:root {
  --ink: #172723;
  --muted: #70807a;
  --faint: #96a39e;
  --line: #e4eae7;
  --line-strong: #d7dfdb;
  --paper: #f4f6f4;
  --card: #ffffff;
  --sidebar: #14231f;
  --sidebar-muted: #91a59e;
  --accent: #147d64;
  --accent-dark: #0e644f;
  --accent-soft: #e6f4ef;
  --blue: #376e9f;
  --blue-soft: #edf4fa;
  --amber: #9b671c;
  --amber-soft: #fff5e4;
  --red: #b54b46;
  --red-soft: #fff0ed;
  --shadow: 0 1px 2px rgba(21, 44, 36, .03), 0 5px 18px rgba(21, 44, 36, .035);
  --mono: 'DM Mono', 'SFMono-Regular', Consolas, monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; color: var(--ink); font-family: var(--sans); font-size: 13px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
::selection { background: #cce8df; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 224px; background: var(--sidebar); color: #fff; padding: 26px 16px 18px; display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 28px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: #d6f56b; color: #14231f; display: grid; place-items: center; }
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: -.4px; }
.brand-sub { color: var(--sidebar-muted); font-size: 10px; margin-top: 3px; letter-spacing: .9px; }
.nav-label { color: #6f8880; padding: 0 12px; margin: 3px 0 9px; font-size: 10px; letter-spacing: 1.4px; }
.nav-list { display: grid; gap: 5px; }
.nav-item { border: 0; background: transparent; color: var(--sidebar-muted); width: 100%; padding: 11px 12px; border-radius: 8px; display: flex; align-items: center; gap: 11px; text-align: left; transition: .18s ease; }
.nav-item svg { width: 17px; height: 17px; stroke-width: 1.7; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.045); }
.nav-item.active { color: #e7fac0; background: rgba(214,245,107,.105); }
.nav-item .nav-index { margin-left: auto; font-family: var(--mono); font-size: 10px; opacity: .45; }
.sidebar-bottom { margin-top: auto; }
.local-card { padding: 14px; border: 1px solid rgba(255,255,255,.09); border-radius: 10px; background: rgba(255,255,255,.025); }
.local-title { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; }
.local-dot { width: 6px; height: 6px; background: #d6f56b; border-radius: 50%; box-shadow: 0 0 0 4px rgba(214,245,107,.08); }
.local-card p { margin: 8px 0 0; color: var(--sidebar-muted); font-size: 11px; line-height: 1.65; }
.sidebar-foot { padding: 18px 10px 0; color: #617b72; font-size: 10px; display: flex; justify-content: space-between; }

.main-shell { grid-column: 2; min-width: 0; }
.topbar { height: 70px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 22px; padding: 0 30px; position: sticky; top: 0; z-index: 15; backdrop-filter: blur(12px); }
.env-pill { display: inline-flex; gap: 7px; align-items: center; border: 1px solid #d5e8df; background: #f0f8f4; color: var(--accent-dark); font-weight: 600; padding: 6px 9px; border-radius: 6px; white-space: nowrap; font-size: 11px; }
.env-pill svg { width: 13px; height: 13px; }
.top-price { display: flex; align-items: baseline; gap: 9px; white-space: nowrap; }
.top-price span { color: var(--muted); font-size: 11px; }
.top-price strong { font-family: var(--mono); font-size: 14px; font-weight: 500; }
.top-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.top-meta svg { width: 14px; height: 14px; }
.top-spacer { flex: 1; }
.scenario-control { position: relative; }
.scenario-button { border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; padding: 8px 11px; display: flex; align-items: center; gap: 9px; font-size: 11px; min-width: 158px; justify-content: space-between; }
.scenario-button svg { width: 13px; height: 13px; color: var(--muted); }
.scenario-button .scenario-dot { width: 6px; height: 6px; border-radius: 50%; background: #d69c3b; }
.scenario-menu { position: absolute; top: calc(100% + 8px); right: 0; width: 290px; background: #fff; border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(20,35,31,.14); border-radius: 10px; padding: 7px; z-index: 40; }
.scenario-menu-head { padding: 8px 10px 9px; color: var(--muted); font-size: 10px; letter-spacing: .6px; }
.scenario-option { display: flex; width: 100%; gap: 10px; align-items: flex-start; border: 0; border-radius: 7px; background: transparent; padding: 9px 10px; text-align: left; }
.scenario-option:hover, .scenario-option.active { background: var(--paper); }
.scenario-option strong { display: block; font-size: 12px; font-weight: 600; }
.scenario-option small { display: block; color: var(--muted); margin-top: 3px; font-size: 10px; }
.scenario-option .check { margin-left: auto; color: var(--accent); padding-top: 2px; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); background: #fff; border-radius: 7px; display: grid; place-items: center; position: relative; }
.icon-button:hover { background: var(--paper); }
.icon-button svg { width: 16px; height: 16px; }
.alert-count { position: absolute; right: -5px; top: -5px; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px; background: var(--red); color: #fff; display: grid; place-items: center; font: 9px var(--mono); border: 2px solid #fff; }

.workspace { padding: 28px 30px 50px; max-width: 1600px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 23px; }
.eyebrow { font-size: 10px; color: var(--accent); letter-spacing: 1.6px; font-weight: 700; text-transform: uppercase; margin-bottom: 7px; }
h1 { margin: 0; font-size: 24px; letter-spacing: -.65px; line-height: 1.35; font-weight: 650; }
.page-description { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.head-actions { display: flex; align-items: center; gap: 9px; padding-top: 5px; }
.button { border: 1px solid var(--line-strong); background: #fff; border-radius: 7px; min-height: 35px; padding: 8px 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 550; font-size: 12px; white-space: nowrap; transition: .15s ease; }
.button svg { width: 14px; height: 14px; }
.button:hover:not(:disabled) { border-color: #b9c9c1; background: #fafcfb; }
.button.primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 2px 4px rgba(20,125,100,.13); }
.button.primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }
.button.danger { color: var(--red); border-color: #edcfc9; background: #fff; }
.button.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.button.small { min-height: 29px; padding: 5px 9px; font-size: 11px; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.text-button { border: 0; padding: 0; color: var(--accent); background: none; font-weight: 600; font-size: 11px; }

.simulation-banner { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border: 1px solid #e4e7d0; background: #fafbee; color: #687038; border-radius: 7px; font-size: 11px; margin-bottom: 20px; }
.simulation-banner svg { width: 14px; height: 14px; flex: none; }
.simulation-banner strong { color: #505a23; }
.simulation-banner .banner-right { margin-left: auto; font-family: var(--mono); font-size: 10px; opacity: .8; }
.alert-banner { display: flex; align-items: flex-start; gap: 11px; padding: 13px 15px; margin-bottom: 18px; border: 1px solid #efd6b8; background: var(--amber-soft); border-radius: 8px; color: #805820; }
.alert-banner.error { border-color: #efcbc5; background: var(--red-soft); color: #98433f; }
.alert-banner.info { border-color: #cfdee9; background: var(--blue-soft); color: #386180; }
.alert-banner svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.alert-banner strong { display: block; font-size: 12px; margin-bottom: 3px; }
.alert-banner p { margin: 0; font-size: 11px; line-height: 1.6; }
.alert-banner .button { margin-left: auto; flex: none; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 18px; }
.metric-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 17px 18px 15px; box-shadow: var(--shadow); min-width: 0; }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.metric-top svg { width: 15px; height: 15px; color: #92a69e; }
.metric-value { margin-top: 12px; font: 500 24px/1.2 var(--mono); letter-spacing: -1px; white-space: nowrap; }
.metric-value .unit { font: 500 11px var(--sans); color: var(--muted); letter-spacing: 0; margin-left: 5px; }
.metric-foot { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; margin-top: 9px; min-height: 15px; }
.metric-foot.positive { color: var(--accent); }
.metric-foot.negative { color: var(--red); }
.metric-foot svg { width: 12px; height: 12px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .85fr); gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 0; }
.card-head { min-height: 55px; padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.card-title { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card-title svg { width: 15px; height: 15px; color: var(--muted); }
.card-subtitle { font-size: 10px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.card-body { padding: 18px; }
.card-foot { border-top: 1px solid var(--line); padding: 12px 18px; background: #fbfcfb; border-radius: 0 0 10px 10px; }
.section-label { color: var(--muted); font-size: 10px; letter-spacing: .8px; font-weight: 600; margin-bottom: 10px; }

.accounts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.account-card { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.account-head { padding: 15px 16px 13px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.account-avatar { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font: 600 13px var(--mono); }
.account-avatar.short { background: #f2effa; color: #76639c; }
.account-name { font-weight: 650; font-size: 12px; }
.account-meta { color: var(--muted); font-size: 10px; margin-top: 3px; }
.account-head .badge { margin-left: auto; }
.account-body { padding: 15px 16px; }
.account-equity-label { font-size: 10px; color: var(--muted); }
.account-equity { font: 500 21px var(--mono); margin-top: 5px; }
.account-equity small { font: 10px var(--sans); color: var(--muted); }
.asset-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.asset-item label { display: block; font-size: 10px; color: var(--muted); margin-bottom: 5px; }
.asset-item strong { font: 500 12px var(--mono); }
.asset-item small { color: var(--muted); font-size: 9px; }
.position-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.position-side { display: flex; align-items: center; gap: 8px; }
.position-side strong { font: 500 13px var(--mono); }
.position-side small { display: block; color: var(--muted); font-size: 9px; margin-top: 4px; }
.pnl { font: 500 11px var(--mono); }
.pnl.positive { color: var(--accent); }
.pnl.negative { color: var(--red); }
.margin-list { padding-top: 8px; }
.data-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; font-size: 11px; }
.data-row > span:first-child { color: var(--muted); }
.data-row strong { font: 500 11px var(--mono); text-align: right; }
.data-row small { font-size: 9px; color: var(--faint); }
.safety-meter { margin-top: 11px; background: var(--paper); padding: 10px; border-radius: 6px; }
.safety-meter-head { display: flex; justify-content: space-between; font-size: 10px; margin-bottom: 7px; }
.meter-track { height: 4px; border-radius: 2px; background: #e2e8e4; overflow: hidden; }
.meter-fill { height: 100%; background: var(--accent); border-radius: 2px; }
.meter-fill.warning { background: #d69c3b; }
.meter-fill.breach { background: var(--red); }

.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 5px; padding: 4px 7px; font-size: 10px; font-weight: 550; white-space: nowrap; background: var(--paper); color: var(--muted); }
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge.ok { color: var(--accent); background: var(--accent-soft); }
.badge.warning { color: var(--amber); background: var(--amber-soft); }
.badge.error { color: var(--red); background: var(--red-soft); }
.badge.info { color: var(--blue); background: var(--blue-soft); }
.badge.neutral::before { display: none; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.unknown { color: var(--faint); font-weight: 400; }
.positive { color: var(--accent); }
.negative { color: var(--red); }

.exposure-visual { padding: 4px 0 15px; display: grid; grid-template-columns: 1fr 42px 1fr 42px 1fr; align-items: center; }
.exposure-node { text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 13px 7px; background: #fbfcfb; }
.exposure-node.highlight { border-color: #cfe4db; background: #f4faf7; }
.exposure-node label { display: block; color: var(--muted); font-size: 10px; }
.exposure-node strong { display: block; font: 500 17px var(--mono); margin-top: 6px; }
.exposure-node small { font-size: 9px; color: var(--muted); }
.exposure-operator { text-align: center; color: var(--faint); font: 18px var(--mono); }
.formula { background: var(--sidebar); color: #d9e6e1; padding: 11px 13px; border-radius: 7px; font: 10px/1.7 var(--mono); }
.formula span { color: #d6f56b; }
.exposure-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 10px; color: var(--muted); }

.plan-summary { display: grid; gap: 12px; }
.plan-price { padding: 14px; background: #f4f8f6; border-radius: 8px; }
.plan-price label { color: var(--muted); font-size: 10px; }
.plan-price strong { display: block; margin-top: 6px; font: 500 21px var(--mono); }
.plan-price small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
.plan-progress { height: 4px; background: #dfe8e3; border-radius: 2px; margin-top: 12px; overflow: hidden; }
.plan-progress > div { height: 100%; width: 60%; background: var(--accent); }
.event-list { display: grid; }
.event-item { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); align-items: start; }
.event-item:last-child { border-bottom: 0; padding-bottom: 0; }
.event-dot { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; margin-top: 4px; }
.event-dot.warning { background: #d69c3b; }
.event-message { font-size: 11px; line-height: 1.5; }
.event-time { font: 9px var(--mono); color: var(--faint); white-space: nowrap; }
.event-source { color: var(--muted); font-size: 9px; margin-top: 3px; }

.empty-state { padding: 52px 25px; text-align: center; }
.empty-icon { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; margin: 0 auto 15px; background: var(--accent-soft); color: var(--accent); }
.empty-icon svg { width: 22px; height: 22px; }
.empty-state h2 { font-size: 16px; margin: 0 0 8px; }
.empty-state p { max-width: 460px; margin: 0 auto 18px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.empty-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 600px; margin: 24px auto 0; text-align: left; }
.empty-grid div { padding: 13px; border: 1px solid var(--line); border-radius: 8px; }
.empty-grid strong { display: block; font-size: 11px; }
.empty-grid small { display: block; color: var(--muted); margin-top: 5px; line-height: 1.6; }

.config-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.config-section { padding: 19px 20px; border-bottom: 1px solid var(--line); }
.config-section:last-child { border-bottom: 0; }
.config-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 17px; }
.section-number { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font: 500 10px var(--mono); }
.config-section-title { font-weight: 650; font-size: 12px; }
.config-section-note { font-size: 10px; color: var(--muted); margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { min-width: 0; }
.field label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #51615b; font-size: 11px; margin-bottom: 7px; }
.field label small { color: var(--faint); font-size: 9px; }
.input-wrap { position: relative; }
.input, .select, .textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); outline: none; transition: .15s ease; }
.input { height: 36px; padding: 8px 42px 8px 10px; font: 400 11px var(--mono); }
.input.no-unit { padding-right: 10px; }
.select { height: 36px; padding: 0 31px 0 10px; font-size: 11px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2370807a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.textarea { min-height: 68px; padding: 10px; resize: vertical; font-size: 11px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20,125,100,.08); }
.input[readonly] { background: var(--paper); color: var(--muted); }
.input.invalid { border-color: var(--red); background: #fffafa; }
.input-unit { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 9px; pointer-events: none; }
.field-hint { color: var(--faint); font-size: 9px; line-height: 1.5; margin-top: 5px; }
.field-error { color: var(--red); font-size: 9px; line-height: 1.5; margin-top: 5px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 11px; }
input[type='checkbox'] { accent-color: var(--accent); }
details.advanced { border-top: 1px solid var(--line); }
details.advanced summary { cursor: pointer; list-style: none; padding: 15px 20px; display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 600; }
details.advanced summary::-webkit-details-marker { display: none; }
details.advanced summary::after { content: '+'; color: var(--muted); font: 16px var(--mono); }
details.advanced[open] summary::after { content: '−'; }
.version-card { padding: 17px; border-bottom: 1px solid var(--line); }
.version-card:last-child { border-bottom: 0; }
.version-number { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.version-number strong { font: 500 14px var(--mono); }
.version-meta { font-size: 10px; color: var(--muted); line-height: 1.7; }
.version-actions { display: flex; gap: 7px; margin-top: 13px; }
.snapshot-note { display: flex; gap: 8px; padding: 11px 12px; border-radius: 6px; background: var(--blue-soft); color: #49677e; font-size: 10px; line-height: 1.65; margin-top: 15px; }
.snapshot-note svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.trigger-preview { padding: 17px; background: var(--sidebar); color: #fff; border-radius: 8px; }
.trigger-preview label { font-size: 10px; color: var(--sidebar-muted); }
.trigger-preview strong { display: block; font: 500 24px var(--mono); color: #e7fac0; margin: 8px 0; }
.trigger-preview small { color: var(--sidebar-muted); font-size: 10px; }
.config-sticky { position: sticky; top: 90px; }
.command-box { background: #fbfcfb; border: 1px dashed var(--line-strong); border-radius: 7px; padding: 12px; margin-top: 15px; }
.command-row { display: flex; gap: 7px; margin-top: 9px; }
.command-row .input { flex: 1; min-width: 0; }

.operation-tabs { display: flex; gap: 5px; padding: 5px; background: #edf1ee; border-radius: 8px; margin-bottom: 19px; overflow-x: auto; }
.operation-tab { flex: 1; border: 0; background: transparent; border-radius: 6px; padding: 8px 11px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.operation-tab.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(20,35,31,.08); }
.preview-layout { display: grid; grid-template-columns: 285px minmax(0, 1fr); gap: 18px; align-items: start; }
.preview-config { position: sticky; top: 90px; }
.preview-config .card-body { display: grid; gap: 14px; }
.preview-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 17px; }
.preview-kpi { border: 1px solid var(--line); border-radius: 8px; padding: 13px; background: #fbfcfb; }
.preview-kpi label { display: block; font-size: 10px; color: var(--muted); margin-bottom: 7px; }
.preview-kpi strong { font: 500 16px var(--mono); }
.preview-kpi small { font-size: 9px; color: var(--muted); }
.compare-table, .data-table { width: 100%; border-collapse: collapse; }
.compare-table th, .compare-table td, .data-table th, .data-table td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: right; font-size: 11px; white-space: nowrap; }
.compare-table th, .data-table th { color: var(--muted); font-size: 9px; font-weight: 550; background: #fafbfa; letter-spacing: .3px; }
.compare-table th:first-child, .compare-table td:first-child, .data-table th:first-child, .data-table td:first-child { text-align: left; }
.compare-table td:not(:first-child), .data-table td.numeric { font-family: var(--mono); font-size: 10px; }
.compare-table tr:last-child td, .data-table tr:last-child td { border-bottom: 0; }
.compare-table .row-head { font-weight: 600; background: #fbfcfb; }
.compare-table .change-up { color: var(--accent); }
.compare-table .change-down { color: var(--red); }
.table-scroll { overflow-x: auto; }
.plan-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 14px; color: var(--muted); font-size: 9px; }
.plan-meta code { font: 9px var(--mono); color: #53665e; }
.plan-meta span { display: inline-flex; align-items: center; gap: 4px; }
.plan-meta svg { width: 11px; height: 11px; }
.step-list { display: grid; }
.plan-step { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 11px; position: relative; padding: 12px 0; }
.plan-step:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 39px; bottom: -6px; width: 1px; background: var(--line); }
.step-seq { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line-strong); background: #fff; border-radius: 50%; color: var(--muted); font: 10px var(--mono); z-index: 1; }
.step-title { font-size: 11px; font-weight: 600; }
.step-title .account-tag { color: var(--accent); font: 9px var(--mono); margin-right: 6px; }
.step-note { font-size: 9px; line-height: 1.6; color: var(--muted); margin-top: 4px; }
.step-qty { font: 10px var(--mono); color: #43564e; text-align: right; }
.precondition { margin-top: 6px; color: var(--accent); font-size: 9px; display: flex; align-items: center; gap: 4px; }
.precondition svg { width: 11px; height: 11px; }
.plan-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.plan-actions-note { color: var(--muted); font-size: 10px; line-height: 1.6; }

.execution-layout { display: grid; grid-template-columns: 295px minmax(0, 1fr); gap: 18px; align-items: start; }
.task-list { padding: 8px; }
.task-item { width: 100%; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 13px; text-align: left; display: block; }
.task-item:hover { background: var(--paper); }
.task-item.active { border-color: #cfe2d9; background: #f3f9f6; }
.task-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-item strong { font-size: 11px; }
.task-id { font: 9px var(--mono); color: var(--muted); margin-top: 7px; }
.task-item-foot { display: flex; justify-content: space-between; color: var(--faint); font-size: 9px; margin-top: 9px; }
.task-overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.task-overview label { display: block; color: var(--muted); font-size: 9px; margin-bottom: 6px; }
.task-overview strong { font: 500 11px var(--mono); }
.execution-timeline { padding: 5px 20px 14px; }
.execution-step { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; position: relative; padding: 13px 0; }
.execution-step:not(:last-child)::after { content: ''; position: absolute; left: 15px; top: 44px; bottom: -4px; width: 1px; background: var(--line); }
.execution-marker { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); color: var(--muted); border: 1px solid var(--line); z-index: 1; }
.execution-marker svg { width: 14px; height: 14px; }
.execution-step.done .execution-marker, .execution-step.filled .execution-marker { background: var(--accent-soft); border-color: #d2e9df; color: var(--accent); }
.execution-step.partially_filled .execution-marker, .execution-step.confirming .execution-marker { background: var(--amber-soft); border-color: #efdfbd; color: var(--amber); }
.execution-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 1px; }
.execution-title { font-size: 11px; font-weight: 600; }
.execution-title span { color: var(--muted); font: 9px var(--mono); margin-right: 7px; }
.execution-detail { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 7px; color: var(--muted); font-size: 9px; }
.execution-detail strong { color: #4b5e56; font: 500 9px var(--mono); }
.execution-note { margin-top: 6px; font-size: 9px; color: var(--faint); }
.control-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reconcile-result { margin: 16px 18px; padding: 14px; border: 1px solid #d6e9df; border-radius: 8px; background: #f3faf6; }
.reconcile-title { display: flex; align-items: center; gap: 7px; color: var(--accent); font-weight: 650; font-size: 11px; }
.reconcile-title svg { width: 15px; height: 15px; }
.reconcile-values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 13px; }
.reconcile-values label { display: block; color: var(--muted); font-size: 9px; margin-bottom: 5px; }
.reconcile-values strong { font: 500 14px var(--mono); }

.pnl-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.pnl-metrics .metric-card { padding: 15px; }
.pnl-metrics .metric-value { font-size: 18px; }
.chart-wrap { padding: 17px 18px 10px; }
.chart-legend { display: flex; gap: 16px; margin-bottom: 14px; }
.legend-item { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.legend-line { width: 14px; height: 3px; background: var(--accent); border-radius: 2px; }
.legend-line.gray { background: #b6c3bd; }
.chart { width: 100%; height: 180px; }
.chart text { font: 9px var(--mono); fill: #8a9992; }
.recovery-panel { padding: 17px; }
.recovery-days { font: 500 30px var(--mono); letter-spacing: -1.3px; margin: 11px 0 7px; }
.recovery-days small { font: 11px var(--sans); color: var(--muted); letter-spacing: 0; }
.recovery-caption { color: var(--muted); font-size: 10px; line-height: 1.7; }
.recovery-formula { margin-top: 14px; padding: 10px; border-radius: 6px; background: var(--paper); font: 9px/1.8 var(--mono); color: #566860; }
.recovery-input { display: grid; grid-template-columns: 1fr 105px; gap: 8px; align-items: end; margin-top: 15px; }
.cost-breakdown { display: grid; gap: 10px; }
.cost-line { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 8px; font-size: 10px; }
.cost-line i { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.cost-line:nth-child(2) i { background: #7ca28f; }
.cost-line:nth-child(3) i { background: #bdc9c2; }
.cost-line strong { font: 500 10px var(--mono); }
.capital-reconcile { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.capital-item { padding: 11px 13px; border-left: 2px solid var(--line-strong); }
.capital-item label { display: block; font-size: 9px; color: var(--muted); margin-bottom: 6px; }
.capital-item strong { font: 500 13px var(--mono); }
.funding-assumption { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 5px; background: var(--paper); color: var(--muted); font-size: 9px; }

#toast-root { position: fixed; right: 24px; bottom: 24px; z-index: 100; display: grid; gap: 9px; }
.toast { width: 330px; background: var(--sidebar); color: #fff; border-radius: 9px; padding: 13px 15px; box-shadow: 0 12px 35px rgba(20,35,31,.22); display: flex; align-items: flex-start; gap: 10px; animation: toast-in .2s ease; }
.toast svg { width: 16px; height: 16px; color: #d6f56b; flex: none; margin-top: 1px; }
.toast strong { display: block; font-size: 11px; margin-bottom: 3px; }
.toast p { color: var(--sidebar-muted); font-size: 10px; line-height: 1.6; margin: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(12,28,23,.45); backdrop-filter: blur(3px); z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal { width: min(520px, 100%); max-height: 85vh; overflow: auto; border-radius: 12px; background: #fff; box-shadow: 0 24px 70px rgba(12,28,23,.25); }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-size: 15px; margin: 0; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; }

@media (max-width: 1180px) {
  .topbar { padding: 0 22px; gap: 15px; }
  .workspace { padding: 24px 22px 45px; }
  .top-meta.sync { display: none; }
  .pnl-metrics { grid-template-columns: repeat(3, 1fr); }
  .pnl-metrics .metric-card:nth-child(n+4) { display: none; }
  .config-layout { grid-template-columns: minmax(0, 1fr) 275px; }
  .preview-layout { grid-template-columns: 250px minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 76px minmax(0,1fr); }
  .sidebar { width: 76px; padding: 24px 10px 16px; }
  .brand { padding: 0 10px 28px; }
  .brand-text, .nav-label, .nav-item span, .nav-index, .sidebar-bottom { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-item svg { width: 19px; height: 19px; }
  .top-meta.mode { display: none; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid, .config-layout, .preview-layout, .execution-layout { grid-template-columns: 1fr; }
  .config-sticky, .preview-config { position: static; }
  .accounts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: 62px; padding: 10px 14px; flex-direction: row; align-items: center; }
  .brand { padding: 0; }
  .brand-text { display: block; }
  .brand-sub, .brand-name { display: none; }
  .nav-list { display: flex; margin-left: auto; }
  .nav-item { padding: 9px; }
  .main-shell { grid-column: auto; }
  .topbar { height: auto; min-height: 62px; flex-wrap: wrap; padding: 12px 16px; }
  .top-price, .top-spacer, .top-meta { display: none; }
  .scenario-control { margin-left: auto; }
  .workspace { padding: 20px 15px 40px; }
  .page-head { display: block; }
  .head-actions { margin-top: 15px; flex-wrap: wrap; }
  .metric-grid, .pnl-metrics { grid-template-columns: 1fr 1fr; }
  .metric-value { font-size: 19px; }
  .form-grid, .form-grid.two { grid-template-columns: 1fr; }
  .preview-kpi-grid, .task-overview { grid-template-columns: repeat(2, 1fr); }
  .capital-reconcile { grid-template-columns: repeat(2, 1fr); }
  .simulation-banner .banner-right { display: none; }
  .empty-grid { grid-template-columns: 1fr; }
}

.advanced-toggle { margin-top: 12px; border-top: 1px solid rgba(255,255,255,.08); border-radius: 0 0 8px 8px; padding-top: 14px; }
.advanced-toggle > svg:last-child { margin-left: auto; width: 13px; height: 13px; }
.advanced-item { margin-left: 12px; width: calc(100% - 12px); padding-top: 9px; padding-bottom: 9px; font-size: 12px; }
.ai-workflow-note { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 18px; border: 1px solid #dbe7e1; border-radius: 8px; background: #f8fbf9; color: #566a61; font-size: 12px; line-height: 1.65; }
.ai-workflow-note svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.ai-workflow-note strong { color: var(--ink); }
.status-strip { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 16px; padding: 15px 18px; margin-bottom: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.status-strip > div + div { border-left: 1px solid var(--line); padding-left: 16px; }
.status-label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.status-strip strong { font-size: 12px; font-weight: 600; }
.home-plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.home-plan-grid > div { padding: 12px; border-radius: 7px; background: var(--paper); }
.home-plan-grid label { display: block; color: var(--muted); font-size: 10px; margin-bottom: 7px; }
.home-plan-grid strong { font: 500 13px var(--mono); }
.account-details { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 9px; }
.account-details summary, .disclosure-card > summary { cursor: pointer; color: var(--accent); font-size: 11px; font-weight: 600; list-style: none; }
.account-details summary::-webkit-details-marker, .disclosure-card > summary::-webkit-details-marker { display: none; }
.account-details summary::after { content: ' +'; font-family: var(--mono); }
.account-details[open] summary::after { content: ' −'; }
.disclosure-card > summary { padding: 16px 18px; color: var(--ink); display: flex; align-items: center; justify-content: space-between; }
.disclosure-card > summary::after { content: '+'; color: var(--muted); font: 16px var(--mono); }
.disclosure-card[open] > summary::after { content: '−'; }
.batch-summary { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 11px 13px; margin-bottom: 14px; border: 1px solid #dce8e2; border-radius: 7px; background: #f5faf7; color: var(--muted); font-size: 11px; }
.batch-summary strong { color: var(--ink); font-family: var(--mono); font-weight: 500; }
.page-description, .step-note, .execution-note, .field-hint { font-size: 11px; }
.card-subtitle, .event-source { font-size: 10px; }
.execution-title, .step-title { font-size: 12px; }
.execution-detail, .execution-note { font-size: 10px; }
@media (max-width: 680px) { .status-strip, .home-plan-grid { grid-template-columns: 1fr; } .status-strip > div + div { border-left: 0; padding-left: 0; } }

.transport-banner { display: flex; align-items: center; gap: 9px; padding: 10px 12px; margin-bottom: 16px; border: 1px solid #cfdee9; border-radius: 8px; background: var(--blue-soft); color: #386180; font-size: 11px; line-height: 1.6; }
.transport-banner.mock { border-color: #e7dfb9; background: #fffbeb; color: #75602b; }
.transport-banner > svg { width: 15px; height: 15px; flex: none; }
.transport-banner .button { margin-left: auto; flex: none; }

.env-pill.live { color: var(--red); background: var(--red-soft); border-color: #efcbc5; font-weight: 700; }
.step-exposure { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
