/* Star Jewellery Sales
   ---------------------------------------------------------------------------
   Built on the same interaction system as the Mustang Mo:Mo order site: a warm
   paper ground, soft cards outlined by a hairline ring rather than a shadow,
   pill-shaped controls, 16px inputs that never zoom on a phone, and a floating
   dock at the bottom that a thumb finds without looking.

   Translated into Star Jewellery's own materials: ivory instead of kitchen
   paper, the violet sampled from the logo as the one working colour, and
   champagne gold only where something has been earned (an order, a win).

   Type: Jost for everything you read and tap. Cormorant Garamond, the serif
   from the catalogues and quotations, appears in two places only — page
   titles and the big figures — so the app reads as the same house. */

:root {
  --violet: #5b4080;
  --violet-deep: #3a2754;
  --violet-ink: #241a33;
  --violet-wash: #ece5f3;
  --gold: #9a7536;
  --gold-bright: #c9a462;
  --gold-wash: #f4ead6;

  --ground: #f1ebe2;
  --ground-2: #e9e1d5;
  --paper: #fffdf9;
  --ink: #241a33;
  --muted: #6c6274;
  --faint: #978d9c;
  --line: rgba(36, 26, 51, .09);
  --line-strong: rgba(36, 26, 51, .18);
  --ring: 0 0 0 1px rgba(36, 26, 51, .07);
  --lift: 0 18px 40px -22px rgba(36, 26, 51, .55);

  --ok: #1f6b4c;   --ok-wash: #e3f1ea;
  --warn: #8a5f0e; --warn-wash: #f7ecd5;
  --alert: #a23535; --alert-wash: #f8e6e4;
  --info: #2f5680; --info-wash: #e6eef7;

  --r-card: 18px;
  --r-ctl: 12px;
  --r-pill: 999px;
  --sans: "Jost", "Futura", "Century Gothic", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --gap: .85rem;
  --pad-card: 1.05rem 1.1rem;
  --gutter: 1rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --dock: 72px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--ground); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.5;
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; }
h1 {
  font-family: var(--serif); font-weight: 500; font-size: 2rem; line-height: 1.08;
  letter-spacing: -.01em; color: var(--violet-ink);
}
h2 { font-size: 1.02rem; font-weight: 600; letter-spacing: -.003em; }
h3 { font-size: .92rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
a { color: var(--violet); }
small { font-size: .8rem; }
.muted { color: var(--muted); font-size: .9rem; }
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; border-radius: 6px; }

/* ============================================================== shell */

#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .7rem;
  min-height: calc(58px + var(--safe-top)); padding: var(--safe-top) 1rem 0;
  background: rgba(241, 235, 226, .88);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .mark { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); min-width: 0; }
.topbar .mark img { height: 30px; width: auto; display: block; }
.topbar .mark .name { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.topbar .mark .unit {
  font-size: .72rem; font-weight: 600; color: var(--violet); background: var(--violet-wash);
  border-radius: var(--r-pill); padding: .12rem .55rem; white-space: nowrap;
}
@media (max-width: 520px) { .topbar .mark .unit { display: none; } }
.topbar .spacer { flex: 1; }

.live-chip {
  display: inline-flex; align-items: center; gap: .4rem; text-decoration: none;
  background: var(--paper); box-shadow: var(--ring); color: var(--ink);
  border-radius: var(--r-pill); padding: .32rem .7rem; font-size: .84rem; font-weight: 600;
}
.live-chip .dot, .live-pill .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: 0 0 auto;
}
.live-chip .dot { background: #2f9a6a; animation: pulse 2s ease-in-out infinite; }
.count {
  min-width: 1.25rem; height: 1.25rem; padding: 0 .35rem; border-radius: var(--r-pill);
  background: var(--violet); color: #fff; font-size: .7rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.count[hidden] { display: none; }

.who-btn {
  display: flex; align-items: center; gap: .6rem; background: none; border: 0; padding: .2rem;
  cursor: pointer; border-radius: var(--r-pill); text-align: right;
}
.who-btn .who { display: none; line-height: 1.2; }
@media (min-width: 700px) { .who-btn .who { display: block; } }
.who-btn .who strong { display: block; font-weight: 600; font-size: .86rem; }
.who-btn .who span { font-size: .74rem; color: var(--muted); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--violet); color: #fff; font-size: .8rem; font-weight: 600; letter-spacing: .02em;
}
.account-list .row { width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }

.shell { flex: 1; display: flex; min-height: 0; }
.viewport {
  flex: 1; min-width: 0; width: 100%; max-width: 1560px; margin: 0 auto;
  padding: 1.1rem var(--gutter) calc(var(--dock) + 2.2rem + var(--safe-bottom));
}

.page-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin: .3rem 0 1.2rem; }
.page-head .titles { flex: 1; min-width: 0; }
.page-head p { color: var(--muted); font-size: .92rem; margin: .3rem 0 0; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ----------------------------------------------- the dock (phones) */
.tabbar {
  position: fixed; z-index: 45; left: .75rem; right: .75rem;
  bottom: calc(.6rem + var(--safe-bottom));
  height: var(--dock); max-width: 520px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: var(--violet-ink); border-radius: 24px;
  box-shadow: 0 20px 40px -18px rgba(20, 12, 30, .7), 0 0 0 1px rgba(255, 255, 255, .04) inset;
  padding: 0 .3rem;
}
.tabbar a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .12rem; height: 100%; text-decoration: none; color: rgba(255, 253, 249, .55);
  font-size: .68rem; font-weight: 500; letter-spacing: .01em;
}
.tabbar a .ico { display: grid; place-items: center; width: 44px; height: 30px; border-radius: var(--r-pill); transition: background-color .18s ease, color .18s ease; }
.tabbar a.active { color: #fff; }
.tabbar a.active .ico { background: rgba(255, 255, 255, .12); }
.tabbar a.primary .ico {
  width: 58px; height: 58px; border-radius: 50%; margin-top: -26px;
  background: var(--gold-bright); color: var(--violet-ink);
  box-shadow: 0 10px 22px -10px rgba(201, 164, 98, .9), 0 0 0 5px var(--ground);
}
.tabbar a.primary .ico svg { width: 26px; height: 26px; stroke-width: 2.2; }
.tabbar a.primary { color: #fff; }
.tabbar a.primary.active .ico { background: #d8b678; }
.tabbar .count { position: absolute; top: 8px; right: calc(50% - 24px); background: var(--gold-bright); color: var(--violet-ink); }

.sidebar { display: none; }

@media (min-width: 900px) {
  .tabbar { display: none; }
  :root { --gutter: 1.6rem; }
  .viewport { padding-bottom: 3rem; }
  .sidebar {
    display: flex; flex-direction: column; width: 232px; flex: 0 0 232px;
    padding: 1.1rem .75rem 2rem; position: sticky; top: calc(58px + var(--safe-top)); align-self: flex-start;
    height: calc(100vh - 58px - var(--safe-top)); overflow-y: auto; overscroll-behavior: contain;
  }
  .sidebar .brand { display: none; }
  .sidebar .group { margin-bottom: 1.2rem; }
  .sidebar .group-title { font-size: .76rem; font-weight: 600; color: var(--faint); padding: 0 .8rem .4rem; }
  .sidebar a {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    height: 38px; padding: 0 .8rem; margin-bottom: 2px;
    border-radius: var(--r-pill); text-decoration: none; color: var(--muted); font-size: .9rem; font-weight: 500;
  }
  .sidebar a:hover { background: rgba(255, 253, 249, .7); color: var(--ink); }
  .sidebar a.active { background: var(--paper); color: var(--violet-deep); font-weight: 600; box-shadow: var(--ring); }
}
@media (min-width: 1200px) { :root { --gutter: 2.4rem; --gap: 1.05rem; --pad-card: 1.3rem 1.4rem; } h1 { font-size: 2.45rem; } }

/* ============================================================== layout */
.grid { display: grid; gap: var(--gap); }
.grid.two   { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.four  { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid.wide  { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.split { display: grid; gap: var(--gap); align-items: start; grid-template-columns: minmax(0, 1fr); }
.split > *, .stack > *, .grid > * { min-width: 0; }
@media (min-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr) 360px; } }
@media (min-width: 1500px) { .split { grid-template-columns: minmax(0, 1fr) 420px; } }
.split.even { grid-template-columns: 1fr; }
@media (min-width: 1100px) { .split.even { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.stack > .card { margin-bottom: 0; }

/* =============================================================== cards */
.card {
  background: var(--paper); border-radius: var(--r-card); padding: var(--pad-card);
  box-shadow: var(--ring); margin-bottom: var(--gap);
}
.card.lead { box-shadow: 0 0 0 1.5px var(--gold-bright), var(--lift); }
.card.quiet { background: transparent; box-shadow: none; padding-left: 0; padding-right: 0; }
.card.flat { box-shadow: var(--ring); }
.card.pad-0 { padding: 0; overflow: hidden; }
.grid > .card { margin-bottom: 0; }
.card + .card-head { margin-top: 1.6rem; }
.card-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem; }
.card-head h2, .card-head h3 { flex: 1; min-width: 0; }
.card-head .link, button.link {
  font-size: .86rem; font-weight: 600; color: var(--violet); cursor: pointer; background: none; border: 0; padding: .2rem 0;
}
.card.tap { cursor: pointer; transition: box-shadow .18s ease, transform .16s ease; }
.card.tap:hover { box-shadow: 0 0 0 1.5px var(--violet); }

.kpi { background: var(--paper); border-radius: var(--r-card); padding: .95rem 1rem; box-shadow: var(--ring); }
.kpi .figure {
  font-family: var(--serif); font-size: clamp(2.2rem, 1.7rem + 1.2vw, 3rem); line-height: 1; font-weight: 500;
  color: var(--violet-ink); font-variant-numeric: lining-nums tabular-nums;
}
.kpi .figure.small { font-size: 1.5rem; }
.kpi .label { font-size: .84rem; color: var(--muted); margin-top: .45rem; font-weight: 500; }
.kpi .delta { font-size: .76rem; margin-top: .2rem; color: var(--faint); }
.kpi.accent { background: var(--gold-wash); box-shadow: 0 0 0 1px rgba(154, 117, 54, .22); }
.kpi.accent .figure { color: var(--gold); }

/* ========================================================== badges & chips */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .16rem .58rem; border-radius: var(--r-pill);
  font-size: .75rem; font-weight: 600; background: var(--violet-wash); color: var(--violet); white-space: nowrap;
}
.badge.ok { background: var(--ok-wash); color: var(--ok); }
.badge.warn { background: transparent; color: var(--warn); box-shadow: inset 0 0 0 1px currentColor; }
.badge.alert { background: var(--alert-wash); color: var(--alert); }
.badge.gold { background: var(--gold-wash); color: var(--gold); }
.badge.info { background: var(--info-wash); color: var(--info); }
.badge.plain { background: var(--ground); color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 500;
  background: var(--paper); box-shadow: var(--ring); border-radius: var(--r-pill); padding: .28rem .7rem; color: var(--muted);
}
.pill-row { display: flex; gap: .45rem; overflow-x: auto; padding: 2px 2px .4rem; margin-bottom: .7rem; scrollbar-width: none; }
.pill-row::-webkit-scrollbar { display: none; }
.pill {
  display: inline-flex; align-items: center; border: 0; background: var(--paper); box-shadow: var(--ring); color: var(--ink);
  border-radius: var(--r-pill); padding: .5rem 1rem; font-size: .88rem; font-weight: 500;
  white-space: nowrap; cursor: pointer; text-decoration: none;
}
.pill:hover { box-shadow: 0 0 0 1.5px var(--violet); }
.pill.active { background: var(--violet-ink); color: #fff; box-shadow: none; }
.jump { display: flex; flex-wrap: wrap; gap: .45rem; }

/* =============================================================== lists */
.list { display: flex; flex-direction: column; }
.row { display: flex; gap: .8rem; align-items: flex-start; padding: .8rem 0; border-bottom: 1px dashed var(--line-strong); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; font-size: .95rem; }
.row .sub { color: var(--muted); font-size: .84rem; }
.row .right { text-align: right; font-size: .84rem; color: var(--muted); white-space: nowrap; }
.row.clickable { cursor: pointer; font: inherit; color: inherit; }
.row.clickable:hover .title { color: var(--violet); }

.empty {
  text-align: center; padding: 2.4rem 1.2rem; color: var(--muted);
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-card); background: rgba(255, 253, 249, .5);
}
.empty strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: .3rem; font-size: 1.02rem; }
.empty .btn { margin-top: 1rem; }

.skeleton { background: var(--ground-2); border-radius: var(--r-card); height: 76px; margin-bottom: .8rem; animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: .75 } 50% { opacity: .4 } }

/* ============================================================== tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-card); background: var(--paper); box-shadow: var(--ring); }
.card .table-wrap { box-shadow: none; border-radius: 0; margin: 0 -.2rem; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: .72rem .85rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; position: sticky; top: 0; background: var(--paper); z-index: 1; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #faf6ef; }
tbody td:first-child { font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }

/* =============================================================== forms */
.field { margin-bottom: .9rem; }
.field label { display: block; font-size: .86rem; font-weight: 600; color: var(--ink); margin-bottom: .35rem; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 50px; padding: .7rem .9rem;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-ctl);
  background: var(--paper); font-size: 16px; /* 16px keeps iOS from zooming on focus */
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field select {
  -webkit-appearance: none; appearance: none; padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%236c6274' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .95rem center;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--violet); outline: none; box-shadow: 0 0 0 4px var(--violet-wash); }
.field textarea { min-height: 96px; resize: vertical; }
.field .hint, .hint { font-size: .8rem; color: var(--faint); margin-top: .3rem; }
.field.inline { display: flex; align-items: center; gap: .6rem; }
.field.inline input[type="checkbox"], .field.inline input[type="radio"] { width: 22px; min-height: 22px; height: 22px; accent-color: var(--violet); }
.field.inline label { margin: 0; font-weight: 500; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--violet); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.form-grid { display: grid; gap: 0 .9rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 48px; padding: .65rem 1.25rem; border-radius: var(--r-pill); border: 0;
  background: var(--violet); color: #fff; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none;
  transition: background-color .15s ease, box-shadow .15s ease, transform .14s ease;
}
.btn:hover { background: var(--violet-deep); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--paper); color: var(--violet-deep); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1.5px var(--violet); background: var(--paper); }
.btn.quiet { background: none; color: var(--muted); }
.btn.quiet:hover { background: var(--ground-2); color: var(--ink); }
.btn.danger { background: var(--alert); }
.btn.gold { background: var(--gold-bright); color: var(--violet-ink); }
.btn.gold:hover { background: #d8b678; }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: .35rem .9rem; font-size: .84rem; }
.btn.ghost.small { color: var(--muted); }
.btn.ghost.small:hover { color: var(--alert); box-shadow: inset 0 0 0 1.5px var(--alert); }

/* The two decisions a rep makes in a shop, sized to be hit without looking. */
.btn-huge {
  width: 100%; min-height: 84px; border-radius: 22px; font-size: 1.12rem; font-weight: 600;
  box-shadow: var(--lift); flex-direction: column; gap: .15rem;
}
.btn-huge.enter { background: var(--violet); }
.btn-huge.exit { background: var(--ok); }
.btn-huge.exit:hover { background: #185439; }
.btn-huge small { display: block; font-weight: 500; opacity: .82; font-size: .8rem; }
.sticky-action {
  position: sticky; bottom: calc(var(--dock) + .9rem + var(--safe-bottom)); z-index: 30;
  margin: 0 calc(-1 * var(--gutter)); padding: 1.4rem var(--gutter) .3rem;
  background: linear-gradient(to bottom, rgba(241, 235, 226, 0), var(--ground) 1.2rem);
  display: grid; gap: .5rem;
}
.sticky-action .btn[disabled] { opacity: 1; background: var(--ground-2); color: var(--faint); box-shadow: none; }
.sticky-action .btn[disabled] small { opacity: 1; }
@media (min-width: 900px) { .sticky-action { position: static; margin: 0; padding: .5rem 0 0; background: none; } }

/* ======================================================= visit capture */
.photo-slot {
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-card); padding: 1.5rem 1rem;
  text-align: center; background: rgba(255, 253, 249, .6); cursor: pointer;
}
.photo-slot:hover { border-color: var(--violet); }
.photo-slot img { max-width: 100%; max-height: 320px; border-radius: var(--r-ctl); display: block; margin: 0 auto .5rem; }
.photo-slot .cue { color: var(--muted); font-size: .9rem; font-weight: 500; }
.photo-slot.filled { border-style: solid; border-color: var(--ok); background: var(--paper); }

.visit-live {
  background: var(--violet-ink); color: #fff; border-radius: 22px; padding: 1.25rem 1.3rem; margin-bottom: var(--gap);
  box-shadow: var(--lift);
}
.visit-live .meta { font-size: .84rem; color: #c9bcd9; }
.visit-live .name { font-family: var(--serif); font-size: 1.55rem; font-weight: 600; margin: .3rem 0 .15rem; line-height: 1.15; }
.timer { font-family: var(--serif); font-size: 3.4rem; font-weight: 500; color: var(--gold-bright); line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #7fd0a4; display: inline-block; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (min-width: 1100px) {
  .visit-live { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1.5rem; }
  .visit-live .clock-side { text-align: right; }
}

/* ============================================================ timeline */
.timeline { position: relative; padding-left: 1.4rem; }
.timeline::before { content: ""; position: absolute; left: .32rem; top: .45rem; bottom: .45rem; width: 1.5px; background: var(--line-strong); }
.tl-item { position: relative; padding: 0 0 1rem; }
.tl-item::before {
  content: ""; position: absolute; left: -1.26rem; top: .4rem; width: 10px; height: 10px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--violet);
}
.tl-item.gold::before { border-color: var(--gold-bright); background: var(--gold-bright); }
.tl-item.muted::before { border-color: var(--line-strong); }
.tl-time { font-size: .76rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.tl-title { font-size: .94rem; font-weight: 600; }
.tl-detail { font-size: .84rem; color: var(--muted); }

/* ============================================================== charts */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; }
.bars .bar { flex: 1; background: var(--violet-wash); border-radius: 6px 6px 0 0; position: relative; }
.bars .bar span { position: absolute; inset: auto 0 -1.2rem; text-align: center; font-size: .62rem; color: var(--faint); }
.bars .bar i { position: absolute; inset: 0; top: auto; background: var(--violet); border-radius: 6px 6px 0 0; }
.funnel { display: flex; flex-direction: column; gap: .6rem; }
.funnel .stage { display: flex; align-items: center; gap: .7rem; }
.funnel .track { flex: 1; height: 34px; background: var(--ground); border-radius: var(--r-pill); overflow: hidden; }
.funnel .fill { height: 100%; background: var(--violet); display: flex; align-items: center; padding: 0 .7rem; color: #fff; font-size: .8rem; font-weight: 600; border-radius: var(--r-pill); min-width: 2.2rem; }
.funnel .stage:last-child .fill { background: var(--gold-bright); color: var(--violet-ink); }
.funnel .stage-label { width: 96px; font-size: .84rem; color: var(--muted); font-weight: 500; }
.funnel .stage-value { width: 60px; text-align: right; font-family: var(--serif); font-size: 1.5rem; font-weight: 600; font-variant-numeric: lining-nums tabular-nums; }

/* ============================================================= sign in */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; background: var(--ground); }
@media (min-width: 900px) { .auth-wrap { grid-template-columns: 1fr 1fr; } }
.auth-side {
  display: none; background: var(--violet-ink); color: #fff; padding: 3.5rem; flex-direction: column; justify-content: space-between;
  border-radius: 0 32px 32px 0;
}
@media (min-width: 900px) { .auth-side { display: flex; } }
.auth-side img { width: min(300px, 64%); height: auto; }
.auth-side .said { font-family: var(--serif); font-size: 2.1rem; font-weight: 500; line-height: 1.18; max-width: 18ch; margin-top: auto; }
.auth-points { list-style: none; padding: 0; margin: 1.6rem 0 2.2rem; display: grid; gap: .55rem; max-width: 34ch; }
.auth-points li { display: flex; gap: .6rem; font-size: .95rem; color: #ddd3e8; }
.auth-points li::before { content: ""; flex: 0 0 7px; height: 7px; margin-top: .55rem; border-radius: 50%; background: var(--gold-bright); }
.auth-side .foot { font-size: .82rem; color: #a99bbc; }
.auth-panel { display: grid; place-items: center; padding: calc(2rem + var(--safe-top)) 1.1rem calc(2rem + var(--safe-bottom)); }
.auth-card { width: 100%; max-width: 400px; background: var(--paper); border-radius: 24px; padding: 1.6rem 1.4rem 1.4rem; box-shadow: var(--ring), var(--lift); }
.auth-card .brand-small { display: flex; justify-content: center; margin-bottom: 1.3rem; }
.auth-card .brand-small img { height: 64px; width: auto; }
@media (min-width: 900px) { .auth-card .brand-small img { height: 52px; } }
.auth-card h1 { font-size: 1.9rem; margin-bottom: .3rem; }
.auth-card .lede { color: var(--muted); font-size: .92rem; margin-bottom: 1.3rem; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--ground); border-radius: var(--r-pill); padding: 4px; margin-bottom: 1.3rem; }
.segmented button { border: 0; background: none; border-radius: var(--r-pill); padding: .55rem; font-weight: 600; font-size: .9rem; color: var(--muted); cursor: pointer; }
.segmented button.on { background: var(--paper); color: var(--violet-ink); box-shadow: 0 1px 4px rgba(36, 26, 51, .12); }
.auth-card .btn.block { margin-top: .4rem; min-height: 52px; font-size: 1rem; }
.auth-switch { font-size: .88rem; margin-top: 1rem; color: var(--muted); text-align: center; }
.auth-switch button { background: none; border: 0; color: var(--violet); cursor: pointer; font-weight: 600; padding: 0; }

/* ============================================================== live */
.live-strip { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .9rem; }
.live-strip:empty { display: none; }
.live-pill {
  display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink);
  background: var(--paper); box-shadow: var(--ring); border-radius: var(--r-pill); padding: .55rem .6rem .55rem .95rem;
  font-weight: 600; font-size: .9rem;
}
.live-pill .dot.on { background: #2f9a6a; animation: pulse 2s ease-in-out infinite; }
.live-pill .go { background: var(--violet-ink); color: #fff; border-radius: var(--r-pill); padding: .25rem .7rem; font-size: .8rem; }
.nudge {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; text-decoration: none;
  background: var(--violet-wash); color: var(--violet-deep); border-radius: 14px; padding: .8rem 1rem; margin-bottom: .2rem;
}
.nudge strong { font-weight: 600; font-size: .92rem; }
.nudge span { font-weight: 700; font-size: .86rem; white-space: nowrap; }
.nudge.warn { background: var(--warn-wash); color: #6c4a0b; }
div > .nudge { margin-bottom: var(--gap); }
.live-strip .nudge { margin: 0; }
.live-list { display: flex; flex-direction: column; gap: .5rem; }
.live-row {
  display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left; cursor: pointer;
  background: var(--ground); border: 0; border-radius: 14px; padding: .7rem .85rem; color: var(--ink);
}
.live-row:hover { background: var(--violet-wash); }
.live-avatar { flex: 0 0 40px; height: 40px; border-radius: 50%; background: var(--violet); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .82rem; }
.live-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.live-text strong { font-weight: 600; }
.live-text span { color: var(--muted); font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-clock { flex: 0 0 auto; font-family: var(--serif); font-size: 1.6rem; font-weight: 600; color: var(--violet); font-variant-numeric: lining-nums tabular-nums; }
.live-empty { display: flex; flex-direction: column; gap: .2rem; padding: 1.2rem; border-radius: 14px; background: var(--ground); color: var(--muted); font-size: .9rem; }
.live-empty strong { color: var(--ink); font-weight: 600; }

/* =============================================================== misc */
.toast-host {
  position: fixed; left: 50%; bottom: calc(var(--dock) + 1.4rem + var(--safe-bottom)); transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: .45rem; width: min(92vw, 420px); pointer-events: none;
}
@media (min-width: 900px) { .toast-host { bottom: 1.5rem; left: auto; right: 1.5rem; transform: none; } }
.toast {
  background: var(--violet-ink); color: #fff; padding: .8rem 1.05rem; border-radius: 16px; font-size: .9rem; font-weight: 500;
  box-shadow: 0 16px 34px -14px rgba(20, 12, 30, .65); animation: toast-in .32s cubic-bezier(.32, .72, 0, 1);
}
.toast.error { background: var(--alert); }
.toast.ok { background: var(--ok); }
.toast.live { background: var(--paper); color: var(--ink); box-shadow: 0 0 0 1.5px var(--violet), 0 16px 34px -14px rgba(20, 12, 30, .45); }
.toast.gold { background: var(--gold-bright); color: var(--violet-ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.sheet-host { position: fixed; inset: 0; z-index: 80; display: none; }
.sheet-host.open { display: block; }
.sheet-host .scrim { position: absolute; inset: 0; background: rgba(36, 26, 51, .45); animation: fade-in .2s ease; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper); border-radius: 26px 26px 0 0; padding: .6rem 1.2rem calc(1.6rem + var(--safe-bottom));
  animation: sheet-rise .34s cubic-bezier(.32, .72, 0, 1);
}
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 0 auto .8rem; }
@media (min-width: 760px) {
  .sheet { left: 50%; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(680px, 92vw); border-radius: 24px; padding-top: 1.2rem; box-shadow: var(--lift); animation: none; }
  .sheet::before { display: none; }
}
@media (min-width: 1400px) { .sheet { width: min(820px, 88vw); } }
.sheet-title { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; position: sticky; top: -.6rem; background: var(--paper); padding: .3rem 0; z-index: 2; }
.sheet-title h2 { flex: 1; font-family: var(--serif); font-size: 1.55rem; font-weight: 600; }
.sheet-title button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--ground); font-size: 1rem; color: var(--muted); cursor: pointer; line-height: 1; }
@keyframes sheet-rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }

.offline-banner { background: var(--warn-wash); color: var(--warn); font-size: .86rem; font-weight: 500; padding: .55rem 1rem; text-align: center; }
.offline-banner.alert { background: var(--alert-wash); color: var(--alert); }

.stat-line { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px dashed var(--line-strong); font-size: .9rem; }
.stat-line:last-child { border-bottom: 0; }
.stat-line span:first-child { color: var(--muted); }
.stat-line span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

.note { font-size: .88rem; color: var(--muted); background: var(--ground); padding: .7rem .9rem; border-radius: 12px; margin-bottom: .8rem; }
.note.warn { background: var(--warn-wash); color: #6c4a0b; }
.note.alert { background: var(--alert-wash); color: #7d2222; }

/* =========================================================== home tiles */
.home-actions { display: grid; gap: .7rem; margin-bottom: var(--gap); }
@media (min-width: 760px) { .home-actions { grid-template-columns: repeat(3, 1fr); } }
.home-tile {
  display: flex; align-items: center; gap: 1rem; padding: 1.2rem 1.15rem; background: var(--paper);
  border-radius: 22px; box-shadow: var(--ring); color: var(--ink); text-decoration: none;
  transition: transform .16s ease, box-shadow .18s ease;
}
.home-tile:hover { box-shadow: 0 0 0 1.5px var(--violet); }
.home-tile:active { transform: scale(.99); }
.home-tile-text { flex: 1; min-width: 0; }
.home-tile strong { display: block; font-family: var(--serif); font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.home-tile small { display: block; margin-top: .3rem; color: var(--muted); font-size: .88rem; }
.home-tile.enter { background: var(--violet-ink); color: #fff; box-shadow: var(--lift); }
.home-tile.enter small { color: rgba(255, 255, 255, .75); }
.home-tile.enter .home-arrow { background: var(--gold-bright); color: var(--violet-ink); }
.home-arrow { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; line-height: 1; background: var(--violet-wash); color: var(--violet); flex: 0 0 auto; }
.home-badge {
  min-width: 2.2rem; height: 2.2rem; padding: 0 .6rem; border-radius: var(--r-pill); background: var(--gold-bright);
  color: var(--violet-ink); font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
@media (min-width: 760px) {
  .home-tile { flex-direction: column; align-items: flex-start; min-height: 176px; padding: 1.4rem; }
  .home-tile-text { display: flex; flex-direction: column; justify-content: flex-end; flex: 1; }
  .home-tile .home-arrow, .home-tile .home-badge { align-self: flex-end; margin-top: auto; }
}

.recovery { box-shadow: 0 0 0 1.5px var(--alert); background: var(--alert-wash); }
.recovery h2 { color: var(--alert); }

.row.clickable, .card.tap { transition: transform .16s cubic-bezier(.32, .72, 0, 1); }
.row.clickable:active, .card.tap:active { transform: scale(.995); }

/* One arrival per screen, in reading order. */
@keyframes settle { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#viewport > * { animation: settle .3s cubic-bezier(.32, .72, 0, 1) backwards; }
#viewport > *:nth-child(2) { animation-delay: .04s; }
#viewport > *:nth-child(n+3) { animation-delay: .08s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
