/* ==========================================================================
   Tally Counter - page-scoped styles. Prefix: .tc-
   Uses the Venuera design tokens (see DESIGN-SYSTEM.md).
   ========================================================================== */

.tc-hero {
	padding: calc(var(--header-h) + 72px) 0 40px;
	background: radial-gradient(900px 400px at 50% -10%, var(--paper-tint), transparent 70%), var(--paper);
}
.tc-hero-meta { color: var(--muted); margin-top: 18px; }

/* ==========================================================================
   Board (dark) - the app surface
   ========================================================================== */
.tc-board-section { position: relative; padding-top: 56px; padding-bottom: 64px; }
.tc-board { position: relative; }

/* ---- toolbar ---- */
.tc-bar {
	display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
	margin-bottom: 20px;
}
.tc-bar-sp { flex: 1 1 22px; }

.tc-btn {
	appearance: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
	background: var(--ink-850); color: var(--d-text); border: 1px solid var(--d-line);
	font: 600 13px var(--body); padding: 9px 14px; border-radius: var(--r-sm);
	transition: background .15s, color .15s, border-color .15s, transform .08s;
	white-space: nowrap;
}
.tc-btn:hover { background: var(--ink-800); color: var(--d-head); border-color: var(--d-line-2); }
.tc-btn:active { transform: translateY(1px); }
.tc-btn svg { width: 15px; height: 15px; flex: none; }
.tc-btn[disabled] { opacity: .4; cursor: default; }
.tc-btn[disabled]:hover { background: var(--ink-850); color: var(--d-text); }
.tc-btn-primary { background: var(--violet); border-color: transparent; color: #fff; }
.tc-btn-primary:hover { background: var(--violet-l); border-color: transparent; color: #fff; }
.tc-btn.is-on {
	background: color-mix(in srgb, var(--violet) 26%, var(--ink-850));
	border-color: color-mix(in srgb, var(--violet) 55%, transparent); color: var(--d-head);
}
.tc-btn-ic { padding: 9px 11px; }

.tc-menu-wrap { position: relative; }
.tc-pop {
	position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; min-width: 232px;
	background: #17132A; border: 1px solid var(--d-line-2); border-radius: var(--r);
	box-shadow: 0 22px 50px rgba(4, 2, 12, .6); padding: 8px; display: none;
}
.tc-pop.is-open { display: block; }
.tc-pop-r { left: auto; right: 0; }
/* card menu: portalled to <body> and pinned to the viewport by JS, so the dark
   board section cannot clip it. Scrolls itself if the screen is too short. */
.tc-pop.tc-pop-float {
	position: fixed; top: 0; left: 0; z-index: 800;
	max-height: calc(100vh - 20px); overflow-y: auto; overscroll-behavior: contain;
}
.tc-pop-k {
	font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .08em;
	color: var(--d-faint); padding: 8px 10px 6px; margin: 0;
}
.tc-pop-item {
	appearance: none; width: 100%; text-align: left; cursor: pointer; background: none; border: 0;
	color: var(--d-text); font: 500 13.5px var(--body); padding: 9px 10px; border-radius: 8px;
	display: flex; align-items: center; gap: 10px;
}
.tc-pop-item:hover { background: var(--ink-800); color: var(--d-head); }
.tc-pop-item small { color: var(--d-faint); font-size: 11.5px; margin-left: auto; font-family: var(--mono); }
.tc-pop-item.is-danger:hover { background: rgba(180, 35, 31, .22); color: #FFD9D7; }
.tc-pop-sep { height: 1px; background: var(--d-line); margin: 6px 4px; border: 0; }
.tc-pop-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; }
.tc-pop-row label { font: 500 12.5px var(--body); color: var(--d-muted); flex: 1; }
.tc-pop-row input {
	width: 84px; background: var(--ink-900); border: 1px solid var(--d-line-2); color: var(--d-head);
	font: 600 13px var(--mono); padding: 7px 9px; border-radius: 8px;
}
.tc-pop-row input:focus { outline: 2px solid var(--violet); outline-offset: 1px; }
.tc-swatches { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 10px 10px; }
.tc-sw {
	width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer;
	padding: 0; appearance: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}
.tc-sw.is-sel { border-color: #fff; }

/* ---- capacity / totals strip ---- */
.tc-top {
	background: var(--ink-850); border: 1px solid var(--d-line); border-radius: var(--r);
	padding: 20px 22px; margin-bottom: 20px;
	display: grid; grid-template-columns: minmax(200px, 260px) 1fr; gap: 22px 28px; align-items: center;
}
.tc-total-k {
	font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .08em;
	color: var(--d-faint); margin: 0 0 6px;
}
.tc-total-v {
	font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; line-height: 1;
	font-size: clamp(40px, 5.2vw, 60px); color: var(--d-head);
	font-variant-numeric: tabular-nums; display: block;
}
.tc-total-note { display: block; margin-top: 8px; font-size: 12.5px; color: var(--d-muted); }

.tc-capwrap { min-width: 0; }
.tc-cap-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tc-cap-pct {
	font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--d-head);
	letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.tc-cap-lab { font-size: 13px; color: var(--d-muted); }
.tc-cap-lab b { color: var(--d-head); font-weight: 600; }
.tc-bar-track {
	position: relative; height: 14px; border-radius: 999px; overflow: hidden;
	background: var(--ink-900); box-shadow: inset 0 0 0 1px var(--d-line);
	display: flex;
}
.tc-bar-seg { height: 100%; transition: width .22s cubic-bezier(.2, .8, .3, 1); }
.tc-bar-mark {
	position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--amber);
	opacity: .85; border-radius: 2px;
}
.tc-cap-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.tc-cap-row label { font: 500 12.5px var(--body); color: var(--d-muted); }
.tc-cap-row input {
	width: 110px; background: var(--ink-900); border: 1px solid var(--d-line-2); color: var(--d-head);
	font: 600 13px var(--mono); padding: 8px 10px; border-radius: 8px;
}
.tc-cap-row input:focus { outline: 2px solid var(--violet); outline-offset: 1px; }
.tc-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.tc-chip {
	display: inline-flex; align-items: baseline; gap: 6px; background: var(--ink-800);
	border-radius: 999px; padding: 6px 12px; font-size: 12.5px; color: var(--d-muted);
}
.tc-chip b { font-family: var(--display); font-size: 14px; color: var(--d-head); font-variant-numeric: tabular-nums; }
.tc-chip.is-warn { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 55%, transparent); }
.tc-chip.is-warn b { color: var(--amber); }

.tc-top.is-full .tc-total-v { color: var(--amber); }

/* ---- counter grid ---- */
.tc-grid {
	display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 16px;
}
.tc-card {
	--tc-c: var(--violet);
	position: relative; background:
		radial-gradient(120% 90% at 50% -20%, color-mix(in srgb, var(--tc-c) 20%, transparent), transparent 68%),
		var(--ink-850);
	border: 1px solid var(--d-line); border-radius: var(--r); overflow: hidden;
	display: flex; flex-direction: column; min-height: 208px;
	transition: border-color .18s, box-shadow .18s, transform .12s;
}
.tc-card::before {
	content: ''; position: absolute; inset: 0 0 auto; height: 3px;
	background: linear-gradient(90deg, var(--tc-c), color-mix(in srgb, var(--tc-c) 30%, transparent));
}
.tc-card.is-active {
	border-color: color-mix(in srgb, var(--tc-c) 58%, transparent);
	box-shadow: 0 0 0 1px color-mix(in srgb, var(--tc-c) 34%, transparent), 0 18px 40px rgba(4, 2, 12, .45);
}
.tc-card.is-pop { transform: scale(.985); }

.tc-card-top { display: flex; align-items: center; gap: 6px; padding: 14px 12px 0 16px; position: relative; z-index: 3; }
.tc-name {
	flex: 1; min-width: 0; background: none; border: 0; border-radius: 7px; padding: 4px 6px;
	color: var(--d-head); font: 600 14.5px var(--body); text-overflow: ellipsis;
}
.tc-name:hover { background: rgba(255, 255, 255, .05); }
.tc-name:focus { outline: 2px solid var(--violet); outline-offset: 0; background: var(--ink-900); }
.tc-sign {
	font: 600 10px var(--mono); text-transform: uppercase; letter-spacing: .06em;
	color: var(--d-faint); background: var(--ink-800); border-radius: 999px; padding: 4px 8px; flex: none;
}
.tc-kbd {
	font: 600 10.5px var(--mono); color: var(--d-faint); background: var(--ink-800);
	border: 1px solid var(--d-line); border-radius: 6px; padding: 2px 6px; flex: none;
}
.tc-dots {
	appearance: none; cursor: pointer; background: none; border: 0; color: var(--d-faint);
	padding: 5px 6px; border-radius: 7px; line-height: 0; flex: none;
}
.tc-dots:hover { background: var(--ink-800); color: var(--d-head); }
.tc-dots svg { width: 16px; height: 16px; }

.tc-hit {
	appearance: none; border: 0; background: none; cursor: pointer; flex: 1;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
	padding: 4px 12px 8px; position: relative; overflow: hidden;
	-webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none;
}
.tc-hit:focus-visible { outline: 2px solid var(--violet); outline-offset: -4px; border-radius: var(--r-sm); }
.tc-val {
	font-family: var(--display); font-weight: 700; letter-spacing: -0.035em; line-height: .95;
	font-size: clamp(46px, 5vw, 62px); color: var(--d-head); font-variant-numeric: tabular-nums;
}
.tc-card.is-lit .tc-val { color: var(--tc-c); }
.tc-plus {
	font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .1em;
	color: color-mix(in srgb, var(--tc-c) 82%, #fff); opacity: .9;
}
.tc-fly {
	position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
	font: 700 20px var(--display); color: var(--tc-c); pointer-events: none;
	animation: tcFly .62s cubic-bezier(.2, .8, .3, 1) forwards;
}
@keyframes tcFly {
	0% { opacity: 0; transform: translate(-50%, 6px) scale(.8); }
	22% { opacity: 1; }
	100% { opacity: 0; transform: translate(-50%, -58px) scale(1.05); }
}
.tc-ripple {
	position: absolute; border-radius: 50%; pointer-events: none;
	background: radial-gradient(circle, color-mix(in srgb, var(--tc-c) 42%, transparent), transparent 70%);
	animation: tcRip .5s ease-out forwards;
}
@keyframes tcRip {
	from { opacity: .85; transform: scale(.2); }
	to { opacity: 0; transform: scale(1); }
}

.tc-card-foot {
	display: flex; align-items: center; gap: 8px; padding: 0 12px 12px 12px; position: relative; z-index: 3;
}
.tc-minus {
	appearance: none; cursor: pointer; background: var(--ink-800); color: var(--d-text);
	border: 1px solid var(--d-line); border-radius: 999px; min-width: 46px; height: 32px;
	font: 700 15px var(--body); line-height: 1; transition: background .14s, color .14s;
}
.tc-minus:hover { background: #251F42; color: var(--d-head); }
.tc-meta { font: 500 11.5px var(--mono); color: var(--d-faint); margin-left: auto; }
.tc-tprog { position: relative; height: 5px; border-radius: 999px; background: var(--ink-900); flex: 1 1 40px; overflow: hidden; }
.tc-tprog i { display: block; height: 100%; background: var(--tc-c); border-radius: 999px; transition: width .22s; }

.tc-add {
	appearance: none; cursor: pointer; min-height: 124px; border-radius: var(--r);
	border: 1px dashed var(--d-line-2); background: rgba(255, 255, 255, .015); color: var(--d-muted);
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
	font: 600 13.5px var(--body); transition: border-color .16s, color .16s, background .16s;
}
.tc-add:hover { border-color: var(--violet); color: var(--d-head); background: rgba(124, 92, 255, .07); }
.tc-add svg { width: 22px; height: 22px; }

.tc-hint-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 22px; font-size: 12.5px; color: var(--d-faint); }
.tc-hint-row kbd {
	font: 600 11px var(--mono); background: var(--ink-800); border: 1px solid var(--d-line);
	border-bottom-width: 2px; border-radius: 5px; padding: 2px 6px; color: var(--d-text);
}
.tc-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- focus (door) mode ---- */
.tc-focus {
	position: fixed; inset: 0; z-index: 900; display: none;
	background: radial-gradient(120% 100% at 50% 0%, #171327, #06050D 72%);
	flex-direction: column;
}
.tc-focus.is-open { display: flex; }
body.tc-focus-open { overflow: hidden; }
.tc-focus-top {
	display: flex; align-items: center; gap: 12px; padding: 16px 20px;
	border-bottom: 1px solid var(--d-line);
}
.tc-focus-name { font: 600 16px var(--body); color: var(--d-head); }
.tc-focus-pick {
	appearance: none; background: var(--ink-850); color: var(--d-head); border: 1px solid var(--d-line);
	border-radius: var(--r-sm); font: 600 13px var(--body); padding: 8px 12px; cursor: pointer;
}
.tc-focus-hit {
	flex: 1; appearance: none; border: 0; background: none; cursor: pointer; position: relative;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
	touch-action: manipulation; user-select: none; -webkit-tap-highlight-color: transparent;
	overflow: hidden;
}
.tc-focus-val {
	font-family: var(--display); font-weight: 700; letter-spacing: -0.045em; line-height: .9;
	font-size: clamp(90px, 26vw, 320px); color: var(--d-head); font-variant-numeric: tabular-nums;
}
.tc-focus-sub { font: 600 12px var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--d-faint); }
.tc-focus-foot {
	display: flex; align-items: center; justify-content: center; gap: 12px; padding: 18px 20px 26px;
	border-top: 1px solid var(--d-line);
}
.tc-focus-minus {
	appearance: none; cursor: pointer; background: var(--ink-850); color: var(--d-head);
	border: 1px solid var(--d-line-2); border-radius: 999px; width: 74px; height: 56px;
	font: 700 24px var(--body); line-height: 1;
}
.tc-focus-cap { font-size: 13px; color: var(--d-muted); }

/* ==========================================================================
   Light sections
   ========================================================================== */
.tc-keys { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 26px; margin: 0; }
.tc-keys div { display: flex; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tc-keys dt { flex: none; }
.tc-keys dd { margin: 0; font-size: 14px; color: var(--text); }
.tc-keys kbd {
	font: 600 11.5px var(--mono); background: var(--paper-soft); border: 1px solid var(--line-2);
	border-bottom-width: 2px; border-radius: 6px; padding: 3px 7px; color: var(--ink);
}

.tc-cross { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }

/* ==========================================================================
   Print sheet (screen-hidden; the only thing that prints)
   ========================================================================== */
.tc-sheet { display: none; }
.tc-sheet-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.tc-sheet-tab { width: 100%; border-collapse: collapse; margin-top: 18px; }
.tc-sheet-tab th, .tc-sheet-tab td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #DBDBE7; }
.tc-sheet-tab td.n, .tc-sheet-tab th.n { text-align: right; font-family: var(--mono); }
.tc-sheet-tab tr.tot td, .tc-sheet-tab tr.tot th { border-top: 2px solid #14121F; border-bottom: 0; font-weight: 700; }
.tc-sheet-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.tc-sheet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 20px; }
.tc-sheet-cell { border: 1px solid #DBDBE7; border-radius: 10px; padding: 12px 14px; }
.tc-sheet-cell b { display: block; font-family: var(--display); font-size: 22px; color: #14121F; }
.tc-sheet-cell span { font-size: 11.5px; color: #74748A; }
.tc-sheet-note { margin-top: 22px; font-size: 11.5px; color: #74748A; }

@media print {
	@page { margin: 14mm 12mm 16mm; }

	/* Print ONLY the tally sheet. Live sites inject floating widgets (chat
	   bubble, cookie bar, scroll-to-top, accessibility button) as body-level
	   fixed elements that otherwise bleed into the PDF - hiding every body
	   child except the sheet kills all of them at once, whatever the plugin. */
	body > *:not(.tc-sheet) { display: none !important; }

	html, body { background: #fff !important; }
	.tc-sheet {
		display: block !important; color: #14121F; font-family: var(--body);
	}
	.tc-sheet h1 { font-family: var(--display); font-size: 26px; letter-spacing: -0.02em; margin: 0 0 4px; }
	.tc-sheet .tc-sheet-sub { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #74748A; margin: 0; }
	.tc-sheet-brand { font-family: var(--display); font-weight: 700; font-size: 15px; color: #5236D8; }
	.tc-sheet-tab, .tc-sheet-grid { break-inside: avoid; }
	* { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 980px) {
	.tc-top { grid-template-columns: 1fr; }
	.tc-keys, .tc-cross { grid-template-columns: 1fr; }
	.tc-chips { margin-left: 0; }
}
@media (max-width: 560px) {
	.tc-board-section { padding-top: 40px; }
	.tc-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
	.tc-card { min-height: 176px; }
	.tc-add { min-height: 112px; }
	/* A phone has no number row to press and no keyboard to shortcut with, so
	   the badge and the shortcut legend give their space back to the name. */
	.tc-kbd, .tc-hint-row { display: none; }
	.tc-card-top { gap: 4px; padding: 12px 8px 0 12px; }
	.tc-name { font-size: 14px; padding: 4px 4px; }
	.tc-sign { font-size: 9.5px; padding: 3px 6px; letter-spacing: .04em; }
	.tc-val { font-size: clamp(38px, 13vw, 54px); }
	.tc-bar .tc-btn span.tc-lab { display: none; }
	.tc-bar .tc-btn { padding: 9px 11px; }
	.tc-bar .tc-btn-primary span.tc-lab { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
	.tc-fly, .tc-ripple { animation: none; display: none; }
	.tc-card, .tc-bar-seg, .tc-tprog i { transition: none; }
}
