/* ═══════════════════════════════════════════════════════════════
   新瑞林阳 · 律师工作台
   设计语言：卷宗纸 + 朱砂印
   暖白纸面 / 墨紫黑正文 / 橄榄砂色分区 / 单一朱红 accent
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Design System Inspired by Pinterest — schema tokens */
  --bg: #ffffff;
  --surface: #f6f6f3;
  --surface-warm: #e5e5e0;

  --fg: #211922;
  --fg-2: #000000;
  --muted: #62625b;
  --meta: #91918c;

  --border: #c8c8c1;
  --border-soft: #e0e0d9;

  --accent: #e60023;
  --accent-on: #000000;
  --accent-hover: color-mix(in oklab, var(--accent), black 8%);
  --accent-active: color-mix(in oklab, var(--accent), black 14%);

  --success: #103c25;
  --warn: #c47700;
  --danger: #9e0a0a;

  --font-display:
    "Pin Sans", -apple-system, system-ui, "Segoe UI", Roboto, "Oxygen-Sans",
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", Ubuntu, Cantarell,
    "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica,
    "ヒラギノ角ゴ Pro W3", メイリオ, Meiryo, "ＭＳ Ｐゴシック", Arial,
    sans-serif;
  --font-body:
    "Pin Sans", -apple-system, system-ui, "Segoe UI", Roboto, "Oxygen-Sans",
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", Ubuntu, Cantarell,
    "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica,
    "ヒラギノ角ゴ Pro W3", メイリオ, Meiryo, "ＭＳ Ｐゴシック", Arial,
    sans-serif;
  --font-mono:
    ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Monaco,
    Consolas, monospace;

  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 44px;
  --text-4xl: 70px;

  --leading-body: 1.4;
  --leading-tight: 1.15;
  --tracking-display: -0.02em;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;

  --section-y-desktop: 80px;
  --section-y-tablet: 48px;
  --section-y-phone: 32px;

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 28px;
  --radius-pill: 9999px;

  --elev-flat: none;
  --elev-ring: 0 0 0 1px var(--border);
  --elev-raised: 0 4px 16px rgba(33, 25, 34, 0.06);

  --focus-ring: 0 0 0 3px color-mix(in oklab, #435ee5, transparent 70%);

  --motion-fast: 150ms;
  --motion-base: 200ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);

  --container-max: 1280px;
  --container-gutter-desktop: 32px;
  --container-gutter-tablet: 24px;
  --container-gutter-phone: 16px;

  /* Application extensions — all resolved from brand tokens */
  --danger-soft: color-mix(in oklab, var(--danger), white 92%);
  --warn-soft: color-mix(in oklab, var(--warn), white 88%);
  --warn-ink: color-mix(in oklab, var(--warn), black 44%);
  --success-soft: color-mix(in oklab, var(--success), white 92%);
  --accent-soft: color-mix(in oklab, var(--accent), white 93%);
  --focus-ink: #435ee5;
  --topbar-h: 64px;
  --calendar-h: 94px;
  --safe-top: env(safe-area-inset-top, 0px);
  --sidebar-w: 248px;
  --shadow-pop: 0 16px 48px rgba(33, 25, 34, 0.14);
  --shadow-card: 0 8px 30px rgba(33, 25, 34, 0.07);
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  min-width: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.5;
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, p, figure, dl, dd, dt { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; }
svg { overflow: visible; }
summary::-webkit-details-marker { display: none; }
summary { list-style: none; }
::selection { background: var(--accent-soft); color: var(--fg); }
:focus-visible { outline: 3px solid color-mix(in oklab, var(--focus-ink), transparent 62%); outline-offset: 2px; }
.od-icon { vertical-align: -0.14em; }
.skip-link {
  position: fixed; top: -60px; left: 16px; z-index: 300;
  padding: 10px 14px; border-radius: 12px; background: var(--fg); color: #fff;
  font-size: 12px; font-weight: 700;
}
.skip-link:focus { top: 12px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.nowrap { white-space: nowrap; }
.is-hidden { display: none !important; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.muted-small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.body-muted { color: var(--muted); font-size: 13px; line-height: 1.65; }
.body-meta { color: var(--muted); font-size: 12px; line-height: 1.5; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-soft); border: 3px solid var(--bg); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }
::-webkit-scrollbar-track { background: transparent; }

/* ─── Typography ────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--fg);
  letter-spacing: var(--tracking-display);
}
.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.08em;
}
.page-title {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.lede {
  max-width: 68ch;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}
.case-title-lg {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

/* ─── Brand & avatar ────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-align: left;
  color: var(--fg);
}
.brand-seal {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}
.brand-seal-lg { width: 44px; height: 44px; border-radius: 13px; font-size: 24px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-name { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.brand-sub { margin-top: 1px; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: 0.04em; white-space: nowrap; }
.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-warm);
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.avatar-xs { width: 22px; height: 22px; font-size: 9px; }
.avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-md { width: 36px; height: 36px; font-size: 13px; }
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }
.avatar-system { background: var(--accent-soft); color: var(--danger); }

/* ─── Shell ─────────────────────────────────────────────────── */
.app-shell { min-height: 100vh; background: var(--bg); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) 24px 0;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in oklab, var(--bg), transparent 4%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.top-search { position: relative; width: 100%; max-width: 480px; justify-self: center; }
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--muted);
  transition: background var(--motion-fast) var(--ease-standard),
              border-color var(--motion-fast) var(--ease-standard),
              box-shadow var(--motion-fast) var(--ease-standard);
}
.search-box:focus-within {
  background: var(--bg);
  border-color: var(--border);
  box-shadow: var(--focus-ring);
}
.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--fg);
  font-size: 13px;
}
.search-box input::placeholder { color: var(--muted); }
.search-box kbd, .ai-btn kbd {
  flex: none;
  padding: 1px 5px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.6;
}
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 80;
  max-height: 430px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--bg);
  box-shadow: var(--shadow-pop);
}
.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 8px;
  border-radius: 12px;
  color: var(--fg);
  text-align: left;
}
.search-result:hover { background: var(--surface); }
.search-ico {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
}
.search-result > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.search-result strong { overflow: hidden; color: var(--fg); font-size: 12px; font-weight: 700; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.search-result small { overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.search-result .od-icon:last-child { color: var(--muted); }
.search-empty { padding: 14px 10px; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 3px; }
.ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  margin-right: 4px;
  padding: 0 11px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--fg);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: background var(--motion-fast) var(--ease-standard);
}
.ai-btn .od-icon { color: var(--accent); }
.ai-btn:hover { background: var(--surface-warm); }
.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  color: var(--fg);
  transition: background var(--motion-fast) var(--ease-standard);
}
.icon-btn:hover { background: var(--surface); }
.icon-btn-sm { width: 30px; height: 30px; }
.badge-count {
  position: absolute;
  top: 2px;
  right: 1px;
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border: 2px solid var(--bg);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-on);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.user-menu { position: relative; margin-left: 3px; }
.user-menu > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 3px 9px 3px 3px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-standard);
}
.user-menu > summary:hover { background: var(--surface); }
.user-menu > summary .od-icon { color: var(--muted); }
.user-name { font-size: 12px; font-weight: 700; white-space: nowrap; }
.user-role { color: var(--muted); font-size: 10px; white-space: nowrap; }
.user-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  width: 288px;
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--bg);
  box-shadow: var(--shadow-pop);
}
.user-pop-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--border-soft);
}
.user-pop-head > div { display: flex; flex-direction: column; justify-content: center; }
.user-pop-head strong { font-size: 13px; }
.user-pop-head span { color: var(--muted); font-size: 11px; }
.user-pop-head p { grid-column: 1 / -1; margin: 2px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border-radius: 11px;
  color: var(--fg);
  font-size: 12px;
  text-align: left;
}
.menu-item:hover { background: var(--surface); }

/* ─── Calendar strip ────────────────────────────────────────── */
.calendar {
  position: sticky;
  top: calc(var(--topbar-h) + var(--safe-top));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: var(--calendar-h);
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
}
.cal-month {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 196px;
  flex: none;
}
.cal-month strong { font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: -0.03em; }
.cal-month span { color: var(--muted); font-size: 10.5px; }
.cal-today { align-self: flex-start; margin-top: 2px; color: var(--danger); font-size: 10.5px; font-weight: 700; }
.cal-today:hover { text-decoration: underline; }
.cal-rail { display: flex; flex: 1; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.cal-rail::-webkit-scrollbar { display: none; }
.cal-day {
  position: relative;
  display: grid;
  grid-template-rows: 11px 22px 16px;
  gap: 1px;
  flex: 0 0 58px;
  height: 70px;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 14px;
  text-align: left;
  transition: background var(--motion-fast) var(--ease-standard),
              border-color var(--motion-fast) var(--ease-standard);
}
.cal-day:hover { background: var(--bg); }
.cal-day.today { background: var(--bg); border-color: var(--fg); box-shadow: var(--elev-raised); }
.cal-day.selected { border-color: var(--accent); }
.cal-day .dow { color: var(--muted); font-size: 9.5px; line-height: 1.2; }
.cal-day .num { color: var(--fg); font-size: 15px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-mon { margin-left: 2px; color: var(--muted); font-size: 7.5px; font-weight: 500; letter-spacing: 0; }
.cal-day.today .num { color: var(--accent); }
.cal-day .ev {
  overflow: hidden;
  align-self: start;
  max-width: 100%;
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.45;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.ev-red { background: var(--danger-soft); color: var(--danger); }
.ev-yellow { background: var(--warn-soft); color: var(--warn-ink); }
.ev-green { background: var(--success-soft); color: var(--success); }
.ev-empty { visibility: hidden; }
.cal-more { position: absolute; right: 6px; bottom: 4px; color: var(--muted); font-size: 8.5px; font-weight: 700; }
.cal-summary { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.cal-week { color: var(--muted); font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 0;
  color: var(--fg);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-link:disabled { opacity: .35; cursor: not-allowed; text-decoration: none; }
.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px;
  color: var(--fg);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}
.text-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ─── Layout & sidebar ─────────────────────────────────────── */
.app-body { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + var(--calendar-h) + var(--safe-top));
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: calc(100vh - var(--topbar-h) - var(--calendar-h) - var(--safe-top));
  overflow: hidden;
  border-right: 1px solid var(--border-soft);
  background: var(--bg);
}
.sidebar-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px 8px; }
.sidebar-label { margin: 0 10px 8px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 0.12em; }
.nav-group { margin-bottom: 6px; }
.nav-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 11px;
  color: var(--fg);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  transition: background var(--motion-fast) var(--ease-standard);
}
.nav-group-head:hover { background: var(--surface); }
.nav-group-head > .od-icon:last-child { margin-left: auto; color: var(--muted); }
.nav-group-icon { color: var(--muted); }
.nav-sub { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 4px; }
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 7px 10px 7px 32px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  text-align: left;
  transition: background var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}
.nav-link::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 50%;
  width: 4px;
  height: 4px;
  margin-top: -2px;
  border-radius: 50%;
  background: var(--border);
}
.nav-link:hover { background: var(--surface); color: var(--fg); }
.nav-link.active { background: var(--surface-warm); color: var(--fg); font-weight: 700; }
.nav-link.active::before { background: var(--accent); }
.nav-link > .od-icon { margin-right: 5px; color: var(--muted); }
.nav-home { margin: 0 0 9px; padding-left: 10px; font-weight: 700; color: var(--fg); }
.nav-home::before { display: none; }
.nav-home .od-icon { color: var(--muted); }
.nav-home.active .od-icon { color: var(--accent); }
.nav-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 17px;
  margin-left: auto;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--danger);
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.nav-util {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}
.sidebar-foot { flex: none; padding: 10px 14px 16px; border-top: 1px solid var(--border-soft); }
.external-link {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--fg);
  text-align: left;
  transition: border-color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard);
}
.external-link:hover { border-color: var(--fg); background: var(--surface-warm); }
.external-ico { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 9px; background: var(--bg); color: var(--accent); }
.external-link > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.external-link strong { font-size: 11.5px; line-height: 1.4; }
.external-link small { color: var(--muted); font-size: 9.5px; line-height: 1.4; }
.external-link > .od-icon { color: var(--muted); }
.sidebar-note { margin: 9px 2px 0; color: var(--muted); font-size: 9px; line-height: 1.5; letter-spacing: 0.02em; }

.main {
  width: 100%;
  min-width: 0;
  max-width: 1480px;
  margin: 0 auto;
  padding: 26px 32px 72px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ─── Buttons, chips, tags, levels ─────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--motion-fast) var(--ease-standard),
              transform var(--motion-fast) var(--ease-standard),
              box-shadow var(--motion-fast) var(--ease-standard);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-on); }
.btn-primary:hover { background: color-mix(in oklab, var(--accent), white 7%); }
.btn-primary:active { background: var(--accent); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18); }
.btn-secondary { background: var(--surface-warm); color: var(--fg-2); }
.btn-secondary:hover { background: color-mix(in oklab, var(--surface-warm), black 6%); }
.btn-ghost { background: transparent; color: var(--fg); }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in oklab, var(--danger), black 10%); }
.btn-sm { height: 32px; padding: 0 11px; border-radius: var(--radius-sm); font-size: 11px; }
.btn[disabled] { opacity: .38; cursor: not-allowed; transform: none; box-shadow: none; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}
.chip:hover { background: var(--surface-warm); color: var(--fg); }
.chip.active { background: var(--fg); color: #fff; }
.chip-count { font-size: 9px; font-weight: 700; opacity: .65; font-variant-numeric: tabular-nums; }
.select-wrap { position: relative; display: inline-flex; }
.select-wrap select {
  height: 32px;
  max-width: 150px;
  padding: 0 26px 0 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 14px, calc(100% - 9px) 14px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.select-wrap select:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}
.tag-soft { background: var(--surface); color: var(--muted); }
.tag-warm { background: var(--surface-warm); color: var(--fg); }
.tag-system { background: var(--accent-soft); color: var(--danger); }
.status-gray { background: var(--surface); color: var(--muted); }
.status-yellow { background: var(--warn-soft); color: var(--warn-ink); }
.status-green { background: var(--success-soft); color: var(--success); }
.status-red { background: var(--danger-soft); color: var(--danger); }
.level {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: var(--radius-pill);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.level-red { background: var(--danger-soft); color: var(--danger); }
.level-yellow { background: var(--warn-soft); color: var(--warn-ink); }
.level-green { background: var(--success-soft); color: var(--success); }
.level-muted { background: var(--surface); color: var(--muted); }
.update-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--danger);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
}
.readonly-flag { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 9.5px; font-weight: 700; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex: none; }
.dot-red { background: var(--accent); }
.dot-yellow { background: var(--warn); }
.dot-green { background: var(--success); }
.readonly-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 0;
  padding: 10px 13px;
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}
.readonly-note .od-icon { margin-top: 1px; color: var(--muted); }
.access-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 20px;
  padding: 13px 15px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}
.access-note > .od-icon { margin-top: 1px; flex: none; color: var(--success); }
.access-note p { margin: 0; }
.access-note strong { color: var(--fg); font-weight: 700; }
.notice-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 14px;
  padding: 9px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}
.notice-line > .od-icon { margin-top: 1px; color: var(--muted); }
.notice-line span { min-width: 0; }
.notice-warn { border-color: transparent; background: var(--warn-soft); color: var(--warn-ink); }
.notice-warn > .od-icon { color: var(--warn-ink); }
.notice-line-soft { border-style: dashed; background: transparent; }

.badge-warm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-warm);
  color: var(--fg);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

/* ─── Stats & panels ────────────────────────────────────────── */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 22px;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
.stat { display: flex; flex-direction: column; padding: 13px 18px; }
.stat:first-child { padding-left: 0; }
.stat + .stat { border-left: 1px solid var(--border-soft); }
.stat-num {
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat-label { margin-top: 2px; color: var(--fg); font-size: 11px; font-weight: 700; }
.stat-note { margin-top: 1px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.panel {
  min-width: 0;
  padding: 21px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--bg);
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}
.panel-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
}
.panel-sub { margin: 3px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.progress { display: block; height: 5px; overflow: hidden; border-radius: var(--radius-pill); background: var(--border-soft); }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--fg); }
.progress-lg { height: 7px; }
.progress-row { display: flex; align-items: center; gap: 9px; }
.progress-row .progress { flex: 1; }
.progress-row strong { color: var(--muted); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-status { padding: 2px 6px; border-radius: var(--radius-pill); background: var(--surface); color: var(--muted); font-size: 9px; font-weight: 700; line-height: 1.4; white-space: nowrap; }
.mini-status.running { background: var(--warn-soft); color: var(--warn-ink); }
.mini-status.done { background: var(--success-soft); color: var(--success); }
.mini-status.queued { background: var(--surface); color: var(--muted); }
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 32px 20px;
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: var(--surface);
  text-align: center;
}
.empty-left { align-items: flex-start; text-align: left; }
.empty-ico { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 4px; border-radius: 50%; background: var(--bg); color: var(--muted); }
.empty-state h3 { margin: 0; font-size: 15px; font-weight: 700; }
.empty-state p { max-width: 42ch; margin: 0 0 6px; color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.empty-inline { display: flex; align-items: center; gap: 6px; padding: 10px 2px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.empty-inline .od-icon { color: var(--success); }

/* ─── Home ─────────────────────────────────────────────────── */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 334px; align-items: start; gap: 22px; }
.home-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.home-rail {
  position: sticky;
  top: calc(var(--topbar-h) + var(--calendar-h) + var(--safe-top) + 20px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - var(--topbar-h) - var(--calendar-h) - var(--safe-top) - 34px);
  overflow-y: auto;
  padding-right: 2px;
}
.board-head { margin-bottom: 16px; }
.board-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.case-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.case-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--border-soft);
  border-radius: 24px;
  background: var(--bg);
  cursor: pointer;
  transition: transform var(--motion-base) var(--ease-standard),
              box-shadow var(--motion-base) var(--ease-standard),
              border-color var(--motion-base) var(--ease-standard);
}
.case-card:hover { transform: translateY(-2px); border-color: var(--border); box-shadow: var(--shadow-card); }
.case-card-top { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.case-card-top .level { flex: none; }
.case-title {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.015em;
  text-align: left;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.case-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.case-no { overflow: hidden; margin: -3px 0 1px; color: var(--muted); font-size: 10.5px; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.deadline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 13px;
  background: var(--surface);
}
.deadline-red { background: var(--danger-soft); }
.deadline-yellow { background: var(--warn-soft); }
.deadline-green { background: var(--surface); }
.deadline-label { display: inline-flex; align-items: center; gap: 5px; min-width: 0; color: var(--muted); font-size: 9.5px; font-weight: 700; line-height: 1.3; }
.deadline-red .deadline-label { color: var(--danger); }
.deadline-yellow .deadline-label { color: var(--warn-ink); }
.deadline-date { margin-left: auto; color: var(--fg); font-size: 15px; font-weight: 700; line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; }
.deadline-date small { color: inherit; font-size: 9px; font-weight: 500; opacity: .7; }
.deadline-count { flex: none; color: var(--muted); font-size: 9.5px; font-weight: 700; white-space: nowrap; }
.deadline-red .deadline-count { color: var(--danger); }
.deadline-yellow .deadline-count { color: var(--warn-ink); }
.case-meta { display: grid; gap: 4px; margin-top: 1px; }
.meta-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 11px; line-height: 1.5; }
.meta-row > span { flex: none; color: var(--muted); }
.meta-row > strong { overflow: hidden; min-width: 0; color: var(--fg); font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.meta-ellipsis { max-width: 64%; }
.case-card-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 17px; margin-top: -1px; }
.case-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 9px; border-top: 1px solid var(--border-soft); }
.case-person { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 500; }
.case-actions { display: inline-flex; align-items: center; gap: 8px; }
.ledger { display: flex; flex-direction: column; }
.ledger-head {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, .9fr) minmax(0, .9fr) minmax(0, .8fr);
  gap: 10px;
  align-items: end;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.ledger-row {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, .9fr) minmax(0, .9fr) minmax(0, .8fr);
  gap: 10px;
  align-items: start;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-standard);
}
.ledger-row:last-child { border-bottom: 0; }
.ledger-row:hover { background: var(--surface); }
.ledger-row:focus-visible { outline-offset: -2px; border-radius: 10px; }
.ledger-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ledger-title { overflow: hidden; font-size: 12.5px; font-weight: 700; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.ledger-sub { overflow: hidden; color: var(--muted); font-size: 9.5px; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.ledger-cell { display: flex; flex-direction: column; gap: 1px; min-width: 0; color: var(--fg); font-size: 10.5px; line-height: 1.45; }
.ledger-cell > span:not(.cell-label), .ledger-cell > small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ledger-cell small { color: var(--muted); font-size: 9.5px; }
.cell-label { display: none; color: var(--muted); font-size: 9px; font-weight: 700; }
.ledger-row .level { align-self: start; }
.ledger-full .ledger-title { font-size: 13px; }
.rail-card {
  padding: 15px;
  border: 1px solid var(--border-soft);
  border-radius: 24px;
  background: var(--surface);
}
.rail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.rail-head .eyebrow { margin-bottom: 2px; }
.rail-title { font-size: 15px; font-weight: 700; line-height: 1.3; letter-spacing: -0.015em; }
.todo-list { display: grid; gap: 1px; }
.todo-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 14px;
  gap: 7px;
  align-items: start;
  width: 100%;
  padding: 8px 7px;
  border-radius: 11px;
  text-align: left;
  transition: background var(--motion-fast) var(--ease-standard);
}
.todo-row:hover { background: var(--bg); }
.todo-time { padding-top: 1px; color: var(--muted); font-size: 9.5px; font-weight: 700; line-height: 1.4; font-variant-numeric: tabular-nums; }
.todo-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.todo-main strong { overflow: hidden; font-size: 11px; font-weight: 700; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.todo-main small { overflow: hidden; color: var(--muted); font-size: 9px; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.todo-level { display: grid; place-items: center; width: 14px; height: 20px; }
.todo-level.level-red { background: transparent; color: var(--danger); }
.todo-level.level-yellow { background: transparent; color: var(--warn-ink); }
.todo-level.level-green { background: transparent; color: var(--success); }
.rail-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-soft); color: var(--muted); font-size: 9.5px; }
.agent-list { display: grid; gap: 2px; }
.agent-row { display: flex; flex-direction: column; gap: 5px; width: 100%; padding: 8px 7px; border-radius: 11px; text-align: left; }
.agent-row:hover { background: var(--bg); }
.agent-row-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.agent-row-top strong { overflow: hidden; font-size: 10.5px; font-weight: 700; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.agent-row .progress { height: 3px; }
.agent-row-meta { color: var(--muted); font-size: 9px; line-height: 1.4; }
.msg-mini-list { display: grid; gap: 1px; }
.msg-mini { display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 8px 7px; border-radius: 11px; text-align: left; }
.msg-mini:hover { background: var(--bg); }
.msg-mini-top { display: flex; align-items: center; gap: 5px; min-width: 0; }
.msg-mini-top strong { overflow: hidden; flex: 1; font-size: 10px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.msg-mini-top > span:last-child:not(.dot) { color: var(--muted); font-size: 8.5px; white-space: nowrap; }
.msg-mini-body {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* ─── Case detail ──────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.crumb { color: var(--fg); font-size: 10.5px; font-weight: 700; }
.crumb:hover { text-decoration: underline; text-underline-offset: 3px; }
.case-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.case-head-main { min-width: 0; flex: 1; }
.case-head-tags { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-bottom: 7px; }
.case-head-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.meta-line { display: flex; align-items: center; gap: 4px 13px; flex-wrap: wrap; margin-top: 7px; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.meta-line span { position: relative; }
.meta-line span + span::before { content: "·"; margin-right: 13px; color: var(--border); }
.case-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 15px 0 4px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--surface);
}
.case-banner-red { background: var(--danger-soft); color: var(--danger); }
.case-banner-yellow { background: var(--warn-soft); color: var(--warn-ink); }
.case-banner-green { background: var(--success-soft); color: var(--success); }
.case-banner-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.case-banner-main > .od-icon { flex: none; }
.case-banner-main strong { display: block; font-size: 12px; font-weight: 700; line-height: 1.45; }
.case-banner-main span { display: block; margin-top: 1px; color: inherit; font-size: 10.5px; line-height: 1.45; opacity: .82; }
.case-banner .text-link { color: inherit; }
.tabs {
  display: flex;
  gap: 1px;
  overflow-x: auto;
  margin: 13px 0 19px;
  border-bottom: 1px solid var(--border-soft);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  padding: 9px 12px 10px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  transition: color var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(286px, .9fr); align-items: start; gap: 20px; }
.detail-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.side-stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.side-stack .panel { padding: 17px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--border-soft); }
.fact { padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.fact:nth-child(odd) { padding-right: 15px; }
.fact:nth-child(even) { padding-left: 15px; border-left: 1px solid var(--border-soft); }
.fact-wide { grid-column: 1 / -1; padding-right: 0; padding-left: 0; border-left: 0; }
.fact dt { margin: 0 0 3px; color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; }
.fact dd { margin: 0; color: var(--fg); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.agent-summary { margin: 0; color: var(--fg); font-size: 13px; line-height: 1.75; }
.relation { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.relation-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; color: var(--muted); font-size: 10px; font-weight: 700; }
.relation-head .muted-small { font-weight: 400; }
.relation-svg { display: block; width: 100%; height: auto; }
.svg-label { fill: var(--muted); font-size: 9px; font-family: var(--font-body); }
.svg-strong { fill: var(--fg); font-size: 10px; font-weight: 700; font-family: var(--font-body); }
.svg-center { fill: #fff; font-size: 11px; font-weight: 700; font-family: var(--font-body); }
.svg-center-id { fill: rgba(255, 255, 255, .78); font-size: 7.5px; font-family: var(--font-mono); }
.node-list { display: flex; flex-direction: column; }
.node-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 7px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border-soft); }
.node-row:last-child { border-bottom: 0; }
.node-date { display: flex; flex-direction: column; padding: 3px 5px; border-radius: 7px; background: var(--surface); color: var(--fg); font-variant-numeric: tabular-nums; }
.node-date.level-red { background: var(--danger-soft); color: var(--danger); }
.node-date.level-yellow { background: var(--warn-soft); color: var(--warn-ink); }
.node-date.level-green { background: var(--success-soft); color: var(--success); }
.node-date strong { font-size: 10px; line-height: 1.3; }
.node-date small { font-size: 8px; line-height: 1.3; opacity: .8; }
.node-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.node-main strong { overflow: hidden; font-size: 10.5px; font-weight: 700; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.node-main small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.node-add { margin-top: 9px; }
.fee-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fee-total { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.fee-desc { margin: 4px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.fee-node { display: flex; align-items: flex-start; gap: 4px; margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.fee-node .od-icon { margin-top: 1px; }
.dist-bar { display: flex; height: 9px; margin: 10px 0 7px; overflow: hidden; border-radius: var(--radius-pill); background: var(--border-soft); }
.dist-seg { display: flex; align-items: center; justify-content: center; height: 100%; overflow: hidden; color: #fff; font-size: 7px; font-weight: 700; line-height: 1; }
.dist-firm { background: var(--fg); }
.dist-source { background: var(--accent); color: var(--accent-on); }
.dist-team { background: var(--warn); color: #2b1b00; }
.dist-lead { background: var(--success); }
.dist-assist { background: var(--muted); }
.dist-rest { background: var(--border-soft); }
.dist-legend { display: flex; flex-wrap: wrap; gap: 3px 9px; color: var(--muted); font-size: 8.5px; line-height: 1.5; }
.dist-legend span { display: inline-flex; align-items: center; gap: 4px; }
.dist-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
.fee-foot { margin: 7px 0 0; padding-top: 7px; border-top: 1px solid var(--border-soft); color: var(--muted); font-size: 8.5px; line-height: 1.5; }
.team-list { display: flex; flex-direction: column; }
.team-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--border-soft); }
.team-row:last-child { border-bottom: 0; }
.team-row > div { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.team-row strong { font-size: 11.5px; font-weight: 700; line-height: 1.4; }
.team-row small { color: var(--muted); font-size: 9.5px; line-height: 1.4; }
.team-row .tag { margin-left: auto; }
.team-row-muted { opacity: .82; }
.team-note { display: flex; align-items: flex-start; gap: 4px; margin: 8px 0 0; color: var(--muted); font-size: 8.5px; line-height: 1.5; }
.file-list { border-top: 1px solid var(--border-soft); }
.file-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 78px 82px 16px;
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 9px 3px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  transition: background var(--motion-fast) var(--ease-standard);
}
.file-row:hover { background: var(--surface); }
.file-row:last-child { border-bottom: 0; }
.file-ico { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--surface); color: var(--muted); }
.file-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.file-main strong { overflow: hidden; font-size: 11.5px; font-weight: 700; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.file-main small { overflow: hidden; color: var(--muted); font-size: 9px; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.file-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file-md5 { font-variant-numeric: tabular-nums; }
.file-open { color: var(--muted); }
.mat-chips { margin-bottom: 12px; }
.output-list { display: flex; flex-direction: column; border-top: 1px solid var(--border-soft); }
.output-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 58px auto; gap: 9px; align-items: center; padding: 10px 3px; border-bottom: 1px solid var(--border-soft); }
.output-row:last-child { border-bottom: 0; }
.output-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface); color: var(--muted); }
.output-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.output-main strong { overflow: hidden; font-size: 12px; font-weight: 700; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.output-main span { color: var(--muted); font-size: 9.5px; line-height: 1.4; }
.status-text { color: var(--fg); }
.output-actions { display: flex; gap: 7px; }
.stepper { display: flex; gap: 3px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 3px; scrollbar-width: none; }
.stepper::-webkit-scrollbar { display: none; }
.step {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: 1 0 96px;
  padding: 9px 8px;
  border-top: 2px solid var(--border-soft);
  color: var(--muted);
  text-align: left;
}
.step.done { border-top-color: var(--fg); color: var(--fg); }
.step.current { border-top-color: var(--accent); color: var(--fg); background: var(--surface); border-radius: 0 0 9px 9px; }
.step:disabled { cursor: default; opacity: .75; }
.step-num { display: grid; place-items: center; width: 19px; height: 19px; border: 1px solid var(--border); border-radius: 50%; font-size: 8.5px; font-weight: 700; line-height: 1; }
.step.done .step-num { border-color: var(--fg); background: var(--fg); color: #fff; }
.step.current .step-num { border-color: var(--accent); background: var(--accent); color: var(--accent-on); }
.step-name { font-size: 10.5px; font-weight: 700; line-height: 1.35; white-space: nowrap; }
.step-now { color: var(--danger); font-size: 8px; font-weight: 700; }
.stage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stage-card { padding: 14px; border-radius: 16px; background: var(--surface); }
.stage-card h3 { margin: 2px 0 8px; font-size: 15px; font-weight: 700; }
.stage-card-muted { background: transparent; border: 1px dashed var(--border); }
.check-list { display: grid; gap: 7px; list-style: none; }
.check-list li { display: flex; align-items: flex-start; gap: 6px; color: var(--fg); font-size: 11.5px; line-height: 1.55; }
.check-list .od-icon { margin-top: 1px; flex: none; color: var(--success); }
.timeline { display: flex; flex-direction: column; gap: 13px; margin-left: 5px; padding-left: 18px; border-left: 1px solid var(--border); }
.tl-item { position: relative; }
.tl-dot { position: absolute; top: 8px; left: -24px; width: 9px; height: 9px; border: 2px solid var(--fg); border-radius: 50%; background: var(--bg); }
.tl-card { padding: 9px 11px; border-radius: 12px; background: var(--surface); }
.tl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 9px; }
.tl-head time { font-variant-numeric: tabular-nums; }
.tl-card h3 { margin: 4px 0 0; font-size: 12px; font-weight: 600; line-height: 1.45; }
.log-composer { margin-bottom: 13px; padding: 11px; border-radius: 16px; background: var(--surface); }
.log-composer textarea {
  width: 100%;
  min-height: 48px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  outline: none;
  background: var(--bg);
  color: var(--fg);
  font-size: 12px;
  line-height: 1.55;
  resize: vertical;
}
.log-composer textarea:focus { border-color: var(--border); box-shadow: var(--focus-ring); }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 7px; color: var(--muted); font-size: 9.5px; line-height: 1.5; }
.composer-foot > span { display: inline-flex; align-items: center; gap: 4px; }
.parse-card { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; padding: 13px; border: 1px dashed var(--border); border-radius: 16px; background: var(--surface); }
.parse-head { display: flex; align-items: flex-start; gap: 7px; }
.parse-head > .od-icon { margin-top: 2px; color: var(--accent); }
.parse-head > div { flex: 1; min-width: 0; }
.parse-head strong { font-size: 12px; font-weight: 700; }
.parse-head p { margin: 1px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.parse-actions { display: flex; justify-content: flex-end; gap: 7px; }
.log-list { display: flex; flex-direction: column; }
.log-item { display: flex; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.log-item:last-child { border-bottom: 0; }
.log-avatar { flex: none; padding-top: 1px; }
.log-main { min-width: 0; flex: 1; }
.log-head { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.log-head strong { font-size: 10.5px; font-weight: 700; }
.log-head time { margin-left: auto; color: var(--muted); font-size: 8.5px; font-variant-numeric: tabular-nums; }
.log-main p { margin: 3px 0 0; color: var(--fg); font-size: 11.5px; line-height: 1.6; }
.change-list { display: flex; flex-direction: column; }
.change-item { border-bottom: 1px solid var(--border-soft); }
.change-item:last-child { border-bottom: 0; }
.change-item > summary {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto 15px;
  gap: 9px;
  align-items: center;
  padding: 10px 2px;
  cursor: pointer;
}
.change-item > summary > .od-icon { color: var(--muted); }
.change-item[open] > summary > .od-icon { transform: rotate(180deg); }
.change-date { display: flex; flex-direction: column; gap: 1px; font-variant-numeric: tabular-nums; }
.change-date strong { font-size: 10.5px; font-weight: 700; }
.change-date small { color: var(--muted); font-size: 8.5px; }
.change-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.change-main strong { font-size: 10.5px; font-weight: 700; }
.change-main small { overflow: hidden; color: var(--muted); font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.change-body { padding: 0 0 11px 67px; }
.change-note { margin: 0 0 5px; color: var(--muted); font-size: 9.5px; line-height: 1.5; }
.change-file { display: flex; align-items: center; gap: 6px; padding: 4px 0; font-size: 10px; }
.change-file .od-icon { color: var(--muted); }
.change-file strong { font-size: 10px; font-weight: 600; }
.change-file .muted-small { margin-left: auto; }

/* ─── Forms ────────────────────────────────────────────────── */
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; padding: 0; margin: 0; border: 0; }
.field > span, .field > label, .field legend { color: var(--fg); font-size: 10.5px; font-weight: 700; line-height: 1.45; }
.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  outline: none;
  background: var(--bg);
  color: var(--fg);
  font-size: 12px;
  line-height: 1.45;
  transition: border-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--fg); box-shadow: var(--focus-ring); }
.field textarea { resize: vertical; min-height: 54px; }
.field select { cursor: pointer; }
.field-wide { grid-column: 1 / -1; }
.field-hint { color: var(--muted); font-size: 9.5px; font-weight: 400; }
.field-help { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.form-error { margin: 0 0 8px; padding: 8px 10px; border-radius: 9px; background: var(--danger-soft); color: var(--danger); font-size: 10.5px; line-height: 1.5; }
.check-row { display: flex; align-items: flex-start; gap: 7px; color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.check-row input { margin-top: 2px; accent-color: var(--accent); }
.radio-stack { display: grid; gap: 5px; }
.radio-row { display: flex; align-items: flex-start; gap: 7px; padding: 8px 10px; border: 1px solid var(--border-soft); border-radius: 11px; background: var(--bg); cursor: pointer; }
.radio-row:has(input:checked) { border-color: var(--fg); background: var(--surface); }
.radio-row input { margin-top: 2px; accent-color: var(--accent); }
.radio-row > span { display: flex; flex-direction: column; gap: 1px; }
.radio-row strong { font-size: 11px; font-weight: 700; }
.radio-row small { color: var(--muted); font-size: 9.5px; line-height: 1.5; }
.segmented { display: flex; gap: 0; padding: 3px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface); }
.segment { position: relative; flex: 1; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span { display: block; padding: 7px 6px; border-radius: 9px; color: var(--muted); font-size: 10.5px; font-weight: 700; text-align: center; cursor: pointer; transition: background var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard); }
.segment input:checked + span { background: var(--bg); color: var(--fg); box-shadow: 0 1px 4px rgba(33, 25, 34, 0.07); }
.segment input:focus-visible + span { outline: 3px solid color-mix(in oklab, var(--focus-ink), transparent 62%); outline-offset: 1px; }
.recipient-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.recipient-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px 4px 4px; border: 1px solid var(--border-soft); border-radius: var(--radius-pill); background: var(--bg); color: var(--fg); font-size: 10.5px; cursor: pointer; }
.recipient-chip input { accent-color: var(--accent); }
.recipient-chip:has(input:checked) { background: var(--surface-warm); border-color: var(--border); }
.cloud-warning { padding: 11px; border: 1px dashed color-mix(in oklab, var(--warn), white 35%); border-radius: 13px; background: var(--warn-soft); color: var(--warn-ink); }
.warning-head { display: flex; align-items: center; gap: 5px; margin-bottom: 4px; font-size: 11px; }
.cloud-warning p { margin: 0 0 7px; color: var(--warn-ink); font-size: 10px; line-height: 1.55; }
.cloud-warning .check-row { color: var(--warn-ink); }
.path-box { display: flex; align-items: flex-start; gap: 7px; padding: 9px 11px; border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.scan-summary { display: flex; flex-wrap: wrap; gap: 12px; padding: 3px 0; color: var(--muted); font-size: 9.5px; line-height: 1.5; }
.scan-summary span { display: inline-flex; align-items: center; gap: 4px; }
.dist-editor { padding: 11px; border-radius: 14px; background: var(--surface); }
.dist-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: var(--fg); font-size: 11px; }
.dist-editor-head strong { font-size: 11px; }
.dist-editor-head span { color: var(--muted); font-size: 10px; }
.dist-editor-head .sum-error { color: var(--danger); font-weight: 700; }
.dist-inputs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.dist-inputs .field input { padding: 7px 6px; text-align: center; }
.dist-inputs .field > span { font-size: 9px; }
.dist-editor .field-help { margin-top: 7px; font-size: 9.5px; }

/* ─── Modal / chat / toast ─────────────────────────────────── */
.modal {
  width: min(620px, calc(100vw - 28px));
  max-height: min(88vh, 900px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  overflow: visible;
}
.modal::backdrop { background: rgba(33, 25, 34, 0.44); backdrop-filter: blur(3px); }
.modal-card {
  max-height: min(88vh, 900px);
  overflow-y: auto;
  padding: 20px;
  border-radius: 24px;
  background: var(--bg);
  box-shadow: 0 24px 80px rgba(33, 25, 34, 0.22);
  animation: pop-in var(--motion-base) var(--ease-standard);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 2px 0 0; font-size: 21px; font-weight: 700; line-height: 1.3; letter-spacing: -0.02em; }
.modal-eyebrow { margin: 0; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 0.1em; }
.modal-close { margin-top: -4px; margin-right: -4px; }
.modal-body { min-width: 0; }
.modal-lead { margin: 0 0 13px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 7px; margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--border-soft); }
.modal-foot-flush { margin-top: 3px; padding-top: 0; border-top: 0; }
.confirm-text { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.modal .form-grid { gap: 9px; }
.modal .modal-foot-flush { justify-content: space-between; }
.job-modal .modal-card { max-width: 420px; margin: 0 auto; }
.job-lead { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.job-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.job-step { display: flex; align-items: center; gap: 8px; padding: 6px 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.job-mark { display: grid; place-items: center; width: 19px; height: 19px; flex: none; border: 1px solid var(--border); border-radius: 50%; font-size: 8px; font-weight: 700; }
.job-step.active { color: var(--fg); }
.job-step.active .job-mark { border-color: var(--accent); background: var(--accent); color: var(--accent-on); }
.job-step.done { color: var(--fg); }
.job-step.done .job-mark { border-color: var(--success); background: var(--success); color: #fff; }
.job-status { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.doc-preview {
  max-height: 48vh;
  overflow-y: auto;
  margin: 0;
  padding: 14px;
  border-radius: 13px;
  background: var(--surface);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.preview-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0 0 12px; }
.preview-meta dt { color: var(--muted); font-size: 9px; font-weight: 700; }
.preview-meta dd { margin: 1px 0 0; font-size: 11px; }
.ocr-preview { padding: 12px; border-radius: 12px; background: var(--surface); }
.ocr-title { margin: 0 0 4px; color: var(--fg); font-size: 11px; font-weight: 700; }
.ocr-sample { margin: 8px 0 0; color: var(--fg); font-size: 11px; line-height: 1.7; white-space: pre-wrap; }
.upload-zone { border: 1px dashed var(--border); border-radius: 14px; background: var(--surface); transition: border-color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard); }
.upload-zone:hover { border-color: var(--fg); background: var(--bg); }
.upload-zone.has-file { padding: 8px; background: var(--bg); }
.upload-empty { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 20px 12px; color: var(--muted); text-align: center; cursor: pointer; }
.upload-empty > .od-icon { color: var(--muted); }
.upload-empty strong { color: var(--fg); font-size: 12px; font-weight: 700; }
.upload-empty small { color: var(--muted); font-size: 9.5px; }
.file-picked { display: flex; align-items: center; gap: 8px; padding: 4px; }
.file-picked > div { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-picked strong { overflow: hidden; font-size: 11px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.file-picked small { color: var(--muted); font-size: 9px; }
.upload-btn { position: relative; cursor: pointer; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 220;
  max-width: min(88vw, 480px);
  padding: 9px 15px;
  border-radius: 12px;
  background: var(--fg);
  color: #fff;
  font-size: 11.5px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  box-shadow: 0 8px 28px rgba(33, 25, 34, 0.24);
  transition: opacity var(--motion-base) var(--ease-standard), transform var(--motion-base) var(--ease-standard);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.chat-dialog {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(440px, 100vw);
  max-width: 440px;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border-soft);
  background: var(--bg);
  overflow: hidden;
}
.chat-dialog::backdrop { background: rgba(33, 25, 34, 0.3); backdrop-filter: blur(2px); }
.chat-shell { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex: none; padding: 17px 18px 13px; border-bottom: 1px solid var(--border-soft); background: var(--bg); }
.chat-head h2 { margin: 2px 0 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.chat-model { display: flex; align-items: center; gap: 4px; margin: 4px 0 0; color: var(--muted); font-size: 9.5px; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 90%; padding: 10px 12px; border-radius: 16px; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.chat-msg.assistant { align-self: flex-start; border: 1px solid var(--border-soft); border-bottom-left-radius: 5px; background: var(--bg); color: var(--fg); }
.chat-msg.user { align-self: flex-end; border-bottom-right-radius: 5px; background: var(--fg); color: #fff; }
.chat-typing { display: flex; align-items: center; gap: 3px; padding: 13px 14px; }
.chat-typing span { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
.chat-quick { display: flex; gap: 5px; flex: none; overflow-x: auto; padding: 9px 14px; border-top: 1px solid var(--border-soft); background: var(--bg); scrollbar-width: none; }
.chat-quick::-webkit-scrollbar { display: none; }
.chat-quick .chip { flex: none; height: 27px; font-size: 10px; }
.chat-form { display: flex; align-items: center; gap: 5px; flex: none; padding: 9px 11px calc(9px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border-soft); background: var(--bg); }
.chat-form input { flex: 1; min-width: 0; height: 40px; padding: 0 10px; border: 1px solid var(--border-soft); border-radius: 13px; outline: none; background: var(--surface); color: var(--fg); font-size: 12px; }
.chat-form input:focus { border-color: var(--border); box-shadow: var(--focus-ring); background: var(--bg); }
.chat-send { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--accent); color: var(--accent-on); }
.chat-send:disabled { opacity: .45; cursor: not-allowed; }
.chat-card { margin-top: 9px; padding: 10px; border: 1px solid var(--border-soft); border-radius: 13px; background: var(--surface); color: var(--fg); }
.chat-card-head { display: flex; align-items: center; gap: 5px; margin-bottom: 6px; font-size: 10px; }
.chat-card-head .od-icon { color: var(--accent); }
.chat-card-head .level { margin-left: auto; }
.chat-fields { display: grid; gap: 4px; margin: 0 0 8px; }
.chat-fields > div { display: flex; gap: 6px; font-size: 10.5px; line-height: 1.5; }
.chat-fields dt { flex: none; width: 30px; color: var(--muted); }
.chat-fields dd { margin: 0; min-width: 0; }
.chat-draft-text { margin: 0 0 5px; font-size: 11.5px; line-height: 1.6; }
.chat-draft-meta { margin: 0 0 7px; color: var(--muted); font-size: 9.5px; line-height: 1.5; }

/* ─── Non-litigation ──────────────────────────────────────── */
.unit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.unit-card { display: flex; flex-direction: column; gap: 8px; padding: 17px; border: 1px solid var(--border-soft); border-radius: 22px; background: var(--bg); cursor: pointer; transition: transform var(--motion-base) var(--ease-standard), box-shadow var(--motion-base) var(--ease-standard), border-color var(--motion-base) var(--ease-standard); }
.unit-card:hover { transform: translateY(-2px); border-color: var(--border); box-shadow: var(--shadow-card); }
.unit-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.unit-head > div { min-width: 0; }
.unit-head h2 { margin: 4px 0 0; font-size: 17px; font-weight: 700; line-height: 1.3; letter-spacing: -0.015em; }
.unit-head p { margin: 2px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.unit-stats { display: flex; gap: 0; margin: 3px 0; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
.unit-stats > div { display: flex; flex-direction: column; flex: 1; padding: 7px 10px 7px 0; }
.unit-stats > div + div { padding-left: 10px; border-left: 1px solid var(--border-soft); }
.unit-stats strong { font-size: 18px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.unit-stats span { margin-top: 1px; color: var(--muted); font-size: 9px; }
.unit-scope { display: -webkit-box; overflow: hidden; margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.unit-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; color: var(--muted); font-size: 9.5px; }
.unit-foot > span { display: inline-flex; align-items: center; gap: 3px; }
.unit-foot .text-link { margin-left: auto; }
.pending-panel { margin-bottom: 18px; }
.pending-consult { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 11px 0; border-top: 1px solid var(--border-soft); }
.consult-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--surface); color: var(--muted); }
.pending-main { min-width: 0; }
.pending-main strong { font-size: 12px; font-weight: 700; }
.pending-main small { display: block; margin-top: 1px; color: var(--muted); font-size: 9.5px; line-height: 1.5; }
.pending-main p { margin: 4px 0 0; color: var(--fg); font-size: 10.5px; line-height: 1.55; }
.pending-action { display: flex; align-items: center; gap: 6px; }
.pending-action select { max-width: 150px; height: 32px; padding: 0 8px; border: 1px solid var(--border-soft); border-radius: 9px; background: var(--bg); font-size: 10px; }
.consult-list { display: flex; flex-direction: column; }
.consult-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) 52px; gap: 9px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.consult-row:last-child { border-bottom: 0; }
.consult-date { padding-top: 1px; color: var(--muted); font-size: 9.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.consult-main { min-width: 0; }
.consult-main strong { font-size: 11.5px; font-weight: 700; line-height: 1.4; }
.consult-main p { margin: 2px 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.consult-main span { color: var(--muted); font-size: 9px; }
.consult-status { color: var(--success); font-size: 9px; font-weight: 700; text-align: right; }
.consult-status.pending { color: var(--warn-ink); }
.review-queue { display: flex; flex-direction: column; }
.queue-label { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 4px; color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; }
.queue-label span { color: var(--fg); font-variant-numeric: tabular-nums; }
.queue-label-done { margin-top: 18px; }
.review-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
.review-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface); color: var(--muted); }
.review-main { min-width: 0; }
.review-main strong { font-size: 11px; font-weight: 600; line-height: 1.4; }
.review-main small { display: block; margin-top: 1px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.project-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--border-soft); border-radius: 20px; background: var(--bg); cursor: pointer; transition: transform var(--motion-base) var(--ease-standard), box-shadow var(--motion-base) var(--ease-standard); }
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.project-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.project-card h2 { margin: 1px 0; font-size: 15px; font-weight: 700; line-height: 1.4; }
.project-meta { margin: 0; color: var(--muted); font-size: 9.5px; line-height: 1.5; }
.chapter-list { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.chapter { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border-radius: var(--radius-pill); background: var(--surface); color: var(--muted); font-size: 8.5px; font-weight: 600; line-height: 1.4; }
.chapter.done { background: var(--success-soft); color: var(--success); }
.chapter.doing { background: var(--warn-soft); color: var(--warn-ink); }
.project-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 7px; border-top: 1px solid var(--border-soft); color: var(--muted); font-size: 9px; }
.project-foot > span:first-child { display: inline-flex; align-items: center; gap: 3px; }
.report-list { display: flex; flex-direction: column; }
.report-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 9px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.report-row:last-child { border-bottom: 0; }
.report-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface); color: var(--muted); }
.report-row strong { display: block; font-size: 11.5px; font-weight: 700; line-height: 1.4; }
.report-row small { display: block; margin-top: 1px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.report-insights { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.report-insights span { padding: 2px 6px; border-radius: var(--radius-pill); background: var(--warn-soft); color: var(--warn-ink); font-size: 8.5px; line-height: 1.4; }
.chapter-table { display: flex; flex-direction: column; border-top: 1px solid var(--border-soft); margin: 10px 0; }
.chapter-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
.chapter-row > div { display: flex; flex-direction: column; }
.chapter-row strong { font-size: 11px; font-weight: 700; }
.chapter-row small { color: var(--muted); font-size: 9px; }

/* ─── Bidding ─────────────────────────────────────────────── */
.crawl-panel { margin: 0 0 14px; background: var(--surface); }
.crawl-list { display: flex; flex-direction: column; }
.crawl-row { display: grid; grid-template-columns: 124px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border-soft); }
.crawl-source { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.crawl-source .od-icon { color: var(--accent); }
.crawl-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.crawl-main strong { overflow: hidden; font-size: 11.5px; font-weight: 700; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.crawl-main small { overflow: hidden; color: var(--muted); font-size: 9px; line-height: 1.45; white-space: nowrap; text-overflow: ellipsis; }
.crawl-actions { display: flex; align-items: center; gap: 4px; }

.bid-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin-top: 14px; }
.bid-card { display: flex; flex-direction: column; gap: 8px; padding: 17px; border: 1px solid var(--border-soft); border-radius: 22px; background: var(--bg); cursor: pointer; transition: transform var(--motion-base) var(--ease-standard), box-shadow var(--motion-base) var(--ease-standard); }
.bid-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.bid-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bid-card h2 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.4; letter-spacing: -0.01em; }
.bid-metrics { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.bid-facts { display: grid; gap: 4px; flex: 1; min-width: 0; }
.bid-facts > div { display: flex; justify-content: space-between; gap: 6px; font-size: 9.5px; line-height: 1.5; }
.bid-facts span { color: var(--muted); }
.bid-facts strong { font-size: 10px; font-weight: 700; text-align: right; }
.bid-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.bid-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border-soft); }
.donut { display: flex; flex-direction: column; align-items: center; gap: 1px; flex: none; margin: 0; }
.donut figcaption { color: var(--muted); font-size: 8px; line-height: 1.3; }
.donut-val { fill: var(--fg); font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.donut-cap { fill: var(--muted); font-family: var(--font-body); font-size: 7px; }
.donut-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 68px; height: 68px; flex: none; border: 1px dashed var(--border); border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 8px; }
.analysis-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.4fr); gap: 15px; margin-bottom: 14px; }
.match-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 14px; border-radius: 16px; background: var(--surface); text-align: center; }
.match-panel p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.qual-list { display: flex; flex-direction: column; }
.qual-row { display: grid; grid-template-columns: 23px minmax(0, 1fr) auto; gap: 7px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border-soft); }
.qual-row:last-child { border-bottom: 0; }
.qual-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 10px; }
.qual-icon.ok { background: var(--success-soft); color: var(--success); }
.qual-icon.warn { background: var(--warn-soft); color: var(--warn-ink); }
.qual-icon.muted { background: var(--surface); color: var(--muted); }
.qual-row > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.qual-row strong { font-size: 10.5px; font-weight: 700; line-height: 1.4; }
.qual-row small { color: var(--muted); font-size: 9px; line-height: 1.5; }
.analysis-subgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.timeline-mini { display: flex; flex-direction: column; margin-top: 5px; }
.timeline-mini > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border-soft); font-size: 9.5px; }
.timeline-mini span { color: var(--muted); }
.timeline-mini strong { font-size: 9.5px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.risk-list { display: grid; gap: 4px; list-style: none; margin-top: 4px; }
.risk-list li { display: flex; align-items: flex-start; gap: 5px; color: var(--warn-ink); font-size: 9.5px; line-height: 1.55; }
.risk-list .od-icon { margin-top: 1px; flex: none; }
.doc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.doc-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 6px 8px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--surface); color: var(--fg); font-size: 10px; line-height: 1.4; }
.doc-chip > span:nth-child(2) { overflow: hidden; max-width: 230px; white-space: nowrap; text-overflow: ellipsis; }
.status-steps { display: flex; gap: 3px; }
.status-step { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; padding: 6px 2px; border-top: 2px solid var(--border-soft); color: var(--muted); }
.status-step span { display: grid; place-items: center; width: 17px; height: 17px; border: 1px solid var(--border); border-radius: 50%; font-size: 7.5px; font-weight: 700; }
.status-step strong { font-size: 8.5px; font-weight: 700; line-height: 1.3; text-align: center; }
.status-step.current { border-top-color: var(--accent); color: var(--fg); }
.status-step.current span { border-color: var(--accent); background: var(--accent); color: var(--accent-on); }
.status-step.done { border-top-color: var(--fg); color: var(--fg); }
.status-step.done span { border-color: var(--fg); background: var(--fg); color: #fff; }
.library-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.lib-card { padding: 17px; }
.lib-items { display: flex; flex-direction: column; }
.lib-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border-soft); }
.lib-row:last-child { border-bottom: 0; }
.lib-row > div { display: flex; flex-direction: column; min-width: 0; }
.lib-row strong { overflow: hidden; font-size: 10.5px; font-weight: 700; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.lib-row small { overflow: hidden; color: var(--muted); font-size: 8.5px; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.funnel-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-top: 16px; overflow-x: auto; }
.funnel-col { min-width: 150px; padding: 10px; border-radius: 16px; background: var(--surface); }
.funnel-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--fg); font-size: 10.5px; font-weight: 700; }
.funnel-head span { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: var(--radius-pill); background: var(--bg); color: var(--muted); font-size: 8.5px; font-variant-numeric: tabular-nums; }
.funnel-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.funnel-card { display: flex; flex-direction: column; gap: 1px; width: 100%; padding: 7px 8px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg); text-align: left; }
.funnel-card:hover { border-color: var(--border); }
.funnel-card strong { overflow: hidden; font-size: 9.5px; font-weight: 700; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.funnel-card small { color: var(--muted); font-size: 8px; line-height: 1.4; }

/* ─── Agent ───────────────────────────────────────────────── */
.task-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.task-card { display: flex; flex-direction: column; gap: 7px; padding: 16px; border: 1px solid var(--border-soft); border-radius: 20px; background: var(--bg); }
.task-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.task-type { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 9px; font-weight: 700; }
.task-type .od-icon { color: var(--accent); }
.task-card h2 { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.4; }
.task-detail { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.task-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 8.5px; line-height: 1.4; }
.task-meta > span:first-child { overflow: hidden; max-width: 62%; white-space: nowrap; text-overflow: ellipsis; }
.task-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; padding-top: 7px; border-top: 1px solid var(--border-soft); }
.task-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-bottom: 10px; }
.task-detail-grid > div { display: flex; flex-direction: column; gap: 1px; }
.task-detail-grid span { color: var(--muted); font-size: 9px; }
.task-detail-grid strong { font-size: 11px; font-weight: 600; line-height: 1.45; }
.usage-table { display: flex; flex-direction: column; }
.usage-head, .usage-row { display: grid; grid-template-columns: 100px 60px 60px 88px minmax(120px, 1fr) minmax(140px, 1.2fr); gap: 8px; align-items: center; padding: 8px 3px; border-bottom: 1px solid var(--border-soft); }
.usage-head { color: var(--muted); font-size: 9px; font-weight: 700; }
.usage-row { font-size: 10px; line-height: 1.5; }
.usage-row > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.usage-row > span:first-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.model-card { padding: 16px; border: 1px solid var(--border-soft); border-radius: 20px; background: var(--bg); }
.model-card.is-default { border-color: var(--fg); }
.model-head { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 8px; }
.model-logo { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--surface); color: var(--accent); }
.model-head > div { flex: 1; min-width: 0; }
.model-head h2 { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.35; }
.model-head p { margin: 1px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.model-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border-soft); font-size: 9px; }
.model-meta span { flex: none; color: var(--muted); }
.model-meta code { overflow: hidden; font-family: var(--font-mono); font-size: 8px; white-space: nowrap; text-overflow: ellipsis; }
.model-meta strong { font-size: 9px; font-weight: 600; }
.model-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.model-actions { display: flex; align-items: center; gap: 5px; }
.switch-label { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 9.5px; }
.switch-label input { accent-color: var(--accent); }
.switch { position: relative; display: inline-block; width: 36px; height: 21px; flex: none; border-radius: var(--radius-pill); background: var(--border-soft); transition: background var(--motion-fast) var(--ease-standard); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: var(--bg); transition: transform var(--motion-fast) var(--ease-standard); }
.switch.on { background: var(--fg); }
.switch.on::after { transform: translateX(15px); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.skill-list { display: flex; flex-direction: column; }
.skill-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.skill-row:last-child { border-bottom: 0; }
.skill-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface); color: var(--muted); }
.skill-row > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.skill-row strong { font-size: 11px; font-weight: 700; }
.skill-row small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.config-lock { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 14px; padding: 13px; border: 1px solid var(--border-soft); border-radius: 14px; background: var(--surface); color: var(--muted); font-size: 11px; line-height: 1.55; }
.config-lock > .od-icon { margin-top: 1px; color: var(--warn-ink); }
.config-lock strong { display: block; color: var(--fg); font-size: 11.5px; }
.config-lock p { margin: 2px 0 0; }

/* ─── Alerts ─────────────────────────────────────────────── */
.alert-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-card { padding: 13px; border: 1px solid var(--border-soft); border-radius: 16px; background: var(--bg); }
.alert-card.is-pending { border-style: dashed; border-color: color-mix(in oklab, var(--warn), white 30%); background: color-mix(in oklab, var(--warn-soft), white 35%); }
.alert-card.is-done { opacity: .72; }
.alert-top { display: flex; align-items: flex-start; gap: 8px; }
.alert-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--surface); }
.alert-icon.level-red { background: var(--danger-soft); color: var(--danger); }
.alert-icon.level-yellow { background: var(--warn-soft); color: var(--warn-ink); }
.alert-icon.level-green { background: var(--success-soft); color: var(--success); }
.alert-icon.level-muted { background: var(--surface); color: var(--muted); }
.alert-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.alert-title strong { font-size: 12px; font-weight: 700; line-height: 1.45; }
.alert-title span { color: var(--muted); font-size: 9px; line-height: 1.45; }
.alert-top > .level, .alert-top > .tag { flex: none; margin-left: auto; }
.alert-note { margin: 7px 0 0 40px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.pending-check, .suggest-done { display: flex; align-items: flex-start; gap: 5px; margin: 7px 0 0 40px; padding: 6px 8px; border-radius: 8px; font-size: 9px; line-height: 1.5; }
.pending-check { background: var(--warn-soft); color: var(--warn-ink); }
.suggest-done { background: var(--success-soft); color: var(--success); }
.pending-check .od-icon, .suggest-done .od-icon { margin-top: 1px; flex: none; }
.alert-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--border-soft); }
.anchor-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 4px 7px; border-radius: var(--radius-pill); background: var(--surface); color: var(--muted); font-size: 9px; font-weight: 600; line-height: 1.4; }
.anchor-chip:hover { background: var(--surface-warm); color: var(--fg); }
.alert-actions { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.level-summary { display: flex; flex-direction: column; gap: 4px; }
.level-summary-row { display: grid; grid-template-columns: 62px 38px minmax(0, 1fr); gap: 6px; align-items: center; font-size: 9.5px; }
.level-summary-row > span:nth-child(2) { color: var(--muted); font-variant-numeric: tabular-nums; }
.level-bar { display: block; height: 5px; overflow: hidden; border-radius: var(--radius-pill); background: var(--surface); }
.level-fill { display: block; height: 100%; border-radius: inherit; }
.level-fill-red { background: var(--accent); }
.level-fill-yellow { background: var(--warn); }
.level-fill-green { background: var(--success); }

/* ─── Messages ───────────────────────────────────────────── */
.msg-layout { display: grid; grid-template-columns: 370px minmax(0, 1fr); gap: 16px; align-items: start; }
.msg-list-panel { padding: 12px; }
.msg-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 3px 9px; }
.msg-list { display: flex; flex-direction: column; gap: 1px; max-height: calc(100vh - 270px); overflow-y: auto; }
.msg-row { display: flex; align-items: flex-start; gap: 8px; width: 100%; padding: 9px 7px; border-radius: 12px; text-align: left; }
.msg-row:hover { background: var(--surface); }
.msg-row.active { background: var(--surface-warm); }
.msg-row.unread { background: color-mix(in oklab, var(--surface), white 35%); }
.msg-row.unread.active { background: var(--surface-warm); }
.msg-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.msg-row-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.msg-row-top strong { font-size: 10.5px; font-weight: 700; line-height: 1.4; }
.msg-row-top small { color: var(--muted); font-size: 8px; white-space: nowrap; }
.msg-row-body { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 9.5px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.msg-row-bottom { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.anchor-mini { display: inline-flex; align-items: center; gap: 3px; overflow: hidden; max-width: 72%; color: var(--muted); font-size: 8px; white-space: nowrap; text-overflow: ellipsis; }
.msg-state { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 8px; font-weight: 700; white-space: nowrap; }
.msg-detail-panel { min-height: 440px; padding: 20px; }
.msg-detail-head { display: flex; align-items: center; gap: 9px; padding-bottom: 12px; border-bottom: 1px solid var(--border-soft); }
.msg-detail-from { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.msg-detail-from strong { font-size: 13px; font-weight: 700; line-height: 1.4; }
.msg-detail-from span { color: var(--muted); font-size: 9.5px; line-height: 1.45; }
.msg-body { margin: 14px 0; color: var(--fg); font-size: 13px; line-height: 1.75; white-space: pre-line; overflow-wrap: anywhere; }
.anchor-card { padding: 12px; border: 1px solid var(--border-soft); border-radius: 14px; background: var(--surface); }
.anchor-head { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 9px; }
.anchor-head .od-icon { color: var(--accent); }
.anchor-head strong { color: var(--muted); font-size: 9px; }
.anchor-head .tag { margin-left: auto; }
.anchor-title { display: block; margin: 5px 0 2px; font-size: 12.5px; font-weight: 700; line-height: 1.4; }
.anchor-card p { margin: 0; color: var(--muted); font-size: 9.5px; line-height: 1.5; }
.anchor-card .anchor-doc { display: flex; align-items: center; gap: 3px; margin-top: 3px; }
.anchor-card .btn { margin-top: 8px; }
.reply-list { margin-top: 15px; }
.reply-list > .eyebrow { margin-bottom: 4px; }
.reply-row { display: flex; gap: 7px; align-items: flex-start; padding: 7px 0; border-top: 1px solid var(--border-soft); }
.reply-row > div { flex: 1; min-width: 0; }
.reply-row strong { font-size: 9.5px; }
.reply-row p { margin: 1px 0 0; color: var(--fg); font-size: 10.5px; line-height: 1.55; }
.reply-row time { color: var(--muted); font-size: 8px; white-space: nowrap; }
.reply-form { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.reply-form textarea { width: 100%; min-height: 48px; padding: 8px 10px; border: 1px solid var(--border-soft); border-radius: 10px; outline: none; background: var(--bg); font-size: 11px; line-height: 1.55; resize: vertical; }
.reply-form textarea:focus { border-color: var(--fg); box-shadow: var(--focus-ring); }
.reply-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }

/* ─── Reports ─────────────────────────────────────────────── */
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart-card { padding: 18px; }
.chart-span { grid-column: 1 / -1; }
.chart-figure { margin: 0; }
.chart-svg { display: block; width: 100%; height: auto; }
.chart-label { fill: var(--muted); font-family: var(--font-body); font-size: 9.5px; }
.chart-value { fill: var(--fg); font-family: var(--font-display); font-size: 9.5px; font-weight: 700; }
.chart-figure figcaption { margin-top: 4px; color: var(--muted); font-size: 9px; }
.chart-note { margin: 10px 0 0; color: var(--muted); font-size: 9.5px; line-height: 1.55; }
.mix-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.mix-legend { display: grid; gap: 5px; font-size: 10px; }
.mix-legend span { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.mix-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; }
.mix-legend strong { color: var(--fg); font-size: 10px; }
.funnel-chart { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.funnel-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) 22px; gap: 7px; align-items: center; font-size: 9.5px; }
.funnel-row > span { color: var(--muted); }
.funnel-track { height: 11px; overflow: hidden; border-radius: var(--radius-pill); background: var(--surface); }
.funnel-track i { display: block; height: 100%; border-radius: inherit; background: var(--fg); }
.funnel-row strong { font-size: 10px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.volume-chart { display: flex; flex-direction: column; gap: 9px; margin-top: 3px; }
.volume-row { display: flex; flex-direction: column; gap: 2px; }
.volume-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; font-size: 9.5px; }
.volume-head strong { font-size: 10px; }
.volume-head span { color: var(--muted); font-variant-numeric: tabular-nums; }
.volume-track { display: flex; gap: 2px; height: 9px; overflow: hidden; border-radius: var(--radius-pill); background: var(--surface); }
.volume-track i { display: block; height: 100%; }
.vol-consult { background: var(--fg); }
.vol-review { background: var(--accent); }
.volume-row small { color: var(--muted); font-size: 8.5px; }
.volume-legend { display: flex; gap: 10px; margin-top: 8px; color: var(--muted); font-size: 9px; }
.volume-legend span { display: inline-flex; align-items: center; gap: 4px; }
.volume-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; }
.attention-list { display: flex; flex-direction: column; }
.attention-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(90px, 1fr) 48px; gap: 9px; align-items: center; width: 100%; padding: 7px 0; border-bottom: 1px solid var(--border-soft); text-align: left; }
.attention-row:last-child { border-bottom: 0; }
.attention-name { overflow: hidden; font-size: 10px; font-weight: 500; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.attention-bar { height: 7px; overflow: hidden; border-radius: var(--radius-pill); background: var(--surface); }
.attention-bar i { display: block; height: 100%; border-radius: inherit; background: var(--fg); }
.attention-val { color: var(--muted); font-size: 9.5px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.mini-stats { display: flex; gap: 6px; margin: 5px 0 7px; }
.mini-stats > div { display: flex; flex-direction: column; flex: 1; align-items: center; padding: 9px 4px; border-radius: 11px; background: var(--surface); }
.mini-stats strong { font-size: 19px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mini-stats span { color: var(--muted); font-size: 8px; }
.permission-panel { max-width: 540px; margin: 70px auto; padding: 34px 26px; border: 1px solid var(--border-soft); border-radius: var(--radius-lg); background: var(--surface); text-align: center; }
.permission-panel h1 { margin: 0 0 7px; font-size: 22px; font-weight: 700; line-height: 1.35; letter-spacing: -0.02em; }
.permission-panel p { margin: 0 0 16px; color: var(--muted); font-size: 11.5px; line-height: 1.65; }

/* ─── External portal ────────────────────────────────────── */
.external-app { min-height: 100vh; background: var(--surface); }
.external-screen { min-height: 100vh; }
.ext-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: calc(64px + var(--safe-top));
  padding: var(--safe-top) 28px 0;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg);
}
.ext-user { display: flex; align-items: center; gap: 7px; }
.ext-isolation { display: inline-flex; align-items: center; gap: 3px; padding: 4px 7px; border-radius: var(--radius-pill); background: var(--success-soft); color: var(--success); font-size: 9px; font-weight: 700; }
.ext-main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 36px 28px 64px; }
.ext-hero { margin-bottom: 24px; }
.ext-hero h1 { margin: 8px 0 10px; font-size: 44px; font-weight: 700; line-height: 1.14; letter-spacing: -0.035em; }
.ext-hero .lede { max-width: 62ch; }
.ext-steps { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 18px; }
.ext-step { display: flex; align-items: center; gap: 5px; padding: 5px 9px; border: 1px solid var(--border-soft); border-radius: var(--radius-pill); background: var(--bg); color: var(--muted); font-size: 9.5px; }
.ext-step span { display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 8px; font-weight: 700; }
.ext-step strong { font-weight: 700; }
.ext-step.current { border-color: var(--fg); background: var(--fg); color: #fff; }
.ext-step.current span { background: var(--bg); color: var(--fg); }
.ext-step.done { border-color: transparent; background: var(--success-soft); color: var(--success); }
.ext-step.done span { background: var(--success); color: #fff; }
.ext-grid { display: grid; grid-template-columns: minmax(0, 1.13fr) minmax(300px, .87fr); gap: 18px; align-items: start; }
.ext-panel { padding: 20px; border: 1px solid var(--border-soft); border-radius: 24px; background: var(--bg); }
.ext-form-panel { padding: 22px; }
.ext-side { display: flex; flex-direction: column; gap: 13px; }
.ext-record-list { display: flex; flex-direction: column; gap: 5px; }
.ext-record { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 9px; border: 1px solid transparent; border-radius: 12px; background: var(--surface); text-align: left; }
.ext-record:hover { border-color: var(--border); }
.ext-record.active { border-color: var(--fg); background: var(--bg); }
.ext-record-top { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.ext-record-top strong { overflow: hidden; font-size: 10.5px; font-weight: 700; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.ext-record-meta { color: var(--muted); font-size: 8.5px; line-height: 1.45; }
.ext-out-list { display: flex; flex-direction: column; }
.ext-out-row { display: grid; grid-template-columns: 27px minmax(0, 1fr) auto auto; gap: 7px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border-soft); }
.ext-out-row:last-child { border-bottom: 0; }
.ext-out-row > div { display: flex; flex-direction: column; min-width: 0; }
.ext-out-row strong { overflow: hidden; font-size: 10px; font-weight: 600; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.ext-out-row small { color: var(--muted); font-size: 8px; }
.ext-note { display: flex; align-items: flex-start; gap: 4px; margin: 8px 0 0; color: var(--muted); font-size: 8.5px; line-height: 1.5; }
.ext-note-box { padding: 12px; border: 1px dashed var(--border); border-radius: 14px; background: var(--bg); font-size: 10px; line-height: 1.55; }
.ext-note-box .od-icon { margin-top: 1px; color: var(--muted); }

/* ─── Login ──────────────────────────────────────────────── */
.login-layer { position: fixed; inset: 0; z-index: 120; display: grid; grid-template-columns: 1.02fr .98fr; overflow-y: auto; background: var(--bg); }
.login-intro {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 46px 52px;
  background: var(--fg);
  color: #fff;
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 52px; }
.login-brand > div { display: flex; flex-direction: column; gap: 1px; }
.login-brand strong { color: #fff; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.login-brand span { color: rgba(255, 255, 255, .62); font-size: 10px; letter-spacing: 0.03em; }
.login-intro .eyebrow { color: rgba(255, 255, 255, .52); }
.login-intro h1 { margin: 7px 0 16px; color: #fff; font-size: 44px; font-weight: 700; line-height: 1.15; letter-spacing: -0.035em; }
.login-lede { max-width: 46ch; margin: 0; color: rgba(255, 255, 255, .7); font-size: 14px; line-height: 1.75; }
.login-points { display: grid; gap: 15px; margin: 34px 0; padding: 0; list-style: none; }
.login-points li { display: flex; align-items: flex-start; gap: 9px; color: rgba(255, 255, 255, .68); font-size: 11px; line-height: 1.6; }
.login-points .od-icon { margin-top: 1px; flex: none; color: var(--surface-warm); }
.login-points strong { display: block; margin-bottom: 1px; color: #fff; font-size: 11px; font-weight: 700; }
.login-foot { margin-top: auto; color: rgba(255, 255, 255, .4); font-size: 9.5px; line-height: 1.5; letter-spacing: 0.02em; }
.login-panel { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; padding: 46px 52px; background: var(--bg); }
.login-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.login-panel-head h2 { margin: 3px 0 0; font-size: 28px; font-weight: 700; line-height: 1.2; letter-spacing: -0.025em; }
.login-panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.account-list { display: flex; flex-direction: column; gap: 8px; }
.account-card { display: flex; align-items: center; gap: 11px; width: 100%; padding: 12px; border: 1px solid var(--border-soft); border-radius: 16px; background: var(--bg); text-align: left; transition: border-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard), transform var(--motion-fast) var(--ease-standard); }
.account-card:hover { border-color: var(--fg); box-shadow: var(--shadow-card); transform: translateY(-1px); }
.account-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.account-name { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 12.5px; font-weight: 700; line-height: 1.4; }
.account-desc { color: var(--muted); font-size: 9.5px; line-height: 1.5; }
.account-enter { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--surface); color: var(--muted); }
.account-card:hover .account-enter { background: var(--fg); color: #fff; }
.lock-inline { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 8.5px; font-weight: 500; }
.login-note { display: flex; align-items: flex-start; gap: 4px; margin: 18px 0 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.login-note .od-icon { margin-top: 1px; flex: none; }

/* ─── Mobile bottom nav ──────────────────────────────────── */
.bottom-nav { display: none; }
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  min-height: 52px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}
.bottom-nav-item .od-icon { color: currentColor; }
.bottom-nav-item.active { color: var(--fg); }
.bottom-nav-item.active .od-icon { color: var(--accent); }

/* ─── Animations ─────────────────────────────────────────── */
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.main > * { animation: fade-up 280ms var(--ease-standard) both; }
.main > *:nth-child(2) { animation-delay: 30ms; }
.main > *:nth-child(3) { animation-delay: 60ms; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ═══════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1320px) {
  .topbar { grid-template-columns: 220px minmax(0, 1fr) auto; gap: 16px; }
  :root { --sidebar-w: 220px; }
  .main { padding: 24px 26px 64px; }
  .home-grid { grid-template-columns: minmax(0, 1fr) 306px; gap: 18px; }
  .user-role { display: none; }
  .ledger-head, .ledger-row { grid-template-columns: minmax(0, 2.1fr) minmax(0, 1.1fr) minmax(0, .95fr) minmax(0, .85fr) minmax(0, .75fr); }
  .ledger-head > span:nth-child(2), .ledger-row .ledger-court { display: none; }
}

@media (max-width: 1180px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-rail {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
  .detail-grid { grid-template-columns: 1fr; }
  .side-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .alert-layout { grid-template-columns: 1fr; }
  .alert-layout > .side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-btn kbd { display: none; }
  .msg-layout { grid-template-columns: 330px minmax(0, 1fr); }
  .ext-grid { grid-template-columns: 1fr; }
  .ext-side { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
}

@media (max-width: 1024px) {
  .topbar { grid-template-columns: 204px minmax(0, 1fr) auto; padding: var(--safe-top) 18px 0; gap: 12px; }
  :root { --sidebar-w: 204px; }
  .main { padding: 22px 22px 60px; }
  .search-box { height: 38px; }
  .calendar { padding: 11px 18px; }
  .cal-month { width: 160px; }
  .cal-month strong { font-size: 19px; }
  .cal-day { flex-basis: 54px; }
  .cal-summary .text-link { font-size: 10px; }
  .case-grid { gap: 10px; }
  .panel { padding: 18px; }
  .stat { padding: 12px 14px; }
  .stat:first-child { padding-left: 0; }
  .stat-num { font-size: 24px; }
  .unit-grid, .project-grid, .bid-grid, .task-grid, .library-grid, .model-grid { gap: 10px; }
  .report-grid { gap: 12px; }
}

@media (max-width: 900px) {
  :root { --topbar-h: 60px; --calendar-h: 88px; }
  .app-body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 20px 20px calc(76px + env(safe-area-inset-bottom)); }
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .top-search { max-width: 100%; }
  .mobile-subnav {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    margin: -2px 0 14px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .mobile-subnav::-webkit-scrollbar { display: none; }
  .mobile-subnav .chip { flex: none; }
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    align-items: stretch;
    height: calc(60px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--border-soft);
    background: color-mix(in oklab, var(--bg), transparent 3%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .calendar { top: calc(var(--topbar-h) + var(--safe-top)); min-height: 88px; padding: 10px 18px; }
  .cal-day { height: 66px; flex-basis: 54px; }
  .cal-day { grid-template-rows: 10px 20px 15px; }
  .home-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grid { grid-template-columns: 1fr; }
  .chart-span { grid-column: auto; }
  .msg-layout { grid-template-columns: 1fr; }
  .msg-list { max-height: 300px; }
  .msg-detail-panel { min-height: 340px; }
  .ext-side { grid-template-columns: 1fr; }
  .login-layer { grid-template-columns: 1fr; }
  .login-intro { min-height: auto; padding: 32px 30px; padding-top: calc(32px + var(--safe-top)); }
  .login-brand { margin-bottom: 28px; }
  .login-intro h1 { font-size: 34px; }
  .login-lede { font-size: 13px; }
  .login-points { margin: 22px 0; gap: 10px; }
  .login-foot { margin-top: 20px; }
  .login-panel { min-height: auto; padding: 32px 30px 44px; padding-top: calc(32px + var(--safe-top)); justify-content: flex-start; }
  .ext-hero h1 { font-size: 34px; }
  .ext-header { padding: 0 20px; }
  .ext-main { padding: 28px 20px 52px; }
  .toast { bottom: calc(72px + env(safe-area-inset-bottom)); }
}

@media (max-width: 760px) {
  .topbar { gap: 8px; padding: var(--safe-top) 14px 0; }
  .brand-sub { display: none; }
  .brand-name { font-size: 13px; }
  .top-search { display: none; }
  .ai-btn { width: 38px; padding: 0; justify-content: center; }
  .ai-btn span, .ai-btn kbd { display: none; }
  .user-name { display: none; }
  .user-menu > summary { padding: 3px; }
  .user-menu > summary > .od-icon { display: none; }
  .icon-btn { width: 38px; height: 38px; }
  .calendar { padding: 9px 14px; gap: 0; }
  .cal-month, .cal-summary { display: none; }
  .cal-rail { gap: 2px; }
  .cal-day { flex-basis: 50px; height: 64px; padding: 5px 6px; }
  .cal-day .num { font-size: 14px; }
  .cal-day .ev { font-size: 8px; padding: 1px 4px; }
  .main { padding: 18px 14px calc(76px + env(safe-area-inset-bottom)); }
  .page-title { font-size: 24px; }
  .case-title-lg { font-size: 24px; }
  .lede { font-size: 13px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .home-head .page-title { font-size: 26px; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .stat { padding: 11px 12px; }
  .stat:first-child { padding-left: 12px; }
  .stat:nth-child(3) { border-left: 0; border-top: 1px solid var(--border-soft); }
  .stat:nth-child(4) { border-top: 1px solid var(--border-soft); }
  .stat-num { font-size: 23px; }
  .case-grid { grid-template-columns: 1fr; }
  .home-rail { grid-template-columns: 1fr; }
  .board-head { align-items: flex-start; }
  .board-tools { width: 100%; justify-content: space-between; }
  .case-card { padding: 15px; border-radius: 20px; }
  .ledger-head { display: none; }
  .ledger-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px 2px;
  }
  .ledger-row .ledger-court { display: flex; }
  .ledger-cell { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 6px; align-items: baseline; font-size: 10.5px; }
  .ledger-cell > span:not(.cell-label), .ledger-cell > small { white-space: normal; }
  .ledger-cell small { grid-column: 2; }
  .cell-label { display: block; }
  .ledger-row .level { grid-column: 1; justify-self: start; margin-top: 2px; }
  .ledger-full .ledger-title { font-size: 12px; white-space: normal; }
  .detail-grid { gap: 14px; }
  .side-stack { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .fact:nth-child(odd) { padding-right: 0; }
  .fact:nth-child(even) { padding-left: 0; border-left: 0; }
  .case-head-actions { width: 100%; }
  .case-head-actions .btn { flex: 1; }
  .case-banner { align-items: flex-start; }
  .case-banner .text-link { margin-left: 27px; }
  .file-row { grid-template-columns: 32px minmax(0, 1fr) 16px; }
  .file-col { display: none; }
  .file-open { grid-column: 3; }
  .output-row { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .output-status { display: none; }
  .change-body { padding-left: 0; }
  .stage-grid { grid-template-columns: 1fr; }
  .stage-card { padding: 12px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .dist-inputs { grid-template-columns: repeat(2, 1fr); }
  .analysis-grid, .analysis-subgrid { grid-template-columns: 1fr; }
  .bid-grid, .unit-grid, .project-grid, .task-grid, .library-grid, .model-grid { grid-template-columns: 1fr; }
  .crawl-row { grid-template-columns: 1fr; gap: 5px; }
  .crawl-actions { justify-content: flex-start; }
  .crawl-main strong, .crawl-main small { white-space: normal; }
  .pending-consult { grid-template-columns: 26px minmax(0, 1fr); }
  .pending-action { grid-column: 1 / -1; justify-content: flex-start; }
  .pending-action select { flex: 1; max-width: none; }
  .unit-stats > div { padding: 6px 7px 6px 0; }
  .review-row { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .review-row .tag { display: none; }
  .usage-head { display: none; }
  .usage-row { grid-template-columns: 1fr 1fr; gap: 3px 8px; padding: 9px 0; }
  .usage-row > span:nth-child(1)::before { content: "时间 · "; color: var(--muted); font-weight: 400; }
  .usage-row > span:nth-child(2)::before { content: "律师 · "; color: var(--muted); font-weight: 400; }
  .usage-row > span:nth-child(4)::before { content: "模型 · "; color: var(--muted); font-weight: 400; }
  .usage-row > span:nth-child(5) { grid-column: 1 / -1; }
  .usage-row > span:nth-child(6) { grid-column: 1 / -1; color: var(--muted); }
  .alert-layout > .side-stack { grid-template-columns: 1fr; }
  .alert-note, .pending-check, .suggest-done { margin-left: 0; }
  .alert-foot { align-items: flex-start; }
  .alert-actions { margin-left: 0; }
  .msg-layout { gap: 12px; }
  .msg-list-panel { padding: 10px; }
  .msg-list { max-height: 260px; }
  .msg-detail-panel { padding: 16px; min-height: 0; }
  .msg-body { font-size: 12px; }
  .chart-card { padding: 15px; }
  .mix-wrap { gap: 10px; }
  .attention-row { grid-template-columns: minmax(0, 1.3fr) 1fr 42px; }
  .ext-header { height: calc(58px + var(--safe-top)); padding: var(--safe-top) 14px 0; gap: 8px; }
  .ext-header .brand-sub { display: none; }
  .ext-isolation, .ext-user .user-name { display: none; }
  .ext-main { padding: 22px 14px 48px; }
  .ext-hero h1 { font-size: 30px; }
  .ext-hero .lede { font-size: 13px; }
  .ext-panel { padding: 16px; border-radius: 20px; }
  .ext-form-panel { padding: 17px; }
  .login-intro { padding: 24px 20px 26px; padding-top: calc(24px + var(--safe-top)); }
  .login-brand { margin-bottom: 22px; }
  .login-intro h1 { font-size: 29px; }
  .login-intro h1 br { display: none; }
  .login-points { display: none; }
  .login-foot { margin-top: 16px; }
  .login-panel { padding: 24px 20px 36px; }
  .login-panel-head { flex-direction: column; align-items: flex-start; }
  .login-panel-head h2 { font-size: 24px; }
  .login-panel-head .btn { margin-top: 2px; }
  .account-card { padding: 11px; }
  .modal { width: calc(100vw - 20px); }
  .modal-card { padding: 16px; border-radius: 20px; max-height: 92vh; }
  .modal-head h2 { font-size: 19px; }
  .toast { width: max-content; max-width: calc(100vw - 28px); }
}

@media (max-width: 560px) {
  .topbar { height: calc(56px + var(--safe-top)); }
  :root { --topbar-h: 56px; --calendar-h: 82px; }
  .calendar { top: calc(var(--topbar-h) + var(--safe-top)); min-height: 82px; padding: 8px 12px; }
  .cal-day { flex-basis: 46px; height: 58px; padding: 4px 5px; grid-template-rows: 9px 18px 14px; }
  .cal-day .dow { font-size: 8.5px; }
  .cal-day .num { font-size: 13px; }
  .cal-day .ev { font-size: 7.5px; padding: 1px 3px; }
  .brand-seal { width: 29px; height: 29px; border-radius: 9px; font-size: 16px; }
  .brand-name { font-size: 12px; }
  .top-actions { gap: 0; }
  .icon-btn { width: 36px; height: 36px; }
  .user-menu { margin-left: 0; }
  .avatar { width: 29px; height: 29px; font-size: 11px; }
  .main { padding: 16px 12px calc(76px + env(safe-area-inset-bottom)); }
  .page-head { gap: 14px; margin-bottom: 16px; }
  .home-head { margin-bottom: 14px; }
  .home-head .page-title { font-size: 24px; }
  .case-title-lg { font-size: 22px; }
  .stat-strip { margin-bottom: 18px; }
  .stat { padding: 9px 10px; }
  .stat-num { font-size: 21px; }
  .stat-label { font-size: 10px; }
  .stat-note { font-size: 9px; }
  .panel { padding: 14px; border-radius: 22px; }
  .panel-title { font-size: 16px; }
  .case-card { padding: 14px; border-radius: 18px; }
  .case-title { font-size: 16px; }
  .deadline { padding: 8px 10px; }
  .deadline-date { font-size: 14px; }
  .case-meta { gap: 3px; }
  .case-foot { flex-wrap: wrap; }
  .rail-card { padding: 13px; border-radius: 18px; }
  .case-head-actions .btn { height: 38px; font-size: 12px; padding: 0 11px; }
  .case-head-actions { gap: 5px; }
  .case-head-actions .btn-primary { flex: 1 0 100%; }
  .case-banner-main strong { font-size: 11.5px; }
  .case-banner-main span { font-size: 10px; }
  .tabs { margin-bottom: 14px; }
  .tab { padding: 8px 9px 9px; font-size: 11px; }
  .side-stack .panel { padding: 14px; }
  .panel-head { margin-bottom: 12px; gap: 9px; }
  .panel-sub { font-size: 10.5px; }
  .btn { height: 38px; font-size: 12px; padding: 0 13px; }
  .btn-sm { height: 30px; padding: 0 9px; font-size: 10px; }
  .head-actions .btn { min-width: 0; }
  .ledger-row { padding: 10px 0; }
  .msg-row-top strong { font-size: 10px; }
  .msg-row-body { font-size: 9px; }
  .msg-list { max-height: 230px; }
  .msg-body { font-size: 11.5px; }
  .anchor-card { padding: 10px; }
  .usage-row { grid-template-columns: 1fr; }
  .usage-row > span:nth-child(6) { grid-column: auto; }
  .analysis-grid, .analysis-subgrid { gap: 10px; }
  .bid-metrics { gap: 8px; }
  .ext-hero h1 { font-size: 27px; }
  .ext-step { font-size: 8.5px; padding: 4px 7px; }
  .ext-step span { width: 15px; height: 15px; font-size: 7px; }
  .ext-main { padding: 18px 12px 44px; }
  .login-intro { padding: 20px 16px 22px; padding-top: calc(20px + var(--safe-top)); }
  .login-intro h1 { font-size: 25px; }
  .login-lede { font-size: 12px; }
  .login-panel { padding: 20px 16px 30px; padding-top: calc(20px + var(--safe-top)); }
  .login-panel-head h2 { font-size: 22px; }
  .account-card { padding: 10px; border-radius: 14px; }
  .account-desc { font-size: 9px; }
  .bottom-nav-item { font-size: 8px; }
  .bottom-nav-item .od-icon { --od-icon-size: 18px !important; }
  .chat-dialog { width: 100vw; max-width: 100vw; border-left: 0; }
  .toast { font-size: 10.5px; padding: 8px 12px; }
}

/* ─── Touch sizing (mobile) ──────────────────────────────── */
@media (max-width: 760px) {
  .icon-btn, .ai-btn { width: 44px; height: 44px; }
  .brand { min-height: 44px; }
  .user-menu > summary { min-height: 44px; }
  .btn, .case-head-actions .btn { height: 44px; }
  .btn-sm { height: 34px; }
  .chip { height: 34px; }
  .tab { padding-top: 12px; padding-bottom: 12px; }
  .select-wrap select { height: 36px; }
  .field input, .field select, .field textarea { min-height: 44px; }
  .text-btn { min-height: 32px; padding: 6px 2px; }
  .segment span { padding: 10px 6px; }
  .todo-row { min-height: 44px; }
  .topbar { padding: var(--safe-top) 12px 0; }
}

@media (max-width: 760px) {
  .chat-form input { height: 44px; }
  .chat-send { width: 44px; height: 44px; }
  .chat-quick .chip { height: 34px; }
}

@media (max-width: 760px) {
  .field input, .field select, .field textarea,
  .chat-form input, .log-composer textarea, .reply-form textarea,
  .pending-action select, .select-wrap select { font-size: 16px; }
  .pending-action select { height: 44px; }
}

@media (max-width: 760px) {
  .chart-figure, .relation { overflow-x: auto; }
  .chart-svg, .relation-svg { min-width: 520px; }
}
