/* ============================================================
   NuvFlow design system
   Tokens first, components second. Semantic tokens only in
   components — never raw hex. Light + dark via [data-theme].
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  /* brand gradient (logo, accents) */
  --brand-a: #6366f1;
  --brand-b: #22d3ee;

  /* light theme (default) — neutral surfaces, indigo primary.
     Green is reserved for device status (online), never for brand. */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --ink: #171a19;
  --ink-2: #434a46;
  --muted: #767e7a;
  --line: #e7ece9;
  --line-strong: #d4ddd8;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --on-primary: #ffffff;
  --primary-soft: #eef0fe;
  --primary-soft-ink: #4338ca;

  --info: #0369a1;
  --info-soft: #e3f1f9;
  --success: #059669;
  --success-soft: #e5f5ef;
  --warning: #b45309;
  --warning-soft: #fdf1e0;
  --danger: #dc2626;
  --danger-soft: #fdeaea;

  --glass: rgba(255, 255, 255, 0.9);
  --glass-line: rgba(23, 26, 25, 0.08);
  --scrim: rgba(15, 17, 21, 0.45);

  --shadow-1: 0 1px 2px rgba(18, 30, 24, 0.04), 0 5px 18px rgba(18, 30, 24, 0.06);
  --shadow-2: 0 2px 6px rgba(18, 30, 24, 0.05), 0 12px 30px rgba(18, 30, 24, 0.07);
  --shadow-3: 0 8px 24px rgba(18, 30, 24, 0.08), 0 26px 60px rgba(18, 30, 24, 0.1);
  --shadow-control: 0 1px 1px rgba(18, 30, 24, 0.03);

  /* shape + rhythm (4px scale) */
  --r-sm: 10px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --sidebar-w: 248px;
  --sidebar-rail: 72px;
  --topbar-h: 60px;

  /* motion */
  --t-fast: 160ms;
  --t-med: 260ms;
  --t-slow: 380ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --font: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #0b0f0e;
  --surface: #151b18;
  --surface-2: #1c2320;
  --ink: #e8eaee;
  --ink-2: #c3c7cf;
  --muted: #9298a3;
  --line: #252e2a;
  --line-strong: #37423d;

  --primary: #818cf8;
  --primary-hover: #9aa3fa;
  --on-primary: #10122a;
  --primary-soft: rgba(129, 140, 248, 0.14);
  --primary-soft-ink: #a5affb;

  --info: #4aa8dd;
  --info-soft: rgba(74, 168, 221, 0.14);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --warning: #f5a742;
  --warning-soft: rgba(245, 167, 66, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);

  --glass: rgba(20, 25, 23, 0.9);
  --glass-line: rgba(232, 234, 238, 0.08);
  --scrim: rgba(0, 0, 0, 0.6);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.24), 0 4px 14px rgba(0, 0, 0, 0.16);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.3), 0 12px 30px rgba(0, 0, 0, 0.2);
  --shadow-3: 0 8px 24px rgba(0, 0, 0, 0.4), 0 26px 60px rgba(0, 0, 0, 0.28);
  --shadow-control: 0 1px 1px rgba(0, 0, 0, 0.22);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  transition: background var(--t-med), color var(--t-med);
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--primary-soft-ink, var(--primary)); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.85em; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100dvh; }

/* sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  transition: width var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out), background var(--t-med);
}
.sidebar-head {
  display: flex; align-items: center; gap: 10px;
  min-height: var(--topbar-h); padding: 0 16px; flex: 0 0 auto;
}
.sidebar-head:has(.tenant-brand-stack) {
  height: auto; padding: 18px 16px; align-items: flex-start;
}
.brand-mark {
  flex: 0 0 34px; width: 34px; height: 34px;
  display: grid; place-items: center;
  filter: drop-shadow(0 2px 6px rgba(99, 102, 241, 0.35));
}
.brand-mark svg { display: block; width: 100%; height: 100%; }
.brand-img {
  flex: 0 0 34px; width: 34px; height: 34px;
  border-radius: var(--r-sm); object-fit: cover; display: block;
}
.brand-img-lg { flex-basis: 56px; width: 56px; height: 56px; border-radius: 10px; }
.brand-name { font-weight: 700; font-size: 16.5px; white-space: nowrap; }
.brand-name b { color: var(--primary-soft-ink); font-weight: 700; }

.sidebar-nav { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.nav-section {
  padding: 14px 12px 6px; font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap; transition: opacity var(--t-med);
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 42px; padding: 9px 12px; border-radius: var(--r-md);
  color: var(--ink-2); font-weight: 500; text-decoration: none;
  white-space: nowrap; position: relative;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-item:active { transform: scale(0.985); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-soft-ink); font-weight: 600; }
.nav-item svg { flex: 0 0 20px; }
.nav-item .nav-label { transition: opacity var(--t-med) var(--ease-out); }
.nav-item.disabled { opacity: 0.45; pointer-events: none; }
.nav-soon {
  margin-left: auto; font-size: 9.5px; font-weight: 600; letter-spacing: 0.06em;
  padding: 2px 7px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--muted); text-transform: uppercase;
  transition: opacity var(--t-med);
}

/* tenant-branded sidebar head */
.tenant-brand-stack { display: flex; flex-direction: column; gap: 8px; min-width: 0; width: 100%; }
.tenant-brand-stack .powered-by { padding-left: 3px; transition: opacity var(--t-med); }
/* Logos ship with all kinds of backgrounds — a white chip makes every one
   look deliberate, in both themes. */
.tenant-logo {
  display: block; height: 60px; max-width: 100%; align-self: flex-start;
  object-fit: contain; object-position: center;
  background: #fff; padding: 10px 18px;
  border-radius: var(--r-md); border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.brand-mark.tenant-tile {
  border-radius: var(--r-sm); background: var(--primary); color: var(--on-primary);
  font-weight: 800; font-size: 15px; text-transform: uppercase;
}
.tenant-brand-text { min-width: 0; transition: opacity var(--t-med); }
.tenant-name { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.powered-by { font-size: 11px; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
.powered-by b { color: var(--primary-soft-ink); font-weight: 650; }
@media (min-width: 900px) {
  .app.rail .tenant-brand-text { opacity: 0; pointer-events: none; }
  .app.rail .tenant-brand-stack .powered-by { opacity: 0; height: 0; }
  /* rail shows just the logo mark: square-crop the logo's left edge, where
     the icon sits in a horizontal lockup */
  .app.rail .sidebar-head:has(.tenant-brand-stack) { padding: 13px 12px; }
  .app.rail .tenant-logo {
    width: 44px; height: 44px; max-width: 44px;
    object-fit: cover; object-position: left center;
    padding: 4px; border-radius: 10px;
  }
}

/* Account row: one quiet line at the foot of the nav — avatar, "name · email",
   sign-out as a framed control. Sits on surface-2 so it reads as part of the
   sidebar rather than a widget bolted under it. */
.sidebar-foot { padding: 8px 12px 12px; margin-top: 4px; border-top: 1px solid var(--line); }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 4px 6px 4px 8px; border-radius: var(--r-sm);
  background: var(--surface-2);
}
.avatar {
  flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 650;
  background: var(--primary-soft); color: var(--primary-soft-ink);
}
.user-meta {
  flex: 1; min-width: 0; font-size: 13px; color: var(--ink); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity var(--t-med);
}
.user-meta:hover { text-decoration: none; color: var(--ink); }
.user-meta .name { font-weight: 600; }
.user-meta .mail { color: var(--muted); }
.signout-btn {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  box-shadow: var(--shadow-control);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.signout-btn:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* rail (collapsed) state — desktop */
@media (min-width: 900px) {
  .app.rail .sidebar { width: var(--sidebar-rail); }
  .app.rail .brand-name,
  .app.rail .nav-label,
  .app.rail .nav-soon,
  .app.rail .nav-section,
  .app.rail .user-meta { opacity: 0; pointer-events: none; }
  .app.rail .nav-item { justify-content: flex-start; }
  .app.rail .main { padding-left: var(--sidebar-rail); }
  .app.rail .signout-btn { display: none; }
  .app.rail .user-chip { padding: 4px; justify-content: center; }
  .app.rail .user-meta { display: none; }
  .app.rail .collapse-btn svg { transform: rotate(180deg); }
}

/* main column */
.main {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  padding-left: var(--sidebar-w);
  transition: padding var(--t-slow) var(--ease-out);
}

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  transition: background var(--t-med), border-color var(--t-med);
}
.icon-btn {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: var(--r-sm);
  border: none; background: transparent; color: var(--ink-2);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:active { transform: scale(0.92); }
.collapse-btn svg { transition: transform var(--t-slow) var(--ease-out); }
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-spacer { flex: 1; }

/* theme toggle — animated sun/moon crossfade + rotate */
.theme-toggle { position: relative; overflow: hidden; }
.theme-toggle svg {
  position: absolute; inset: 0; margin: auto;
  transition: transform var(--t-slow) var(--ease-out), opacity var(--t-med);
}
.theme-toggle .i-sun { opacity: 0; transform: rotate(90deg) scale(0.5); }
.theme-toggle .i-moon { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="dark"] .theme-toggle .i-sun { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="dark"] .theme-toggle .i-moon { opacity: 0; transform: rotate(-90deg) scale(0.5); }

/* content */
.content { flex: 1; padding: 30px 28px 56px; max-width: 1320px; width: 100%; margin: 0 auto; }
.content-form-narrow { max-width: 592px; }
.content-form-medium { max-width: 772px; }
.content-form-wide { max-width: 932px; }

/* mobile drawer */
.scrim {
  position: fixed; inset: 0; z-index: 35; background: var(--scrim);
  opacity: 0; pointer-events: none; transition: opacity var(--t-med);
}
@media (max-width: 899px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .app.drawer-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-3); }
  .app.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .main { padding-left: 0; }
  .content { padding: 18px 14px 40px; }
  .collapse-btn { display: none; } /* rail collapse is desktop-only */
}
@media (min-width: 900px) {
  .menu-btn { display: none; }
}

/* ---------- components ---------- */

/* cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  transition: background var(--t-med), border-color var(--t-med), box-shadow var(--t-med), transform var(--t-med) var(--ease-out);
}
.card.hoverable:hover { border-color: color-mix(in srgb, var(--primary) 14%, var(--line)); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 56px; padding: 16px 22px; border-bottom: 1px solid var(--line);
}
.card-head b { font-size: 14.5px; }
.card-body { padding: 22px; }

/* stat card — wrappers stretch so every card matches the tallest in the row */
.stat-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  grid-auto-rows: 1fr;
  margin-bottom: 22px;
}
.stat-grid > * { display: flex; }
.stat-grid .stat-card { flex: 1; }
.stat-card { display: flex; align-items: center; gap: 15px; padding: 18px 20px; }
.stat-icon {
  flex: 0 0 44px; width: 44px; height: 44px; border-radius: var(--r-md);
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-soft-ink);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 7%, transparent);
}
.stat-meta .stat-value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.stat-meta .stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat-meta .stat-sub { font-size: 11.5px; color: var(--muted); }

/* dashboard store-health heat map */
.health-map { margin-bottom: 22px; overflow: hidden; }
.health-map-head { align-items: flex-start; flex-wrap: wrap; }
.health-map-head > div:first-child { display: grid; gap: 2px; }
.health-legend { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.health-legend span { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11.5px; }
.health-swatch { width: 9px; height: 9px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line-strong); }
.health-swatch.health-healthy { background: var(--success); border-color: var(--success); }
.health-swatch.health-degraded { background: var(--warning); border-color: var(--warning); }
.health-swatch.health-offline { background: var(--danger); border-color: var(--danger); }
.health-map-body { display: grid; gap: 20px; }
.health-tenant { min-width: 0; }
.health-tenant + .health-tenant { padding-top: 18px; border-top: 1px solid var(--line); }
.health-tenant-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 9px; flex-wrap: wrap; }
.health-grid { min-width: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.health-grid-head, .health-row { display: grid; grid-template-columns: minmax(150px, 240px) minmax(180px, 1fr) 64px; }
.health-grid-head {
  min-height: 32px; align-items: center; background: var(--surface-2); border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
}
.health-grid-head > span, .health-row > * { padding-inline: 12px; }
.health-grid-head > span:last-child { text-align: center; }
.health-row { min-height: 50px; align-items: stretch; background: var(--surface); }
.health-row + .health-row { border-top: 1px solid var(--line); }
.health-store {
  min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 1px;
  color: var(--ink); border-right: 1px solid var(--line);
}
.health-store:hover { text-decoration: none; background: var(--surface-2); }
.health-store-name { min-width: 0; display: flex; align-items: baseline; gap: 7px; }
.health-store-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.health-store-name code { flex: 0 0 auto; color: var(--muted); font-size: 10.5px; }
.health-store-region { overflow: hidden; color: var(--muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.health-devices {
  min-width: 0; padding-block: 8px; display: flex; align-items: stretch; gap: 4px; overflow-x: auto;
  scrollbar-width: thin;
}
.health-device {
  flex: 0 0 34px; min-height: 32px; border: 1px solid transparent; border-radius: 5px;
  transition: filter var(--t-fast), transform var(--t-fast);
}
.health-device:hover { text-decoration: none; filter: brightness(.94); transform: translateY(-1px); }
.health-device.health-online { background: color-mix(in srgb, var(--success) 66%, var(--surface)); border-color: color-mix(in srgb, var(--success) 76%, var(--line)); }
.health-device.health-offline { background: color-mix(in srgb, var(--danger) 72%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 82%, var(--line)); }
.health-device.health-unpaired, .health-device.health-empty { background: var(--surface-2); border-color: var(--line-strong); }
.health-device.health-empty { border-style: dashed; }
.health-now {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin: 8px;
  padding: 0 8px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: 12px; font-weight: 700;
}
.health-now:hover { text-decoration: none; filter: brightness(.96); }
.health-now i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.health-now.health-healthy { color: var(--success); background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, var(--line)); }
.health-now.health-degraded { color: var(--warning); background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 32%, var(--line)); }
.health-now.health-offline { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.health-now.health-neutral i { display: none; }

@media (max-width: 560px) {
  .health-legend { justify-content: flex-start; }
  .health-grid { overflow-x: auto; }
  .health-grid-head, .health-row { min-width: 520px; grid-template-columns: 165px minmax(270px, 1fr) 64px; }
}

/* badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; line-height: 1;
  padding: 5px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-brand { background: var(--primary-soft); color: var(--primary-soft-ink); border-color: transparent; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: transparent; }

/* status dot with pulse (online) */
.badge-success .dot { animation: pulse 2.4s var(--ease-in-out) infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); }
  50% { box-shadow: 0 0 0 5px transparent; }
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 9px 18px; border-radius: var(--r-md);
  font-weight: 600; font-size: 13.5px; line-height: 1.2;
  border: 1px solid transparent; text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.btn:active { transform: scale(0.975); }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 1px 2px color-mix(in srgb, var(--primary) 20%, transparent), 0 4px 12px color-mix(in srgb, var(--primary) 14%, transparent); }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 2px 5px color-mix(in srgb, var(--primary) 20%, transparent), 0 8px 18px color-mix(in srgb, var(--primary) 16%, transparent); }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line-strong); box-shadow: var(--shadow-control); }
.btn-ghost:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--ink) 12%, var(--line-strong)); color: var(--ink); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input {
  width: 100%; min-height: 42px; padding: 10px 14px;
  border-radius: var(--r-md); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-control);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-med);
}
.input::placeholder { color: var(--muted); }
.input:hover { border-color: color-mix(in srgb, var(--ink) 14%, var(--line-strong)); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field-error { display: block; margin-top: 5px; font-size: 12px; color: var(--danger); }
.form-alert {
  padding: 10px 14px; margin-bottom: 14px; border-radius: var(--r-md);
  background: var(--danger-soft); color: var(--danger); font-size: 13px;
}
.form-alert:empty, .form-alert ul:empty { display: none; }
.form-alert ul { margin: 0; padding-left: 16px; }

/* alerts / empty states */
.alert { padding: 14px 16px; border: 1px solid transparent; border-radius: var(--r-md); font-size: 13.5px; }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state svg { opacity: 0.5; margin-bottom: 10px; }
.empty-state .empty-title { font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.empty-state p { font-size: 13px; }

/* page header */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 22px; letter-spacing: -0.025em; }
.page-head .subtitle { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.page-head .head-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* org tree */
.org-tree { list-style: none; margin: 0; padding: 0; }
.org-tree ul { list-style: none; margin: 4px 0 0; padding-left: 22px; border-left: 1px dashed var(--line-strong); }
.org-node { padding: 4px 0; }
.org-node-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--r-sm); transition: background var(--t-fast); }
.org-node-row:hover { background: var(--surface-2); }
.org-node-row .org-name { font-weight: 600; font-size: 13.5px; }
.org-node-row code { color: var(--muted); }
.kiosk-row {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 6px 5px 10px; border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--ink-2);
  transition: background var(--t-fast);
}
.kiosk-row:hover { background: var(--surface-2); }
.kiosk-row code { font-weight: 600; }
.kiosk-row .kiosk-name { color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.status-online { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-offline { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.status-unpaired { background: var(--line-strong); }

/* tenant grid */
.tenant-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
@media (max-width: 480px) { .tenant-grid { grid-template-columns: 1fr; } }

/* ---------- auth layout ---------- */
.auth-page {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(700px 400px at 12% -8%, color-mix(in srgb, var(--brand-a) 13%, transparent), transparent 65%),
    radial-gradient(600px 420px at 105% 110%, color-mix(in srgb, var(--brand-b) 9%, transparent), transparent 65%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  padding: 34px 32px 30px;
  animation: rise var(--t-slow) var(--ease-out) both;
}
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.auth-note { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.auth-note code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.auth-theme-toggle { position: fixed; top: 16px; right: 16px; }

/* quiet links — ink-colored, reveal intent on hover */
a.link-quiet { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
a.link-quiet:hover { color: var(--primary-soft-ink); text-decoration: none; }
a.link-quiet svg { opacity: 0; transition: opacity var(--t-fast), transform var(--t-fast); transform: translateX(-3px); }
a.link-quiet:hover svg { opacity: 1; transform: none; }

/* ---------- tables ---------- */
/* Rows carry nowrap headers, codes and badge chips that refuse to shrink —
   scroll the card horizontally instead of clipping (overflow-y stays hidden
   so the card's rounded top corners still crop the header background). */
.table-card { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 12px 16px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table .cell-main { font-weight: 600; }
.table .cell-sub { font-size: 12px; color: var(--muted); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.indent-1 { padding-left: 26px; }
.row-inactive { opacity: 0.5; }

/* maintenance mode — compact inline toggle form shared by kiosk/store/tenant rows and detail cards */
.maintenance-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.maintenance-form .input { width: 220px; }
.maintenance-note { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }

/* extra buttons */
.btn-sm { min-height: 34px; padding: 6px 13px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* forms */
.form-card { width: 100%; max-width: 540px; margin-inline: auto; }
.form-card-wide { max-width: 880px; }
.field-hint { display: block; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.form-actions { display: flex; gap: 10px; margin-top: 22px; align-items: center; }
select.input { cursor: pointer; }
.check-row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.check-row input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* trading hours */
.hours-section { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px 8px; background: var(--surface-2); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--surface) 70%, transparent); }
.hours-grid { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.hours-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hours-day { flex: 0 0 92px; font-size: 13px; color: var(--ink-2); }
.hours-time { width: auto; flex: 0 1 120px; padding: 7px 10px; }
.hours-time:disabled { opacity: 0.45; background: var(--surface-2); }
.hours-sep { color: var(--muted); }
.hours-closed { flex: 0 0 auto; margin-left: auto; }

/* toast */
.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 100;
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-radius: var(--r-lg); font-size: 13.5px; font-weight: 500;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); box-shadow: var(--shadow-3);
  animation: rise var(--t-med) var(--ease-out) both;
}
.toast .t-icon { color: var(--success); display: grid; place-items: center; }
.toast.out { transition: opacity var(--t-med), transform var(--t-med); opacity: 0; transform: translateY(8px); }

/* config editor */
.code-editor {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.6; tab-size: 2; resize: vertical; min-height: 220px;
}
.code-preview {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.65; margin: 0; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow-x: auto; white-space: pre;
}

/* file dropzone — enhances every input[type=file] */
/* visually-hidden but form-participating (file inputs, picker-backed selects) */
.dz-hidden {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; overflow: hidden; pointer-events: none;
}
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 24px 16px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg);
  background: var(--surface-2); color: var(--muted); font-size: 13px;
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.dropzone b { color: var(--ink-2); font-weight: 600; }
.dropzone svg { opacity: 0.6; transition: opacity var(--t-fast), transform var(--t-med) var(--ease-out); }
.dropzone:hover, .dropzone.drag {
  border-color: var(--primary); background: var(--primary-soft); color: var(--primary-soft-ink);
}
.dropzone:hover svg, .dropzone.drag svg { opacity: 1; transform: translateY(-2px); }
.dropzone.drag { border-style: solid; }
.dropzone.has-file { border-style: solid; border-color: var(--success); background: var(--success-soft); }
.dropzone .dz-file { font-weight: 600; color: var(--ink); font-size: 12.5px; word-break: break-all; }
.dropzone .dz-file:empty { display: none; }
.dropzone.has-file .dz-prompt { display: none; }
.dropzone.dz-invalid { border-color: var(--danger); background: var(--danger-soft, var(--surface-2)); }
.dz-error { display: block; margin-top: 4px; font-size: 12.5px; color: var(--danger); min-height: 0; }
.dz-error:empty { display: none; }

/* searchable multiselect picker */
.picker { position: relative; }
.picker-control {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 7px 10px; cursor: text;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-control);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.picker.open .picker-control { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.picker-chips { display: contents; }
.picker-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 6px 3px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-soft-ink);
  font-size: 12px; font-weight: 600; white-space: nowrap;
  animation: rise var(--t-fast) var(--ease-out);
}
.picker-chip-x {
  border: none; background: transparent; color: inherit; cursor: pointer;
  font-size: 14px; line-height: 1; padding: 2px 4px; border-radius: 50%;
}
.picker-chip-x:hover { background: color-mix(in srgb, currentColor 15%, transparent); }
.picker-search {
  flex: 1; min-width: 140px; border: none; outline: none; background: transparent;
  color: var(--ink); font: inherit; font-size: 13.5px; padding: 3px 2px;
}
.picker-search::placeholder { color: var(--muted); }
.picker-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  max-height: 260px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: 6px;
  animation: rise var(--t-fast) var(--ease-out);
}
.picker-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px;
  transition: background var(--t-fast);
}
.picker-item:hover { background: var(--surface-2); }
.picker-item.on { color: var(--primary-soft-ink); font-weight: 600; }
.picker-check { width: 14px; flex: 0 0 14px; color: var(--primary); font-weight: 700; }
.picker-empty { padding: 10px 12px; color: var(--muted); font-size: 12.5px; }

/* scheduled publishing */
.sched-pop { position: relative; }
.sched-pop summary { list-style: none; cursor: pointer; display: inline-flex; }
.sched-pop summary::-webkit-details-marker { display: none; }
.sched-form {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  display: flex; gap: 6px; align-items: center; padding: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3); white-space: nowrap;
  animation: rise var(--t-fast) var(--ease-out);
}
.sched-form .input { max-width: 200px; }

/* config revision timeline */
.rev-item { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.rev-item:last-child { border-bottom: none; }
.rev-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rev-details { margin-top: 6px; }
.rev-details summary { cursor: pointer; }
.rev-details summary:hover { color: var(--primary-soft-ink); }
.diff-view { margin-top: 8px; }
.diff-add { color: var(--success); background: var(--success-soft); display: inline-block; width: 100%; }
.diff-del { color: var(--danger); background: var(--danger-soft); display: inline-block; width: 100%; text-decoration: line-through; opacity: 0.75; }
.diff-ctx { color: var(--muted); }

/* pairing code display */
.pairing-code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 34px; font-weight: 700; letter-spacing: 0.12em; text-align: center;
  padding: 22px 10px; margin: 14px 0 16px;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md);
  background: var(--surface-2); color: var(--primary-soft-ink);
  animation: rise var(--t-med) var(--ease-out) both;
}

/* confirm dialog */
dialog.confirm {
  border: none; padding: 0; width: min(92vw, 380px);
  border-radius: var(--r-xl); background: var(--surface); color: var(--ink);
  outline: 1px solid var(--line);
  box-shadow: var(--shadow-3);
}
dialog.confirm::backdrop { background: rgba(8, 10, 14, 0.55); backdrop-filter: blur(3px); }
dialog.confirm[open] { animation: rise var(--t-med) var(--ease-out); }
.confirm-body { padding: 24px 24px 6px; }
.confirm-body h3 { font-size: 15.5px; margin-bottom: 6px; }
.confirm-body p { font-size: 13px; color: var(--muted); line-height: 1.55; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 18px 22px 20px; }

/* ---------- auth split (login) ---------- */
.auth-split {
  width: 100%; max-width: 960px;
  display: grid; grid-template-columns: 1.1fr 1fr;
  border-radius: var(--r-xl); overflow: hidden;
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow-3);
  animation: rise var(--t-slow) var(--ease-out) both;
}
.auth-hero {
  position: relative;
  padding: 44px 40px;
  display: flex; flex-direction: column;
  color: #eef0f7;
  background:
    radial-gradient(520px 320px at 85% -10%, rgba(99, 102, 241, 0.38), transparent 62%),
    radial-gradient(440px 340px at -10% 112%, rgba(34, 211, 238, 0.22), transparent 62%),
    linear-gradient(150deg, #171c33, #101425 58%, #0d1120);
}
.auth-hero .brand-name { color: #fff; }
.auth-hero .brand-name b { color: #93c5fd; }
.auth-hero h1 {
  font-size: 27px; line-height: 1.25; letter-spacing: -0.02em;
  margin: 34px 0 10px; color: #fff;
}
.auth-hero .hero-sub { color: rgba(238, 240, 247, 0.72); font-size: 13.5px; max-width: 40ch; }
.hero-features { margin-top: 30px; display: flex; flex-direction: column; gap: 16px; }
.hero-feature { display: flex; gap: 13px; align-items: flex-start; }
.hero-feature .hf-icon {
  flex: 0 0 36px; width: 36px; height: 36px; border-radius: var(--r-md);
  display: grid; place-items: center;
  background: rgba(129, 140, 248, 0.16); color: #a5b4fc;
  border: 1px solid rgba(129, 140, 248, 0.26);
}
.hero-feature b { display: block; font-size: 13.5px; color: #fff; }
.hero-feature p { font-size: 12.5px; color: rgba(238, 240, 247, 0.65); line-height: 1.5; }

/* mini fleet vignette */
.hero-vignette {
  margin-top: auto; padding-top: 30px;
  display: flex; flex-direction: column; gap: 8px;
}
.vignette-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(8px);
  font-size: 12px; color: rgba(235, 247, 240, 0.85);
}
.vignette-row code { font-weight: 600; color: #fff; }
.vignette-row .vr-right { margin-left: auto; font-size: 11px; color: rgba(235, 247, 240, 0.55); }
.vignette-row .status-dot.status-online { background: #4ad98a; box-shadow: 0 0 0 3px rgba(74, 217, 138, 0.18); animation: pulse 2.4s var(--ease-in-out) infinite; }

.auth-form-panel {
  background: var(--surface);
  padding: 44px 40px;
  display: flex; flex-direction: column; justify-content: center;
  transition: background var(--t-med);
}

@media (max-width: 820px) {
  .auth-split { grid-template-columns: 1fr; max-width: 420px; }
  .auth-hero { display: none; }
  .auth-form-panel { padding: 34px 30px; }
}

/* ---------- entrance animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(7px) scale(.997); } to { opacity: 1; transform: none; } }
.anim-in { animation: rise var(--t-slow) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 55ms); }

/* ---------- docs ---------- */
.doc-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.doc-card { display: flex; gap: 14px; padding: 18px; text-decoration: none; color: inherit; }
.doc-card:hover { text-decoration: none; }
.doc-card .stat-icon { flex: 0 0 42px; }
.doc-card b { display: block; font-size: 14.5px; margin-bottom: 3px; }
.doc-card p { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.doc-prose { max-width: 760px; font-size: 14px; line-height: 1.75; }
.doc-prose h2 { font-size: 17px; margin: 28px 0 10px; }
.doc-prose h2:first-child { margin-top: 0; }
.doc-prose p { margin: 0 0 12px; color: var(--ink-2); }
.doc-prose ol, .doc-prose ul { margin: 0 0 14px; padding-left: 22px; color: var(--ink-2); }
.doc-prose li { margin-bottom: 6px; }
.doc-prose li::marker { color: var(--primary-soft-ink); font-weight: 600; }
.doc-prose code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.doc-prose b { color: var(--ink); }
.doc-note {
  margin: 14px 0; padding: 12px 16px; border-radius: var(--r-md);
  background: var(--primary-soft); color: var(--primary-soft-ink); font-size: 13px; line-height: 1.6;
}
.doc-warn {
  margin: 14px 0; padding: 12px 16px; border-radius: var(--r-md);
  background: var(--warning-soft); color: var(--warning); font-size: 13px; line-height: 1.6;
}

/* ---------- utilities ---------- */
.text-muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }

/* ---------- ops: alerts, kiosk timeline, audit ---------- */
.alert-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; margin-bottom: 14px;
  background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--r-lg); font-size: 13.5px;
}
.alert-banner .ab-icon { display: grid; place-items: center; color: var(--danger); flex: none; }
.alert-banner .ab-body { flex: 1; min-width: 0; }
.alert-banner b { color: var(--danger); }

.detail-grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.uptime .uptime-label { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.uptime-bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.uptime-fill { height: 100%; border-radius: inherit; background: var(--success); transition: width var(--t-fast, 0.2s); }
.uptime-fill.low { background: var(--warning); }

/* kiosk details — captured screen preview (Screen card) */
.screen-capture-img {
  display: block; max-width: 100%; max-height: 360px; width: 100%;
  object-fit: contain; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-md);
}

/* usage analytics — "most visited screens/actions" horizontal bars */
.usage-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12.5px; }
.usage-bar-label { flex: 0 0 auto; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-bar-track { flex: 1; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.usage-bar-fill { height: 100%; border-radius: inherit; background: var(--primary); transition: width var(--t-fast, 0.2s); }
.usage-bar-count { flex: 0 0 auto; min-width: 26px; text-align: right; color: var(--muted); }

/* hourly activity strip — 24 cells, intensity via color-mix on --primary */
.hour-strip { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
.hour-cell {
  height: 26px; border-radius: 4px; background: color-mix(in srgb, var(--primary) var(--intensity, 0%), var(--line));
  border: 1px solid var(--line);
}
@media (max-width: 640px) { .hour-strip { grid-template-columns: repeat(12, 1fr); } }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 13px; top: 10px; bottom: 10px;
  width: 2px; background: var(--line);
}
.tl-item { display: flex; gap: 12px; padding: 7px 0; position: relative; }
.tl-dot {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center; z-index: 1;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--muted);
}
.tl-success .tl-dot { color: var(--success); border-color: color-mix(in srgb, var(--success) 45%, transparent); }
.tl-danger .tl-dot { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.tl-warning .tl-dot { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 45%, transparent); }
.tl-brand .tl-dot { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 45%, transparent); }
.tl-body { flex: 1; min-width: 0; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding-top: 4px; }
.tl-title { font-size: 13px; }
.tl-time { font-size: 12px; color: var(--muted); white-space: nowrap; }

.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-chips .chip {
  padding: 6px 13px; border-radius: 999px; font-size: 12.5px; text-decoration: none;
  color: var(--muted); border: 1px solid var(--line); background: var(--surface);
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.filter-chips .chip:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.filter-chips .chip.active { background: var(--primary-soft); color: var(--primary-soft-ink); border-color: transparent; }

/* ---------- booking calendar & schedules ---------- */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.cal-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-store-pick .input { min-width: 260px; }
.cal-week-nav { display: flex; align-items: center; gap: 8px; }
.cal-week-label { font-size: 13px; font-weight: 600; min-width: 150px; text-align: center; }

.cal-scroll { overflow-x: auto; }
.cal { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 760px; }
.cal th, .cal td { border: 1px solid var(--line); padding: 4px 6px; vertical-align: top; }
.cal thead th { border-top: none; padding: 8px 6px; text-align: center; }
.cal th:first-child, .cal td:first-child { border-left: none; }
.cal th:last-child, .cal td:last-child { border-right: none; }
.cal tbody tr:last-child td { border-bottom: none; }
.cal-dayname { font-weight: 700; }
.cal-daynum { font-size: 11px; color: var(--muted); }
.cal-time-col { width: 52px; text-align: right; color: var(--muted); font-size: 11px; white-space: nowrap; }
.cal-cell { min-width: 92px; height: 34px; position: relative; }
.cal-cell.cal-today, th.cal-today { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.cal-blocked {
  background: repeating-linear-gradient(-45deg,
    color-mix(in srgb, var(--danger) 7%, transparent) 0 6px, transparent 6px 12px) !important;
}
.cal-block-mark { position: absolute; top: 3px; right: 4px; color: var(--danger); opacity: 0.6; }
.cal-pill {
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  background: var(--primary-soft); color: var(--primary-soft-ink);
  border-radius: 6px; padding: 2px 6px; margin: 2px 0; font-size: 11px;
}
.cal-pill.done { opacity: 0.55; text-decoration: line-through; }
.cal-pill.noshow { opacity: 0.7; border-style: dashed; color: var(--warning); }
.cal-pill code { background: none; padding: 0; font-size: 10.5px; color: inherit; }
.cal-pill-actions { display: none; align-items: center; gap: 2px; }
.cal-pill:hover .cal-pill-actions { display: inline-flex; }
.cal-pill-actions form { margin: 0; display: inline-flex; }
.cal-mini-btn {
  border: none; background: none; cursor: pointer; padding: 1px; border-radius: 4px;
  color: inherit; display: grid; place-items: center; opacity: 0.7;
}
.cal-mini-btn:hover { opacity: 1; background: color-mix(in srgb, currentColor 14%, transparent); }
.cal-free { font-size: 10px; }

.block-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.block-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 13px;
}
.block-list form { margin: 0; }

/* ---------- searchable single select (nfsel — auto-enhances select.input) ---------- */
.nfsel { position: relative; }
.nfsel-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; cursor: pointer;
}
.nfsel-btn .nfsel-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nfsel-btn .nfsel-label.placeholder { color: var(--muted); }
.nfsel-chev { flex: none; color: var(--muted); transition: transform var(--t-fast, 0.15s); }
.nfsel.open .nfsel-chev { transform: rotate(180deg); }
.nfsel-menu {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  padding: 7px; max-height: 280px; display: flex; flex-direction: column;
  animation: rise var(--t-fast) var(--ease-out) both;
}
.nfsel-search {
  width: 100%; border: 1px solid var(--line-strong); background: var(--surface-2);
  color: var(--ink); border-radius: var(--r-sm); padding: 8px 10px; font: inherit;
  font-size: 13px; margin-bottom: 6px; outline: none;
}
.nfsel-search:focus { border-color: var(--primary); }
.nfsel-list { overflow-y: auto; }
.nfsel-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--r-sm); font-size: 13px; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.nfsel-item:hover, .nfsel-item.hover { background: var(--primary-soft); color: var(--primary-soft-ink); }
.nfsel-item.on { font-weight: 600; }
.nfsel-item .picker-check { width: 14px; flex: none; color: var(--primary); }
/* An open menu must escape its container's stacking context (anim-in creates
   one via its transform animation) — lift whichever ancestor traps it. */
.nfsel.open { z-index: 70; }
.anim-in:has(.nfsel.open),
.cal-toolbar:has(.nfsel.open),
.field:has(.nfsel.open) { position: relative; z-index: 70; }

/* ---------- list pages (search + sort + filters) ----------
   .list-filters is the generic name used by every list-table page
   (Kiosks, Org, Users, Roles, Releases, Bookings, Tenants, …);
   .audit-* selectors are kept as aliases so the Audit page keeps working. */
.audit-filters, .list-filters {
  margin-bottom: 16px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.audit-filter-row, .list-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.audit-filter-row .input, .list-filter-row .input { width: auto; }
.audit-search, .list-search { flex: 1 1 220px; min-width: 180px; }
.audit-daterange, .list-daterange { display: flex; align-items: center; gap: 6px; }
.audit-daterange .input, .list-daterange .input { width: auto; }
.audit-table, .list-table { min-width: 880px; }
.cell-when { white-space: nowrap; }
.sort-link {
  display: inline-flex; align-items: center; gap: 2px; color: inherit; text-decoration: none;
  cursor: pointer; white-space: nowrap;
}
.sort-link:hover { color: var(--ink); }
.sort-link.active { color: var(--primary-soft-ink); }
.nfsel-menu[hidden] { display: none; }

/* ---------- live navigation ---------- */
main.content.live-loading { opacity: 0.55; pointer-events: none; transition: opacity 0.12s ease; }
main.content { transition: opacity 0.12s ease; }
/* after the first in-place swap, entrance animations stay off — replays read as reloads */
main.content.no-anim .anim-in { animation: none; }

/* ---------- tooltips (nf-tip — instant, styled; replaces native title) ---------- */
.nf-tip {
  position: fixed; z-index: 100; pointer-events: none;
  background: var(--ink); color: var(--bg);
  font-size: 12px; font-weight: 500; line-height: 1;
  padding: 6px 9px; border-radius: var(--r-sm); white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  opacity: 0; transform: translateY(2px) scale(0.97);
  transition: opacity 0.1s ease, transform 0.1s ease;
  max-width: 320px; white-space: normal; text-align: center;
}
.nf-tip.on { opacity: 1; transform: none; }

/* ---------- tours ---------- */
/* Spotlight: one div over the target whose giant box-shadow darkens the rest
   of the page. pointer-events:none — it never eats the click. */
.nf-tour-spot {
  position: fixed; z-index: 9001; pointer-events: none;
  border-radius: var(--r-md);
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55);
  outline: 2px solid var(--primary);
  outline-offset: 0;
  transition: left 0.18s ease, top 0.18s ease, width 0.18s ease, height 0.18s ease;
}

/* Invisible click shield. On advance='next' it is one full sheet; on
   advance='click' it is four rectangles leaving the target genuinely live. */
.nf-tour-block { position: fixed; z-index: 9000; background: transparent; }

/* Tooltip card — same family as dialog.confirm. */
.nf-tour-tip {
  position: fixed; z-index: 9002; max-width: 340px;
  padding: 16px 18px 14px;
  border-radius: var(--r-lg); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-3);
  animation: rise var(--t-med) var(--ease-out) both;
}
.nf-tour-count {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--primary); margin-bottom: 4px;
}
.nf-tour-tip h3 { font-size: 15px; margin: 0 0 6px; }
.nf-tour-tip p { font-size: 13px; color: var(--muted); line-height: 1.55; margin: 0; }
.nf-tour-tip p b, .nf-tour-tip p code { color: var(--ink-2); }
.nf-tour-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* Tutorials page cards */
.tutorial-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.tutorial-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; }
.tutorial-card .tut-icon {
  width: 38px; height: 38px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary-soft-ink);
}
.tutorial-card h3 { font-size: 14.5px; margin: 0; }
.tutorial-card p { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0; flex: 1; }
.tutorial-card .tut-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.tutorial-card .tut-steps { font-size: 12px; color: var(--muted); }

/* Busy state for long-running form submits (e.g. 40MB APK uploads). */
.nf-spinner {
  display: inline-block; width: 14px; height: 14px; vertical-align: -2px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: nf-spin 0.7s linear infinite;
}
@keyframes nf-spin { to { transform: rotate(360deg); } }

/* ---------- kiosk config preview (virtual kiosk) ----------
   Portal chrome below uses design tokens only, per convention. The colors
   painted *inside* .kiosk-preview-screen (kiosk theme.primary/accent, the
   luminance-derived on-color, and the Material-ish light/dark surface set)
   come from the resolved kiosk CONFIG DATA and are applied by kiosk-preview.js
   as inline styles/custom properties — that's device content, not portal
   theme, so it is intentionally exempt from the "no raw hex" rule. */
.kiosk-preview-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: var(--scrim); backdrop-filter: blur(3px);
  padding: 20px;
  animation: rise var(--t-med) var(--ease-out) both;
}
.kiosk-preview-overlay[hidden] { display: none; }
.kiosk-preview-modal {
  width: min(96vw, 1080px); height: min(94vh, 900px);
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--shadow-3); overflow: hidden;
}
.kiosk-preview-header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.kiosk-preview-header h2 { font-size: 15.5px; margin: 0; white-space: nowrap; }
.kiosk-preview-header .input { max-width: 260px; }
.kiosk-preview-tabs { display: flex; gap: 4px; flex-wrap: wrap; background: var(--surface-2); padding: 3px; border-radius: 999px; }
.kp-tab {
  border: none; background: transparent; color: var(--ink-2);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  padding: 6px 13px; border-radius: 999px; transition: background var(--t-fast), color var(--t-fast);
}
.kp-tab:hover { color: var(--ink); }
.kp-tab.active { background: var(--primary); color: var(--on-primary); }
.kp-tab[hidden] { display: none; }
.kiosk-preview-badge {
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap;
}
.kiosk-preview-badge.kp-badge-ok { background: var(--success-soft); color: var(--success); border-color: transparent; }
.kiosk-preview-badge.kp-badge-warn { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.kiosk-preview-badge.kp-badge-muted { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.kiosk-preview-header #kiosk-preview-version { white-space: nowrap; }
.kiosk-preview-header #kiosk-preview-close { margin-left: auto; }

.kiosk-preview-body {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--bg); overflow: auto;
}
.kiosk-preview-frame {
  position: relative;
  width: min(360px, 100%);
  aspect-ratio: 3 / 5;
  max-height: 100%;
  background: #14151a; /* device bezel — physical hardware color, not portal theme */
  border-radius: 34px;
  padding: 14px;
  box-shadow: var(--shadow-3);
  flex: 0 0 auto;
}
.kiosk-preview-screen {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 20px;
  overflow: hidden;
  font-family: var(--font);
}

/* ----- content rendered by kiosk-preview.js inside .kiosk-preview-screen -----
   All colors from here down are set inline (kiosk config data), listed only
   for layout/structure. */
.kp-welcome { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding: 34px 18px 22px; overflow-y: auto; }
/* Always white per the render spec — the native kiosk's logo card doesn't flip with theme.mode. */
.kp-logo-card { background: #fff; border-radius: 14px; padding: 8px 16px; margin-bottom: 18px; box-shadow: 0 2px 10px rgba(0,0,0,0.18); }
.kp-logo-card img { height: 40px; display: block; }
.kp-title { font-size: 21px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.kp-subtitle { font-size: 12.5px; text-align: center; margin-bottom: 22px; line-height: 1.5; }
.kp-tiles { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.kp-tile {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: none; border-radius: 14px; padding: 12px 14px; text-align: left;
  font: inherit; font-size: 13px; font-weight: 600;
}
.kp-tile-clickable { cursor: pointer; }
.kp-tile-chip { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.kp-tile-chip svg { width: 18px; height: 18px; }

.kp-sub { position: absolute; inset: 0; display: flex; flex-direction: column; overflow-y: auto; }
.kp-sub-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 6px; }
.kp-back {
  border: none; background: transparent; padding: 6px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.kp-back svg { width: 16px; height: 16px; }
.kp-sub-title { font-size: 15px; font-weight: 700; }
.kp-sub-body { padding: 8px 18px 18px; flex: 1; }
.kp-note { font-size: 11px; line-height: 1.5; margin-top: 14px; }

.kp-btn-row { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.kp-btn {
  font: inherit; font-size: 12.5px; font-weight: 600; padding: 11px 14px;
  border-radius: 12px; text-align: center; cursor: default;
}

.kp-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; margin-bottom: 16px; }
.kp-chip { font-size: 11.5px; font-weight: 600; padding: 7px 12px; border-radius: 999px; }
.kp-step-label { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; margin: 14px 0 4px; }

.kp-cat-section { margin-bottom: 14px; }
.kp-cat-head { font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.kp-cat-item { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; padding: 5px 0; border-bottom: 1px dashed var(--glass-line); }
.kp-cat-item .kp-cat-tag { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; margin-left: 6px; }

.kp-error { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; background: var(--surface); color: var(--danger); font-size: 13px; }
.kp-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12.5px; }

/* Feedback module preview: HappyOrNot-style smiley rating row. The faces
   themselves are drawn with the fixed semaphore hex values in kiosk-preview.js
   (documented exception, see there) — this only lays the row out. */
.kp-face-row { display: flex; justify-content: space-between; gap: 6px; margin-top: 14px; }
.kp-face-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1 1 0; }
.kp-face-label { font-size: 10.5px; font-weight: 600; text-align: center; }

/* Feedback analytics (Views/Feedback/Index.cshtml): per-store mini rating
   distribution — a tiny colored dot (--dot-color, set inline per HappyOrNot
   semaphore score) plus its count. */
.feedback-mini-dist { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.feedback-mini-dot { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
.feedback-mini-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot-color, var(--muted)); flex: 0 0 auto; }

@media (max-width: 480px) {
  .kiosk-preview-body { padding: 12px; }
  .kiosk-preview-frame { width: min(300px, 100%); border-radius: 24px; padding: 10px; }
  .kiosk-preview-screen { border-radius: 14px; }
  .kiosk-preview-header { padding: 12px; gap: 8px; }
  .kiosk-preview-header h2 { font-size: 14px; }
}

/* =====================================================================
   Staff companion (phone-first shell): Queue → Mobile, Bookings → Today.
   A chromeless authenticated layout (_CompanionLayout) — no sidebar, one
   sticky top bar, content column capped for one-hand reach. Everything
   uses the shared tokens so tenant theming and dark mode apply as-is.
   ===================================================================== */
.companion { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.companion-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.companion-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.companion-title b { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.companion-title span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.companion-main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 16px 14px; padding-bottom: calc(88px + env(safe-area-inset-bottom)); }

/* Development-only one-tap sign-in rows on the login page. */
.dev-login { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.dev-login .btn { font-family: var(--mono, ui-monospace, monospace); font-size: 12px; padding: 4px 8px; }

/* Connection strip shown by nfLivePoll after repeated failed polls. */
.live-offline[hidden] { display: none; }
.live-offline {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; padding: 8px 12px; border-radius: 10px;
  font-size: 12.5px; font-weight: 600;
  color: var(--warning); background: var(--warning-soft); border: 1px solid var(--warning-soft);
}
.live-offline::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warning);
  animation: live-offline-pulse 1.2s ease-in-out infinite;
}
@keyframes live-offline-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* Big single action pinned to the thumb zone. */
.companion-cta {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  padding: 12px 14px; padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  display: flex; justify-content: center;
}
.companion-cta form { width: 100%; max-width: 532px; }
.companion-cta .btn { width: 100%; padding: 15px; font-size: 16px; border-radius: 14px; }

/* Now-serving ticket card: number dominates, actions are full-width thumbs. */
.companion-serving { display: flex; flex-direction: column; gap: 10px; }
.companion-ticket { display: flex; align-items: center; gap: 12px; }
.companion-ticket .pairing-code { margin: 0; padding: 10px 20px; font-size: 30px; }
.companion-ticket-meta { display: flex; flex-direction: column; min-width: 0; }
.companion-actions { display: flex; gap: 10px; }
.companion-actions form { flex: 1; }
.companion-actions .btn { width: 100%; padding: 12px; }

/* Waiting list: one row per ticket with an optional priority "Call". */
.companion-waiting { display: flex; flex-direction: column; }
.companion-wait-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--glass-line); }
.companion-wait-row:last-child { border-bottom: none; }
.companion-wait-row .badge { font-size: 13px; font-variant-numeric: tabular-nums; }
.companion-wait-meta { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.companion-wait-row form { margin: 0; }

/* Compact stats strip (waiting / served / no-shows). */
/* Five tiles fit a 360px phone (5 × 60px + 4 × 6px gaps); narrower wraps to 3 + 2. */
.companion-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); gap: 6px; margin-bottom: 14px; }
.companion-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; text-align: center; min-width: 0; }
.companion-stat b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.companion-stat span { font-size: 11px; color: var(--muted); white-space: nowrap; letter-spacing: -0.01em; }

/* Bookings day view: one row per slot that has content. */
.companion-day-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.companion-day-nav .day-label { font-size: 14px; font-weight: 700; text-align: center; flex: 1; }
.companion-day-nav .day-label span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.companion-slot { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--glass-line); }
.companion-slot-time { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 46px; padding-top: 4px; }
.companion-slot-body { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.companion-booking { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.companion-booking-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.companion-booking-head b { font-variant-numeric: tabular-nums; }
.companion-booking .companion-actions { margin-top: 10px; }
.companion-booking .companion-actions .btn { padding: 9px 6px; font-size: 12.5px; }
.companion-booking.is-noshow { opacity: 0.7; border-style: dashed; }
.companion-blocked {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12.5px; color: var(--warning); background: var(--warning-soft); border-radius: 10px; padding: 8px 12px;
}
.companion-blocked form { margin: 0; }

/* Day-view tools: collapsible walk-in and block-time sheets. */
.companion-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.companion-sheet summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.companion-sheet summary::-webkit-details-marker { display: none; }
.companion-sheet[open] summary { background: var(--primary-soft); color: var(--primary-soft-ink); }
.companion-sheet[open] { flex-basis: 100%; }
.companion-sheet-body {
  margin-top: 8px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.companion-sheet-body .field { margin-bottom: 10px; }
.companion-sheet-body .form-actions { margin-top: 2px; }


/* ---- Get started (provisioning) ---- */
.prov-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.prov-grid .prov-wide { grid-column: 1 / -1; }
.prov-grid .form-card { max-width: none; width: 100%; margin: 0; }
@media (max-width: 900px) { .prov-grid { grid-template-columns: 1fr; } }
.build-card .card-head, .group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.build-version { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.build-ver { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); background: transparent; }
.build-facts { width: 100%; font-size: 13px; border-collapse: collapse; }
.build-facts td { padding: 5px 0; vertical-align: top; }
.build-facts td:first-child { width: 96px; }
.build-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.step-list { margin: 0; padding-left: 22px; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.step-list li { margin-bottom: 12px; }
.step-list li::marker { color: var(--primary-soft-ink); font-weight: 700; }
.step-list b { color: var(--ink); }
.step-list .field-hint { display: block; margin-top: 4px; }
.cmd {
  display: flex; align-items: center; gap: 8px; margin: 8px 0 4px;
  padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; overflow-x: auto;
}
.cmd code { flex: 1; background: transparent; border: none; padding: 0; white-space: pre-wrap; word-break: break-all; font-size: inherit; }
.cmd-pre {
  margin: 8px 0 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12px; line-height: 1.5; overflow-x: auto; white-space: pre;
}
.copy-btn {
  flex: 0 0 auto; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; position: relative;
  transition: background var(--t-fast), color var(--t-fast);
}
.copy-btn:hover { background: var(--surface-2); color: var(--ink); }
.copy-btn.copied { color: var(--success); border-color: var(--success); }
.copy-btn.copied::after {
  content: "Copied"; position: absolute; right: 0; bottom: 100%; margin-bottom: 4px;
  font: 600 11px/1 Inter, system-ui, sans-serif; color: var(--success); white-space: nowrap;
}
.qr-row { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.qr-img { border-radius: var(--r-md); border: 1px solid var(--line); background: #fff; padding: 6px; flex: 0 0 auto; }
.fleet-versions { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.adopt-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.adopt-row code { min-width: 64px; }
.adopt-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; min-width: 60px; }
.adopt-fill { height: 100%; border-radius: inherit; background: var(--success); transition: width var(--t-fast, 0.2s); }
.adopt-cell { display: flex; flex-direction: column; gap: 4px; min-width: 84px; }
.adopt-cell .num { font-size: 13px; font-weight: 600; }
.group-head { padding-right: 14px; }


/* ---- page-level tab strip (sections that used to be sidebar entries) ---- */
.page-tabs {
  display: flex; gap: 4px; margin: -6px 0 18px; border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.page-tabs::-webkit-scrollbar { display: none; }
.page-tab {
  padding: 9px 12px 11px; margin-bottom: -1px; white-space: nowrap;
  font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent; transition: color var(--t-fast), border-color var(--t-fast);
}
.page-tab:hover { color: var(--ink); text-decoration: none; }
.page-tab.active { color: var(--primary-soft-ink); border-bottom-color: var(--primary); }

/* ---- topbar help menu (mirrors the Help section of the sidebar) ---- */
.help-menu { position: relative; }
.help-menu > summary { list-style: none; cursor: pointer; }
.help-menu > summary::-webkit-details-marker { display: none; }
.help-menu[open] > summary .icon-btn { background: var(--surface-2); color: var(--ink); }
.help-menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; z-index: 50;
  padding: 6px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: 2px;
  animation: rise var(--t-fast) var(--ease-out) both;
}
.help-menu-pop a {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 8px 10px;
  border-radius: var(--r-sm); color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none;
}
.help-menu-pop a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }


/* ---- table hygiene: long text truncates with a tooltip instead of wrapping rows tall ---- */
.table td.cell-trunc { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table td.cell-main { white-space: nowrap; }

/* ---- empty states with a next step ---- */
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

/* ---- inline hint banner above a list ---- */
.hint-banner {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 10px 14px;
  border-radius: var(--r-md); background: var(--primary-soft); color: var(--primary-soft-ink); font-size: 13px;
}
.hint-banner .text-muted { color: color-mix(in srgb, var(--primary-soft-ink) 70%, var(--muted)); }
.hint-banner .btn { margin-left: auto; flex: 0 0 auto; }

/* ---- generic form modal (Releases: Upload a build) ---- */
dialog.modal {
  border: none; padding: 0; width: min(94vw, 600px); max-height: 92vh;
  border-radius: var(--r-xl); background: var(--surface); color: var(--ink);
  outline: 1px solid var(--line); box-shadow: var(--shadow-3);
}
dialog.modal::backdrop { background: rgba(8, 10, 14, 0.55); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: rise var(--t-med) var(--ease-out); }
.modal-card { display: flex; flex-direction: column; max-height: 92vh; }
.modal-card .card-head { display: flex; justify-content: space-between; align-items: center; flex: 0 0 auto; }
.modal-card .card-body { overflow-y: auto; }

/* Layout toggle that sits inside a filter row (Releases: Flat / By platform). */
.list-filter-row .seg { flex: 0 0 auto; gap: 4px; margin-left: auto; }
.list-filter-row select.input { flex: 0 1 170px; min-width: 130px; }

/* Filters apply instantly when scripts run (nuvflow.js submits on change / as you
   type); the Apply button only exists for the no-JS path. */
.nf-live .list-filters button[type="submit"],
.nf-live .audit-filters button[type="submit"] { display: none; }
