:root {
  color-scheme: light;
  --ink: #1c211e;
  --muted: #707870;
  --paper: #f6f4ef;
  --panel: rgba(255, 255, 252, 0.92);
  --line: #deded6;
  --green: #244f3b;
  --green-soft: #e8f0e9;
  --gold: #b99b5d;
  --danger: #a84737;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.ambient { position: fixed; border-radius: 999px; filter: blur(80px); opacity: .3; pointer-events: none; }
.ambient-one { width: 360px; height: 360px; background: #c9dbc9; left: -100px; top: -120px; }
.ambient-two { width: 430px; height: 430px; background: #e6d6b5; right: -160px; bottom: -180px; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; position: relative; }
.login-card { width: min(440px, 100%); padding: 46px; border: 1px solid rgba(255,255,255,.8); border-radius: 28px; background: var(--panel); box-shadow: 0 25px 80px rgba(37, 51, 42, .12); backdrop-filter: blur(18px); }
.brand-mark { width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; color: #fff; background: var(--green); font: 600 27px Georgia, serif; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 12px; font-size: 20px; flex: 0 0 auto; }
.eyebrow { margin: 25px 0 6px; color: var(--gold); font-size: 12px; letter-spacing: .18em; font-weight: 700; }
h1, h2, h3 { font-family: Georgia, "Songti SC", serif; font-weight: 500; }
.login-card h1 { margin: 0; font-size: 34px; }
.intro { color: var(--muted); margin: 10px 0 30px; line-height: 1.7; }
.stack { display: grid; gap: 18px; }
label { display: grid; gap: 8px; color: #525a53; font-size: 13px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; color: var(--ink); background: #fff; outline: none; transition: border-color .16s, box-shadow .16s; }
input:focus, select:focus, textarea:focus { border-color: #78957f; box-shadow: 0 0 0 3px rgba(49, 96, 69, .1); }
textarea { min-height: 82px; resize: vertical; }
.primary, .secondary, .danger, .quiet { border: 0; border-radius: 11px; padding: 11px 16px; font-weight: 650; }
.primary { background: var(--green); color: #fff; }
.primary:hover { background: #173d2c; }
.secondary { color: var(--green); background: var(--green-soft); }
.quiet { color: #505851; background: #eeeDE8; }
.danger { color: #fff; background: var(--danger); }
.text-button { border: 0; padding: 0; background: none; color: #667269; text-align: left; }
.form-error { color: var(--danger); min-height: 20px; margin: 0; font-size: 13px; }
.login-footnote { color: #8a918b; font-size: 12px; line-height: 1.6; margin: 25px 0 0; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; position: relative; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 22px; background: rgba(30, 50, 39, .97); color: #eef3ee; display: flex; flex-direction: column; z-index: 4; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 38px; }
.sidebar-brand b, .sidebar-brand small { display: block; }
.sidebar-brand small { color: #aab9ae; margin-top: 3px; }
#nav { display: grid; gap: 7px; }
#nav button { border: 0; border-radius: 11px; padding: 11px 13px; text-align: left; color: #cbd6ce; background: transparent; }
#nav button:hover, #nav button.active { color: #fff; background: rgba(255,255,255,.1); }
.sidebar-footer { margin-top: auto; padding: 17px 12px 0; border-top: 1px solid rgba(255,255,255,.12); display: grid; gap: 7px; font-size: 13px; }
.sidebar-footer .muted { color: #9daba1; }
.sidebar-footer .text-button { color: #d7dfd9; margin-top: 8px; }
.workspace { min-width: 0; padding: 48px clamp(28px, 5vw, 76px) 80px; }
.mobile-header { display: none; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-head h1 { margin: 0 0 7px; font-size: 32px; }
.page-head p { margin: 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.flash { position: fixed; z-index: 9; right: 28px; top: 24px; max-width: 440px; padding: 13px 17px; border-radius: 12px; color: #fff; background: var(--green); box-shadow: 0 13px 40px rgba(0,0,0,.18); }
.flash.error { background: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat, .card { border: 1px solid var(--line); border-radius: 17px; background: var(--panel); box-shadow: 0 8px 30px rgba(46,55,49,.04); }
.stat { padding: 22px; }
.stat span { display: block; color: var(--muted); font-size: 13px; }
.stat strong { display: block; margin-top: 9px; font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.card { padding: 24px; margin-bottom: 18px; }
.card h2, .card h3 { margin: 0 0 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 17px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { color: var(--muted); font-size: 12px; font-weight: 650; text-align: left; }
th, td { border-bottom: 1px solid #ecece7; padding: 12px 10px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; border-radius: 99px; padding: 4px 9px; font-size: 11px; background: #ecefea; color: #4c5d50; }
.badge.active { background: #e4f0e7; color: #26613e; }
.badge.draft { background: #f2ead8; color: #775f2e; }
.row-action { border: 0; background: none; color: var(--green); padding: 4px; font-weight: 650; }
.empty { text-align: center; color: var(--muted); padding: 35px; }

.map-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(310px, .55fr); gap: 18px; }
.map { width: 100%; min-height: 520px; border-radius: 14px; border: 1px solid var(--line); overflow: hidden; background: #e9ece7; }
.venue-search-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-bottom: 10px; }
.venue-search-bar button { min-width: 78px; }
.venue-search-results { display: grid; gap: 6px; max-height: 250px; overflow-y: auto; margin-bottom: 10px; }
.venue-search-result { display: grid; gap: 3px; width: 100%; padding: 10px 12px; border: 1px solid #e2e4de; border-radius: 10px; color: var(--ink); background: #fff; text-align: left; }
.venue-search-result:hover { border-color: #9cad9f; background: #f6f9f5; }
.venue-search-result span, .venue-search-result small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.venue-search-message { padding: 11px 12px; border-radius: 10px; color: var(--muted); background: #f0f1ec; font-size: 12px; line-height: 1.55; }
.map-placeholder { min-height: 520px; display: grid; place-items: center; text-align: center; padding: 35px; color: var(--muted); line-height: 1.7; }
.map-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.map-tools button { padding: 8px 12px; }
.map-tools .hint { margin-left: auto; padding: 8px 11px; }
.map-help { margin: 8px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.editor-panel { display: flex; flex-direction: column; gap: 14px; }
.editor-panel .form-actions { margin-top: auto; }
.hint { padding: 11px 13px; border-radius: 10px; color: #5e675f; background: #f0f1ec; font-size: 12px; line-height: 1.6; }
.topology-status { padding: 10px 12px; border: 1px solid #dfe6df; border-radius: 10px; color: var(--green); background: #f1f6f1; font-size: 12px; line-height: 1.5; }
.topology-status.invalid { border-color: #edc9c2; color: var(--danger); background: #fbefed; }
.section-label { margin-bottom: 8px; color: #525a53; font-size: 13px; }
.vertex-list { max-height: 210px; overflow-y: auto; border: 1px solid #e5e5df; border-radius: 10px; background: #fff; }
.vertex-row { display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 38px; padding: 6px 8px; border-bottom: 1px solid #efefe9; color: #687068; font-size: 11px; font-variant-numeric: tabular-nums; }
.vertex-row:last-child { border-bottom: 0; }
.vertex-number { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 99px; color: #fff; background: var(--green); font-weight: 700; }
.vertex-row button { border: 0; padding: 5px 7px; color: var(--danger); background: transparent; font-size: 11px; }
.empty.compact { padding: 18px; font-size: 12px; }
.relation-list { display: grid; gap: 9px; max-height: 290px; overflow-y: auto; padding-right: 3px; }
.relation-row { display: grid; grid-template-columns: auto minmax(0,1fr) 118px; align-items: center; gap: 9px; padding: 10px; border: 1px solid #e5e5df; border-radius: 10px; background: #fff; }
.relation-row small { display: block; color: var(--muted); margin-top: 3px; }
.relation-row select { padding: 7px; }
.checkboxes { display: grid; gap: 8px; }
.checkboxes label { display: flex; align-items: center; gap: 9px; }
.checkboxes input { width: auto; }
.audit-list { display: grid; gap: 0; }
.audit-item { display: grid; grid-template-columns: 150px 1fr auto; gap: 18px; padding: 13px 0; border-bottom: 1px solid #ecece7; font-size: 13px; }
.audit-item:last-child { border: 0; }

.runtime-banner { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 14px 17px; border: 1px solid #d9e1da; border-radius: 15px; background: rgba(240, 246, 240, .86); }
.runtime-banner div { display: grid; gap: 3px; }
.runtime-banner small { color: var(--muted); }
.runtime-banner .badge { margin-left: auto; }
.runtime-dot { width: 10px; height: 10px; border-radius: 50%; background: #9ca39d; box-shadow: 0 0 0 5px rgba(128, 137, 130, .1); }
.runtime-dot.live { background: #3c8f5c; box-shadow: 0 0 0 5px rgba(60, 143, 92, .12); }
.pair-detail { border-color: #cdd9cf; box-shadow: 0 14px 45px rgba(36,79,59,.08); }
.pair-detail .eyebrow, .replay-result .eyebrow { margin: 0 0 7px; }
.notice { margin: 14px 0; padding: 13px 15px; border-radius: 11px; font-size: 13px; line-height: 1.6; }
.notice.warning { border: 1px solid #ead4a5; color: #6b5628; background: #fbf5e7; }
.comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin: 18px 0; }
.comparison-panel { min-height: 165px; padding: 18px; border: 1px solid #e0e2dc; border-radius: 14px; background: #fafaf7; }
.comparison-panel > small { display: block; color: var(--muted); margin-bottom: 8px; }
.comparison-panel > strong { display: block; font: 500 40px Georgia, serif; }
.comparison-panel > p { color: var(--muted); line-height: 1.55; }
.replay-form { display: grid; gap: 12px; }
.replay-form label { gap: 6px; }
.consent-row { display: grid !important; grid-template-columns: auto minmax(0,1fr); align-items: start; gap: 9px !important; color: #586159; line-height: 1.5; }
.consent-row input { width: auto; margin-top: 3px; }
.material-grid { margin-top: 16px; }
.material-grid details, .raw-json { border: 1px solid #e2e3de; border-radius: 12px; background: #fbfbf8; overflow: hidden; }
.material-grid summary, .raw-json summary { cursor: pointer; padding: 13px 15px; color: #4f5b52; font-weight: 650; }
pre { margin: 0; padding: 16px; overflow: auto; max-height: 420px; color: #263229; background: #f3f4ef; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.raw-json { margin-top: 16px; }
.metric-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 13px 0 18px; }
.metric-strip span { padding: 7px 10px; border-radius: 9px; color: #5c665e; background: #eef1ec; font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.attempt-grid { display: grid; gap: 16px; }
.attempt-card { padding: 19px; border: 1px solid #dfe2dc; border-radius: 15px; background: #fff; }
.attempt-card h3 { margin: 0; }
.score-orb { width: 68px; height: 68px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--green); font: 500 20px Georgia, serif; }
.pair-thesis { margin: 4px 0 14px; font-size: 17px; line-height: 1.7; }
.dimensions { border-top: 1px solid #eceee9; }
.dimension-row { display: grid; grid-template-columns: minmax(240px,1.5fr) minmax(130px,.7fr) minmax(130px,.7fr) 105px; gap: 14px; align-items: center; padding: 15px 0; border-bottom: 1px solid #eceee9; }
.dimension-row small { display: block; margin-top: 5px; color: var(--muted); line-height: 1.5; }
.direction-score { display: grid; gap: 5px; color: #586259; font-size: 11px; }
.score-track { height: 6px; overflow: hidden; border-radius: 99px; background: #e5e9e4; }
.score-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7fa58a, #244f3b); }
.confidence { color: var(--muted); font-size: 11px; }
.replay-copy { margin-top: 18px; }
.replay-copy h4 { margin: 0 0 8px; }
.replay-copy ul { margin: 0; padding-left: 18px; color: #596259; line-height: 1.7; }
.replay-loading { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.replay-loading span { width: 15px; height: 15px; border: 2px solid #c6d0c8; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
.danger-soft { color: var(--danger); background: #f7e9e6; }
.mode-two-card { border-color: #c5d5c8; background: linear-gradient(145deg, rgba(250,252,248,.98), rgba(239,245,237,.95)); }
.mode-two-card .eyebrow { margin: 0 0 6px; }
.simulation-intent-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 9px; max-height: 270px; overflow-y: auto; padding: 11px; border: 1px solid #dfe5dd; border-radius: 13px; background: rgba(255,255,255,.72); }
.simulation-intent-picker label { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 10px; align-items: start; padding: 11px; border: 1px solid #e4e7e1; border-radius: 11px; background: #fff; cursor: pointer; }
.simulation-intent-picker input { width: auto; margin-top: 3px; }
.simulation-intent-picker small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.45; }
.simulation-settings { margin-top: 14px; }
.simulation-submit-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px; align-items: end; margin-top: 16px; }
.simulation-submit-row > div { display: flex; align-items: center; gap: 12px; }
.simulation-result { border-color: #bfcfc2; box-shadow: 0 15px 44px rgba(36,79,59,.09); }
.compact-stats { margin-top: 18px; }
.compact-stats .stat { padding: 15px; }
.compact-stats .stat strong { font-size: 24px; }
.selected-pairs { display: grid; gap: 10px; margin: 22px 0; }
.selected-pairs article { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px; border: 1px solid #cad8cc; border-radius: 14px; background: #f4f8f3; }
.selected-pairs small { display: block; max-width: 720px; margin-top: 6px; color: var(--muted); line-height: 1.55; }
.small-orb { width: 56px; height: 56px; flex: 0 0 auto; font-size: 16px; }
.simulation-columns { margin: 24px 0; }
.simulation-timeline { position: relative; display: grid; gap: 0; max-height: 440px; overflow-y: auto; padding-left: 10px; }
.timeline-event { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 15px; padding: 11px 8px 11px 18px; border-left: 2px solid #d9dfd8; }
.timeline-event::before { content: ''; position: absolute; width: 8px; height: 8px; margin: 5px 0 0 -23px; border-radius: 50%; background: #a7b4aa; }
.timeline-event.proposal { border-left-color: var(--green); background: #f1f6f0; }
.timeline-event.proposal::before { background: var(--green); box-shadow: 0 0 0 4px rgba(36,79,59,.1); }
.timeline-event time { color: var(--muted); font-size: 11px; }
.timeline-event small { display: block; margin-top: 4px; color: var(--muted); }
.intent-outcomes { display: grid; gap: 8px; }
.intent-outcomes > div { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding: 12px; border: 1px solid #e2e5df; border-radius: 11px; background: #fff; }
.intent-outcomes small { grid-column: span 2; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .map-grid { grid-template-columns: 1fr; }
  .map { min-height: 430px; }
  .dimension-row { grid-template-columns: 1fr 1fr; }
  .dimension-row > div:first-child { grid-column: span 2; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .2s; width: 250px; }
  .sidebar.open { transform: translateX(0); }
  .workspace { padding: 0 18px 55px; }
  .mobile-header { height: 62px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
  .mobile-header button { border: 0; border-radius: 8px; padding: 8px 11px; }
  .page-head { display: grid; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .login-card { padding: 34px 27px; }
  .audit-item { grid-template-columns: 1fr; gap: 4px; }
  .runtime-banner { align-items: flex-start; flex-wrap: wrap; }
  .runtime-banner .badge { margin-left: 0; }
  .comparison-grid { grid-template-columns: 1fr; }
  .dimension-row { grid-template-columns: 1fr; }
  .dimension-row > div:first-child { grid-column: auto; }
  .simulation-submit-row { grid-template-columns: 1fr; }
  .simulation-submit-row > div { align-items: stretch; flex-direction: column; }
  .timeline-event { grid-template-columns: 1fr; gap: 4px; }
}

.staff-pair-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:24px; }
.staff-person { min-width:0; padding:16px; border:1px solid #e1e4dc; border-radius:14px; }
.staff-person h3 { margin-top:0; }
.staff-photos { display:flex; gap:8px; flex-wrap:wrap; }
.staff-photos img { width:100px; height:126px; object-fit:cover; border-radius:10px; }
.staff-profile-copy { overflow-wrap:anywhere; white-space:pre-wrap; font-size:13px; line-height:1.7; padding:12px 0; }
.staff-person details { margin-top:12px; }
.staff-person summary { cursor:pointer; }
@media(max-width:760px) { .staff-pair-grid { grid-template-columns:1fr; } }
