:root {
  color-scheme: dark;
  --bg: #050506;
  --surface: rgba(28, 28, 30, .78);
  --surface-solid: #1c1c1e;
  --surface-raised: rgba(44, 44, 46, .72);
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .15);
  --text: #f5f5f7;
  --secondary: #a1a1a6;
  --tertiary: #6e6e73;
  --blue: #0a84ff;
  --blue-soft: rgba(10, 132, 255, .15);
  --green: #30d158;
  --green-soft: rgba(48, 209, 88, .12);
  --orange: #ff9f0a;
  --red: #ff453a;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% -12%, rgba(10, 132, 255, .13), transparent 29%),
    radial-gradient(circle at 42% 110%, rgba(48, 209, 88, .06), transparent 32%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.app-shell > *, main, .view { min-width: 0; }
aside {
  position: sticky; top: 0; height: 100vh; z-index: 2;
  display: flex; flex-direction: column;
  padding: 32px 22px 24px;
  border-right: 1px solid var(--line);
  background: rgba(9, 9, 11, .78);
  backdrop-filter: blur(28px) saturate(140%);
}
.brand { display: flex; align-items: center; gap: 13px; padding: 0 6px; }
.brand > span {
  display: grid; place-items: center; width: 42px; height: 42px;
  overflow: visible; background: transparent;
}
.brand > span img { width: 42px; height: 30px; object-fit: contain; }
.brand strong { display: block; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.brand small { display: block; margin-top: 2px; color: var(--tertiary); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.brand + nav { margin-top: 52px; }
nav { display: grid; gap: 6px; }
.nav-item {
  padding: 12px 14px; border: 0; border-radius: 11px; background: transparent;
  color: var(--secondary); text-align: left; font-size: 14px; font-weight: 560; cursor: pointer;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.045); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.09); box-shadow: inset 0 0 0 1px rgba(255,255,255,.025); }
.nav-item:active { transform: scale(.985); }
.nav-item.system-link { margin-top: 18px; padding-top: 22px; border-top: 1px solid var(--line); border-radius: 0 0 11px 11px; }
.mode-card {
  display: flex; align-items: center; gap: 11px; margin-top: auto; padding: 15px;
  border: 1px solid rgba(48,209,88,.18); border-radius: 15px; background: var(--green-soft);
}
.mode-card i { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px rgba(48,209,88,.75); }
.mode-card strong { display: block; color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.mode-card small { color: rgba(207,255,221,.56); font-size: 11px; }

main { width: min(1240px, 100%); margin: auto; padding: 48px 48px 80px; }
header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 38px; }
h1 { margin: 5px 0 8px; font-size: clamp(32px, 3vw, 42px); line-height: 1.04; font-weight: 700; letter-spacing: -.045em; }
.subtitle { margin: 0; color: var(--secondary); font-size: 15px; line-height: 1.45; }
.eyebrow { margin: 0; color: var(--secondary); font-size: 11px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-actions form { margin: 0; }
.logout-button { color: var(--secondary); background: transparent; }
.connection { color: var(--tertiary); font-size: 10px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.connection i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--orange); }
.connection.connected i { background: var(--green); box-shadow: 0 0 10px rgba(48,209,88,.65); }
.connection.failed { color: var(--red); }
.price-ticker {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255,255,255,.045); color: var(--text);
  font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums;
}
button {
  padding: 10px 15px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: rgba(255,255,255,.07); color: var(--text);
  font-size: 12px; font-weight: 650; cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, filter .16s ease;
}
button:hover { background: rgba(255,255,255,.11); border-color: rgba(255,255,255,.22); }
button:active { transform: scale(.975); }
button:disabled { opacity: .38; cursor: not-allowed; transform: none; }
.primary { border-color: transparent; background: var(--blue); color: #fff; box-shadow: 0 8px 22px rgba(10,132,255,.2); }
.primary:hover { background: #2994ff; border-color: transparent; }
.secondary { color: #64b5ff; background: var(--blue-soft); border-color: rgba(10,132,255,.18); }
.secondary:hover { background: rgba(10,132,255,.22); }
.text-button { padding: 0; border: 0; background: none; color: #64b5ff; }
.view { display: none; animation: view-in .24s ease both; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel, .money-grid article {
  border: 1px solid var(--line); border-radius: 20px;
  background: linear-gradient(145deg, rgba(34,34,37,.82), rgba(22,22,24,.78));
  box-shadow: 0 18px 55px rgba(0,0,0,.18), inset 0 1px rgba(255,255,255,.025);
  backdrop-filter: blur(22px) saturate(130%);
}
.panel { padding: 26px; }
.hero-balance {
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 34px 36px; margin-bottom: 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 24px;
  background: linear-gradient(125deg, rgba(10,132,255,.20), rgba(30,30,33,.86) 50%, rgba(48,209,88,.08));
  box-shadow: 0 24px 70px rgba(0,0,0,.24), inset 0 1px rgba(255,255,255,.06);
}
.hero-balance > div > span, .money-grid article > span { display: block; color: var(--secondary); font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; }
.hero-balance > div > strong { display: block; margin: 9px 0 6px; font-size: 40px; line-height: 1; font-weight: 700; letter-spacing: -.045em; }
.hero-balance small, .money-grid small { color: var(--secondary); font-size: 11px; }
.bot-state { display: flex; align-items: center; gap: 12px; padding: 14px 17px; border: 1px solid var(--line); border-radius: 14px; background: rgba(0,0,0,.22); }
.bot-state > span { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); }
.bot-state > span.searching { background: var(--green); box-shadow: 0 0 13px rgba(48,209,88,.65); }
.bot-state small { display: block; color: var(--tertiary); font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.bot-state strong { font-size: 13px; }
.money-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 14px; }
.money-grid article { padding: 22px; }
.money-grid article > strong { display: block; margin: 14px 0 8px; font-size: 23px; font-weight: 650; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.money-grid small b { color: var(--green); font-weight: 650; }
.two-column { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; margin-bottom: 14px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 19px; font-weight: 670; letter-spacing: -.02em; }
.panel-heading > span { color: var(--secondary); font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }
.checklist { display: grid; gap: 0; margin-bottom: 20px; }
.checklist > div { display: flex; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.checklist > div > span { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--green); font-size: 11px; }
.checklist > div.done > span { border-color: rgba(48,209,88,.32); background: var(--green-soft); }
.checklist strong { display: block; font-size: 13px; font-weight: 620; }
.checklist small { display: block; margin-top: 3px; color: var(--tertiary); font-size: 11px; }
.strategy-summary dl { display: grid; grid-template-columns: 1fr 1fr; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.strategy-summary dl div { padding: 14px; background: rgba(0,0,0,.12); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.strategy-summary dt { color: var(--tertiary); font-size: 11px; }
.strategy-summary dd { margin: 6px 0 0; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.badge { padding: 6px 9px; border-radius: 999px; font-size: 9px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.badge.neutral { background: rgba(255,255,255,.08); color: var(--secondary); }
.recent-trades { margin-top: 0; }
.empty-portfolio { padding: 32px; border: 1px dashed var(--line-strong); border-radius: 14px; color: var(--tertiary); font-size: 12px; text-align: center; }
.mini-positions { display: grid; gap: 9px; color: var(--secondary); font-size: 12px; }

.section-intro { margin-bottom: 25px; }
.section-intro h2 { margin: 0 0 7px; font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.section-intro p { margin: 0; color: var(--secondary); font-size: 14px; }
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.setup-card { display: grid; grid-template-columns: 40px 1fr; gap: 15px; min-height: 222px; }
.step-number { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--blue-soft); color: #64b5ff; font-size: 12px; font-weight: 750; }
.setup-card h3, .form-section h3 { margin: 4px 0 8px; font-size: 17px; font-weight: 660; letter-spacing: -.015em; }
.setup-card p, .form-section p { margin: 0 0 20px; color: var(--secondary); font-size: 13px; line-height: 1.55; }
.status-row { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(0,0,0,.12); color: var(--secondary); font-size: 12px; }
.status-row.complete { border-color: rgba(48,209,88,.2); background: var(--green-soft); color: var(--green); }
.status-row.pending { color: var(--orange); }
.address-box { display: flex; gap: 8px; margin-top: 10px; }
.address-box code { flex: 1; overflow: hidden; text-overflow: ellipsis; padding: 10px; border-radius: 9px; background: rgba(0,0,0,.25); color: var(--secondary); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.limit-row { display: flex; justify-content: space-between; margin-bottom: 10px; color: var(--secondary); font-size: 12px; }
.limit-row strong { display: grid; gap: 4px; color: var(--text); text-align: right; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.limit-row strong small { color: var(--green); font-size: 11px; }
.locked-action { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding: 21px 24px; border: 1px solid rgba(255,159,10,.15); border-radius: 17px; background: rgba(255,159,10,.07); }
.locked-action strong { font-size: 14px; }
.locked-action p { margin: 5px 0 0; color: var(--secondary); font-size: 12px; }

.strategy-builder { display: grid; grid-template-columns: .78fr 1.22fr; gap: 34px; margin-bottom: 28px; }
.builder-copy h2 { margin: 6px 0 9px; font-size: 23px; font-weight: 690; letter-spacing: -.025em; }
.builder-copy > p:last-child { margin: 0; color: var(--secondary); font-size: 14px; line-height: 1.55; }
.builder-inputs { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 10px; align-items: start; }
.builder-inputs label, .fields label { color: var(--secondary); font-size: 12px; font-weight: 570; }
.builder-inputs label { display: grid; grid-template-rows: 34px 46px auto; align-items: start; }
.builder-inputs input, .builder-inputs select, .fields input {
  display: block; width: 100%; margin-top: 7px; padding: 11px 12px;
  border: 1px solid var(--line-strong); border-radius: 10px; outline: none;
  background: rgba(0,0,0,.26); color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.builder-inputs input, .builder-inputs select { height: 46px; margin-top: 0; }
.builder-inputs input:focus, .builder-inputs select:focus, .fields input:focus { border-color: var(--blue); background: rgba(10,132,255,.05); box-shadow: 0 0 0 4px rgba(10,132,255,.14); }
.builder-inputs label small { display: block; margin-top: 7px; color: var(--green); font-size: 12px; font-weight: 650; }
.builder-inputs > button { min-height: 46px; margin-top: 34px; white-space: nowrap; }
.preset-heading { display: flex; justify-content: space-between; align-items: end; margin: 0 0 15px; }
.preset-heading h2 { margin: 0 0 5px; font-size: 23px; letter-spacing: -.025em; }
.preset-heading p { max-width: 720px; margin: 0; color: var(--secondary); font-size: 13px; line-height: 1.45; }
.preset-heading > span { color: #64b5ff; font-size: 12px; font-weight: 650; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.preset-placeholder { grid-column: 1/-1; padding: 44px; border: 1px dashed var(--line-strong); border-radius: 18px; color: var(--tertiary); font-size: 13px; text-align: center; }
.preset-card {
  padding: 28px; border: 1px solid var(--line); border-radius: 20px;
  background: linear-gradient(145deg, rgba(36,36,39,.9), rgba(23,23,25,.84));
  box-shadow: 0 16px 48px rgba(0,0,0,.16), inset 0 1px rgba(255,255,255,.025);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.preset-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 22px 58px rgba(0,0,0,.24); }
.preset-card.recommended { border-color: rgba(10,132,255,.38); background: linear-gradient(145deg, rgba(22,48,72,.8), rgba(25,25,28,.88)); }
.preset-card.selected { outline: 2px solid var(--blue); outline-offset: 3px; }
.preset-top { display: flex; justify-content: space-between; align-items: start; }
.preset-top h3 { margin: 0; font-size: 21px; font-weight: 690; letter-spacing: -.025em; }
.preset-top span { display: block; margin-top: 4px; color: var(--secondary); font-size: 13px; }
.preset-top b { padding: 6px 8px; border-radius: 999px; background: var(--blue-soft); color: #64b5ff; font-size: 9px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.preset-card > p { min-height: 44px; margin: 17px 0; color: var(--secondary); font-size: 14px; line-height: 1.5; }
.preset-card dl { display: grid; grid-template-columns: repeat(3,1fr); margin: 0 0 19px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.preset-card dl div { min-width: 0; padding: 13px; background: rgba(0,0,0,.16); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.preset-card dt { color: var(--tertiary); font-size: 11px; font-weight: 560; }
.preset-card dd { margin: 6px 0 0; overflow-wrap: anywhere; color: var(--text); font-size: 15px; font-weight: 680; font-variant-numeric: tabular-nums; }
.preset-card dl div > small { display: block; margin-top: 5px; color: var(--green); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.preset-card button { font-size: 13px; }
.custom-divider { display: flex; align-items: center; gap: 14px; margin: 30px 0 15px; color: var(--tertiary); font-size: 10px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; }
.custom-divider::before, .custom-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.strategy-form { padding: 0; overflow: hidden; }
.form-section { display: grid; grid-template-columns: .7fr 1.3fr; gap: 38px; padding: 30px; border-bottom: 1px solid var(--line); }
.fields { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.fields label small { display: block; margin-top: 7px; color: var(--tertiary); font-size: 10px; line-height: 1.4; }
.form-footer { display: flex; justify-content: space-between; align-items: center; padding: 20px 30px; }
.form-footer span { color: var(--secondary); font-size: 11px; }

.compact article { padding: 20px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 14px 12px; border-top: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--tertiary); font-weight: 570; }
.empty-cell { padding: 40px; color: var(--tertiary); text-align: center; }
.position-state.open, .usd-value { color: var(--green); font-weight: 650; }
.position-state.failed { color: var(--red); }
.position-state.closed, .positive { color: var(--green); font-weight: 650; }
.negative { color: var(--red); font-weight: 650; }
.paper-control { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.paper-control h2 { margin: 6px 0; font-size: 25px; }
.paper-control p:last-child { margin: 0; color: var(--secondary); font-size: 12px; }
.paper-actions { display: flex; gap: 9px; }
.paper-tabs {
  display: flex; gap: 4px; width: 100%; min-width: 0; margin: 18px 0 16px; padding: 5px;
  border: 1px solid var(--line); border-radius: 15px;
  background: rgba(18,18,20,.74); box-shadow: inset 0 1px rgba(255,255,255,.025);
  overflow-x: auto; scrollbar-width: none;
}
.paper-tabs::-webkit-scrollbar { display: none; }
.paper-tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; flex: 1 0 auto;
  padding: 10px 16px; border: 0; border-radius: 11px; background: transparent; color: var(--secondary); box-shadow: none;
  font-size: 12px; font-weight: 650; white-space: nowrap;
}
.paper-tab:hover { border: 0; background: rgba(255,255,255,.045); color: var(--text); }
.paper-tab.active { background: rgba(255,255,255,.095); color: var(--text); box-shadow: 0 7px 22px rgba(0,0,0,.2), inset 0 1px rgba(255,255,255,.055); }
.paper-tab:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.paper-tab b { min-width: 24px; padding: 4px 7px; border-radius: 999px; background: rgba(255,255,255,.07); color: var(--tertiary); font-size: 9px; font-weight: 720; font-variant-numeric: tabular-nums; }
.paper-tab.active b { background: var(--blue-soft); color: #64b5ff; }
.paper-tab-panels { min-height: 420px; }
.paper-tab-panel { animation: paper-tab-in .2s ease both; }
.paper-tab-panel > :first-child { margin-top: 0; }
.paper-tab-panel > :last-child { margin-bottom: 0; }
.staged-risk-panel { margin: 14px 0; background: radial-gradient(circle at 0 0, rgba(10,132,255,.12), transparent 42%), rgba(23,23,25,.96); }
.stage-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; gap: 12px; }
.stage-flow > i { align-self: center; color: var(--tertiary); font-style: normal; font-size: 19px; }
.stage-card { display: grid; gap: 8px; padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: rgba(0,0,0,.16); }
.stage-card.active { border-color: rgba(10,132,255,.34); background: rgba(10,132,255,.08); }
.stage-card span { color: #64b5ff; font-size: 10px; font-weight: 720; letter-spacing: .1em; text-transform: uppercase; }
.stage-card strong { font-size: 20px; letter-spacing: -.02em; }
.stage-card small { color: var(--secondary); font-size: 11px; line-height: 1.55; }
.risk-strip { display: flex; gap: 10px; margin-top: 12px; }
.risk-strip span { flex: 1; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--secondary); font-size: 10px; }
.risk-strip b { color: var(--text); font-size: 12px; }
.evaluation-panel { margin: 14px 0; background: radial-gradient(circle at 100% 0, rgba(48,209,88,.08), transparent 38%), rgba(23,23,25,.96); }
.evaluation-progress { display: grid; gap: 12px; margin-bottom: 16px; }
.evaluation-progress > div:first-child { display: flex; justify-content: space-between; gap: 20px; align-items: baseline; }
.evaluation-progress strong { font-size: 21px; }
.evaluation-progress span { color: var(--secondary); font-size: 11px; }
.evaluation-track { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.07); }
.evaluation-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--green)); transition: width .35s ease; }
.evaluation-checks { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; }
.evaluation-checks > div { display: grid; gap: 7px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(0,0,0,.15); }
.evaluation-checks span { color: var(--secondary); font-size: 10px; }
.evaluation-checks strong { font-size: 12px; font-variant-numeric: tabular-nums; }
.evaluation-checks .complete strong { color: var(--green); }
.evaluation-checks .pending strong { color: var(--orange); }
@keyframes paper-tab-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.danger-button { color: var(--red); border-color: rgba(255,69,58,.2); background: rgba(255,69,58,.08); }
.paper-rejections { margin-top: 14px; }
.historical-paper-row { opacity: 0.52; }
.performance-panel { margin: 14px 0; }
.performance-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--border); }
.performance-grid > div { display: grid; gap: 8px; padding: 20px; background: rgba(19, 19, 21, .96); }
.performance-grid span, .performance-grid small { color: var(--secondary); }
.performance-grid span { font-size: 12px; font-weight: 600; }
.performance-grid strong { font-size: 24px; letter-spacing: -.03em; }
.performance-grid small { font-size: 11px; }
.protocol-performance { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.protocol-performance > div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 13px; background: rgba(255,255,255,.018); }
.protocol-performance strong { color: var(--accent); font-size: 12px; }
.protocol-performance span { color: var(--secondary); font-size: 12px; text-align: right; }
@media (max-width: 900px) { .performance-grid, .evaluation-checks { grid-template-columns: repeat(2, 1fr); } .protocol-performance { grid-template-columns: 1fr; } .stage-flow { grid-template-columns: 1fr; } .stage-flow > i { display: none; } .risk-strip { flex-direction: column; } }
.funnel-panel { margin: 14px 0; }
.funnel-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 10px; }
.funnel-grid > div { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(0,0,0,.14); }
.funnel-grid span { display: block; color: var(--tertiary); font-size: 10px; }
.funnel-grid strong { display: block; margin-top: 7px; font-size: 22px; }
.rejection-list > div:not(.empty-portfolio) { display: flex; justify-content: space-between; gap: 20px; padding: 15px 2px; border-top: 1px solid var(--line); }
.rejection-list strong { font-size: 13px; }
.rejection-list p { margin: 5px 0 0; color: var(--secondary); font-size: 11px; line-height: 1.5; }
.rejection-list time { flex: 0 0 auto; color: var(--tertiary); font-size: 10px; }
.valuation-disclaimer { margin: 14px 0 0; color: var(--tertiary); font-size: 11px; line-height: 1.5; }
.timeline { max-height: 570px; overflow: auto; }
.timeline-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 13px; padding: 15px 4px; border-top: 1px solid var(--line); }
.timeline-row i { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--tertiary); }
.timeline-row.success i { background: var(--green); }.timeline-row.warning i { background: var(--orange); }.timeline-row.danger i { background: var(--red); }.timeline-row.info i { background: var(--blue); }
.timeline-row strong { font-size: 13px; font-weight: 620; }
.timeline-row p { margin: 4px 0 0; color: var(--secondary); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.timeline-row time { color: var(--tertiary); font-size: 10px; font-variant-numeric: tabular-nums; }
.system-details dl { display: grid; grid-template-columns: repeat(4,1fr); margin: 0; }
.system-details dl div { padding: 14px; border-right: 1px solid var(--line); }
.system-details dt { color: var(--tertiary); font-size: 10px; }.system-details dd { margin: 6px 0 0; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
#toast { position: fixed; right: 26px; bottom: 26px; z-index: 5; transform: translateY(25px); opacity: 0; padding: 13px 17px; border: 1px solid rgba(10,132,255,.22); border-radius: 13px; background: rgba(26,47,68,.94); color: #8ac7ff; box-shadow: 0 18px 48px rgba(0,0,0,.3); backdrop-filter: blur(20px); font-size: 12px; transition: .22s ease; pointer-events: none; }
#toast.show { transform: none; opacity: 1; }
[hidden] { display: none !important; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  aside { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; padding: 18px 20px; }
  .brand + nav { margin: 0 0 0 28px; } nav { display: flex; gap: 3px; }
  .nav-item.system-link { margin: 0; padding-top: 12px; border: 0; border-radius: 11px; }
  .mode-card { margin: 0 0 0 auto; }
  main { padding: 34px 24px 64px; }
  .money-grid { grid-template-columns: 1fr 1fr; }
  .strategy-builder { grid-template-columns: 1fr; }
  .builder-inputs { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  aside nav { display: none; } .mode-card small { display: none; }
  header, .hero-balance, .locked-action { display: grid; gap: 18px; }
  .header-actions { flex-wrap: wrap; }
  .money-grid, .two-column, .setup-grid, .preset-grid { grid-template-columns: 1fr; }
  .builder-inputs, .form-section, .fields { grid-template-columns: 1fr; }
  .builder-inputs > button { margin-top: 0; }
  .preset-heading { display: grid; gap: 9px; }
  .preset-card dl, .system-details dl { grid-template-columns: 1fr 1fr; }
  .timeline-row { grid-template-columns: 12px 1fr; }.timeline-row time { grid-column: 2; }
  .paper-control { display: grid; gap: 18px; }
  .paper-actions { flex-wrap: wrap; }
  .paper-tab { flex: 0 0 auto; }
}
