/* Operator console — dense, keyboard-friendly, laptop-first. */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--t-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--flash); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.015em; }
h1 { font-size: var(--t-2xl); font-weight: 640; }
h2 { font-size: var(--t-lg); font-weight: 620; }
h3 { font-size: var(--t-md); font-weight: 600; }

.muted { color: var(--ink-3); }
.small { font-size: var(--t-sm); }
.mono  { font-family: var(--font-mono); font-size: var(--t-sm); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

/* -- shell --------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s-5);
  padding: 0 var(--s-5);
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex; align-items: center; gap: var(--s-3);
  font-weight: 660; letter-spacing: -0.02em; color: var(--ink);
  font-size: var(--t-md);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--flash-fill);
  display: grid; place-items: center;
  color: #fff; font-size: 15px;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.22);
}

.nav { display: flex; gap: var(--s-1); margin-left: var(--s-4); }
.nav a {
  padding: 7px 13px; border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 520; font-size: var(--t-sm);
}
.nav a:hover { background: var(--surface-3); text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--flash-soft); color: var(--flash-strong); }

.topbar-right { margin-left: auto; display: flex; gap: var(--s-2); align-items: center; }

.page { max-width: 1180px; margin: 0 auto; padding: var(--s-6) var(--s-5) var(--s-8); }
.page-head {
  display: flex; align-items: flex-start; gap: var(--s-4);
  margin-bottom: var(--s-5); flex-wrap: wrap;
}
.page-head .actions { margin-left: auto; display: flex; gap: var(--s-2); flex-wrap: wrap; }

.breadcrumb {
  display: flex; gap: var(--s-2); align-items: center;
  font-size: var(--t-sm); color: var(--ink-3); margin-bottom: var(--s-2);
}
.breadcrumb a { color: var(--ink-3); }

/* -- surfaces ------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: var(--s-5); }
.card-head {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line-2);
}
.card-head .actions { margin-left: auto; display: flex; gap: var(--s-2); }

.grid { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stack  { display: flex; flex-direction: column; gap: var(--s-4); }
.row    { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }

/* -- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-size: var(--t-sm); font-weight: 560;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), transform var(--fast);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--flash); outline-offset: 2px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Filled buttons use the *-fill tokens, which stay dark in both schemes so the
   white label never has to fight a pale background. */
.btn-primary {
  background: var(--flash-fill); border-color: var(--flash-fill); color: #fff;
  box-shadow: var(--shadow-1);
}
.btn-primary:hover {
  background: var(--flash-fill-hover); border-color: var(--flash-fill-hover);
}

.btn-live { background: var(--live-fill); border-color: var(--live-fill); color: #fff; }
.btn-live:hover { background: var(--live-fill-hover); border-color: var(--live-fill-hover); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); }

.btn-danger { color: var(--danger); border-color: var(--line); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn-lg { padding: 13px 22px; font-size: var(--t-base); border-radius: var(--r-md); }
.btn-sm { padding: 5px 10px; font-size: var(--t-xs); }

/* -- badges & pills ------------------------------------------------------ */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--r-full);
  font-size: var(--t-xs); font-weight: 600; letter-spacing: .01em;
  background: var(--surface-3); color: var(--ink-2);
  white-space: nowrap;
}
.badge-live      { background: var(--live-soft);   color: var(--live); }
.badge-scheduled { background: var(--flash-soft);  color: var(--flash-strong); }
.badge-completed { background: var(--surface-3);   color: var(--ink-2); }
.badge-draft     { background: var(--surface-3);   color: var(--ink-3); }
.badge-cancelled { background: var(--danger-soft); color: var(--danger); }
.badge-warn      { background: var(--warn-soft);   color: var(--warn); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dot-pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

/* -- stats --------------------------------------------------------------- */

.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: var(--s-4);
}
.stat-label {
  font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); font-weight: 640;
}
.stat-value {
  font-size: var(--t-2xl); font-weight: 680; line-height: 1.1;
  letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums;
}
.stat-hint { font-size: var(--t-xs); color: var(--ink-3); margin-top: 2px; }

/* -- tables -------------------------------------------------------------- */

.table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.table th {
  text-align: left; font-weight: 640; color: var(--ink-3);
  font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .06em;
  padding: 10px var(--s-4); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 11px var(--s-4); border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* -- forms --------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s-4); }
.field > label { font-weight: 580; font-size: var(--t-sm); color: var(--ink-2); }
.field .help { font-size: var(--t-xs); color: var(--ink-3); }
.field .errors { font-size: var(--t-xs); color: var(--danger); font-weight: 560; }

.input {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: var(--t-base);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.input:focus {
  outline: none; border-color: var(--flash);
  box-shadow: 0 0 0 3px var(--flash-soft);
}
.input.textarea { resize: vertical; min-height: 70px; }
select.input { appearance: none; background-image:
  linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
  linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 51%, calc(100% - 12px) 51%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: 34px;
}

.check-row { display: flex; gap: var(--s-3); align-items: flex-start; margin-bottom: var(--s-3); }
.check-row input[type="checkbox"] { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--flash); }
.check-row label { font-weight: 520; font-size: var(--t-sm); }

fieldset { border: 0; padding: 0; margin: 0 0 var(--s-6); }
legend {
  padding: 0; margin-bottom: var(--s-4); font-weight: 640; font-size: var(--t-md);
  letter-spacing: -0.01em;
}
.legend-hint { font-weight: 400; color: var(--ink-3); font-size: var(--t-sm); }

/* -- messages ------------------------------------------------------------ */

.messages { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-5); }
.message {
  padding: 11px var(--s-4); border-radius: var(--r-sm);
  font-size: var(--t-sm); border: 1px solid transparent;
}
.message.success { background: var(--live-soft);   color: var(--live);   border-color: currentColor; }
.message.error   { background: var(--danger-soft); color: var(--danger); border-color: currentColor; }
.message.warning { background: var(--warn-soft);   color: var(--warn);   border-color: currentColor; }
.message.info    { background: var(--surface-3);   color: var(--ink-2); }

/* -- readiness checks ---------------------------------------------------- */

.check { display: flex; gap: var(--s-3); align-items: flex-start; padding: 10px 0; }
.check + .check { border-top: 1px solid var(--line-2); }
.check-icon {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff;
  margin-top: 1px;
}
.check-ok    .check-icon { background: var(--live-fill); }
.check-error .check-icon { background: var(--danger); }
.check-warn  .check-icon { color: #fff; }
.check-warn  .check-icon { background: var(--warn); }
.check-info  .check-icon { background: var(--ink-4); }
.check-label { font-weight: 600; font-size: var(--t-sm); }
.check-detail { font-size: var(--t-sm); color: var(--ink-3); }

/* -- galleries ----------------------------------------------------------- */

.session-grid {
  display: grid; gap: var(--s-4);
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.session-card {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); overflow: hidden;
  transition: box-shadow var(--base), transform var(--base);
  display: block; color: inherit;
}
.session-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); text-decoration: none; }
.session-thumb {
  aspect-ratio: 3 / 4; background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 6px;
}
/* Letterbox rather than crop: a 2x6 strip and a 5x5 square sit in the same
   grid, and the operator needs to recognise a session at a glance, not admire
   a crop of it. max-* with auto sizing is what actually constrains an image
   whose own aspect ratio is taller than its box. */
.session-thumb img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain; display: block;
}
.session-meta { padding: 9px 11px; display: flex; align-items: center; gap: 6px; }
.session-meta .seq { font-weight: 660; font-size: var(--t-sm); }
.session-meta .when { margin-left: auto; font-size: var(--t-xs); color: var(--ink-3); }

.shot-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.shot { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--surface-3); position: relative; }
.shot img { width: 100%; display: block; aspect-ratio: 3/2; object-fit: cover; }
.shot .tag {
  position: absolute; top: 7px; left: 7px;
  background: rgba(0,0,0,.62); color: #fff; backdrop-filter: blur(6px);
  padding: 2px 8px; border-radius: var(--r-full);
  font-size: var(--t-xs); font-weight: 640;
}

/* -- empty state --------------------------------------------------------- */

.empty { text-align: center; padding: var(--s-8) var(--s-5); color: var(--ink-3); }
.empty h3 { color: var(--ink); margin-bottom: var(--s-2); }
.empty p { margin: 0 auto var(--s-5); max-width: 44ch; }

/* -- layout picker ------------------------------------------------------- */

.layout-picker { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.layout-option { position: relative; }
.layout-option input { position: absolute; opacity: 0; pointer-events: none; }
.layout-option label {
  display: block; cursor: pointer; padding: var(--s-3);
  border: 2px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); text-align: center;
  transition: border-color var(--fast), background var(--fast);
}
.layout-option label:hover { border-color: var(--ink-4); }
.layout-option input:checked + label { border-color: var(--flash); background: var(--flash-soft); }
.layout-option input:focus-visible + label { outline: 2px solid var(--flash); outline-offset: 2px; }
.layout-option .name { font-size: var(--t-xs); font-weight: 620; margin-top: 7px; }
.layout-option .paper { font-size: var(--t-xs); color: var(--ink-3); }
.layout-thumb { width: 100%; height: 108px; display: block; }

@media (max-width: 720px) {
  .topbar { gap: var(--s-2); padding: 0 var(--s-3); overflow-x: auto; }
  .page { padding: var(--s-4) var(--s-3) var(--s-7); }
  h1 { font-size: var(--t-xl); }
}

/* -- guest book moderation ---------------------------------------------- */

.is-hidden-entry { opacity: .55; border-style: dashed; }
.is-hidden-entry img { filter: grayscale(1); }

/* -- printable gallery sign ---------------------------------------------- */

@media print {
  .topbar, .breadcrumb, .no-print, .messages { display: none !important; }
  body { background: #fff; }
  .print-sheet { border: 0; box-shadow: none; max-width: none; }
  .page { padding: 0; }
}

/* ==========================================================================
   Sign-in and account screens
   ========================================================================== */

.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100svh; padding: var(--s-5);
  background: var(--canvas);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  padding: var(--s-6);
}
.auth-card h1 { font-size: var(--t-xl); margin-bottom: var(--s-2); }
.auth-brand {
  display: flex; align-items: center; gap: var(--s-3);
  font-weight: 660; letter-spacing: -0.02em; margin-bottom: var(--s-5);
}

.steps { margin: var(--s-4) 0; padding-left: var(--s-5); font-size: var(--t-sm); }
.steps li { margin-bottom: var(--s-4); }
.steps li::marker { color: var(--ink-3); font-weight: 700; }

.qr-box {
  width: 190px; margin: var(--s-3) 0;
  background: #fff; padding: 10px; border-radius: var(--r-sm);
  border: 1px solid var(--line);
}
.qr-box svg { width: 100%; height: auto; display: block; }

/* Recovery codes are read off the screen and typed elsewhere, so they get room
   to breathe and a font where 0 and O are not the same shape. */
.code-grid {
  list-style: none; margin: var(--s-4) 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-2);
}
.code-grid li {
  background: var(--surface-3); border-radius: var(--r-sm);
  padding: 10px; text-align: center;
  font-size: var(--t-base); letter-spacing: .04em;
}

/* -- role chips ---------------------------------------------------------- */

.role { font-size: var(--t-xs); font-weight: 640; padding: 2px 8px; border-radius: var(--r-full); }
.role-super_admin    { background: var(--flash-soft); color: var(--flash-strong); }
.role-business_owner { background: var(--live-soft);  color: var(--live); }
.role-operator       { background: var(--surface-3);  color: var(--ink-2); }

.user-menu { display: flex; align-items: center; gap: var(--s-3); }
.user-menu .who { text-align: right; line-height: 1.25; }
.user-menu .who strong { display: block; font-size: var(--t-sm); }
.user-menu .who span { font-size: var(--t-xs); color: var(--ink-3); }

/* -- multi-select checkbox lists (operator assignment) ------------------- */

.check-list {
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: var(--s-3); background: var(--surface-2);
  max-height: 220px; overflow-y: auto;
}
.check-list .check-row { margin-bottom: var(--s-2); }
.check-list .check-row:last-child { margin-bottom: 0; }
.check-list label { font-weight: 500; cursor: pointer; }

.assignee { display: flex; align-items: center; gap: var(--s-2); padding: 6px 0; }
.assignee + .assignee { border-top: 1px solid var(--line-2); }
