:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --ink: #17212d;
  --ink-2: #2c3a4a;
  --muted: #6c6f74;
  --line: #e7e1d6;
  --line-strong: #d6cdbd;
  --accent: #a4532e;
  --accent-dark: #7e3b1d;
  --accent-soft: #f7e9df;
  --ok: #2d7650;
  --ok-soft: #e4f2ea;
  --warn: #a86b12;
  --warn-soft: #fbf0da;
  --bad: #b03a2e;
  --bad-soft: #fae5e1;
  --run: #2f5f8f;
  --run-soft: #e4edf6;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(23, 33, 45, 0.04), 0 8px 24px rgba(23, 33, 45, 0.05);
  --shadow-lg: 0 2px 6px rgba(23, 33, 45, 0.05), 0 24px 60px rgba(23, 33, 45, 0.12);
  --serif: "Iowan Old Style", Palatino, "Hiragino Mincho ProN", "Noto Serif JP", serif;
  --sans: -apple-system, "Hiragino Sans", "Noto Sans JP", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(164, 83, 46, 0.07), transparent 60%),
    var(--bg);
  color: var(--ink);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 0.35rem; }
h2 { font-size: 1.15rem; margin: 0; }
h3 { font-size: 1rem; margin: 0 0 0.3rem; }
p { margin: 0.4rem 0; }
code {
  font: 0.82rem/1.4 ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.05rem 0.4rem;
  color: var(--ink-2);
}
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.hint { color: var(--muted); font-size: 0.92rem; }
.empty { color: var(--muted); padding: 1.2rem 0; text-align: center; }
.error { color: var(--bad); font-weight: 500; }
.over { color: var(--bad); font-weight: 600; }
.detail { white-space: pre-wrap; color: var(--muted); font-size: 0.9rem; }

/* Header */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, #1a2532 0%, #151e29 100%);
  color: #eef0f2;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 6px 20px rgba(10, 16, 24, 0.18);
}
.top-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.75rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 2.25rem;
}
.top a { color: inherit; text-decoration: none; }
.brand { display: inline-flex; align-items: center; gap: 0.65rem; font-family: var(--serif); font-size: 1.2rem; letter-spacing: 0.01em; white-space: nowrap; }
.nav-links { display: flex; gap: 0.35rem; align-items: center; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  position: relative;
  flex: none;
  white-space: nowrap;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  color: #c4cad2;
  font-size: 0.93rem;
  letter-spacing: 0.02em;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }
.nav-links a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.11); }
.nav-links a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.78rem;
  width: 1.5rem;
  height: 2px;
  margin-left: -0.75rem;
  background: #d9824f;
  border-radius: 2px;
}
.top-tools { display: flex; align-items: center; gap: 0.9rem; margin-left: auto; }
.top-tools form { margin: 0; }
.who { color: #9aa3ad; font-size: 0.85rem; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.lang button {
  border: 0;
  background: transparent;
  color: #b7bec7;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: none;
}
.lang button:hover { color: #fff; background: transparent; }
.lang button[aria-current="true"] { background: #f4f1ea; color: var(--ink); }
.top .ghost { background: transparent; color: #dfe3e8; border-color: rgba(255, 255, 255, 0.22); box-shadow: none; }
.top .ghost:hover { background: rgba(255, 255, 255, 0.08); color: #fff; border-color: rgba(255, 255, 255, 0.35); }

/* Layout */
main { max-width: 1240px; margin: 0 auto; padding: 2.25rem 1.75rem 4rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; margin-bottom: 1.6rem; }
.page-head p { color: var(--muted); margin: 0; max-width: 46rem; }
.head-actions { display: flex; align-items: center; gap: 0.75rem; }
.eyebrow { margin: 0 0 0.3rem; color: var(--accent); letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.72rem; font-weight: 600; }
.crumb { color: var(--muted); font-size: 0.88rem; margin: 0 0 0.6rem; }
.crumb a { color: var(--muted); }
.stack { display: grid; gap: 1.25rem; align-content: start; }
.grid { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-wide { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.grid-users { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 18.5rem; gap: 1.25rem; align-items: start; }
.review { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; margin-bottom: 1.25rem; }

/* Surfaces */
.panel, .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.5rem;
}
section.panel { margin-bottom: 1.25rem; }
.stack > .panel, .grid > .panel { margin-bottom: 0; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.panel-head.padded { padding: 1.1rem 1.5rem 0; margin-bottom: 0.9rem; }
.link-quiet { font-size: 0.85rem; text-decoration: none; color: var(--muted); }
.link-quiet:hover { color: var(--accent); }
.subhead { font-size: 0.95rem; margin: 1.3rem 0 0.7rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* Login */
body.login-page main { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 3.6rem); padding-top: 2rem; }
.login-card { width: min(27rem, 100%); padding: 2.4rem 2.3rem 2.1rem; box-shadow: var(--shadow-lg); border-radius: 18px; }
.login-card h1 { font-size: 1.85rem; margin-bottom: 0.6rem; }
.login-card form { margin-top: 1.1rem; }
.login-card .primary.block { margin-top: 0.9rem; padding: 0.7rem 1rem; }
.login-error { margin: 0.2rem 0 0.4rem; padding: 0.7rem 0.9rem; border-radius: var(--radius-sm); background: var(--bad-soft); border: 1px solid #efc5be; }
.login-error p { margin: 0; }
.login-error .hint { margin-top: 0.25rem; font-size: 0.85rem; color: #8a4a40; }
.lockout { margin: 0.4rem 0 0.6rem; padding: 1rem 1.1rem; border-radius: 12px; background: var(--warn-soft); border: 1px solid #efd9a8; color: #6b4a10; }
.lockout p { margin: 0.3rem 0 0; font-size: 0.9rem; }
.lockout .hint { color: #8a6a2a; font-size: 0.82rem; }
.lockout-head { display: flex; align-items: center; gap: 0.5rem; color: var(--warn); }
.lockout-icon { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: #f6e2b8; }
.lockout-timer { display: flex; align-items: baseline; gap: 0.6rem; margin-top: 0.6rem !important; }
.lockout-clock { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.lockout [hidden] { display: none !important; }
.lockout.is-over { background: var(--ok-soft); border-color: #c5e1d1; color: #1f5a3c; }
.lockout.is-over .lockout-head { color: var(--ok); }
.lockout.is-over .lockout-icon { background: #cfe8da; }

/* Forms */
label { display: grid; gap: 0.35rem; margin: 0 0 1rem; font-size: 0.88rem; font-weight: 500; color: var(--ink-2); }
input, select, textarea {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--ink);
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(164, 83, 46, 0.14); }
input[type="file"] { padding: 0.5rem; background: var(--surface-2); border-style: dashed; }
textarea { min-height: 9rem; resize: vertical; line-height: 1.55; }
input.num { width: 6.5rem; text-align: right; padding: 0.4rem 0.55rem; }
.secret { display: flex; gap: 0.5rem; align-items: center; }
.secret input { flex: 1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 0.4rem; }
.sticky-actions { position: sticky; bottom: 1rem; justify-content: flex-end; }
.bilingual { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.bilingual label { margin: 0; }
.lang-tag { justify-self: start; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }

/* Buttons */
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 1px rgba(23, 33, 45, 0.04);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}
button:hover, .button:hover { background: var(--surface-2); border-color: #c5b9a5; color: var(--ink); }
button:active, .button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.primary, button.primary, .button.primary {
  background: linear-gradient(180deg, #b15d35, var(--accent-dark));
  border-color: var(--accent-dark);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 4px 12px rgba(126, 59, 29, 0.22);
}
.primary:hover, button.primary:hover, .button.primary:hover { background: linear-gradient(180deg, #bb6639, #8a4221); color: #fff; border-color: var(--accent-dark); }
.block { width: 100%; }
button.small, .button.small { padding: 0.35rem 0.75rem; font-size: 0.83rem; }
button.danger { color: var(--bad); }
button.danger:hover:not(:disabled) { background: var(--bad-soft); border-color: #e9b9b2; color: var(--bad); }
.reveal { min-width: 4.2rem; }
.row-buttons { display: inline-flex; gap: 0.45rem; justify-content: flex-end; }
button.danger-solid { background: var(--bad); border-color: #8f2c22; color: #fff; box-shadow: 0 4px 12px rgba(176, 58, 46, 0.25); }
button.danger-solid:hover { background: #9a3127; border-color: #7d261d; color: #fff; }

/* Confirm dialog */
dialog.confirm {
  width: min(26rem, calc(100vw - 2rem));
  padding: 1.8rem 1.8rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
dialog.confirm::backdrop { background: rgba(17, 24, 33, 0.45); backdrop-filter: blur(2px); }
dialog.confirm[open] { animation: pop 0.14s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.confirm-icon {
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: var(--bad-soft);
  color: var(--bad);
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
}
dialog.confirm h2 { font-size: 1.3rem; margin-bottom: 0.4rem; }
.confirm-name { font-weight: 600; color: var(--ink-2); word-break: break-all; }
.confirm-actions { justify-content: flex-end; margin-top: 1.3rem; }

/* Banner and notices */
.banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--ok-soft);
  border: 1px solid #c5e1d1;
  color: #1f5a3c;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin: 0 0 1.4rem;
}
.banner::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--ok); flex: none; }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; }
.notice-run { border-left: 4px solid var(--run); }
.notice-bad { border-left: 4px solid var(--bad); }
.spinner { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 3px solid var(--run-soft); border-top-color: var(--run); animation: spin 0.9s linear infinite; flex: none; }
.notice-run > div { flex: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.pill::before { content: ""; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: currentColor; opacity: 0.85; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-draft { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-run { background: var(--run-soft); color: var(--run); }
.flag { display: inline-block; font-size: 0.7rem; font-weight: 600; padding: 0.05rem 0.45rem; background: var(--warn-soft); color: var(--warn); border-radius: 999px; margin-left: 0.3rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
.table-clean th, .table-clean td, table th, table td { padding: 0.8rem 1rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.table-clean th, table th {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--surface-2);
}
.table-clean tbody tr { transition: background 0.12s; }
.table-clean tbody tr:hover { background: #fcfaf6; }
.table-clean tbody tr:last-child td { border-bottom: 0; }
.panel:not(.panel-flush) .table-clean th:first-child, .panel:not(.panel-flush) .table-clean td:first-child { padding-left: 0.2rem; }
.panel:not(.panel-flush) .table-clean th { background: transparent; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.review-row { background: #fffaf0; }
.review-row:hover { background: #fff5e4 !important; }
tfoot .total-row td { border-top: 2px solid var(--ink); border-bottom: 0; font-weight: 700; font-size: 1rem; padding-top: 0.9rem; }
.lines { min-width: 52rem; }
.jobs-table { min-width: 36rem; }
.jobs-table th { white-space: nowrap; }
.jobs-table th, .jobs-table td { padding-left: 0.7rem; padding-right: 0.7rem; }
.jobs-table th:first-child, .jobs-table td:first-child { padding-left: 1.1rem; }
.jobs-table th:last-child, .jobs-table td:last-child { padding-right: 1.1rem; }
.cell-sub { display: block; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-table { min-width: 48rem; }
.row-form, .actions { display: flex; gap: 0.5rem; align-items: center; }
.row-form select { min-width: 10.5rem; padding: 0.4rem 0.6rem; }
.actions form, .row-form { margin: 0; }
.avatar {
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  margin-right: 0.6rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 0.8rem;
  vertical-align: middle;
}

/* Job page */
.drawing-panel { position: sticky; top: 5rem; }
.drawing-frame { display: block; width: 100%; height: 76vh; border: 0; border-top: 1px solid var(--line); background: #fff; }
.facts { display: grid; gap: 0; margin: 0; }
.facts div { display: grid; grid-template-columns: 8.5rem 1fr; gap: 0.8rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); font-size: 0.85rem; }
.facts dd { margin: 0; display: flex; align-items: center; gap: 0.6rem; }
.meter { display: inline-block; width: 6rem; height: 0.45rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, #d9824f, var(--accent)); }
.reason { padding: 0.9rem 0; border-top: 1px solid var(--line); }
.reason:first-of-type { border-top: 0; padding-top: 0; }
.reason p { font-size: 0.92rem; }
.assumptions { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.45rem; }

/* Dashboard */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--line); }
.kpi-accent::before { background: linear-gradient(90deg, #d9824f, var(--accent)); }
.kpi-warn::before { background: var(--bad); }
.kpi-label { margin: 0; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.kpi-value { margin: 0.35rem 0 0.15rem; font-family: var(--serif); font-size: 2.1rem; line-height: 1.1; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-slash { font-size: 1.1rem; color: var(--muted); }
.kpi-sub { margin: 0; font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.big { margin: 0.3rem 0 0.1rem; font-family: var(--serif); font-size: 1.85rem; font-weight: 600; }
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.duo > div { padding: 0.9rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }

.stack-bar { display: flex; height: 0.9rem; border-radius: 999px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.seg { display: block; height: 100%; }
.seg-processing { background: var(--run); }
.seg-drafts { background: #d9a441; }
.seg-approved { background: var(--ok); }
.seg-failed { background: var(--bad); }
.legend { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem 1.2rem; }
.legend li { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; color: var(--ink-2); }
.legend strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.legend-inline { display: flex; gap: 1.2rem; margin-top: 0.6rem; }
.legend-inline li { font-size: 0.8rem; color: var(--muted); }
.dot { width: 0.65rem; height: 0.65rem; border-radius: 3px; flex: none; }
.dot-ghost { background: #c9c2b6; }
.dot-over { background: var(--accent); }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.95rem; }
.bar-label { display: flex; justify-content: space-between; align-items: baseline; gap: 0.8rem; font-size: 0.88rem; margin-bottom: 0.3rem; }
.bar-label .muted { font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 0.5rem; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar + .bar { margin-top: 0.22rem; }
.bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #d9824f, var(--accent)); }
.bar-ink span { background: linear-gradient(90deg, #4b5d72, var(--ink-2)); }
.bar-ghost span { background: #c9c2b6; }
.bar-over span { background: var(--accent); }
.bar-note { margin: 0.3rem 0 0; font-size: 0.78rem; color: var(--muted); }

.columns { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 0.45rem; height: 11rem; align-items: end; padding-top: 0.5rem; }
.panel-chart { display: flex; flex-direction: column; }
.panel-chart .columns { flex: 1; height: auto; min-height: 11rem; }
.col { display: grid; grid-template-rows: auto 1fr auto; height: 100%; align-items: end; text-align: center; }
.col-count { font-size: 0.72rem; color: var(--ink-2); font-weight: 600; min-height: 1rem; }
.col-bar { display: block; min-height: 3px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #d9824f, var(--accent)); align-self: end; }
.col-bar[style*="height: 0.0%"] { background: var(--line); }
.col-day { font-size: 0.7rem; color: var(--muted); margin-top: 0.35rem; }

.health { margin: 0; display: grid; }
.health div { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.health div:last-child { border-bottom: 0; }
.health dt { color: var(--muted); }
.health dd { margin: 0; text-align: right; min-width: 0; }
.health dt { flex: none; max-width: 55%; }
.health .pill { white-space: normal; text-align: left; }
.mini-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.mini-kpis div { display: grid; gap: 0.1rem; padding: 0.7rem 0.85rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.mini-kpis strong { font-family: var(--serif); font-size: 1.35rem; line-height: 1.1; }
.mini-kpis span { font-size: 0.75rem; color: var(--muted); }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li + li { border-top: 1px solid var(--line); }
.activity a { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.8rem 0.4rem; color: inherit; text-decoration: none; border-radius: var(--radius-sm); transition: background 0.12s; }
.activity a:hover { background: var(--surface-2); color: inherit; }
.activity-main { display: grid; min-width: 0; }
.activity-main .muted { font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-meta { display: flex; align-items: center; gap: 0.75rem; font-size: 0.82rem; flex: none; }

.upload { position: sticky; top: 5rem; }

.doc {
  max-width: 52rem;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.2rem 2.4rem 2.6rem;
}
.doc h1 { font-size: 2.1rem; }
.doc h2 { margin: 2rem 0 0.55rem; font-size: 1.4rem; }
.doc h3 { margin: 1.3rem 0 0.4rem; }
.doc p, .doc li { color: var(--ink-2); }
.doc ul, .doc ol { margin: 0.4rem 0 0.8rem; padding-left: 1.25rem; }
.doc li + li { margin-top: 0.28rem; }
.doc pre.mermaid {
  margin: 1rem 0 1.3rem;
  padding: 0.6rem;
  overflow-x: auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.doc .mermaid svg { max-width: 100%; height: auto; }
.doc pre code { display: block; padding: 0.85rem 1rem; overflow-x: auto; }

@media (max-width: 1100px) {
  .who { display: none; }
  .split { grid-template-columns: 1fr; }
  .upload { position: static; }
}
@media (max-width: 900px) {
  .grid-2, .grid-wide, .grid-users, .split, .review, .bilingual { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis .kpi:last-child { grid-column: 1 / -1; }
  .top-inner { flex-wrap: wrap; gap: 0.75rem 1.25rem; padding: 0.7rem 1rem; }
  .nav-links { order: 3; flex-basis: 100%; overflow-x: auto; }
  .nav-links a[aria-current="page"]::after { display: none; }
  main { padding: 1.5rem 1rem 3rem; }
  .drawing-panel, .upload { position: static; }
  .drawing-frame { height: 60vh; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .doc { padding: 1.3rem 1rem 1.8rem; }
}
