/* moov dashboard, built on Apple's interface rules: instant press feedback, translucent chrome that content scrolls
   under, grouped lists, size-specific tracking, and a sheet you can drag. Dark is the default; light is its own set
   of steps. Reduced motion, reduced transparency and higher contrast each get their own fallback at the bottom. */
:root {
  --bg: #0A0A0C; --surface: #16171C; --surface-2: #1F2027; --surface-3: #2A2C35;
  --sep: rgb(255 255 255 / .08); --line: rgb(255 255 255 / .12);
  --ink: #F5F5F7; --ink-2: #C7C8D1; --muted: #8E909E;
  --brand: #2B3BFF; --mark: #7480FF; --on-brand: #FFFFFF;
  --good: #3DDC97; --warn: #FFB84D; --bad: #FF6B6B;
  --chrome: rgb(22 23 28 / .72); --chrome-edge: rgb(255 255 255 / .10); --scrim: rgb(0 0 0 / .5);
  --shadow-lg: 0 24px 60px rgb(0 0 0 / .55), 0 2px 8px rgb(0 0 0 / .4);
  --r-lg: 1.25rem; --r-md: .875rem; --r-sm: .625rem;
  --font: system-ui, -apple-system, "Segoe UI", "Noto Sans Hebrew", sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F2F2F7; --surface: #FFFFFF; --surface-2: #F2F2F7; --surface-3: #E5E5EA;
    --sep: rgb(60 60 67 / .12); --line: rgb(60 60 67 / .18);
    --ink: #0C0C0E; --ink-2: #3A3B45; --muted: #6C6E7A;
    --mark: #2B3BFF; --good: #138A57; --warn: #A15F00; --bad: #C4302B;
    --chrome: rgb(255 255 255 / .72); --chrome-edge: rgb(255 255 255 / .6); --scrim: rgb(0 0 0 / .28);
    --shadow-lg: 0 24px 60px rgb(0 0 0 / .18), 0 2px 8px rgb(0 0 0 / .08);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #F2F2F7; --surface: #FFFFFF; --surface-2: #F2F2F7; --surface-3: #E5E5EA;
  --sep: rgb(60 60 67 / .12); --line: rgb(60 60 67 / .18);
  --ink: #0C0C0E; --ink-2: #3A3B45; --muted: #6C6E7A;
  --mark: #2B3BFF; --good: #138A57; --warn: #A15F00; --bad: #C4302B;
  --chrome: rgb(255 255 255 / .72); --chrome-edge: rgb(255 255 255 / .6); --scrim: rgb(0 0 0 / .28);
  --shadow-lg: 0 24px 60px rgb(0 0 0 / .18), 0 2px 8px rgb(0 0 0 / .08);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { font: 100%/1.5 var(--font); -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100dvh; -webkit-font-smoothing: antialiased; letter-spacing: 0; }
body.locked { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button, a, .pressable { touch-action: manipulation; }
a { color: var(--mark); }
:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; border-radius: var(--r-sm); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* type: tracking and leading change with size; weight carries emphasis */
.title { font-size: 2.125rem; line-height: 1.08; font-weight: 800; letter-spacing: -0.022em; margin: .25rem 0 .25rem; }
.subtitle { color: var(--muted); font-size: .9375rem; margin: 0 0 1.25rem; }
h3 { font-size: 1.0625rem; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 .75rem; }
.caption { font-size: .8125rem; line-height: 1.4; color: var(--muted); letter-spacing: .01em; }
.small { font-size: .875rem; letter-spacing: .005em; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* press feedback: on the press itself, instant */
.pressable, .btn, .tab, .seg button, .row-btn, .chip { transition: transform 100ms ease-out, background-color 150ms ease, opacity 150ms ease; }
.pressable:active, .btn:active, .chip:active, .row-btn:active { transform: scale(.97); }
.tab:active, .seg button:active { transform: scale(.94); }

/* chrome: translucent bars, content scrolls under them */
.bar-top { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: calc(.625rem + env(safe-area-inset-top)) 1rem .625rem; background: var(--chrome);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); }
/* scroll edge: a soft fade appears only once content is actually under the bar */
.bar-top::after { content: ""; position: absolute; inset: 100% 0 auto; height: 14px; pointer-events: none; opacity: 0;
  background: linear-gradient(var(--chrome), transparent); transition: opacity 200ms ease; }
.bar-top.edge::after { opacity: 1; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.0625rem; letter-spacing: -0.01em; }
.brand img { width: 1.75rem; height: 1.75rem; border-radius: .5rem; display: block; }
.live { display: inline-flex; align-items: center; gap: .5rem; font-size: .8125rem; color: var(--ink-2); letter-spacing: .01em; }
.live i { width: .5rem; height: .5rem; border-radius: 50%; background: var(--muted); }
.live.on i { background: var(--good); box-shadow: 0 0 0 .25rem rgb(61 220 151 / .18); }

.tabs { position: fixed; inset: auto 0 0; z-index: 6; display: flex; justify-content: center; gap: .25rem;
  padding: .375rem .5rem calc(.375rem + env(safe-area-inset-bottom)); background: var(--chrome);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--chrome-edge); }
.tabs-inner { position: relative; display: flex; gap: .25rem; width: 100%; max-width: 32rem; }
.tab-pill { position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-radius: var(--r-md); background: var(--surface-3); will-change: transform, width; }
.tab { position: relative; z-index: 1; flex: 1; border: 0; background: none; color: var(--muted); padding: .5rem .25rem; border-radius: var(--r-md);
  display: grid; justify-items: center; gap: .1875rem; font-size: .6875rem; font-weight: 600; letter-spacing: .01em; cursor: pointer; }
.tab svg { width: 1.5rem; height: 1.5rem; }
.tab[aria-current="page"] { color: var(--ink); }
.tab .badge { position: absolute; top: .25rem; inset-inline-start: calc(50% + .45rem); min-width: 1.125rem; height: 1.125rem; padding: 0 .3rem;
  border-radius: 999px; background: var(--brand); color: var(--on-brand); font-size: .6875rem; line-height: 1.125rem; text-align: center; }

.wrap { max-width: 61rem; margin: 0 auto; padding: .5rem 1rem calc(6.5rem + env(safe-area-inset-bottom)); }
.grid { display: grid; gap: .75rem; }
.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.section { margin-top: 1.75rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; margin: 0 .25rem .5rem; }
.section-head h3 { margin: 0; }

/* surfaces */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 1rem; min-width: 0; }
.tile .label { font-size: .8125rem; color: var(--muted); letter-spacing: .01em; }
.tile .value { font-size: 1.875rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.022em; margin-top: .375rem; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: .8125rem; color: var(--muted); margin-top: .125rem; }
.hero { background: radial-gradient(120% 140% at 100% 0%, #4A57FF 0%, var(--brand) 45%, #1420B0 100%); color: var(--on-brand); padding: 1.25rem; }
.hero .label { color: rgb(255 255 255 / .8); font-size: .875rem; }
.hero .value { font-size: 2rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.025em; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.todo { display: grid; gap: .625rem; margin: 0; padding: 0; list-style: none; }
.todo li { display: flex; gap: .625rem; align-items: flex-start; font-size: .9375rem; }
.todo li::before { content: ""; flex: none; width: .5rem; height: .5rem; margin-top: .45rem; border-radius: 50%; background: var(--warn); }

/* grouped list, iOS style: one surface, rows split by hairlines that start after the leading edge */
.list { background: var(--surface); border-radius: var(--r-lg); overflow: hidden; }
.row-btn { display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 3.75rem; padding: .75rem 1rem; border: 0; background: none;
  text-align: start; cursor: pointer; position: relative; }
.row-btn + .row-btn::before { content: ""; position: absolute; top: 0; inset-inline: 1rem 0; height: 1px; background: var(--sep); }
.row-btn:active { background: var(--surface-2); transform: none; }
.row-main { flex: 1; min-width: 0; display: grid; gap: .125rem; }
.row-title { font-weight: 600; font-size: 1rem; letter-spacing: -0.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: .8125rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { display: grid; justify-items: end; gap: .25rem; flex: none; }
.chev { width: .5rem; height: .875rem; color: var(--muted); flex: none; }
.dot { width: .625rem; height: .625rem; border-radius: 50%; flex: none; background: var(--muted); }
.dot.new { background: var(--mark); } .dot.talked { background: var(--warn); } .dot.won { background: var(--good); } .dot.lost { background: var(--surface-3); }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.75rem; padding: 0 1.125rem;
  border-radius: 999px; border: 0; background: var(--surface-2); color: var(--ink); font-weight: 600; letter-spacing: -0.005em;
  text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.wa { background: #1FAF5A; color: #fff; }
.btn.sm { min-height: 2.25rem; padding: 0 .875rem; font-size: .875rem; }
.btn.block { width: 100%; min-height: 3.125rem; font-size: 1.0625rem; }
.btn:disabled { opacity: .45; cursor: default; }
.actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .5rem; }
.field { width: 100%; min-height: 2.875rem; border-radius: var(--r-md); border: 1px solid transparent; background: var(--surface-2); padding: .625rem .875rem; }
.field:focus { outline: none; border-color: var(--mark); }
textarea.field { min-height: 6rem; resize: vertical; line-height: 1.45; }
.field-label { display: grid; gap: .375rem; font-size: .8125rem; color: var(--muted); letter-spacing: .01em; }

/* segmented control with a thumb that springs to the chosen segment */
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: .125rem; border-radius: var(--r-sm);
  background: var(--surface-2); }
.seg-thumb { position: absolute; top: .125rem; bottom: .125rem; left: 0; width: 0; border-radius: calc(var(--r-sm) - .125rem);
  background: var(--surface-3); box-shadow: 0 1px 3px rgb(0 0 0 / .25); will-change: transform, width; }
.seg button { position: relative; z-index: 1; border: 0; background: none; padding: .4375rem .5rem; font-size: .8125rem; font-weight: 600;
  color: var(--ink-2); cursor: pointer; border-radius: calc(var(--r-sm) - .125rem); white-space: nowrap; }
.seg button[aria-checked="true"] { color: var(--ink); }
.chips { display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem .75rem; padding: 0 1rem; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 0; background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: .4375rem .875rem; font-size: .875rem; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.chip .n { opacity: .6; margin-inline-start: .25rem; font-variant-numeric: tabular-nums; }

/* sign-in */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.signin .card { width: 100%; max-width: 23rem; padding: 2rem 1.5rem 1.5rem; text-align: center; }
.signin img { width: 3.5rem; height: 3.5rem; border-radius: 1rem; }
.signin .title { font-size: 1.75rem; margin-top: 1rem; }
.signin p { color: var(--ink-2); margin: 0 0 1.5rem; }
.code { text-align: center; font-size: 1.75rem; font-weight: 700; letter-spacing: .5em; padding-inline-start: 1.25rem; direction: ltr; font-variant-numeric: tabular-nums; }
.msg { min-height: 1.5rem; margin-top: .75rem; font-size: .875rem; color: var(--ink-2); }
.msg.err { color: var(--warn); }
.stack { display: grid; gap: .75rem; }

/* horizontal bars */
.bars { display: grid; gap: .75rem; }
.hbar { display: grid; grid-template-columns: minmax(5.5rem, 38%) 1fr 3.25rem; gap: .625rem; align-items: center; font-size: .875rem; }
.hbar .k { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: .5rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.hbar .fill { display: block; height: 100%; width: 0; background: var(--mark); border-radius: 999px; transition: width 450ms cubic-bezier(.2, .8, .2, 1); }
.hbar .v { font-variant-numeric: tabular-nums; text-align: left; }
.divider { height: 1px; background: var(--sep); margin: 1.25rem 0; border: 0; }

/* column chart */
.chart { position: relative; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--sep); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 500 11px var(--font); letter-spacing: .01em; }
.chart .col { fill: var(--mark); transition: opacity 120ms ease; }
.chart.hovering .col { opacity: .45; }
.chart.hovering .col.on { opacity: 1; }
.chart .hit { fill: transparent; cursor: pointer; }
#tip { position: fixed; z-index: 20; pointer-events: none; background: var(--ink); color: var(--bg); border-radius: var(--r-sm); padding: .5rem .625rem;
  font-size: .8125rem; line-height: 1.4; box-shadow: var(--shadow-lg); max-width: 14rem; }
details summary { cursor: pointer; padding: .5rem 0; list-style: none; }
details summary::-webkit-details-marker { display: none; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { text-align: start; padding: .5rem .375rem; border-bottom: 1px solid var(--sep); font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-weight: 500; font-size: .8125rem; }

/* sheet: comes up from the bottom, leaves the same way, follows the finger when dragged */
.scrim { position: fixed; inset: 0; z-index: 30; background: var(--scrim); opacity: 0; }
.sheet { position: fixed; z-index: 31; inset: auto 0 0; margin: 0 auto; max-width: 36rem; max-height: calc(100dvh - 2.5rem - env(safe-area-inset-top));
  display: flex; flex-direction: column; background: var(--surface); border-radius: 1.5rem 1.5rem 0 0; box-shadow: var(--shadow-lg);
  transform: translateY(100%); will-change: transform; }
.sheet-head { flex: none; padding: .5rem 1.25rem .75rem; touch-action: none; cursor: grab; }
.sheet-head:active { cursor: grabbing; }
.grabber { width: 2.25rem; height: .3125rem; border-radius: 999px; background: var(--surface-3); margin: 0 auto .875rem; }
.sheet-title { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.sheet-title h2 { font-size: 1.375rem; line-height: 1.2; font-weight: 800; letter-spacing: -0.018em; margin: 0; word-break: break-word; }
.close { flex: none; width: 2rem; height: 2rem; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 1.25rem calc(1.5rem + env(safe-area-inset-bottom)); display: grid; gap: 1.125rem; }
.meta { display: grid; gap: .5rem; margin: 0; }
.meta div { display: flex; justify-content: space-between; gap: 1rem; font-size: .9375rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; text-align: end; word-break: break-word; }
.saved { font-size: .8125rem; color: var(--good); min-height: 1.2rem; }
.saved.err { color: var(--warn); }
.link { direction: ltr; text-align: left; font-size: .8125rem; background: var(--surface-2); border-radius: var(--r-sm); padding: .625rem .75rem; word-break: break-all; }
.caption-text { white-space: pre-line; color: var(--ink-2); font-size: .9375rem; line-height: 1.5; background: var(--surface-2); border-radius: var(--r-md); padding: .75rem .875rem; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.skeleton { height: 7.5rem; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface) 0, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

@media (min-width: 48rem) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr 1fr; }
  .tabs { position: sticky; top: 0; bottom: auto; padding: .5rem 1rem; border-top: 0; border-bottom: 1px solid var(--chrome-edge); }
  .bar-top { position: static; }
  .bar-top::after { display: none; }
  .tab { grid-auto-flow: column; gap: .5rem; font-size: .875rem; padding: .5rem .875rem; }
  .tab svg { width: 1.125rem; height: 1.125rem; }
  .tab .badge { position: static; }
  .wrap { padding-bottom: 3rem; }
  .sheet { bottom: 1.25rem; border-radius: 1.5rem; }
}

/* accessibility fallbacks */
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .hbar .fill, .pressable, .btn, .tab, .seg button, .row-btn, .chip { transition: none; }
  .pressable:active, .btn:active, .chip:active, .tab:active, .seg button:active { transform: none; opacity: .7; }
}
@media (prefers-reduced-transparency: reduce) {
  .bar-top, .tabs { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --sep: var(--muted); --muted: var(--ink-2); }
  .card, .list, .field, .seg, .chip { border: 1px solid var(--ink-2); }
}
