/**
 * TB POS — Screen layouts
 * Dashboard, POS, VIP, KDS, Events, Inventory, Reports, Settings, Customer VIP
 */

/* ------------------------------------------------------------------ Dashboard */

.tb-dash-ops {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: var(--tb-space-4);
	margin-top: var(--tb-space-4);
}

.tb-dash-lower {
	display: grid;
	grid-template-columns: 2fr 1fr 1fr;
	gap: var(--tb-space-4);
	margin-top: var(--tb-space-6);
}

.tb-activity-item {
	display: flex;
	gap: var(--tb-space-3);
	padding: var(--tb-space-3) 0;
	border-bottom: 1px solid var(--tb-border);
}

.tb-activity-item:last-child {
	border-bottom: none;
}

.tb-activity-item__time {
	font-size: var(--tb-text-label);
	color: var(--tb-text-secondary);
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ POS */

.tb-pos {
	display: grid;
	grid-template-columns: 180px 1fr minmax(360px, 420px);
	height: 100%;
	min-height: 0;
	background: var(--tb-bg);
}

.tb-pos__cats {
	background: var(--tb-surface);
	border-right: 1px solid var(--tb-border);
	padding: var(--tb-space-3);
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: var(--tb-space-1);
}

.tb-pos__cat {
	min-height: var(--tb-touch-pref);
	padding: 0 var(--tb-space-3);
	border: none;
	border-radius: var(--tb-radius-md);
	background: transparent;
	text-align: left;
	font-weight: 600;
	font-size: var(--tb-text-sm);
	color: var(--tb-text-secondary);
	cursor: pointer;
}

.tb-pos__cat:hover {
	background: var(--tb-surface-alt);
	color: var(--tb-text-primary);
}

.tb-pos__cat.is-active {
	background: var(--tb-teal-wash);
	color: var(--tb-teal);
}

.tb-pos__main {
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
}

.tb-pos__toolbar {
	display: flex;
	align-items: center;
	gap: var(--tb-space-3);
	padding: var(--tb-space-3) var(--tb-space-4);
	background: var(--tb-surface);
	border-bottom: 1px solid var(--tb-border);
	flex-wrap: wrap;
}

/* Pushed to the end of the toolbar, and first to drop to its own line when the
   order types wrap. */
.tb-pos__textsize {
	margin-left: auto;
}

.tb-pos__grid {
	flex: 1;
	overflow: auto;
	padding: var(--tb-space-4);
	display: grid;
	/* The track minimum scales with the text, so larger type means fewer,
	   wider tiles rather than the same narrow tiles with the words breaking
	   apart. min() keeps a single tile from exceeding the grid on a phone.

	   180px, not 140px, because the thumbnail takes a fixed 40px plus its gap
	   out of every tile and what is left has to hold a word. At 140px the text
	   column came out near 60px and the grid rendered "Guinness" as
	   "Guinnes / s" — a broken word is harder to read in a dark room than no
	   picture at all. The text-only grid below keeps the narrower track, since
	   there it is all text. */
	grid-template-columns: repeat(auto-fill, minmax(min(100%, calc(180px * var(--tb-font-scale))), 1fr));
	gap: var(--tb-space-3);
	align-content: start;
	/* Rows sized by what is in them.
	 *
	 * A tile is a <button>, and a button grid item does not offer its flex
	 * content's height when the row is being measured — so the row came out
	 * shorter than its tallest card and `overflow: hidden` cropped the rest.
	 * "Kendall-Jackson Vintner's Reserve Chardonnay" lost its price; a cashier
	 * saw a tile with no number on it.
	 *
	 * min-content measures the real thing, and the cards still stretch to the
	 * row so a row of tiles stays level. */
	grid-auto-rows: min-content;
}

.tb-pos__ticket {
	background: var(--tb-surface);
	border-left: 1px solid var(--tb-border);
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.tb-pos__ticket-head {
	padding: var(--tb-space-4);
	border-bottom: 1px solid var(--tb-border);
}

.tb-pos__ticket-title {
	margin: 0;
	font-size: var(--tb-text-md);
	font-weight: 700;
}

.tb-pos__ticket-meta {
	font-size: var(--tb-text-xs);
	color: var(--tb-text-secondary);
	margin-top: 4px;
}

.tb-pos__lines {
	flex: 1;
	overflow: auto;
	padding: var(--tb-space-3) var(--tb-space-4);
}

.tb-pos__line {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: var(--tb-space-3) 0;
	border-bottom: 1px solid var(--tb-border);
	font-size: var(--tb-text-sm);
}

.tb-pos__line-main {
	display: flex;
	justify-content: space-between;
	gap: var(--tb-space-3);
	align-items: flex-start;
}

.tb-pos__line-mods-sum {
	display: block;
	margin-top: 2px;
	font-size: var(--tb-text-label);
	color: var(--tb-text-secondary);
	font-weight: 400;
}

.tb-pos__mods {
	background: var(--tb-surface-alt);
	border-radius: var(--tb-radius-md);
	padding: 10px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.tb-pos__mod-group {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.tb-pos__mod-label {
	font-size: var(--tb-text-label);
	font-weight: 600;
	color: var(--tb-text-secondary);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.tb-pos__mod-option {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	font-size: var(--tb-text-sm);
	cursor: pointer;
	padding: 4px 6px;
	border-radius: var(--tb-radius-sm);
}

.tb-pos__mod-option:hover {
	background: var(--tb-muted-wash);
}

.tb-pos__mod-option input {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	accent-color: var(--tb-teal);
}

.tb-modal--build {
	width: min(520px, 94vw);
	max-height: min(86vh, 720px);
	overflow: auto;
}

.tb-pos__build-body {
	display: flex;
	flex-direction: column;
	gap: 16px;
	margin-bottom: 8px;
}

.tb-pos__build-body .tb-pos__mod-group {
	padding: 12px;
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-md);
	background: var(--tb-surface-alt);
}

.tb-pos__build-body .tb-pos__mod-label {
	margin-bottom: 6px;
	font-size: var(--tb-text-xs);
	color: var(--tb-text-primary);
}

.tb-pos__totals {
	padding: var(--tb-space-4);
	border-top: 1px solid var(--tb-border);
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.tb-pos__total-row {
	display: flex;
	justify-content: space-between;
	font-size: var(--tb-text-sm);
	color: var(--tb-text-secondary);
}

.tb-pos__total-row--grand {
	font-size: var(--tb-text-lg);
	font-weight: 700;
	color: var(--tb-text-primary);
	margin-top: 4px;
}

.tb-pos__pay {
	margin-top: var(--tb-space-3);
}

/* ------------------------------------------------------------------ Tables floor */

.tb-floor {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: var(--tb-space-4);
}

.tb-table-tile {
	background: var(--tb-surface);
	border: 2px solid var(--tb-border);
	border-radius: var(--tb-radius-lg);
	padding: var(--tb-space-3);
	min-height: 120px;
	display: flex;
	flex-direction: column;
	gap: var(--tb-space-2);
	text-align: left;
}

.tb-table-tile__main {
	appearance: none;
	background: transparent;
	border: 0;
	padding: var(--tb-space-1);
	cursor: pointer;
	text-align: left;
	display: flex;
	flex-direction: column;
	gap: var(--tb-space-2);
	flex: 1;
	font: inherit;
	color: inherit;
	width: 100%;
}

.tb-table-tile__name {
	font-weight: 700;
	font-size: var(--tb-text-body);
}

.tb-table-tile__status {
	font-size: var(--tb-text-label);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.tb-table-tile__detail {
	font-size: var(--tb-text-xs);
	color: var(--tb-text-secondary);
	margin-top: auto;
}

.tb-table-tile--available {
	border-color: var(--tb-border);
}

.tb-table-tile--available .tb-table-tile__status {
	color: var(--tb-success-text);
}

.tb-table-tile--occupied {
	border-color: var(--tb-teal);
	background: var(--tb-teal-wash);
}

.tb-table-tile--occupied .tb-table-tile__status {
	color: var(--tb-info-text);
}

.tb-table-tile--ready {
	border-color: var(--tb-success);
	background: var(--tb-success-wash);
}

.tb-table-tile--ready .tb-table-tile__status {
	color: var(--tb-success-text);
}

.tb-table-tile--check {
	border-color: var(--tb-warning);
	background: var(--tb-warning-wash);
}

.tb-table-tile--check .tb-table-tile__status {
	color: var(--tb-warning-text);
}

/* ------------------------------------------------------------------ VIP ops */

.tb-vip-board {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: var(--tb-space-4);
}

.tb-vip-progress {
	display: flex;
	gap: var(--tb-space-2);
	margin-bottom: var(--tb-space-6);
}

.tb-vip-progress__step {
	flex: 1;
	text-align: center;
	padding: var(--tb-space-3);
	border-radius: var(--tb-radius-md);
	background: var(--tb-surface-alt);
	font-size: var(--tb-text-label);
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--tb-text-secondary);
	position: relative;
}

.tb-vip-progress__step.is-active {
	background: var(--tb-teal);
	color: var(--tb-text-on-teal);
}

.tb-vip-progress__step.is-done {
	background: var(--tb-teal-wash);
	color: var(--tb-teal);
}

/* ------------------------------------------------------------------ Customer VIP */

.tb-customer {
	min-height: 100vh;
	background: linear-gradient(180deg, var(--tb-white) 0%, var(--tb-shell-cream) 100%);
	color: var(--tb-text-primary);
	font-family: var(--tb-font);
	padding: var(--tb-space-6) var(--tb-space-4) var(--tb-space-10);
	display: flex;
	flex-direction: column;
	align-items: center;
}

.tb-customer__inner {
	width: min(480px, 100%);
}

.tb-customer__logo {
	display: flex;
	justify-content: center;
	margin-bottom: var(--tb-space-6);
}

.tb-customer__module {
	text-align: center;
	font-size: var(--tb-text-xs);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--tb-deep-rose);
	margin-bottom: var(--tb-space-2);
}

.tb-customer__event {
	text-align: center;
	font-size: var(--tb-text-4xl);
	font-weight: 700;
	letter-spacing: -0.03em;
	margin: 0 0 var(--tb-space-2);
}

.tb-customer__tier {
	text-align: center;
	margin: 0 0 var(--tb-space-6);
}

.tb-customer__package {
	background: var(--tb-white);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-lg);
	padding: var(--tb-space-5);
	margin-bottom: var(--tb-space-6);
}

.tb-customer__package h2 {
	margin: 0 0 var(--tb-space-3);
	font-size: var(--tb-text-sm);
	font-weight: 600;
	color: var(--tb-text-secondary);
}

.tb-customer__package ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tb-customer__package li {
	padding: 10px 0;
	border-bottom: 1px solid var(--tb-border);
	font-weight: 600;
}

.tb-customer__package li:last-child {
	border-bottom: none;
}

.tb-customer__confirm {
	text-align: center;
}

.tb-customer__confirm-icon {
	width: 64px;
	height: 64px;
	margin: 0 auto var(--tb-space-4);
	border-radius: 50%;
	background: var(--tb-success-wash);
	color: var(--tb-success-text);
	display: flex;
	align-items: center;
	justify-content: center;
}

.tb-mixer-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--tb-space-3);
	padding: var(--tb-space-3) 0;
	border-bottom: 1px solid var(--tb-border);
}

.tb-mixer-row:last-child {
	border-bottom: none;
}

.tb-pickup {
	min-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: var(--tb-space-8) var(--tb-space-6);
	background: var(--tb-bg);
}

.tb-pickup__header {
	display: flex;
	align-items: center;
	gap: var(--tb-space-3);
	margin-bottom: var(--tb-space-8);
}

.tb-pickup__title {
	font-size: var(--tb-text-3xl);
	font-weight: 700;
	margin: 0;
	transition: color 140ms linear;
}

/* ------------------------------------------------------ Verdict, screen-wide
 *
 * The verdict is carried on the pickup root, not on the scan panel alone, so
 * the two largest things on the screen answer together: the TB VIP wordmark at
 * the top and the frame the operator just scanned into. From behind a bar the
 * title is the part visible over a customer's shoulder.
 *
 * The status word next to it is not decoration. Colour on its own is not a
 * message — the word is what makes this readable to somebody who cannot tell
 * the green from the red, and to anybody glancing back after the pulse. */

.tb-pickup.is-verdict-ok .tb-pickup__title {
	color: var(--tb-success-text);
}

.tb-pickup.is-verdict-bad .tb-pickup__title {
	color: var(--tb-danger-text);
}

.tb-pickup.is-verdict-warn .tb-pickup__title {
	color: var(--tb-warning-text);
}

.tb-pickup__verdict {
	display: none;
	margin: 6px 0 0;
	padding: 4px 12px;
	border-radius: 999px;
	font-size: var(--tb-text-label);
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	white-space: nowrap;
}

.tb-pickup.is-verdict-ok .tb-pickup__verdict,
.tb-pickup.is-verdict-bad .tb-pickup__verdict,
.tb-pickup.is-verdict-warn .tb-pickup__verdict {
	display: inline-block;
}

.tb-pickup.is-verdict-ok .tb-pickup__verdict {
	background: var(--tb-success-wash);
	color: var(--tb-success-text);
}

.tb-pickup.is-verdict-bad .tb-pickup__verdict {
	background: var(--tb-danger-wash);
	color: var(--tb-danger-text);
}

.tb-pickup.is-verdict-warn .tb-pickup__verdict {
	background: var(--tb-warning-wash);
	color: var(--tb-warning-text);
}

.tb-pickup__scan {
	width: min(420px, 100%);
	aspect-ratio: 1;
	border: 2px dashed var(--tb-border-strong);
	border-radius: var(--tb-radius-lg);
	background: var(--tb-surface);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--tb-space-3);
	color: var(--tb-text-secondary);
	margin-bottom: var(--tb-space-6);
	position: relative;
	transition: border-color 120ms linear, background 120ms linear;
}

/* ------------------------------------------------------------- Scan verdict
 *
 * The result has to be readable from arm's length, by somebody already turning
 * away to reach for a bottle. Colour is the fastest signal there is — but it
 * is never the ONLY one here: the panel text, the toast and (for a duplicate)
 * the refusal panel all say the same thing in words, because roughly one man
 * in twelve cannot reliably separate the green from the red.
 *
 * Two slow pulses, not a strobe. WCAG 2.3.1 caps flashing at three per second
 * for photosensitivity, and a till facing a room full of people is exactly
 * where that matters.
 */

/* The pulse is a RING around the panel, not a wash over it.
 *
 * Filling the panel with the status colour at peak opacity put green text on a
 * green ground for a quarter of a second at a time — the most visible moment
 * of the signal was the least readable. The ring is louder from across a bar
 * and never touches the words. */
.tb-pickup__scan::after {
	content: "";
	position: absolute;
	inset: -3px;
	border-radius: inherit;
	pointer-events: none;
	border: 5px solid currentColor;
	opacity: 0;
}

.tb-pickup.is-verdict-ok .tb-pickup__scan {
	border-style: solid;
	border-color: var(--tb-success);
	background: var(--tb-success-wash);
	color: var(--tb-success-text);
}

.tb-pickup.is-verdict-bad .tb-pickup__scan {
	border-style: solid;
	border-color: var(--tb-danger);
	background: var(--tb-danger-wash);
	color: var(--tb-danger-text);
}

/* Neither collected nor a duplicate — a balance owing, or before event day.
   Calling that red would say "this guest already took it", which is a
   different and much worse thing to tell a bartender. */
.tb-pickup.is-verdict-warn .tb-pickup__scan {
	border-style: solid;
	border-color: var(--tb-warning);
	background: var(--tb-warning-wash);
	color: var(--tb-warning-text);
}

.tb-pickup.is-verdict-ok .tb-pickup__scan::after,
.tb-pickup.is-verdict-bad .tb-pickup__scan::after,
.tb-pickup.is-verdict-warn .tb-pickup__scan::after {
	animation: tb-scan-pulse 1.1s ease-out 2;
}

@keyframes tb-scan-pulse {
	0% {
		opacity: 0;
		transform: scale(1);
	}
	18% {
		opacity: 1;
		transform: scale(1);
	}
	100% {
		opacity: 0;
		transform: scale(1.025);
	}
}

/* Reduced motion keeps the verdict and drops the pulse: the wash and a steady
   ring carry the same information without anything flashing. */
@media (prefers-reduced-motion: reduce) {
	.tb-pickup.is-verdict-ok .tb-pickup__scan::after,
	.tb-pickup.is-verdict-bad .tb-pickup__scan::after,
	.tb-pickup.is-verdict-warn .tb-pickup__scan::after {
		animation: none;
		opacity: 1;
		transform: none;
	}
}

.tb-pickup__or {
	text-align: center;
	color: var(--tb-text-secondary);
	font-size: var(--tb-text-xs);
	font-weight: 600;
	margin: var(--tb-space-4) 0;
}

/* ------------------------------------------------------------------ KDS */

.tb-kds {
	min-height: 100%;
	background: var(--tb-kds-bg);
	color: var(--tb-white);
	display: flex;
	flex-direction: column;
}

.tb-kds__header {
	height: 72px;
	display: flex;
	align-items: center;
	gap: var(--tb-space-4);
	padding: 0 var(--tb-space-6);
	border-bottom: 1px solid var(--tb-kds-rule);
	flex-shrink: 0;
}

.tb-kds__brand {
	display: flex;
	align-items: center;
	gap: var(--tb-space-3);
	font-size: var(--tb-text-lg);
	font-weight: 700;
}

.tb-kds__station {
	font-size: var(--tb-text-md);
	font-weight: 600;
	color: var(--tb-kds-text-muted);
}

.tb-kds__modes {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-left: 16px;
}

.tb-kds__kiosk-badge {
	font-size: var(--tb-text-badge);
	font-weight: 700;
	letter-spacing: 0.08em;
	padding: 4px 8px;
	border: 1px solid var(--tb-kds-chip-border);
	color: var(--tb-kds-text-muted);
	border-radius: 4px;
}

.tb-kds__dual {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	padding: 20px;
	align-items: stretch;
	flex: 1;
	min-height: 0;
	overflow: hidden;
}

.tb-kds__dual > section {
	display: flex;
	flex-direction: column;
	min-height: 0;
	min-width: 0;
}

.tb-kds__panel-title {
	margin: 0 0 12px;
	font-size: var(--tb-text-lg);
	font-weight: 600;
	color: var(--tb-kds-text-muted);
	flex-shrink: 0;
}

.tb-kds__lane {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	padding: var(--tb-space-6);
}

.tb-kds__dual .tb-kds__lane {
	padding: 0;
}

.tb-kds__board {
	flex: 1;
	min-height: 0;
	display: grid;
	/* Cards flow ACROSS and then down. At 320px minimum a half-width lane on a
	   1280 or 1366 screen — the two commonest till and TV sizes — resolved to a
	   single column, so tickets only ever went downwards and straight off the
	   bottom. 260px gives two columns there and still three on a 2560 board.
	   The min() guard stops a card wider than its lane from forcing overflow
	   on a narrow screen. */
	grid-template-columns: repeat(auto-fill, minmax(min(var(--tb-kds-card-min), 100%), 1fr));
	grid-auto-flow: row;
	/* Rows size to their content instead of stretching to fill the board, so
	   a lane holding two short orders does not blow them up to half-screen
	   each and push everything else out of view. */
	grid-auto-rows: min-content;
	gap: var(--tb-space-5);
	align-content: start;
	justify-items: stretch;
	overflow: hidden;
}

.tb-kds__dual .tb-kds__board {
	padding: 0;
}

.tb-kds__board .tb-kitchen-card.is-kds-offpage {
	display: none !important;
}

.tb-kds__pager {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 12px;
	padding-top: 12px;
	margin-top: 4px;
	border-top: 1px solid var(--tb-kds-rule);
}

.tb-kds__pager[hidden] {
	display: none !important;
}

.tb-kds__pager-label {
	font-size: var(--tb-text-xs);
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var(--tb-kds-text-muted);
	min-width: 5.5rem;
	text-align: center;
}

.tb-kds .tb-kitchen-card {
	background: var(--tb-kds-surface);
	border-color: var(--tb-kds-border);
	color: var(--tb-white);
	min-height: var(--tb-kds-card-h);
	padding: var(--tb-space-5);
}

.tb-kds .tb-kitchen-card__timer {
	font-size: var(--tb-text-4xl);
}

.tb-kds .tb-card-id {
	color: var(--tb-kds-text-dim);
	font-size: var(--tb-text-body);
}

.tb-kds .tb-btn--primary {
	color: var(--tb-text-on-teal);
}

.tb-kds a.tb-btn--primary,
.tb-kds a.tb-btn--primary:hover,
.tb-kds a.tb-btn--primary:visited {
	color: var(--tb-text-on-teal) !important;
}

.tb-kds .tb-btn--ghost {
	color: var(--tb-kds-text-muted);
}

.tb-kds .tb-btn--ghost:hover {
	background: var(--tb-kds-chip);
	color: var(--tb-white);
}

.tb-kds .tb-btn--secondary {
	background: var(--tb-kds-chip-hover);
	border-color: var(--tb-kds-chip-border);
	color: var(--tb-white);
}

/* ------------------------------------------------------------------ Settings */

.tb-settings-layout {
	display: grid;
	grid-template-columns: 220px 1fr;
	gap: var(--tb-space-6);
	align-items: start;
}

.tb-settings-nav {
	background: var(--tb-surface);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-lg);
	padding: var(--tb-space-2);
	position: sticky;
	top: 0;
}

.tb-settings-nav__item {
	display: block;
	width: 100%;
	text-align: left;
	min-height: 44px;
	padding: 0 var(--tb-space-3);
	border: none;
	border-radius: var(--tb-radius-sm);
	background: transparent;
	font-weight: 600;
	font-size: var(--tb-text-sm);
	color: var(--tb-text-secondary);
	cursor: pointer;
}

.tb-settings-nav__item:hover {
	background: var(--tb-surface-alt);
	color: var(--tb-text-primary);
}

.tb-settings-nav__item.is-active {
	background: var(--tb-teal-wash);
	color: var(--tb-teal);
}

.tb-settings-section {
	display: flex;
	flex-direction: column;
	gap: var(--tb-space-4);
}

.tb-settings-section [data-tb-settings-panel][hidden] {
	display: none !important;
}

.tb-settings-section [data-tb-settings-panel] {
	margin-top: 0 !important;
}

.tb-form-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--tb-space-4);
}

.tb-form-grid .tb-field--full {
	grid-column: 1 / -1;
}

/* ------------------------------------------------------------------ Billing */

.tb-billing {
	display: flex;
	flex-direction: column;
	gap: var(--tb-space-5);
}

.tb-billing__status {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--tb-space-4);
	padding: var(--tb-space-4) var(--tb-space-5);
	border-radius: var(--tb-radius-lg);
	background: var(--tb-surface);
	border: 1px solid var(--tb-border);
	box-shadow: var(--tb-shadow-sm);
}

.tb-billing__status-main {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 12px;
	min-width: 0;
}

.tb-billing__status-label {
	font-size: var(--tb-text-badge);
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--tb-muted);
}

.tb-billing__status-copy {
	flex: 1 1 100%;
	margin: 0;
	max-width: 52ch;
	font-size: var(--tb-text-sm);
	line-height: 1.5;
	color: var(--tb-text-secondary);
}

.tb-billing__status-action {
	flex-shrink: 0;
	padding-top: 2px;
}

.tb-billing__metrics {
	margin: 0;
}

.tb-billing__jump {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.tb-billing__jump-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border-radius: var(--tb-radius-md);
	border: 1px solid var(--tb-border);
	background: var(--tb-surface-solid);
	color: var(--tb-text-primary);
	font-size: var(--tb-text-xs);
	font-weight: 500;
	letter-spacing: 0.02em;
	text-decoration: none;
	transition: border-color var(--tb-duration) var(--tb-ease), background var(--tb-duration) var(--tb-ease);
}

.tb-billing__jump-link:hover {
	border-color: var(--tb-border-gold);
	background: var(--tb-surface);
	color: var(--tb-text-primary);
}

.tb-billing__jump-link span {
	font-variant-numeric: tabular-nums;
	color: var(--tb-shell-gold-deep);
	font-weight: 600;
}

.tb-billing__meta {
	margin-top: 2px;
	font-size: var(--tb-text-label);
	color: var(--tb-muted);
}

.tb-billing__panel:target {
	outline: 2px solid var(--tb-border-gold);
	outline-offset: 3px;
}

.tb-billing__layout {
	display: grid;
	grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
	gap: var(--tb-space-5);
	align-items: start;
}

.tb-billing__side {
	display: flex;
	flex-direction: column;
	gap: var(--tb-space-5);
}

.tb-billing__panel {
	margin: 0;
}

.tb-billing__panel .tb-card__header {
	margin-bottom: var(--tb-space-4);
}

.tb-billing__step {
	margin: 0 0 6px;
	font-size: var(--tb-text-badge);
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--tb-shell-gold);
}

.tb-billing__form {
	display: flex;
	flex-direction: column;
	gap: var(--tb-space-4);
}

.tb-billing__form--compact {
	gap: var(--tb-space-3);
}

.tb-billing__form-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding-top: 4px;
}

.tb-billing__checks {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 20px;
	margin-top: 8px;
}

.tb-billing__checks .tb-row {
	align-items: center;
	gap: 8px;
	font-size: var(--tb-text-sm);
	color: var(--tb-text-primary);
}

.tb-billing__divider {
	border: none;
	border-top: 1px solid var(--tb-border);
	margin: var(--tb-space-4) 0;
}

.tb-billing__empty {
	margin: 0;
	padding: var(--tb-space-4) 0;
	color: var(--tb-text-secondary);
	font-size: var(--tb-text-sm);
}

.tb-billing__table th,
.tb-billing__table td {
	vertical-align: top;
}

.tb-billing__id {
	font-family: var(--tb-font);
	font-weight: 600;
	font-size: var(--tb-text-sm);
	letter-spacing: 0.02em;
	color: var(--tb-text-primary);
}

.tb-billing__col-money {
	text-align: right;
	white-space: nowrap;
}

.tb-money {
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum";
	font-weight: 600;
	letter-spacing: 0.01em;
	color: var(--tb-text-primary);
}

.tb-billing__lines {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 160px;
}

.tb-billing__lines li {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	font-size: var(--tb-text-sm);
	line-height: 1.35;
}

.tb-billing__line-label {
	color: var(--tb-text-secondary);
	min-width: 0;
}

.tb-billing__lines .tb-money {
	font-weight: 500;
	color: var(--tb-text-primary);
}

.tb-billing__actions {
	white-space: nowrap;
}

.tb-billing__row-actions {
	display: inline-flex;
	margin: 0;
}

.tb-billing__done {
	color: var(--tb-muted);
	font-size: var(--tb-text-sm);
}

.tb-billing__ops {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--tb-space-5);
	align-items: start;
}

@media (max-width: 1100px) {
	.tb-billing__layout,
	.tb-billing__ops {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 720px) {
	.tb-billing__status {
		flex-direction: column;
	}
}

/* ------------------------------------------------------------------ Reports */

/* ------------------------------------------------------------------ Bar chart
 *
 * Heights arrive as a share of the tallest bar, computed in Components\BarChart.
 * Nothing here invents a minimum: a bar with no sales must not look like trade,
 * which is what a `min-height` on every bar used to do.
 */

.tb-chart {
	display: flex;
	flex-direction: column;
	gap: var(--tb-space-2);
}

.tb-chart__plot {
	height: 240px;
	background: linear-gradient(180deg, var(--tb-teal-wash) 0%, transparent 100%);
	border-radius: var(--tb-radius-md);
	border-bottom: 1px solid var(--tb-border-strong);
	display: flex;
	align-items: flex-end;
	gap: 4px;
	padding: var(--tb-space-4) var(--tb-space-3) 0;
}

.tb-chart__slot {
	flex: 1 1 0;
	min-width: 0;
	height: 100%;
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

/* Capped rather than filling the slot, so a chart with few bars does not turn
   them into slabs. The leftover is air. */
.tb-chart__bar {
	width: 100%;
	max-width: 24px;
	background: var(--tb-teal);
	border-radius: 4px 4px 0 0;
	opacity: 0.85;
	transition: opacity var(--tb-duration) var(--tb-ease);
}

.tb-chart__bar:hover {
	opacity: 1;
}

/* An empty slot is a hairline on the baseline — present, clearly nothing. */
.tb-chart__bar.is-empty {
	height: 2px !important;
	background: var(--tb-border-strong);
	opacity: 1;
	border-radius: 0;
}

.tb-chart__bar.is-peak {
	background: var(--tb-teal-deep);
	opacity: 1;
}

.tb-chart__axis {
	display: flex;
	gap: 4px;
	padding: 0 var(--tb-space-3);
}

.tb-chart__tick {
	flex: 1 1 0;
	min-width: 0;
	text-align: center;
	font-size: var(--tb-text-badge);
	color: var(--tb-text-secondary);
	white-space: nowrap;
}

.tb-chart__tick.is-blank {
	visibility: hidden;
}

.tb-chart__caption {
	margin: 0;
	font-size: var(--tb-text-label);
	color: var(--tb-text-secondary);
}

/* Retained for anything still emitting the old markup. */
.tb-chart-placeholder {
	height: 240px;
	background: linear-gradient(180deg, var(--tb-teal-wash) 0%, transparent 100%);
	border-radius: var(--tb-radius-md);
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: var(--tb-space-4);
	overflow: hidden;
}

.tb-chart-bar {
	flex: 1;
	background: var(--tb-teal);
	border-radius: 4px 4px 0 0;
	opacity: 0.85;
	max-height: 100%;
}

/* ------------------------------------------------------------------ VIP bar tab
 *
 * A guest's phone, held one-handed, in a dark room. The cart sits on top of the
 * page rather than at the bottom of it, because a shelf of thirty bottles means
 * the total would otherwise be a scroll away from the thing being added.
 */

.tb-vipbar {
	padding-bottom: 96px; /* room for the cart bar, so it never covers the last row */
}

.tb-vipbar__heading {
	margin: var(--tb-space-6) 0 var(--tb-space-2);
	font-size: var(--tb-text-sm);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--tb-text-secondary);
}

.tb-vipbar__name {
	font-weight: 600;
}

/* 44px: a thumb, not a mouse pointer. Anything smaller is a mis-tap that costs
 * the guest a bottle they did not want. */
.tb-vipbar__step {
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	font-size: var(--tb-text-lg);
	line-height: 1;
}

.tb-vipbar__qty {
	min-width: 2ch;
	text-align: center;
	font-variant-numeric: tabular-nums;
	font-weight: 700;
	color: var(--tb-text-primary);
}

.tb-mixer-row.is-chosen {
	background: var(--tb-teal-wash);
	border-radius: var(--tb-radius-md);
}

.tb-vipbar__bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 40;
	display: flex;
	align-items: center;
	gap: var(--tb-space-3);
	padding: var(--tb-space-3) var(--tb-space-4);
	/* The safe area, or the Pay button sits under an iPhone's home bar and the
	 * guest cannot press it at all. */
	padding-bottom: calc(var(--tb-space-3) + env(safe-area-inset-bottom, 0px));
	background: var(--tb-surface-solid);
	border-top: 1px solid var(--tb-border);
	box-shadow: var(--tb-shadow-md);
}

.tb-vipbar__bar-sum {
	flex: 1;
	display: flex;
	flex-direction: column;
	color: var(--tb-text-secondary);
	font-size: var(--tb-text-sm);
}

.tb-vipbar__bar-sum strong {
	color: var(--tb-text-primary);
	font-size: var(--tb-text-lg);
	font-variant-numeric: tabular-nums;
}

.tb-vipbar__sheet {
	position: fixed;
	inset: 0;
	z-index: 50;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	background: var(--tb-scrim);
}

.tb-vipbar__sheet-inner {
	width: min(480px, 100%);
	max-height: 90vh;
	overflow-y: auto;
	background: var(--tb-surface-solid);
	color: var(--tb-text-primary);
	border-radius: var(--tb-radius-lg) var(--tb-radius-lg) 0 0;
	padding: var(--tb-space-5) var(--tb-space-4);
	padding-bottom: calc(var(--tb-space-5) + env(safe-area-inset-bottom, 0px));
}

.tb-vipbar__order {
	font-size: var(--tb-text-4xl);
	font-weight: 700;
	letter-spacing: 0.04em;
	font-variant-numeric: tabular-nums;
	color: var(--tb-text-primary);
	margin: var(--tb-space-2) 0 0;
}

.tb-vipbar__sheet-total {
	margin: 0;
	font-size: var(--tb-text-3xl);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var(--tb-text-primary);
}

/* A ticket this board has finished while the other is still making its half.
 * Kept visible rather than hidden: a bartender who has already poured two rums
 * needs to see the ticket is still live, or they pour them again when it
 * reappears on the next refresh. */
.tb-kitchen-card__waiting {
	margin: var(--tb-space-3) 0 0;
	padding: 10px;
	border-radius: var(--tb-radius-md);
	background: var(--tb-success-wash);
	color: var(--tb-success-text);
	font-weight: 600;
	text-align: center;
}

.tb-vipbar__img {
	width: 44px;
	height: 56px;
	object-fit: contain;
	flex: none;
	border-radius: var(--tb-radius-sm);
	background: var(--tb-surface-alt);
}

/* ------------------------------------------------------------------ POS search */

/* First thing in the toolbar and allowed to take the room: on a busy bar four
 * letters beat four categories and a scroll. It drops to a full-width row of
 * its own before it gets too narrow to read what was typed. */
.tb-pos__search {
	flex: 1 1 220px;
	min-width: 160px;
	max-width: 360px;
}

.tb-pos__search-input {
	width: 100%;
}

/* Spans the grid rather than sitting in the first column, where an empty-state
 * sentence would be squeezed into a 180px track. */
.tb-pos__no-match {
	grid-column: 1 / -1;
	margin: 0;
}
