/* ============================================================
   VAULT — "Midnight Archival"
   A private Swiss bank crossed with memento mori.
   ============================================================ */

:root {
  /* inks */
  --ink:      #0C0F0D;
  --ink-1:    #0F1310;
  --ink-2:    #121712;
  --ink-3:    #172017;
  --ink-4:    #1D271D;

  /* parchment */
  --parch:    #E9E3D3;
  --parch-80: rgba(233, 227, 211, .80);
  --parch-60: rgba(233, 227, 211, .60);
  --parch-40: rgba(233, 227, 211, .40);
  --parch-22: rgba(233, 227, 211, .22);

  /* brass */
  --brass:      #C7A45C;
  --brass-hi:   #E4C88A;
  --brass-deep: #8F7238;
  --brass-40:   rgba(199, 164, 92, .40);
  --brass-22:   rgba(199, 164, 92, .22);
  --brass-12:   rgba(199, 164, 92, .12);
  --brass-06:   rgba(199, 164, 92, .06);
  --hairline:   rgba(199, 164, 92, .26);

  /* states */
  --oxblood:    #93312B;
  --oxblood-hi: #BC4C42;
  --oxblood-22: rgba(147, 49, 43, .22);
  --sage:       #7C9A6D;
  --sage-22:    rgba(124, 154, 109, .22);
  --amber:      #C98F3D;
  --amber-22:   rgba(201, 143, 61, .20);
  --slate:      #7A8C96;
  --slate-22:   rgba(122, 140, 150, .20);

  /* type */
  --display: 'Fraunces', Georgia, serif;
  --body:    'Newsreader', Georgia, serif;
  --mono:    'Spline Sans Mono', 'Courier New', monospace;

  --rail-w: 232px;
  --letterpress: 0 1px 0 rgba(0,0,0,.55);
  --lift: 0 10px 30px -12px rgba(0,0,0,.7);
}

/* ---------- reset & base ---------- */

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

html { height: 100%; }

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 78% -10%, rgba(124,154,109,.05), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(199,164,92,.045), transparent 55%),
    var(--ink);
  color: var(--parch);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--brass); color: var(--ink); }

img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: var(--brass); text-decoration: none; }
a:hover { color: var(--brass-hi); }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.12;
  text-shadow: var(--letterpress);
}

/* accessible focus */
:focus-visible {
  outline: 1px solid var(--brass);
  outline-offset: 3px;
  border-radius: 2px;
}

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--brass-22) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--brass-22); border-radius: 5px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- film grain ---------- */

.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none;
  z-index: 2000;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 9s steps(6) infinite;
}
@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-2%, 1%); }
  40%  { transform: translate(1%, -2%); }
  60%  { transform: translate(-1%, 2%); }
  80%  { transform: translate(2%, -1%); }
  100% { transform: translate(0, 0); }
}

/* ---------- typographic utilities ---------- */

.ovl {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--parch-40);
}
.ovl b, .ovl strong { color: var(--brass); font-weight: 500; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.muted { color: var(--parch-60); }
.faint { color: var(--parch-40); }

.brass-rule {
  height: 1px;
  background: linear-gradient(90deg, var(--brass-40), var(--hairline) 40%, transparent);
  border: none;
}

/* ---------- staggered load reveal (one per view) ---------- */

.reveal {
  opacity: 0;
  animation: rise .65s cubic-bezier(.22,.8,.3,1) both;
  animation-delay: calc(var(--i, 0) * 75ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ============================================================
   BOOT / LOCK / SETUP (full-screen states)
   ============================================================ */

.boot-screen, .lock-screen, .setup-screen, .offline-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 40px;
  position: relative;
}

.boot-mark { display: flex; flex-direction: column; align-items: center; gap: 18px; animation: slow-pulse 3.2s ease-in-out infinite; }
.boot-word, .lock-word {
  font-family: var(--display);
  font-style: italic;
  font-optical-sizing: auto;
  font-size: 44px;
  color: var(--parch);
  letter-spacing: .02em;
  text-shadow: var(--letterpress);
}
@keyframes slow-pulse {
  0%, 100% { opacity: .55; }
  50%      { opacity: 1; }
}

/* --- lock --- */

.lock-screen { gap: 0; }
.lock-emblem { margin-bottom: 26px; animation: slow-pulse 3.6s ease-in-out infinite; }
.lock-word { font-size: 58px; }
.lock-tag {
  margin-top: 10px;
  font-style: italic;
  color: var(--parch-40);
  font-size: 16px;
}
.lock-form {
  margin-top: 46px;
  width: min(360px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.lock-form input[type="password"] { text-align: center; letter-spacing: .35em; font-family: var(--mono); }
.lock-error {
  color: var(--oxblood-hi);
  font-size: 14px;
  text-align: center;
  font-style: italic;
  min-height: 20px;
}
.lock-foot { position: absolute; bottom: 30px; }

/* --- setup wizard --- */

.setup-screen { justify-content: flex-start; padding-top: 9vh; }
.setup-head { text-align: center; margin-bottom: 44px; }
.setup-head .lock-word { font-size: 46px; }
.setup-kicker { margin-bottom: 14px; color: var(--brass); }

.setup-steps {
  display: flex; gap: 10px; justify-content: center; margin-top: 26px;
}
.setup-steps span {
  width: 34px; height: 2px; background: var(--brass-22); transition: background .3s;
}
.setup-steps span.done { background: var(--brass); }

.setup-card {
  width: min(560px, 92vw);
  background: linear-gradient(180deg, var(--ink-3), var(--ink-1));
  border: 1px solid var(--hairline);
  padding: 40px 44px 36px;
  position: relative;
}
.setup-card::before {
  content: ""; position: absolute; inset: 6px;
  border: 1px solid var(--brass-12); pointer-events: none;
}
.setup-card h2 { font-size: 30px; margin-bottom: 6px; }
.setup-card .step-sub { color: var(--parch-60); font-style: italic; margin-bottom: 26px; font-size: 15.5px; }
.setup-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 30px; }

.strength { display: flex; gap: 5px; margin-top: 8px; align-items: center; }
.strength i { width: 42px; height: 3px; background: var(--parch-22); border-radius: 2px; }
.strength[data-level="1"] i:nth-child(-n+1) { background: var(--oxblood-hi); }
.strength[data-level="2"] i:nth-child(-n+2) { background: var(--amber); }
.strength[data-level="3"] i:nth-child(-n+3) { background: var(--sage); }
.strength[data-level="4"] i:nth-child(-n+4) { background: var(--sage); }
.strength em { font-size: 12px; font-style: italic; color: var(--parch-40); margin-left: 8px; }

.grace-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grace-choice {
  border: 1px solid var(--hairline);
  padding: 18px 16px 14px;
  text-align: left;
  transition: border-color .2s, background .2s, transform .2s;
  background: var(--brass-06);
}
.grace-choice:hover { transform: translateY(-2px); border-color: var(--brass-40); }
.grace-choice.on { border-color: var(--brass); background: var(--brass-12); }
.grace-choice .g-big { font-family: var(--display); font-size: 26px; color: var(--parch); }
.grace-choice .g-sub { font-size: 13px; color: var(--parch-40); font-style: italic; margin-top: 2px; }

/* offline */
.offline-screen p { color: var(--parch-60); max-width: 420px; text-align: center; font-style: italic; }

/* ============================================================
   APP SHELL — left rail + main
   ============================================================ */

.shell { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail-w);
  flex-shrink: 0;
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(199,164,92,.03), transparent 30%), var(--ink-1);
  padding: 30px 0 22px;
}

.rail-mark {
  padding: 0 26px 26px;
  border-bottom: 1px solid var(--brass-12);
}
.rail-word {
  font-family: var(--display);
  font-style: italic;
  font-size: 32px;
  color: var(--parch);
  text-shadow: var(--letterpress);
  line-height: 1;
}
.rail-tag { margin-top: 7px; font-size: 10px; letter-spacing: .24em; text-transform: uppercase; color: var(--brass-40); }

.rail-nav { flex: 1; padding: 18px 14px; display: flex; flex-direction: column; gap: 2px; }

.rail-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--parch-60);
  border-left: 1px solid transparent;
  transition: color .2s, background .2s, border-color .2s;
  position: relative;
}
.rail-link svg { width: 16px; height: 16px; opacity: .7; }
.rail-link:hover { color: var(--parch); background: var(--brass-06); }
.rail-link.active {
  color: var(--brass);
  background: linear-gradient(90deg, var(--brass-12), transparent);
  border-left-color: var(--brass);
}
.rail-link.active svg { opacity: 1; }

.state-dot {
  width: 7px; height: 7px; border-radius: 50%;
  margin-left: auto;
  background: var(--parch-22);
  box-shadow: 0 0 0 0 transparent;
}
.state-dot[data-state="armed"]    { background: var(--sage);    box-shadow: 0 0 8px rgba(124,154,109,.8); animation: dot-breathe 3s ease-in-out infinite; }
.state-dot[data-state="warning"]  { background: var(--amber);   box-shadow: 0 0 8px rgba(201,143,61,.8); animation: dot-breathe 1.6s ease-in-out infinite; }
.state-dot[data-state="triggered"]{ background: var(--oxblood-hi); box-shadow: 0 0 9px rgba(188,76,66,.9); animation: dot-breathe 1s ease-in-out infinite; }
.state-dot[data-state="released"] { background: var(--oxblood); }
.state-dot[data-state="paused"]   { background: var(--slate);   box-shadow: 0 0 8px rgba(122,140,150,.7); }
@keyframes dot-breathe { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

.rail-foot { padding: 16px 14px 0; border-top: 1px solid var(--brass-12); }
.rail-lock {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 14px;
  font-size: 12px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--parch-40);
  transition: color .2s;
}
.rail-lock:hover { color: var(--oxblood-hi); }
.rail-lock svg { width: 15px; height: 15px; }

/* main column */

.main {
  flex: 1;
  min-width: 0;
  padding: 44px 52px 90px;
  max-width: 1460px;
}

.view-head { margin-bottom: 34px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.view-head h1 {
  font-size: 44px;
  font-variation-settings: "opsz" 90;
  letter-spacing: -.01em;
}
.view-head .view-sub { margin-top: 8px; color: var(--parch-40); font-style: italic; font-size: 15px; }

/* ============================================================
   BUTTONS, INPUTS, CHIPS
   ============================================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 10px 20px;
  border: 1px solid var(--hairline);
  color: var(--parch-80);
  font-family: var(--body);
  font-size: 12.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  background: transparent;
  transition: transform .18s, border-color .18s, background .18s, color .18s, box-shadow .18s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: var(--brass-40); background: var(--brass-06); color: var(--parch); box-shadow: var(--lift); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 14px; height: 14px; }

.btn-primary {
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 55%, var(--brass-deep));
  border-color: var(--brass-deep);
  color: #14120A;
  font-weight: 600;
  text-shadow: 0 1px 0 rgba(255,255,255,.25);
}
.btn-primary:hover { background: linear-gradient(180deg, #EFD79F, var(--brass) 60%, var(--brass-deep)); color: #14120A; }

.btn-danger { border-color: rgba(147,49,43,.5); color: var(--oxblood-hi); }
.btn-danger:hover { background: var(--oxblood-22); border-color: var(--oxblood-hi); color: #E5A79F; }

.btn-ghost { border-color: transparent; color: var(--parch-40); }
.btn-ghost:hover { box-shadow: none; background: var(--brass-06); }

.btn-sm { padding: 6px 12px; font-size: 11px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid transparent;
  color: var(--parch-40);
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: var(--brass); border-color: var(--hairline); background: var(--brass-06); }
.icon-btn svg { width: 15px; height: 15px; }

/* fields */

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.field > label { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--parch-40); }
.field .hint { font-size: 13px; color: var(--parch-40); font-style: italic; }

input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="date"], input[type="url"], input[type="file"], select, textarea {
  width: 100%;
  background: var(--ink-1);
  border: 1px solid var(--hairline);
  color: var(--parch);
  font-family: var(--body);
  font-size: 16px;
  padding: 11px 14px;
  transition: border-color .2s, box-shadow .2s;
  border-radius: 0;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px var(--brass-12);
}
input::placeholder, textarea::placeholder { color: var(--parch-22); font-style: italic; }
input.mono, textarea.mono { font-family: var(--mono); font-size: 14.5px; }
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
select { appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23C7A45C' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 34px;
}
input[type="date"] { font-family: var(--mono); font-size: 14.5px; color-scheme: dark; }
input[type="file"] { padding: 9px; font-size: 13px; font-family: var(--mono); }
input[type="file"]::file-selector-button {
  font-family: var(--body); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  background: var(--brass-12); color: var(--brass); border: 1px solid var(--hairline);
  padding: 7px 12px; margin-right: 12px; cursor: pointer;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.form-actions { display: flex; justify-content: flex-end; gap: 12px; }
.form-actions.split { justify-content: space-between; }

/* range slider */
input[type="range"] {
  appearance: none; width: 100%; height: 26px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 2px; background: linear-gradient(90deg, var(--brass), var(--brass-22));
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--brass-hi), var(--brass) 55%, var(--brass-deep));
  border: 1px solid var(--brass-deep);
  margin-top: -8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
input[type="range"]::-moz-range-track { height: 2px; background: var(--brass-22); }
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--brass-hi), var(--brass) 55%, var(--brass-deep));
  border: 1px solid var(--brass-deep);
}

/* radio & checkbox rows */
.choice-row {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 10px 12px; border: 1px solid transparent;
  transition: background .15s, border-color .15s;
  cursor: pointer;
  font-size: 15px;
}
.choice-row:hover { background: var(--brass-06); border-color: var(--hairline); }
.choice-row input { width: auto; accent-color: var(--brass); margin-top: 4px; flex-shrink: 0; }
.choice-row .c-sub { display: block; font-size: 13px; color: var(--parch-40); font-style: italic; }

/* chips */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid var(--hairline);
  color: var(--parch-60);
  background: var(--brass-06);
  white-space: nowrap;
}
.chip.brass { color: var(--brass); border-color: var(--brass-40); }
.chip.sage  { color: var(--sage); border-color: rgba(124,154,109,.45); background: rgba(124,154,109,.08); }
.chip.oxblood { color: var(--oxblood-hi); border-color: rgba(188,76,66,.45); background: rgba(147,49,43,.12); }
.chip.amber { color: var(--amber); border-color: rgba(201,143,61,.45); background: rgba(201,143,61,.08); }
.chip.slate { color: var(--slate); border-color: rgba(122,140,150,.45); background: rgba(122,140,150,.08); }

/* ============================================================
   DASHBOARD — hero, ring, EKG, seal
   ============================================================ */

.hero {
  position: relative;
  border: 1px solid var(--hairline);
  background:
    radial-gradient(900px 420px at 20% 0%, var(--mode-tint, var(--sage-22)), transparent 60%),
    linear-gradient(180deg, var(--ink-3), var(--ink-1) 75%);
  padding: 48px 56px 44px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: center;
  overflow: hidden;
  min-height: 380px;
  transition: background .8s;
}
.hero::after {
  content: ""; position: absolute; inset: 8px;
  border: 1px solid var(--brass-12);
  pointer-events: none;
}

.hero[data-mode="armed"]    { --mode-tint: var(--sage-22);    --mode-color: var(--sage); }
.hero[data-mode="amber"]    { --mode-tint: var(--amber-22);   --mode-color: var(--amber); }
.hero[data-mode="alarm"]    { --mode-tint: var(--oxblood-22); --mode-color: var(--oxblood-hi); }
.hero[data-mode="alarm"]::after { animation: hero-alarm 2.4s ease-in-out infinite; }
.hero[data-mode="travel"]   { --mode-tint: var(--slate-22);   --mode-color: var(--slate); }
.hero[data-mode="released"] {
  --mode-tint: rgba(147,49,43,.4); --mode-color: var(--oxblood-hi);
  background:
    radial-gradient(1000px 500px at 30% 0%, rgba(147,49,43,.45), transparent 65%),
    linear-gradient(180deg, #1C100E, #120C0A 80%);
  border-color: rgba(147,49,43,.5);
}
@keyframes hero-alarm {
  0%, 100% { box-shadow: inset 0 0 60px rgba(147,49,43,0); }
  50%      { box-shadow: inset 0 0 90px rgba(147,49,43,.28); }
}

/* guilloché backdrop */
.hero-guilloche {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: flex-end;
  pointer-events: none;
  opacity: .55;
}
.hero-guilloche svg { height: 150%; width: auto; margin-right: -12%; }

/* EKG line across full hero */
.hero-ekg {
  position: absolute; left: 0; right: 0; top: 52%;
  height: 120px; transform: translateY(-50%);
  pointer-events: none;
}
.hero-ekg svg { width: 100%; height: 100%; }
.hero-ekg path { fill: none; }
.ekg-dim  { stroke: var(--mode-color, var(--sage)); opacity: .12; }
.ekg-beat {
  stroke: var(--mode-color, var(--sage));
  stroke-dasharray: 140 860;
  stroke-dashoffset: 1000;
  animation: ekg-run 5.2s linear infinite;
  filter: drop-shadow(0 0 6px var(--mode-color, var(--sage)));
}
.hero[data-mode="alarm"] .ekg-beat { animation-duration: 2.6s; }
.hero[data-mode="travel"] .ekg-beat, .hero[data-mode="released"] .ekg-beat { animation-play-state: paused; opacity: .25; }
@keyframes ekg-run {
  from { stroke-dashoffset: 1000; }
  to   { stroke-dashoffset: -1000; }
}

.hero-left { position: relative; z-index: 2; max-width: 620px; }
.hero-state-label { color: var(--mode-color, var(--sage)); margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.hero-state-label::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--mode-color); box-shadow: 0 0 10px var(--mode-color);
  animation: dot-breathe 2.8s ease-in-out infinite;
}

.hero-count {
  font-family: var(--mono);
  font-size: clamp(44px, 5.4vw, 76px);
  font-weight: 300;
  letter-spacing: -.01em;
  line-height: 1;
  color: var(--parch);
  text-shadow: var(--letterpress);
  font-variant-numeric: tabular-nums;
}
.hero-count .cd-unit { color: var(--parch-40); font-size: .55em; margin-right: .3em; }
.hero-count .cd-sec { display: inline-block; }
.hero-count .cd-sec.tick { animation: sec-tick .4s ease-out; }
@keyframes sec-tick {
  from { opacity: .2; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-sub {
  margin-top: 12px;
  font-family: var(--display);
  font-style: italic;
  font-size: 21px;
  color: var(--parch-60);
}

.hero-meta {
  margin-top: 28px;
  display: flex; flex-wrap: wrap; gap: 10px 28px;
  font-size: 13px;
}
.hero-meta .hm { display: flex; flex-direction: column; gap: 3px; }
.hero-meta .hm .ovl { font-size: 10px; }
.hero-meta .hm .hm-v { font-family: var(--mono); font-size: 13.5px; color: var(--parch-80); }

.hero-released-note {
  margin-top: 22px;
  border-left: 2px solid var(--oxblood-hi);
  padding: 10px 16px;
  font-style: italic;
  color: var(--parch-80);
  background: rgba(147,49,43,.14);
  max-width: 520px;
}

/* countdown ring + seal */

.hero-ring { position: relative; z-index: 2; width: 320px; height: 320px; flex-shrink: 0; }
.hero-ring > svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.ring-track { stroke: var(--brass-12); }
.ring-fill {
  stroke: url(#ring-grad);
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
  filter: drop-shadow(0 0 5px var(--brass-40));
}
.ring-marks { stroke: var(--brass-22); }

/* the wax-seal check-in button */

.seal {
  position: absolute; inset: 50%;
  width: 168px; height: 168px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 34% 28%, rgba(255,241,205,.55), transparent 42%),
    radial-gradient(circle at 66% 78%, rgba(0,0,0,.35), transparent 50%),
    radial-gradient(circle at 50% 50%, var(--brass) 0%, var(--brass-deep) 78%, #5E4A22 100%);
  border: 1px solid #5E4A22;
  box-shadow:
    0 14px 34px -8px rgba(0,0,0,.75),
    inset 0 2px 3px rgba(255,255,255,.28),
    inset 0 -6px 14px rgba(0,0,0,.4);
  transition: transform .16s cubic-bezier(.34,1.56,.64,1), box-shadow .16s;
}
.seal::before {
  content: ""; position: absolute; inset: 11px;
  border-radius: 50%;
  border: 1px solid rgba(20,18,10,.45);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.22);
}
.seal::after { /* engraved second ring */
  content: ""; position: absolute; inset: 17px;
  border-radius: 50%;
  border: 1px dashed rgba(20,18,10,.3);
}
.seal-text {
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: .14em;
  text-align: center;
  line-height: 1.25;
  color: #191507;
  text-shadow: 0 1px 0 rgba(255,255,255,.3);
  text-transform: uppercase;
}
.seal-sub {
  display: block;
  font-family: var(--body);
  font-size: 9px;
  letter-spacing: .3em;
  margin-top: 5px;
  color: rgba(25,21,7,.7);
}
.seal:hover { transform: translate(-50%, -50%) scale(1.03); }
.seal:active, .seal.stamping {
  transform: translate(-50%, -50%) scale(.93);
  box-shadow:
    0 4px 12px -4px rgba(0,0,0,.8),
    inset 0 3px 10px rgba(0,0,0,.45),
    inset 0 -1px 2px rgba(255,255,255,.15);
}
.seal:disabled { filter: saturate(.4) brightness(.8); }

/* stamp ripple */
.seal-ripple {
  position: absolute; inset: 50%;
  width: 168px; height: 168px;
  margin: -84px 0 0 -84px;
  border-radius: 50%;
  border: 2px solid var(--brass);
  pointer-events: none;
  opacity: 0;
}
.seal-ripple.go { animation: ripple 1s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes ripple {
  0%   { opacity: .85; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.05); }
}

/* travel hero compass */
.compass-motif { color: var(--slate); opacity: .9; }
.compass-motif .needle { transform-origin: 60px 60px; animation: compass-wander 7s ease-in-out infinite; }
@keyframes compass-wander {
  0%, 100% { transform: rotate(-14deg); }
  50%      { transform: rotate(11deg); }
}

/* ---------- stat row ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  margin-top: 26px;
}
.stat {
  background: var(--ink-1);
  padding: 20px 22px 17px;
  transition: background .2s;
}
.stat:hover { background: var(--ink-2); }
.stat .st-v {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 300;
  color: var(--parch);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
.stat .st-v .cur { font-size: 13px; color: var(--brass); margin-right: 6px; letter-spacing: .1em; }
.stat .st-sub { font-size: 12.5px; color: var(--parch-40); margin-top: 3px; font-style: italic; }

/* ---------- dashboard lower ---------- */

.dash-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 26px; margin-top: 26px; align-items: start; }
.dash-cols > * { min-width: 0; }

.panel {
  border: 1px solid var(--hairline);
  background: var(--ink-1);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--brass-12);
}
.panel-head .ovl { color: var(--brass); }
.panel-body { padding: 10px 22px 18px; }

/* timeline entries */
.tl-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid rgba(199,164,92,.08);
}
.tl-item:last-child { border-bottom: none; }
.tl-ico {
  width: 30px; height: 30px; flex-shrink: 0;
  border: 1px solid var(--hairline); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--brass);
  background: var(--brass-06);
}
.tl-ico svg { width: 13px; height: 13px; }
.tl-ico.oxblood { color: var(--oxblood-hi); border-color: rgba(188,76,66,.4); background: rgba(147,49,43,.1); }
.tl-ico.sage { color: var(--sage); border-color: rgba(124,154,109,.4); background: rgba(124,154,109,.08); }
.tl-msg { font-size: 15px; color: var(--parch-80); line-height: 1.4; }
.tl-when { font-family: var(--mono); font-size: 11.5px; color: var(--parch-40); margin-top: 3px; }

/* nominee strip */
.nom-strip { display: flex; flex-direction: column; gap: 4px; }
.nom-mini {
  display: flex; align-items: center; gap: 13px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(199,164,92,.08);
}
.nom-mini:last-child { border-bottom: none; }
.nom-mini .who { flex: 1; min-width: 0; }
.nom-mini .who b { display: block; font-weight: 500; font-size: 15.5px; }
.nom-mini .who i { font-size: 12.5px; color: var(--parch-40); }

.monogram {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--brass-40);
  background: radial-gradient(circle at 35% 30%, var(--brass-22), var(--brass-06) 70%);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display);
  font-size: 15px;
  color: var(--brass);
  letter-spacing: .04em;
  text-shadow: var(--letterpress);
}

/* ============================================================
   VAULT
   ============================================================ */

.toolbar {
  display: flex; align-items: center; gap: 18px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.tabs { display: flex; border: 1px solid var(--hairline); }
.tab {
  padding: 9px 18px;
  font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--parch-40);
  border-right: 1px solid var(--hairline);
  transition: color .2s, background .2s;
  position: relative;
}
.tab:last-child { border-right: none; }
.tab:hover { color: var(--parch); background: var(--brass-06); }
.tab.active { color: var(--brass); background: var(--brass-12); }
.tab .tab-n { font-family: var(--mono); font-size: 10px; color: var(--parch-40); margin-left: 6px; }

.search-wrap { position: relative; margin-left: auto; }
.search-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--parch-40); pointer-events: none;
}
.search-wrap input { width: 240px; padding-left: 36px; font-size: 14.5px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.vcard {
  border: 1px solid var(--hairline);
  background: linear-gradient(180deg, var(--ink-2), var(--ink-1));
  padding: 20px 22px 16px;
  display: flex; flex-direction: column; gap: 12px;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  position: relative;
  min-height: 168px;
}
.vcard:hover { transform: translateY(-3px); border-color: var(--brass-40); box-shadow: var(--lift); }

.vcard-top { display: flex; align-items: flex-start; gap: 13px; }
.vcard-title { font-family: var(--display); font-size: 19px; line-height: 1.2; }
.vcard-inst { font-size: 13px; color: var(--parch-40); font-style: italic; margin-top: 2px; }
.vcard-actions { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .2s; }
.vcard:hover .vcard-actions, .vcard:focus-within .vcard-actions { opacity: 1; }

.vcard-value {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 300;
  color: var(--parch);
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.vcard-value .cur { font-size: 13px; color: var(--brass); margin-right: 7px; letter-spacing: .08em; }

.vcard-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tile {
  width: 44px; height: 44px; flex-shrink: 0;
  border: 1px solid var(--brass-40);
  background: linear-gradient(135deg, var(--brass-22), var(--brass-06));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display);
  font-size: 17px;
  color: var(--brass);
}
.tile svg { width: 20px; height: 20px; }

.secret-line {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 13.5px;
  color: var(--parch-60);
  min-height: 26px;
}
.secret-line .sv { letter-spacing: .12em; }
.secret-line .sv.shown { color: var(--parch); letter-spacing: .04em; user-select: all; }
.secret-label { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--parch-22); width: 74px; flex-shrink: 0; }

.note-preview { font-size: 14.5px; color: var(--parch-60); font-style: italic; line-height: 1.5; white-space: pre-wrap; max-height: 132px; overflow: auto; }
.note-veil { display: flex; align-items: center; gap: 10px; color: var(--parch-40); font-style: italic; font-size: 14px; }
.note-veil svg { width: 18px; height: 18px; flex-shrink: 0; }

.doc-meta { font-family: var(--mono); font-size: 12px; color: var(--parch-40); }

/* inline delete confirm */
.confirm-veil {
  position: absolute; inset: 0;
  background: rgba(12,15,13,.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  border: 1px solid rgba(147,49,43,.5);
  z-index: 3;
  animation: rise .25s both;
  padding: 16px; text-align: center;
}
.confirm-veil p { font-style: italic; color: var(--parch-80); font-size: 15px; }
.confirm-veil .row { display: flex; gap: 10px; }

/* ============================================================
   DRAWER
   ============================================================ */

.drawer-scrim {
  position: fixed; inset: 0;
  background: rgba(5,7,6,.6);
  backdrop-filter: blur(2px);
  z-index: 100;
  opacity: 0;
  transition: opacity .3s;
}
.drawer-scrim.open { opacity: 1; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(480px, 92vw);
  background: linear-gradient(180deg, var(--ink-3), var(--ink-1));
  border-left: 1px solid var(--brass-40);
  z-index: 101;
  transform: translateX(102%);
  transition: transform .38s cubic-bezier(.22,.9,.3,1);
  display: flex; flex-direction: column;
  box-shadow: -30px 0 60px -20px rgba(0,0,0,.7);
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  padding: 26px 30px 20px;
  border-bottom: 1px solid var(--brass-12);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.drawer-head h2 { font-size: 26px; }
.drawer-head .drawer-sub { font-size: 13.5px; color: var(--parch-40); font-style: italic; margin-top: 4px; }

.drawer-body { flex: 1; overflow-y: auto; padding: 26px 30px; }
.drawer-foot {
  padding: 18px 30px;
  border-top: 1px solid var(--brass-12);
  display: flex; justify-content: flex-end; gap: 12px;
  background: var(--ink-1);
}

/* type picker tiles in drawer */
.type-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.type-tile {
  border: 1px solid var(--hairline);
  padding: 18px 16px;
  text-align: left;
  display: flex; flex-direction: column; gap: 9px;
  transition: border-color .2s, background .2s, transform .2s;
  background: var(--brass-06);
}
.type-tile:hover { border-color: var(--brass); background: var(--brass-12); transform: translateY(-2px); }
.type-tile svg { width: 20px; height: 20px; color: var(--brass); }
.type-tile b { font-family: var(--display); font-weight: 500; font-size: 17px; }
.type-tile i { font-size: 12.5px; color: var(--parch-40); }

.scope-list {
  max-height: 240px; overflow-y: auto;
  border: 1px solid var(--hairline);
  padding: 6px;
  background: var(--ink-1);
}

/* ============================================================
   NOMINEES
   ============================================================ */

.nom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }

.nom-card {
  border: 1px solid var(--hairline);
  background: linear-gradient(180deg, var(--ink-2), var(--ink-1));
  padding: 30px 24px 20px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  position: relative;
}
.nom-card:hover { transform: translateY(-3px); border-color: var(--brass-40); box-shadow: var(--lift); }
.nom-card .monogram { width: 66px; height: 66px; font-size: 24px; margin-bottom: 10px; }
.nom-card h3 { font-size: 22px; }
.nom-card .nom-rel { font-style: italic; color: var(--brass); font-size: 14px; }
.nom-card .nom-contact { font-family: var(--mono); font-size: 12px; color: var(--parch-40); margin-top: 6px; line-height: 1.7; word-break: break-all; }
.nom-card .nom-chips { margin-top: 12px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.nom-card .nom-msg {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid rgba(199,164,92,.1);
  font-style: italic; font-size: 13px; color: var(--parch-40);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.nom-card .vcard-actions { position: absolute; top: 12px; right: 12px; }

/* ============================================================
   TRAVEL
   ============================================================ */

.travel-note {
  display: flex; gap: 14px; align-items: center;
  border: 1px solid rgba(122,140,150,.35);
  background: var(--slate-22);
  padding: 14px 20px;
  margin-bottom: 28px;
  font-style: italic;
  color: var(--parch-80);
  font-size: 15px;
}
.travel-note svg { width: 22px; height: 22px; color: var(--slate); flex-shrink: 0; }

.travel-group { margin-bottom: 30px; }
.travel-group > .ovl { margin-bottom: 12px; display: block; }

.trip {
  display: flex; align-items: center; gap: 20px;
  border: 1px solid var(--hairline);
  background: var(--ink-1);
  padding: 16px 22px;
  margin-bottom: 10px;
  transition: border-color .2s, transform .2s;
}
.trip:hover { border-color: var(--brass-40); transform: translateX(3px); }
.trip.active-trip { border-color: rgba(122,140,150,.5); background: linear-gradient(90deg, var(--slate-22), var(--ink-1) 60%); }
.trip.past-trip { opacity: .55; }
.trip .trip-label { font-family: var(--display); font-size: 18px; flex: 1; }
.trip .trip-dates { font-family: var(--mono); font-size: 13px; color: var(--parch-60); }
.trip .trip-len { font-size: 12px; color: var(--parch-40); font-style: italic; }

/* ============================================================
   ACTIVITY
   ============================================================ */

.activity-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
.activity-split > * { min-width: 0; }

.outbox-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  border: 1px solid transparent;
  border-bottom: 1px solid rgba(199,164,92,.08);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  width: 100%; text-align: left;
}
.outbox-item:hover { background: var(--brass-06); }
.outbox-item.sel { border: 1px solid var(--brass-40); background: var(--brass-06); }
.outbox-item .ob-main { flex: 1; min-width: 0; }
.outbox-item .ob-subj { font-size: 15px; color: var(--parch); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.outbox-item .ob-meta { font-family: var(--mono); font-size: 11px; color: var(--parch-40); margin-top: 3px; }

.mail-preview {
  border: 1px solid var(--hairline);
  background: var(--ink-1);
  position: sticky; top: 30px;
}
.mail-preview iframe {
  width: 100%; height: 560px; border: none; background: #fff;
}
.mail-preview .mp-head { padding: 16px 20px; border-bottom: 1px solid var(--brass-12); }
.mail-preview .mp-head .mp-subj { font-family: var(--display); font-size: 18px; }
.mail-preview .mp-head .mp-to { font-family: var(--mono); font-size: 12px; color: var(--parch-40); margin-top: 4px; }
.mail-error { padding: 10px 20px; background: var(--oxblood-22); color: var(--oxblood-hi); font-family: var(--mono); font-size: 12px; border-bottom: 1px solid rgba(147,49,43,.4); }

/* ============================================================
   SETTINGS
   ============================================================ */

.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-grid > * { min-width: 0; }
.settings-grid .panel-body { padding: 22px; }

.slider-readout {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px;
}
.slider-readout .sr-big { font-family: var(--mono); font-size: 24px; color: var(--brass); }
.slider-readout .sr-human { font-family: var(--display); font-style: italic; font-size: 16px; color: var(--parch-60); }

.smtp-help {
  border-left: 2px solid var(--brass-40);
  background: var(--brass-06);
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--parch-60);
  font-style: italic;
  margin-bottom: 20px;
  line-height: 1.6;
}

.drill-panel { border-color: rgba(147,49,43,.4); }
.drill-panel .panel-head { border-bottom-color: rgba(147,49,43,.3); }
.drill-panel .panel-head .ovl { color: var(--oxblood-hi); }
.drill-status {
  font-family: var(--mono);
  font-size: 13px;
  padding: 12px 16px;
  border: 1px dashed var(--hairline);
  background: var(--ink);
  margin-bottom: 18px;
  line-height: 1.8;
}
.drill-status .on { color: var(--amber); }
.drill-btns { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.drill-btns input { width: 90px; }

/* ============================================================
   EMPTY STATES
   ============================================================ */

.empty {
  border: 1px dashed var(--hairline);
  padding: 60px 40px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--parch-40);
  grid-column: 1 / -1;
}
.empty svg { width: 92px; height: 92px; color: var(--brass-40); margin-bottom: 14px; }
.empty h3 { font-size: 22px; color: var(--parch-60); font-style: italic; font-weight: 400; }
.empty p { font-size: 14.5px; font-style: italic; max-width: 380px; }
.empty .btn { margin-top: 18px; }
.empty.compact { padding: 34px 20px; }
.empty.compact svg { width: 56px; height: 56px; margin-bottom: 6px; }

/* ============================================================
   TOASTS
   ============================================================ */

#toast-root {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--parch);
  color: #17140C;
  font-size: 14.5px;
  padding: 12px 22px 12px 18px;
  border-left: 3px solid var(--brass);
  box-shadow: 0 12px 40px -8px rgba(0,0,0,.8);
  display: flex; align-items: center; gap: 12px;
  max-width: 520px;
  animation: toast-in .4s cubic-bezier(.22,1.2,.36,1) both;
  font-family: var(--body);
}
.toast.err { border-left-color: var(--oxblood); }
.toast.err::before { content: "✗"; color: var(--oxblood); font-weight: 700; }
.toast.ok::before { content: "✓"; color: #5d7a50; font-weight: 700; }
.toast.out { animation: toast-out .3s ease-in both; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(18px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(10px); }
}

/* ============================================================
   RESPONSIVE (desktop-first, down to ~1024px)
   ============================================================ */

@media (max-width: 1360px) {
  .dash-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hero { padding: 40px 40px 36px; }
}

@media (max-width: 1180px) {
  :root { --rail-w: 200px; }
  .main { padding: 36px 34px 70px; }
  .hero { grid-template-columns: 1fr; min-height: unset; gap: 24px; }
  .hero-ring { margin: 0 auto; }
  .activity-split, .settings-grid, .dash-cols { grid-template-columns: minmax(0, 1fr); }
  .hero-count { font-size: clamp(40px, 7vw, 64px); }
}

/* ============================================================
   MOBILE NAV — slim top band + bottom tab bar (≤760px)
   Hidden entirely on desktop; the rail hides on mobile.
   ============================================================ */

.mobile-top, .tabbar { display: none; }

.mobile-top {
  position: sticky; top: 0; z-index: 60;
  align-items: center; gap: 10px;
  padding: 12px 18px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: rgba(15, 19, 16, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.mt-word {
  font-family: var(--display);
  font-style: italic;
  font-size: 24px;
  line-height: 1;
  color: var(--parch);
  text-shadow: var(--letterpress);
}
.mobile-top .state-dot { width: 8px; height: 8px; }
.mt-lock { margin-left: auto; width: 44px; height: 44px; color: var(--parch-60); }
.mt-lock svg { width: 18px; height: 18px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: rgba(15, 19, 16, .96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--hairline);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab-link {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 56px;
  padding: 8px 2px 7px;
  font-size: 8.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--parch-40);
  border-top: 2px solid transparent;
  transition: color .2s, border-color .2s;
}
.tab-link svg { width: 19px; height: 19px; opacity: .75; }
.tab-link.active { color: var(--brass); border-top-color: var(--brass); background: linear-gradient(180deg, var(--brass-06), transparent); }
.tab-link.active svg { opacity: 1; }

/* tablet band: tab row scrolls instead of forcing overflow */
@media (max-width: 1080px) {
  .toolbar { flex-wrap: wrap; }
  .tabs {
    overflow-x: auto; flex-wrap: nowrap;
    max-width: 100%; min-width: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex-shrink: 0; }
}

/* ============================================================
   PHONE (≤760px) — single column, thumb-friendly
   ============================================================ */

@media (max-width: 760px) {
  html, body { overflow-x: hidden; }

  .rail { display: none; }
  .mobile-top { display: flex; }
  .tabbar { display: flex; }
  .shell { display: block; }

  .main {
    padding: 22px 16px calc(96px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }

  /* inputs ≥16px so iOS never zooms */
  input[type="text"], input[type="password"], input[type="email"], input[type="number"],
  input[type="date"], input[type="url"], input[type="file"], select, textarea,
  input.mono, textarea.mono {
    font-size: 16px;
  }

  .view-head { flex-wrap: wrap; margin-bottom: 24px; gap: 14px; }
  .view-head h1 { font-size: 32px; }
  .view-head .view-sub { font-size: 14px; }
  .view-head > .btn { width: 100%; }

  .field-row { grid-template-columns: 1fr; gap: 0; }

  /* --- dashboard --- */
  .hero { padding: 26px 20px 30px; gap: 18px; }
  .hero::after { inset: 5px; }
  .hero-count { font-size: clamp(34px, 11vw, 46px); }
  .hero-sub { font-size: 17px; }
  .hero-meta { margin-top: 20px; gap: 8px 20px; }
  .hero-guilloche svg { height: 120%; margin-right: -40%; }
  .hero-ekg { top: 72%; height: 90px; } /* sweep through the ring, not the meta text */
  .hero-ring { width: 230px; height: 230px; }
  .seal { width: 126px; height: 126px; }
  .seal-text { font-size: 16px; }
  .seal-sub { font-size: 7.5px; letter-spacing: .22em; }
  .seal-ripple { width: 126px; height: 126px; margin: -63px 0 0 -63px; }

  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 15px 16px 13px; }
  .stat .st-v { font-size: 21px; }

  .dash-cols { gap: 18px; margin-top: 18px; }
  .panel-head { padding: 13px 16px; }
  .panel-body { padding: 8px 16px 14px; }

  /* --- vault --- */
  .toolbar { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 20px; }
  .tabs {
    overflow-x: auto; flex-wrap: nowrap;
    max-width: 100%; min-width: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex-shrink: 0; padding: 11px 14px; }
  .search-wrap { margin-left: 0; width: 100%; }
  .search-wrap input { width: 100%; }
  .card-grid { grid-template-columns: 1fr; gap: 14px; }
  .vcard { min-height: 0; }
  .vcard-actions { opacity: 1; } /* no hover on touch */
  .vcard-value { font-size: 26px; }

  /* --- nominees / travel --- */
  .nom-grid { grid-template-columns: 1fr; gap: 14px; }
  .nom-card .vcard-actions { opacity: 1; }
  .trip { flex-wrap: wrap; gap: 10px 14px; padding: 14px 16px; }
  .trip .trip-label { flex-basis: 100%; }
  .trip .trip-dates { font-size: 12px; }
  .trip:hover { transform: none; }
  .travel-note { padding: 12px 16px; font-size: 14px; }

  /* --- activity --- */
  .activity-split { grid-template-columns: 1fr; gap: 16px; }
  .mail-preview { position: static; }
  .mail-preview iframe { height: 60vh; }
  .outbox-item { flex-wrap: wrap; gap: 8px 12px; padding: 12px; }
  .outbox-item .ob-main { flex-basis: calc(100% - 44px); }
  .tl-item { gap: 11px; }
  .tl-item > .chip { display: none; } /* kind chip is decorative; the icon already says it */

  /* --- settings --- */
  .settings-grid { gap: 18px; }
  .settings-grid .panel-body { padding: 18px 16px; }
  .drill-btns { gap: 8px; }
  .drill-btns input { width: 76px; }
  .drill-btns .btn { padding: 10px 14px; }
  .drill-status { font-size: 11.5px; word-break: break-word; overflow-wrap: anywhere; }
  .smtp-help { font-size: 13px; overflow-wrap: anywhere; }
  .form-actions { flex-wrap: wrap; gap: 10px; }
  .form-actions .btn { flex: 1 1 auto; white-space: normal; }
  .slider-readout .sr-big { font-size: 21px; }

  /* --- drawer: full screen --- */
  .drawer { width: 100vw; border-left: none; }
  .drawer-head { padding: 20px 18px 16px; padding-top: calc(20px + env(safe-area-inset-top, 0px)); }
  .drawer-head h2 { font-size: 23px; }
  .drawer-body { padding: 20px 18px; }
  .drawer-foot {
    padding: 14px 18px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
  .drawer-foot .btn { flex: 1; padding: 13px 10px; }
  .type-pick { gap: 10px; }
  .type-tile { padding: 14px 12px; }
  .type-tile i { font-size: 11.5px; }

  /* --- toasts float above the tab bar --- */
  #toast-root {
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    width: calc(100vw - 28px);
  }
  .toast { max-width: 100%; font-size: 13.5px; padding: 11px 16px 11px 14px; }

  /* --- setup wizard / lock --- */
  .setup-screen { padding: 24px 14px 60px; padding-top: 5vh; }
  .setup-head { margin-bottom: 30px; }
  .setup-head .lock-word { font-size: 38px; }
  .setup-card { width: 100%; padding: 28px 20px 24px; }
  .setup-card h2 { font-size: 25px; }
  .grace-choices { grid-template-columns: 1fr; }
  .setup-actions { flex-direction: column-reverse; gap: 10px; align-items: stretch; margin-top: 24px; }
  .setup-actions .btn { width: 100%; padding: 13px 10px; }
  .setup-actions span:empty { display: none; }
  .lock-screen { padding: 30px 20px; }
  .lock-word { font-size: 46px; }
  .lock-form { margin-top: 36px; }
  .empty { padding: 40px 22px; }
}

/* very narrow phones (≤400px): tighten the countdown + tab labels */
@media (max-width: 400px) {
  .main { padding-left: 13px; padding-right: 13px; }
  .hero { padding: 22px 16px 26px; }
  .hero-count { font-size: clamp(30px, 10.5vw, 40px); }
  .tab-link { font-size: 8px; letter-spacing: .08em; }
  .hero-ring { width: 210px; height: 210px; }
  .stat .st-v { font-size: 19px; }
}
