/* ===========================================================================
   Vision Agent Hub — design system
   Single source of truth for all pages. Allianz brand blue + Vision energy.
   Theme via [data-theme] on <html>; falls back to prefers-color-scheme.
   =========================================================================== */

:root {
  /* Brand */
  --allianz-blue: #003781;
  --allianz-blue-600: #0056b8;
  --allianz-blue-300: #4a90d9;
  --accent: #00857c;         /* AlliSya teal */
  --accent-2: #f5a623;       /* Vision energy / gold */
  --danger: #d0021b;
  --success: #2e9e5b;

  /* Light theme surfaces */
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --border: #dfe5ee;
  --text: #1a2230;
  --text-muted: #5c6b82;
  --shadow: 0 1px 3px rgba(16, 34, 66, .08), 0 6px 24px rgba(16, 34, 66, .06);

  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0e1420;
  --surface: #171f2e;
  --surface-2: #1f293b;
  --border: #2b384f;
  --text: #e8edf5;
  --text-muted: #9aa8bf;
  --allianz-blue: #4a90d9;
  --allianz-blue-600: #6aa9e6;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 6px 24px rgba(0, 0, 0, .3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1420;
    --surface: #171f2e;
    --surface-2: #1f293b;
    --border: #2b384f;
    --text: #e8edf5;
    --text-muted: #9aa8bf;
    --allianz-blue: #4a90d9;
    --allianz-blue-600: #6aa9e6;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 6px 24px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Faint, thin scrollbars everywhere (page bar, rails, tables) ----------
   Neutral translucent grey reads subtly on both light & dark surfaces, so no
   per-theme rule is needed. Applies to the main page scrollbar and every scroll
   container; .sc-rail keeps its own thinner override. */
* { scrollbar-width: thin; scrollbar-color: rgba(128, 130, 145, .16) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128, 130, 145, .16); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(128, 130, 145, .40); background-clip: padding-box; }
/* Hide the full-height page (viewport) scrollbar — it ran alongside the fixed
   navbar. The page still scrolls (wheel/trackpad/keys); inner scroll areas
   (rails, tables) keep the faint bar above. */
html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--allianz-blue);
  color: #fff;
  box-shadow: var(--shadow);
}
.topbar__inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .3px; color: #fff; text-decoration: none; }
.brand__mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #fff 0 45%, var(--accent-2) 45% 100%);
  display: grid; place-items: center; color: var(--allianz-blue); font-weight: 900; font-size: 15px;
}
.brand small { display: block; font-weight: 500; font-size: 11px; opacity: .8; letter-spacing: .5px; }
.nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: #dbe7f7; text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 7px 12px; border-radius: 8px; white-space: nowrap;
}
.nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav a.active { background: #fff; color: var(--allianz-blue); }
.theme-btn {
  background: rgba(255,255,255,.14); border: 0; color: #fff; cursor: pointer;
  width: 34px; height: 34px; border-radius: 8px; font-size: 15px;
}
.menu-btn { display: none; background: rgba(255,255,255,.14); border: 0; color: #fff; cursor: pointer; width: 36px; height: 36px; border-radius: 8px; font-size: 18px; }

@media (max-width: 860px) {
  .menu-btn { display: block; margin-left: auto; }
  .nav { display: none; order: 3; width: 100%; flex-direction: column; margin: 0; padding-top: 8px; }
  .nav.open { display: flex; }
  .nav a { padding: 10px 12px; }
  .theme-btn { order: 2; }
}

/* ---------- Layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 28px 20px 80px; }
.page-head { margin: 8px 0 24px; }
.page-head h1 { margin: 0 0 6px; font-size: clamp(24px, 4vw, 34px); letter-spacing: -.5px; }
.page-head p { margin: 0; color: var(--text-muted); max-width: 70ch; }
.eyebrow { text-transform: uppercase; letter-spacing: 1.5px; font-size: 12px; font-weight: 800; color: var(--allianz-blue-600); }

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 17px; }
.card p { margin: 0; color: var(--text-muted); font-size: 14.5px; }

.tile { display: block; text-decoration: none; color: inherit; transition: transform .12s ease, box-shadow .12s ease; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(16,34,66,.14); }
.tile .ico { font-size: 26px; }
.tile h3 { color: var(--text); margin-top: 10px; }
.tile .go { color: var(--allianz-blue-600); font-weight: 700; font-size: 14px; margin-top: 12px; display: inline-block; }

/* ---------- Stat strip ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 4px 0 26px; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; box-shadow: var(--shadow); }
.stat .num { font-size: 26px; font-weight: 800; color: var(--allianz-blue-600); line-height: 1.1; }
.stat .lbl { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Sections ---------- */
.section { margin: 34px 0 0; }
.section > h2 {
  font-size: 20px; margin: 0 0 14px; display: flex; align-items: center; gap: 10px;
  border-left: 4px solid var(--accent-2); padding-left: 12px;
}
.section .sub { color: var(--text-muted); margin: -6px 0 16px; }

/* ---------- Step / numbered ---------- */
.step { display: flex; gap: 16px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; }
.step__n { flex: 0 0 40px; height: 40px; border-radius: 10px; background: var(--allianz-blue); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 17px; }
.step__body { flex: 1; min-width: 0; }
.step__body h3 { margin: 2px 0 6px; font-size: 17px; }
.step__body ul { margin: 8px 0 0; padding-left: 18px; }
.step__body li { margin: 4px 0; }

/* ---------- Callouts ---------- */
.callout { border-radius: var(--radius); padding: 14px 16px; margin: 14px 0; border: 1px solid var(--border); background: var(--surface-2); }
.callout.tip { border-left: 4px solid var(--success); }
.callout.warn { border-left: 4px solid var(--accent-2); }
.callout.quote { border-left: 4px solid var(--allianz-blue-600); font-style: italic; }
.callout b { color: var(--text); }

/* ---------- Script blocks ---------- */
.script { background: var(--surface-2); border: 1px dashed var(--allianz-blue-300); border-radius: var(--radius-sm); padding: 12px 14px; margin: 10px 0; font-size: 14.5px; }
.script::before { content: "💬 Script"; display: block; font-size: 11px; font-weight: 800; letter-spacing: .5px; color: var(--allianz-blue-600); text-transform: uppercase; margin-bottom: 6px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 12px 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 480px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
thead th { background: var(--allianz-blue); color: #fff; font-weight: 700; white-space: nowrap; }
tbody tr:nth-child(even) { background: var(--surface-2); }

/* ---------- Pills / tags ---------- */
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); }
.pill.blue { background: rgba(0,86,184,.12); color: var(--allianz-blue-600); border-color: transparent; }
.pill.teal { background: rgba(0,133,124,.14); color: var(--accent); border-color: transparent; }
.pill.gold { background: rgba(245,166,35,.16); color: #b5760a; border-color: transparent; }

/* ---------- Forms & buttons ---------- */
input, select, textarea {
  font-family: var(--font); font-size: 14.5px; width: 100%;
  padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--allianz-blue-300); outline-offset: 1px; }
label { font-size: 13px; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 4px; }
.field { margin-bottom: 12px; }

/* ---------- Currency input: "Rp" prefix + comma grouping + ▲▼ steppers ----------
   Paired with assets/js/currency-input.js on any <input data-currency>. The
   padding overrides are !important so they hold even where a page bumps the base
   input padding (e.g. the big-font Scenario rails). */
.cur-field { position: relative; }
.cur-field input { padding-left: 34px !important; padding-right: 30px !important; }
.cur-rp { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13.5px; font-weight: 700; color: var(--text-muted); pointer-events: none; }
.cur-arrows { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 2px; }
.cur-arrows button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 9px; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.cur-arrows button:hover { color: var(--allianz-blue-600); background: var(--surface-2); }

.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border: 0; border-radius: var(--radius-sm); padding: 10px 16px;
  font-weight: 700; font-size: 14.5px; background: var(--allianz-blue); color: #fff;
}
.btn:hover { background: var(--allianz-blue-600); }
.btn.ghost { background: transparent; color: var(--allianz-blue-600); border: 1px solid var(--border); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--border); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }

/* ---------- Progress ---------- */
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--allianz-blue-600), var(--accent)); width: 0; transition: width .4s ease; }

/* ---------- Follow-up cockpit rows (dashboard "today") ---------- */
.fu-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.fu-row:last-child { border-bottom: 0; }
.fu-name { flex: 1; min-width: 150px; font-size: 14px; }
.fu-actions { display: flex; gap: 6px; margin-left: auto; }

/* ---------- Weekly activity log rows ---------- */
.act-row { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; row-gap: 7px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); }
.act-row:last-child { border-bottom: 0; }
.act-label { grid-column: 1; grid-row: 1; font-weight: 600; font-size: 14px; }
.act-count { grid-column: 2; grid-row: 1; text-align: right; font-size: 13.5px; color: var(--text-muted); }
.act-count b { color: var(--text); font-size: 16px; }
.act-bar { grid-column: 1; grid-row: 2; height: 8px; }
.act-btns { grid-column: 2; grid-row: 2; display: flex; gap: 6px; }
.act-btns .btn { min-width: 40px; justify-content: center; }

/* ---------- Checklist items ---------- */
.checkline { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.checkline:last-child { border-bottom: 0; }
.checkline input[type=checkbox] { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--allianz-blue-600); }
.checkline.done label { text-decoration: line-through; color: var(--text-muted); }
.checkline label { margin: 0; font-weight: 500; color: var(--text); font-size: 14.5px; }

/* ---------- Misc ---------- */
.muted { color: var(--text-muted); }
.center { text-align: center; }
.mt { margin-top: 18px; }
.hr { height: 1px; background: var(--border); border: 0; margin: 22px 0; }
.footer-note { text-align: center; color: var(--text-muted); font-size: 12.5px; margin-top: 50px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
details.acc { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 14px; margin: 8px 0; background: var(--surface); }
details.acc summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.disclaimer { font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); margin-top: 40px; padding-top: 16px; }

@media print {
  .topbar, .theme-btn, .menu-btn, .btn { display: none !important; }
  body { background: #fff; }
  .card, .step { box-shadow: none; }
}

/* ===========================================================================
   Mobile-first chrome: iOS-style glass bottom tab bar, "More" sheet, PIN gate,
   PWA/standalone tweaks. Added for the mobile redesign.
   =========================================================================== */

/* Hide the old hamburger — the bottom tab bar replaces it on mobile. */
.menu-btn { display: none !important; }

@media (max-width: 900px) {
  .nav { display: none !important; }                 /* top nav links → bottom bar */
  .wrap { padding-bottom: 128px; }                   /* clear the floating bar */
  .topbar__inner { padding: 10px 16px; }
}
@media (max-width: 620px) {
  .wrap { padding-left: 14px; padding-right: 14px; }
  .page-head h1 { font-size: 25px; }
  .section > h2 { font-size: 18px; }
  .card { padding: 16px; }
}

/* ---------- Glass bottom tab bar ---------- */
.tabbar { display: none; }
@media (max-width: 900px) {
  .tabbar {
    display: flex; position: fixed; z-index: 60;
    left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    margin: 0 auto; max-width: 520px;
    padding: 7px 6px; gap: 2px; justify-content: space-around; align-items: stretch;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.62);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    backdrop-filter: blur(22px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 10px 34px rgba(16, 34, 66, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  }
  :root[data-theme="dark"] .tabbar {
    background: rgba(26, 34, 50, 0.62);
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
}
@media (max-width: 900px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tabbar {
    background: rgba(26, 34, 50, 0.62);
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
}
.tabbar a, .tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 7px 2px; border: 0; background: transparent; cursor: pointer;
  text-decoration: none; color: var(--text-muted); border-radius: 18px; min-height: 46px;
  transition: color .15s, background .15s;
}
.tabbar .tb-ico { font-size: 20px; line-height: 1; }
.tabbar .tb-lbl { font-size: 10px; font-weight: 700; letter-spacing: .2px; }
.tabbar a.active { color: var(--allianz-blue-600); background: rgba(0, 86, 184, 0.12); }
:root[data-theme="dark"] .tabbar a.active { color: #8fc0ff; background: rgba(120, 170, 255, 0.16); }

/* ---------- "More" bottom sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 70; background: rgba(8, 14, 24, 0.42);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 71; left: 0; right: 0; bottom: 0;
  transform: translateY(100%); transition: transform .32s cubic-bezier(.32, .72, 0, 1);
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(26px) saturate(180%); backdrop-filter: blur(26px) saturate(180%);
  border-radius: 26px 26px 0 0; padding: 8px 16px calc(env(safe-area-inset-bottom, 0px) + 22px);
  box-shadow: 0 -12px 44px rgba(0, 0, 0, 0.22); max-height: 82vh; overflow-y: auto;
}
:root[data-theme="dark"] .sheet { background: rgba(22, 30, 45, 0.92); }
.sheet.open { transform: translateY(0); }
.sheet .grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 8px auto 16px; }
.sheet h4 { margin: 0 0 12px; font-size: 15px; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sheet-grid a {
  text-decoration: none; color: var(--text); text-align: center; padding: 15px 6px;
  border-radius: 16px; background: var(--surface-2); font-size: 11.5px; font-weight: 600; line-height: 1.25;
}
.sheet-grid a .em { display: block; font-size: 23px; margin-bottom: 6px; }
.sheet-grid a.active { background: var(--allianz-blue); color: #fff; }
.sheet h5 { margin: 16px 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); }
.sheet h5:first-of-type { margin-top: 4px; }

/* ---------- Double top navbar: primary group row + sticky secondary sub-row ---------- */
.topbar__inner .brand { order: 0; white-space: nowrap; flex: 0 0 auto; }
.nav.tnav { order: 1; display: flex !important; flex-direction: row; align-items: center; gap: 4px; margin: 0 auto 0 18px; flex-wrap: nowrap; overflow-x: auto; width: auto; padding: 0; }
.nav.tnav::-webkit-scrollbar { display: none; }
.theme-btn { order: 2; margin-left: 0; }
.tnav-top { display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 9px; color: #dbe7f7; text-decoration: none; font-weight: 700; font-size: 14px; white-space: nowrap; }
.tnav-top:hover { background: rgba(255,255,255,.12); color: #fff; }
.tnav-top.active { background: #fff; color: var(--allianz-blue); }
.tnav-top .ti { font-size: 15px; }

.subnav2 { position: sticky; top: 0; z-index: 40; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.subnav2::-webkit-scrollbar { height: 0; }
.subnav2-inner { display: flex; gap: 2px; max-width: var(--maxw); margin: 0 auto; padding: 7px 16px; }
.sub2-link { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; color: var(--text-muted); text-decoration: none; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.sub2-link:hover { background: var(--surface-2); color: var(--text); }
.sub2-link.active { background: var(--allianz-blue); color: #fff; }
/* cascade breadcrumb — shown when you're inside a venture's own toolkit (Vision Agent) */
.sub2-crumb { display: flex; align-items: center; padding: 7px 10px; border-radius: 8px; color: var(--text-muted); text-decoration: none; font-size: 13px; font-weight: 600; white-space: nowrap; }
.sub2-crumb:hover { background: var(--surface-2); color: var(--text); }
.sub2-scope { display: flex; align-items: center; padding: 7px 10px 7px 4px; margin-right: 6px; border-right: 1px solid var(--border); color: var(--text); font-size: 13px; font-weight: 700; white-space: nowrap; }
.sub2-link .ti { font-size: 14px; }

@media (max-width: 760px) {
  .nav.tnav { margin-left: 10px; gap: 2px; }
  .tnav-top { padding: 7px 10px; font-size: 12.5px; gap: 5px; }
  .subnav2-inner { padding: 6px 10px; }
}

/* ---------- Finance unlock gate (name + PIN) ---------- */
.fgate { position: fixed; inset: 0; z-index: 9998; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(125% 100% at 50% 0%, #0a2c5e 0%, #061a38 58%, #030f22 100%); }
.fgate-card { width: 100%; max-width: 340px; text-align: center; display: flex; flex-direction: column; gap: 10px; }
.fgate-mark { font-size: 40px; }
.fgate-card h2 { color: #fff; margin: 0; font-size: 20px; }
.fgate-card p { color: #9fb6d6; margin: 0 0 6px; font-size: 13px; }
.fgate-card input { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); color: #fff; text-align: center; }
.fgate-card input::placeholder { color: #7f9bc0; }
.fgate-card .btn { justify-content: center; }
.fgate-err { color: #ff9ba6; font-size: 13px; min-height: 18px; }

/* ---------- "All pages" panel: header + search (shared mobile + desktop) ---------- */
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 2px 2px 12px; flex-wrap: wrap; }
.sheet-head h4 { margin: 0; }
.sheet-search { flex: 1; min-width: 160px; max-width: 340px; margin-left: auto; padding: 8px 12px; font-size: 14px; }
.sheet-sec { margin-bottom: 6px; }

/* On desktop the overflow is a CENTERED MODAL, not a full-width bottom sheet. */
@media (min-width: 901px) {
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%;
    width: min(880px, 92vw); max-height: 82vh;
    border-radius: 20px; padding: 18px 20px 22px;
    transform: translate(-50%, -47%) scale(.985); opacity: 0;
    transition: opacity .18s ease, transform .2s cubic-bezier(.32, .72, 0, 1);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .34);
  }
  .sheet.open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  .sheet .grabber { display: none; }
  .sheet-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ---------- PIN gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px; text-align: center;
  background: radial-gradient(125% 100% at 50% 0%, #0a2c5e 0%, #061a38 58%, #030f22 100%); color: #fff;
}
.gate__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 30px; font-weight: 800; font-size: 15px; }
.gate__brand .brand__mark { width: 30px; height: 30px; }
.gate__title { font-size: 18px; font-weight: 600; margin: 0 0 5px; }
.gate__sub { font-size: 13px; color: #9fb6d6; margin: 0 0 26px; min-height: 18px; }
.gate.err .gate__sub { color: #ff9ba6; }
.dots { display: flex; gap: 15px; margin-bottom: 34px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 1.6px solid rgba(255, 255, 255, 0.5); transition: all .15s; }
.dots i.on { background: #fff; border-color: #fff; transform: scale(1.05); }
.gate.shake { animation: gshake .4s; }
@keyframes gshake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 74px); gap: 18px; }
.keypad button {
  width: 74px; height: 74px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.09); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: #fff; font-size: 27px; font-weight: 400; cursor: pointer; transition: background .12s, transform .06s;
}
.keypad button:active { background: rgba(255, 255, 255, 0.24); transform: scale(0.96); }
.keypad button.fn { background: transparent; border-color: transparent; font-size: 14px; font-weight: 600; }
.gate__reset { margin-top: 28px; background: none; border: 0; color: #7f9bc0; font-size: 12.5px; cursor: pointer; }
.gate__reset:active { color: #fff; }

/* Standalone (added to Home Screen) — give the top bar a touch more top room. */
@media (display-mode: standalone) {
  .topbar__inner { padding-top: max(10px, env(safe-area-inset-top, 0px)); }
}

/* ---------- Auto-sync status dot (in the top bar) ---------- */
.sync-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px; font-size: 13px; font-weight: 700;
  color: #cfe0f5; background: rgba(255, 255, 255, 0.10); margin-left: 2px; transition: color .2s, opacity .2s;
}
.sync-dot[data-state="syncing"] { color: #fff; animation: syncpulse 1s infinite; }
.sync-dot[data-state="ok"] { color: #7cf0aa; }
.sync-dot[data-state="err"] { color: #ffb3bb; }
.sync-dot[data-state="idle"] { opacity: .45; }
@keyframes syncpulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
