:root {
  color-scheme: light;
  --canvas: #f3f5f4;
  --paper: #fff;
  --ink: #152824;
  --muted: #52635e;
  --line: #e0e8e4;
  --brand: #096b57;
  --brand-dark: #075644;
  --mint: #e3f2eb;
  --nav: #122c26;
  --nav-line: #34534a;
  --warm: #fff8e8;
  --warm-line: #eddfb9;
  --warm-ink: #674812;
  --danger: #902e36;
  --danger-bg: #fff0f1;
  --radius: 14px;
  --shadow: 0 2px 3px #16362a06, 0 8px 22px #16362a06;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 15px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--canvas); line-height: 1.55; }
a { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid #b45f16; outline-offset: 3px; }
:target { scroll-margin-top: 86px; }
.visually-hidden,
.skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; z-index: 10; top: 8px; left: 8px; padding: 8px 12px; background: var(--paper); border-radius: 6px; }
.muted { color: var(--muted); }

.workspace { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; padding: 28px 16px 21px; background: var(--nav); color: #e4f0eb; height: 100vh; position: sticky; top: 0; }
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; line-height: 1.3; }
.sidebar .brand { padding-inline: 9px; }
.brand strong { display: block; font-size: 1.08rem; font-weight: 750; letter-spacing: .045em; }
.brand-caption { display: block; margin-top: 4px; color: #b6cec4; font-size: .74rem; white-space: nowrap; }
.brand-mark { position: relative; display: block; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 10px; background: #b7e5cb; }
.brand-mark::before, .brand-mark::after { position: absolute; content: ""; width: 14px; height: 14px; border: 2px solid #174938; border-radius: 3px; }
.brand-mark::before { top: 8px; left: 8px; }
.brand-mark::after { top: 14px; left: 14px; background: #b7e5cb; }
.nav-list { display: grid; gap: 6px; margin-top: 42px; }
.nav-list a { display: flex; gap: 12px; align-items: center; min-height: 44px; padding: 9px 11px; border-radius: 7px; color: #bdd1c9; text-decoration: none; font-weight: 620; font-size: .9rem; }
.nav-list a:hover { background: #1d3c33; color: #fff; }
.nav-list a[aria-current] { background: #294b40; color: #effbf5; }
.nav-icon { position: relative; display: inline-block; flex: 0 0 17px; width: 17px; height: 17px; }
.nav-icon::before, .nav-icon::after { position: absolute; content: ""; }
.nav-upload::before { inset: 1px 3px 1px 3px; border: 1.5px solid currentColor; border-radius: 2px; }
.nav-upload::after { top: 6px; left: 6px; width: 5px; height: 5px; border: solid currentColor; border-width: 1.5px 0 0 1.5px; transform: rotate(45deg); }
.nav-analysis::before { inset: 2px 1px 1px 2px; border-bottom: 1.5px solid currentColor; border-left: 1.5px solid currentColor; }
.nav-analysis::after { bottom: 4px; left: 5px; width: 2px; height: 5px; background: currentColor; box-shadow: 3px -3px currentColor, 6px -5px currentColor; }
.nav-history::before { inset: 1px; border: 1.5px solid currentColor; border-radius: 50%; }
.nav-history::after { left: 8px; top: 4px; width: 4px; height: 5px; border: solid currentColor; border-width: 0 0 1.5px 1.5px; }
.sidebar-footer { display: flex; gap: 8px; align-items: center; margin-top: auto; padding: 15px 10px 1px; border-top: 1px solid var(--nav-line); color: #bdd1c9; font-size: .77rem; }
.private-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 100%; background: #64b18e; }

.main-area { min-width: 0; }
.topbar { min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 clamp(20px, 3.3vw, 46px); background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-label { color: var(--muted); font-size: .9rem; font-weight: 650; }
.mobile-brand { display: none; }
.main-content { width: 100%; max-width: 1390px; margin-inline: auto; padding: 32px clamp(20px, 3.3vw, 46px) 55px; }
.page-header { margin-bottom: 24px; }
.eyebrow { color: var(--brand-dark); font-size: .76rem; letter-spacing: .16em; font-weight: 800; margin-bottom: 6px; }
h1 { font-size: clamp(1.85rem, 3vw, 2.6rem); letter-spacing: -.035em; line-height: 1.25; font-weight: 800; }
.page-header h1 + p { margin-top: 9px; color: var(--muted); }
.practice-note { display: flex; gap: 11px; align-items: center; padding: 13px 16px; margin-bottom: 22px; border: 1px solid var(--warm-line); border-radius: 9px; color: var(--warm-ink); background: var(--warm); font-size: .87rem; }
.notice-icon { flex: 0 0 18px; width: 18px; height: 18px; border: 1.5px solid currentColor; text-align: center; border-radius: 50%; font: 800 12px/15px system-ui, sans-serif; }
.practice-note div { display: flex; flex-wrap: wrap; gap: 3px 12px; }

.intake-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: stretch; gap: 20px; }
.card { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.upload-card, .status-card, .report-card { padding: 21px 22px; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 16px; margin-bottom: 18px; }
h2 { font-size: 1.2rem; font-weight: 760; line-height: 1.35; letter-spacing: -.02em; }
h3 { font-size: 1.08rem; font-weight: 750; line-height: 1.4; }
.card-header p { color: var(--muted); font-size: .87rem; margin-top: 4px; overflow-wrap: anywhere; }
.inline-link { align-self: flex-start; flex-shrink: 0; padding-block: 3px; font-weight: 650; font-size: .84rem; }
.muted-link { color: var(--muted); }

.form-field { display: grid; gap: 6px; margin-bottom: 13px; }
.form-field label { font-size: .87rem; font-weight: 680; }
select, input[type="password"] { width: 100%; min-height: 42px; padding: 8px 12px; color: var(--ink); background: var(--paper); border: 1px solid #bfcfc6; border-radius: 7px; }
select:hover, input[type="password"]:hover { border-color: #8aab9d; }
.drop-zone { position: relative; display: flex; min-height: 95px; gap: 14px; align-items: center; justify-content: center; border: 1px dashed #92b1a4; border-radius: 9px; background: #f5faf7; transition: border-color .15s ease, background .15s ease; }
.drop-zone:focus-within { outline: 3px solid #b45f16; outline-offset: 3px; }
.drop-zone:hover, .drop-zone.is-dragging { background: var(--mint); border-color: var(--brand); }
.upload-icon { position: relative; width: 36px; height: 36px; flex: 0 0 36px; background: var(--mint); color: var(--brand-dark); border-radius: 10px; }
.upload-icon::before, .upload-icon::after { position: absolute; content: ""; }
.upload-icon::before { inset: 17px 9px 9px; border: 1.5px solid currentColor; border-top: 0; border-radius: 0 0 3px 3px; }
.upload-icon::after { width: 8px; height: 8px; left: 14px; top: 10px; border: solid currentColor; border-width: 1.5px 0 0 1.5px; transform: rotate(45deg); }
.file-label { font-weight: 770; color: var(--brand-dark); cursor: pointer; }
.file-label::after { content: ""; position: absolute; inset: 0; border-radius: 9px; }
.drop-hint, .file-format, .file-selection { color: var(--muted); font-size: .81rem; font-weight: 450; }
.drop-hint { margin-left: 7px; }
.file-selection { margin-top: 8px; overflow-wrap: anywhere; }
.form-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.form-actions .inline-link { align-self: center; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 7px 13px; border: 1px solid transparent; border-radius: 7px; font-size: .88rem; font-weight: 700; line-height: 1.45; }
.button-primary { background: var(--brand); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--brand-dark); }
.button-primary:disabled { background: #dce6e0; color: #52655d; cursor: not-allowed; }
.button-quiet { color: var(--brand-dark); background: var(--paper); border-color: #cadaD1; }
.button-quiet:hover { background: #eff7f2; border-color: #98b9a9; }

.badge { display: inline-flex; align-items: center; flex-shrink: 0; min-height: 26px; padding: 3px 8px; color: #4b6057; background: #edf2ef; border-radius: 999px; font-weight: 740; font-size: .74rem; white-space: nowrap; }
.badge[data-status="validating"], .badge[data-status="analyzing"], .badge[data-status="queued"] { color: #6c4a14; background: #fbf1d4; }
.badge[data-status="succeeded"] { color: var(--brand-dark); background: var(--mint); }
.badge[data-status="failed"] { color: var(--danger); background: var(--danger-bg); }
.steps { display: grid; gap: 0; padding: 0; margin: 2px 0 0; list-style: none; }
.steps li { position: relative; display: flex; align-items: center; gap: 11px; min-height: 44px; color: var(--muted); font-size: .89rem; }
.steps li:not(:last-child)::after { content: ""; position: absolute; z-index: 0; top: 29px; bottom: -15px; left: 7px; width: 1px; background: #d5dfd9; }
.step-marker { width: 15px; height: 15px; flex: 0 0 15px; position: relative; z-index: 1; border: 1.5px solid #a7b8af; background: #fff; border-radius: 50%; }
.steps li[data-state="complete"] .step-marker { background: var(--mint); border-color: #80b69f; }
.steps li[data-state="complete"] .step-marker::after { position: absolute; content: ""; width: 7px; height: 4px; border: solid var(--brand-dark); border-width: 0 0 1.5px 1.5px; left: 2.5px; top: 3px; transform: rotate(-45deg); }
.steps li[data-state="active"] { color: var(--ink); font-weight: 730; }
.steps li[data-state="active"] .step-marker { background: var(--brand); border: 3px solid #c7e6d6; box-shadow: 0 0 0 1px var(--brand); }
.alert, .connection-status { margin-top: 10px; padding: 8px 10px; border-radius: 6px; font-size: .83rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.alert { background: var(--danger-bg); color: var(--danger); }
.connection-status { background: #eef3f0; }

.section-block { margin-top: 28px; }
.section-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px 14px; justify-content: space-between; margin-bottom: 10px; }
.section-meta { font-size: .81rem; color: var(--muted); overflow-wrap: anywhere; }
.empty-panel { display: flex; align-items: center; gap: 12px; min-height: 65px; padding: 12px 17px; color: var(--muted); font-size: .91rem; }
.empty-panel .nav-icon { color: var(--brand); }
.history-empty { padding: 17px; color: var(--muted); font-size: .91rem; }
.table-wrap { max-width: 100%; overflow-x: auto; }
.history-card .table-wrap { border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: 10px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: #455b51; background: #f2f7f4; font-size: .78rem; font-weight: 740; white-space: nowrap; }
td { overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.history-card table { min-width: 555px; }
.history-card td:first-child { font-weight: 650; }
.history-card td:nth-child(n+2) { white-space: nowrap; }
.history-card td:last-child { text-align: right; }
.history-card tr[data-selected="true"] td { background: #f1f8f3; }
.filename { display: block; color: var(--muted); margin-top: 2px; font-size: .78rem; font-weight: 450; white-space: normal; }
.history-compact { display: none; }
.history-open { min-height: 32px; padding: 4px 9px; font-size: .79rem; }

.report-layout { display: grid; gap: 13px; }
.report-context, .report-hint { color: var(--muted); font-size: .85rem; padding-top: 4px; }
.report-table { border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; }
.report-table table { min-width: 420px; }
.report-recommendation { border-left: 4px solid #68b797; }
.report-recommendation .card-header { margin-bottom: 8px; }
.report-list { display: grid; gap: 5px; padding-left: 19px; margin: 10px 0 0; font-size: .89rem; }
.scenario-details, .source-details { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; }
.scenario-details summary, .source-details summary { padding: 10px 13px; cursor: pointer; font-size: .88rem; font-weight: 700; }
.details-body { padding: 0 13px 13px; }
.details-body h4 { margin: 13px 0 0; font-size: .9rem; }
.details-body .report-table { margin-top: 7px; }
.source-notes { padding-left: 19px; margin: 8px 0 0; font-size: .86rem; }
.source-notes li + li { margin-top: 9px; }
.source-cite { display: block; color: var(--muted); font-size: .8rem; }
.draft-field { display: block; width: 100%; min-height: 128px; resize: vertical; padding: 9px 11px; margin-top: 10px; color: var(--ink); background: #f6faf7; border: 1px solid var(--line); border-radius: 8px; font: .83rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.copy-feedback { color: var(--muted); font-size: .81rem; }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(ellipse at 70% 36%, #244d40 0, var(--nav) 63%, #10251f); }
.login-card { width: min(100%, 440px); background: var(--paper); border-radius: 17px; border: 1px solid #c6dbd0; padding: clamp(25px, 5vw, 37px); box-shadow: 0 21px 70px #08171365; }
.login-card .brand-caption { color: var(--muted); }
.login-card h1 { font-size: 1.83rem; margin-top: 32px; }
.login-intro { color: var(--muted); margin: 8px 0 22px; font-size: .9rem; }
.login-form .button { width: 100%; justify-content: space-between; margin-top: 3px; min-height: 44px; }
.login-form .alert { margin: 0 0 10px; }
.login-footer { display: flex; gap: 8px; align-items: center; margin-top: 23px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }

@media (max-width: 1090px) {
  .workspace { grid-template-columns: 184px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .upload-card, .status-card, .report-card { padding: 17px; }
  .intake-grid { gap: 14px; }
}
@media (max-width: 900px) {
  .intake-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 730px) {
  .workspace { display: flex; flex-direction: column; }
  .sidebar { position: static; order: 0; height: auto; padding: 6px 12px; }
  .sidebar .brand, .sidebar-footer, .topbar-label { display: none; }
  .nav-list { display: flex; margin: 0; gap: 3px; flex-wrap: wrap; }
  .nav-list a { min-height: 38px; padding: 6px 8px; gap: 5px; font-size: .82rem; }
  .nav-icon { transform: scale(.85); }
  .mobile-brand { display: flex; align-items: center; gap: 7px; font-weight: 750; }
  .mobile-brand .brand-mark { transform: scale(.71); margin-left: -5px; }
  .topbar { min-height: 56px; }
  .main-content { padding-top: 22px; }
  .practice-note { margin-bottom: 14px; }
}
@media (max-width: 385px) {
  .main-content { padding-inline: 12px; }
  .card-header { flex-wrap: wrap; }
}
@media (max-width: 620px) {
  .history-card table { min-width: 0; }
  .history-card th, .history-card td { padding-inline: 8px; }
  .history-card :is(th, td):is(:nth-child(2), :nth-child(4)) { display: none; }
  .history-compact { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
