/* ============================================================
   Queens Bakery — shell.css
   ALL shared layout + kit component styles. Built ONLY on the
   tokens from /tokens.css. Class names here are the contract
   that every page builder depends on. No hardcoded colors.
   ============================================================ */

/* ---- Base reset ---- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: var(--leading);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
img { max-width: 100%; }

/* ============================================================
   LAYOUT — shell / sidebar / main / topbar
   ============================================================ */
.shell { display: flex; align-items: flex-start; min-height: 100vh; }

.side {
  position: sticky;
  top: 0;
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: var(--sp-3) 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
}
.brand-sq { width: 12px; height: 12px; border-radius: 3px; background: var(--brand); flex: 0 0 auto; }
.brand-name { color: var(--sidebar-heading); font-weight: 700; font-size: var(--text-base); line-height: 1.2; }
.brand-sub { color: var(--sidebar-dim); font-size: var(--text-xs); line-height: 1.3; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 1px; padding: 0 var(--sp-2); }
/* Thai-only compact items (owner feedback 2026-07-18): no .nav-en anymore,
   38px rows — tighter than the old 44 but still comfortably tablet-tappable. */
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 38px;
  padding: 0 var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: var(--text-sm);
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--sidebar-surface); }
.nav-item .nav-th { font-weight: 500; }
.nav-item.active {
  background: var(--sidebar-surface);
  color: var(--sidebar-heading);
  border-left-color: var(--sidebar-active);
  font-weight: 700;
}

main#main {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--sp-4);
  max-width: 1280px;
  width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--topbar-h);
  padding: 0 var(--sp-4);
  margin: calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4)) var(--sp-4);
  background: var(--panel);
  border-bottom: 3px solid var(--accent, var(--accent-default));
}
.topbar .titles { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.topbar h1 { font-size: var(--text-lg); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .en { font-size: var(--text-xs); color: var(--muted); }
.topbar .spacer { flex: 1 1 auto; }
.topbar .clock { font-size: var(--text-sm); color: var(--muted); font-variant-numeric: tabular-nums; min-width: 46px; text-align: right; }
.topbar select { max-width: 150px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover { background: var(--panel-2); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---- Mobile: sidebar → horizontal icon+label strip ---- */
.nav-toggle { display: none; }
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side {
    position: sticky;
    top: 0;
    z-index: 30;
    flex: none;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: var(--sp-2);
    overflow-x: auto;
    overflow-y: hidden;
    padding: var(--sp-2) var(--sp-3);
    -webkit-overflow-scrolling: touch;
  }
  .brand { padding: 0 var(--sp-2) 0 0; flex: 0 0 auto; }
  .brand-sub { display: none; }
  .nav { flex-direction: row; padding: 0; gap: var(--sp-1); flex: 1 1 auto; }
  .nav-item {
    flex: 0 0 auto;
    min-height: 40px;
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }
  .nav-item.active { border-left: none; border-bottom-color: var(--sidebar-active); }
  main#main { max-width: 100%; padding: var(--sp-3); }
  .topbar { margin: calc(-1 * var(--sp-3)) calc(-1 * var(--sp-3)) var(--sp-3); }
}

/* ============================================================
   CARD
   ============================================================ */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-4);
}
.card > h3 {
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
}
.card > h3 .tag { color: var(--muted); font-size: var(--text-xs); font-weight: 400; }
.card-link { display: block; }
.card-link:hover { border-color: var(--brand); box-shadow: var(--shadow-md); }

/* ============================================================
   KPI tiles
   ============================================================ */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-3); }
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.kpi .num { display: block; font-size: var(--text-xl); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .lbl { display: block; font-size: var(--text-xs); color: var(--muted); margin-top: 4px; }
.kpi.bad .num { color: var(--bad); }
.kpi.warn .num { color: var(--warn); }
.kpi.ok .num { color: var(--ok); }
.kpi.info .num { color: var(--info); }

/* ============================================================
   CHIP
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  line-height: 1.3;
  padding: 2px 10px;
  border-radius: var(--pill);
  white-space: nowrap;
  background: var(--panel-2);
  color: var(--muted);
}
.chip.c-ok   { color: var(--ok);   background: var(--ok-soft); }
.chip.c-warn { color: var(--warn); background: var(--warn-soft); }
.chip.c-bad  { color: var(--bad);  background: var(--bad-soft); }
.chip.c-info { color: var(--info); background: var(--info-soft); }
.chip.c-auto { color: var(--auto); background: var(--auto-soft); }
.chip.c-muted{ color: var(--muted);background: var(--panel-2); }
.chip.c-brand{ color: var(--brand);background: var(--brand-soft); }

/* count pill (big red pill used on My Day tasks) */
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 var(--sp-3);
  border-radius: var(--pill);
  background: var(--brand);
  color: var(--brand-contrast);
  font-weight: 700;
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   PIPELINE  (the centerpiece)
   ============================================================ */
.pipeline { display: flex; flex-wrap: wrap; gap: 0; align-items: center; }
.stage {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--sp-3);
  margin: 3px 0;
  border-radius: var(--pill);
  font-size: var(--text-sm);
  white-space: nowrap;
}
.stage::after {
  content: "";
  display: inline-block;
  width: 18px;
  height: 2px;
  margin: 0 2px;
  background: var(--line);
  flex: 0 0 auto;
}
.stage:last-child::after { display: none; }

.stage.s-done    { background: var(--stage-done-soft); color: var(--stage-done); }
.stage.s-done::after { background: var(--stage-done); opacity: .5; }
.stage.s-current {
  background: var(--panel);
  color: var(--ink);
  border: 2px solid var(--stage-current);
  font-weight: 700;
  padding: 0 calc(var(--sp-3) - 2px);
}
.stage.s-pending { border: 1px solid var(--line); color: var(--stage-pending); }
.stage.s-blocked { background: var(--stage-blocked-soft); color: var(--stage-blocked); font-weight: 700; }
.stage.s-skipped { border: 1px dashed var(--line); color: var(--stage-skipped); }

.stage .dot {
  width: 8px; height: 8px; border-radius: var(--pill);
  background: var(--brand); margin-right: 6px; flex: 0 0 auto;
}
.stage .skip-tag { font-size: var(--text-xs); color: var(--stage-skipped); margin-left: 6px; }

/* compact variant */
.pipeline.compact .stage { font-size: var(--text-xs); min-height: 28px; padding: 0 var(--sp-2); }
.pipeline.compact .stage::after { display: none; }
.pipeline.compact .stage.hide-lbl { display: none; }

.pipeline-note {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
  color: var(--bad);
  font-size: var(--text-sm);
}

/* count strip (My Day flow) — clickable stage chips carrying a count */
.count-strip { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.count-strip .cs {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px var(--sp-3);
  border-radius: var(--pill);
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-size: var(--text-sm);
}
.count-strip .cs:hover { border-color: var(--brand); }
.count-strip .cs .n { font-weight: 700; font-variant-numeric: tabular-nums; }
.count-strip .cs.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.count-strip .cs.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.count-strip .sep { color: var(--muted); }

/* ============================================================
   TABLES
   ============================================================ */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
thead th {
  text-align: left;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--line-soft); }
tbody tr:hover { background: var(--panel-2); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
th.num, td.num { text-align: right; }

/* ============================================================
   CONTROLS — buttons, inputs, filters
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--touch);
  padding: 0 var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}
.btn:hover { background: var(--panel-2); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); font-weight: 600; }
.btn-primary:hover { background: var(--brand-deep); }
.btn-sm { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--text-xs); }
.btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }

select, input, textarea {
  min-height: var(--touch);
  padding: 0 var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
}
textarea { padding: var(--sp-2) var(--sp-3); min-height: 72px; line-height: var(--leading); }
select:focus-visible, input:focus-visible, textarea:focus-visible { outline: none; box-shadow: var(--focus); }

.filters { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: flex-end; margin-bottom: var(--sp-4); }
.filters .field { display: flex; flex-direction: column; gap: 4px; }
.filters .field > label { font-size: var(--text-xs); color: var(--muted); }

/* stepper [−][value][+] */
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.stepper button {
  width: var(--touch); height: var(--touch);
  border: none; background: var(--panel); color: var(--ink);
  font-size: var(--text-lg); cursor: pointer;
}
.stepper button:hover { background: var(--panel-2); }
.stepper .val {
  min-width: 52px; display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: var(--text-base);
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; gap: var(--sp-2); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-4); overflow-x: auto; }
.tabs button {
  min-height: 44px;
  padding: 0 var(--sp-3);
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: var(--text-sm);
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button.active { color: var(--ink); border-bottom-color: var(--brand); font-weight: 700; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============================================================
   BANNER
   ============================================================ */
.banner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  border-left: 4px solid var(--info);
  background: var(--info-soft);
  color: var(--info);
  margin-bottom: var(--sp-4);
  font-size: var(--text-sm);
}
.banner.b-bad  { border-left-color: var(--bad);  background: var(--bad-soft);  color: var(--bad); }
.banner.b-warn { border-left-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.banner.b-info { border-left-color: var(--info); background: var(--info-soft); color: var(--info); }
.banner.b-ok   { border-left-color: var(--ok);   background: var(--ok-soft);   color: var(--ok); }
.banner .spacer { flex: 1 1 auto; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: var(--sp-5);
  transform: translateX(-50%) translateY(8px);
  z-index: 100;
  max-width: 90vw;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--pill);
  background: var(--sidebar-bg);
  color: var(--sidebar-heading);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   SKELETON
   ============================================================ */
.skeleton {
  height: 44px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--sp-2);
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--line-soft) 37%, var(--panel-2) 63%);
  background-size: 400% 100%;
  animation: sk 1.4s ease infinite;
}
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ============================================================
   EMPTY
   ============================================================ */
.empty {
  text-align: center;
  color: var(--muted);
  padding: var(--sp-6) var(--sp-4);
}
.empty .emoji { font-size: 40px; display: block; margin-bottom: var(--sp-3); }
.empty p { margin-bottom: var(--sp-3); }

/* ============================================================
   DIALOG
   ============================================================ */
dialog.dialog-card {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: 440px;
  width: 92vw;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
dialog.dialog-card::backdrop { background: rgba(0, 0, 0, .4); }
dialog.dialog-card .dc-body { padding: var(--sp-4); }
dialog.dialog-card h3 { font-size: var(--text-lg); font-weight: 700; margin-bottom: var(--sp-3); }
dialog.dialog-card p { color: var(--muted); font-size: var(--text-sm); }
dialog.dialog-card .dc-actions { display: flex; justify-content: flex-end; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); }

/* ============================================================
   Utility
   ============================================================ */
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: var(--text-xs); }
.b { font-weight: 700; }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mb-0 { margin-bottom: 0; }
.chev { color: var(--muted); margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }

/* ============================================================
   KIOSK mode (POS, driver) — no sidebar, bigger base
   ============================================================ */
body.kiosk { font-size: 19px; }
body.kiosk .side { display: none; }
body.kiosk main#main { max-width: 100%; padding: var(--sp-4); }
body.kiosk .kiosk-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--topbar-h);
  padding: 0 var(--sp-4);
  /* Inserted by initShell as a direct child of <body> (a sibling BEFORE
     <main>), NOT inside padded #main like the admin .topbar. <body> has
     margin:0 and no padding, so negative side margins would push the sticky
     header --sp-4 past each viewport edge → permanent 16px horizontal
     overflow (desktop + 375px). margin:0 spans exactly 100% viewport width. */
  margin: 0 0 var(--sp-4);
  background: var(--panel);
  border-bottom: 3px solid var(--accent, var(--accent-default));
}
body.kiosk .btn:active, body.kiosk .kiosk-tile:active, body.kiosk .count-pill:active { transform: scale(.98); }
.kiosk-home { display: inline-flex; align-items: center; gap: var(--sp-2); font-weight: 700; color: var(--brand); }

/* ============================================================
   v2 comparison-interface additions (foundation-owned)
   Banner · source chip · read-only marks · login dialog.
   Tokens only — no hardcoded colours; works in light + dark.
   ============================================================ */

/* ---- Slim persistent banner (§7). Sits above the shell; never dismissible.
   The "เปิดหน้าเดิม →" link (href="/") is the ONE allowed absolute URL. ---- */
.v2-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 32px;
  padding: 2px var(--sp-4);
  background: var(--brand-soft);
  color: var(--ink);
  border-bottom: 1px solid var(--brand);
  font-size: var(--text-xs);
  position: relative;
  z-index: 30;
}
.v2-banner .v2-b-tag { font-weight: 700; color: var(--brand); white-space: nowrap; }
.v2-banner .v2-b-txt { color: var(--muted); white-space: nowrap; }
.v2-banner .v2-b-spacer { flex: 1 1 auto; }
.v2-banner .v2-b-old { font-weight: 600; color: var(--brand); text-decoration: none; white-space: nowrap; }
.v2-banner .v2-b-old:hover { text-decoration: underline; }
.v2-banner .v2-b-login { display: inline-flex; align-items: center; }
.v2-banner .v2-b-user { color: var(--ink); font-weight: 600; white-space: nowrap; }
.v2-banner .v2-b-btn {
  min-height: 26px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--brand);
  border-radius: var(--pill);
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}
.v2-banner .v2-b-btn:hover { background: var(--brand); color: var(--brand-contrast); }
.v2-banner .v2-b-btn:focus-visible { outline: none; box-shadow: var(--focus); }

/* Authentication now lives in the page header; the obsolete experimental banner is gone. */
.topbar > .v2-b-login,
.kiosk-top > .v2-b-login { display: inline-flex; align-items: center; gap: var(--sp-2); }
.topbar > .v2-b-login .v2-b-user,
.kiosk-top > .v2-b-login .v2-b-user { color: var(--ink); font-weight: 600; white-space: nowrap; }
.topbar > .v2-b-login .v2-b-btn,
.kiosk-top > .v2-b-login .v2-b-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.topbar > .v2-b-login .v2-b-btn:hover,
.kiosk-top > .v2-b-login .v2-b-btn:hover { background: var(--brand); color: var(--brand-contrast); }
.topbar > .v2-b-login .v2-b-btn:focus-visible,
.kiosk-top > .v2-b-login .v2-b-btn:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---- Source chip beside the page title (§7) ---- */
.v2-src-chip { align-self: center; flex: 0 0 auto; white-space: nowrap; }

/* ---- Read-only marks (§6): visible but neutralized; toasts on tap ---- */
.v2-ro { opacity: .6; cursor: not-allowed !important; }
.v2-ro:hover { opacity: .6; }
/* W1 save in mock mode: tappable — explains + opens login (shell.js writeNeedsLogin) */
.v2-login-req { opacity: .75; }

/* ---- Login dialog (§5) — reuses .dialog-card chrome ---- */
dialog.v2-login .v2-login-fields { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-3); }
dialog.v2-login .v2-login-fields input { width: 100%; }
dialog.v2-login .v2-login-err { color: var(--bad); font-size: var(--text-sm); min-height: 1.2em; margin-top: var(--sp-2); }
dialog.v2-login::backdrop { background: rgba(15, 23, 42, .42); backdrop-filter: blur(7px); }

/* Logged-out V2 is an authentication screen, not a demo. Hide the complete
   application shell while the session is absent or being checked; the only
   visible surface is the standalone login gate below. */
body.v2-auth-locked,
body.v2-auth-checking { overflow: hidden; }
body.v2-auth-locked > .shell,
body.v2-auth-checking > .shell,
body.v2-auth-locked > .kiosk-top,
body.v2-auth-checking > .kiosk-top,
body.v2-auth-locked > main,
body.v2-auth-checking > main {
  visibility: hidden !important;
  pointer-events: none !important;
  user-select: none !important;
}
.v2-auth-gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  background: var(--bg);
  color: var(--ink);
}
.v2-auth-card {
  width: min(100%, 390px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: calc(var(--sp-6) + var(--sp-2));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.v2-auth-card h1 { margin: 0; font-size: var(--text-xl); }
.v2-auth-card p { margin: 0; color: var(--muted); }
.v2-auth-mark {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--brand);
  color: var(--brand-contrast);
  font-weight: 800;
  letter-spacing: -.03em;
}
.v2-auth-action { min-height: var(--touch); display: flex; align-items: center; }
.v2-auth-action .btn { min-width: 150px; }

/* ============================================================
   v2 revision: search + combobox + auto-refresh
   (design/DESIGN.md §2) — tokens only, light+dark via tokens.
   ============================================================ */

/* ---- searchField (§2.3): grow-first field in a .filters row ---- */
.filters .field.search-field { flex: 1 1 240px; }
.filters .field.search-field input { width: 100%; max-width: 420px; min-height: var(--touch); }

/* ---- comboBox (§2.4) ---- */
.combo { position: relative; display: inline-flex; align-items: stretch; min-width: 200px; }
.combo .combo-input { width: 100%; padding-right: calc(var(--touch) + var(--sp-1)); }
.combo .combo-clear {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  width: var(--touch); height: var(--touch);
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none; color: var(--muted);
  font-size: var(--text-base); cursor: pointer; border-radius: var(--radius-sm);
}
.combo .combo-clear:hover { color: var(--ink); background: var(--panel-2); }
.combo .combo-clear:focus-visible { outline: none; box-shadow: var(--focus); }
.combo .combo-list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  margin-top: 2px; max-height: 40vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  display: none;
}
.combo.open .combo-list { display: block; }
.combo .combo-item {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  min-height: var(--touch); padding: var(--sp-2) var(--sp-3);
  border: none; background: none; color: var(--ink);
  font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer;
}
.combo .combo-item:hover, .combo .combo-item.active { background: var(--panel-2); }
.combo .combo-item.active { box-shadow: inset 3px 0 0 var(--brand); }
.combo .combo-item-label { flex: 1 1 auto; min-width: 0; }
.combo .combo-item-hint { flex: 0 0 auto; color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.combo mark.combo-hl { background: var(--hl-bg); color: var(--hl-ink); border-radius: 3px; padding: 0 1px; }
.combo .combo-more, .combo .combo-empty {
  padding: var(--sp-2) var(--sp-3); color: var(--muted); font-size: var(--text-xs);
}
.combo .combo-empty { text-align: center; padding: var(--sp-4) var(--sp-3); }
/* round-2 §R1: action button inside the combobox empty state */
.combo .combo-empty .combo-empty-action { margin-top: var(--sp-2); }

/* ---- auto-refresh pill (§2.2): fixed, thumb-reachable, above content ---- */
.fresh-pill {
  position: fixed; left: 50%; top: calc(var(--topbar-h) + 44px);
  transform: translateX(-50%) translateY(-8px);
  z-index: 60;
  min-height: var(--touch); padding: 0 var(--sp-5);
  border: none; border-radius: var(--pill);
  background: var(--brand); color: var(--brand-contrast);
  font: inherit; font-size: var(--text-sm); font-weight: 600;
  box-shadow: var(--shadow-lg); cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.fresh-pill.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.fresh-pill:focus-visible { outline: none; box-shadow: var(--focus), var(--shadow-lg); }
@media print { .fresh-pill { display: none; } }

/* round-2 §R4: quiet "data checked/changed" pulse (My Day; reusable) */
@keyframes tickFlash { from { background: var(--brand-soft); } to { background: transparent; } }
.tick-flash { animation: tickFlash 1.2s ease-out; }

/* round-2 §R5: freshly-arrived rows after a pill apply */
@keyframes newRowFade { from { background: var(--brand-soft); } to { background: var(--panel); } }
a.ord-row.is-new { animation: newRowFade 4s ease-out; }
