/* Flow — clean & bright, mobile first.
   Type scale: 12 / 14 / 16 / 22 (+ hero numbers). Spacing on a 4/8 grid. */
:root {
  --brand: #2a46b8;
  --brand-ink: #182463;
  --brand-soft: #eef1fd;
  --accent: #f5a524;
  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --line: #e9ecf4;
  --card-line: rgba(22, 32, 90, .07);
  --text: #141a33;
  --text-2: #3c4462;
  --muted: #6b7390;
  --danger: #d6334a;
  --ok: #1f9d55;
  --r-lg: 20px;
  --r: 16px;
  --r-sm: 12px;
  --shadow: 0 1px 2px rgba(22, 32, 90, .04), 0 4px 14px rgba(22, 32, 90, .05);
  --shadow-lg: 0 20px 60px rgba(24, 36, 99, .22);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --nav-h: 68px;
  --side-w: 248px;

  --t-grey: #5d6680;   --t-grey-bg: #eff1f6;
  --t-blue: #2459d6;   --t-blue-bg: #e8effe;
  --t-teal: #0b7f77;   --t-teal-bg: #e1f5f2;
  --t-purple: #6c3fd1; --t-purple-bg: #f1ebff;
  --t-orange: #c35a07; --t-orange-bg: #fff1e3;
  --t-red: #c9283e;    --t-red-bg: #fdeaec;
  --t-green: #1a8a4c;  --t-green-bg: #e4f6ea;
  --t-yellow: #946200; --t-yellow-bg: #fff5d1;

  /* Theme-aware helpers (dark values below) */
  --surface-3: #eef1f8;
  --line-2: #d5dbea;
  --faint: #a3a9bd;
  --tint: #fafbff;
  --tint-2: #f4f6fd;
  --brand-hover: #2240a8;
  --brand-hover-soft: #eef1ff;
  --seg-bg: #eef1f8;
  --lane-bg: #eceff6;
  --ok-tint: #f5fbf7;
  --ok-line: #bfe6cd;
  --help-1: #fffaf0;
  --help-2: #fff5e0;
  --help-line: #f6dfae;
  --danger-line: #f3c6cd;
  --hold-line: #f1d98a;
  --chip-on: #141a3d;
  --frost: rgba(255, 255, 255, .9);
  --frost-bg: rgba(244, 246, 251, .78);
  --bg-clear: rgba(244, 246, 251, 0);
  --hover: rgba(20, 26, 51, .05);
  --pop-bg: #fff;
  --pop-ink: #182463;
  --grad-ink: #182463;
  --bar-soft: #c9d3fa;
  --input-bg: #ffffff;
  --overlay: rgba(12, 18, 48, .42);
  color-scheme: light;
}

/* ── Dark theme ───────────────────────────────────────────────────── */
:root[data-theme="dark"] {
  --brand: #6b86f7;
  --brand-ink: #c7d2ff;
  --brand-soft: rgba(107, 134, 247, .16);
  --accent: #f7b13c;
  --bg: #0a0e1c;
  --bg-2: #0d1224;
  --surface: #121830;
  --surface-2: #182039;
  --surface-3: #1e2744;
  --line: #222b48;
  --line-2: #313c63;
  --card-line: rgba(255, 255, 255, .06);
  --text: #e9ecf8;
  --text-2: #bcc3dd;
  --muted: #8a92b2;
  --faint: #5f6888;
  --danger: #ff6b80;
  --ok: #3fd283;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .28);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
  --tint: #151c35;
  --tint-2: #182039;
  --brand-hover: #5873ea;
  --brand-hover-soft: rgba(107, 134, 247, .22);
  --seg-bg: #0f1529;
  --lane-bg: #0f1529;
  --ok-tint: rgba(63, 210, 131, .08);
  --ok-line: rgba(63, 210, 131, .35);
  --help-1: rgba(247, 177, 60, .1);
  --help-2: rgba(247, 177, 60, .06);
  --help-line: rgba(247, 177, 60, .28);
  --danger-line: rgba(255, 107, 128, .35);
  --hold-line: rgba(232, 186, 50, .4);
  --chip-on: #6b86f7;
  --frost: rgba(18, 24, 48, .86);
  --frost-bg: rgba(10, 14, 28, .78);
  --bg-clear: rgba(10, 14, 28, 0);
  --hover: rgba(255, 255, 255, .06);
  --pop-bg: #6b86f7;
  --pop-ink: #ffffff;
  --grad-ink: #2a3fa8;
  --bar-soft: #34407a;
  --input-bg: #0f1529;
  --overlay: rgba(0, 0, 0, .6);
  color-scheme: dark;

  --t-grey: #a3abc6;   --t-grey-bg: rgba(163, 171, 198, .12);
  --t-blue: #8aa6ff;   --t-blue-bg: rgba(107, 140, 255, .16);
  --t-teal: #4fd1c5;   --t-teal-bg: rgba(79, 209, 197, .13);
  --t-purple: #b49cff; --t-purple-bg: rgba(160, 130, 255, .16);
  --t-orange: #ffa45c; --t-orange-bg: rgba(255, 150, 70, .14);
  --t-red: #ff7a8c;    --t-red-bg: rgba(255, 107, 128, .14);
  --t-green: #4ade80;  --t-green-bg: rgba(74, 222, 128, .13);
  --t-yellow: #f5c84c; --t-yellow-bg: rgba(245, 200, 76, .13);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 400 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
a { color: var(--brand); }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lead { font-size: 16px; color: var(--text-2); }

.ms {
  font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal;
  font-size: 20px; line-height: 1; display: inline-block; vertical-align: middle;
  letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr;
  font-feature-settings: "liga"; -webkit-font-feature-settings: "liga";
  user-select: none; flex-shrink: 0; font-variation-settings: "FILL" 0, "wght" 450;
}
.ms.ok { color: var(--ok); }
.ms.warn { color: var(--t-orange); }

/* ── Brand mark / wordmark / splash ─────────────────────────────── */
.brand-mark { display: inline-block; flex-shrink: 0; line-height: 0; }
.brand-mark.tiled { filter: drop-shadow(0 6px 14px rgba(22, 32, 90, .28)); }
.brand-mark svg { display: block; overflow: visible; }
.brand-mark polygon { transform-box: fill-box; transform-origin: 0% 100%; }
.brand-mark.animated .fb1 { animation: fb-in .55s .10s cubic-bezier(.2, .9, .3, 1.2) both; }
.brand-mark.animated .fb2 { animation: fb-in .55s .22s cubic-bezier(.2, .9, .3, 1.2) both; }
.brand-mark.animated .fb3 { animation: fb-in .5s .36s cubic-bezier(.2, .9, .3, 1.2) both; }
.brand-mark.animated .fb4 { animation: fb-in .6s .5s cubic-bezier(.2, .9, .3, 1.3) both, fb-glow 3s 1.4s ease-in-out infinite; }
@keyframes fb-in { from { opacity: 0; transform: translate(-6px, 8px) scaleY(.2); } to { opacity: 1; transform: none; } }
@keyframes bm-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes fb-glow { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }

.wordmark { font-weight: 700; font-size: 18px; letter-spacing: -.03em; color: var(--brand-ink); white-space: nowrap; line-height: 1.1; }
.wordmark.lg { font-size: 30px; }
.brand-tag { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .01em; }

.splash { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; align-content: center; gap: 16px; }
.splash .wordmark, .splash .brand-tag { animation: rise .6s .5s both; }
.splash .brand-tag { margin-top: -10px; animation-delay: .6s; }
.splash-bar { width: 120px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 8px; animation: rise .5s .7s both; }
.splash-bar i { display: block; width: 40%; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--brand), var(--accent)); animation: splash-run 1.1s ease-in-out infinite; }
@keyframes splash-run { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Legacy tile (kept for message screens) */
.logo {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(140deg, var(--grad-ink), var(--brand)); color: #fff;
  font-weight: 700; font-size: 15px; letter-spacing: .5px; flex-shrink: 0;
}

/* ── Sign-in (Flow) — mobile: hero + bottom sheet · desktop: split screen ── */
.auth {
  --hero-1: #0d1440; --hero-2: #182a86; --hero-3: #2a46b8;
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--hero-1); color: #fff; overflow-x: hidden;
}
.auth-hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: calc(var(--safe-t) + 28px) 20px 48px; gap: 16px;
  background: linear-gradient(160deg, var(--hero-1) 0%, var(--hero-2) 60%, var(--hero-3) 120%);
}
.auth-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.auth-bg i { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; }
.auth-bg .b1 { width: 320px; height: 320px; left: -120px; top: -100px; background: #3d5ef0; animation: float1 16s ease-in-out infinite alternate; }
.auth-bg .b2 { width: 260px; height: 260px; right: -110px; top: 30%; background: #6a49e6; opacity: .4; animation: float2 19s ease-in-out infinite alternate; }
.auth-bg .b3 { width: 200px; height: 200px; left: 30%; bottom: -120px; background: var(--accent); opacity: .22; animation: float1 22s ease-in-out infinite alternate-reverse; }
.auth-bg .grid {
  inset: 0; border-radius: 0; filter: none; opacity: .5;
  background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1.2px); background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(90% 70% at 50% 30%, #000 30%, transparent 75%); mask-image: radial-gradient(90% 70% at 50% 30%, #000 30%, transparent 75%);
}
@keyframes float1 { to { transform: translate(60px, 50px) scale(1.15); } }
@keyframes float2 { to { transform: translate(-50px, -40px) scale(1.1); } }

.auth-top { display: flex; align-items: center; gap: 12px; order: 1; }
.auth-top .brand-mark { display: none; }
.auth .wordmark { color: #fff; font-size: 32px; }
.auth-top .brand-tag { color: rgba(255, 255, 255, .6); font-size: 13px; }
.auth-name { display: grid; gap: 2px; justify-items: center; animation: rise .6s .6s both; }
.auth-hero-mark { order: 0; padding: 4px; }
.auth-hero-mark .brand-mark { filter: drop-shadow(0 14px 30px rgba(0, 0, 0, .35)); }
.auth-copy { order: 2; display: grid; gap: 8px; max-width: 420px; }
.auth-kicker { display: none; }
.auth-copy h1 { font-size: 17px; font-weight: 500; line-height: 1.45; color: rgba(255, 255, 255, .82); letter-spacing: 0; animation: rise .6s .75s both; }
.auth-copy h1 em { font-style: normal; color: #fff; }
.auth-sub { display: none; }
.auth-foot { display: none; }

/* The case journey: Case → Visit → Draft → Check → Bill, with a pulse running along it. */
.auth-flow { order: 3; position: relative; display: flex; justify-content: space-between; width: 100%; max-width: 340px; margin-top: 8px; --dot: 36px; --cycle: 5s; }
.af-rail { position: absolute; left: calc(var(--dot) / 2); right: calc(var(--dot) / 2); top: calc(var(--dot) / 2 - 1px); height: 2px; background: rgba(255, 255, 255, .16); border-radius: 2px; overflow: hidden; animation: rise .6s .9s both; }
.af-pulse { position: absolute; top: 0; bottom: 0; width: 30%; left: -30%; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: af-run var(--cycle) 1.6s linear infinite; }
@keyframes af-run { 0% { left: -30%; } 80%, 100% { left: 100%; } }
.af-step { position: relative; display: grid; justify-items: center; gap: 6px; animation: rise .5s calc(.9s + var(--i) * .08s) both; }
.af-dot {
  width: var(--dot); height: var(--dot); border-radius: 50%; display: grid; place-items: center;
  background: #16236e; border: 1.5px solid rgba(255, 255, 255, .2); color: rgba(255, 255, 255, .8);
  animation: af-lit var(--cycle) calc(1.6s + var(--i) * var(--cycle) * .8 / 4 - .3s) ease-out infinite;
}
.af-dot .ms { font-size: 17px; }
.af-step small { font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, .62); letter-spacing: .02em; }
@keyframes af-lit {
  0% { background: #16236e; border-color: rgba(255, 255, 255, .2); box-shadow: none; color: rgba(255, 255, 255, .8); }
  6% { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 6px rgba(245, 165, 36, .18), 0 0 22px rgba(245, 165, 36, .55); color: #2b1a00; }
  22%, 100% { background: #16236e; border-color: rgba(255, 255, 255, .2); box-shadow: none; color: rgba(255, 255, 255, .8); }
}

/* Sign-in card: a bottom sheet on phones */
.auth-panel { flex: 1; display: flex; flex-direction: column; margin-top: -28px; position: relative; z-index: 1; }
.auth-card {
  flex: 1; display: grid; align-content: start; gap: 16px; color: var(--text);
  background: var(--surface); border-radius: 28px 28px 0 0; padding: 28px 20px calc(var(--safe-b) + 24px);
  box-shadow: 0 -10px 40px rgba(5, 10, 40, .35);
  animation: sheet-up .75s .35s cubic-bezier(.2, .9, .25, 1) both;
}
.auth-card::before { content: ""; justify-self: center; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: -12px 0 4px; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.auth-card > * { animation: rise .5s both; }
.auth-card > :nth-child(2) { animation-delay: .7s; }
.auth-card > :nth-child(3) { animation-delay: .78s; }
.auth-card > :nth-child(4) { animation-delay: .86s; }
.auth-card > :nth-child(5), .auth-card > :nth-child(6) { animation-delay: .94s; }
.auth-card > :nth-child(7) { animation-delay: 1.02s; }
.auth-card-head { display: grid; gap: 4px; }
.auth-card-mark { display: none; }
.auth-card-head h2 { font-size: 22px; letter-spacing: -.02em; }
.auth-card-head p { color: var(--muted); font-size: 14px; }

.auth-field { display: grid; gap: 8px; }
.auth-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.auth-input {
  display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 6px 0 14px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface-2);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.auth-input > .ms { color: var(--muted); transition: color .2s; }
.auth-input input {
  flex: 1; min-width: 0; height: 100%; border: 0 !important; outline: 0; background: transparent !important;
  box-shadow: none !important; padding: 0 !important; min-height: 0; font-size: 16px;
}
.auth-input:focus-within { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px rgba(42, 70, 184, .12); }
.auth-input:focus-within > .ms { color: var(--brand); }
.auth-input .eye { margin-left: auto; }
.auth .form-error { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--t-red-bg); color: var(--t-red); }
.auth .form-error:empty { display: none; }

.auth-btn { position: relative; height: 56px; border-radius: 16px; font-size: 16px; overflow: hidden;
  background: linear-gradient(135deg, var(--grad-ink), var(--brand) 70%); box-shadow: 0 10px 24px rgba(42, 70, 184, .3); transition: transform .15s, box-shadow .2s, background .3s; }
.auth-btn::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .22) 50%, transparent 70%); transform: translateX(-100%); }
.auth-btn:hover::after { transform: translateX(100%); transition: transform .8s; }
.btn.auth-btn:hover { background: linear-gradient(135deg, var(--grad-ink), var(--brand) 70%); box-shadow: 0 14px 30px rgba(42, 70, 184, .38); }
.btn.auth-btn:disabled { opacity: 1; cursor: progress; }
.auth-btn:active { transform: scale(.98); }
.auth-btn .arrow { transition: transform .2s; }
.auth-btn:hover .arrow { transform: translateX(4px); }
.auth-btn .spin, .auth-btn .done-ic { display: none; }
.auth-card.loading .auth-btn .arrow { display: none; }
.auth-card.loading .auth-btn .spin { display: inline-block; }
.auth-card.done .btn.auth-btn { background: var(--ok); box-shadow: 0 10px 24px rgba(31, 157, 85, .3); }
.auth-card.done .auth-btn .arrow { display: none; }
.auth-card.done .auth-btn .done-ic { display: inline-block; animation: bm-pop .4s cubic-bezier(.3, 1.6, .5, 1) both; }
.auth-card.shake { animation: shake .45s; }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.auth-help { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; color: var(--muted); }
.auth-help .ms { font-size: 17px; }

/* Short phones: tighten the hero */
@media (max-height: 700px) and (max-width: 899px) {
  .auth-hero { gap: 10px; padding-bottom: 40px; }
  .auth-hero-mark .brand-mark, .auth-hero-mark svg { width: 56px !important; height: 56px !important; }
  .auth-flow { display: none; }
}

/* Desktop: brand panel on the left, sign-in on the right */
@media (min-width: 900px) {
  .auth { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(440px, 1fr); background: var(--bg); }
  .auth-hero {
    align-items: flex-start; text-align: left; justify-content: space-between;
    margin: 16px 0 16px 16px; border-radius: 28px; padding: 40px 56px 32px; gap: 32px;
    min-height: calc(100vh - 32px); min-height: calc(100dvh - 32px);
  }
  .auth-bg .b1 { width: 520px; height: 520px; left: -160px; top: -200px; }
  .auth-bg .b2 { width: 420px; height: 420px; right: -160px; top: 35%; }
  .auth-bg .b3 { width: 360px; height: 360px; left: 20%; bottom: -220px; }
  .auth-bg .grid { -webkit-mask-image: radial-gradient(80% 70% at 30% 40%, #000 20%, transparent 75%); mask-image: radial-gradient(80% 70% at 30% 40%, #000 20%, transparent 75%); }
  .auth-top { order: 0; }
  .auth-top .brand-mark { display: inline-block; }
  .auth-name { justify-items: start; animation-delay: .4s; }
  .auth-top .wordmark { font-size: 24px; }
  .auth-top .brand-tag { font-size: 12px; }
  .auth-hero-mark { display: none; }
  .auth-copy { order: 1; max-width: 560px; gap: 16px; margin-top: auto; }
  .auth-kicker { display: inline-flex; justify-self: start; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #ffd28a; background: rgba(245, 165, 36, .12); border: 1px solid rgba(245, 165, 36, .3); animation: rise .6s .55s both; }
  .auth-copy h1 { font-size: clamp(36px, 3.6vw, 52px); font-weight: 700; line-height: 1.08; letter-spacing: -.035em; color: #fff; animation-delay: .65s; }
  .auth-copy h1 em { background: linear-gradient(90deg, #ffd28a, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .auth-sub { display: block; font-size: 17px; line-height: 1.6; color: rgba(255, 255, 255, .7); max-width: 480px; animation: rise .6s .78s both; }
  .auth-flow { order: 2; max-width: 520px; margin: 8px 0 auto; --dot: 48px; }
  .af-dot .ms { font-size: 22px; }
  .af-step small { font-size: 12px; }
  .auth-foot { order: 3; display: flex; width: 100%; justify-content: space-between; font-size: 13px; color: rgba(255, 255, 255, .5); animation: rise .6s 1.2s both; }
  .auth-foot span { display: inline-flex; align-items: center; gap: 6px; }
  .auth-foot .ms { font-size: 17px; }

  .auth-panel { margin: 0; display: grid; place-items: center; padding: 32px; }
  .auth-card {
    flex: none; width: 100%; max-width: 420px; border-radius: 0; padding: 0; background: transparent; box-shadow: none;
    gap: 20px; animation: rise .7s .3s both;
  }
  .auth-card::before { display: none; }
  .auth-card-mark { display: block; margin-bottom: 16px; }
  .auth-card-head { gap: 8px; margin-bottom: 4px; }
  .auth-card-head h2 { font-size: 30px; letter-spacing: -.03em; }
  .auth-card-head p { font-size: 15px; }
  .auth-input { background: var(--surface); }
  .auth-card > :nth-child(1) { animation-delay: .45s; }
  .auth-help { justify-content: flex-start; }
}
@media (min-width: 1400px) {
  .auth-hero { padding: 56px 72px 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .enter > *, .enter .fs-step, .wk-pair span, .stat, .case-card { animation: none !important; transition: none !important; }
  .auth *, .auth *::before, .auth *::after, .splash *, .brand-mark * { animation: none !important; transition: none !important; }
}

.login {
  min-height: 100vh; display: grid; align-content: center; justify-items: center; gap: 24px; padding: 32px 16px;
  background: radial-gradient(120% 60% at 50% 0%, var(--brand-hover-soft) 0%, var(--bg) 60%);
}
.login-brand { display: grid; justify-items: center; text-align: center; gap: 8px; }
.login-brand h1 { font-size: 28px; margin-top: 8px; }
.login-brand p { color: var(--muted); }
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border-radius: var(--r-lg);
  padding: 24px; box-shadow: var(--shadow); display: grid; gap: 16px;
}
.login-card.center { justify-items: center; text-align: center; }
.form-error { color: var(--danger); font-size: 14px; font-weight: 500; }
.form-error:empty { display: none; }

/* ── Inputs ─────────────────────────────────────────────────────── */
.field { display: grid; gap: 8px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); letter-spacing: .01em; }
.req { color: var(--danger); }
.opt { color: var(--muted); font-weight: 400; font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; margin-top: -2px; line-height: 1.4; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 13px;
  border: 1px solid var(--line-2); background: var(--input-bg); outline: none; font-size: 16px;
  box-shadow: 0 1px 2px rgba(22, 32, 90, .04); transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { resize: vertical; min-height: 88px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover:not(:focus):not(:disabled), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: var(--line-2); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(42, 70, 184, .12); }
input:disabled { background: var(--surface-2); color: var(--muted); }
.invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 4px rgba(214, 51, 74, .1) !important; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row input { flex: 1; min-width: 0; }
.input-wrap { position: relative; }
.input-wrap .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.input-wrap input { padding-right: 48px; }
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid { grid-template-columns: 1fr 1fr; } }

details.more { border: 1.5px dashed var(--line); border-radius: var(--r-sm); padding: 12px 14px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--brand); font-size: 14px; }
details.more[open] summary { margin-bottom: 12px; }

/* Choice chips & segmented */
.choice-group { display: grid; gap: 8px; }
.choices, .chip-row.wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 500;
  transition: all .15s;
}
.choice .ms { font-size: 18px; color: var(--muted); }
.choice:hover { border-color: var(--line-2); }
.choice.on { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(42, 70, 184, .25); }
.choice.on .ms { color: #fff; }
.other-row input { min-height: 44px; }
.segmented { display: flex; background: var(--seg-bg); border: 1px solid var(--line); border-radius: 13px; padding: 4px; gap: 4px; }
.segmented button {
  flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: 14px;
  color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.segmented button { transition: background .15s, color .15s; }
.segmented button:hover:not(.on) { color: var(--text-2); }
.segmented button.on { background: var(--surface); color: var(--brand); box-shadow: 0 1px 2px rgba(24, 36, 99, .08), 0 2px 8px rgba(24, 36, 99, .08); }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-sm); border: 1.5px solid transparent;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 2px 6px rgba(42, 70, 184, .2);
  transition: transform .06s, background .15s, opacity .15s;
}
.btn:hover { background: var(--brand-hover); }
.btn:active { transform: scale(.98); }
.btn.big { min-height: 52px; font-size: 16px; border-radius: 14px; padding: 0 22px; }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.outline { background: var(--surface); color: var(--brand); border-color: var(--line-2); box-shadow: none; }
.btn.outline:hover { background: var(--brand-soft); }
.btn.ghost { background: transparent; color: var(--text-2); box-shadow: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { background: var(--danger); }
.btn.outline.danger { background: var(--surface); color: var(--danger); border-color: var(--danger-line); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.loading::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
.btn.loading > .ms { display: none; }
.btn:focus-visible, .icon-btn:focus-visible, .case-card:focus-visible, .nav-item:focus-visible, .choice:focus-visible,
.chip:focus-visible, .stat:focus-visible, .set-row:focus-visible, .person:focus-visible, .assign-row:focus-visible {
  outline: 3px solid rgba(42, 70, 184, .4); outline-offset: 2px;
}
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0;
  background: transparent; cursor: pointer; color: var(--muted); flex-shrink: 0;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn.sm .ms { font-size: 18px; }
.link { border: 0; background: none; color: var(--brand); font-weight: 600; cursor: pointer; padding: 8px 0; font-size: 14px; }

.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .8s linear infinite; display: inline-block; }
.spin.dark { border-color: var(--line); border-top-color: var(--brand); width: 28px; height: 28px; border-width: 3px; }
.loading-block { display: grid; place-items: center; padding: 64px 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pills ──────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px 4px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--tone-bg, var(--t-grey-bg)); color: var(--tone, var(--t-grey));
}
.pill .ms { font-size: 15px; }
.pill.big { font-size: 14px; padding: 6px 12px 6px 10px; }
.pill.big .ms { font-size: 18px; }
.tone-grey   { --tone: var(--t-grey);   --tone-bg: var(--t-grey-bg); }
.tone-blue   { --tone: var(--t-blue);   --tone-bg: var(--t-blue-bg); }
.tone-teal   { --tone: var(--t-teal);   --tone-bg: var(--t-teal-bg); }
.tone-purple { --tone: var(--t-purple); --tone-bg: var(--t-purple-bg); }
.tone-orange { --tone: var(--t-orange); --tone-bg: var(--t-orange-bg); }
.tone-red    { --tone: var(--t-red);    --tone-bg: var(--t-red-bg); }
.tone-green  { --tone: var(--t-green);  --tone-bg: var(--t-green-bg); }
.tone-yellow { --tone: var(--t-yellow); --tone-bg: var(--t-yellow-bg); }
.count {
  display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 700;
}
.count.red { background: var(--t-red-bg); color: var(--t-red); }
.wait { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--t-orange-bg); color: var(--t-orange); white-space: nowrap; }
.wait.late { background: var(--t-red-bg); color: var(--t-red); }
.wait.ok { background: var(--t-green-bg); color: var(--t-green); }
.dot-sep::before { content: "·"; margin: 0 6px; color: var(--faint); }

/* ── Avatars ────────────────────────────────────────────────────── */
.avatar {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff;
  font-weight: 700; font-size: 14px; flex-shrink: 0; letter-spacing: .02em;
}
.avatar.xs { width: 24px; height: 24px; font-size: 10px; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.xl { width: 80px; height: 80px; font-size: 28px; box-shadow: 0 8px 24px rgba(24, 36, 99, .2); }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }

/* ── App shell ──────────────────────────────────────────────────── */
.content { max-width: 1120px; margin: 0 auto; padding: calc(16px + var(--safe-t)) 16px calc(var(--nav-h) + 32px + var(--safe-b)); }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--frost); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line); padding: 6px 8px calc(6px + var(--safe-b)); min-height: var(--nav-h);
  box-shadow: 0 -8px 24px rgba(22, 32, 90, .05);
}
.nav-item {
  display: grid; justify-items: center; align-content: center; gap: 2px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 12px; font-weight: 600; padding: 4px 0; border-radius: 12px;
}
.nav-ic { position: relative; display: grid; place-items: center; width: 56px; height: 32px; border-radius: 999px; transition: background .2s; }
.nav-item.on { color: var(--brand); }
.nav-item.on .nav-ic { background: var(--brand-soft); }
.bottom-nav .nav-item.on .nav-ic { animation: nav-pop .3s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes nav-pop { from { transform: scale(.8); } }
.nav-item.on .ms { font-variation-settings: "FILL" 1, "wght" 500; }
.nav-new .nav-ic { width: 52px; height: 52px; margin-top: -24px; background: linear-gradient(145deg, #182a86, var(--brand)); color: #fff; box-shadow: 0 8px 20px rgba(42, 70, 184, .35); border: 4px solid var(--bg); }
.nav-new .nav-ic .ms { font-size: 26px; }
.badge {
  position: absolute; top: -4px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface);
}
.sidebar { display: none; }
.offline-bar {
  position: sticky; top: 0; z-index: 25; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px; background: #312e2b; color: #fff; font-size: 14px;
}
.push-banner {
  display: flex; align-items: center; gap: 12px; margin: calc(12px + var(--safe-t)) 16px 0; padding: 12px;
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); max-width: 1088px;
}
.push-banner p { flex: 1; display: grid; font-size: 14px; }
.push-banner small { color: var(--muted); font-size: 12px; }
.push-banner small .ms { font-size: 15px; }
.pb-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--t-yellow-bg); color: var(--t-yellow); }
.push-banner + .content { padding-top: 16px; }

@media (min-width: 900px) {
  .sidebar {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 30; padding: 20px 14px;
    color: #fff; isolation: isolate; overflow: hidden;
    background: radial-gradient(120% 50% at 0% 0%, rgba(74, 102, 214, .35), transparent 60%), linear-gradient(180deg, #0f1745 0%, #121c55 100%);
  }
  .sidebar::after { content: ""; position: absolute; inset: auto -60px -60px auto; width: 220px; height: 220px; border-radius: 50%; z-index: -1;
    background: radial-gradient(circle, rgba(245, 165, 36, .14), transparent 70%); }
  .side-brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 26px; }
  .side-brand .brand-mark.tiled { filter: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .1); border-radius: 10px; }
  .side-brand .wordmark { display: block; font-size: 21px; color: #fff; }
  .side-brand small { color: rgba(255, 255, 255, .55); font-size: 12px; font-weight: 500; }
  .side-nav { display: grid; gap: 2px; }
  .side-nav .nav-item { position: relative; grid-auto-flow: column; justify-content: start; gap: 10px; padding: 3px 8px; font-size: 14px; color: rgba(255, 255, 255, .66); transition: background .15s, color .15s; }
  .side-nav .nav-ic { width: 34px; height: 34px; border-radius: 10px; }
  .side-nav .nav-item.on { background: rgba(255, 255, 255, .1); color: #fff; }
  .side-nav .nav-item.on .nav-ic { background: none; color: #fff; }
  .side-nav .nav-item.on::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
  .side-nav .nav-item:hover:not(.on):not(.nav-new) { background: rgba(255, 255, 255, .06); color: #fff; }
  .side-nav .nav-new { margin: 8px 0; background: var(--pop-bg); color: var(--pop-ink); }
  .side-nav .nav-new .nav-ic { width: 34px; height: 34px; margin: 0; border: 0; box-shadow: none; background: var(--brand-soft); color: var(--brand); }
  .side-nav .nav-new .nav-ic .ms { font-size: 22px; }
  .side-nav .nav-new:hover { background: var(--brand-hover-soft); }
  .side-nav .badge { right: -4px; top: -2px; border-color: #121c55; }
  .side-foot { margin-top: auto; display: grid; gap: 6px; }
  .side-me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; min-width: 0; width: 100%; text-align: left; cursor: pointer; color: #fff;
    background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); transition: background .15s; }
  .side-me:hover { background: rgba(255, 255, 255, .1); }
  .side-me div { min-width: 0; display: grid; }
  .side-me b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-me small { color: rgba(255, 255, 255, .5); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-toggle { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 16px; border: 0; border-radius: 10px; background: none; cursor: pointer;
    color: rgba(255, 255, 255, .5); font-size: 13px; font-weight: 600; transition: background .15s, color .15s; }
  .side-toggle:hover { background: rgba(255, 255, 255, .06); color: #fff; }
  .side-toggle .ms { font-size: 20px; }

  /* Collapsed: an icon rail */
  .sidebar, .content, .topbar-slot, .push-banner, .offline-bar { transition: width .25s cubic-bezier(.2, .8, .2, 1), margin-left .25s cubic-bezier(.2, .8, .2, 1), padding .25s; }
  body.side-collapsed { --side-w: 76px; }
  .side-collapsed .sidebar { padding: 20px 12px; }
  .side-collapsed .side-brand { justify-content: center; padding: 2px 0 26px; }
  .side-collapsed .side-name, .side-collapsed .nav-label, .side-collapsed .side-me div, .side-collapsed .side-toggle span { display: none; }
  .side-collapsed .side-nav .nav-item { justify-content: center; padding: 3px 0; }
  .side-collapsed .side-nav .nav-item.on::before { left: -12px; }
  .side-collapsed .side-me { justify-content: center; padding: 8px 0; }
  .side-collapsed .side-toggle { justify-content: center; padding: 0; }
  .side-collapsed .side-nav .badge { right: 2px; }
  .bottom-nav { display: none; }
  .content { margin-left: calc(var(--side-w) + max(0px, (100vw - var(--side-w) - 1120px) / 2)); padding: 32px 32px 48px; }
  .offline-bar, .push-banner { margin-left: calc(var(--side-w) + 32px); }
  .push-banner { margin-top: 24px; margin-right: 32px; }
}

/* ── Home ───────────────────────────────────────────────────────── */
.home { display: grid; gap: 16px; }
.home-head { padding: 4px 0; }
.role-line { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; margin-top: 2px; }
.role-line .ms { font-size: 17px; }
.m-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 2px; }
.today { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.hello { font-size: 24px; font-weight: 700; letter-spacing: -.025em; line-height: 1.2; }
.me-btn { border: 0; padding: 2px; background: var(--surface); border-radius: 50%; box-shadow: 0 0 0 1px var(--line), var(--shadow); cursor: pointer; line-height: 0; }

/* Hero: navy brand card with the big number and the live case flow */
.hero {
  position: relative; overflow: hidden; isolation: isolate; border-radius: 24px; padding: 20px; color: #fff;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(74, 102, 214, .55) 0%, transparent 55%),
    radial-gradient(80% 60% at 0% 100%, rgba(245, 165, 36, .14) 0%, transparent 60%),
    linear-gradient(150deg, #0f1745 0%, #182a86 70%, #2238a6 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 18px 40px -12px rgba(22, 32, 90, .55);
  display: grid; gap: 4px;
}
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .35;
  background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1.2px); background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(110deg, transparent 30%, #000 100%); mask-image: linear-gradient(110deg, transparent 30%, #000 100%); }
.hero-deco { position: absolute; right: -18px; top: -26px; width: 190px; height: 190px; z-index: -1; opacity: .16; pointer-events: none; }
.hero-deco svg { width: 100%; height: 100%; }
.hero-deco polygon { fill: #fff; }
.hero-deco .fb4 { fill: var(--accent); opacity: .9; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; min-height: 30px; }
.hero-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 9px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .9); backdrop-filter: blur(6px); }
.hero-chip .ms { font-size: 16px; }
.hero-date { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: rgba(255, 255, 255, .55); }
.hero-date .ms { font-size: 15px; color: #6ee7b7; animation: live 2s ease-in-out infinite; }
@keyframes live { 50% { opacity: .35; } }
.hero-num { display: flex; align-items: center; gap: 12px; }
.hero-num b { font-size: 56px; line-height: 1; font-weight: 700; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.hero-num span { font-size: 17px; font-weight: 600; line-height: 1.25; max-width: 12ch; }
.hero-ok { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: rgba(52, 211, 153, .18); color: #6ee7b7; }
.hero-ok .ms { font-size: 30px; }
.hero.calm .hero-num span { max-width: none; font-size: 22px; letter-spacing: -.02em; }
.hero-line { color: rgba(255, 255, 255, .68); font-size: 14px; }
.hero-btn { background: var(--pop-bg); color: var(--pop-ink); box-shadow: 0 6px 18px rgba(0, 0, 0, .22); min-height: 40px; }
.btn.hero-btn:hover { background: var(--brand-hover-soft); }
.hero-flow { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .1); }
.hf-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .5); margin-bottom: 10px; }

/* Flow strip: Case → Visit → Draft → Check → Bill with live counts */
.flow-strip { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.flow-strip::before { content: ""; position: absolute; left: 10%; right: 10%; top: 17px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .22) 80%, rgba(245, 165, 36, .6)); }
.fs-step { position: relative; display: grid; justify-items: center; gap: 2px; padding: 0 0 4px; border: 0; background: none; color: #fff; cursor: pointer; border-radius: 12px; transition: background .15s; }
.fs-step:hover { background: rgba(255, 255, 255, .06); }
.fs-dot { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; margin-bottom: 4px;
  background: #1b2a7a; border: 1.5px solid rgba(255, 255, 255, .22); color: rgba(255, 255, 255, .85); transition: transform .2s; }
.fs-dot .ms { font-size: 18px; }
.fs-step b { font-size: 18px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.fs-step small { font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, .6); }
.fs-step.zero b { color: rgba(255, 255, 255, .4); }
.fs-step.focus .fs-dot { background: var(--accent); border-color: var(--accent); color: #2b1a00; box-shadow: 0 0 0 5px rgba(245, 165, 36, .18), 0 0 20px rgba(245, 165, 36, .45); }
.fs-step.focus small { color: #ffd28a; }
.fs-step:hover .fs-dot { transform: translateY(-2px); }

/* Stats */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 12px; }
.stat-row.four { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .stat-row.four { grid-template-columns: repeat(5, 1fr); } }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat {
  position: relative; display: grid; gap: 4px; text-align: left; padding: 14px; border-radius: var(--r); border: 1px solid var(--card-line);
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer; min-width: 0; transition: transform .15s, box-shadow .2s, border-color .2s;
}
.stat-grid .stat { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.hd-stats .stat { grid-template-columns: minmax(0, 1fr); align-content: space-between; gap: 14px; }
.hd-stats .stat-go { position: absolute; top: 16px; right: 14px; }
div.stat { cursor: default; }
.stat-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--tone-bg); color: var(--tone); }
.stat-ic .ms { font-size: 20px; font-variation-settings: "FILL" 1, "wght" 500; }
.stat-text { display: grid; min-width: 0; }
.stat b { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.stat small { font-size: 12px; color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-text small { order: -1; }
.stat-grid .stat small { white-space: normal; line-height: 1.3; }
.stat-grid .stat { padding: 12px; gap: 10px; }
.stat-go { color: var(--faint); font-size: 18px; transition: transform .2s, color .2s; }
.stat-grid .stat-go { display: none; }
button.stat:hover { box-shadow: 0 2px 4px rgba(24, 36, 99, .05), 0 12px 28px rgba(24, 36, 99, .1); border-color: var(--line-2); transform: translateY(-1px); }
button.stat:hover .stat-go { color: var(--brand); transform: translateX(2px); }
button.stat:active { transform: scale(.98); }
.stat-grid .stat:last-child:nth-child(odd) { grid-column: span 2; }

.help-card { background: linear-gradient(135deg, var(--help-1), var(--help-2)); border: 1px solid var(--help-line); border-radius: var(--r); padding: 16px; }
.help-head { display: flex; align-items: center; gap: 8px; }
.help-head .ms { color: var(--accent); }
.help-head b { flex: 1; }
.help-card ol { margin: 8px 0 0; padding-left: 20px; color: var(--text-2); font-size: 14px; display: grid; gap: 4px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.section-head h2 { font-size: 18px; letter-spacing: -.02em; }
.see-all { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-size: 14px; }
.see-all .ms { font-size: 16px; }

/* Entrance: sections rise in one after another (first paint only) */
.enter > * { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.enter > :nth-child(2) { animation-delay: .06s; }
.enter > :nth-child(3) { animation-delay: .12s; }
.enter > :nth-child(4) { animation-delay: .18s; }
.enter > :nth-child(5) { animation-delay: .24s; }
.enter > :nth-child(n+6) { animation-delay: .3s; }
.enter .fs-step { animation: rise .45s calc(.25s + var(--i) * .06s) both; }

/* ── Case cards ─────────────────────────────────────────────────── */
.case-list { display: grid; gap: 12px; }
@media (min-width: 720px) { .case-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .case-list { grid-template-columns: repeat(3, 1fr); } }
.case-card {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; text-align: left; padding: 14px 14px 12px; border-radius: 18px;
  border: 1px solid var(--card-line); background: var(--surface); box-shadow: var(--shadow); cursor: pointer; min-width: 0; overflow: hidden;
  transition: transform .15s, box-shadow .2s, border-color .2s;
}
.case-card:hover { box-shadow: 0 2px 4px rgba(24, 36, 99, .05), 0 14px 32px rgba(24, 36, 99, .1); transform: translateY(-1px); }
.case-card:active { transform: scale(.99); }
.case-card.mine { border-color: rgba(42, 70, 184, .28); box-shadow: 0 0 0 3px rgba(42, 70, 184, .06), var(--shadow); }
.case-card.mine::after { content: ""; position: absolute; top: 14px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(245, 165, 36, .2); }
.case-card.mine .cc-row { padding-right: 14px; }
.case-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; flex-shrink: 0; background: var(--tone-bg); color: var(--tone); }
.case-ic .ms { font-size: 20px; font-variation-settings: "FILL" 1, "wght" 500; }
.cc-row { display: flex; gap: 12px; align-items: flex-start; }
.cc-main .ref { margin-top: 3px; font-size: 11px; }
.case-ic { margin-top: 1px; }
.cc-main { min-width: 0; flex: 1; }
.cc-row > .pill, .cc-row > .cc-amount { flex-shrink: 0; }
.cc-name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-meta { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-amount { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.cc-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 7px 10px; }
.cc-status .clip { flex: 1; }
.cc-status-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--line); color: var(--muted); }
.cc-status-icon .ms { font-size: 15px; }
.cc-foot { display: flex; align-items: center; gap: 6px; font-size: 12px; min-width: 0; }
.cc-foot .pill { flex-shrink: 0; }
.ref { font-family: "JetBrains Mono", ui-monospace, monospace; color: var(--muted); font-size: 12px; letter-spacing: -.02em; }
.cc-foot > :last-child { margin-left: auto; }
.cc-action { display: inline-flex; align-items: center; gap: 2px; color: var(--brand); font-weight: 700; font-size: 13px; white-space: nowrap; }
.cc-action .ms { font-size: 17px; transition: transform .2s; }
.case-card:hover .cc-action .ms { transform: translateX(3px); }

/* ── Cases page ─────────────────────────────────────────────────── */
.cases { display: grid; gap: 12px; }
.page-top h1 { font-size: 26px; letter-spacing: -.03em; }
.page-sub { color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 2px; }
.cases-sticky { position: sticky; top: 0; z-index: 5; display: grid; gap: 10px; margin: 0 -16px; padding: calc(8px + var(--safe-t)) 16px 8px;
  background: linear-gradient(var(--bg) 82%, var(--bg-clear)); }
.cases-sticky .chip-row { padding-bottom: 6px; }
.cases .case-list { margin-top: 2px; }
.page-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.search-box { position: relative; }
.search-box > .ms { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input.search { padding-left: 44px !important; border-radius: 999px; background: var(--surface); border-color: transparent; box-shadow: var(--shadow); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 4px; margin: 0 -16px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; white-space: nowrap; font-size: 14px; font-weight: 600; color: var(--text-2);
  transition: background .15s, border-color .15s, color .15s; flex-shrink: 0;
}
.chip:hover:not(.on) { border-color: var(--line-2); background: var(--surface-2); }
.chip .n { min-width: 20px; height: 20px; display: inline-grid; place-items: center; padding: 0 6px; border-radius: 99px; background: var(--surface-2); }
.chip.on .n { background: rgba(255, 255, 255, .16); }
.chip .ms { font-size: 18px; }
.chip .n { font-size: 12px; color: var(--muted); font-weight: 700; }
.chip.on { background: var(--chip-on); border-color: var(--chip-on); color: #fff; box-shadow: 0 4px 12px rgba(20, 26, 61, .2); }
.chip.on .n { color: rgba(255, 255, 255, .7); }
.table-only { display: none; }
@media (min-width: 900px) {
  .chip-row { margin: 0; padding: 2px 0 4px; flex-wrap: wrap; }
  .cases:has(.table-only) .cards-only { display: none; }
  .table-only { display: block; }
}
.table-wrap { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: auto; }
.case-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.case-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.case-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.case-table td small { display: block; color: var(--muted); font-size: 12px; }
.case-table tbody tr { cursor: pointer; transition: background .1s; }
.case-table tbody tr:hover, .case-table tbody tr:focus-visible { background: var(--surface-2); outline: none; }
.case-table tr:last-child td { border-bottom: 0; }
.case-table .pill + .pill { margin-left: 4px; }
.with { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }

/* ── Empty / skeleton ───────────────────────────────────────────── */
.empty { display: grid; justify-items: center; gap: 8px; padding: 48px 16px; text-align: center; grid-column: 1 / -1; }
.empty-icon { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); margin-bottom: 8px; }
.empty-icon .ms { font-size: 34px; }
.empty p { color: var(--muted); max-width: 320px; }
.empty .btn { margin-top: 8px; }

/* ── Layers: sheets and pages ───────────────────────────────────── */
.overlay, .page-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(12, 18, 48, .42); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .2s ease; }
.overlay { display: flex; align-items: flex-end; justify-content: center; }
.layer.out { animation: fade .2s ease reverse forwards; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-height: calc(100dvh - 32px - var(--safe-t)); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 28px 28px 0 0; box-shadow: 0 -12px 48px rgba(12, 18, 48, .25); animation: sheet-in .38s cubic-bezier(.2, .9, .25, 1.05);
}
@keyframes sheet-in { from { transform: translateY(100%); } }
.layer.out .sheet { animation: down .2s ease forwards; }
.sheet-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0; margin-top: 4px; background: var(--tone-bg); color: var(--tone); }
.sheet.confirm .sheet-head { flex-direction: column; align-items: center; text-align: center; padding: 20px 24px 6px; position: relative; }
.sheet.confirm .sheet-head > .icon-btn { position: absolute; right: 12px; top: 8px; }
.sheet.confirm .sheet-ic { width: 60px; height: 60px; border-radius: 50%; margin: 0 0 6px; box-shadow: 0 0 0 8px var(--tone-bg); }
.sheet.confirm .sheet-ic .ms { font-size: 30px; }
.sheet.confirm .sheet-body { text-align: center; padding: 4px 24px 22px; }
.sheet.confirm .lead { font-size: 15px; color: var(--muted); }
.sheet.confirm .sheet-foot .btn { flex: 1; }
.sheet-ic .ms { font-size: 24px; font-variation-settings: "FILL" 1, "wght" 500; }
@keyframes up { from { transform: translateY(60px); opacity: .5; } }
@keyframes dialog-in { from { transform: translateY(12px) scale(.96); opacity: 0; } }
@keyframes dialog-out { to { transform: translateY(8px) scale(.97); opacity: 0; } }
@keyframes down { to { transform: translateY(60px); opacity: 0; } }
.grabber { width: 40px; height: 5px; border-radius: 5px; background: var(--line-2); margin: 10px auto 0; flex-shrink: 0; }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px 10px 20px; }
.sheet-head h2 { font-size: 19px; letter-spacing: -.02em; }
.sheet-head > .icon-btn { background: var(--surface-2); border-radius: 50%; width: 36px; height: 36px; margin-top: 4px; }
.sheet-head > div { flex: 1; min-width: 0; padding-top: 8px; }
.sheet-head p { font-size: 13px; margin-top: 2px; }
.sheet-body { padding: 8px 20px 20px; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 16px; align-content: start; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 0 0; }
.sheet-foot .btn { min-height: 48px; border-radius: 13px; }
.sheet-foot .btn.ghost { background: var(--surface); border: 1px solid var(--line); }
.sheet-foot .btn:not(.ghost):not(.danger):not(.outline) { background: linear-gradient(135deg, var(--grad-ink), var(--brand) 70%); }
.sheet-foot .btn { flex: 1; }
@media (min-width: 720px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { max-width: 480px; border-radius: 24px; max-height: calc(100vh - 48px); overflow: hidden; box-shadow: 0 30px 80px rgba(12, 18, 48, .35); animation: dialog-in .28s cubic-bezier(.2, .9, .25, 1.1); }
  .layer.out .sheet { animation: dialog-out .18s ease forwards; }
  .sheet.confirm { max-width: 420px; }
  .grabber { display: none; }
  .sheet-foot { padding-bottom: 12px; }
  .sheet-foot .btn { flex: 0 0 auto; }
}

.page {
  position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg);
  animation: slide .26s cubic-bezier(.2, .8, .2, 1);
}
.layer.out .page { animation: slideout .2s ease forwards; }
@keyframes slide { from { transform: translateX(32px); opacity: .4; } }
@keyframes slideout { to { transform: translateX(32px); opacity: 0; } }
.page-head {
  display: flex; align-items: center; gap: 4px; padding: calc(8px + var(--safe-t)) 8px 8px; background: var(--frost);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line); min-height: 60px; position: relative; z-index: 2;
}
.page-title { flex: 1; min-width: 0; padding: 0 4px; }
.page-title h2 { font-size: 17px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-title p { font-size: 12px; color: var(--muted); font-family: "JetBrains Mono", ui-monospace, monospace; }
.page-title p:empty { display: none; }
.page-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px 32px; display: grid; gap: 16px; align-content: start; }
.page-foot { display: flex; gap: 8px; padding: 12px 16px calc(12px + var(--safe-b)); background: var(--frost); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(24, 36, 99, .06); }
.page-foot .btn.big { background: linear-gradient(135deg, var(--grad-ink), var(--brand) 70%); box-shadow: 0 8px 20px rgba(42, 70, 184, .28); }
.page-foot .btn.big:hover { background: linear-gradient(135deg, var(--grad-ink), var(--brand-hover) 70%); }
.page-foot .btn.big.outline { background: var(--surface); box-shadow: none; }
.page-foot > .btn:last-child { flex: 1; }
@media (min-width: 900px) {
  .page { left: auto; width: min(720px, 100%); border-radius: 24px 0 0 24px; box-shadow: var(--shadow-lg); overflow: hidden; }
  .page-body { padding: 24px 32px 40px; }
  .page-foot { padding: 16px 32px; }
}

/* ── Guided flows ───────────────────────────────────────────────── */
.stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.stepper li { flex: 1; display: grid; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.stepper li::before { content: ""; height: 4px; border-radius: 4px; background: var(--line); }
.stepper li.done::before { background: var(--ok); }
.stepper li.now::before { background: var(--brand); }
.stepper li.now { color: var(--brand); }
.stepper li span { display: none; }
.step-title { font-size: 16px; font-weight: 700; margin-top: 6px; letter-spacing: -.01em; }
.step-sub { color: var(--muted); margin-top: -8px; }
.form-stack { display: grid; gap: 16px; }
.form-card { background: var(--surface); border-radius: var(--r-lg); padding: 20px; display: grid; gap: 18px; box-shadow: var(--shadow); border: 1px solid var(--card-line); }
.fc-head { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; margin-bottom: 2px; border-bottom: 1px solid var(--line); }
.fc-head h3 { font-size: 16px; letter-spacing: -.01em; }
.fc-head p { color: var(--muted); font-size: 13px; }
.fc-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.fc-ic .ms { font-size: 20px; }
.format-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.format-row .segmented { flex: 0 0 220px; }
.ref-preview { display: inline-flex; align-items: center; gap: 4px; font: 500 13px "JetBrains Mono", ui-monospace, monospace; color: var(--muted); padding: 6px 10px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--line-2); }
.ref-preview .ms { font-size: 15px; color: var(--brand); }
.case-strip { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--card-line); box-shadow: var(--shadow); }
.cs-text { flex: 1; display: grid; min-width: 0; }
.cs-text b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-text small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-ref { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; color: var(--muted); padding: 4px 8px; border-radius: 8px; background: var(--surface-2); white-space: nowrap; }
.hint-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.hint-line .ms { font-size: 18px; }
.hint-line .ok { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 600; }
.hint-line .ok .ms { color: var(--ok); }
.note { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--tone-bg); color: var(--tone); }
.note > .ms { margin-top: 1px; }
.note b { display: block; }
.note p { color: var(--text); font-size: 14px; margin-top: 2px; }
.card-group { background: var(--surface); border-radius: 14px; border: 1px solid var(--line); overflow: hidden; }
.assign-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 72px; padding: 12px 16px; border: 0; background: none;
  text-align: left; cursor: pointer;
}
.assign-row + .assign-row { border-top: 1px solid var(--line); }
.assign-row:hover:not(:disabled) { background: var(--surface-2); }
.assign-row:disabled { cursor: default; opacity: .7; }
.ar-label { width: 108px; flex-shrink: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.assign-row { min-height: 64px; transition: background .15s; }
.ar-person { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.ar-person b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-empty { display: flex; align-items: center; gap: 6px; flex: 1; color: var(--brand); font-weight: 600; }
.chev { color: var(--faint); }
.people-list { display: grid; gap: 8px; }
.person {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); transition: border-color .15s, background .15s, box-shadow .15s;
  background: var(--surface); cursor: pointer; text-align: left;
}
.person:hover { border-color: var(--line-2); background: var(--surface-2); }
.person.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px rgba(42, 70, 184, .1); }
.p-text { flex: 1; display: grid; min-width: 0; }
.p-text small { color: var(--muted); font-size: 12px; }
.load { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.load-chip { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; background: var(--t-orange-bg); color: var(--t-orange); }
.load-chip.free { background: var(--t-green-bg); color: var(--t-green); }
.load-chip.busy { background: var(--t-red-bg); color: var(--t-red); }
.load.free { background: var(--ok); }
.load.busy { background: var(--danger); }
.pick { color: var(--brand); }
.photo-uploader { display: grid; gap: 12px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 560px) { .photo-grid { grid-template-columns: repeat(4, 1fr); } }
.photo-add {
  aspect-ratio: 1; border-radius: 14px; border: 1.5px dashed var(--line-2); transition: background .15s, border-color .15s; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; align-content: center; gap: 4px; cursor: pointer; font-weight: 600; font-size: 12px;
}
.photo-add .ms { font-size: 30px; }
.photo-add small { font-size: 11px; font-weight: 500; color: var(--muted); }
.photo-grid .photo-add:only-child { grid-column: 1 / -1; aspect-ratio: auto; min-height: 120px; }
.photo-grid .photo-add:not(:only-child) small { display: none; }
.photo-add.alt { background: var(--surface); border-color: var(--line); color: var(--text-2); }
.photo { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo.uploading img { opacity: .5; }
.photo .spin { position: absolute; left: 50%; top: 50%; margin: -9px 0 0 -9px; }
.doc-upload.over .doc-drop { border-color: var(--brand); background: var(--brand-soft); }
.doc-drop {
  width: 100%; display: grid; justify-items: center; gap: 4px; padding: 26px 16px; border-radius: 16px; border: 1.5px dashed var(--line-2);
  background: linear-gradient(180deg, var(--tint), var(--tint-2)); cursor: pointer; text-align: center; color: var(--text-2); transition: border-color .15s, background .15s, transform .1s;
}
.doc-drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.doc-drop:active { transform: scale(.99); }
.doc-drop > .ms:first-child { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--surface); box-shadow: 0 4px 12px rgba(42, 70, 184, .12); margin-bottom: 6px; }
.doc-drop .ms { font-size: 26px; color: var(--brand); }
.doc-drop small { color: var(--muted); font-size: 12px; }
.doc-state { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.doc-state > div { flex: 1; display: grid; min-width: 0; }
.doc-state b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-state small { color: var(--muted); font-size: 12px; }
.doc-state.done { border-color: rgba(31, 157, 85, .4); background: linear-gradient(180deg, var(--surface), var(--ok-tint)); }
.doc-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--t-red-bg); color: var(--t-red); flex-shrink: 0; }
.doc-ic.k-visit_sheet, .doc-ic.k-property_doc { background: var(--t-blue-bg); color: var(--t-blue); }
.doc-ic.k-final_report { background: var(--t-green-bg); color: var(--t-green); }
.doc-ic.k-bill { background: var(--t-yellow-bg); color: var(--t-yellow); }
.doc-ic.k-draft { background: var(--t-purple-bg); color: var(--t-purple); }
.file-big { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--card-line); background: var(--surface); box-shadow: var(--shadow); cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .2s; }
.file-big:hover { border-color: var(--line-2); box-shadow: 0 8px 22px rgba(22, 32, 90, .1); }
.file-big > div { flex: 1; display: grid; min-width: 0; }
.file-big small { color: var(--muted); font-size: 12px; }
.file-big > .ms { color: var(--brand); }
.file-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file-chips:empty { display: none; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 4px 4px 10px; border-radius: 999px; background: var(--brand-soft); font-size: 14px; }
.file-chip .ms { font-size: 18px; color: var(--brand); }
.alt-action { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px; border-radius: var(--r); border: 1.5px dashed var(--line); }
.alt-action p { color: var(--muted); font-size: 14px; }
.mini-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 14px; color: var(--text-2); }
.mini-facts span { display: inline-flex; align-items: center; gap: 6px; }
.mini-facts .ms { font-size: 18px; color: var(--muted); }
.gps { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); min-height: 52px; }
.gps > span:not(.ms):not(.spin) { flex: 1; display: grid; font-size: 14px; }
.gps small { color: var(--muted); }
.gps .btn { flex: none; white-space: nowrap; }
.review { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.review > div { display: grid; gap: 2px; padding: 14px; background: var(--surface); border-radius: 14px; border: 1px solid var(--card-line); box-shadow: var(--shadow); }
.review > div .ms { color: var(--brand); font-size: 20px; }
.review span { color: var(--muted); font-size: 12px; font-weight: 600; }
.review .full { grid-column: span 2; }
.review p { font-size: 14px; }
.amount-field { display: grid; gap: 6px; padding: 20px 22px; background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--card-line); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.amount-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(42, 70, 184, .1); }
.amount-field > span { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.amount-field > div { display: flex; align-items: center; gap: 8px; }
.amount-field b { font-size: 34px; color: var(--brand); font-weight: 600; }
.amount-field .amount-input { border: 0 !important; box-shadow: none !important; padding: 0 !important; font-size: 40px !important; font-weight: 700; min-height: 0 !important; background: transparent !important; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* Site visit screen */
.check-row { display: flex; flex-wrap: wrap; gap: 8px; }
.visit-meter { display: grid; gap: 10px; padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--card-line); box-shadow: var(--shadow); }
.vm-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.vm-top b { font-size: 16px; }
.vm-top small { color: var(--muted); font-size: 12px; }
.vm-track { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.vm-fill { display: block; height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, var(--brand), #4a66d6); transition: width .4s cubic-bezier(.2, .8, .2, 1); }
.visit-meter:has(.vm-fill[style*="100%"]) .vm-fill { background: linear-gradient(90deg, #1f9d55, #34c27a); }
.visit-meter .check-pill { box-shadow: none; border: 1px solid var(--line); }
.check-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-size: 14px; font-weight: 600; color: var(--muted); }
.check-pill .ms { font-size: 18px; }
.check-pill.done { color: var(--t-green); background: var(--t-green-bg); box-shadow: none; }
.visit-step { display: grid; gap: 14px; padding: 18px; background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--card-line); box-shadow: var(--shadow); }
.vs-head { display: flex; gap: 12px; align-items: flex-start; }
.vs-num { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(145deg, #182a86, var(--brand)); color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0; box-shadow: 0 4px 10px rgba(42, 70, 184, .25); }
.vs-num .ms { font-size: 18px; }
.vs-head h3 { font-size: 16px; }
.vs-head p { color: var(--muted); font-size: 14px; }
.visit-step .doc-drop { padding: 20px 16px; }
.media-box { display: grid; gap: 12px; }
.media-list { display: grid; gap: 8px; }
.media-list:empty { display: none; }
.media-item { display: grid; gap: 4px; }
.media-item audio { width: 100%; height: 44px; }
.media-item video { width: 100%; max-height: 260px; border-radius: var(--r-sm); background: #000; }
.media-item small { color: var(--muted); font-size: 12px; }
.media-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.recording { display: flex; align-items: center; gap: 10px; flex: 1; padding: 10px 14px; border-radius: var(--r-sm); background: var(--t-red-bg); color: var(--t-red); }
.recording small { color: var(--text-2); font-size: 14px; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }
.rec-time { font-variant-numeric: tabular-nums; font-size: 16px; }
.media-actions:has(.recording) { flex-wrap: nowrap; }
.sub-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.doc-groups { display: grid; gap: 16px; }
.doc-group-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.doc-group-head .ms { font-size: 16px; color: var(--brand); }
.doc-group-head .n { margin-left: auto; color: var(--muted); font-weight: 600; }

/* Success */
.success { display: grid; justify-items: center; text-align: center; gap: 12px; padding: 48px 16px 24px; }
.success-badge {
  position: relative; display: grid; place-items: center; width: 96px; height: 96px; border-radius: 50%; background: linear-gradient(145deg, #23b366, #178a4a); color: #fff;
  box-shadow: 0 12px 32px rgba(31, 157, 85, .35); animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); margin-bottom: 12px;
}
.success-badge .ms { font-size: 52px; font-variation-settings: "FILL" 1, "wght" 700; }
.success-badge .ring { position: absolute; inset: -10px; border-radius: 50%; border: 3px solid rgba(31, 157, 85, .35); animation: ring 1.2s ease-out .2s both; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
@keyframes ring { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
.success h2 { font-size: 26px; letter-spacing: -.02em; }
.success-badge::after { content: ""; position: absolute; inset: -26px; border-radius: 50%; z-index: -1; background: radial-gradient(circle, rgba(35, 179, 102, .18), transparent 70%); }
.success p { color: var(--muted); max-width: 340px; }
.ref-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; padding: 10px 16px; border-radius: 999px; border: 1.5px dashed var(--line-2);
  background: var(--brand-soft); color: var(--brand-ink); font: 600 16px "JetBrains Mono", ui-monospace, monospace; cursor: pointer;
}
.ref-chip .ms { font-size: 18px; color: var(--brand); }
.ref-chip.copied { border-style: solid; border-color: var(--ok); }
.success-actions { display: grid; gap: 8px; width: 100%; max-width: 360px; margin-top: 20px; }

/* ── Case page ──────────────────────────────────────────────────── */
.case-view { display: flex; flex-direction: column; gap: 16px; }
/* Phones: main + aside interleave in this order. Wide hosts: two columns (see container query below). */
.cv-main, .cv-aside { display: contents; }
.case-view .o1 { order: 1; } .case-view .o2 { order: 2; } .case-view .note { order: 3; } .case-view .o4 { order: 4; }
.case-view .o4b { order: 5; } .case-view .o4c { order: 5; } .case-view .o5 { order: 6; } .case-view .o6 { order: 7; } .case-view .o7 { order: 8; }
.case-view .o8 { order: 9; } .case-view .o9 { order: 10; } .case-view .o10 { order: 11; }
.page-body, .pane-body { container-type: inline-size; }
@container (min-width: 760px) {
  .case-view { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
  .cv-main, .cv-aside { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  .cv-aside { position: sticky; top: 0; }
  .case-view .quick-actions { grid-template-columns: none; grid-auto-columns: minmax(0, 150px); justify-content: start; }
}
.people-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.people-mini li { display: flex; align-items: center; gap: 10px; min-width: 0; }
.people-mini li > div { display: grid; min-width: 0; }
.people-mini small { color: var(--muted); font-size: 12px; }
.people-mini b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-mini li.unset b { color: var(--muted); font-weight: 500; }
.avatar.ghost { background: var(--surface-2) !important; color: var(--faint); border: 1.5px dashed var(--line); }
.avatar.ghost .ms { font-size: 16px; }
.case-hero { display: grid; gap: 14px; padding: 16px; background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--card-line); box-shadow: var(--shadow); }
.hero-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hero-wait { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; padding: 4px 10px; }
.hero-wait .ms { font-size: 14px; }

/* Stage track: five segments, done = brand, now = amber (orange when sent back, yellow on hold) */
.case-track { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.case-track li { display: grid; gap: 6px; min-width: 0; }
.ct-bar { height: 6px; border-radius: 6px; background: var(--line); position: relative; overflow: hidden; }
.case-track li.done .ct-bar { background: var(--brand); }
.case-track li.now .ct-bar { background: var(--brand-soft); }
.case-track li.now .ct-bar::after { content: ""; position: absolute; inset: 0; width: 60%; border-radius: 6px; background: var(--accent); animation: ct-fill 1.8s ease-in-out infinite alternate; }
.case-track li.now.warn .ct-bar::after { background: var(--t-orange); }
.case-track li.now.hold .ct-bar::after { background: #e0a800; animation: none; }
@keyframes ct-fill { from { width: 35%; } to { width: 75%; } }
.ct-label { display: flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--faint); white-space: nowrap; overflow: hidden; }
.ct-label .ms { font-size: 14px; }
.case-track li.done .ct-label { color: var(--brand); }
.case-track li.now .ct-label { color: var(--text); font-weight: 700; }
.case-track li.now .ct-label .ms { color: var(--accent); font-variation-settings: "FILL" 1; }
.case-track li.now.warn .ct-label .ms { color: var(--t-orange); }

.ch-info { display: grid; gap: 10px; }
.ch-row { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.ch-row > div { display: grid; min-width: 0; }
.ch-row small, .case-text small { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ch-row b { font-size: 15px; font-weight: 600; line-height: 1.4; }
.ch-branch { font-weight: 500; color: var(--text-2); }
.ch-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); flex-shrink: 0; }
.ch-ic .ms { font-size: 19px; }
.case-text { display: grid; gap: 4px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.case-text p { white-space: pre-wrap; font-size: 14px; color: var(--text-2); line-height: 1.55; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; gap: 8px; }
.qa {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 8px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s; white-space: nowrap; min-width: 0;
}
.qa .ms { font-size: 18px; color: var(--brand); }
.qa:hover { background: var(--brand-soft); border-color: var(--line-2); color: var(--brand); }
.qa:active { transform: scale(.97); }
.qa.off { opacity: .45; cursor: default; }
@media (max-width: 420px) { .qa { flex-direction: column; gap: 2px; min-height: 56px; font-size: 11px; } }

.next-card {
  position: relative; overflow: hidden; isolation: isolate; display: grid; gap: 8px; padding: 16px 18px; border-radius: var(--r-lg); color: #fff;
  background: radial-gradient(100% 120% at 100% 0%, rgba(74, 102, 214, .5), transparent 60%), linear-gradient(150deg, #0f1745, #1d2f95);
  box-shadow: 0 14px 30px -12px rgba(22, 32, 90, .55);
}
.next-card::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nc-top { display: flex; align-items: center; gap: 12px; }
.nc-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: rgba(245, 165, 36, .16); color: #ffc65c; border: 1px solid rgba(245, 165, 36, .3); }
.nc-top small { display: block; font-size: 11px; color: rgba(255, 255, 255, .6); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.nc-top b { font-size: 18px; letter-spacing: -.01em; }
.next-card p { color: rgba(255, 255, 255, .75); font-size: 14px; }
.with-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--card-line); box-shadow: var(--shadow); }
.with-card > div { flex: 1; display: grid; min-width: 0; }
.with-card small { color: var(--muted); font-size: 12px; font-weight: 600; }
.wc-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
.bt-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); }
.bt-ic .ms { font-size: 17px; }
.sub-label { display: flex; align-items: center; gap: 6px; }
section.block { background: var(--surface); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); border: 1px solid var(--card-line); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; min-width: 0; overflow: hidden; }
.block-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.block-title small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.sub-title { font-size: 14px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.block-action { padding-top: 4px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin: 0; }
.facts > div { min-width: 0; }
.facts .wide { grid-column: span 2; }
.facts dt { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.facts dd { margin: 3px 0 0; font-weight: 500; font-size: 15px; word-break: break-word; }
.facts > div { padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
@media (min-width: 900px) { .facts { grid-template-columns: repeat(3, 1fr); } .facts .wide { grid-column: span 3; } }
.remarks { padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 14px; color: var(--text-2); }
.photo-strip { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 2px 18px 6px; scroll-padding: 0 18px; scroll-snap-type: x proximity; min-width: 0; }
.photo-strip .thumb { scroll-snap-align: start; }
.photo-strip::-webkit-scrollbar { display: none; }
.thumb { flex: 0 0 120px; height: 120px; border: 0; padding: 0; border-radius: 14px; transition: transform .15s, box-shadow .2s; overflow: hidden; background: var(--line); cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(22, 32, 90, .18); }
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.doc-list li { display: flex; align-items: center; gap: 4px; }
.doc-open { flex: 1; display: flex; align-items: center; gap: 12px; padding: 8px; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; text-align: left; min-width: 0; }
.doc-open:hover { background: var(--surface-2); }
.doc-open > div { display: grid; min-width: 0; }
.doc-open b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-open small { color: var(--muted); font-size: 12px; }

.journey { list-style: none; margin: 0; padding: 0; display: grid; }
.journey li { position: relative; display: flex; gap: 12px; padding-bottom: 16px; }
.journey li:last-child { padding-bottom: 0; }
.journey li::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.journey li:last-child::before { display: none; }
.journey li.done::before { background: var(--brand); }
.j-dot {
  position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--surface); flex-shrink: 0; color: #fff;
}
.j-dot .ms { font-size: 16px; font-variation-settings: "FILL" 1, "wght" 700; }
.journey li.done .j-dot { background: var(--brand); border-color: var(--brand); }
.journey li.now .j-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px rgba(245, 165, 36, .18); color: #2b1a00; }
.journey li.now.warn .j-dot { background: var(--t-orange); border-color: var(--t-orange); box-shadow: 0 0 0 5px var(--t-orange-bg); }
.journey li.now.hold .j-dot { background: #e0a800; border-color: #e0a800; box-shadow: 0 0 0 5px var(--t-yellow-bg); }
.j-text { display: grid; padding-top: 3px; min-width: 0; }
.j-text b { font-size: 14px; font-weight: 600; }
.journey li:not(.done):not(.now) .j-text b { color: var(--muted); font-weight: 500; }
.j-text small { color: var(--muted); font-size: 12px; }
.journey li.now .j-text small { color: var(--text-2); font-weight: 500; }
.activity-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.activity-list li { position: relative; display: flex; gap: 12px; }
.activity-list li:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 36px; bottom: -12px; width: 2px; background: var(--line); }
.activity-list li > div { display: grid; gap: 2px; min-width: 0; font-size: 14px; }
.activity-list q { quotes: none; font-size: 14px; color: var(--text-2); background: var(--surface-2); border-radius: 10px; padding: 6px 10px; justify-self: start; }
.activity-list small { color: var(--muted); font-size: 12px; }
.menu-list { display: grid; gap: 2px; margin: 0 -8px; }
.menu-row { display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 0 10px; border: 0; background: none; border-radius: 14px; cursor: pointer; text-align: left; font-size: 15px; font-weight: 600; transition: background .12s; }
.mr-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--brand-soft); }
.mr-label { flex: 1; min-width: 0; }
.menu-row .chev { opacity: 0; transition: opacity .15s, transform .15s; }
.menu-row:hover .chev { opacity: 1; transform: translateX(2px); }
.menu-row.warn .mr-ic { background: var(--t-orange-bg); }
.menu-row.warn .mr-ic .ms { color: var(--t-orange); }
.menu-row:hover { background: var(--surface-2); }
.menu-row .mr-ic .ms { color: var(--brand); font-size: 20px; }
.cta { box-shadow: 0 8px 20px rgba(42, 70, 184, .3); }
.error-box { padding: 16px; border-radius: var(--r-sm); background: var(--t-red-bg); color: var(--t-red); }

/* ── Admin ──────────────────────────────────────────────────────── */
.dash { display: grid; gap: 16px; }
.dash-head { display: grid; gap: 12px; }
.dash-head .chip-row { margin-top: 2px; }
.dash .stat-row.four .stat { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; }
.dash .stat-row.four .stat b { font-size: 20px; }
.dash .stat-row.four .stat small { order: 2; grid-column: 2; margin-top: -4px; white-space: normal; line-height: 1.3; }
.dash .stat-row.four .stat .stat-ic { grid-row: span 2; }
@media (min-width: 900px) {
  .dash-head { display: flex; align-items: flex-end; justify-content: space-between; }
  .dash-head .hello { font-size: 28px; }
  .dash-home .dash-head { display: flex !important; }
  .dash .hero { padding: 24px 28px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); column-gap: 32px; }
  .dash .hero > :not(.hero-flow):not(.hero-deco) { grid-column: 1; }
  .dash .hero-flow { grid-column: 2; grid-row: 1 / span 3; margin: 0; padding: 0 0 0 32px; border-top: 0; border-left: 1px solid rgba(255, 255, 255, .1); align-self: center; }
  .dash .hero-num b { font-size: 64px; }
  .dash .hero-deco { right: auto; left: 34%; top: -50px; opacity: .1; }
}
.dash-grid { display: grid; gap: 16px; }
@media (min-width: 1000px) { .dash-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.pipeline { display: grid; gap: 4px; }
.pipe-row { display: grid; grid-template-columns: 120px 1fr 32px; align-items: center; gap: 12px; padding: 8px; border: 0; background: none; border-radius: 10px; cursor: pointer; font-size: 14px; text-align: left; }
.pipe-row:hover { background: var(--surface-2); }
.pipe-bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.pipe-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--tone); min-width: 4px; transition: width .5s; }
.pipe-row b { text-align: right; font-variant-numeric: tabular-nums; }
.tat { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tat > div { display: grid; padding: 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.tat small { color: var(--muted); font-size: 12px; }
.tat b { font-size: 16px; }
.link-list { list-style: none; margin: 0 -8px; padding: 0; display: grid; }
.link-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 8px; border: 0; background: none; border-radius: 12px; cursor: pointer; text-align: left; }
.link-list button:hover { background: var(--surface-2); }
.link-list button > div { flex: 1; display: grid; min-width: 0; }
.link-list b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-list small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-list { display: grid; gap: 4px; }
.team-row { display: grid; grid-template-columns: auto minmax(0, 1.4fr) 1fr auto auto; align-items: center; gap: 12px; padding: 8px 0; }
.team-row + .team-row { border-top: 1px solid var(--line); }
.tr-name { display: grid; min-width: 0; }
.tr-name b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-name small, .tr-num small { color: var(--muted); font-size: 12px; }
.tr-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.tr-bar span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.tr-num { display: grid; justify-items: end; min-width: 52px; }
.tr-num b { font-variant-numeric: tabular-nums; }
.tr-num b.warn { color: var(--t-red); }
@media (max-width: 560px) { .tr-bar { display: none; } .team-row { grid-template-columns: auto minmax(0, 1fr) auto auto; } }
.user-list { display: grid; gap: 8px; }
.team-tools { display: grid; gap: 10px; }
.team-grid { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.person-card {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "av name chev" "av meta chev"; align-items: center; column-gap: 14px; row-gap: 2px;
  padding: 14px 14px 14px 16px; border-radius: 18px; border: 1px solid var(--card-line); background: var(--surface); box-shadow: var(--shadow); cursor: pointer; text-align: left;
  transition: transform .15s, box-shadow .2s, border-color .2s; min-width: 0;
}
.person-card:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(24, 36, 99, .05), 0 14px 32px rgba(24, 36, 99, .1); border-color: var(--line-2); }
.person-card.inactive { opacity: .6; }
.pc-top { grid-area: av; position: relative; }
.pc-top .avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.pc-top .pill, .pc-load { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); white-space: nowrap; font-size: 10px; padding: 2px 7px; box-shadow: 0 0 0 2px var(--surface); }
.pc-top .pill .ms { display: none; }
.pc-load { border-radius: 99px; font-weight: 700; background: var(--t-blue-bg); color: var(--t-blue); }
.pc-load.busy { background: var(--t-red-bg); color: var(--t-red); }
.pc-name { grid-area: name; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
.pc-name b { font-size: 16px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-role { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--brand); background: var(--brand-soft); padding: 2px 8px 2px 6px; border-radius: 99px; white-space: nowrap; }
.pc-role .ms { font-size: 14px; }
.pc-meta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); font-size: 12px; min-width: 0; }
.pc-meta span { display: inline-flex; align-items: center; gap: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-meta .ms { font-size: 14px; }
.person-card > .chev { grid-area: chev; }
@media (min-width: 900px) {
  .team-tools .search-box { max-width: 440px; }
  .team-tools .search-box input.search { min-height: 42px; border-radius: 12px; box-shadow: none; border: 1px solid var(--line); }
  .team .page-top { justify-content: space-between !important; }
  .team .page-top h1 { display: none; }
  .team-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
  .person-card { grid-template-columns: minmax(0, 1fr); grid-template-areas: "av" "name" "meta"; justify-items: start; row-gap: 8px; padding: 20px; }
  .person-card > .chev { position: absolute; top: 18px; right: 16px; }
  .pc-top .avatar.lg { width: 60px; height: 60px; font-size: 20px; }
  .pc-top { margin-bottom: 8px; }
  .pc-name { flex-direction: column; align-items: flex-start; gap: 6px; }
  .pc-meta { flex-direction: column; gap: 4px; }
}
.u-text small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch-row > div { flex: 1; display: grid; }
.switch-row small { color: var(--muted); font-size: 12px; }
.switch-row input { width: 48px; height: 28px; accent-color: var(--brand); }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.add-row input { flex: 1 1 180px; }
.plain-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); }
.plain-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 4px 16px; min-height: 52px; }
.plain-list li + li { border-top: 1px solid var(--line); }

/* ── Me ─────────────────────────────────────────────────────────── */
.me { display: grid; gap: 16px; max-width: 560px; margin: 0 auto; }
.me-card { position: relative; overflow: hidden; background: var(--surface); border-radius: 24px; border: 1px solid var(--card-line); box-shadow: var(--shadow); }
.me-banner { position: relative; height: 104px; overflow: hidden; isolation: isolate;
  background: radial-gradient(120% 120% at 100% 0%, rgba(74, 102, 214, .6), transparent 60%), radial-gradient(70% 90% at 0% 100%, rgba(245, 165, 36, .18), transparent 60%), linear-gradient(150deg, #0f1745, #1d2f95); }
.me-banner .hero-deco { right: 10px; top: -40px; width: 180px; height: 180px; opacity: .14; }
.me-body { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 0 20px 20px; margin-top: -52px; position: relative; }
.me-body .photo-edit .avatar { box-shadow: 0 0 0 5px var(--surface), 0 10px 24px rgba(22, 32, 90, .25); }
.me-card h2 { margin-top: 10px; font-size: 22px; letter-spacing: -.02em; }
.me-role { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 10px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: 13px; }
.me-role .ms { font-size: 17px; }
.me-user { color: var(--muted); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; }
.me-body .link.sm { font-size: 13px; }
.me-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.me-stats div { display: grid; gap: 2px; padding: 0 6px; }
.me-stats div + div { border-left: 1px solid var(--line); }
.me-stats b { font-size: 18px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.me-stats small { color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.3; }
.me-settings { display: grid; gap: 16px; align-content: start; }
.set-block { display: grid; gap: 8px; }
.set-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 0 6px; }
.set-group { background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--card-line); box-shadow: var(--shadow); overflow: hidden; }
.set-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 10px 16px; border: 0; background: none; text-align: left; cursor: pointer; transition: background .15s; }
div.set-row { cursor: default; }
.set-row + .set-row { border-top: 1px solid var(--line); }
button.set-row:hover { background: var(--surface-2); }
button.set-row:hover .chev { transform: translateX(2px); color: var(--brand); }
.set-row .chev { transition: transform .2s, color .2s; }
.set-row > div { flex: 1; display: grid; min-width: 0; }
.set-row b { font-weight: 600; }
.set-row small { color: var(--muted); font-size: 12px; }
.set-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.set-ic[class*="tone-"] { background: var(--tone-bg); color: var(--tone); }
.set-row.danger { color: var(--danger); }
.set-row.danger .set-ic { background: var(--t-red-bg); color: var(--danger); }
@media (min-width: 900px) {
  .me { max-width: 980px; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; margin: 0; }
  .me-card { position: sticky; top: calc(var(--top-h, 0px) + 24px); }
}
.version { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 600; padding: 4px 0 8px; }
.how { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.how li { display: flex; gap: 12px; align-items: flex-start; }
.how li > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; flex-shrink: 0; }
.how p { padding-top: 5px; }
.how p .ms { font-size: 18px; color: var(--brand); }

/* ── Update banner ──────────────────────────────────────────────── */
.update-bar {
  position: fixed; z-index: 95; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 12px + var(--safe-b));
  display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 12px; border-radius: var(--r);
  background: var(--grad-ink); color: #fff; box-shadow: var(--shadow-lg); animation: up .3s cubic-bezier(.2, .8, .2, 1);
  max-width: 480px; margin: 0 auto;
}
.ub-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .12); color: var(--accent); flex-shrink: 0; }
.ub-text { flex: 1; display: grid; min-width: 0; }
.ub-text b { font-size: 14px; }
.ub-text small { font-size: 12px; opacity: .75; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.update-bar .btn { background: var(--pop-bg); color: var(--pop-ink); box-shadow: none; }
.update-bar .icon-btn { color: rgba(255, 255, 255, .7); }
.update-bar .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
body:not(:has(.bottom-nav)) .update-bar { bottom: calc(16px + var(--safe-b)); }
@media (min-width: 900px) { .update-bar { left: auto; right: 24px; bottom: 24px; margin: 0; width: 420px; } }

/* ── Toasts / pull to refresh ───────────────────────────────────── */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + var(--safe-b)); z-index: 90; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
body.no-scroll #toasts { bottom: calc(96px + var(--safe-b)); }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; border-radius: 16px; background: rgba(17, 22, 52, .94); backdrop-filter: blur(10px); color: #fff; box-shadow: 0 16px 40px rgba(12, 18, 48, .35); font-size: 14px; font-weight: 500; animation: toast-in .35s cubic-bezier(.2, .9, .25, 1.2); pointer-events: auto; border: 1px solid rgba(255, 255, 255, .08); }
@keyframes toast-in { from { transform: translateY(16px) scale(.96); opacity: 0; } }
.toast-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(52, 211, 153, .18); flex-shrink: 0; }
.toast-ic .ms { font-size: 18px; font-variation-settings: "wght" 700; }
.toast .ms { color: #6be3a0; }
.toast.error { background: rgba(122, 22, 38, .96); }
.toast.error .toast-ic { background: rgba(255, 184, 193, .2); }
.toast.error .ms { color: #ffb8c1; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .3s; }
@media (min-width: 900px) { #toasts { bottom: 24px; } }
.ptr {
  position: fixed; left: 50%; top: 0; z-index: 70; width: 40px; height: 40px; border-radius: 50%; background: var(--surface);
  box-shadow: var(--shadow); display: grid; place-items: center; color: var(--muted); transform: translate(-50%, -60px); pointer-events: none;
}
.ptr.ready { color: var(--brand); }
.ptr.spinning .ms { animation: spin .7s linear infinite; }

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

/* ═══════════════════════════════════════════════════════════════════
   Desktop (≥ 900px): top bar, palette, bell, split view, board, home
   ═══════════════════════════════════════════════════════════════════ */
kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px;
  border: 1px solid var(--line); border-bottom-width: 2px; background: var(--surface); color: var(--muted);
  font: 600 11px/1 Inter, system-ui, sans-serif;
}
.topbar-slot:empty { display: none; }
@media (min-width: 900px) {
  body.has-topbar { --top-h: 64px; }
  .topbar-slot { position: sticky; top: 0; z-index: 25; margin-left: var(--side-w); }
  .topbar {
    display: flex; align-items: center; gap: 16px; height: var(--top-h); padding: 0 32px;
    background: var(--frost-bg); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .tb-title { min-width: 140px; }
  .tb-title h1 { font-size: 20px; }
  .tb-search {
    flex: 1; max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 8px 0 14px;
    border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: text; font-size: 14px;
    box-shadow: 0 1px 2px rgba(24, 36, 99, .04); transition: border-color .15s, box-shadow .15s;
  }
  .tb-search:hover { border-color: var(--line-2); box-shadow: 0 2px 10px rgba(24, 36, 99, .06); }
  .tb-search > span:not(.ms) { flex: 1; text-align: left; }
  .tb-actions { display: flex; align-items: center; gap: 8px; }
  .tb-actions .btn { min-height: 40px; }
  .tb-actions .btn kbd.on-btn { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .25); color: #fff; margin-left: 4px; }
  .has-topbar .push-banner { margin-top: 16px; }
  .has-topbar .content { padding-top: 24px; }
  .has-topbar .side-nav .nav-new { display: none; }
  .has-topbar .page-top h1 { display: none; }
  .has-topbar .page-top { justify-content: flex-end; padding: 0; }
  .has-topbar .home-head { display: none; }
  .content { max-width: 1440px; }
  .has-topbar .content { margin-left: var(--side-w); margin-right: 0; max-width: none; padding-left: 32px; padding-right: 32px; }
}

/* Bell */
.bell { position: relative; }
.tb-icon { position: relative; border: 1px solid var(--line); background: var(--surface); width: 42px; height: 42px; }
.bell-dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.bell-pop {
  position: absolute; right: 0; top: calc(100% + 10px); width: 380px; max-height: 70vh; overflow: auto; z-index: 40;
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-lg); border: 1px solid var(--line); padding: 8px;
  animation: up .18s ease;
}
.bell-head { display: grid; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.bell-head small { color: var(--muted); font-size: 12px; }
.bell-list { list-style: none; margin: 0; padding: 0; }
.bell-list button { display: flex; gap: 10px; width: 100%; padding: 10px; border: 0; background: none; border-radius: 10px; text-align: left; cursor: pointer; }
.bell-list button:hover { background: var(--surface-2); }
.bell-list button.new { background: var(--brand-soft); }
.bell-list button > div { display: grid; min-width: 0; font-size: 14px; }
.bell-list small { color: var(--muted); font-size: 12px; }
.bell-empty { padding: 24px; text-align: center; color: var(--muted); }

/* Command palette */
.pal-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(15, 20, 45, .4); display: grid; justify-items: center; align-items: start; padding-top: 12vh; animation: fade .12s ease; }
.palette { width: min(640px, 92vw); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; animation: up .16s ease; }
.pal-head { display: flex; align-items: center; gap: 10px; padding: 6px 14px; border-bottom: 1px solid var(--line); }
.pal-head > .ms { color: var(--muted); }
.palette input.pal-input { border: 0 !important; box-shadow: none !important; padding: 12px 0; font-size: 17px; min-height: 56px; }
.pal-results { max-height: 52vh; overflow: auto; padding: 6px; }
.pal-group { padding: 10px 10px 4px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pal-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; background: none; border-radius: 10px; text-align: left; cursor: pointer; }
.pal-row.on { background: var(--brand-soft); }
.pal-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--tone-bg); color: var(--tone); flex-shrink: 0; }
.pal-ic .ms { font-size: 18px; }
.pal-text { flex: 1; display: grid; min-width: 0; }
.pal-text b { font-weight: 600; font-size: 14px; }
.pal-text small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-tag { font-size: 12px; font-weight: 700; color: var(--brand); background: var(--surface); border: 1px solid var(--line-2); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pal-empty { padding: 32px; text-align: center; color: var(--muted); }
.pal-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 12px; color: var(--muted); }
.pal-foot kbd { margin-right: 2px; }

/* Desktop cases */
.cases-desk { display: grid; gap: 14px; }
.dk-toolbar { display: flex; align-items: center; gap: 12px; }
.dk-toolbar .search-box { flex: 1; max-width: 440px; }
.dk-toolbar .search-box input.search { min-height: 42px; border-radius: 12px; box-shadow: none; border: 1px solid var(--line); background: var(--surface); }
.dk-count { font-size: 13px; font-weight: 600; color: var(--muted); }
.segmented.mode { margin-left: auto; width: auto; background: var(--surface); border: 1px solid var(--line); }
.segmented.mode button { padding: 0 14px; min-height: 34px; }
.cases-desk .chip-row.tabs-bar, .team .chip-row.tabs-bar { margin: 0; padding: 4px; flex-wrap: nowrap; overflow-x: auto; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; scrollbar-width: none; }
.cases-desk .tabs-bar .chip, .team .tabs-bar .chip { min-height: 34px; padding: 0 12px; font-size: 13px; border: 0; border-radius: 10px; background: none; box-shadow: none; }
.cases-desk .tabs-bar .chip:hover:not(.on), .team .tabs-bar .chip:hover:not(.on) { background: var(--surface-2); }
.cases-desk .tabs-bar .chip.on, .team .tabs-bar .chip.on { background: var(--brand-soft); color: var(--brand); }
.cases-desk .tabs-bar .chip.on .n, .team .tabs-bar .chip.on .n { background: var(--brand); color: #fff; }
.dk-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.dk-split.has-sel { grid-template-columns: minmax(340px, 40%) minmax(0, 1fr); }
.dk-table-wrap { max-height: calc(100vh - var(--top-h, 0px) - 200px); overflow: auto; border: 1px solid var(--card-line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.dk-table thead th { border-bottom: 1px solid var(--line); }
.dk-table .th-sort { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 12px 16px; }
.dk-table tbody tr { position: relative; }
.dk-table tbody tr.needs td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.dk-table td.nowrap { white-space: nowrap; }
@media (max-width: 1360px) { .dk-table .c-updated { display: none; } }
.dk-table td.nowrap > span { display: block; font-weight: 500; }
.dk-table .case-ic { width: 34px; height: 34px; border-radius: 11px; }
.dk-table .case-ic .ms { font-size: 18px; }
.dk-foot { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; font-size: 12px; color: var(--muted);
  background: var(--frost); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.dk-keys { display: inline-flex; align-items: center; gap: 4px; }
.dk-keys kbd:nth-of-type(3) { margin-left: 10px; }
.dk-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); padding: 0; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; width: 100%; padding: 12px 16px; border: 0; background: none; cursor: pointer; font: inherit; color: inherit; text-align: left; white-space: nowrap; }
.th-sort:hover { color: var(--text); }
.th-sort .ms { font-size: 15px; color: var(--brand); }
.dk-table td { padding: 11px 16px; }
.dk-table tbody tr.sel { background: var(--brand-soft); }
.dk-table tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.dk-table tbody tr.sel:hover { background: var(--brand-soft); }
.dk-table td.num { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.dk-table td.muted { white-space: nowrap; font-size: 13px; }
.cc-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cc-cell > div { display: grid; min-width: 0; }
.cc-cell b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); flex-shrink: 0; }
.act-chip { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.act-chip .ms { font-size: 15px; }
.cc-cell .act-chip { margin-left: auto; }
.dk-split.has-sel .dk-table .wide, .dk-split.has-sel .dk-table th:nth-child(n+6), .dk-split.has-sel .dk-table td:nth-child(n+6) { display: none; }
.dk-split.has-sel .cc-cell .act-chip { display: none; }
.dk-detail {
  position: sticky; top: calc(var(--top-h, 0px) + 16px); display: flex; flex-direction: column; min-width: 0;
  height: calc(100vh - var(--top-h, 0px) - 40px); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow); animation: slide .22s cubic-bezier(.2, .8, .2, 1);
}
.pane-head { display: flex; align-items: center; gap: 4px; padding: 12px 12px 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.pane-title { flex: 1; min-width: 0; }
.pane-title h2 { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-title p { font: 12px "JetBrains Mono", ui-monospace, monospace; color: var(--muted); }
.pane-body { flex: 1; overflow: auto; padding: 20px; display: grid; gap: 16px; align-content: start; overscroll-behavior: contain; }
.pane-foot { padding: 12px 20px; background: var(--surface); border-top: 1px solid var(--line); }
.pane-foot .btn { max-width: 420px; margin-left: auto; display: flex; }

/* Board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.lane { display: flex; flex-direction: column; max-height: calc(100vh - var(--top-h, 0px) - 160px); background: var(--lane-bg); border-radius: var(--r); min-width: 0; }
.lane-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-size: 14px; }
.lane-head .ms { font-size: 18px; color: var(--muted); }
.lane-head .n { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface); border-radius: 999px; padding: 1px 8px; }
.lane-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 0 10px 10px; overflow-y: auto; overflow-x: hidden; }
.lane-empty { text-align: center; color: var(--faint); font-size: 13px; padding: 16px 0; }
.bcard { display: grid; gap: 6px; text-align: left; padding: 12px; border-radius: 12px; border: 1px solid transparent; background: var(--surface); box-shadow: 0 1px 2px rgba(24, 36, 99, .06); cursor: pointer; min-width: 0; transition: box-shadow .15s, transform .1s; }
.bcard:hover { box-shadow: 0 6px 18px rgba(24, 36, 99, .1); transform: translateY(-1px); }
.bcard.hold { border-color: var(--hold-line); }
.bc-top { display: flex; align-items: center; gap: 8px; }
.bc-top b { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard > small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.bc-foot .ref { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bc-foot .act-chip, .bc-foot .pill { margin-left: auto; }

/* Desktop home */
.home-desk { display: grid; gap: 20px; }
.hd-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.hd-head .hello { font-size: 28px; }
.hd-top { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; }
.home-desk .hero { padding: 24px 28px; align-content: start; }
.home-desk .hero-num b { font-size: 64px; }
.home-desk .hero-flow { margin-top: auto; padding-top: 18px; }
.home-desk .hero { grid-template-rows: auto auto auto 1fr; }
.home-desk .flow-strip { max-width: 520px; }
.home-desk .hero-deco { width: 260px; height: 260px; right: -20px; top: -40px; }
.hd-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-content: stretch; }
.hd-stats.n2 { grid-template-columns: 1fr; }
.hd-stats .stat { padding: 18px; }
.hd-stats .stat b { font-size: 28px; }
.hd-stats .stat small { white-space: normal; line-height: 1.3; }
.hd-stats:not(.n2) .stat:nth-child(odd):last-child { grid-column: span 2; }
.hd-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.hd-side { display: grid; gap: 20px; }
.panel-card { background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--card-line); box-shadow: var(--shadow); padding: 8px; min-width: 0; }
.pc-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.pc-head h2 { font-size: 16px; letter-spacing: -.01em; }
.pc-sub { margin-left: auto; color: var(--muted); font-size: 12px; }
.pc-head .link { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; }
.pc-head .link .ms { font-size: 16px; }
.link.more { display: block; width: 100%; text-align: center; padding: 10px; }
.pad { padding: 16px 12px; }
.task-list { list-style: none; margin: 0; padding: 0; }
.task { display: grid; grid-template-columns: auto minmax(0, 1.4fr) minmax(0, 1fr) auto; align-items: center; gap: 14px; width: 100%; padding: 12px; border: 0; background: none; border-radius: 14px; text-align: left; cursor: pointer; transition: background .12s; }
.task-list li + li { border-top: 1px solid var(--line); }
.task:hover { background: var(--surface-2); }
.task:hover .act-chip { background: var(--brand); color: #fff; }
.t-main, .t-status { display: grid; gap: 2px; min-width: 0; }
.t-main b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-main small, .t-status small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-status .pill { justify-self: start; }
.t-meta { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.act-chip { transition: background .15s, color .15s; }
.feed { list-style: none; margin: 0; padding: 0 4px 4px; }
.feed button { display: flex; gap: 10px; width: 100%; padding: 10px 8px; border: 0; background: none; border-radius: 10px; text-align: left; cursor: pointer; }
.feed button:hover { background: var(--surface-2); }
.feed button > div { display: grid; min-width: 0; font-size: 14px; }
.feed small { color: var(--muted); font-size: 12px; }
.kbd-hint { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 0 8px; font-size: 12px; color: var(--muted); }
.kbd-hint kbd:not(:first-child) { margin-left: 8px; }
.kbd-hint kbd + kbd { margin-left: 0; }
.kbd-list { list-style: none; margin: 0; padding: 4px 12px 10px; display: grid; gap: 10px; font-size: 14px; color: var(--text-2); }
.kbd-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Last 7 days chart */
.week { padding: 4px 12px 12px; display: grid; gap: 14px; }
.week-sum { display: flex; gap: 24px; }
.week-sum div { display: grid; }
.week-sum b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.week-sum small { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.key { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.key.made, .wk .made { background: var(--bar-soft); }
.key.done, .wk .done { background: var(--brand); }
.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 120px; }
.wk { display: grid; grid-template-rows: 1fr auto; gap: 6px; justify-items: center; }
.wk-pair { display: flex; align-items: flex-end; gap: 3px; height: 100%; }
.wk-pair span { width: 10px; height: max(3px, var(--h)); border-radius: 4px 4px 2px 2px; transform-origin: bottom; animation: grow .6s var(--d) cubic-bezier(.2, .8, .2, 1) both; }
.wk small { font-size: 11px; font-weight: 600; color: var(--muted); }
.wk.today small { color: var(--brand); }
@keyframes grow { from { transform: scaleY(0); } to { transform: none; } }

/* Desktop polish for shared screens */
@media (min-width: 900px) {
  .page { width: min(820px, 100%); }
  .case-card { box-shadow: none; border: 1px solid var(--line); }
  .case-card:hover { box-shadow: 0 8px 24px rgba(24, 36, 99, .08); }
  .case-hero, .with-card { box-shadow: none; border: 1px solid var(--line); }
  .stat { box-shadow: none; border: 1px solid var(--line); }
  button.stat:hover { border-color: var(--line-2); box-shadow: 0 6px 18px rgba(24, 36, 99, .07); }
  .user-row, .set-group, .plain-list, .card-group, .table-wrap { box-shadow: none; border: 1px solid var(--line); }
  .home .hero, .home-desk .hero { min-height: 100%; }
}
@media (min-width: 1280px) { .page.case-page { width: min(1040px, 92vw); } }
@media (min-width: 900px) and (max-width: 1180px) {
  .hd-top, .hd-grid { grid-template-columns: minmax(0, 1fr); }
  .dk-split.has-sel { grid-template-columns: minmax(300px, 44%) minmax(0, 1fr); }
}

/* Profile photos */
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.has-img { background: var(--surface-2) !important; }
.photo-edit { position: relative; display: inline-grid; }
.photo-edit .cam {
  position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff; border: 3px solid var(--surface); cursor: pointer; box-shadow: var(--shadow);
}
.photo-edit .cam .ms { font-size: 16px; }
.photo-edit .cam.loading .ms { animation: spin .8s linear infinite; }
.photo-edit .cam.loading .ms::before { content: ''; }
.photo-row { display: flex; align-items: center; gap: 16px; }
.photo-row .btn-row { gap: 6px; }

/* Bill & payment */
section.block .note { order: 0; }
.bill-card, .pay-card { display: grid; gap: 6px; padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.bc-amt { display: grid; }
.bc-amt small { font-size: 12px; color: var(--muted); font-weight: 600; }
.bc-amt b { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.bc-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--text-2); }
.bill-card .btn { justify-self: start; padding-left: 0; }
.pay-card.ok { background: var(--t-green-bg); border-color: var(--ok-line); }
.pay-card.bad { background: var(--t-red-bg); border-color: var(--danger-line); }
.pay-card .match { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; }
.pay-card.ok .match { color: var(--t-green); }
.pay-card.bad .match { color: var(--t-red); }
.verify-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .verify-grid { grid-template-columns: 1fr; } }
.proof-img { display: block; width: 100%; max-height: 420px; padding: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.proof-img img { width: 100%; max-height: 420px; object-fit: contain; display: block; }
.warn-line { color: var(--t-orange); font-weight: 600; }
.warn-line .ms { color: var(--t-orange); }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* Documents */
.docs { display: grid; gap: 16px; }
.docs-updated { margin-top: -4px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.docs-updated .ms { font-size: 16px; margin-right: 4px; vertical-align: -3px; }
.docs-updated b { color: var(--text-2); font-weight: 600; }
.dg { display: grid; gap: 8px; }
.dg-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.dg-head .ms { font-size: 16px; color: var(--brand); }
.dg-card { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.doc-row + .doc-row { border-top: 1px solid var(--line); }
.doc-line { display: flex; align-items: center; gap: 4px; padding-right: 6px; }
.doc-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px; border: 0; background: none; text-align: left; cursor: pointer; }
.doc-main:hover { background: var(--surface-2); }
.doc-main .doc-ic { width: 40px; height: 40px; border-radius: 10px; }
.doc-main .doc-ic .ms { font-size: 20px; }
.doc-text { display: grid; gap: 1px; min-width: 0; }
.doc-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.doc-title b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-file { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-actions { display: flex; align-items: center; flex-shrink: 0; }
.doc-actions .icon-btn { color: var(--faint); }
.v-chip { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; padding: 1px 8px; border-radius: 999px; background: var(--t-grey-bg); color: var(--t-grey); font-size: 11px; font-weight: 700; white-space: nowrap; }
.v-chip.latest { background: var(--t-green-bg); color: var(--t-green); padding-left: 5px; }
.v-chip .ms { font-size: 13px; }
.older-toggle { display: inline-flex; align-items: center; gap: 4px; margin: -4px 0 10px 64px; padding: 3px 10px 3px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.older-toggle:hover { color: var(--text); border-color: var(--line-2); }
.older-toggle .ms { font-size: 15px; }
.older-toggle .chev-i { transition: transform .2s; }
.older-toggle.open .chev-i { transform: rotate(180deg); }
.doc-older { list-style: none; margin: 0 12px 10px 64px; padding: 0; border-left: 2px solid var(--line); }
.doc-older button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; background: none; text-align: left; cursor: pointer; font-size: 12px; color: var(--muted); border-radius: 0 8px 8px 0; min-width: 0; }
.doc-older button:hover { background: var(--surface-2); color: var(--text-2); }
.doc-older .o-name { color: var(--text-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.doc-older .o-meta { white-space: nowrap; }
.doc-older .ms { font-size: 14px; opacity: .6; }
@media (max-width: 480px) { .doc-older .o-meta { display: none; } .older-toggle, .doc-older { margin-left: 12px; } }

/* Searchable picker */
.pick-list { display: grid; gap: 2px; max-height: 52vh; overflow: auto; margin: 0 -8px; padding: 2px 0; }
.pick-search { position: sticky; top: 0; z-index: 1; }
.pick-search input { background: var(--surface-2) !important; padding-left: 44px !important; }
.pick-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px; border: 0; background: none; border-radius: 12px; text-align: left; cursor: pointer; font-size: 15px; transition: background .12s; }
.pick-row:hover { background: var(--surface-2); }
.pick-row.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.pr-badge { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 11px; font-weight: 700; letter-spacing: .02em; flex-shrink: 0; }
.pick-row.on .pr-badge { background: var(--brand); border-color: var(--brand); color: #fff; }
.pr-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-check { color: var(--brand); font-variation-settings: "FILL" 1; }
.pick-empty { padding: 12px; color: var(--muted); font-size: 14px; text-align: center; }
.pick-row.other { justify-content: flex-start; color: var(--brand); font-weight: 600; border: 1px dashed var(--line-2); margin: 8px 8px 4px; background: var(--tint); }
.pick-row.other .ms { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); }
@media (min-width: 720px) { .sheet.picker { max-width: 520px; } }
.picker-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 0 14px; border-radius: 13px; border: 1px solid var(--line-2); background: var(--input-bg); cursor: pointer; text-align: left; font-size: 16px; box-shadow: 0 1px 2px rgba(22, 32, 90, .04); transition: border-color .15s, box-shadow .15s; }
.picker-btn:hover { border-color: var(--line-2); }
.picker-btn:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(42, 70, 184, .12); outline: none; }
.picker-btn .ph { color: var(--faint); flex: 1; }
.picker-btn .val { flex: 1; font-weight: 600; }
.picker-btn .ms { color: var(--muted); }
.picker-btn.invalid { border-color: var(--danger); }

/* Report details + short form */
.segmented.locked { pointer-events: none; opacity: .6; }
.doc-drop.compact { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 16px; }
.doc-drop.compact .ms { font-size: 22px; }
.doc-drop.compact > .ms:first-child { width: auto; height: auto; background: none; box-shadow: none; margin: 0; border-radius: 0; }
.report-form { border: 1.5px solid var(--line-2) !important; }
.rf-head { display: flex; align-items: center; gap: 12px; }
.rf-head > div { display: grid; }
.rf-head small { color: var(--muted); font-size: 12px; }
.rf-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.rf-actions { display: flex; justify-content: flex-end; }
.mv-words { color: var(--t-green); font-weight: 700; font-size: 13px; }
.case-text { white-space: pre-wrap; font-size: 15px; line-height: 1.5; color: var(--text); background: var(--surface-2); border-radius: var(--r-sm); padding: 12px 14px; }
.fmt-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; background: var(--text); color: var(--surface); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.case-text-plain { white-space: pre-wrap; }
.ok-text { color: var(--t-green) !important; font-weight: 600; }

/* ── Appearance (theme) ─────────────────────────────────────────── */
.theme-row { flex-wrap: wrap; }
.set-row > .theme-pick { flex: none; display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--seg-bg); border: 1px solid var(--line); }
.theme-pick button { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 10px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s; }
.theme-pick button .ms { font-size: 16px; }
.theme-pick button.on { background: var(--surface); color: var(--brand); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 2px 8px rgba(22, 32, 90, .08); }
@media (max-width: 420px) { .theme-pick { width: 100%; margin-left: 52px; } .theme-pick button { flex: 1; justify-content: center; } }
.theme-fade, .theme-fade *, .theme-fade *::before, .theme-fade *::after { transition: background-color .35s ease, border-color .35s ease, color .35s ease, fill .35s ease !important; }

/* Dark-mode touches that tokens alone don't cover */
[data-theme="dark"] body { background: var(--bg); }
[data-theme="dark"] .sidebar { background: radial-gradient(120% 50% at 0% 0%, rgba(74, 102, 214, .22), transparent 60%), linear-gradient(180deg, #0c1233 0%, #0a0f2a 100%); border-right: 1px solid rgba(255, 255, 255, .05); }
[data-theme="dark"] .hero, [data-theme="dark"] .next-card, [data-theme="dark"] .me-banner { box-shadow: 0 0 0 1px rgba(255, 255, 255, .06) inset, 0 18px 40px -16px rgba(0, 0, 0, .7); }
[data-theme="dark"] .segmented button.on, [data-theme="dark"] .theme-pick button.on { background: var(--surface-3); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
[data-theme="dark"] .brand-mark.tiled { filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .45)); }
[data-theme="dark"] .side-brand .brand-mark.tiled { filter: none; }
[data-theme="dark"] .case-card:hover, [data-theme="dark"] button.stat:hover, [data-theme="dark"] .person-card:hover { box-shadow: 0 14px 32px rgba(0, 0, 0, .45); border-color: var(--line-2); }
[data-theme="dark"] .auth-panel { background: var(--bg); }
[data-theme="dark"] .auth-card { box-shadow: 0 -10px 40px rgba(0, 0, 0, .5); }
[data-theme="dark"] .bottom-nav { box-shadow: 0 -8px 24px rgba(0, 0, 0, .35); }
[data-theme="dark"] .btn.outline:hover { background: var(--brand-soft); }
[data-theme="dark"] .photo-add { background: var(--brand-soft); border-color: var(--line-2); }
[data-theme="dark"] .toast { background: rgba(30, 39, 68, .96); border-color: rgba(255, 255, 255, .1); }
[data-theme="dark"] .doc-drop > .ms:first-child { background: var(--surface-3); box-shadow: none; }
[data-theme="dark"] img { filter: none; }
[data-theme="dark"] ::selection { background: rgba(107, 134, 247, .35); }
[data-theme="dark"] .fmt-badge { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

/* Site visit: download everything as one ZIP */
.visit-download { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.visit-download > div { flex: 1; display: grid; min-width: 180px; }
.visit-download b { font-size: 14px; }
.visit-download small { color: var(--muted); font-size: 12px; }
.visit-download .btn.loading .ms { display: none; }
