:root {
  --bg: #0a0e16;
  --bg2: #0d121c;
  --surface: #121927;
  --surface2: #18212f;
  --line: #243044;
  --line2: #2e3b52;
  --text: #e9eef6;
  --quiet: #8d99ae;
  --faint: #5f6b80;
  --mint: #3ee6c4;
  --mint-ink: #04241e;
  --sky: #6ab0ff;
  --amber: #ffb84d;
  --coral: #ff6b6b;
  --green: #46d483;
  --radius: 18px;
  --radius-s: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow-x: hidden;
}
body::before { /* soft glow behind the page */
  content: ""; position: fixed; inset: -20vh -20vw auto auto; width: 70vw; height: 60vh; pointer-events: none; z-index: 0;
  background: radial-gradient(closest-side, rgba(62, 230, 196, .10), transparent 70%);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--sky); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: rgba(10, 14, 22, .78); backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid rgba(36, 48, 68, .6);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.logo { width: 30px; height: 30px; flex: none; }
.updated { margin-left: auto; color: var(--faint); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(70, 212, 131, .15); }
.live-dot.stale { background: var(--amber); box-shadow: 0 0 0 3px rgba(255, 184, 77, .15); }
.live-dot.off { background: var(--coral); box-shadow: 0 0 0 3px rgba(255, 107, 107, .15); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.spin svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.shell { position: relative; z-index: 1; }
main { padding: 16px 16px calc(var(--tabbar) + var(--safe-bottom) + 96px); max-width: 760px; margin: 0 auto; }
.page-title { font-size: 28px; font-weight: 750; letter-spacing: -.02em; margin: 6px 2px 14px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 10px; }
.section-title h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--quiet); margin: 0; font-weight: 650; }
.section-title span { font-size: 12px; color: var(--faint); }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, var(--surface2), var(--surface));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
}
.hero { position: relative; overflow: hidden; padding: 20px 18px 18px; }
.hero::after { /* the two parallel lines motif */
  content: ""; position: absolute; right: -30px; top: -40px; width: 160px; height: 220px; opacity: .14; pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, var(--mint) 38% 47%, transparent 47% 56%, var(--mint) 56% 65%, transparent 65%);
}
.hero .label { color: var(--quiet); font-size: 13px; }
.hero .big { font-size: 44px; font-weight: 780; letter-spacing: -.03em; line-height: 1.05; margin: 4px 0 2px; }
.hero .big small { font-size: 18px; color: var(--quiet); font-weight: 600; letter-spacing: 0; }
.hero .sub { color: var(--quiet); font-size: 13px; }
.goal { margin-top: 16px; cursor: pointer; border: 0; background: none; padding: 0; width: 100%; text-align: left; }
.goal-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--quiet); margin-bottom: 7px; }
.goal-row b { color: var(--text); font-weight: 650; }
.bar { height: 8px; background: #0b1220; border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #22c7a7, var(--mint)); box-shadow: 0 0 12px rgba(62, 230, 196, .5); transition: width .6s cubic-bezier(.2, .8, .2, 1); }

.strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.strip button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px 4px 9px; cursor: pointer; text-align: center;
}
.strip b { display: block; font-size: 20px; font-weight: 720; }
.strip span { font-size: 11px; color: var(--quiet); }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; min-height: 56px;
  transition: transform .12s ease, border-color .12s ease;
}
.row:active { transform: scale(.985); }
@media (hover: hover) { .row:hover { border-color: var(--line2); } }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .d { color: var(--quiet); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { color: var(--faint); font-size: 12px; text-align: right; flex: none; }
.chev { color: var(--faint); flex: none; }
.tone { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.tone.coral { background: var(--coral); box-shadow: 0 0 10px rgba(255, 107, 107, .6); }
.tone.amber { background: var(--amber); box-shadow: 0 0 10px rgba(255, 184, 77, .5); }
.tone.mint { background: var(--mint); box-shadow: 0 0 10px rgba(62, 230, 196, .5); }
.tone.sky { background: var(--sky); }
.tone.quiet { background: var(--faint); }

.avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: #1d2a3f; color: #b9c7dc; border: 1px solid var(--line2);
}

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 650; padding: 3px 8px; border-radius: 99px; border: 1px solid var(--line2); color: var(--quiet); white-space: nowrap; }
.badge.coral { color: var(--coral); border-color: rgba(255, 107, 107, .35); background: rgba(255, 107, 107, .08); }
.badge.amber { color: var(--amber); border-color: rgba(255, 184, 77, .35); background: rgba(255, 184, 77, .08); }
.badge.mint { color: var(--mint); border-color: rgba(62, 230, 196, .35); background: rgba(62, 230, 196, .08); }
.badge.green { color: var(--green); border-color: rgba(70, 212, 131, .35); background: rgba(70, 212, 131, .08); }
.badge.sky { color: var(--sky); border-color: rgba(106, 176, 255, .35); background: rgba(106, 176, 255, .08); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

.empty { text-align: center; color: var(--quiet); padding: 30px 16px; border: 1px dashed var(--line2); border-radius: var(--radius); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* countdown ring */
.ring { width: 46px; height: 46px; flex: none; position: relative; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring span { font-size: 11px; font-weight: 700; line-height: 1; text-align: center; }

/* filter chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--quiet); border-radius: 99px; padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 600; min-height: 38px; }
.chip.on { background: var(--mint); color: var(--mint-ink); border-color: var(--mint); }
.chip i { font-style: normal; opacity: .7; margin-left: 4px; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + var(--safe-bottom));
  background: rgba(12, 17, 27, .86); backdrop-filter: saturate(160%) blur(20px); -webkit-backdrop-filter: saturate(160%) blur(20px);
  border-top: 1px solid rgba(36, 48, 68, .7);
}
.tab { border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; color: var(--faint); font-size: 11px; font-weight: 600; position: relative; min-height: 50px; }
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--mint); }
.tab .dot { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 99px; background: var(--coral); color: #fff; font-size: 10px; font-weight: 750; display: grid; place-items: center; }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--tabbar) + var(--safe-bottom) + 18px); z-index: 25;
  width: 56px; height: 56px; border-radius: 18px; border: 0; cursor: pointer;
  background: var(--mint); color: var(--mint-ink); display: grid; place-items: center;
  box-shadow: 0 10px 30px rgba(62, 230, 196, .35), 0 2px 0 rgba(255, 255, 255, .35) inset;
}
.fab svg { width: 26px; height: 26px; }

/* ---------- sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(3, 6, 12, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity .2s; }
.scrim.on { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg2); border: 1px solid var(--line); border-bottom: 0; border-radius: 24px 24px 0 0;
  padding: 8px 18px calc(24px + var(--safe-bottom));
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet.on { transform: none; }
.grab { width: 40px; height: 5px; border-radius: 99px; background: var(--line2); margin: 4px auto 12px; }
.sheet h3 { font-size: 22px; margin: 0; letter-spacing: -.02em; }
.sheet .sub { color: var(--quiet); font-size: 13px; margin-top: 2px; }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; }
.sheet-head .x { margin-left: auto; }

.steps { display: flex; gap: 6px; margin: 16px 0 4px; }
.steps div { flex: 1; height: 5px; border-radius: 99px; background: var(--line); }
.steps div.done { background: var(--mint); }
.steps-l { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--faint); margin-bottom: 4px; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 14px; margin: 14px 0; }
.kv dt { color: var(--quiet); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.block { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-top: 12px; }
.block h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .09em; color: var(--quiet); }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.timeline li { padding: 7px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.timeline li:first-child { border-top: 0; }
.timeline time { color: var(--faint); flex: none; width: 74px; }

/* ---------- buttons + forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: 14px; border: 1px solid var(--line2); background: var(--surface2); cursor: pointer; font-weight: 650;
}
.btn.primary { background: var(--mint); color: var(--mint-ink); border-color: var(--mint); }
.btn.danger { color: var(--coral); border-color: rgba(255, 107, 107, .35); background: rgba(255, 107, 107, .06); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.btns .wide { grid-column: 1 / -1; }

.field { display: block; margin-top: 12px; }
.field span { display: block; font-size: 12.5px; color: var(--quiet); margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line2);
  background: #0b111c; outline: none; font-size: 16px; /* 16px stops iPhone zoom */
}
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(62, 230, 196, .15); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--mint); }

/* ---------- toast + celebration ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + var(--safe-bottom) + 90px); z-index: 60; transform: translate(-50%, 20px);
  background: #1b2638; border: 1px solid var(--line2); padding: 11px 16px; border-radius: 14px; font-size: 14px; opacity: 0;
  transition: all .25s; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 107, 107, .5); }
.burst { position: fixed; inset: 0; pointer-events: none; z-index: 70; display: grid; place-items: center; }
.burst div { position: absolute; width: 8px; height: 22px; border-radius: 4px; background: var(--mint); animation: fly 1.1s cubic-bezier(.15, .7, .3, 1) forwards; }
.burst div:nth-child(3n) { background: var(--sky); }
.burst div:nth-child(4n) { background: var(--amber); }
@keyframes fly { from { transform: rotate(var(--r)) translateY(0) scale(.6); opacity: 1; } to { transform: rotate(var(--r)) translateY(-42vh) scale(1); opacity: 0; } }
.burst p { font-size: 26px; font-weight: 800; letter-spacing: -.02em; animation: pop 1.3s ease forwards; text-shadow: 0 4px 30px rgba(62, 230, 196, .6); }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 25% { transform: scale(1.06); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; position: relative; z-index: 1; }
.login form { width: 100%; max-width: 360px; }
.login .logo { width: 56px; height: 56px; margin-bottom: 18px; }
.login h1 { font-size: 28px; margin: 0 0 4px; letter-spacing: -.02em; }
.login p { color: var(--quiet); margin: 0 0 18px; }
.login .err { color: var(--coral); font-size: 14px; min-height: 20px; margin-top: 10px; }

/* ---------- laptop ---------- */
@media (min-width: 900px) {
  :root { --tabbar: 0px; }
  .tabbar {
    top: 0; bottom: 0; right: auto; width: 88px; grid-template-columns: 1fr; grid-auto-rows: 76px; align-content: start;
    padding: calc(72px + var(--safe-top)) 8px 0; border-top: 0; border-right: 1px solid rgba(36, 48, 68, .7);
  }
  .topbar { padding-left: 104px; }
  main { padding: 24px 32px 120px 120px; max-width: 1100px; }
  .two { display: grid; grid-template-columns: 1.1fr .9fr; gap: 20px; align-items: start; }
  .two .section-title:first-child { margin-top: 0; }
  .sheet { left: auto; right: 24px; top: 24px; bottom: 24px; width: 460px; max-height: none; border-radius: 24px; border-bottom: 1px solid var(--line); transform: translateX(110%); }
  .sheet.on { transform: none; }
  .grab { display: none; }
  .fab { bottom: 28px; right: 28px; }
  .toast { bottom: 40px; }
  .clients-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- lock screen ---------- */
.lock { position: relative; z-index: 1; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(24px + var(--safe-top)) 24px calc(24px + var(--safe-bottom)); text-align: center; }
.lock .logo { width: 60px; height: 60px; margin-bottom: 14px; }
.lock h1 { font-size: 26px; margin: 0; letter-spacing: -.02em; }
.lock p { color: var(--quiet); margin: 6px 0 22px; min-height: 22px; }
.lock p.bad { color: var(--coral); }
.dots { display: flex; gap: 16px; margin-bottom: 34px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line2); transition: all .15s; }
.dots i.on { background: var(--mint); border-color: var(--mint); box-shadow: 0 0 12px rgba(62, 230, 196, .55); }
.dots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 26px; }
.pad button { width: 76px; height: 76px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 30px; font-weight: 500; cursor: pointer; display: grid; place-items: center; transition: background .1s, transform .1s; }
.pad button:active { background: var(--surface2); transform: scale(.94); }
.pad button.soft { background: transparent; border-color: transparent; color: var(--quiet); }
.pad button.soft svg { width: 30px; height: 30px; }
.pad #faceBtn { color: var(--mint); }
.pad [hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.topbar .icon-btn + .icon-btn { margin-left: 0; }

[hidden] { display: none !important; }

/* ---------- native-app feel on phones ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; overscroll-behavior: none; }
body { overscroll-behavior-y: none; }
/* 16px+ text in boxes stops iPhone zooming in when you tap them */
input, select, textarea, .field input, .field select, .field textarea { font-size: 16px !important; }
/* no text-selection popups or long-press menus on things you tap */
button, .tab, .chip, .row, .strip button, .pad button, .icon-btn, .fab, a.row, .badge, .topbar, .tabbar, .section-title {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
button, a, .row, [data-biz], [data-thread], [data-tab] { touch-action: manipulation; }
/* every tap answers right away */
.row, .strip button, .chip, .btn, .icon-btn, .tab, .fab, .hero button, .block button {
  transition: transform .12s ease, background-color .12s ease, opacity .12s ease;
}
.row:active, .strip button:active, .btn:active, .chip:active { transform: scale(.975); }
.icon-btn:active, .fab:active { transform: scale(.92); }
.tab:active { opacity: .6; }
img, svg { -webkit-user-drag: none; }
/* swipe-to-close panels */
.sheet.dragging { transition: none !important; }
.grab { padding: 0; position: relative; }
.grab::after { content: ""; position: absolute; inset: -14px -60px; } /* bigger grab area */
@media (prefers-reduced-motion: reduce) { * { transition-duration: .01ms !important; animation-duration: .01ms !important; } }
