/**
 * TB POS — Reusable Components
 *
 * Prefer these primitives over one-off screen styles.
 * All classes live under #tb-pos-app / .tb-pos-root.
 */

/* --------------------------------------------------------------- hidden
 *
 * `hidden` is an attribute that means "not rendered", and every component here
 * that sets `display` quietly overrides it: the browser's own `[hidden]` rule is
 * a plain element selector, so a single class beats it. The symptom is a pay
 * sheet, a toast stack or an empty error box sitting on the screen with nothing
 * in it, and the JS that set `el.hidden = true` looking correct.
 *
 * This had already been patched twice in screens.css, once per component, which
 * is the shape of a problem that wants fixing in one place. Stated once here,
 * for everything.
 */
[hidden] {
	display: none !important;
}

/* ------------------------------------------------------- border-box, guests
 *
 * The console's copy of this reset lives in shell.css. The guest surfaces do
 * not load shell.css — CustomerVip enqueues tokens, components, screens,
 * responsive and themes, and nothing else — so a `.tb-pos-public` selector
 * written there never reached a single customer page. Every `.tb-input` with
 * width:100% on the VIP pages and the signing portal was laid out content-box
 * and spilled its own padding and borders past the field holding it.
 *
 * It is stated here because this file is on every surface, which is the
 * property the rule needs. */
.tb-pos-public *,
.tb-pos-public *::before,
.tb-pos-public *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------ Button */

.tb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--tb-space-2);
	min-height: var(--tb-touch-pref);
	padding: 0 var(--tb-space-5);
	border-radius: var(--tb-radius-md);
	border: 1px solid transparent;
	font-size: var(--tb-text-control);
	font-weight: 500;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: background var(--tb-duration) var(--tb-ease),
		border-color var(--tb-duration) var(--tb-ease),
		color var(--tb-duration) var(--tb-ease),
		box-shadow var(--tb-duration) var(--tb-ease),
		transform var(--tb-duration) var(--tb-ease),
		opacity var(--tb-duration) var(--tb-ease);
	user-select: none;
	white-space: nowrap;
	text-decoration: none;
}

/* A button whose label is a document's title cannot be held on one line.
 *
 * `.tb-btn` is `nowrap` deliberately: a console button reading "Save" or
 * "Void sale" breaking mid-phrase looks broken. The customer's signing page
 * is the exception, because the document's own name is IN the button — "Sign
 * Electronic signing consent and authorisation" measures 594px of text inside
 * a 262px column at phone width, which bin/verify-form-layout.js caught and
 * nothing else would have.
 *
 * Wrapped rather than shortened: the title is the only thing telling five
 * signing buttons on one page apart.
 */
.tb-btn--wrap {
	white-space: normal;
	height: auto;
	padding-top: var(--tb-space-2);
	padding-bottom: var(--tb-space-2);
}

/* ------------------------------------------------------------------ Focus
 *
 * Buttons had no focus style at all, so keyboard users were relying on the
 * browser default over themed fills. Stated once here for every interactive
 * thing in the console rather than per component, which is how the gap opened
 * in the first place.
 *
 * :focus-visible, not :focus — a pointer user clicking a button should not get
 * a ring, or people start styling it away again.
 */
#tb-pos-app :focus-visible,
.tb-pos-root :focus-visible {
	outline: none;
	box-shadow: var(--tb-shadow-focus);
	/* Above neighbouring cards, so the outer ring is never clipped by the
	   next element's background. */
	position: relative;
	z-index: 1;
}

/* The sidebar and the KDS board are dark whatever the theme, so they take the
 * lifted ring rather than the card one. */
#tb-pos-app .tb-sidebar :focus-visible,
.tb-pos-root .tb-sidebar :focus-visible,
#tb-pos-app .tb-kds :focus-visible,
.tb-pos-root .tb-kds :focus-visible {
	box-shadow: var(--tb-shadow-focus-dark);
}

/* Windows High Contrast / forced-colours mode throws away box-shadow, so the
 * ring has to come back as a real outline or it disappears for exactly the
 * users who turned that mode on. */
@media (forced-colors: active) {
	#tb-pos-app :focus-visible,
	.tb-pos-root :focus-visible {
		outline: 3px solid Highlight;
		outline-offset: 2px;
	}
}

.tb-btn:disabled,
.tb-btn.is-disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

.tb-btn--primary {
	background: var(--tb-teal);
	color: var(--tb-text-on-teal);
	box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset;
}

.tb-btn--primary:hover {
	background: var(--tb-teal-deep);
	color: var(--tb-text-on-teal);
	transform: translateY(-1px);
}

.tb-btn--secondary {
	background: var(--tb-surface-solid);
	border-color: var(--tb-border-strong);
	color: var(--tb-text-primary);
}

.tb-btn--secondary:hover {
	border-color: var(--tb-shell-gold);
	background: var(--tb-surface-solid);
	color: var(--tb-text-primary);
}

.tb-btn--vip {
	background: var(--tb-coral);
	color: var(--tb-text-on-coral);
}

.tb-btn--vip:hover {
	filter: brightness(0.97);
	color: var(--tb-text-on-coral);
}

.tb-btn--upgrade {
	background: var(--tb-shell-gold);
	color: var(--tb-text-on-gold);
}

.tb-btn--upgrade:hover {
	background: var(--tb-shell-gold-deep);
	color: var(--tb-text-on-gold-deep);
}

.tb-btn--danger {
	background: var(--tb-danger);
	color: var(--tb-text-on-danger);
}

.tb-btn--danger:hover {
	filter: brightness(0.95);
	color: var(--tb-white);
}

.tb-btn--ghost {
	background: transparent;
	color: var(--tb-text-secondary);
	padding-inline: var(--tb-space-3);
}

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

/* Beat WP admin / theme link color on teal & filled CTAs (was black-on-green).
   The ink is a variable with a fallback, not a fixed token, because this rule
   is !important and therefore wins everywhere — including the public shell,
   where the primary button is GOLD and white text on it measures 2.42:1. A
   surface that repaints the button sets --tb-btn-primary-ink alongside the
   paint; everywhere else the fallback is exactly what this rule always did. */
#tb-pos-app a.tb-btn--primary,
#tb-pos-app button.tb-btn--primary,
#tb-pos-app .tb-btn--primary,
.tb-pos-root a.tb-btn--primary,
.tb-pos-root button.tb-btn--primary,
.tb-pos-root .tb-btn--primary,
.tb-pos-ops-surface a.tb-btn--primary,
.tb-pos-ops-surface button.tb-btn--primary,
.tb-pos-public a.tb-btn--primary,
.tb-pos-public button.tb-btn--primary,
#tb-pos-app a.tb-btn--primary:hover,
#tb-pos-app a.tb-btn--primary:focus,
#tb-pos-app a.tb-btn--primary:visited,
.tb-pos-root a.tb-btn--primary:hover,
.tb-pos-root a.tb-btn--primary:focus,
.tb-pos-root a.tb-btn--primary:visited,
.tb-pos-ops-surface a.tb-btn--primary:hover,
.tb-pos-ops-surface a.tb-btn--primary:visited,
.tb-pos-public a.tb-btn--primary:hover,
.tb-pos-public a.tb-btn--primary:visited {
	color: var(--tb-btn-primary-ink, var(--tb-text-on-teal)) !important;
}

#tb-pos-app a.tb-btn--danger,
#tb-pos-app button.tb-btn--danger,
.tb-pos-root a.tb-btn--danger,
.tb-pos-root button.tb-btn--danger,
#tb-pos-app a.tb-btn--danger:hover,
#tb-pos-app a.tb-btn--danger:visited,
.tb-pos-root a.tb-btn--danger:hover,
.tb-pos-root a.tb-btn--danger:visited {
	color: var(--tb-white) !important;
}

.tb-btn--sm {
	min-height: var(--tb-touch-min);
	padding: 0 var(--tb-space-3);
	font-size: var(--tb-text-label);
}

.tb-btn--lg {
	min-height: 56px;
	padding: 0 var(--tb-space-8);
	font-size: var(--tb-text-md);
}

.tb-btn--block {
	width: 100%;
}

.tb-btn--icon {
	width: var(--tb-touch-pref);
	padding: 0;
}

.tb-btn.is-loading {
	position: relative;
	color: transparent !important;
}

.tb-btn.is-loading::after {
	content: "";
	position: absolute;
	width: 18px;
	height: 18px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: tb-spin 0.6s linear infinite;
	color: var(--tb-white);
}

.tb-btn--secondary.is-loading::after,
.tb-btn--vip.is-loading::after,
.tb-btn--upgrade.is-loading::after,
.tb-btn--ghost.is-loading::after {
	color: var(--tb-teal);
}

@keyframes tb-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ------------------------------------------------------------------ Card */

.tb-card {
	background: var(--tb-surface);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-lg);
	box-shadow: none;
	padding: var(--tb-space-6);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.tb-card--flush {
	padding: 0;
}

.tb-card__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--tb-space-3);
	margin-bottom: var(--tb-space-5);
}

.tb-card__title {
	margin: 0;
	font-family: var(--tb-font-display);
	font-size: var(--tb-text-2xl);
	font-weight: 600;
	letter-spacing: 0.01em;
	color: var(--tb-text-primary);
}

.tb-card__subtitle {
	margin: var(--tb-space-1) 0 0;
	color: var(--tb-text-secondary);
	font-size: var(--tb-text-label);
	letter-spacing: 0.02em;
}

/* ------------------------------------------------------------------ Metric */

.tb-metric {
	background: var(--tb-surface);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-lg);
	padding: var(--tb-space-5) var(--tb-space-5) var(--tb-space-6);
	box-shadow: none;
	display: flex;
	flex-direction: column;
	gap: var(--tb-space-3);
	min-height: 120px;
	position: relative;
	overflow: hidden;
	transition: border-color var(--tb-duration) var(--tb-ease), transform var(--tb-duration) var(--tb-ease);
}

.tb-metric::after {
	content: "";
	position: absolute;
	left: var(--tb-space-5);
	right: var(--tb-space-5);
	top: 0;
	height: 1px;
	background: linear-gradient(90deg, var(--tb-shell-gold), transparent 70%);
	opacity: 0.55;
}

.tb-metric:hover {
	border-color: var(--tb-border-gold);
	transform: translateY(-1px);
}

.tb-metric__label {
	font-size: var(--tb-text-badge);
	font-weight: 500;
	color: var(--tb-text-secondary);
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.tb-metric__value {
	font-family: var(--tb-font-display);
	font-size: var(--tb-text-metric);
	font-weight: 600;
	letter-spacing: 0.01em;
	line-height: 1.05;
	color: var(--tb-text-primary);
}

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

/* A heading over a group of cards, with the group's scope beside it. The note
   is the part that stops "Orders 12" and "Open Checks 4" being read as the same
   kind of number. */
.tb-section-heading {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: var(--tb-space-3);
	margin: 0 0 var(--tb-space-3);
	font-size: var(--tb-text-label);
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--tb-text-secondary);
}

.tb-section-heading__note {
	font-size: var(--tb-text-label);
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
	color: var(--tb-text-secondary);
}

/* A card that can be opened.
 *
 * An <a>, not an article with a click handler: focusable, keyboard-operable,
 * middle-clickable into a new tab, and announced as a link. `color: inherit`
 * because the value and label are already the right colours and a card is not
 * a sentence with a link in it. */
.tb-metric--link {
	color: inherit;
	text-decoration: none;
	cursor: pointer;
}

.tb-metric__drill {
	/* Pushed to the bottom so the line sits on the card's edge whatever the
	   value's height, and the row of cards reads as a row. */
	margin-top: auto;
	font-size: var(--tb-text-label);
	color: var(--tb-text-secondary);
	opacity: 0;
	transition: opacity var(--tb-duration) var(--tb-ease), color var(--tb-duration) var(--tb-ease);
}

/* Shown on hover and on keyboard focus — and ALWAYS where a pointer cannot
   hover, because on a tablet behind the bar an affordance that only appears on
   hover is an affordance that does not exist. */
.tb-metric--link:hover .tb-metric__drill,
.tb-metric--link:focus-visible .tb-metric__drill {
	opacity: 1;
	color: var(--tb-text-primary);
}

@media (hover: none) {
	.tb-metric__drill {
		opacity: 1;
	}
}

/* Reserve the line's height on every card in a row, linked or not, so hovering
   one card does not nudge the others. */
.tb-metric--link {
	min-height: 148px;
}

.tb-metric--accent-teal {
	border-top: none;
}

.tb-metric--accent-teal::after {
	background: linear-gradient(90deg, var(--tb-teal), transparent 70%);
	opacity: 0.7;
	height: 2px;
}

.tb-metric--accent-coral {
	border-top: none;
}

.tb-metric--accent-coral::after {
	background: linear-gradient(90deg, var(--tb-coral), transparent 70%);
	opacity: 0.8;
	height: 2px;
}

.tb-metric--accent-gold {
	border-top: none;
}

.tb-metric--accent-gold::after {
	background: linear-gradient(90deg, var(--tb-shell-gold), transparent 70%);
	opacity: 0.85;
	height: 2px;
}

.tb-metric--accent-success {
	border-top: none;
}

.tb-metric--accent-success::after {
	background: linear-gradient(90deg, var(--tb-success), transparent 70%);
	opacity: 0.75;
	height: 2px;
}

.tb-metric--accent-warning {
	border-top: 3px solid var(--tb-warning);
}

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

.tb-metric-grid--5 {
	grid-template-columns: repeat(5, minmax(0, 1fr));
}

.tb-metric-grid--6 {
	grid-template-columns: repeat(6, minmax(0, 1fr));
}

.tb-metric-grid--7 {
	grid-template-columns: repeat(7, minmax(0, 1fr));
}

/* ------------------------------------------------------------------ Badge */

.tb-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 22px;
	padding: 0 9px;
	border-radius: var(--tb-radius-sm);
	font-size: var(--tb-text-badge);
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	white-space: nowrap;
	line-height: 1;
	border: 1px solid transparent;
}

.tb-badge--paid,
.tb-badge--ready,
.tb-badge--fulfilled,
.tb-badge--success,
.tb-badge--checked-in {
	background: var(--tb-success-wash);
	color: var(--tb-success-text);
}

.tb-badge--pending,
.tb-badge--picking,
.tb-badge--warning,
.tb-badge--low-stock {
	background: var(--tb-warning-wash);
	color: var(--tb-warning-text);
}

.tb-badge--cancelled,
.tb-badge--urgent,
.tb-badge--danger,
.tb-badge--variance {
	background: var(--tb-danger-wash);
	color: var(--tb-danger-text);
}

.tb-badge--requested,
.tb-badge--info,
.tb-badge--live {
	background: var(--tb-info-wash);
	color: var(--tb-info-text);
}

.tb-badge--vip {
	background: var(--tb-shell-cream);
	color: var(--tb-deep-rose);
}

.tb-badge--muted,
.tb-badge--cancelled {
	background: var(--tb-muted-wash);
	color: var(--tb-muted-text);
}

.tb-badge--substitution {
	background: var(--tb-shell-cream);
	color: var(--tb-deep-rose);
}

/* ------------------------------------------------------------------ Inputs */

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

.tb-label {
	font-size: var(--tb-text-label);
	font-weight: 600;
	color: var(--tb-text-primary);
}

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

/* A hint that is a figure somebody has to act on rather than an aside — the
 * off-menu line total on the report, for instance. Uses the warning TEXT token,
 * not the raw warning colour: the raw one is tuned to sit on the wash behind a
 * badge and does not clear AA against the page background. */
.tb-hint--warning {
	color: var(--tb-warning-text);
	font-weight: 600;
}

/* WordPress admin styles form controls as `input[type="text"]` — a type
 * selector, so specificity (0,0,1,1) beats a bare class (0,0,1,0). Every one of
 * these declarations was losing to wp-admin/css/forms.css: the colour, the
 * background, the border, the height and, worst of all, the font size, which
 * left the field you type into frozen at WordPress's 16px while the labels
 * around it scaled. Qualifying with the root element wins the cascade back. */
#tb-pos-app .tb-input,
#tb-pos-app .tb-select,
#tb-pos-app .tb-textarea,
.tb-pos-root .tb-input,
.tb-pos-root .tb-select,
.tb-pos-root .tb-textarea,
.tb-input,
.tb-select,
.tb-textarea {
	width: 100%;
	min-height: var(--tb-touch-min);
	padding: 0 14px;
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-md);
	background: var(--tb-surface-solid);
	color: var(--tb-text-primary);
	/* Inputs do not inherit the page font, so both have to be stated. Without
	   the size, the text size control does not reach the one place a person is
	   actually reading closely. */
	font-family: var(--tb-font);
	font-size: var(--tb-text-control);
	line-height: var(--tb-leading-body);
	transition: border-color var(--tb-duration) var(--tb-ease), box-shadow var(--tb-duration) var(--tb-ease);
}

#tb-pos-app .tb-textarea,
.tb-pos-root .tb-textarea,
.tb-textarea {
	padding: 12px 14px;
}

/* Placeholder text is a hint, not content — but it still has to be legible. */
#tb-pos-app .tb-input::placeholder,
#tb-pos-app .tb-textarea::placeholder,
.tb-pos-root .tb-input::placeholder,
.tb-pos-root .tb-textarea::placeholder {
	color: var(--tb-text-secondary);
	/* Was 0.75, which dropped this to 3.79:1. A placeholder reads as a hint
	   because of what it says and because it vanishes on typing — not because
	   it is too faint to read. Firefox also defaults ::placeholder to 0.54,
	   so this has to be stated rather than left alone. */
	opacity: 1;
}

.tb-textarea {
	min-height: 96px;
	padding: 12px 14px;
	resize: vertical;
}

.tb-input:hover,
.tb-select:hover,
.tb-textarea:hover {
	border-color: var(--tb-border-strong);
}

.tb-input:focus,
.tb-select:focus,
.tb-textarea:focus {
	outline: none;
	border-color: var(--tb-teal);
	box-shadow: var(--tb-shadow-focus);
}

.tb-input--error,
.tb-select--error,
.tb-textarea--error {
	border-color: var(--tb-danger);
}

.tb-select {
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6462' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 36px;
}

.tb-context-select {
	min-height: 40px;
	padding: 0 32px 0 12px;
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-md);
	background-color: var(--tb-surface);
	font-size: var(--tb-text-sm);
	font-weight: 600;
	cursor: pointer;
}

/* ------------------------------------------------------------------ Segmented control */

.tb-segmented {
	display: inline-flex;
	/* Six order types at a large text size are wider than a tablet. Wrapping to
	   a second row is the only honest option — the alternative is buttons that
	   run off the edge of the screen and cannot be tapped at all. */
	flex-wrap: wrap;
	max-width: 100%;
	padding: 4px;
	background: var(--tb-surface-alt);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-md);
	gap: 2px;
}

.tb-segmented__btn {
	min-height: var(--tb-touch-min);
	padding: 0 16px;
	white-space: nowrap;
	border: none;
	border-radius: var(--tb-radius-sm);
	background: transparent;
	color: var(--tb-text-secondary);
	font-size: var(--tb-text-label);
	font-weight: 600;
	cursor: pointer;
	transition: background var(--tb-duration) var(--tb-ease), color var(--tb-duration) var(--tb-ease);
}

.tb-segmented__btn:hover {
	color: var(--tb-text-primary);
}

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

.tb-segmented--block {
	display: flex;
	width: 100%;
}

.tb-segmented--block .tb-segmented__btn {
	flex: 1;
}

/* ------------------------------------------------------------------ Tabs */

.tb-tabs {
	display: flex;
	gap: var(--tb-space-1);
	border-bottom: 1px solid var(--tb-border);
	margin-bottom: var(--tb-space-5);
}

.tb-tabs__tab {
	min-height: 44px;
	padding: 0 var(--tb-space-4);
	border: none;
	background: transparent;
	color: var(--tb-text-secondary);
	font-weight: 600;
	font-size: var(--tb-text-sm);
	cursor: pointer;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
}

.tb-tabs__tab:hover {
	color: var(--tb-text-primary);
}

.tb-tabs__tab.is-active {
	color: var(--tb-teal);
	border-bottom-color: var(--tb-teal);
}

/* ------------------------------------------------------------------ Table */

.tb-table-wrap {
	overflow: auto;
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-lg);
	background: var(--tb-surface);
}

.tb-table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--tb-text-sm);
}

.tb-table th {
	text-align: left;
	font-size: var(--tb-text-label);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--tb-text-secondary);
	padding: 12px 16px;
	background: var(--tb-surface-alt);
	border-bottom: 1px solid var(--tb-border);
	white-space: nowrap;
}

.tb-table td {
	padding: 14px 16px;
	border-bottom: 1px solid var(--tb-border);
	vertical-align: middle;
}

.tb-table tr:last-child td {
	border-bottom: none;
}

.tb-table tr.is-exception td {
	background: var(--tb-danger-wash);
}

.tb-table tr:hover td {
	background: var(--tb-surface-alt);
}

/* ------------------------------------------------------------------ Product card */

.tb-product-card {
	display: flex;
	/* A row, not a column.
	 *
	 * Stacked, the picture sat on top and the name — the thing a cashier is
	 * actually looking for — was the second element on every tile. Beside it,
	 * the name is where the eye lands and the artwork is an accent. */
	flex-direction: row;
	align-items: flex-start;
	gap: var(--tb-space-3);
	padding: var(--tb-space-4);
	background: var(--tb-surface);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-md);
	cursor: pointer;
	/* em, not px: the tile has to grow with the text it holds. A fixed 96px
	   box with enlarged text is how the name ends up outside the card. */
	min-height: 6em;
	text-align: left;
	/* Grid and flex children default to min-width:auto, so one long unbreakable
	   word makes the card wider than its track and paints over its neighbour. */
	min-width: 0;
	overflow: hidden;
	transition: border-color var(--tb-duration) var(--tb-ease), box-shadow var(--tb-duration) var(--tb-ease);
}

.tb-product-card:hover {
	border-color: var(--tb-teal);
	box-shadow: var(--tb-shadow-sm);
}

.tb-product-card:active {
	transform: scale(0.99);
}

/* All three read from the scaled type tokens, so the hierarchy between them
   survives at every text size. "Chardonnay/Sauvignon-Blanc" has no space in it,
   so without overflow-wrap the browser refuses to break it and it runs straight
   out of the tile — which is exactly what was happening. */
.tb-product-card__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	flex: 1;
}

.tb-product-card__name {
	/* The biggest thing on the tile. It is what the grid is read by. */
	font-size: calc(var(--tb-text-body) * 1.08);
	font-weight: 700;
	letter-spacing: -0.01em;
	line-height: var(--tb-leading-tight);
	min-width: 0;
	/* break-word, not anywhere: `anywhere` lets the browser split a word the
	 * moment the line is tight, which is how "Guinness" became "Guinnes / s".
	 * break-word splits only a word that cannot fit the column on its own —
	 * "Chardonnay/Sauvignon-Blanc", the case this was added for — and hyphens
	 * marks the split so it reads as one word rather than two. */
	overflow-wrap: break-word;
	hyphens: auto;
}

.tb-product-card__price {
	font-size: calc(var(--tb-text-body) * 0.95);
	font-weight: 600;
	color: var(--tb-teal);
	min-width: 0;
	overflow-wrap: break-word;
}

.tb-product-card__stock {
	font-size: var(--tb-text-label);
	color: var(--tb-text-secondary);
	min-width: 0;
	overflow-wrap: break-word;
}

.tb-product-card__stock.is-low {
	color: var(--tb-warning);
	font-weight: 600;
}

.tb-product-card--compact {
	min-height: 4.5em;
	padding: var(--tb-space-3);
}

.tb-product-card.is-selected {
	border-color: var(--tb-teal);
	border-width: 2px;
	background: var(--tb-shell-cream);
}

/* ------------------------------------------------------------------ VIP / selection card */

.tb-selection-card {
	display: flex;
	align-items: flex-start;
	gap: var(--tb-space-3);
	padding: var(--tb-space-4);
	background: var(--tb-surface);
	border: 2px solid var(--tb-border);
	border-radius: var(--tb-radius-md);
	cursor: pointer;
	text-align: left;
	width: 100%;
	transition: border-color var(--tb-duration) var(--tb-ease), background var(--tb-duration) var(--tb-ease);
}

.tb-selection-card:hover {
	border-color: var(--tb-border-strong);
}

.tb-selection-card.is-selected {
	border-color: var(--tb-teal);
	background: var(--tb-shell-cream);
}

.tb-selection-card__check {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	border: 2px solid var(--tb-border-strong);
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-top: 2px;
}

.tb-selection-card.is-selected .tb-selection-card__check {
	background: var(--tb-teal);
	border-color: var(--tb-teal);
	color: var(--tb-text-on-teal);
}

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

.tb-selection-card__meta {
	font-size: var(--tb-text-xs);
	color: var(--tb-text-secondary);
	margin: 4px 0 0;
}

.tb-selection-card--upgrade {
	border-color: var(--tb-shell-gold);
	background: var(--tb-surface-solid);
}

/* ------------------------------------------------------------------ Order / VIP / Kitchen cards */

.tb-order-card,
.tb-vip-card,
.tb-kitchen-card {
	background: var(--tb-surface);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-lg);
	padding: var(--tb-space-4);
	display: flex;
	flex-direction: column;
	gap: var(--tb-space-3);
	box-shadow: var(--tb-shadow-sm);
}

.tb-vip-card {
	border-left: 4px solid var(--tb-status-requested);
}

.tb-vip-card--picking {
	border-left-color: var(--tb-status-picking);
}

.tb-vip-card--ready {
	border-left-color: var(--tb-status-ready);
}

.tb-vip-card--urgent {
	border-left-color: var(--tb-status-urgent);
}

.tb-vip-card--fulfilled {
	border-left-color: var(--tb-status-fulfilled);
	opacity: 0.85;
}

.tb-kitchen-card {
	min-height: 220px;
	padding: var(--tb-space-5);
}

.tb-kitchen-card__timer {
	font-size: var(--tb-text-4xl);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.02em;
}

.tb-kitchen-card__timer.is-waiting {
	color: var(--tb-warning);
}

.tb-kitchen-card__timer.is-late {
	color: var(--tb-danger);
}

.tb-card-id {
	font-family: var(--tb-font-mono);
	font-size: var(--tb-text-xs);
	font-weight: 600;
	color: var(--tb-text-secondary);
}

.tb-card-guest {
	font-size: var(--tb-text-lg);
	font-weight: 700;
	letter-spacing: -0.02em;
	margin: 0;
}

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

.tb-line-list li {
	font-size: var(--tb-text-sm);
	font-weight: 500;
}

/* ------------------------------------------------------------------ Qty stepper */

.tb-qty {
	display: inline-flex;
	align-items: center;
	gap: var(--tb-space-2);
}

.tb-qty__btn {
	width: var(--tb-touch-min);
	height: var(--tb-touch-min);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-sm);
	background: var(--tb-surface);
	font-size: var(--tb-text-lg);
	font-weight: 600;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.tb-qty__btn:hover:not(:disabled) {
	border-color: var(--tb-teal);
	color: var(--tb-teal);
}

.tb-qty__btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.tb-qty__value {
	min-width: 28px;
	text-align: center;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ Modal */

.tb-modal-backdrop {
	position: fixed;
	inset: 0;
	background: var(--tb-scrim);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--tb-space-6);
	z-index: var(--tb-z-modal);
}

.tb-modal {
	width: min(440px, 100%);
	background: var(--tb-surface);
	border-radius: var(--tb-radius-lg);
	box-shadow: var(--tb-shadow-md);
	padding: var(--tb-space-6);
	/* A modal taller than the screen used to run off the bottom of it, taking
	   Cancel and Save with it and leaving no way to scroll to them — the dialog
	   was unusable and looked merely long. The backdrop is a flex container with
	   its own padding, so the height available is the viewport less that padding
	   on both sides. */
	max-height: calc(100vh - (2 * var(--tb-space-6)));
	overflow-y: auto;
	/* Momentum scrolling on iOS, where a bar manager is most likely to meet a
	   form long enough to need it. */
	-webkit-overflow-scrolling: touch;
}

/* A form with several controls on a line needs the room; 440px wraps every row
   into a stack four deep. */
.tb-modal--wide {
	width: min(760px, 100%);
}

.tb-modal--approval {
	border-top: 4px solid var(--tb-warning);
}

.tb-modal__title {
	margin: 0 0 var(--tb-space-2);
	font-size: var(--tb-text-xl);
	font-weight: 700;
}

.tb-modal__body {
	color: var(--tb-text-secondary);
	margin-bottom: var(--tb-space-5);
}

.tb-modal__actions {
	display: flex;
	gap: var(--tb-space-2);
	justify-content: flex-end;
	margin-top: var(--tb-space-5);
}

/* ------------------------------------------------------------------ Alert / Toast / Empty */

.tb-alert {
	display: flex;
	gap: var(--tb-space-3);
	padding: var(--tb-space-4);
	border-radius: var(--tb-radius-md);
	border: 1px solid var(--tb-border);
	background: var(--tb-surface);
}

.tb-alert--error {
	background: var(--tb-danger-wash);
	border-color: var(--tb-danger);
	color: var(--tb-danger-text);
}

.tb-alert--success {
	background: var(--tb-success-wash);
	border-color: var(--tb-success);
	color: var(--tb-success-text);
}

.tb-alert--warning {
	background: var(--tb-warning-wash);
	border-color: var(--tb-warning);
	color: var(--tb-warning-text);
}

.tb-alert--info {
	background: var(--tb-info-wash);
	border-color: var(--tb-info);
	color: var(--tb-info-text);
}

.tb-alert__title {
	font-weight: 700;
	margin: 0 0 4px;
	color: var(--tb-text-primary);
}

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

.tb-toast-stack {
	position: fixed;
	right: var(--tb-space-6);
	bottom: var(--tb-space-6);
	display: flex;
	flex-direction: column;
	gap: var(--tb-space-2);
	z-index: var(--tb-z-toast);
	width: min(360px, calc(100vw - 48px));
}

.tb-toast {
	/* Not --tb-text-primary. That token flips to near-white in the Night
	   theme, which made every toast white text on a white slab — unreadable
	   exactly when a confirmation matters. */
	background: var(--tb-inverse-surface);
	color: var(--tb-text-on-inverse);
	border: 1px solid var(--tb-border-strong);
	padding: 14px 16px;
	border-radius: var(--tb-radius-md);
	box-shadow: var(--tb-shadow-md);
	font-size: var(--tb-text-sm);
	font-weight: 500;
	animation: tb-toast-in var(--tb-duration) var(--tb-ease);
}

/* An error toast states its own pair, so no caller has to reach in and set a
 * background inline — which is what used to happen, leaving the text colour
 * behind and the two out of step. */
.tb-toast--error {
	background: var(--tb-danger);
	color: var(--tb-text-on-danger);
	border-color: var(--tb-danger);
}

.tb-toast--success {
	background: var(--tb-success);
	color: var(--tb-text-on-success);
	border-color: var(--tb-success);
}

@keyframes tb-toast-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.tb-empty {
	text-align: center;
	padding: var(--tb-space-12) var(--tb-space-6);
	color: var(--tb-text-secondary);
}

.tb-empty__title {
	font-size: var(--tb-text-lg);
	font-weight: 700;
	color: var(--tb-text-primary);
	margin: 0 0 var(--tb-space-2);
}

.tb-empty__body {
	margin: 0 0 var(--tb-space-5);
	max-width: 36ch;
	margin-inline: auto;
}

/* ------------------------------------------------------------------ Filters */

.tb-filters {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tb-space-3);
	align-items: flex-end;
	margin-bottom: var(--tb-space-5);
	padding: var(--tb-space-4);
	background: var(--tb-surface);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-lg);
}

.tb-filters .tb-field {
	min-width: 140px;
	flex: 1;
}

/* ------------------------------------------------------------------ Skeleton */

.tb-skeleton {
	background: linear-gradient(90deg, var(--tb-surface-alt) 25%, var(--tb-surface-solid) 37%, var(--tb-surface-alt) 63%);
	background-size: 400% 100%;
	animation: tb-shimmer 1.2s ease infinite;
	border-radius: var(--tb-radius-sm);
}

.tb-skeleton--text {
	height: 14px;
	width: 60%;
}

.tb-skeleton--metric {
	height: 32px;
	width: 40%;
}

.tb-skeleton--card {
	height: 112px;
	width: 100%;
}

@keyframes tb-shimmer {
	0% {
		background-position: 100% 0;
	}
	100% {
		background-position: 0 0;
	}
}

/* ------------------------------------------------------------------ Connection / Status indicator */

.tb-connection {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 32px;
	padding: 0 12px;
	border-radius: 999px;
	font-size: var(--tb-text-label);
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	background: var(--tb-success-wash);
	color: var(--tb-success-text);
}

.tb-connection__dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: currentColor;
}

.tb-connection--live .tb-connection__dot {
	animation: tb-pulse 1.8s ease infinite;
}

.tb-connection--syncing {
	background: var(--tb-info-wash);
	color: var(--tb-info-text);
}

.tb-connection--degraded {
	background: var(--tb-warning-wash);
	color: var(--tb-warning-text);
}

.tb-connection--offline {
	background: var(--tb-danger-wash);
	color: var(--tb-danger-text);
}

@keyframes tb-pulse {
	0%,
	100% {
		opacity: 1;
	}
	50% {
		opacity: 0.35;
	}
}

.tb-status-dot {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: var(--tb-text-xs);
	font-weight: 600;
}

.tb-status-dot::before {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: currentColor;
}

/* ------------------------------------------------------------------ Grid helpers */

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

.tb-stack--6 {
	gap: var(--tb-space-6);
}

.tb-row {
	display: flex;
	gap: var(--tb-space-4);
	align-items: center;
}

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

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

.tb-brand-logo {
	display: block;
	max-width: 100%;
	height: auto;
	object-fit: contain;
}

.tb-brand-logo--full {
	width: min(280px, 70vw);
	height: auto;
}

.tb-brand-mark {
	width: 40px;
	height: 40px;
	object-fit: contain;
	display: block;
}

.tb-brand-mark--sm {
	width: 28px;
	height: 28px;
}

.tb-brand-mark--lg {
	width: 56px;
	height: 56px;
}

/* ------------------------------------------------------------------ Text size picker */

.tb-textsize {
	display: inline-flex;
	align-items: flex-end;
	gap: 2px;
	padding: 4px;
	background: var(--tb-surface-alt);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-md);
}

/* The button itself never scales — otherwise the control that fixes the text
   size becomes unreadable at the size you are trying to escape. */
.tb-textsize__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 34px;
	min-height: 34px;
	padding: 0 6px;
	border: none;
	border-radius: var(--tb-radius-sm);
	background: transparent;
	color: var(--tb-text-secondary);
	cursor: pointer;
	transition: background var(--tb-duration) var(--tb-ease), color var(--tb-duration) var(--tb-ease);
}

/* Each step shows its own size, so the control previews what it does. */
.tb-textsize__btn:nth-child(1) .tb-textsize__a { font-size: 11px; }
.tb-textsize__btn:nth-child(2) .tb-textsize__a { font-size: 13px; }
.tb-textsize__btn:nth-child(3) .tb-textsize__a { font-size: 16px; }
.tb-textsize__btn:nth-child(4) .tb-textsize__a { font-size: 19px; }

.tb-textsize__a {
	font-weight: 700;
	line-height: 1;
}

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

.tb-textsize__btn.is-active,
.tb-textsize__btn[aria-pressed="true"] {
	background: var(--tb-teal);
	color: var(--tb-text-on-teal);
}

.tb-textsize__btn:focus-visible {
	outline: none;
	box-shadow: var(--tb-shadow-focus);
}

/* The busiest hour of the night, called out in the sales chart. */
.tb-chart-bar.is-peak {
	background: var(--tb-teal);
}

/* Product artwork.
 *
 * Fixed box with object-fit: contain, because the pictures come from wherever
 * the venue's distributor keeps them — a 2000px studio shot on white and a
 * 120px thumbnail land in the same grid, and neither may stretch. */
.tb-product-card__img {
	/* Fixed box, so a broken or slow URL cannot collapse the tile and reflow
	 * the grid under a cashier's thumb mid-tap. */
	width: 40px;
	height: 48px;
	min-width: 40px;
	flex: none;
	object-fit: contain;
	border-radius: var(--tb-radius-sm);
	background: var(--tb-surface-alt);
}

/* No thumbnail to pay for, so the track can go back to the narrower floor and
 * fit more tiles on the screen. */
.tb-pos__grid.is-textonly {
	grid-template-columns: repeat(auto-fill, minmax(min(100%, calc(140px * var(--tb-font-scale))), 1fr));
}

/* With pictures off the tile is all text, so it can be shorter and the grid
 * denser — which is the point of turning them off. */
.tb-pos__grid.is-textonly .tb-product-card {
	min-height: 3.5em;
}

/* A proposed product photograph, waiting on a yes or a no. */
.tb-image-proposal {
	display: flex;
	align-items: center;
	gap: var(--tb-space-3);
	padding: var(--tb-space-3) 0;
	border-bottom: 1px solid var(--tb-border);
}

.tb-image-proposal.is-done {
	opacity: 0.55;
}

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

.tb-image-proposal__body {
	flex: 1;
	min-width: 0;
}

.tb-image-proposal__name {
	font-weight: 600;
	color: var(--tb-text-primary);
}

.tb-image-proposal__actions {
	display: flex;
	gap: var(--tb-space-2);
	flex: none;
}

/* The product picture on a stock row. Small: this is a list to count from, not
 * a catalogue to browse. */
.tb-inv-thumb {
	width: 34px;
	height: 42px;
	object-fit: contain;
	flex: none;
	border-radius: var(--tb-radius-sm);
	background: var(--tb-surface-alt);
}
