:root {
  --ink: #17201d;
  --muted: #69746f;
  --line: #dfe5e1;
  --soft: #f4f7f5;
  --paper: #ffffff;
  --green: #176b4b;
  --green-2: #249168;
  --green-soft: #e8f4ee;
  --amber: #b56b17;
  --amber-soft: #fff4df;
  --red: #b84942;
  --red-soft: #fcecea;
  --blue: #3c648c;
  --shadow: 0 16px 44px rgba(31, 50, 42, .09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--soft); color: var(--ink); font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }

.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.15fr) minmax(380px, .85fr); background: #eef3f0; }
.login-brand { padding: 11vh 8vw; background: radial-gradient(circle at 25% 15%, #2e8a68 0, #176b4b 32%, #104f38 100%); color: white; display: flex; flex-direction: column; justify-content: center; }
.login-brand .eyebrow { color: #b7e7d2; }
.login-brand h1 { font-size: clamp(42px, 5vw, 72px); line-height: 1.08; margin: 20px 0; letter-spacing: -.04em; }
.login-brand p { max-width: 620px; color: #d6e9e0; font-size: 18px; line-height: 1.7; }
.login-points { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.login-points span { border: 1px solid rgba(255,255,255,.24); border-radius: 999px; padding: 8px 13px; color: #ecf8f2; font-size: 13px; }
.login-card { align-self: center; justify-self: center; width: min(420px, calc(100vw - 40px)); padding: 42px; background: white; border-radius: 24px; box-shadow: var(--shadow); }
.brand-mark { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--green); color: white; font-size: 24px; font-weight: 900; }
.brand-mark.small { width: 34px; height: 34px; border-radius: 10px; font-size: 16px; }
.login-card h2 { margin: 28px 0 4px; font-size: 28px; }
label { display: grid; gap: 8px; color: #39443f; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #cfd8d3; border-radius: 10px; padding: 11px 13px; color: var(--ink); background: white; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(36,145,104,.12); }
textarea { min-height: 108px; resize: vertical; line-height: 1.55; }
.login-card label { margin-top: 20px; }
.form-error { color: var(--red); min-height: 20px; font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; background: #11251d; color: white; padding: 24px 16px; display: flex; flex-direction: column; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 28px; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-radius: 10px; background: transparent; color: #b9c9c1; text-align: left; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.09); }
.nav-item span { width: 18px; text-align: center; }
.sidebar-note { margin-top: auto; border: 1px solid rgba(255,255,255,.09); border-radius: 12px; padding: 14px; color: #bed0c7; }
.sidebar-note strong { color: #e8f5ee; font-size: 13px; }
.sidebar-note p { margin: 8px 0 0; font-size: 11px; line-height: 1.6; }

.main { min-width: 0; }
.topbar { min-height: 104px; padding: 25px 38px 19px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); backdrop-filter: blur(12px); display: flex; justify-content: space-between; align-items: center; }
.topbar h1 { margin: 5px 0 0; font-size: 25px; letter-spacing: -.02em; }
.user-area { display: flex; gap: 14px; align-items: center; text-align: right; }
.user-area small { display: block; color: var(--muted); margin-top: 3px; }
.icon-button { border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--muted); padding: 8px 11px; }
.icon-button:hover { color: var(--ink); border-color: #aebbb4; }
.page-content { padding: 30px 38px 70px; max-width: 1480px; margin: 0 auto; }

.button { border: 1px solid var(--line); border-radius: 9px; padding: 10px 16px; background: white; color: var(--ink); font-weight: 700; }
.button.primary { border-color: var(--green); background: var(--green); color: white; }
.button.primary:hover { background: #115c40; }
.button.ghost:hover { border-color: var(--green); color: var(--green); }
.button.danger { color: var(--red); border-color: #efc7c2; }
.button.small { padding: 6px 10px; font-size: 12px; }
.button.wide { width: 100%; margin-top: 26px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.hero-strip { background: linear-gradient(110deg, #163e2e, #216d50); color: white; border-radius: var(--radius); padding: 28px 30px; display: flex; justify-content: space-between; align-items: center; gap: 22px; margin-bottom: 22px; }
.hero-strip h2 { margin: 6px 0 7px; font-size: 24px; }
.hero-strip p { margin: 0; color: #cfe6da; }
.hero-strip .button { border-color: white; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: 0 4px 18px rgba(30,50,40,.035); }
.card h2, .card h3 { margin-top: 0; }
.metric { display: flex; flex-direction: column; gap: 9px; }
.metric strong { font-size: 28px; }
.metric span { color: var(--muted); font-size: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin: 28px 0 14px; }
.section-head h2 { margin: 0; font-size: 19px; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.form-card { max-width: 900px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; }
.choice { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); padding: 10px; border-radius: 9px; font-weight: 500; }
.choice input { width: auto; }
.notice { border-left: 3px solid var(--amber); background: var(--amber-soft); padding: 12px 14px; border-radius: 7px; color: #684616; font-size: 13px; line-height: 1.6; }

.table-wrap { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 13px 15px; font-size: 13px; vertical-align: top; }
th { color: var(--muted); background: #f8faf9; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 9px; background: var(--soft); color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.status.complete, .status.published, .status.active { background: var(--green-soft); color: var(--green); }
.status.failed, .status.archived { background: var(--red-soft); color: var(--red); }
.status.queued, .status.preparing, .status.crawling, .status.analyzing, .status.submitted, .status.complete_with_gaps, .status.waiting_for_crawler { background: var(--amber-soft); color: var(--amber); }
.progress { width: 110px; height: 6px; border-radius: 999px; background: #e7ece9; overflow: hidden; margin-top: 7px; }
.progress span { display: block; height: 100%; background: var(--green-2); }
.empty { padding: 50px 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 7px; }

.tabs { display: flex; gap: 5px; padding: 5px; border-radius: 11px; background: #e9eeeb; width: fit-content; margin-bottom: 18px; }
.tab { border: 0; background: transparent; color: var(--muted); border-radius: 8px; padding: 8px 13px; font-weight: 700; }
.tab.active { background: white; color: var(--green); box-shadow: 0 2px 8px rgba(20,45,35,.08); }
.asset-card { display: flex; flex-direction: column; gap: 12px; }
.asset-card .asset-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.asset-card h3 { margin: 0; font-size: 17px; line-height: 1.4; }
.asset-card p { margin: 0; color: #4f5b56; line-height: 1.65; font-size: 13px; }
.context-summary { display: grid; gap: 9px; padding: 13px; border-radius: 10px; background: #f5f8f6; }
.context-summary div { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: start; }
.context-summary strong { font-size: 12px; color: var(--muted); }
.context-summary span { font-size: 13px; line-height: 1.55; }
.tag { border-radius: 999px; padding: 4px 8px; background: var(--soft); color: var(--muted); font-size: 11px; }
.evidence { border-left: 3px solid #b5c8be; padding: 8px 11px; background: #f8faf9; color: #46534d; font-size: 12px; border-radius: 4px; }
.json-preview { max-height: 220px; overflow: auto; padding: 12px; border-radius: 9px; background: #17201d; color: #d8e9e0; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }

.report-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.report-header h2 { margin: 6px 0; font-size: 26px; }
.signal-bar { display: grid; grid-template-columns: 150px 1fr 64px; gap: 12px; align-items: center; margin: 11px 0; font-size: 13px; }
.signal-block { border-bottom: 1px solid var(--line); padding: 2px 0 12px; }
.signal-block:last-child { border-bottom: 0; }
.signal-block details { margin-left: 162px; color: var(--muted); font-size: 12px; }
.signal-block summary { cursor: pointer; color: var(--green); font-weight: 700; }
.signal-track { background: #e8eeeb; height: 9px; border-radius: 99px; overflow: hidden; }
.signal-track span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #64b68f); border-radius: 99px; }
.quote-list { display: grid; gap: 8px; }

.toast { position: fixed; top: 20px; right: 24px; z-index: 20; background: #173b2d; color: white; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 420px; }
.toast.error { background: #8f332e; }

.editor-dialog { width: min(920px, calc(100vw - 30px)); max-height: 90vh; border: 0; border-radius: 20px; padding: 0; box-shadow: 0 24px 80px rgba(20,35,29,.28); }
.editor-dialog::backdrop { background: rgba(12,27,21,.58); backdrop-filter: blur(3px); }
.dialog-shell > header, .dialog-shell > footer { padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.dialog-shell > footer { border-bottom: 0; border-top: 1px solid var(--line); justify-content: flex-end; }
.dialog-shell h2 { margin: 4px 0 0; }
.dialog-body { max-height: 65vh; overflow: auto; padding: 24px; }
.dialog-body .form-grid { gap: 15px; }
.context-section { padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: #f7faf8; }
.context-section h3 { margin: 5px 0 4px; font-size: 17px; }
.context-section p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.stage-guide { padding: 13px 15px; border-radius: 10px; background: var(--green-soft); color: var(--green); }
.stage-guide p { margin: 5px 0 0; color: #355c4a; font-size: 12px; line-height: 1.55; }
.context-detail { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.context-detail-row { display: grid; grid-template-columns: 150px 1fr; gap: 18px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.context-detail-row:last-child { border-bottom: 0; }
.context-detail-row strong { font-size: 12px; color: var(--muted); }
.context-detail-row p { margin: 0; line-height: 1.6; white-space: pre-wrap; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 76px 1fr; }
  .sidebar { padding: 20px 10px; }
  .sidebar-brand strong, .nav-item:not(.active) { font-size: 0; }
  .nav-item { justify-content: center; }
  .nav-item.active { font-size: 0; }
  .nav-item span { font-size: 18px; }
  .sidebar-note { display: none; }
  .grid.four { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .choice-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 700px) {
  .login-view { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 10; bottom: 0; top: auto; height: 64px; width: 100%; padding: 7px; flex-direction: row; }
  .sidebar-brand, .sidebar-note { display: none; }
  .sidebar nav { width: 100%; display: flex; justify-content: space-around; }
  .nav-item, .nav-item.active { font-size: 0; width: auto; }
  .nav-item span { font-size: 21px; }
  .topbar { padding: 18px 18px 14px; }
  .topbar h1 { font-size: 20px; }
  .user-area div { display: none; }
  .page-content { padding: 20px 16px 90px; }
  .grid.two, .grid.three, .grid.four, .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .context-detail-row, .context-summary div { grid-template-columns: 1fr; gap: 4px; }
  .choice-grid { grid-template-columns: 1fr; }
  .hero-strip, .report-header { align-items: flex-start; flex-direction: column; }
}
