:root {
  --bg: #F6F5F1;
  --surface: #FFFFFF;
  --surface-2: #F1F0EB;
  --border: #E4E2DA;
  --border-strong: #D3D1C7;
  --text: #1D1C1A;
  --muted: #6B6A64;
  --faint: #9A988F;
  --accent: #1F6FEB;
  --accent-soft: #E7F0FD;
  --accent-ink: #0B4BB3;
  --bull: #1A8F5A;
  --bull-soft: #E4F4EB;
  --bear: #D1433F;
  --bear-soft: #FBE9E8;
  --signal: #C98A10;
  --signal-soft: #FBF1DC;
  --signal-ink: #7A5205;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(29, 28, 26, 0.04), 0 4px 16px rgba(29, 28, 26, 0.04);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Manrope', var(--font);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* Phone app feel: no double-tap zoom, and no zoom-on-focus in iOS Safari
   (it zooms any field whose text is under 16px). */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
b { font-weight: 600; }

/* ---------- shell ---------- */
.app { min-height: 100vh; }
.shell { max-width: 1180px; margin: 0 auto; padding: 0 16px 96px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 12px; margin: 0 -16px 4px; position: sticky; top: 0; z-index: 5; background: rgba(246, 245, 241, 0.92); backdrop-filter: blur(12px); border-bottom: 1px solid transparent; transition: border-color 0.2s; }
.topbar.scrolled { border-bottom-color: var(--border); }
@media (min-width: 960px) { .topbar { margin: 0 -32px 4px; padding: 18px 32px 12px; } }
.page-title { font: 700 22px/1.2 var(--font-display); margin: 0; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.balance-chip { font: 700 14px var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 440px) { #enginePillText { display: none; } .engine-pill { padding: 8px; } }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-around; background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(12px); border-top: 1px solid var(--border); padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); }
.nav-brand { display: none; }
.nav-tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; color: var(--muted); font-size: 11px; font-weight: 500; padding: 6px 4px; border-radius: var(--radius-sm); transition: color 0.2s, background 0.2s; }
.nav-tab svg { box-sizing: content-box; padding: 3px 16px; border-radius: 999px; transition: background 0.2s; }
.nav-tab.active { color: var(--accent-ink); font-weight: 600; }
.nav-tab.active svg { background: var(--accent-soft); }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.brand-text { font: 800 16px var(--font-display); }

@media (min-width: 960px) {
  .app { padding-left: 232px; }
  .nav { top: 0; right: auto; width: 232px; flex-direction: column; justify-content: flex-start; gap: 4px; padding: 20px 14px; border-top: 0; border-right: 1px solid var(--border); background: var(--surface); }
  .nav-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
  .nav-tab { flex: none; flex-direction: row; gap: 10px; font-size: 14px; padding: 10px 12px; }
  .nav-tab svg, .nav-tab.active svg { padding: 0; background: none; }
  .nav-tab:hover { background: var(--surface-2); color: var(--text); }
  .nav-tab.active { background: var(--accent-soft); color: var(--accent-ink); }
  .shell { padding: 0 32px 48px; }
}

/* ---------- building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
@media (min-width: 760px) { .card { padding: 18px; } }
.card h2, .section-head h2 { font: 700 16px var(--font-display); margin: 0 0 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 28px 2px 10px; }
.section-head h2 { margin: 0; }
.section-head.tight { margin: 0 0 12px; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.big-number { font: 800 28px/1.15 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.lede { color: var(--muted); margin: 0 0 14px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.tight { gap: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
.grid-2.align-start { align-items: start; margin-top: 0; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill-soft { background: var(--accent-soft); color: var(--accent-ink); }
.pill.good { background: var(--bull-soft); color: var(--bull); }
.pill.bad { background: var(--bear-soft); color: var(--bear); }
.pill.warn { background: var(--signal-soft); color: var(--signal-ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--radius-sm); padding: 10px 16px; font-weight: 600; border: 1px solid transparent; transition: background 0.15s, border-color 0.15s, transform 0.1s; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.full { width: 100%; margin-top: 14px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #185fcf; }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-buy { background: var(--bull); color: #fff; }
.btn-sell { background: var(--surface); border-color: var(--bear); color: var(--bear); }
.btn-danger { background: var(--surface); border-color: var(--bear); color: var(--bear); }
.btn-danger:hover { background: var(--bear-soft); }
.link-btn { background: none; border: 0; color: var(--accent); font-weight: 600; font-size: 13px; padding: 4px 0; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; flex-shrink: 0; }
.icon-btn.active { background: var(--signal-soft); border-color: var(--signal); color: var(--signal); }
.icon-btn.active svg { fill: currentColor; }

.segmented { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--radius-sm); margin-top: 14px; }
.segmented button { flex: 1; white-space: nowrap; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 13px; padding: 7px 10px; border-radius: 8px; transition: background 0.2s, color 0.2s; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.segmented.small { margin: 0; }
.segmented.small button { padding: 5px 10px; font-size: 12px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; transition: all 0.2s; }
.chip.active { background: var(--text); border-color: var(--text); color: #fff; }

.up { color: var(--bull); }
.down { color: var(--bear); }
.change { font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- engine + robot status ---------- */
.engine-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex-shrink: 0; }
.engine-pill.ok .dot, .status-ring.ok .dot { background: var(--bull); animation: breathe 2.4s ease-in-out infinite; }
.engine-pill.warn .dot, .status-ring.warn .dot { background: var(--signal); }
.engine-pill.bad .dot, .status-ring.bad .dot { background: var(--bear); }

.status-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.status-main { display: flex; align-items: center; gap: 14px; }
.status-ring { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; }
.status-ring .dot { width: 12px; height: 12px; }
.status-title { font: 700 17px var(--font-display); }
.status-sub { color: var(--muted); font-size: 13px; }
.status-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.decision-row { display: flex; align-items: center; gap: 16px; }
.ring { width: 64px; height: 64px; transform: rotate(-90deg); flex-shrink: 0; }
.ring.sm { width: 38px; height: 38px; }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 4; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 119.4; stroke-dashoffset: 119.4; transition: stroke-dashoffset 1s linear, stroke 0.3s; }
.ring-fill.signal { stroke: var(--signal); }
.ring-fill.bull { stroke: var(--bull); }

.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.mini-stats b { display: block; color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---------- stages + readiness ---------- */
.stage-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.stage-chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.stage-chip.watching { background: var(--accent-soft); color: var(--accent-ink); }
.stage-chip.setting-up { background: var(--signal-soft); color: var(--signal-ink); }
.stage-chip.ready { background: var(--bull-soft); color: var(--bull); animation: ready-pulse 1.8s ease-out infinite; }
.stage-chip.holding { background: var(--accent); color: #fff; }

.segments { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.seg { height: 6px; border-radius: 3px; background: var(--surface-2); transition: background 0.5s var(--ease); }
.seg.on { background: var(--bull); }
.seg.on.signal { background: var(--signal); }
.seg.na { background: repeating-linear-gradient(90deg, var(--surface-2) 0 3px, #fff 3px 5px); }
.seg.pop { animation: pop 0.45s var(--ease); }

.firing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.fire-card { cursor: pointer; transition: transform 0.2s var(--ease), box-shadow 0.2s; }
.fire-card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(29, 28, 26, 0.08); }
.fire-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.coin-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.coin-dot { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 10px; font-weight: 700; letter-spacing: -0.02em; flex-shrink: 0; overflow: hidden; }
.coin-name > div { min-width: 0; }
.coin-name b { display: block; }
.coin-name small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fire-foot > span { white-space: nowrap; }
.fire-trigger { margin: 12px 0 4px; font-size: 14px; }
.fire-trigger b { font-variant-numeric: tabular-nums; }
.fire-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.fire-foot .count { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- lists ---------- */
.row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) auto; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; transition: border-color 0.2s, transform 0.2s var(--ease); }
.row:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.row-mid { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row-mid .muted { font-size: 12px; line-height: 1.4; }
.row-right { text-align: right; font-variant-numeric: tabular-nums; }
.row-right b { display: block; }
@media (max-width: 640px) {
  .row { grid-template-columns: minmax(0, 1fr) auto; }
  .row-mid { grid-column: 1 / -1; grid-row: 2; }
}

.position-card { display: grid; gap: 12px; cursor: pointer; }
.position-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.exit-bar { position: relative; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--bear-soft), var(--surface-2) 40%, var(--bull-soft)); }
.exit-bar .marker { position: absolute; top: -4px; width: 3px; height: 16px; border-radius: 2px; transform: translateX(-50%); transition: left 0.8s var(--ease); }
.exit-bar .marker.stop { background: var(--bear); }
.exit-bar .marker.entry { background: var(--faint); }
.exit-bar .marker.be { background: var(--signal); }
.exit-bar .marker.price { background: var(--text); width: 12px; height: 12px; top: -2px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--text); }
.exit-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.activity { display: flex; flex-direction: column; }
.activity-item { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.activity-item:last-child { border-bottom: 0; }
.activity-item .icon { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; font-size: 11px; font-weight: 700; white-space: nowrap; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.activity-item .icon.buy { background: var(--bull-soft); color: var(--bull); }
.activity-item .icon.sell { background: var(--accent-soft); color: var(--accent-ink); }
.activity-item .icon.skip { background: var(--surface-2); color: var(--muted); }
.activity-item .icon.pause { background: var(--signal-soft); color: var(--signal-ink); }
.activity-item small { display: block; color: var(--faint); font-size: 11px; }

.empty { color: var(--muted); font-size: 14px; padding: 18px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* ---------- radar ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 12px; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 12px; color: var(--muted); }
.search input { flex: 1; border: 0; outline: 0; background: none; padding: 10px 0; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- coin detail ---------- */
.coin-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.coin-title { flex: 1; min-width: 0; }
.coin-top-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.coin-symbol { font-weight: 600; color: var(--muted); }
.coin-price-row { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 10px; }
.coin-price { font: 800 26px var(--font-display); font-variant-numeric: tabular-nums; border-radius: 6px; padding: 0 4px; margin-left: -4px; }
.coin-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 1040px) {
  .coin-grid { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr); grid-template-rows: auto auto 1fr; align-items: start; }
  .plan-card { grid-row: 1 / span 3; }
}

.plan-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.plan-sentence { font: 600 17px/1.4 var(--font-display); margin: 0 0 16px; }
.stepper { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0; margin: 0 0 16px; counter-reset: step; }
.stepper li { font-size: 12px; font-weight: 600; color: var(--faint); text-align: center; }
.stepper li::before { content: ''; display: block; height: 6px; border-radius: 3px; background: var(--surface-2); margin-bottom: 6px; transition: background 0.6s var(--ease); }
.stepper li.done { color: var(--bull); }
.stepper li.done::before { background: var(--bull); }
.stepper li.current { color: var(--signal-ink); }
.stepper li.current::before { background: linear-gradient(90deg, var(--signal) 0 50%, var(--surface-2) 50%); background-size: 200% 100%; animation: step-progress 1.6s ease-in-out infinite alternate; }
.plan-highlight { display: flex; align-items: center; gap: 14px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 14px; }
.plan-highlight .big-number { font-size: 22px; }
.plan-highlight .muted { font-size: 13px; }
.plan-countdown { margin-left: auto; text-align: right; }
@media (max-width: 560px) {
  .plan-highlight { flex-wrap: wrap; }
  .plan-highlight > div:not(.plan-countdown) { flex: 1; min-width: 0; }
  .plan-countdown { flex-basis: 100%; margin-left: 0; text-align: left; padding-top: 12px; border-top: 1px solid var(--border); }
}
.blockers { background: var(--signal-soft); color: var(--signal-ink); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.blockers div + div { margin-top: 4px; }
.checklist { display: flex; flex-direction: column; margin-bottom: 8px; }
.check { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.check:last-child { border-bottom: 0; }
.check .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--faint); transition: background 0.4s, color 0.4s; }
.check.ok .mark { background: var(--bull-soft); color: var(--bull); }
.check.fail .mark { background: var(--bear-soft); color: var(--bear); }
.check small { display: block; color: var(--muted); font-size: 12px; }
.plan-trade { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kv { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.kv span { display: block; font-size: 12px; color: var(--muted); }
.kv b { font-variant-numeric: tabular-nums; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }

.chart-card { padding: 14px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.chart-wrap { position: relative; height: 320px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 14px; height: 0; border-top: 2px solid; display: inline-block; }
.chart-legend i.dash { border-top-style: dashed; }
.chart-legend i.box { height: 10px; border: 0; border-radius: 2px; }

.details-card { margin-top: 14px; }
.coin-grid > .details-card, .coin-grid > .action-bar { margin-top: 0; }
.details-card summary { cursor: pointer; font: 700 15px var(--font-display); list-style: none; display: flex; gap: 10px; align-items: baseline; }
.details-card summary::-webkit-details-marker { display: none; }
.details-card summary::after { content: '+'; margin-left: auto; color: var(--muted); font-size: 18px; }
.details-card[open] summary::after { content: '-'; }
.details-card summary .muted { font: 400 13px var(--font); }
@media (max-width: 560px) { .summary-hint { display: none; } }
.settings-fold[open] summary { margin-bottom: 4px; }
.danger-zone summary { color: var(--bear); }
.details-body { animation: fade-in 0.3s var(--ease); }

.action-bar { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.action-buttons { display: flex; gap: 8px; }
.action-buttons .btn { min-width: 96px; }
@media (max-width: 959px) {
  .action-bar { position: sticky; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); z-index: 4; flex-wrap: nowrap; padding: 12px; box-shadow: 0 6px 24px rgba(29, 28, 26, 0.12); }
  .action-note { font-size: 12px; line-height: 1.4; }
  .action-buttons .btn { min-width: 76px; }
}

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
@media (min-width: 900px) { .settings-grid { grid-template-columns: 1fr 1fr; } }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 4px 0 14px; }
.switch-row small { display: block; color: var(--muted); font-size: 12px; }
input[type="checkbox"][role="switch"] { appearance: none; width: 42px; height: 24px; border-radius: 12px; background: var(--border-strong); position: relative; cursor: pointer; flex-shrink: 0; transition: background 0.2s; }
input[type="checkbox"][role="switch"]::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.25s var(--ease); }
input[type="checkbox"][role="switch"]:checked { background: var(--accent); }
input[type="checkbox"][role="switch"]:checked::after { transform: translateX(18px); }
.field-label { font-size: 13px; font-weight: 600; margin: 4px 0 8px; }
.strategy-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.strategy-row small { display: block; color: var(--muted); font-size: 12px; }
.strategy-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
@media (max-width: 560px) {
  .strategy-row { flex-direction: column-reverse; align-items: flex-start; gap: 8px; }
  .strategy-badges { flex-direction: row; }
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid label, .form-grid.one label { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; font-size: 13px; line-height: 1.35; color: var(--muted); }
input:not([type="checkbox"]), select, textarea { font-size: 16px; }
input:not([type="checkbox"]), select { width: 100%; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 12px; color: var(--text); outline: 0; transition: border-color 0.15s, box-shadow 0.15s; }
input:not([type="checkbox"]):focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input:not([type="checkbox"]), .search input:not([type="checkbox"]):focus { border: 0; box-shadow: none; background: none; padding: 10px 0; }
.button-row { display: flex; gap: 10px; margin-top: 14px; }
.form-note { font-size: 13px; color: var(--muted); margin-top: 10px; min-height: 1em; }
.form-note.good { color: var(--bull); }
.form-note.bad { color: var(--bear); }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 13px; font-weight: 600; }
.tag button { border: 0; background: var(--surface); width: 22px; height: 22px; border-radius: 50%; color: var(--muted); line-height: 1; }
.tag button:hover { color: var(--bear); }
.add-row { display: flex; gap: 8px; margin-top: 14px; }

/* ---------- toasts + loading ---------- */
.toast-host { position: fixed; right: 16px; bottom: 150px; z-index: 30; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
@media (min-width: 960px) { .toast-host { bottom: 20px; } }
.toast { background: var(--text); color: #fff; border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); animation: toast-in 0.4s var(--ease); }
.toast b { display: block; font-size: 14px; }
.toast.out { animation: toast-out 0.3s ease forwards; }
.skeleton-card { height: 150px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2) 25%, #fafaf7 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

/* ---------- motion ---------- */
.view:not(.hidden) { animation: view-in 0.35s var(--ease); }
.enter { animation: rise 0.45s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.flash-up { animation: flash-up 0.9s ease-out; }
.flash-down { animation: flash-down 0.9s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { transform: scaleY(1); } 40% { transform: scaleY(1.9); } 100% { transform: scaleY(1); } }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(26, 143, 90, 0.35); } 50% { box-shadow: 0 0 0 5px rgba(26, 143, 90, 0); } }
@keyframes ready-pulse { 0% { box-shadow: 0 0 0 0 rgba(26, 143, 90, 0.4); } 70% { box-shadow: 0 0 0 7px rgba(26, 143, 90, 0); } 100% { box-shadow: 0 0 0 0 rgba(26, 143, 90, 0); } }
@keyframes step-progress { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes flash-up { from { background: var(--bull-soft); } to { background: transparent; } }
@keyframes flash-down { from { background: var(--bear-soft); } to { background: transparent; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

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