/* AK Nexus — 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;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --line: #e7eaf3;
  --text: #141a33;
  --text-2: #3c4462;
  --muted: #6b7390;
  --danger: #d6334a;
  --ok: #1f9d55;
  --r-lg: 20px;
  --r: 16px;
  --r-sm: 12px;
  --shadow: 0 1px 2px rgba(24, 36, 99, .05), 0 6px 20px rgba(24, 36, 99, .06);
  --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;
}

* { 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); }

/* ── Logo / splash / login ──────────────────────────────────────── */
.logo {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(140deg, var(--brand-ink), var(--brand)); color: #fff;
  font-weight: 700; font-size: 15px; letter-spacing: .5px; flex-shrink: 0;
  box-shadow: inset 0 -3px 0 var(--accent), 0 6px 16px rgba(42, 70, 184, .25);
}
.logo.lg { width: 64px; height: 64px; font-size: 24px; border-radius: 18px; }
.splash { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 24px; }

.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%, #dfe6ff 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: 14px; font-weight: 600; color: var(--text-2); }
.req { color: var(--danger); }
.opt { color: var(--muted); font-weight: 400; font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; margin-top: -4px; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line); background: var(--surface); outline: none; font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 88px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #a3a9bd; }
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: #c9d0e6; }
.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(--surface-2); border: 1.5px solid var(--line); border-radius: var(--r-sm); 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.on { background: var(--surface); color: var(--brand); box-shadow: 0 1px 4px rgba(24, 36, 99, .12); }

/* ── 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: #2240a8; }
.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: #d3d9ef; 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: rgba(20, 26, 51, .05); }
.btn.danger { background: var(--danger); }
.btn.outline.danger { background: var(--surface); color: var(--danger); border-color: #f3c6cd; }
.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: rgba(20, 26, 51, .06); 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: #b4b9cb; }

/* ── 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); }

/* ── 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: rgba(255, 255, 255, .94); 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);
}
.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); }
.nav-item.on .ms { font-variation-settings: "FILL" 1, "wght" 500; }
.nav-new .nav-ic { width: 52px; height: 52px; margin-top: -24px; background: 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 #fff;
}
.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;
    background: var(--surface); border-right: 1px solid var(--line); padding: 20px 12px;
  }
  .side-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; }
  .side-brand b { display: block; font-size: 16px; }
  .side-brand small { color: var(--muted); font-size: 12px; }
  .side-nav { display: grid; gap: 4px; }
  .side-nav .nav-item { grid-auto-flow: column; justify-content: start; gap: 12px; padding: 4px 8px; font-size: 15px; }
  .side-nav .nav-ic { width: 36px; height: 36px; }
  .side-nav .nav-item.on { background: var(--brand-soft); }
  .side-nav .nav-item:hover:not(.on) { background: var(--surface-2); }
  .side-nav .nav-new { margin: 8px 0; background: var(--brand); color: #fff; }
  .side-nav .nav-new .nav-ic { width: 36px; height: 36px; margin: 0; border: 0; box-shadow: none; background: rgba(255, 255, 255, .15); }
  .side-nav .nav-new .nav-ic .ms { font-size: 22px; }
  .side-nav .nav-new:hover { background: #2240a8; }
  .side-nav .badge { right: -6px; }
  .side-me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px; border-top: 1px solid var(--line); min-width: 0; }
  .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: var(--muted); font-size: 12px; }
  .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; }
.hello { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.role-line { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; margin-top: 2px; }
.role-line .ms { font-size: 17px; }
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 24px; color: #fff;
  background: linear-gradient(135deg, var(--brand-ink) 0%, var(--brand) 70%, #4a66d6 100%);
  box-shadow: 0 12px 32px rgba(42, 70, 184, .28); display: grid; gap: 4px;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 165, 36, .45), transparent 70%);
}
.hero.calm { background: linear-gradient(135deg, #1d6b4f, #23926a); box-shadow: 0 12px 32px rgba(31, 157, 85, .25); }
.hero-num { display: flex; align-items: baseline; gap: 10px; position: relative; z-index: 1; }
.hero-num b { font-size: 48px; line-height: 1; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hero-num span { font-size: 16px; font-weight: 600; opacity: .95; }
.hero p { opacity: .8; font-size: 14px; position: relative; z-index: 1; }
.hero-btn { margin-top: 16px; background: #fff; color: var(--brand-ink); box-shadow: 0 4px 14px rgba(0, 0, 0, .15); justify-self: start; position: relative; z-index: 1; min-height: 48px; }
.hero-btn:hover { background: #f3f5ff; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 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 {
  display: grid; gap: 4px; text-align: left; padding: 14px; border-radius: var(--r); border: 0; background: var(--surface);
  box-shadow: var(--shadow); cursor: pointer; min-width: 0;
}
div.stat { cursor: default; }
.stat-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--tone-bg); color: var(--tone); margin-bottom: 4px; }
.stat-ic .ms { font-size: 18px; }
.stat b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat small { font-size: 12px; color: var(--muted); font-weight: 500; }
button.stat:hover { box-shadow: 0 2px 4px rgba(24, 36, 99, .06), 0 10px 28px rgba(24, 36, 99, .1); }
.help-card { background: #fffaf0; border: 1.5px solid #f8e3b8; 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; }

/* ── 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; gap: 10px; text-align: left; padding: 16px 16px 12px 20px; border-radius: var(--r);
  border: 0; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; min-width: 0; overflow: hidden;
  transition: transform .12s, box-shadow .15s;
}
.case-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--edge, var(--t-grey)); }
.case-card:hover { box-shadow: 0 2px 4px rgba(24, 36, 99, .06), 0 12px 32px rgba(24, 36, 99, .1); }
.case-card:active { transform: scale(.99); }
.edge-grey { --edge: #b6bdd0; } .edge-blue { --edge: var(--t-blue); } .edge-teal { --edge: var(--t-teal); }
.edge-purple { --edge: var(--t-purple); } .edge-orange { --edge: var(--t-orange); } .edge-red { --edge: var(--t-red); }
.edge-green { --edge: var(--t-green); } .edge-yellow { --edge: #e0a800; }
.cc-row { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.cc-main { min-width: 0; }
.cc-name { font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-meta { color: var(--muted); font-size: 14px; 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: 14px; color: var(--text-2); background: var(--surface-2); border-radius: 10px; padding: 8px 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: 8px; font-size: 12px; }
.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: 14px; white-space: nowrap; }
.cc-action .ms { font-size: 18px; }
.case-card.mine { box-shadow: 0 0 0 1.5px rgba(42, 70, 184, .18), var(--shadow); }

/* ── Cases page ─────────────────────────────────────────────────── */
.cases { display: grid; gap: 12px; }
.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: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); cursor: pointer; white-space: nowrap; font-size: 14px; font-weight: 600; color: var(--text-2);
}
.chip .ms { font-size: 18px; }
.chip .n { font-size: 12px; color: var(--muted); font-weight: 700; }
.chip.on { background: var(--text); border-color: var(--text); color: #fff; }
.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(15, 20, 45, .45); animation: fade .18s 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: 24px 24px 0 0; box-shadow: var(--shadow-lg); animation: up .25s cubic-bezier(.2, .8, .2, 1);
}
.layer.out .sheet { animation: down .2s ease forwards; }
@keyframes up { from { transform: translateY(60px); opacity: .5; } }
@keyframes down { to { transform: translateY(60px); opacity: 0; } }
.grabber { width: 40px; height: 4px; border-radius: 4px; background: #d6dae6; margin: 8px auto 0; }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px 8px 20px; }
.sheet-head > div { flex: 1; min-width: 0; padding-top: 8px; }
.sheet-head p { font-size: 14px; 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: 8px; padding: 12px 20px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); }
.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); }
  .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(--surface);
  border-bottom: 1px solid var(--line); min-height: 60px;
}
.page-title { flex: 1; min-width: 0; padding: 0 4px; }
.page-title h2 { font-size: 17px; 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(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(24, 36, 99, .06); }
.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: 22px; font-weight: 700; margin-top: 8px; }
.step-sub { color: var(--muted); margin-top: -8px; }
.form-stack { display: grid; gap: 20px; }
.form-card { background: var(--surface); border-radius: var(--r); padding: 20px; display: grid; gap: 20px; box-shadow: var(--shadow); }
.case-strip { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-radius: var(--r-sm); box-shadow: var(--shadow); }
.case-strip span { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; color: var(--muted); }
.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: var(--r); box-shadow: var(--shadow); 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: 14px; color: var(--muted); font-weight: 600; }
.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: #b6bccd; }
.people-list { display: grid; gap: 8px; }
.person {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-sm); border: 1.5px solid var(--line);
  background: var(--surface); cursor: pointer; text-align: left;
}
.person:hover { border-color: #c8cfe6; background: var(--surface-2); }
.person.on { border-color: var(--brand); background: var(--brand-soft); }
.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.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: var(--r-sm); border: 2px dashed #bfc8e8; 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.alt { background: var(--surface); border-color: var(--line); color: var(--text-2); }
.photo { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); 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: 28px 16px; border-radius: var(--r); border: 2px dashed #c7cfe8;
  background: var(--surface); cursor: pointer; text-align: center; color: var(--text-2);
}
.doc-drop .ms { font-size: 34px; color: var(--brand); }
.doc-drop small { color: var(--muted); font-size: 12px; }
.doc-state { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
.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 { box-shadow: 0 0 0 1.5px rgba(31, 157, 85, .35), var(--shadow); }
.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: 16px; border-radius: var(--r); border: 0; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; text-align: left; }
.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: var(--r-sm); background: var(--surface); border: 1.5px solid var(--line); min-height: 52px; }
.gps > span:not(.ms):not(.spin) { flex: 1; display: grid; font-size: 14px; }
.gps small { color: var(--muted); }
.review { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.review > div { display: grid; gap: 2px; padding: 14px; background: var(--surface); border-radius: var(--r-sm); 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: 8px; padding: 20px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); }
.amount-field > span { font-size: 14px; font-weight: 600; color: var(--muted); }
.amount-field > div { display: flex; align-items: center; gap: 8px; }
.amount-field b { font-size: 34px; color: var(--muted); font-weight: 600; }
.amount-field .amount-input { border: 0 !important; box-shadow: none !important; padding: 0; font-size: 40px; font-weight: 700; min-height: 0; font-variant-numeric: tabular-nums; }

/* 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: var(--ok); 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: 22px; }
.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 #c3cbe6;
  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: grid; gap: 16px; }
.case-hero { display: grid; gap: 8px; padding: 16px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); }
.hero-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.hero-sub { display: flex; align-items: flex-start; gap: 8px; color: var(--text-2); font-size: 14px; }
.hero-sub .ms { font-size: 18px; color: var(--muted); margin-top: 1px; }
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.qa {
  display: grid; justify-items: center; gap: 6px; padding: 8px 0 4px; border: 0; background: none; text-decoration: none;
  color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer; border-radius: 12px;
}
.qa-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); transition: transform .1s; }
.qa:active .qa-ic { transform: scale(.94); }
.qa.off { opacity: .45; cursor: default; }
.next-card {
  display: grid; gap: 8px; padding: 16px; border-radius: var(--r); color: #fff;
  background: linear-gradient(135deg, var(--brand-ink), var(--brand)); box-shadow: 0 10px 28px rgba(42, 70, 184, .28);
}
.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(255, 255, 255, .15); }
.nc-top small { display: block; font-size: 12px; opacity: .75; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.nc-top b { font-size: 18px; }
.next-card p { opacity: .85; font-size: 14px; }
.with-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border-radius: var(--r); 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); }
section.block { background: var(--surface); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); display: grid; gap: 12px; align-content: start; min-width: 0; }
.block-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.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: 12px; color: var(--muted); font-weight: 500; }
.facts dd { margin: 2px 0 0; font-weight: 500; word-break: break-word; }
@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 -16px; padding: 0 16px; }
.photo-strip::-webkit-scrollbar { display: none; }
.thumb { flex: 0 0 104px; height: 104px; border: 0; padding: 0; border-radius: var(--r-sm); overflow: hidden; background: var(--line); cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.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(--ok); }
.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(--ok); border-color: var(--ok); }
.journey li.now .j-dot { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 5px var(--brand-soft); }
.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 { display: flex; gap: 10px; }
.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; margin: 0 -8px; }
.menu-row { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 12px; border: 0; background: none; border-radius: 12px; cursor: pointer; text-align: left; font-size: 16px; font-weight: 500; }
.menu-row:hover { background: var(--surface-2); }
.menu-row .ms { color: var(--muted); }
.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-grid { display: grid; gap: 16px; }
@media (min-width: 1000px) { .dash-grid { grid-template-columns: 1fr 1fr; } }
.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; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r); border: 0; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; text-align: left; }
.user-row.inactive { opacity: .55; }
.u-text { flex: 1; display: grid; min-width: 0; }
.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 { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 32px 16px 24px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.me-card h2 { margin-top: 10px; font-size: 22px; }
.me-card p { display: flex; align-items: center; gap: 6px; color: var(--brand); font-weight: 600; }
.me-card small { color: var(--muted); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; }
.set-group { background: var(--surface); border-radius: var(--r); 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; }
div.set-row { cursor: default; }
.set-row + .set-row { border-top: 1px solid var(--line); }
button.set-row:hover { background: var(--surface-2); }
.set-row > div { flex: 1; display: grid; min-width: 0; }
.set-row small { color: var(--muted); font-size: 12px; }
.set-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.set-row.danger { color: var(--danger); }
.set-row.danger .set-ic { background: var(--t-red-bg); color: var(--danger); }
.version { text-align: center; color: var(--muted); font-size: 12px; }
.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(--brand-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: #fff; color: var(--brand-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: 10px; padding: 14px 16px; border-radius: 14px; background: #161b33; color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; animation: up .2s ease; pointer-events: auto; }
.toast .ms { color: #6be3a0; }
.toast.error { background: #8d1c2c; }
.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; }
}
