:root {
  color-scheme: light;
  --base: #f6f8fb; --panel: #fff; --inset: #f0f3f8; --hover: #edf2fb;
  --text: #182137; --muted: #526078; --dim: #657187; --line: #dce3ec;
  --accent: #234fdb; --accent-fill: #315fe9; --accent-ink: #fff; --accent-wash: #e8efff;
  --green: #087644; --green-bg: #e5f6ee; --amber: #8b4d10; --amber-bg: #fff0d8;
  --red: #a73045; --red-bg: #ffeaef; --shadow: 0 16px 56px #1727451c;
  --code: #f4f6fa;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --base: #11151e; --panel: #181e29; --inset: #202836; --hover: #222d42;
  --text: #e9eef9; --muted: #a9b5ca; --dim: #96a5bf; --line: #2d374a;
  --accent: #a4b9ff; --accent-fill: #5278f3; --accent-ink: #0b1229; --accent-wash: #24355b;
  --green: #7fe6af; --green-bg: #1b3a32; --amber: #ffcd80; --amber-bg: #3e3027;
  --red: #ff9dac; --red-bg: #492a37; --shadow: 0 16px 56px #05080b8c;
  --code: #121824;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --base: #11151e; --panel: #181e29; --inset: #202836; --hover: #222d42;
    --text: #e9eef9; --muted: #a9b5ca; --dim: #96a5bf; --line: #2d374a;
    --accent: #a4b9ff; --accent-fill: #5278f3; --accent-ink: #0b1229; --accent-wash: #24355b;
    --green: #7fe6af; --green-bg: #1b3a32; --amber: #ffcd80; --amber-bg: #3e3027;
    --red: #ff9dac; --red-bg: #492a37; --shadow: 0 16px 56px #05080b8c;
    --code: #121824;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--base); color: var(--text); min-height: 100dvh; }
button, input, textarea, select { font: inherit; }
button, input, select, textarea { color: var(--text); }
a { color: inherit; text-decoration: none; }
a, button, input, select, textarea { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); }
button, .button { border: 1px solid var(--line); border-radius: 7px; background: var(--panel); min-height: 40px; padding: 8px 13px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font-weight: 600; font-size: .875rem; }
button:hover, .button:hover { background: var(--hover); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary { background: var(--accent-fill); color: var(--accent-ink); border-color: transparent; }
button.primary:hover { filter: brightness(1.10); }
button.quiet { border-color: transparent; background: transparent; color: var(--muted); }
button.quiet:hover { background: var(--inset); color: var(--text); }
button.danger { color: var(--red); }
input:not([type=checkbox]), select, textarea { width: 100%; padding: 10px 12px; min-height: 42px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
textarea { resize: vertical; line-height: 1.5; }
label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.6rem, 3vw, 2.35rem); line-height: 1.2; letter-spacing: -.04em; }
h2 { font-size: 1.12rem; letter-spacing: -.015em; }
h3 { font-size: 1rem; }
p { line-height: 1.62; }
small, .small { font-size: .83rem; color: var(--dim); }
.muted { color: var(--muted); }
.mono, pre, code { font-family: "SF Mono", ui-monospace, Consolas, monospace; }
.mono { font-size: .83rem; overflow-wrap: anywhere; }
.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; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); max-width: 430px; width: 100%; border-radius: 12px; padding: 36px; }
.login-card h1 { margin: 17px 0 8px; }
.login-card p { color: var(--muted); }
.login-card form { margin-top: 28px; display: grid; gap: 9px; }
.login-card label { margin: 0; }
.login-card button { margin-top: 8px; }
.form-error { color: var(--red) !important; }
.form-error:not(:empty) { margin-top: 10px; }
.shell { width: 100%; display: grid; grid-template-columns: 221px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; border-right: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 11px; padding: 25px 21px 24px; font-weight: 750; font-size: 1.08rem; letter-spacing: .025em; line-height: 1; }
.mark { width: 34px; height: 34px; flex: 0 0 34px; display: inline-grid; place-items: center; background: var(--accent-fill); color: var(--accent-ink); font-size: 1.35rem; font-weight: 800; border-radius: 7px; }
.brand-sub { display: block; margin-top: 5px; font-size: .65rem; font-weight: 700; letter-spacing: .12em; color: var(--muted); }
.nav { display: grid; gap: 3px; padding: 0 11px; overflow: auto; }
.nav a { min-height: 41px; display: flex; align-items: center; gap: 11px; padding: 8px 11px; border-radius: 7px; color: var(--muted); font-weight: 590; font-size: .9rem; white-space: nowrap; }
.nav a:hover { background: var(--inset); color: var(--text); }
.nav a[aria-current=page] { background: var(--accent-wash); color: var(--accent); }
.nav-icon { width: 19px; height: 19px; display: block; flex: 0 0 19px; stroke: currentColor; stroke-width: 1.55; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.side-footer { margin: auto 13px 17px; padding: 12px; border-top: 1px solid var(--line); }
.side-footer strong { display: block; margin-top: 7px; font-size: .88rem; overflow-wrap: anywhere; }
.workspace { min-width: 0; }
.topbar { height: 64px; padding: 0 25px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 2; }
.top-left, .top-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-left select { max-width: 32vw; min-width: 148px; font-size: .9rem; min-height: 38px; text-overflow: ellipsis; }
.mini-brand, #mobile-approvals { display: none; }
.surface { max-width: 1510px; margin: 0 auto; padding: 30px clamp(20px, 3.2vw, 47px) 48px; min-height: calc(100dvh - 64px); }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 23px; }
.page-heading p { margin-top: 6px; color: var(--muted); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { padding: 15px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.metric .value { margin-top: 7px; font-size: clamp(1.28rem, 2vw, 1.9rem); letter-spacing: -.045em; font-weight: 720; overflow-wrap: anywhere; }
.metric .metric-label { color: var(--muted); font-size: .86rem; line-height: 1.35; }
.columns { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 15px; align-items: start; }
.surface > .panel + .stack { margin-top: 15px; }
.stack { display: grid; gap: 15px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.panel-head { padding: 15px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.panel-body { padding: 15px 16px; }
.panel .entry + .entry { border-top: 1px solid var(--line); }
.entry { padding: 13px 16px; min-width: 0; }
.entry-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; flex-wrap: wrap; }
.entry-top h3 { margin-bottom: 3px; }
.entry p { overflow-wrap: anywhere; }
.entry .actions { margin-top: 10px; }
.status { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-size: .83rem; font-weight: 650; color: var(--muted); }
.status::before { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; background: var(--dim); content: ""; }
.status.green { color: var(--green); }
.status.green::before { background: var(--green); }
.status.amber { color: var(--amber); }
.status.amber::before { background: var(--amber); }
.status.red { color: var(--red); }
.status.red::before { background: var(--red); }
.chip { display: inline-block; white-space: nowrap; border-radius: 5px; padding: 3px 8px; font-size: .83rem; font-weight: 650; background: var(--inset); color: var(--muted); }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.amber { background: var(--amber-bg); color: var(--amber); }
.chip.red { background: var(--red-bg); color: var(--red); }
.chip.blue { background: var(--accent-wash); color: var(--accent); }
.empty { color: var(--muted); padding: 24px 16px; font-size: .94rem; line-height: 1.52; }
.progress-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: center; margin-top: 9px; }
progress { width: 100%; height: 7px; appearance: none; border: 0; border-radius: 10px; overflow: hidden; background: var(--inset); accent-color: var(--accent-fill); }
progress::-webkit-progress-bar { background: var(--inset); }
progress::-webkit-progress-value { background: var(--accent-fill); }
progress::-moz-progress-bar { background: var(--accent-fill); }
.data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 18px; margin: 0; }
.data-grid dt { color: var(--muted); font-size: .84rem; margin-bottom: 3px; }
.project-goal { margin-top: 12px; overflow-wrap: anywhere; }
.data-grid dd { margin: 0; overflow-wrap: anywhere; }
.console-output { min-height: 210px; max-height: 57dvh; overflow: auto; overscroll-behavior: contain; }
.event { display: grid; grid-template-columns: 71px minmax(0, 1fr); gap: 9px; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.event time { color: var(--dim); font-variant-numeric: tabular-nums; font-size: .8rem; padding-top: 3px; }
.event strong, .event p, pre { overflow-wrap: anywhere; }
.event p { white-space: pre-wrap; }
.event .label { color: var(--muted); }
pre { padding: 12px; margin: 8px 0 0; background: var(--code); border: 1px solid var(--line); border-radius: 6px; white-space: pre-wrap; line-height: 1.52; max-height: 50dvh; overflow: auto; font-size: .83rem; }
.composer { padding: 13px 14px; border-top: 1px solid var(--line); }
.composer textarea { min-height: 89px; }
.composer .actions { justify-content: space-between; margin-top: 7px; }
.search button { flex: 0 0 auto; white-space: nowrap; }
.search { display: flex; gap: 7px; padding: 10px 13px; border-bottom: 1px solid var(--line); }
.dialog-title { margin: 0; font-size: 1.3rem; }
dialog { color: var(--text); width: min(660px, calc(100% - 28px)); max-height: min(90dvh, 900px); padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
dialog::backdrop { background: #0b142979; }
.dialog-head { position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--line); padding: 12px 16px; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.dialog-form { padding: 16px; display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.flag { display: flex; gap: 7px; align-items: center; }
.form-footer { display: flex; justify-content: end; gap: 8px; }
.toasts { position: fixed; bottom: 16px; right: 16px; z-index: 8; display: grid; gap: 7px; max-width: min(420px, calc(100vw - 32px)); }
.toast { color: var(--text); background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); box-shadow: var(--shadow); padding: 11px 14px; border-radius: 6px; }
.toast.warn { border-left-color: var(--red); }
@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shell { grid-template-columns: 190px minmax(0, 1fr); }
  .surface { padding-inline: 22px; }
}
@media (max-width: 850px) {
  .shell { display: block; }
  .sidebar { height: auto; border: 0; border-bottom: 1px solid var(--line); z-index: 3; }
  .sidebar .brand, .side-footer { display: none; }
  .nav { display: flex; gap: 6px; padding: 7px 9px; scrollbar-width: none; }
  #mobile-approvals { display: inline-flex; white-space: nowrap; padding-inline: 8px; }
  .nav a { padding: 7px 10px; gap: 7px; }
  .nav-icon { width: 15px; height: 15px; flex-basis: 15px; }
  .topbar { top: 56px; padding-inline: 12px; height: 54px; }
  .surface { padding-top: 20px; }
  .columns { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .topbar { position: relative; top: auto; }
  .surface { padding: 17px 12px 34px; }
  .page-heading { flex-wrap: wrap; gap: 9px; margin-bottom: 15px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .metric { padding: 10px; }
  .top-left select { max-width: 46vw; min-width: 116px; }
  .top-right { gap: 2px; }
  .top-right button { padding: 8px; }
  .top-right .status { font-size: 0; }
  .top-right .status::before { width: 9px; height: 9px; flex-basis: 9px; }
  .data-grid { gap: 8px 10px; }
  .entry, .panel-body { padding: 11px 12px; }
  .event { grid-template-columns: 60px minmax(0, 1fr); padding-inline: 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .console-output { max-height: 49dvh; }
}
