:root {
  --ink: #1f2926;
  --muted: #68736f;
  --quiet: #8c9692;
  --paper: #f4f1e9;
  --surface: #fbfaf6;
  --line: #d9d5ca;
  --line-strong: #b9b7ad;
  --brand: #0b6e63;
  --brand-dark: #07574f;
  --brand-pale: #dcebe6;
  --danger: #a64032;
  --danger-pale: #f5e5df;
  --sans: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: "Songti SC", SimSun, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 94px;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(31, 41, 38, .028) 1px, transparent 1px) 0 0 / 80px 80px,
    var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(244, 241, 233, .92);
  backdrop-filter: blur(12px);
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 650; }
.wordmark-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: white; background: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: -.04em; }
.topbar-meta { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-email { max-width: 240px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.environment-chip { border: 1px solid var(--line); border-radius: 99px; padding: 5px 9px; color: var(--muted); background: var(--surface); font-size: 11px; }
.environment-chip.ready { color: var(--brand-dark); border-color: #b8d4cc; background: var(--brand-pale); }

.gate { width: min(680px, calc(100% - 40px)); margin: min(18vh, 160px) auto 0; padding: 48px 0; border-top: 2px solid var(--ink); }
.gate-index, .eyebrow, .section-index { color: var(--brand-dark); text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 700; }
.gate h1 { margin: 18px 0 12px; font-family: var(--serif); font-size: clamp(32px, 5vw, 52px); font-weight: 600; line-height: 1.18; letter-spacing: -.04em; }
.gate > p { max-width: 560px; margin: 0 0 28px; color: var(--muted); line-height: 1.8; }
.login-form { max-width: 420px; display: grid; gap: 14px; margin-top: 26px; }

.review-workspace { width: min(1160px, calc(100% - 56px)); margin: 0 auto; animation: page-enter 260ms ease both; }
.review-intro { padding: clamp(58px, 8vw, 104px) 0 48px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(380px, .8fr); gap: clamp(46px, 8vw, 112px); align-items: end; }
.review-intro h1 { max-width: 720px; margin: 14px 0 18px; font-family: var(--serif); font-size: clamp(40px, 6vw, 72px); font-weight: 600; line-height: 1.12; letter-spacing: -.055em; }
.intro-copy { max-width: 690px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.85; }
.task-facts { margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line-strong); }
.task-facts div { min-height: 88px; padding: 18px 12px 14px 0; border-bottom: 1px solid var(--line); }
.task-facts div:nth-child(even) { padding-left: 18px; border-left: 1px solid var(--line); }
.task-facts dt { color: var(--quiet); font-size: 10px; }
.task-facts dd { margin: 9px 0 0; font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }

.notice { margin: 0 0 24px; padding: 12px 14px; border-left: 3px solid var(--brand); color: var(--brand-dark); background: var(--brand-pale); font-size: 12px; line-height: 1.6; }
.notice.danger { color: var(--danger); border-color: var(--danger); background: var(--danger-pale); }
.review-section { padding: clamp(54px, 7vw, 86px) 0; border-top: 1px solid var(--line-strong); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 34px; }
.section-heading h2 { margin: 10px 0 9px; font-family: var(--serif); font-size: clamp(30px, 4vw, 46px); font-weight: 600; line-height: 1.2; letter-spacing: -.04em; }
.section-heading p:last-child { max-width: 660px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.75; }
.section-count { flex: 0 0 auto; padding-bottom: 5px; color: var(--quiet); font-size: 11px; }

.asset-filters { display: flex; gap: 22px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.asset-filters::-webkit-scrollbar { display: none; }
.asset-filters button { position: relative; flex: 0 0 auto; padding: 0 0 13px; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; }
.asset-filters button::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; content: ""; background: transparent; }
.asset-filters button.active { color: var(--ink); font-weight: 650; }
.asset-filters button.active::after { background: var(--brand); }
.asset-review-groups { display: grid; gap: 28px; }
.asset-group-heading, .secondary-asset-group summary { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; }
.asset-group-heading { padding: 0 0 12px; border-bottom: 2px solid var(--brand); }
.candidate-confirm-action { display: inline-block; margin-top: 8px; color: var(--brand); font-size: 13px; font-weight: 650; text-decoration: underline; }
.candidate-confirm-action[type="button"] { padding: 0; border: 0; background: transparent; cursor: pointer; }
.asset-group-heading h3 { margin: 0; color: var(--brand-dark); font-size: 14px; }
.secondary-asset-group { border-bottom: 1px solid var(--line); }
.secondary-asset-group summary { padding: 16px 0; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 650; }
.secondary-asset-group summary .section-count { padding: 0; }
.asset-list { border-bottom: 1px solid var(--line); }
.asset-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 34%); gap: clamp(30px, 6vw, 76px); padding: 34px 0; border-top: 1px solid var(--line); transition: opacity 180ms ease, transform 180ms ease; }
.asset-row:first-child { border-top: 0; }
.asset-row.rejected { opacity: .56; }
.asset-row.deep-linked::before { position: absolute; top: 22px; bottom: 22px; left: -16px; width: 3px; border-radius: 3px; content: ""; background: var(--brand); }
.asset-row.deep-linked { background: linear-gradient(90deg, rgba(11, 110, 99, .055), transparent 42%); }
.asset-row.interview-asset-focus {
  margin: 0 -18px;
  padding: 34px 18px;
  border: 2px solid var(--brand);
  border-radius: 12px;
  background: linear-gradient(110deg, var(--brand-pale), rgba(251, 250, 246, .96) 72%);
  box-shadow: 0 16px 34px rgba(11, 110, 99, .12);
}
.asset-origin-focus { color: var(--brand-dark); font-weight: 750; }
.asset-row.status-changing { opacity: .22; transform: translateX(8px); }
.asset-kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; color: var(--quiet); font-size: 10px; }
.asset-type { color: var(--brand-dark); font-weight: 700; letter-spacing: .08em; }
.asset-status { padding-left: 10px; border-left: 1px solid var(--line); }
.asset-row h3 { margin: 0 0 10px; font-family: var(--serif); font-size: 25px; font-weight: 600; line-height: 1.3; letter-spacing: -.025em; }
.asset-summary { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.asset-content { margin: 0; font-size: 14px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.asset-tags { margin-top: 14px; color: var(--quiet); font-size: 10px; }
.asset-actions { margin-top: 18px; display: flex; gap: 16px; align-items: center; }
.asset-actions button { border: 0; padding: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; }
.asset-actions button:hover { color: var(--ink); }
.asset-actions .reject-action:hover { color: var(--danger); }
.asset-evidence { align-self: start; padding-left: 20px; border-left: 2px solid var(--brand-pale); }
.asset-evidence > p { margin: 0 0 12px; color: var(--quiet); font-size: 10px; }
.citation-button { width: 100%; margin: 0 0 12px; padding: 0 0 12px; border: 0; border-bottom: 1px solid var(--line); color: inherit; background: transparent; text-align: left; cursor: pointer; }
.citation-button:last-child { margin-bottom: 0; border-bottom: 0; }
.citation-button q { display: block; color: var(--ink); font-family: var(--serif); font-size: 14px; line-height: 1.7; }
.citation-button small { display: block; margin-top: 7px; color: var(--quiet); font-size: 9px; line-height: 1.5; }
.empty-state { padding: 34px 0; margin: 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.portrait-heading { align-items: center; }
.portrait-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(40px, 8vw, 100px); border-top: 1px solid var(--line); }
.portrait-field { min-height: 118px; padding: 23px 0; border-bottom: 1px solid var(--line); }
.portrait-field.wide { grid-column: 1 / -1; }
.portrait-field h3 { margin: 0 0 10px; color: var(--quiet); font-size: 10px; font-weight: 600; letter-spacing: .08em; }
.portrait-field-marker { display: inline-block; margin-left: 8px; padding: 2px 6px; border: 1px solid rgba(63, 111, 91, .28); border-radius: 999px; color: var(--brand); font-size: 9px; font-weight: 600; letter-spacing: 0; vertical-align: 1px; }
.portrait-field-marker.reverted { border-color: var(--line-strong); color: var(--muted); }
.unsaved-state, .form-warning { margin: 10px 0 0; color: #9a5b16; font-size: 13px; line-height: 1.5; }
.unsaved-state { padding: 10px 14px; border: 1px solid rgba(154, 91, 22, .25); border-radius: 8px; background: rgba(154, 91, 22, .06); }
.portrait-field p { margin: 0; font-family: var(--serif); font-size: 17px; line-height: 1.75; }
.portrait-field.wide p { max-width: 900px; font-size: 20px; }
.portrait-field .empty-copy { color: var(--quiet); }
.portrait-interview { margin-top: 34px; padding: 24px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, .8fr); gap: 22px 40px; }
.portrait-interview h3 { margin: 8px 0 8px; font-family: var(--serif); font-size: 24px; font-weight: 600; }
.portrait-interview p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.75; }
.portrait-interview form { display: grid; gap: 10px; }
.portrait-interview .primary-action { justify-self: start; }
.interview-status { grid-column: 1 / -1; color: var(--brand-dark) !important; }

.confirm-bar { position: fixed; z-index: 18; right: 0; bottom: 0; left: 0; min-height: 78px; padding: 14px max(28px, calc((100vw - 1160px) / 2)); border-top: 1px solid var(--line-strong); display: flex; align-items: center; justify-content: space-between; gap: 28px; background: rgba(251, 250, 246, .96); backdrop-filter: blur(14px); box-shadow: 0 -12px 36px rgba(31, 41, 38, .06); }
.confirm-bar strong { display: block; font-size: 13px; }
.confirm-bar p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

.primary-action, .secondary-action { min-height: 44px; border-radius: 8px; padding: 11px 18px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; cursor: pointer; text-decoration: none; font-size: 13px; font-weight: 650; transition: transform 120ms ease, background 120ms ease, border-color 120ms ease; }
.primary-action { color: white; background: var(--brand); }
.primary-action:hover:not(:disabled) { background: var(--brand-dark); transform: translateY(-1px); }
.primary-action:disabled { opacity: .45; cursor: not-allowed; }
.primary-action.blocked-unsaved:disabled { opacity: 1; color: var(--muted); border-color: #b6b0a3; background: #e4e1d8; box-shadow: inset 0 0 0 2px rgba(154, 91, 22, .16); }
.secondary-action { color: var(--ink); border-color: var(--line-strong); background: transparent; }
.secondary-action:hover:not(:disabled) { border-color: var(--ink); }
.secondary-action:disabled { opacity: .45; cursor: not-allowed; }
.text-button { border: 0; padding: 4px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; }
.text-button:hover { color: var(--ink); }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: transparent; cursor: pointer; font-size: 19px; }
.icon-button:hover { color: var(--ink); border-color: var(--ink); }

input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; padding: 11px 12px; color: var(--ink); background: var(--surface); outline: none; transition: border-color 140ms ease, box-shadow 140ms ease; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 110, 99, .1); }
textarea { resize: vertical; line-height: 1.65; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 600; }
.form-error { margin: 0; padding: 10px 12px; border-left: 3px solid var(--danger); color: var(--danger); background: var(--danger-pale); font-size: 12px; line-height: 1.6; }

dialog { color: var(--ink); }
dialog::backdrop { background: rgba(31, 41, 38, .42); backdrop-filter: blur(2px); }
.edit-dialog, .confirm-dialog { width: min(680px, calc(100% - 32px)); max-height: calc(100vh - 40px); margin: auto; padding: 0; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); box-shadow: 0 30px 90px rgba(31, 41, 38, .18); }
.edit-dialog form, .confirm-dialog form { padding: 30px; display: grid; gap: 18px; }
.dialog-head { display: flex; justify-content: space-between; gap: 20px; align-items: start; }
.dialog-head h2, .confirm-dialog h2 { margin: 8px 0 0; font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -.035em; }
.form-grid { display: grid; gap: 16px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dialog-note { margin: 0; color: var(--quiet); font-size: 10px; line-height: 1.65; }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 4px; }
.portrait-dialog { width: min(840px, calc(100% - 32px)); }
.confirm-dialog { width: min(520px, calc(100% - 32px)); }
.confirm-dialog > form > p:not(.section-index):not(.form-error) { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }

.evidence-drawer { position: fixed; z-index: 42; top: 0; right: 0; bottom: 0; width: min(520px, 92vw); padding: 34px clamp(24px, 5vw, 46px); overflow-y: auto; background: var(--surface); box-shadow: -24px 0 70px rgba(31, 41, 38, .14); transform: translateX(105%); transition: transform 220ms ease; }
.evidence-drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: start; justify-content: space-between; gap: 24px; }
.drawer-head h2 { margin: 8px 0 0; font-family: var(--serif); font-size: 30px; font-weight: 600; }
.drawer-location { margin: 34px 0 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); color: var(--quiet); font-size: 10px; line-height: 1.6; }
.evidence-drawer blockquote { margin: 0; color: var(--muted); font-family: var(--serif); font-size: 17px; line-height: 2; white-space: pre-wrap; overflow-wrap: anywhere; }
.evidence-drawer mark { padding: 2px 1px; color: var(--ink); background: #cfe5dd; }
.drawer-scrim { position: fixed; z-index: 41; inset: 0; border: 0; background: rgba(31, 41, 38, .3); cursor: default; }

@keyframes page-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 820px) {
  body { padding-bottom: 114px; }
  .topbar { padding: 0 18px; }
  .user-email { display: none; }
  .review-workspace { width: min(100% - 36px, 680px); }
  .review-intro { padding-top: 52px; grid-template-columns: 1fr; gap: 38px; }
  .review-intro h1 { font-size: clamp(38px, 10vw, 58px); }
  .asset-row { grid-template-columns: 1fr; gap: 24px; }
  .asset-evidence { padding: 16px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .confirm-bar { padding-right: 18px; padding-left: 18px; }
}

@media (max-width: 520px) {
  .environment-chip { display: none; }
  .review-workspace { width: calc(100% - 32px); }
  .review-intro { padding: 42px 0 36px; }
  .review-intro h1 { font-size: 38px; }
  .intro-copy { font-size: 13px; }
  .task-facts dd { font-size: 19px; }
  .review-section { padding: 48px 0; }
  .section-heading, .portrait-heading { display: block; }
  .section-heading .secondary-action { width: 100%; margin-top: 22px; }
  .section-count { display: block; margin-top: 12px; }
  .asset-row h3 { font-size: 22px; }
  .portrait-body { grid-template-columns: 1fr; }
  .portrait-field.wide { grid-column: auto; }
  .portrait-interview { grid-template-columns: 1fr; }
  .two-columns { grid-template-columns: 1fr; }
  .edit-dialog form, .confirm-dialog form { padding: 23px 20px; }
  .confirm-bar { min-height: 106px; align-items: stretch; flex-direction: column; gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .confirm-bar > div { display: none; }
  .confirm-bar .primary-action { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
