/* apps/staff/styles.css — staff-specific styles on /shared/theme.css. */

body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

/* The sticky shift-header carries its OWN safe-area top inset (so it sits right
 * once pinned). The body must therefore NOT add a second top inset, or the two
 * stack and the header sits a notch-height too low at rest (grey showing around
 * the clock). The login screen has no shift-header, so it takes the inset itself. */
body { padding-top: 0; }
#login-view { padding-top: env(safe-area-inset-top); }

.view-header { margin-bottom: var(--space-1); }
.view-header-actions { gap: var(--space-2); }

.scanner {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  background: #000; aspect-ratio: 3 / 4; margin-bottom: var(--space-3);
}
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner::after {                       /* aiming reticle */
  content: ""; position: absolute; inset: 18%;
  border: 3px solid var(--accent); border-radius: var(--radius-md);
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.35);
}

/* =========================================================================
 * Manual entry / hook-number & code lookup fallback (collapsed by default —
 * keeps the scan screen minimal while staying one tap away).
 * ========================================================================= */
.manual-entry-details { margin-bottom: var(--space-3); }
.manual-entry-details summary {
  cursor: pointer; padding: var(--space-3) var(--space-4); min-height: var(--tap);
  display: flex; align-items: center; color: var(--text-muted); font-weight: var(--weight-medium);
  background: var(--bg-elevated); border: 1px solid var(--line); border-radius: var(--radius-md);
  list-style: none;
}
.manual-entry-details summary::-webkit-details-marker { display: none; }
.manual-entry-details[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.manual-entry-details > div, .lookup-fallback {
  padding: var(--space-3) var(--space-4); background: var(--bg-elevated);
  border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.lookup-fallback { border-top: 1px solid var(--line); border-radius: var(--radius-md); margin-top: var(--space-3); }
.lookup-row { display: flex; align-items: center; gap: var(--space-3); text-align: left; justify-content: flex-start; }
.lookup-row .num { font-weight: var(--weight-black); min-width: 3ch; }
.lookup-row .ico { font-size: 1.25rem; }

/* =========================================================================
 * Rush mode — giant scanner, minimal chrome, max contrast for dark rooms.
 * ========================================================================= */
.rush-toggle-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
body.rush-mode { background: #000; }
body.rush-mode #scan-view h1,
body.rush-mode #new-checkin-btn { display: none; }
/* Manual entry/lookup stays reachable (collapsed) even in rush mode — a guest's dead phone
 * doesn't wait for a quiet moment — it just no longer eats space until tapped open. */
body.rush-mode .scanner { aspect-ratio: unset; height: calc(100dvh - 260px); min-height: 300px; }
body.rush-mode .ticket-hook-row .gos-hook-number { font-size: min(30vw, 8rem); }
body.rush-mode .ticket-actions .gos-btn--lg { min-height: 84px; font-size: var(--text-xl); }

/* =========================================================================
 * Shift header — sticky at-a-glance bar (in / out / calls / revenue),
 * visible above every logged-in view so staff never has to switch tabs to
 * see the shape of the night.
 * ========================================================================= */
.shift-header {
  position: sticky; top: 0; z-index: 30;
  max-width: var(--maxw); margin-inline: auto;
  padding: calc(var(--space-2) + env(safe-area-inset-top)) var(--space-3) var(--space-2);
  display: grid; grid-template-columns: auto repeat(3, 1fr); align-items: center; gap: var(--space-2);
  background: var(--bg-elevated); border-bottom: 1px solid var(--line);
}
.shift-brand { font-size: var(--text-lg); padding-right: var(--space-3); margin-right: var(--space-1); border-right: 1px solid var(--line); }
@media (max-width: 380px) { .shift-brand .gos-brand-word { display: none; } } /* keep the mark, drop the word when tight */
.shift-stat { display: flex; flex-direction: column; align-items: center; padding: var(--space-1) 0; border-radius: var(--radius-sm); }
.shift-stat .n { font-size: var(--text-xl); font-weight: var(--weight-black); font-variant-numeric: tabular-nums; line-height: 1.1; }
.shift-stat .l { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.shift-stat--warn .n { color: var(--warn); }
.shift-stat--active { background: var(--warn-soft); }
.shift-stat--active .n { color: var(--warn); }
body.rush-mode .shift-header { display: none; } /* rush mode already maximizes the scanner — header would just eat space */

/* =========================================================================
 * Always-visible call-ahead strip (above the tab bar, every tab)
 * ========================================================================= */
.call-strip {
  position: fixed; left: 0; right: 0; bottom: 72px; z-index: 39;
  display: flex; gap: var(--space-2); overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: var(--space-2) var(--space-3);
  background: var(--warn-soft); border-top: 1px solid var(--warn);
}
.call-strip::-webkit-scrollbar { display: none; }
.call-strip-item {
  flex: 0 0 auto; display: flex; align-items: center; gap: var(--space-2);
  background: var(--bg-elevated); border: 1px solid var(--warn); border-radius: var(--radius-pill);
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-3); min-height: 44px;
}
.call-strip-item .num { font-weight: var(--weight-black); font-size: var(--text-2xl); }
.call-strip-item .waiting { font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.call-strip-item button {
  appearance: none; border: 0; border-radius: var(--radius-pill); min-height: 36px;
  padding: 0 var(--space-3); background: var(--accent); color: var(--accent-text, #fff);
  font-weight: var(--weight-bold); font-size: var(--text-sm); cursor: pointer;
}

/* =========================================================================
 * Full-screen scan result flash — one-handed, readable in a dark loud club
 * ========================================================================= */
.scan-flash {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2);
  animation: scan-flash-fade 650ms ease-out forwards;
}
.scan-flash--ok { background: var(--ok, #1fa971); }
.scan-flash--reject { background: var(--danger, #e5484d); }
.scan-flash-icon { font-size: 4rem; line-height: 1; }
.scan-flash-number { font-size: min(28vw, 11rem); font-weight: var(--weight-black); color: #fff; line-height: 1; }
.scan-flash-label { font-size: var(--text-xl); font-weight: var(--weight-bold); color: #fff; text-transform: uppercase; letter-spacing: .04em; }
@keyframes scan-flash-fade { 0% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }

/* =========================================================================
 * Pending-sync badge — offline queue indicator
 * ========================================================================= */
.pending-sync-badge {
  position: fixed; right: var(--space-3); bottom: calc(72px + 60px + var(--space-3)); z-index: 45;
  appearance: none; border: 1px solid var(--warn); border-radius: var(--radius-pill);
  background: var(--warn-soft); color: var(--warn); font-weight: var(--weight-bold); font-size: var(--text-sm);
  padding: var(--space-2) var(--space-4); min-height: 40px; cursor: pointer; box-shadow: var(--shadow-md);
}

/* =========================================================================
 * SSE connection-status badge — only visible while a previously-live
 * connection is reconnecting (see renderConnBadge in app.js).
 * ========================================================================= */
.conn-status-badge {
  position: fixed; top: calc(env(safe-area-inset-top) + var(--space-2)); left: 50%; transform: translateX(-50%);
  z-index: 150; border: 1px solid var(--warn); border-radius: var(--radius-pill);
  background: var(--warn-soft); color: var(--warn); font-weight: var(--weight-bold); font-size: var(--text-sm);
  padding: var(--space-2) var(--space-4); box-shadow: var(--shadow-md); white-space: nowrap;
}

/* =========================================================================
 * Bottom tab bar — thumb-reachable, glove-friendly
 * ========================================================================= */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; gap: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--line);
  padding: var(--space-2) var(--space-2) calc(var(--space-2) + env(safe-area-inset-bottom));
}
.tab-btn {
  appearance: none; flex: 1 1 0; min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: transparent; border: 0; border-radius: var(--radius-md);
  color: var(--text-muted); font-family: inherit; cursor: pointer; position: relative;
  -webkit-tap-highlight-color: transparent;
}
.tab-btn:active { background: var(--bg-overlay); }
.tab-btn.active { color: var(--text); }
.tab-btn.active .tab-ico { transform: scale(1.08); }
.tab-ico { font-size: 1.5rem; transition: transform var(--motion); }
.tab-lbl { font-size: var(--text-xs); font-weight: var(--weight-medium); }
.tab-badge {
  position: absolute; top: 2px; right: calc(50% - 26px);
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--radius-pill);
  background: var(--danger); color: #fff; font-size: 11px; font-weight: var(--weight-bold);
  display: flex; align-items: center; justify-content: center;
}

/* =========================================================================
 * Toasts
 * ========================================================================= */
.toast-host {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: calc(var(--space-3) + env(safe-area-inset-top)) var(--space-4) 0;
  pointer-events: none; align-items: center;
}
.toast {
  max-width: var(--maxw); width: 100%; pointer-events: auto;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--bg-raised);
  box-shadow: var(--shadow-md); font-size: var(--text-sm); font-weight: var(--weight-medium);
  animation: toast-in var(--motion) ease-out;
}
.toast--ok     { background: var(--ok-soft);     border-color: var(--ok);     color: var(--ok); }
.toast--warn   { background: var(--warn-soft);   border-color: var(--warn);   color: var(--warn); }
.toast--danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.toast--info   { background: var(--info-soft);   border-color: var(--info);  color: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

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

/* =========================================================================
 * Ticket result card (scan)
 * ========================================================================= */
.ticket-card {
  background: var(--bg-elevated); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4);
}
.ticket-card--picked-up, .ticket-card--lost { border-color: var(--danger); }
.ticket-card--picked-up .ticket-card-warning, .ticket-card--lost .ticket-card-warning {
  color: var(--danger); font-weight: var(--weight-bold); font-size: var(--text-lg);
}
.ticket-hook-row { display: flex; align-items: baseline; gap: var(--space-3); }
.ticket-hook-label { font-size: var(--text-sm); color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.ticket-item-row { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-lg); }
.ticket-item-row .ico { font-size: 1.75rem; }
.ticket-photo { width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--line); }
.ticket-meta { display: flex; flex-wrap: wrap; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-muted); }
.ticket-actions { display: flex; flex-direction: column; gap: var(--space-2); }
.ticket-actions-secondary { display: flex; gap: var(--space-2); }
.ticket-actions-secondary .gos-btn { flex: 1 1 0; min-height: var(--tap); font-size: var(--text-sm); }

/* =========================================================================
 * Overview stat tiles + revenue
 * ========================================================================= */
.counts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
.count-tile {
  background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: var(--space-4); text-align: center;
}
.count-tile .n { font-size: var(--text-2xl); font-weight: var(--weight-black); }
.count-tile .l { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

.revenue-row { display: flex; align-items: center; justify-content: space-between; padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.revenue-row:last-child { border-bottom: 0; }
.revenue-row .label { display: flex; align-items: center; gap: var(--space-2); color: var(--text-muted); }
.revenue-row .value { font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.revenue-hero { font-size: var(--text-3xl); font-weight: var(--weight-black); }

/* =========================================================================
 * Call queue / express rail rows
 * ========================================================================= */
.queue-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); background: var(--bg-elevated);
  border: 1px solid var(--line); border-radius: var(--radius-md);
  min-height: 64px; cursor: pointer; text-align: left; width: 100%;
  font-family: inherit; color: inherit; appearance: none;
}
.queue-row:active { background: var(--bg-overlay); }
.queue-row--newest { border-color: var(--accent); background: var(--accent-soft); }
.queue-row .num { font-size: var(--text-3xl); font-weight: var(--weight-black); min-width: 2.5ch; }
.queue-row .ico { font-size: 1.5rem; }
.queue-row .info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.queue-row .waiting { font-size: var(--text-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.queue-row .new-tag {
  font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--accent);
  text-transform: uppercase; letter-spacing: .04em;
}
.rail-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); background: var(--bg-elevated);
  border: 1px solid var(--line); border-radius: var(--radius-md); min-height: 64px;
}
.rail-row .num { font-size: var(--text-2xl); font-weight: var(--weight-black); min-width: 2.5ch; }
.rail-row .pickup-btn { min-height: 44px; padding: 0 var(--space-3); font-size: var(--text-sm); }
.empty-state { padding: var(--space-5); text-align: center; color: var(--text-faint); }

/* =========================================================================
 * Express Rail hero cards — the 3AM-rush screen. Huge hook number (the thing
 * being grabbed off a hook in a dim room), full-card tap target, one action.
 * ========================================================================= */
.rail-list { gap: var(--space-4); }
.rail-card {
  appearance: none; width: 100%; text-align: left; font-family: inherit; color: inherit; cursor: pointer;
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-4) var(--space-5); background: var(--bg-elevated);
  border: 2px solid var(--warn); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.rail-card:active { background: var(--bg-overlay); transform: scale(0.99); }
.rail-card--urgent { border-color: var(--danger); animation: rail-urgent-pulse 1.4s ease-in-out infinite; }
@keyframes rail-urgent-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--danger-soft); } 50% { box-shadow: 0 0 0 8px transparent; } }
.rail-card-top { display: flex; align-items: center; gap: var(--space-2); }
.rail-card-ico { font-size: 1.5rem; }
.rail-card-top .waiting { margin-left: auto; font-size: var(--text-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.new-tag {
  font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--accent);
  text-transform: uppercase; letter-spacing: .04em;
}
.urgent-tag {
  font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--danger);
  text-transform: uppercase; letter-spacing: .04em;
}
.rail-card-hook {
  font-size: clamp(3rem, 16vw, var(--text-4xl)); font-weight: var(--weight-black);
  line-height: 1; letter-spacing: 0.02em; text-align: center; padding: var(--space-2) 0;
}
.rail-card-action {
  display: flex; align-items: center; justify-content: center; min-height: var(--tap-lg);
  border-radius: var(--radius-md); background: var(--accent); color: var(--text-invert);
  font-size: var(--text-lg); font-weight: var(--weight-bold);
}

/* =========================================================================
 * Rush snapshot — items in storage, pickups/hour sparkline, express/normal
 * ========================================================================= */
.session-row { display: flex; gap: var(--space-3); }
.session-stat { flex: 1 1 0; text-align: center; }
.session-stat .n { font-size: var(--text-2xl); font-weight: var(--weight-black); }
.session-stat .l { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.sparkline-wrap { display: flex; flex-direction: column; gap: var(--space-2); }
.sparkline { width: 100%; height: 64px; background: var(--bg-raised); border-radius: var(--radius-sm); }

/* =========================================================================
 * New check-in sheet
 * ========================================================================= */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: var(--maxw); max-height: 92dvh; overflow-y: auto;
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
  padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
}
.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.item-line {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3); background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: var(--radius-md);
}
.item-line .ico { font-size: 1.25rem; }
.item-line .grow { flex: 1 1 auto; }
.item-line .remove { background: none; border: 0; color: var(--danger); font-size: 1.25rem; cursor: pointer; padding: var(--space-1) var(--space-2); }
.stepper { display: flex; align-items: center; gap: var(--space-3); }
.stepper button {
  min-width: var(--tap); min-height: var(--tap); border-radius: var(--radius-md);
  border: 1px solid var(--line-strong); background: var(--bg-raised); color: var(--text);
  font-size: var(--text-xl); font-weight: var(--weight-bold); cursor: pointer;
}
.stepper .n { min-width: 2ch; text-align: center; font-size: var(--text-lg); font-weight: var(--weight-bold); }
.checkin-total { font-size: var(--text-xl); font-weight: var(--weight-black); text-align: right; }

.capture-video { width: 100%; max-height: 45vh; border-radius: var(--radius-md); background: #000; object-fit: cover; }
.result-hooks { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; }
.result-hook { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); text-align: center; }
.result-hook .n { font-size: var(--text-3xl); font-weight: var(--weight-black); color: var(--accent-text); }
.result-hook .l { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; }

/* Guest identity: name + phone shown on the scan card and in phone-died search. */
.gos-guest-line { font-size: var(--text-base); color: var(--text); margin: var(--space-1) 0; }
.gos-guest-line b { font-weight: var(--weight-bold); }
.gos-phone { color: var(--accent-text); text-decoration: none; }
.gos-phone:hover { text-decoration: underline; }
.lookup-guest { text-align: left; }
.lookup-guest .gos-row { align-items: center; gap: var(--space-3); }
.lookup-guest-num { font-size: var(--text-2xl); min-width: 2ch; text-align: center; }
