:root {
  --ink: oklch(25% 0.035 250);
  --ink-soft: oklch(43% 0.025 250);
  --paper: oklch(97.5% 0.012 85);
  --paper-deep: oklch(93% 0.018 85);
  --line: oklch(82% 0.018 250);
  --navy: oklch(29% 0.075 252);
  --navy-2: oklch(38% 0.08 250);
  --vermilion: oklch(59% 0.17 35);
  --green: oklch(53% 0.11 153);
  --amber: oklch(70% 0.13 75);
  --red: oklch(51% 0.18 29);
  --sans: "Microsoft YaHei UI", "Noto Sans CJK SC", sans-serif;
  --display: "Bahnschrift", "Microsoft YaHei UI", sans-serif;
  --shadow: 0 14px 50px oklch(25% 0.03 250 / .1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--paper); color: var(--ink); font-family: var(--sans); }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.grain { position: fixed; inset: 0; opacity: .13; pointer-events: none; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E"); }
.eyebrow { margin: 0 0 .65rem; font-family: var(--display); font-size: .72rem; letter-spacing: .18em; color: var(--vermilion); text-transform: uppercase; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr); }
.login-manifesto { background: var(--navy); color: var(--paper); padding: clamp(3rem, 8vw, 8rem); display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.login-manifesto::after { content: "LIVE"; position: absolute; right: -2vw; bottom: -7vw; font: 900 clamp(9rem, 26vw, 26rem)/.75 var(--display); color: oklch(40% 0.07 250 / .28); letter-spacing: -.08em; }
.login-manifesto h1 { font: 700 clamp(3.3rem, 7vw, 7rem)/.96 var(--display); letter-spacing: -.045em; margin: .5rem 0 2rem; max-width: 10ch; position: relative; z-index: 1; }
.login-manifesto > p:not(.eyebrow) { max-width: 34rem; color: oklch(88% .025 250); line-height: 1.9; position: relative; z-index: 1; }
.manifesto-index { margin-top: 4rem; padding-top: 1rem; border-top: 1px solid oklch(78% .03 250 / .35); display: flex; gap: 1.4rem; flex-wrap: wrap; font: 600 .78rem var(--display); letter-spacing: .08em; color: oklch(82% .04 250); z-index: 1; }
.login-panel { padding: clamp(2.5rem, 6vw, 6rem); display: flex; flex-direction: column; justify-content: center; background: var(--paper); }
.login-panel h2 { font: 700 clamp(1.8rem, 3vw, 2.7rem) var(--display); margin: 0 0 3rem; letter-spacing: -.03em; }
form { display: grid; gap: 1rem; }
label { display: grid; gap: .42rem; color: var(--ink-soft); font-size: .83rem; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: oklch(99% .006 85); color: var(--ink); padding: .82rem .9rem; border-radius: 2px; outline: none; transition: border-color .18s, box-shadow .18s; }
textarea { min-height: 9rem; resize: vertical; line-height: 1.65; }
input:focus, select:focus, textarea:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px oklch(60% .07 250 / .16); }
.button { border: 0; padding: .82rem 1rem; font-weight: 800; border-radius: 2px; letter-spacing: .02em; }
.button.primary { background: var(--vermilion); color: var(--paper); }
.button.secondary { background: var(--navy); color: var(--paper); }
.button.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.button.danger { background: transparent; color: var(--red); border: 1px solid oklch(72% .09 29); }
.text-button { border: 0; background: none; color: inherit; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.form-error { min-height: 1.4rem; color: var(--red); font-size: .84rem; }
.login-note { margin-top: 2rem; color: var(--ink-soft); font-size: .76rem; line-height: 1.7; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.rail { min-height: 100vh; position: sticky; top: 0; align-self: start; background: var(--navy); color: var(--paper); padding: 1.4rem 1rem; display: flex; flex-direction: column; border-right: 6px solid var(--vermilion); }
.brand { display: flex; gap: .75rem; align-items: center; padding: .5rem .5rem 2rem; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; color: var(--paper); background: var(--vermilion); font: 900 1.08rem var(--display); }
.brand strong, .brand small { display: block; }
.brand strong { font: 700 1rem var(--display); letter-spacing: .02em; }
.brand small { color: oklch(78% .035 250); margin-top: .25rem; font-size: .68rem; }
#nav { display: grid; gap: .22rem; }
#nav button { width: 100%; display: grid; grid-template-columns: 2.2rem 1fr; text-align: left; align-items: center; border: 0; padding: .78rem .7rem; color: oklch(82% .03 250); background: transparent; border-radius: 2px; }
#nav button span { color: oklch(65% .06 250); font: 600 .64rem var(--display); letter-spacing: .1em; }
#nav button:hover { color: var(--paper); background: oklch(38% .065 250); }
#nav button.active { color: var(--paper); background: oklch(42% .075 250); }
#nav button.active span { color: oklch(84% .13 65); }
.rail-footer { margin-top: auto; padding: 1.2rem .55rem .4rem; border-top: 1px solid oklch(75% .03 250 / .25); display: flex; justify-content: space-between; font-size: .76rem; color: oklch(80% .03 250); }
.workspace { min-width: 0; padding: clamp(1.4rem, 3vw, 3.6rem); }
.work-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; padding-bottom: 1.25rem; border-bottom: 2px solid var(--ink); }
.work-header h1 { margin: 0; font: 750 clamp(2rem, 4vw, 3.8rem)/1 var(--display); letter-spacing: -.045em; }
.header-status { display: flex; align-items: center; gap: .55rem; color: var(--ink-soft); font-size: .78rem; padding-bottom: .35rem; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px oklch(53% .11 153 / .15); }
.content { padding: 2rem 0 5rem; }
.notice { margin-top: 1rem; padding: .8rem 1rem; background: oklch(93% .055 72); border-left: 4px solid var(--amber); font-size: .84rem; }

.metric-strip { display: grid; grid-template-columns: repeat(6, minmax(100px, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric { padding: 1.3rem 1rem 1.1rem 0; min-width: 0; }
.metric + .metric { padding-left: 1rem; border-left: 1px solid var(--line); }
.metric strong { display: block; font: 700 clamp(1.65rem, 3vw, 2.7rem)/1 var(--display); letter-spacing: -.04em; }
.metric span { display: block; margin-top: .55rem; color: var(--ink-soft); font-size: .72rem; }
.section-head { margin: 2.6rem 0 1rem; display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.section-head h2 { margin: 0; font: 720 clamp(1.2rem, 2vw, 1.75rem) var(--display); letter-spacing: -.02em; }
.section-head p { margin: 0; color: var(--ink-soft); font-size: .78rem; }
.split { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(290px, .55fr); gap: clamp(1.5rem, 3vw, 3rem); align-items: start; }
.panel { border-top: 4px solid var(--navy); background: oklch(99% .006 85); box-shadow: var(--shadow); padding: 1.2rem; }
.panel h3 { font: 700 1.05rem var(--display); margin: 0 0 1rem; }
.layer-list { display: grid; gap: .8rem; }
.layer { display: grid; grid-template-columns: 2.3rem 1fr auto; gap: .85rem; align-items: center; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.layer b { font: 800 .68rem var(--display); color: var(--vermilion); }
.layer span { font-size: .82rem; }
.layer em { font-style: normal; font-size: .7rem; color: var(--green); }
.layer em.pending { color: var(--amber); }

.data-table { width: 100%; border-collapse: collapse; font-size: .82rem; background: oklch(99% .006 85); }
.data-table th { text-align: left; padding: .78rem .7rem; color: var(--ink-soft); font-size: .68rem; letter-spacing: .06em; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.data-table td { padding: .88rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tr:hover td { background: oklch(95% .02 85); }
.status { display: inline-flex; align-items: center; min-height: 1.45rem; padding: .18rem .5rem; border-radius: 999px; font-size: .68rem; font-weight: 800; background: var(--paper-deep); color: var(--ink-soft); white-space: nowrap; }
.status.high, .status.failed { background: oklch(90% .07 30); color: var(--red); }
.status.online, .status.published, .status.completed, .status.analyzed { background: oklch(91% .055 153); color: oklch(42% .11 153); }
.status.medium, .status.candidate, .status.queued, .status.received { background: oklch(93% .065 80); color: oklch(48% .12 68); }
.status.info { background: oklch(91% .04 250); color: var(--navy); }
.empty { border: 1px dashed var(--line); padding: 2rem; color: var(--ink-soft); line-height: 1.7; }
.toolbar { display: flex; gap: .7rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.toolbar .button { font-size: .78rem; }
.compact-field { min-width: min(18rem, 100%); display: flex; flex-direction: row; align-items: center; gap: .55rem; padding-left: .35rem; }
.compact-field select { min-width: 12rem; padding-block: .7rem; }
.inline-form { background: var(--paper-deep); padding: 1rem; margin: 1rem 0 1.6rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; border-top: 3px solid var(--vermilion); }
.inline-form .wide { grid-column: 1 / -1; }
.inline-form .actions { grid-column: 1 / -1; display: flex; gap: .6rem; justify-content: flex-end; }
.timeline { display: grid; gap: .8rem; }
.finding { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.finding time { color: var(--ink-soft); font: 600 .72rem var(--display); }
.finding h4 { margin: 0 0 .3rem; font: 700 .92rem var(--display); }
.finding p { margin: .2rem 0; font-size: .8rem; line-height: 1.65; }
.evidence { color: var(--ink-soft); border-left: 2px solid var(--line); padding-left: .65rem; }
.transcript { max-height: 36rem; overflow: auto; white-space: pre-wrap; font-size: .86rem; line-height: 1.85; padding-right: .7rem; }
.detail-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 2rem; }
.model-review-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.coach-note + .coach-note { border-top: 1px solid var(--line); margin-top: .9rem; padding-top: .9rem; }
.coach-note p { margin: .4rem 0 0; font-size: .8rem; line-height: 1.65; }
.back { color: var(--navy); border: 0; background: none; padding: 0; margin-bottom: 1rem; font-weight: 800; }
.muted { color: var(--ink-soft); }
.loading { padding: 3rem 0; color: var(--ink-soft); }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .rail { padding-inline: .6rem; }
  .brand div, #nav button:not(.active)::after, #nav button { font-size: 0; }
  .brand { padding-inline: .25rem; justify-content: center; }
  #nav button { grid-template-columns: 1fr; text-align: center; }
  #nav button span { font-size: .68rem; }
  .rail-footer { display: none; }
  .metric-strip { grid-template-columns: repeat(3, 1fr); }
  .metric:nth-child(4) { border-left: 0; }
  .split, .detail-grid, .model-review-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-manifesto { min-height: 42vh; padding: 2rem; }
  .login-panel { padding: 2rem; }
  .app-shell { display: block; }
  .rail { min-height: auto; position: sticky; z-index: 5; height: auto; padding: .55rem; border-right: 0; border-bottom: 4px solid var(--vermilion); }
  .brand, .rail-footer { display: none; }
  #nav { display: flex; overflow-x: auto; scrollbar-width: none; }
  #nav::-webkit-scrollbar { display: none; }
  #nav button { min-width: 82px; font-size: .64rem; gap: .15rem; }
  #nav button span { font-size: .58rem; }
  .workspace { padding: 1rem; }
  .work-header { align-items: start; }
  .header-status { display: none; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(odd) { border-left: 0; }
  .inline-form { grid-template-columns: 1fr; }
  .compact-field { width: 100%; align-items: stretch; flex-direction: column; padding-left: 0; }
  .data-table { display: block; overflow-x: auto; white-space: nowrap; }
  .data-table th, .data-table td { min-width: 6.5rem; }
  .data-table th:first-child, .data-table td:first-child { min-width: 8rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .content > * { animation: reveal .34s cubic-bezier(.22, 1, .36, 1) both; }
  @keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
