:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17201a;
  --muted: #66736b;
  --line: #dfe5e1;
  --accent: #146c43;
  --accent-hover: #0e5735;
  --accent-soft: #e7f7ee;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --warn: #9a4b0d;
  --warn-soft: #fff7e7;
  --info: #175cd3;
  --info-soft: #edf5ff;
  --focus: #2563eb;
  --radius: 14px;
  --shadow: 0 1px 3px rgb(16 24 40 / 8%);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }
::selection { color: #fff; background: var(--accent); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
a { color: var(--info); }
pre { max-width: 100%; }

.skip { position: fixed; left: 12px; top: -80px; z-index: 100; padding: 10px 14px; color: #111; background: #fff; border-radius: 8px; }
.skip:focus { top: 12px; }
.shell { display: grid; grid-template-columns: 254px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; z-index: 10; height: 100vh; overflow-y: auto; padding: 18px 14px 118px; color: #fff; background: #102018; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.brand small, .persona-switch small { display: block; color: #a9b8af; }
.mark { display: grid; place-items: center; width: 36px; height: 36px; color: #07351e; background: #39d98a; border-radius: 10px; font-weight: 900; }
.persona-switch { width: 100%; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 10px; color: #fff; text-align: left; background: #1b3024; border: 1px solid #35503f; border-radius: 12px; }
.persona-switch > span:first-child { display: grid; place-items: center; width: 34px; height: 34px; color: #14532d; background: #d1fae5; border-radius: 50%; font-weight: 800; }
.persona-switch b, .persona-switch small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.persona-menu { position: absolute; left: 14px; right: 14px; top: 112px; z-index: 12; max-height: 45vh; overflow-y: auto; padding: 6px; color: #111; background: #fff; border-radius: 12px; box-shadow: 0 16px 40px #0006; }
.persona-menu button { width: 100%; padding: 10px; text-align: left; background: none; border: 0; border-radius: 8px; }
.persona-menu button:hover, .persona-menu button:focus-visible, .persona-menu button[aria-checked="true"] { background: #ecfdf3; }
.hidden { display: none !important; }
nav { margin-top: 18px; }
nav button { width: 100%; margin: 2px 0; padding: 10px 12px; color: #c5d1ca; text-align: left; background: transparent; border: 0; border-radius: 9px; }
nav button.active, nav button:hover, nav button:focus-visible { color: #fff; background: #264333; }
.mock-banner { position: absolute; left: 14px; right: 14px; bottom: 16px; padding: 10px; color: #d6ded8; background: #13291d; border: 1px solid #405b4b; border-radius: 10px; pointer-events: none; }
.mock-banner b { color: #fbbf24; font-size: 11px; }
.mock-banner span { display: block; margin-top: 3px; font-size: 11px; }
.nav-backdrop { display: none; }

main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 28px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 2px 0; font-size: 22px; letter-spacing: -.02em; }
.scope-context, .setup-note { display: block; color: var(--muted); font-size: 12px; }
.top-actions, .actions { display: flex; flex-wrap: wrap; gap: 8px; }
#mobile-nav { display: none; background: none; border: 0; font-size: 22px; }
.view { width: 100%; max-width: 1500px; margin: auto; padding: 26px 28px 60px; }
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 18px; }
.card { min-width: 0; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card h2, .card h3 { margin: 0 0 12px; }
.onboarding { margin-top: 16px; background: linear-gradient(135deg, #fff, #effcf4); border-color: #86d7a9; }
.onboarding li { margin: 6px 0; }
.auth-card { max-width: 620px; margin: 56px auto; border-color: #9ebef9; box-shadow: 0 18px 50px rgb(16 24 40 / 12%); }
.metric strong { display: block; margin-top: 4px; font-size: 28px; }
.metric span, .muted { color: var(--muted); }
.small { font-size: 12px; }
.section-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 10px; }
.section-title h2 { margin: 0; font-size: 16px; }
.list { display: grid; gap: 8px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.row-main { display: flex; min-width: 0; align-items: center; gap: 10px; }
.row-main strong, .row-main span { display: block; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 4px 8px; overflow-wrap: anywhere; border-radius: 999px; font-size: 11px; font-weight: 800; }
.badge::before { flex: 0 0 auto; width: 6px; height: 6px; background: currentColor; border-radius: 50%; content: ""; }
.green { color: #146c43; background: var(--accent-soft); }
.red { color: var(--danger); background: var(--danger-soft); }
.yellow { color: var(--warn); background: var(--warn-soft); }
.blue { color: var(--info); background: var(--info-soft); }
.gray { color: #475467; background: #f2f4f7; }
.persona-chip { display: grid; flex: 0 0 32px; width: 32px; height: 32px; place-items: center; color: #027a48; background: #ecfdf3; border-radius: 50%; font-weight: 800; }
.notice { margin: 8px 0; padding: 12px 14px; overflow-wrap: anywhere; border: 1px solid; border-radius: 10px; }
.notice.warn { background: var(--warn-soft); border-color: #f79009; }
.notice.error { background: var(--danger-soft); border-color: #f04438; }
.notice.info { background: var(--info-soft); border-color: #2e90fa; }
.tabs { display: flex; gap: 4px; margin-bottom: 18px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs button { flex: 0 0 auto; padding: 10px 12px; background: none; border: 0; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--accent); border-color: var(--accent); font-weight: 800; }
.progress { height: 8px; overflow: hidden; background: #eaecf0; border-radius: 9px; }
.progress span { display: block; height: 100%; background: var(--accent); }
.timeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.step { padding: 9px 6px; text-align: center; background: #f2f4f7; border-radius: 8px; font-size: 10px; }
.step.done { color: #166534; background: #dcfce7; }
.step.current { background: #f0fdf4; outline: 2px solid #16a34a; }
.step.blocked { color: var(--danger); background: var(--danger-soft); }
.form { display: grid; gap: 14px; }
.field label { display: block; margin-bottom: 6px; font-weight: 700; }
.field input, .field textarea, .field select { width: 100%; padding: 10px; color: var(--text); background: #fff; border: 1px solid #b8c2bc; border-radius: 9px; }
.field textarea { min-height: 92px; resize: vertical; }
.check { display: flex; gap: 9px; align-items: flex-start; margin: 14px 0; }
.check input { flex: 0 0 auto; margin-top: 3px; }
.scope-picker { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.scope-picker legend { padding-inline: 5px; font-weight: 700; }
.scope-picker label { display: inline-flex; min-height: 32px; align-items: center; gap: 7px; }
.primary, .ghost, .danger-btn { min-height: 38px; padding: 9px 13px; border-radius: 9px; font-weight: 750; }
.primary { color: #fff; background: var(--accent); border: 1px solid var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.ghost { color: #344054; background: #fff; border: 1px solid #c6ceca; }
.danger-btn { color: var(--danger); background: #fff; border: 1px solid #fda29b; }
.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 18px; background: #0009; }
.modal { width: min(720px, 100%); max-height: 90vh; overflow-y: auto; padding: 22px; background: #fff; border-radius: 16px; box-shadow: 0 24px 70px #0006; }
.modal h2 { margin-top: 0; }
.wizard-steps { display: flex; gap: 6px; margin-bottom: 18px; }
.wizard-steps span { height: 5px; flex: 1; background: #eaecf0; border-radius: 5px; }
.wizard-steps span.on { background: #16a34a; }
.evidence { padding: 10px 12px; border: 1px solid #84adff; border-radius: 10px; }
.tree { padding-left: 16px; border-left: 1px solid #d0d5dd; }
.tree .node { margin: 8px 0; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.kpi-up { color: #067647; }
.kpi-down { color: var(--danger); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.empty { padding: 38px; color: var(--muted); text-align: center; }
.nav-label { margin: 20px 12px 7px; color: #8fa198; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.today-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .65fr); gap: 22px; margin-top: 16px; }
.worktable { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.worktable-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px; border-bottom: 1px solid var(--line); }
.worktable-head h2, .today-rail h2, .portfolio-head h2, .ceo-intro h2, .review-summary h2, .calendar-head h2, .asset-head h2, .exception-head h2, .advanced-intro h2 { margin: 0 0 5px; letter-spacing: -.02em; }
.worktable-head p, .portfolio-head p, .ceo-intro p, .review-summary p, .calendar-head p, .asset-head p, .exception-head p, .advanced-intro p { max-width: 70ch; margin: 0; color: var(--muted); }
.work-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.work-row:last-child { border-bottom: 0; }
.work-row strong, .work-row span, .rail-item strong, .rail-item span { display: block; }
.work-row > div > span, .rail-item span { color: var(--muted); font-size: 12px; }
.quiet-state { display: grid; gap: 4px; padding: 48px 22px; color: var(--muted); text-align: center; }
.quiet-state strong { color: var(--text); font-size: 18px; }
.today-rail { display: grid; align-content: start; gap: 16px; }
.today-rail section { padding: 18px; background: #eaf4ee; border-radius: var(--radius); }
.today-rail section + section { background: var(--panel); border: 1px solid var(--line); }
.pulse { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 18px 0; background: #bfd2c7; }
.pulse div { padding: 11px; background: #eaf4ee; }
.pulse dt { color: #56635b; font-size: 11px; }
.pulse dd { margin: 3px 0 0; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.text-action { padding: 0; color: var(--accent); background: none; border: 0; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.rail-item { padding: 10px 0; border-top: 1px solid var(--line); }
.portfolio-head, .calendar-head, .asset-head, .exception-head, .advanced-intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.portfolio-table { overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.portfolio-row { display: grid; grid-template-columns: minmax(240px, 1.5fr) minmax(130px, .8fr) 70px 70px 85px auto; gap: 14px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.portfolio-row:last-child { border-bottom: 0; }
.portfolio-labels { color: var(--muted); background: #f8faf9; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.portfolio-persona { display: flex; align-items: center; gap: 11px; min-width: 0; }
.portfolio-persona strong, .portfolio-persona small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portfolio-persona i { font-style: normal; }
.portfolio-persona small { color: var(--muted); }
.ceo-intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 22px; align-items: end; padding: 28px; margin-bottom: 18px; color: #f3fff8; background: #173525; border-radius: var(--radius); }
.ceo-intro p { color: #bcd0c4; }
.ceo-rule { min-width: 180px; padding: 14px 16px; color: #173525; background: #8ce8b6; border-radius: 12px; }
.ceo-rule b, .ceo-rule span { display: block; }
.ceo-rule span { margin-top: 3px; }
.decision-sheet { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr); gap: 24px; padding: 20px 22px; background: var(--panel); border-bottom: 1px solid var(--line); }
.decision-sheet:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.decision-sheet:last-child { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.decision-sheet h3 { margin: 5px 0 8px; }
.ceo-analysis { display: grid; grid-template-columns: minmax(220px, .55fr) minmax(0, 1fr); gap: 28px; margin-bottom: 18px; }
.ceo-analysis-copy h2, .ceo-research-result h2 { margin: 2px 0 8px; }
.ceo-analysis-copy p:last-child { color: var(--muted); line-height: 1.55; }
.ceo-source-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 10px; }
.ceo-research-result { margin-bottom: 18px; }
.asset-text-preview { max-height: 420px; overflow: auto; padding: 18px; white-space: pre-wrap; overflow-wrap: anywhere; background: #f6f8f7; border: 1px solid var(--line); border-radius: 10px; font: inherit; line-height: 1.55; }
.review-summary { padding: 0 0 18px; border-bottom: 1px solid var(--line); }
.calendar-list, .asset-ledger { overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.calendar-list article { display: grid; grid-template-columns: 190px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.calendar-list article:last-child, .asset-row:last-child { border-bottom: 0; }
.calendar-list time { color: var(--muted); font-variant-numeric: tabular-nums; }
.calendar-list strong, .calendar-list span, .asset-row strong, .asset-row span, .asset-row small { display: block; }
.calendar-list span, .asset-row small { color: var(--muted); }
.asset-row { display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(180px, .6fr) auto; gap: 18px; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.exception-list { overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.exception-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, .85fr); gap: 28px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.exception-row:last-child { border-bottom: 0; }
.exception-row h3 { margin: 5px 0 7px; }
.exception-row details { margin: 10px 0; }
.advanced-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.advanced-links button { min-height: 70px; text-align: left; }
.advanced-links strong, .advanced-links span { display: block; }
.advanced-links span { margin-top: 3px; color: var(--muted); font-size: 12px; }
#toast { position: fixed; right: 20px; bottom: 20px; z-index: 40; max-width: min(430px, calc(100vw - 40px)); }
.toast { padding: 12px 16px; color: #fff; background: #111827; border-radius: 10px; box-shadow: 0 8px 30px #0003; }

@media(max-width:1000px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 220px minmax(0, 1fr); }
  .today-layout { grid-template-columns: 1fr; }
  .portfolio-row { grid-template-columns: minmax(210px, 1fr) 120px 65px 65px auto; }
  .portfolio-row > :nth-child(5) { display: none; }
  .advanced-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media(max-width:720px) {
  .shell { display: block; }
  .sidebar { position: fixed; left: 0; display: flex; width: 254px; flex-direction: column; overflow: hidden; padding-bottom: 16px; box-shadow: 10px 0 28px #0005; transform: translateX(calc(-100% - 32px)); transition: transform .18s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar nav { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; }
  .sidebar .mock-banner { position: static; flex: 0 0 auto; margin-top: 8px; }
  .nav-backdrop { position: fixed; inset: 0; z-index: 9; display: block; width: 100%; height: 100%; padding: 0; background: #0007; border: 0; }
  .topbar { padding: 10px 14px; }
  .top-actions .ghost { display: none; }
  #mobile-nav { display: block; }
  .view { padding: 16px 14px 44px; }
  .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { align-items: flex-start; }
  .topbar h1 { font-size: 18px; }
  .modal-backdrop { padding: 8px; }
  .modal { max-height: 96vh; padding: 18px; }
  .worktable-head, .portfolio-head, .calendar-head, .asset-head, .exception-head, .advanced-intro { align-items: stretch; flex-direction: column; }
  .work-row { grid-template-columns: minmax(0, 1fr) auto; }
  .work-row > button { grid-column: 1 / -1; }
  .portfolio-table { border: 0; background: transparent; overflow: visible; }
  .portfolio-labels { display: none; }
  .portfolio-row { grid-template-columns: 1fr auto; margin-bottom: 10px; padding: 15px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
  .portfolio-row > :nth-child(3), .portfolio-row > :nth-child(4), .portfolio-row > :nth-child(5) { display: none; }
  .ceo-intro, .decision-sheet, .ceo-analysis { grid-template-columns: 1fr; }
  .ceo-rule { min-width: 0; }
  .calendar-list article, .asset-row { grid-template-columns: 1fr auto; }
  .calendar-list article > :nth-child(2), .asset-row > :nth-child(3) { grid-column: 1 / -1; }
  .advanced-links { grid-template-columns: 1fr; }
  .exception-row { grid-template-columns: 1fr; padding: 16px; }
}

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

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
