/* Dictate Portal. Matches the Dictate site (DICTATE v12, the Apple cut): the system font, label greys,
   #f5f5f7 page, white cards, a dark translucent nav, and the brand blue (#0115e6) for primary actions
   and the pay slab. One fade-and-rise on entry; Reduce Motion turns it off. */
:root {
  --bg: #F5F5F7; --card: #FFFFFF;
  --ink: #1D1D1F; --ink-2: #6E6E73; --ink-3: #86868B;
  --line: rgba(0,0,0,.08); --line-2: rgba(0,0,0,.14);
  --mist: #E8E8ED; --mist-2: #D2D2D7;
  --blue: #0115E6; --blue-hover: #0B26FF; --blue-soft: #E8EAFD;
  --sun: #FF9F0A; --sun-soft: #FFF3E0; --sun-ink: #8A5300;
  --green: #1E8E3E; --green-soft: #E5F5EA; --red: #D70015; --red-soft: #FDE8EA;
  --nav: rgba(29,29,31,.82);
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.05);
  --shadow-up: 0 2px 4px rgba(0,0,0,.05), 0 14px 34px rgba(0,0,0,.10);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --gl: max(16px, env(safe-area-inset-left, 0px)); --gr: max(16px, env(safe-area-inset-right, 0px));
  --max: 1080px; --r: 20px; --r-sm: 14px;
  --ease: cubic-bezier(.16,1,.3,1);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.47 var(--sans); letter-spacing: -.016em; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--blue); }
b, strong { font-weight: 600; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 8px; }
button, input, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }

/* ---------- buttons and fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font-weight: 500; text-decoration: none; color: var(--ink); white-space: nowrap; transition: transform .2s var(--ease), background .2s, border-color .2s; }
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; font-size: 14px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 0 24px; }
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn-small { min-height: 34px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 4px 0; color: var(--blue); cursor: pointer; font-weight: 500; }
.link:hover { text-decoration: underline; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=search], select {
  width: 100%; min-height: 46px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); font-size: 16px; color: var(--ink); font-weight: 400;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.form-error { padding: 10px 14px; border-radius: 12px; background: var(--red-soft); color: var(--red); font-size: 14px; }
.hint { color: var(--ink-3); font-size: 13.5px; font-weight: 400; }

/* ---------- boot + sign in ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--ink-3); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px var(--gr) 24px var(--gl); background: var(--bg); }
.login-card { width: min(420px, 100%); display: grid; gap: 18px; padding: 40px 32px 32px; background: var(--card); border-radius: 20px; box-shadow: var(--shadow-up); animation: rise .7s var(--ease) both; }
.login-logo { height: 34px; width: auto; margin-bottom: 6px; }
.login h1 { font-size: 32px; font-weight: 600; letter-spacing: -.015em; }
.login .btn { min-height: 50px; font-size: 16px; margin-top: 4px; }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top, 0px); background: var(--nav); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); color: #fff; }
.top-in, .view, .notice { max-width: var(--max); margin: 0 auto; padding-left: var(--gl); padding-right: var(--gr); }
.top-in { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; min-height: 60px; }
.brand img { height: 22px; width: auto; }
.tabs { display: flex; gap: 4px; padding: 4px; background: rgba(255,255,255,.08); border-radius: 999px; }
.tab { display: block; padding: 7px 16px; border-radius: 999px; color: rgba(255,255,255,.72); text-decoration: none; font-size: 15px; font-weight: 500; transition: background .25s var(--ease), color .2s; }
.tab:hover { color: #fff; }
.tab[aria-current=page] { background: rgba(255,255,255,.18); color: #fff; }
.who { justify-self: end; display: flex; align-items: center; gap: 14px; font-size: 14px; color: rgba(255,255,255,.72); min-width: 0; }
.top .link { color: #fff; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice { margin-top: 16px; }
.notice > div { padding: 14px 16px; border-radius: var(--r-sm); background: var(--sun-soft); color: var(--sun-ink); font-size: 15px; }

/* bottom tab bar, phones only */
.tabbar { display: none; }

/* ---------- page ---------- */
.view { padding-top: 40px; padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(36px, 5vw, 56px); font-weight: 600; letter-spacing: -.008em; line-height: 1.07; }
.lede { margin-top: 10px; font-size: clamp(17px, 1.6vw, 20px); color: var(--ink-2); max-width: 46ch; }
.updated { font-size: 13.5px; color: var(--ink-3); display: flex; gap: 10px; align-items: center; padding-bottom: 6px; }
.state { padding: 56px 16px; color: var(--ink-2); text-align: center; }
.state .btn { margin-top: 14px; }

.block { margin-top: 44px; }
.page-head + .block, .picker + .block, .scope + .block, .hero + .block { margin-top: 28px; }
.block-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap; margin-bottom: 16px; }
.block-head h2 { font-size: 24px; font-weight: 600; letter-spacing: -.01em; line-height: 1.17; }
.block-head p { margin-top: 4px; font-size: 15px; color: var(--ink-2); max-width: 60ch; }
.footnote { margin-top: 28px; font-size: 13.5px; color: var(--ink-3); max-width: 70ch; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--card); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; display: grid; gap: 2px; align-content: start; }
.stat b { font-size: 34px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.stat span { font-size: 14px; color: var(--ink-2); }
.meter { height: 6px; margin-top: 10px; border-radius: 6px; background: var(--mist); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--green); transition: width 1s var(--ease) .15s; }

/* filters */
.tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font-size: 14px; color: var(--ink-2); transition: background .2s, color .2s, border-color .2s; }
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip i { font-style: normal; opacity: .6; margin-left: 5px; }
.search { flex: 1 1 240px; max-width: 320px; margin-left: auto; }
.search input { min-height: 40px; border-radius: 999px; font-size: 15px; padding: 0 16px; }

/* segmented controls */
.seg, .toggle { display: flex; gap: 2px; padding: 3px; background: rgba(0,0,0,.06); border-radius: 12px; overflow-x: auto; scrollbar-width: none; }
.seg { width: fit-content; max-width: 100%; }
.seg::-webkit-scrollbar { display: none; }
.toggle { display: inline-flex; border-radius: 999px; }
.seg button, .toggle button { flex: 1 0 auto; min-height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: none; cursor: pointer; color: var(--ink-2); font-size: 14.5px; font-weight: 500; white-space: nowrap; transition: background .25s var(--ease), color .2s, box-shadow .25s; }
.toggle button { border-radius: 999px; min-height: 32px; font-size: 14px; }
.seg button:hover, .toggle button:hover { color: var(--ink); }
.seg button[aria-pressed=true], .toggle button[aria-pressed=true] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg button i { font-style: normal; margin-left: 6px; color: var(--ink-3); font-weight: 400; }
.scope { margin-top: 20px; }

/* lists: each item is its own rounded row */
.list { display: grid; gap: 8px; }
.row { display: grid; gap: 4px 16px; align-items: center; width: 100%; padding: 14px 20px; border: 0; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); text-align: left; cursor: pointer; transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.row:hover { transform: translateY(-1px); box-shadow: var(--shadow-up); }
.row:active { transform: scale(.995); }
.row .main { min-width: 0; }
.row .title { display: block; font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.row .sub { display: block; font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.row .col { font-size: 14.5px; color: var(--ink-2); }
.row .sub.show-sm { display: none; }
.row-lead { grid-template-columns: minmax(0, 2.2fr) 160px minmax(0, 1.3fr) minmax(0, 1.2fr) 80px; }
.row-deal { grid-template-columns: minmax(0, 2fr) 110px 130px minmax(0, 1.6fr); }
.list-head { display: grid; gap: 16px; padding: 0 20px 4px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.right { text-align: right; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--mist); color: var(--ink-2); white-space: nowrap; width: fit-content; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.p-blue { background: var(--blue-soft); color: var(--blue); }
.p-navy { background: var(--ink); color: #fff; }
.p-sun { background: var(--sun-soft); color: var(--sun-ink); }
.p-green { background: var(--green-soft); color: var(--green); }
.p-red { background: var(--red-soft); color: var(--red); }
.flag { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 6px; background: var(--red-soft); color: var(--red); font-size: 11.5px; font-weight: 600; letter-spacing: .03em; vertical-align: 2px; }

/* ---------- detail sheet ---------- */
.sheet { width: min(540px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; padding: 0; border: 0; border-radius: 28px 0 0 28px; background: var(--bg); color: var(--ink); box-shadow: -20px 0 60px rgba(0,0,0,.18); }
.sheet::backdrop { background: rgba(0,0,0,.28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet[open] { display: flex; flex-direction: column; animation: sheetIn .45s var(--ease); }
@keyframes sheetIn { from { transform: translateX(40px); opacity: 0; } }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: calc(28px + env(safe-area-inset-top, 0px)) var(--gr) 8px 28px; }
.sheet-head h2 { font-size: 30px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; overflow-wrap: anywhere; }
.close { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(0,0,0,.07); font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink-2); transition: background .2s; }
.close:hover { background: rgba(0,0,0,.12); }
.sheet-body { padding: 16px var(--gr) calc(36px + env(safe-area-inset-bottom, 0px)) 28px; overflow-y: auto; display: grid; gap: 14px; align-content: start; }
.sheet-body > section { background: var(--card); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow); }
.sheet h3 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 9px 16px; margin: 0; font-size: 15px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.note-box { padding: 14px 16px; background: var(--mist); border-radius: 12px; white-space: pre-wrap; font-size: 15px; }
.sheet-body > .note-box { background: var(--card); box-shadow: var(--shadow); }
.sheet-body > p { font-size: 15px; color: var(--ink-2); }

/* ---------- pay ---------- */
.picker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.picker select { width: auto; min-width: 280px; max-width: 100%; border-radius: 999px; }
.inline-label { display: inline; }
.hero { position: relative; overflow: hidden; display: grid; gap: 6px; margin-top: 28px; padding: 36px 32px; border-radius: 20px; color: #fff; background: var(--blue); }
.hero .label { font-size: 17px; color: rgba(255,255,255,.82); font-weight: 600; }
.hero .big { font-size: clamp(52px, 10vw, 88px); font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.hero .why { font-size: 15px; color: rgba(255,255,255,.82); margin-top: 6px; }
.cards { display: grid; gap: 14px; }
.deal-card { background: var(--card); border-radius: var(--r); padding: 22px 22px 20px; display: grid; gap: 22px; box-shadow: var(--shadow); }
.deal-card.later { background: rgba(255,255,255,.55); box-shadow: none; border: 1px solid var(--line); }
.deal-top { display: flex; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.deal-top .title { font-weight: 600; font-size: 19px; letter-spacing: -.015em; }
.deal-top .sub { font-size: 14px; color: var(--ink-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.deal-total { text-align: right; font-size: 13.5px; color: var(--ink-2); }
.deal-total b { display: block; font-size: 22px; color: var(--ink); font-weight: 600; letter-spacing: -.02em; }
.track { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.step { position: relative; display: grid; justify-items: center; align-content: start; gap: 1px; padding: 0 4px; text-align: center; }
.step::before { content: ""; position: absolute; top: 14px; left: calc(-50% + 22px); right: calc(50% + 22px); height: 4px; border-radius: 4px; background: var(--mist-2); }
.step:first-child::before { display: none; }
.step.after-paid::before { background: var(--green); }
.dot { width: 32px; height: 32px; margin-bottom: 10px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--mist-2); background: var(--card); color: var(--ink-3); font-size: 13px; font-weight: 600; }
.step.paid .dot { background: var(--green); border-color: var(--green); color: #fff; }
.step.next .dot { border-color: var(--blue); color: var(--blue); box-shadow: 0 0 0 5px var(--blue-soft); }
.view.enter .step.paid .dot { animation: pop .5s var(--ease) .35s both; }
.step .k { font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--ink-3); }
.step .a { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.step .s { font-size: 13px; color: var(--ink-2); line-height: 1.3; }
.step.paid .s { color: var(--green); font-weight: 500; }
.later .step .a { color: var(--ink-2); }
.later-note { font-size: 13.5px; color: var(--ink-2); margin-top: -8px; }

.table-card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px 20px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 14px 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .sub { display: block; font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.table.history td:first-child { white-space: nowrap; width: 84px; font-weight: 500; }
.table.history td:last-child { white-space: nowrap; font-weight: 600; }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ---------- people ---------- */
.code-box { font: 600 30px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; padding: 22px; text-align: center; background: var(--card); border-radius: 18px; box-shadow: var(--shadow); user-select: all; }
.form-grid { display: grid; gap: 16px; background: var(--card); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.radio { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line-2); border-radius: 14px; cursor: pointer; font-size: 15px; color: var(--ink); font-weight: 500; transition: border-color .2s, background .2s; }
.radio input { margin-top: 3px; accent-color: var(--blue); }
.radio small { display: block; color: var(--ink-2); font-size: 13.5px; font-weight: 400; margin-top: 2px; }
.radio:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.choices { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.choices legend { margin-bottom: 8px; }
.choices[disabled] { opacity: .45; }

/* ---------- loading ---------- */
.skeleton { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 32px; }
.skeleton div { height: 96px; border-radius: 18px; background: linear-gradient(90deg, var(--mist) 0%, #F8F9FB 50%, var(--mist) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton.rows { grid-template-columns: 1fr; gap: 8px; }
.skeleton.rows div { height: 64px; border-radius: 16px; }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.view.enter > * { animation: rise .7s var(--ease) both; }
.view.enter > :nth-child(2) { animation-delay: .06s; }
.view.enter > :nth-child(3) { animation-delay: .12s; }
.view.enter > :nth-child(4) { animation-delay: .18s; }
.view.enter > :nth-child(5) { animation-delay: .24s; }
.view.enter > :nth-child(6) { animation-delay: .30s; }
.view.enter > :nth-child(n+7) { animation-delay: .36s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .top-in { grid-template-columns: 1fr auto; min-height: 54px; }
  .top .tabs { display: none; }
  .brand img { height: 20px; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 6px var(--gr) calc(6px + env(safe-area-inset-bottom, 0px)) var(--gl);
    background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); }
  .tb { display: grid; justify-items: center; gap: 2px; padding: 6px 0 2px; color: var(--ink-3); text-decoration: none; font-size: 11px; font-weight: 600; }
  .tb svg { width: 25px; height: 25px; }
  .tb[aria-current=page] { color: var(--blue); }
  .view { padding-top: 28px; padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
  .block { margin-top: 36px; }
  .block-head h2 { font-size: 21px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat b { font-size: 28px; }
  .period .stats, .three .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .period .stat, .three .stat { padding: 12px; }
  .period .stat b { font-size: 24px; }
  .three .stat b { font-size: 18px; letter-spacing: -.03em; }
  .search { max-width: none; margin-left: 0; flex-basis: 100%; }
  .list-head { display: none; }
  .row { padding: 14px 16px; }
  .row-lead, .row-deal { grid-template-columns: minmax(0, 1fr) auto; }
  .row .col { grid-column: 1; }
  .row .pill { grid-column: 2; grid-row: 1; justify-self: end; }
  .row .hide-sm { display: none; }
  .row .right { grid-column: 2; grid-row: 2; font-size: 13px; }
  .row .sub.show-sm { display: block; }
  .hero { padding: 28px 22px; }
  .deal-card { padding: 18px 16px; }
  .sheet { border-radius: 24px 24px 0 0; height: 94dvh; max-height: 94dvh; margin: auto 0 0; width: 100vw; }
  .sheet-head, .sheet-body { padding-left: var(--gl); }
  .picker select { min-width: 0; width: 100%; }
}
@media (max-width: 520px) {
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .deal-total { text-align: left; }
}
