/* =========================================================
   链鉴 · 供应链韧性管理平台
   设计语言：深墨绿 / 酸性绿 / 等宽数据 / 运营指挥舱
   ========================================================= */
:root {
  --bg: #070d0a;
  --bg-2: #0a120e;
  --panel: #0f1813;
  --panel-2: #121f18;
  --ink: #edf5ec;
  --muted: #8b9b8f;
  --muted-2: #5e6d62;
  --line: rgba(200, 245, 106, 0.13);
  --line-strong: rgba(200, 245, 106, 0.3);
  --lime: #c8f56a;
  --lime-2: #a8dc47;
  --amber: #f5b653;
  --red: #ff6b56;
  --green: #70d6a3;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Bahnschrift", "DIN Alternate", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  --body: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
  --sidebar-w: 224px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 14px; line-height: 1.65; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
::selection { background: rgba(200,245,106,.25); color: #fff; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
svg { display: block; }

.app { min-height: 100vh; }
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); z-index: 80;
  display: flex; flex-direction: column;
  background:
    radial-gradient(circle at 0% 0%, rgba(200,245,106,.09), transparent 34%),
    linear-gradient(180deg, #0b1a12, #06100b 74%);
  border-right: 1px solid var(--line);
}
.sidebar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: linear-gradient(rgba(200,245,106,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(200,245,106,.035) 1px, transparent 1px);
  background-size: 22px 22px;
}
.brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 21px 18px 15px; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; background: var(--lime); color: #08100b; font-family: var(--sans); font-size: 19px; font-weight: 800; clip-path: polygon(0 0,100% 0,100% 78%,78% 100%,0 100%); }
.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-copy strong { font-family: var(--sans); font-size: 20px; letter-spacing: 4px; font-weight: 800; }
.brand-copy small { font-family: var(--mono); font-size: 6.5px; color: rgba(237,245,236,.35); letter-spacing: 1px; margin-top: 2px; }
.entity { position: relative; z-index: 1; margin: 0 16px 17px; padding: 9px 10px; border: 1px solid rgba(200,245,106,.12); background: rgba(200,245,106,.035); }
.entity span { display: block; font-size: 9px; color: rgba(237,245,236,.65); }
.entity b { display: block; font-family: var(--mono); font-size: 6.5px; color: rgba(237,245,236,.3); font-weight: 400; margin-top: 2px; }
.sidenav { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 9px; }
.sidenav button { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 9px; padding: 11px 10px; text-align: left; color: rgba(237,245,236,.55); border-left: 2px solid transparent; transition: .22s; }
.sidenav button span { font-family: var(--mono); font-size: 7px; color: rgba(237,245,236,.28); }
.sidenav button b { font-size: 12px; font-weight: 400; letter-spacing: .4px; }
.sidenav button i { font-family: var(--mono); font-style: normal; font-size: 5.5px; letter-spacing: .5px; color: rgba(237,245,236,.16); }
.sidenav button:hover { color: #fff; background: rgba(200,245,106,.045); }
.sidenav button.active { color: var(--lime); border-left-color: var(--lime); background: linear-gradient(90deg, rgba(200,245,106,.1), transparent); }
.sidenav button.active span { color: var(--lime); }
.sidenav button.active i { color: rgba(200,245,106,.4); }
.side-bottom { position: relative; z-index: 1; margin-top: auto; padding: 15px 13px 17px; }
.copilot-btn { width: 100%; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 8px; text-align: left; padding: 9px; border: 1px solid rgba(200,245,106,.2); background: rgba(200,245,106,.04); color: var(--lime); }
.copilot-btn .spark { font-size: 14px; }
.copilot-btn b { display: block; font-size: 9px; font-weight: 400; color: var(--ink); }
.copilot-btn small { display: block; font-size: 6px; color: rgba(237,245,236,.32); margin-top: 1px; }
.copilot-btn em { font-style: normal; font-size: 12px; color: var(--lime); }
.side-user { display: grid; grid-template-columns: 28px 1fr 8px; align-items: center; gap: 8px; margin-top: 13px; padding-top: 13px; border-top: 1px solid rgba(200,245,106,.1); }
.user-avatar { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid rgba(200,245,106,.35); color: var(--lime); font-family: var(--sans); font-size: 13px; }
.side-user b { display: block; font-size: 9px; font-weight: 400; color: var(--ink); }
.side-user small { display: block; font-size: 6px; color: rgba(237,245,236,.3); margin-top: 1px; }
.online { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(112,214,163,.1); }

.app-main { margin-left: var(--sidebar-w); min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 60; height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 26px; background: rgba(7,13,10,.9); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.crumb { display: flex; align-items: center; gap: 9px; font-size: 10px; color: var(--muted); }
.crumb span { font-family: var(--mono); font-size: 8px; letter-spacing: .4px; }
.crumb i { font-style: normal; color: var(--line-strong); }
.crumb b { font-family: var(--sans); font-size: 14px; color: var(--ink); letter-spacing: 1px; }
.top-actions { display: flex; align-items: center; gap: 13px; }
.asof { font-family: var(--mono); font-size: 7px; color: var(--muted-2); }
.role-select { display: flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 6.5px; color: var(--muted-2); }
.role-select select { border: 1px solid var(--line); background: transparent; padding: 5px 7px; color: var(--ink); font-family: var(--body); font-size: 9px; outline: none; }
.role-select select option { background: var(--panel); color: var(--ink); }
.ai-top { display: flex; align-items: center; gap: 6px; border: 1px solid rgba(200,245,106,.3); padding: 6px 9px; color: var(--lime); font-size: 9px; background: rgba(200,245,106,.04); }
.ai-top span { font-size: 12px; }
.ai-top:hover { background: rgba(200,245,106,.1); }
.top-avatar { width: 27px; height: 27px; display: grid; place-items: center; background: var(--lime); color: #08100b; font-family: var(--sans); font-size: 12px; font-weight: 700; }

.content { max-width: 1560px; margin: 0 auto; padding: 26px 28px 60px; }
.view { display: none; animation: viewIn .35s ease; }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-head { display: grid; grid-template-columns: 1.1fr .9fr; gap: 38px; align-items: end; margin-bottom: 18px; }
.eyebrow { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 7px; letter-spacing: 1.4px; color: var(--muted-2); }
.eyebrow i { width: 30px; height: 1px; background: var(--line-strong); }
h1 { font-family: var(--sans); font-size: clamp(38px, 4vw, 58px); line-height: 1.03; letter-spacing: -.8px; font-weight: 800; margin-top: 10px; }
h1 span { color: var(--lime); position: relative; white-space: nowrap; background: linear-gradient(transparent 72%, rgba(200,245,106,.16) 72%); padding: 0 2px; }
.view-side { display: flex; align-items: flex-end; gap: 20px; padding-bottom: 3px; }
.view-side p { max-width: 470px; font-size: 10px; line-height: 1.85; color: var(--muted); }
.side-stamp { flex: 0 0 auto; border-left: 1px solid var(--line-strong); padding-left: 15px; }
.side-stamp span { display: block; font-family: var(--mono); font-size: 6.5px; color: var(--muted-2); }
.side-stamp strong { font-family: var(--sans); font-size: 31px; line-height: 1.1; color: var(--lime); letter-spacing: -1px; }
.side-stamp em { display: block; font-style: normal; font-size: 7px; color: var(--muted-2); }

.kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-bottom: 8px; }
.kpi { background: var(--panel); border: 1px solid var(--line); padding: 10px 13px 9px; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; width: 2px; height: 22px; background: var(--lime); opacity: .75; }
.kpi span { display: block; font-size: 8.5px; color: var(--muted); }
.kpi strong { display: inline-block; font-family: var(--sans); font-size: 26px; line-height: 1.15; letter-spacing: -.7px; margin-top: 1px; }
.kpi small { font-family: var(--mono); font-size: 7.5px; color: var(--muted-2); margin-left: 3px; }
.kpi em { display: block; font-style: normal; font-family: var(--mono); font-size: 6.5px; color: var(--muted-2); margin-top: 1px; }
.kpi.good strong { color: var(--lime); }
.kpi.warn strong { color: var(--amber); }
.kpi.bad strong { color: var(--red); }

.panel { background: var(--panel); border: 1px solid var(--line); position: relative; min-width: 0; }
.panel::before { content: ""; position: absolute; left: 0; top: 0; width: 18px; height: 2px; background: var(--lime); opacity: .65; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-family: var(--sans); font-size: 13px; letter-spacing: .4px; font-weight: 700; }
.panel-head h3 { font-family: var(--sans); font-size: 11px; font-weight: 600; }
.panel-head span { display: block; font-family: var(--mono); font-size: 6.5px; color: var(--muted-2); margin-top: 2px; }
.count { border: 1px solid var(--line); color: var(--muted) !important; padding: 3px 6px; font-size: 6.5px !important; margin-top: 0 !important; white-space: nowrap; }
.unit { font-family: var(--mono); font-size: 6.5px !important; color: var(--muted-2) !important; margin-top: 3px !important; white-space: nowrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 35px; padding: 0 12px; font-size: 9.5px; border: 1px solid transparent; transition: .2s; }
.btn span { font-size: 12px; }
.btn-solid { background: var(--lime); color: #08100b; border-color: var(--lime); font-weight: 700; }
.btn-solid:hover { background: #dcff8c; transform: translateY(-1px); }
.btn-ghost { border-color: var(--line-strong); color: var(--muted); }
.btn-ghost:hover { border-color: var(--lime); color: var(--lime); }
.btn-block { width: 100%; }

/* ---------- overview ---------- */
.overview-grid { display: grid; grid-template-columns: 1.5fr .72fr; gap: 8px; }
.network-panel { min-height: 330px; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 7.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--green); }
.dot.warn { background: var(--amber); }
.dot.danger { background: var(--red); }
.diamond { width: 6px; height: 6px; display: inline-block; border: 1px solid var(--lime); transform: rotate(45deg); }
.network-canvas { position: relative; padding: 2px 6px 0; }
.network-canvas.compact { height: 280px; }
.network-canvas.large { min-height: 530px; }
.network-canvas svg { width: 100%; height: 100%; }
.network-canvas .tier-head { font-family: var(--mono); font-size: 6.5px; fill: var(--muted-2); letter-spacing: .8px; }
.network-canvas .tier-line { stroke: rgba(200,245,106,.07); stroke-dasharray: 2 6; }
.network-canvas .grid-line { stroke: rgba(200,245,106,.035); stroke-width: .6; }
.network-canvas .edge { fill: none; stroke: rgba(160,190,160,.16); stroke-width: 1; }
.network-canvas .edge.affected { stroke: rgba(255,107,86,.55); stroke-width: 1.4; stroke-dasharray: 4 4; animation: flow 1.6s linear infinite; }
.network-canvas .edge.hot { stroke: rgba(200,245,106,.4); stroke-dasharray: 4 4; animation: flow 2.2s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -16; } }
.network-canvas .node { cursor: pointer; }
.network-canvas .node .ring { fill: none; stroke-width: 1; opacity: .6; transition: opacity .2s, stroke-width .2s; }
.network-canvas .node .core { transition: r .2s; }
.network-canvas .node .label { font-family: var(--body); font-size: 7.5px; fill: var(--ink); pointer-events: none; }
.network-canvas .node .code { font-family: var(--mono); font-size: 6px; fill: var(--muted-2); pointer-events: none; }
.network-canvas .node:hover .ring, .network-canvas .node.active .ring { opacity: 1; stroke-width: 2; }
.network-canvas .node.dim { opacity: .22; }
.network-canvas .sole-mark { fill: var(--lime); }
.network-canvas .chaos { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .2; } 50% { opacity: .9; } }
.network-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 7px 14px 10px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 6.5px; color: var(--muted-2); }
.network-foot span { display: flex; align-items: center; gap: 4px; }
.foot-note { margin-left: auto; }
.risk-feed { display: flex; flex-direction: column; }
.risk-feed-list { padding: 3px 12px 6px; }
.risk-row { display: grid; grid-template-columns: 36px 1fr 7px; gap: 7px; align-items: start; padding: 7px 0; border-bottom: 1px solid rgba(200,245,106,.07); cursor: pointer; }
.risk-row:last-child { border-bottom: 0; }
.risk-row:hover { background: rgba(200,245,106,.035); }
.risk-time { font-family: var(--mono); font-size: 6.5px; color: var(--muted-2); padding-top: 2px; }
.risk-main b { display: block; font-size: 8.5px; font-weight: 500; }
.risk-main span { display: block; font-size: 7px; color: var(--muted-2); line-height: 1.5; margin-top: 1px; }
.risk-dot { width: 5px; height: 5px; border-radius: 50%; margin-top: 4px; background: var(--amber); }
.risk-dot.danger { background: var(--red); }
.risk-dot.ok { background: var(--green); }
.ai-brief { margin-top: auto; padding: 9px 12px; border-top: 1px solid var(--line); background: rgba(200,245,106,.04); }
.ai-brief > span { font-family: var(--mono); font-size: 6.5px; color: var(--lime); letter-spacing: .5px; }
.ai-brief p { font-size: 8px; line-height: 1.65; color: var(--muted); margin-top: 2px; }
.alerts-panel, .approvals-panel { min-height: 200px; }
.todo-list, .approval-list { padding: 4px 12px 8px; }
.todo-row { display: grid; grid-template-columns: 6px 1fr auto; gap: 7px; align-items: start; padding: 7px 0; border-bottom: 1px solid rgba(200,245,106,.06); cursor: pointer; }
.todo-row:last-child { border-bottom: 0; }
.todo-row i { width: 5px; height: 5px; border-radius: 50%; margin-top: 4px; background: var(--amber); }
.todo-row i.danger { background: var(--red); }
.todo-row i.info { background: var(--blue, #6fa8b8); }
.todo-main b { display: block; font-size: 8.5px; font-weight: 500; }
.todo-main span { display: block; font-family: var(--mono); font-size: 6.5px; color: var(--muted-2); margin-top: 1px; }
.todo-arrow { font-family: var(--mono); font-size: 8px; color: var(--muted-2); }
.approval-row { display: grid; grid-template-columns: 1fr auto; gap: 7px; align-items: center; padding: 7px 0; border-bottom: 1px solid rgba(200,245,106,.06); }
.approval-row:last-child { border-bottom: 0; }
.approval-main b { display: block; font-size: 8.5px; font-weight: 500; }
.approval-main span { display: block; font-family: var(--mono); font-size: 6.5px; color: var(--muted-2); margin-top: 1px; }
.approval-actions button { font-size: 7.5px; padding: 3px 6px; border: 1px solid var(--line); color: var(--muted); }
.approval-actions button.approve { color: var(--green); border-color: rgba(112,214,163,.35); }
.approval-actions button:disabled { opacity: .4; cursor: not-allowed; }
.empty { padding: 16px 0; text-align: center; font-size: 7.5px; color: var(--muted-2); }
.audit-panel { grid-column: 1 / -1; }
.audit-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; padding: 3px 14px 8px; }
.audit-row { display: grid; grid-template-columns: 60px 1fr auto; gap: 7px; align-items: start; padding: 6px 0; border-bottom: 1px solid rgba(200,245,106,.06); }
.audit-time { font-family: var(--mono); font-size: 6.5px; color: var(--muted-2); padding-top: 2px; }
.audit-main b { display: block; font-size: 8px; font-weight: 500; }
.audit-main span { display: block; font-size: 6.5px; color: var(--muted-2); margin-top: 1px; }
.audit-status { font-family: var(--mono); font-size: 6px; padding: 2px 4px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.audit-status.good { color: var(--green); border-color: rgba(112,214,163,.3); }
.audit-status.warn { color: var(--amber); border-color: rgba(245,182,83,.3); }
.audit-status.blue { color: #79b7c7; border-color: rgba(121,183,199,.3); }

/* ---------- network view ---------- */
.network-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) 330px; gap: 8px; align-items: stretch; }
.filter-chips { display: flex; gap: 4px; }
.filter-chips button { font-size: 7px; padding: 4px 7px; border: 1px solid var(--line); color: var(--muted); }
.filter-chips button.active { background: var(--lime); color: #08100b; border-color: var(--lime); }
.supplier-panel { display: flex; flex-direction: column; }
.risk-pill { font-family: var(--mono); font-size: 6.5px !important; padding: 4px 6px; border: 1px solid currentColor; color: var(--red); margin-top: 0 !important; white-space: nowrap; }
.risk-pill.warn { color: var(--amber); }
.risk-pill.ok { color: var(--green); }
.supplier-detail { padding: 12px 14px 0; flex: 1; }
.sup-name { font-family: var(--sans); font-size: 22px; line-height: 1.2; letter-spacing: -.3px; }
.sup-sub { font-family: var(--mono); font-size: 7px; color: var(--muted-2); margin-top: 3px; }
.sup-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.sup-tags span { font-family: var(--mono); font-size: 6.5px; padding: 2px 5px; border: 1px solid var(--line); color: var(--muted); }
.sup-tags span.hot { color: var(--red); border-color: rgba(255,107,86,.35); }
.score-grid { display: grid; grid-template-columns: 1fr 1fr; border-left: 1px solid var(--line); margin-top: 10px; }
.score-grid div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 7px; }
.score-grid span { display: block; font-size: 6.5px; color: var(--muted-2); }
.score-grid b { display: block; font-family: var(--sans); font-size: 17px; line-height: 1.2; margin-top: 1px; }
.score-grid b small { font-family: var(--mono); font-size: 6px; color: var(--muted-2); }
.score-grid b.bad { color: var(--red); }
.score-grid b.warn { color: var(--amber); }
.score-grid b.good { color: var(--green); }
.sup-note { margin-top: 9px; padding: 8px 9px; border-left: 2px solid var(--lime); background: rgba(200,245,106,.04); font-size: 7.5px; line-height: 1.65; color: var(--muted); }
.sup-alts { margin-top: 9px; }
.sup-alts > span { font-family: var(--mono); font-size: 6px; color: var(--muted-2); letter-spacing: .5px; }
.sup-alt { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed rgba(200,245,106,.1); font-size: 7.5px; color: var(--muted); }
.sup-alt b { font-family: var(--mono); font-size: 7px; color: var(--ink); font-weight: 400; }
.supplier-actions { padding: 10px 14px 12px; display: grid; gap: 5px; }

/* ---------- simulation ---------- */
.sim-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr) 330px; gap: 8px; align-items: stretch; }
.sim-controls { display: flex; flex-direction: column; }
.scenario-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 10px 12px 5px; }
.scenario-chip { text-align: left; border: 1px solid var(--line); padding: 7px 6px; font-size: 8px; line-height: 1.4; color: var(--muted); }
.scenario-chip small { display: block; font-family: var(--mono); font-size: 6px; color: var(--muted-2); margin-bottom: 2px; }
.scenario-chip.active { border-color: var(--lime); color: var(--lime); background: rgba(200,245,106,.06); }
.scenario-desc { min-height: 55px; padding: 0 12px 7px; font-size: 7.5px; line-height: 1.6; color: var(--muted); }
.sim-controls .slider-group { padding: 8px 12px 3px; border-top: 1px solid rgba(200,245,106,.06); }
.slider-group label { display: flex; justify-content: space-between; font-size: 8px; color: var(--muted); }
.slider-group output { font-family: var(--mono); font-size: 7.5px; color: var(--lime); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 15px; background: transparent; cursor: pointer; margin-top: 3px; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: rgba(200,245,106,.16); }
input[type="range"]::-moz-range-track { height: 2px; background: rgba(200,245,106,.16); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 9px; height: 9px; margin-top: -3.5px; border-radius: 50%; background: var(--lime); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--lime); }
input[type="range"]::-moz-range-thumb { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--lime); }
.range-scale { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 6px; color: var(--muted-2); }
.scenario-note { display: flex; gap: 6px; margin: 9px 12px 12px; padding: 7px; border-left: 1px solid var(--line-strong); background: rgba(255,255,255,.02); font-size: 6.5px; line-height: 1.55; color: var(--muted-2); }
.scenario-note i { color: var(--lime); font-family: var(--serif); font-style: italic; }
.loss-waterfall { padding: 8px 14px 3px; }
.wf-row { display: grid; grid-template-columns: 84px 1fr 60px; gap: 8px; align-items: center; margin-bottom: 7px; }
.wf-label { font-size: 8px; color: var(--muted); }
.wf-track { height: 12px; background: rgba(200,245,106,.06); position: relative; overflow: hidden; }
.wf-track i { display: block; height: 100%; background: rgba(200,245,106,.55); }
.wf-track i.bad { background: rgba(255,107,86,.65); }
.wf-track i.warn { background: rgba(245,182,83,.65); }
.wf-val { font-family: var(--mono); font-size: 7.5px; color: var(--ink); text-align: right; }
.sim-chart { height: 100px; padding: 4px 14px 0; }
.sim-chart svg { width: 100%; height: 100%; }
.sim-advice-panel { display: flex; flex-direction: column; }
.sim-advice { padding: 10px 14px 0; }
.advice-block { padding: 7px 0; border-bottom: 1px solid rgba(200,245,106,.07); font-size: 7.5px; line-height: 1.6; color: var(--muted); }
.advice-block b { display: block; color: var(--ink); font-size: 8.5px; font-weight: 500; }
.advice-block em { font-style: normal; font-family: var(--mono); font-size: 6.5px; color: var(--lime); }
.sim-advice-panel .btn { margin: 0 14px 5px; width: calc(100% - 28px); }
.sim-advice-panel .btn:last-of-type { margin-bottom: 10px; }
.sub-head { border-top: 1px solid var(--line); padding-top: 9px; }
.sim-table-panel { margin-top: 8px; }
.sim-table-head, .sim-table-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1fr 1fr 0.8fr; gap: 8px; align-items: center; padding: 7px 14px; }
.sim-table-head { border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 6.5px; color: var(--muted-2); }
.sim-table-row { border-bottom: 1px solid rgba(200,245,106,.06); font-family: var(--mono); font-size: 8px; color: var(--muted); }
.sim-table-row.active { background: rgba(200,245,106,.035); box-shadow: inset 2px 0 0 var(--lime); }
.sim-table-row b { color: var(--ink); font-weight: 400; }
.sim-table-row .bad { color: var(--red); }
.sim-table-row .good { color: var(--green); }
.sim-table-row .good { color: var(--green); }
.exposure-panel { margin-top: 8px; }
.exposure-head, .exposure-row { display: grid; grid-template-columns: 1fr 1fr 1.2fr .7fr .8fr .8fr .8fr; gap: 8px; align-items: center; padding: 6px 14px; }
.exposure-head { border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 6.5px; color: var(--muted-2); }
.exposure-row { border-bottom: 1px solid rgba(200,245,106,.06); font-family: var(--mono); font-size: 8px; color: var(--muted); }
.exposure-row b { color: var(--ink); font-weight: 400; }
.exposure-row .bad { color: var(--red); }
.exposure-row .warn { color: var(--amber); }
.exposure-row .good { color: var(--green); }

/* ---------- plan ---------- */
.plan-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) 340px; gap: 8px; align-items: start; }
.material-tabs { display: flex; gap: 4px; }
.material-tabs button { font-size: 7px; padding: 4px 7px; border: 1px solid var(--line); color: var(--muted); }
.material-tabs button.active { background: var(--lime); color: #08100b; border-color: var(--lime); }
.allocation-bar { display: flex; height: 18px; margin: 15px 14px 10px; overflow: hidden; background: rgba(200,245,106,.06); }
.allocation-bar i { display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 6.5px; color: #08100b; overflow: hidden; white-space: nowrap; transition: width .4s; }
.allocation-table-head, .alloc-row { display: grid; grid-template-columns: 1.5fr 1fr .8fr .8fr .8fr .6fr; gap: 8px; align-items: center; padding: 6px 14px; }
.allocation-table-head { border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 6px; color: var(--muted-2); }
.allocation-table { padding-bottom: 6px; }
.alloc-row { border-bottom: 1px solid rgba(200,245,106,.06); font-family: var(--mono); font-size: 7.5px; color: var(--muted); }
.alloc-row b { color: var(--ink); font-weight: 400; }
.alloc-row .primary { color: var(--lime); }
.alloc-row .risk { color: var(--red); }
.alloc-summary { padding: 10px 14px 0; }
.alloc-total { display: flex; align-items: flex-end; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 7px; }
.alloc-total span { font-size: 7px; color: var(--muted-2); }
.alloc-total strong { font-family: var(--sans); font-size: 28px; line-height: 1; color: var(--lime); letter-spacing: -1px; }
.alloc-total strong small { font-family: var(--mono); font-size: 7px; color: var(--muted-2); }
.alloc-metrics { display: grid; grid-template-columns: 1fr 1fr; border-left: 1px solid var(--line); margin-top: 8px; }
.alloc-metrics div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 7px; }
.alloc-metrics span { display: block; font-size: 6.5px; color: var(--muted-2); }
.alloc-metrics b { display: block; font-family: var(--mono); font-size: 10px; font-weight: 400; margin-top: 1px; }
.alloc-metrics b.good { color: var(--green); }
.alloc-metrics b.warn { color: var(--amber); }
.plan-sliders { padding: 3px 14px; }
.alloc-advice { margin: 8px 14px; padding: 8px 9px; border-left: 2px solid var(--lime); background: rgba(200,245,106,.04); font-size: 7.5px; line-height: 1.65; color: var(--muted); }
.alloc-advice b { color: var(--lime); }
.summary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 0 14px 10px; }
.plan-grid .btn { font-size: 8.5px; }
.plan-audit { margin-top: 8px; }
.sensitivity-panel { margin-top: 8px; border-top: 1px solid var(--line); }
.sensitivity-panel .panel-head { padding-left: 0; padding-right: 0; }
.sensitivity-panel .sens-head, .sensitivity-panel .sens-row { padding-left: 0; padding-right: 0; }
.sens-head, .sens-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr; gap: 10px; align-items: center; padding: 7px 14px; }
.sens-head { border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 6.5px; color: var(--muted-2); }
.sens-row { border-bottom: 1px solid rgba(200,245,106,.06); font-family: var(--mono); font-size: 8.5px; color: var(--muted); cursor: pointer; }
.sens-row:hover { background: rgba(200,245,106,.035); }
.sens-row.active { background: rgba(200,245,106,.05); box-shadow: inset 2px 0 0 var(--lime); }
.sens-row b { color: var(--ink); font-weight: 400; }
.sens-row .good { color: var(--green); }
.sens-row .bad { color: var(--red); }

/* ---------- copilot / toast ---------- */
.copilot-backdrop { position: fixed; inset: 0; z-index: 150; background: rgba(4,10,7,.55); opacity: 0; pointer-events: none; transition: .25s; }
.copilot-backdrop.open { opacity: 1; pointer-events: auto; }
.copilot { position: fixed; right: 0; top: 0; bottom: 0; width: min(390px, 92vw); z-index: 160; background: var(--panel); border-left: 1px solid var(--line-strong); transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; box-shadow: -20px 0 60px rgba(0,0,0,.35); }
.copilot.open { transform: none; }
.copilot-head { display: flex; align-items: center; gap: 9px; padding: 14px; border-bottom: 1px solid var(--line); background: #0a1710; }
.copilot-avatar { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(200,245,106,.4); color: var(--lime); font-size: 13px; }
.copilot-head h3 { font-family: var(--sans); font-size: 14px; }
.copilot-head span { display: block; font-size: 6.5px; color: var(--muted-2); margin-top: 1px; }
.copilot-head button { margin-left: auto; color: var(--muted); font-size: 24px; line-height: 1; }
.chat-log { flex: 1; overflow: auto; padding: 13px; display: flex; flex-direction: column; gap: 9px; }
.chat-msg { max-width: 92%; padding: 8px 10px; font-size: 8px; line-height: 1.7; }
.chat-msg.ai { align-self: flex-start; background: rgba(200,245,106,.05); border-left: 2px solid var(--lime); color: var(--muted); }
.chat-msg.user { align-self: flex-end; background: var(--lime); color: #08100b; }
.chat-msg b { color: var(--ink); }
.chat-msg.user b { color: #08100b; }
.chat-cite { display: block; margin-top: 5px; font-family: var(--mono); font-size: 6px; color: var(--lime); border-top: 1px dashed var(--line); padding-top: 4px; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 13px 9px; }
.chat-suggestions button { font-size: 7px; padding: 4px 6px; border: 1px solid var(--line); color: var(--muted); }
.chat-suggestions button:hover { border-color: var(--lime); color: var(--lime); }
.chat-form { display: flex; border-top: 1px solid var(--line); padding: 9px 11px; gap: 6px; }
.chat-form input { flex: 1; border: 1px solid var(--line); background: transparent; padding: 8px 9px; font-size: 8px; outline: none; color: var(--ink); }
.chat-form input:focus { border-color: var(--lime); }
.chat-form button { background: var(--lime); color: #08100b; font-size: 8px; padding: 0 11px; font-weight: 700; }
.chat-note { padding: 0 13px 11px; font-size: 6px; line-height: 1.55; color: var(--muted-2); }
.toast { position: fixed; left: 50%; bottom: 26px; z-index: 300; transform: translate(-50%, 10px); background: var(--lime); color: #08100b; font-size: 9px; font-weight: 600; padding: 10px 16px; opacity: 0; pointer-events: none; transition: .25s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- readability ---------- */
body { font-size: 15px; }
.view-side p { font-size: 11px; }
.sidenav button b { font-size: 12.5px; }
.panel-head h2 { font-size: 14px; }
.panel-head span { font-size: 7.5px; }
.kpi span { font-size: 9.5px; }
.kpi em { font-size: 7.5px; }
.risk-main b, .todo-main b, .approval-main b { font-size: 9.5px; }
.risk-main span, .todo-main span, .approval-main span { font-size: 7.5px; }
.audit-main b { font-size: 9px; }
.audit-main span { font-size: 7px; }
.chat-msg { font-size: 9px; }
.advice-block { font-size: 8.5px; }
.alloc-row { font-size: 8.5px; }

@media (max-width: 1240px) {
  :root { --sidebar-w: 204px; }
  .content { padding: 22px 20px 50px; }
  .sim-grid { grid-template-columns: 240px minmax(0, 1fr) 300px; }
  .plan-grid { grid-template-columns: minmax(0, 1.4fr) 310px; }
}
@media (max-width: 1020px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); }
  .app-main { margin-left: 0; }
  .view-head { grid-template-columns: 1fr; gap: 10px; }
  .view-side { align-items: flex-start; }
  .overview-grid { grid-template-columns: 1fr; }
  .audit-panel { grid-column: auto; }
  .audit-list { grid-template-columns: 1fr; }
  .network-grid, .plan-grid { grid-template-columns: 1fr; }
  .supplier-panel { grid-row: 1; }
  .network-canvas.large { min-height: 430px; }
  .sim-grid { grid-template-columns: 1fr 1fr; }
  .sim-visual { grid-column: 1 / -1; grid-row: 2; }
  .sim-advice-panel { grid-column: 2; grid-row: 1; }
  .sim-controls { grid-row: 1; }
}
@media (max-width: 680px) {
  .topbar { height: 56px; padding: 0 13px; }
  .asof, .role-select, .ai-top { display: none; }
  .content { padding: 18px 12px 42px; }
  h1 { font-size: 38px; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .kpi:last-child { grid-column: 1 / -1; }
  .network-canvas.large { min-height: 340px; overflow-x: auto; }
  .network-canvas.large svg { min-width: 760px; }
  .network-canvas.compact { height: 240px; }
  .sim-grid { grid-template-columns: 1fr; }
  .sim-visual, .sim-advice-panel, .sim-controls { grid-column: auto; grid-row: auto; }
  .sim-table-head, .sim-table-row { grid-template-columns: 1.1fr 1fr 1fr 1fr; }
  .sim-table-head span:nth-child(5), .sim-table-head span:nth-child(6),
  .sim-table-row span:nth-child(5), .sim-table-row span:nth-child(6) { display: none; }
  .allocation-table-head, .alloc-row { grid-template-columns: 1.4fr 1fr .8fr .8fr; }
  .allocation-table-head span:nth-child(5), .allocation-table-head span:nth-child(6),
  .alloc-row span:nth-child(5), .alloc-row span:nth-child(6) { display: none; }
  .audit-list { padding-left: 10px; padding-right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
