/* Shared by the local app (webapp) and the hosted site (hosted). */
:root {
  --bg: #0b0e14; --panel: #121722; --sub: #0e121b; --raised: #182030; --line: #222b3c;
  --fg: #c3ccdb; --muted: #7a869b; --strong: #f3f6fb;
  --accent: #34d399; --accent-ink: #052e22;
  --green: #34d399; --red: #f26d78; --orange: #f0b45a; --cyan: #4fc6d9; --blue: #5aa9f7;
  --shadow: 0 1px 0 rgba(255, 255, 255, .02) inset, 0 8px 24px rgba(0, 0, 0, .25);
  --radius: 14px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f6fa; --panel: #ffffff; --sub: #f0f3f8; --raised: #e9eef6; --line: #dde3ee;
  --fg: #3b4558; --muted: #6b778c; --strong: #0f1726;
  --accent: #0f9f6e; --accent-ink: #ffffff;
  --green: #0f9f6e; --red: #d63a4a; --orange: #b7791f; --cyan: #0e8aa0; --blue: #2b6cb0;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg);
       font: 14px/1.5 "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, sans-serif;
       -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
a { color: var(--accent); }
h1, h2, h3 { color: var(--strong); letter-spacing: -.01em; }
.hidden { display: none !important; }

/* ---- forms / gate screens ---- */
.gate { max-width: 440px; margin: 8vh auto; padding: 0 16px; }
.gate h1 { font-size: 26px; margin: 0 0 4px; text-align: center; }
.gate h1 span, .brand span { color: var(--accent); }
.gate p.tag { text-align: center; color: var(--muted); margin: 0 0 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 12px; font-size: 15px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 5px; }
input, textarea { width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line);
        background: var(--sub); color: var(--strong); }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.btn { padding: 9px 16px; border-radius: 9px; border: 1px solid transparent; cursor: pointer;
       font-weight: 600; color: var(--accent-ink); background: var(--accent); transition: filter .12s, background .12s; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:focus-visible, .nav:focus-visible, .tab:focus-visible { outline: 2px solid var(--strong); outline-offset: 2px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.go { background: var(--green); }
.btn.stop { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--raised); filter: none; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { margin-top: 16px; }
.row.between { justify-content: space-between; }
.msg { min-height: 20px; margin-top: 10px; font-size: 13px; color: var(--orange); }
.msg.ok { color: var(--green); }
.done { color: var(--green); font-size: 13px; }
.note { color: var(--muted); font-size: 13px; }
code.hwid { display: block; padding: 9px 12px; background: var(--sub); border-radius: 9px; flex: 1; min-width: 0;
            border: 1px solid var(--line); color: var(--strong); word-break: break-all; user-select: all;
            font: 12px/1.5 Consolas, monospace; }

/* ---- header (hosted site) ---- */
header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
         padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { font-size: 18px; font-weight: 700; color: var(--strong); letter-spacing: -.02em;
         display: flex; align-items: center; gap: 9px; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
header .brand { margin-right: auto; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
        font-size: 12px; font-weight: 600; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.on { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent);
           background: color-mix(in srgb, var(--green) 10%, transparent); }
.pill.off { color: var(--muted); }
.pill.wait { color: var(--orange); border-color: color-mix(in srgb, var(--orange) 45%, transparent); }
.pill.on::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
                   animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---- app shell (local app) ---- */
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 12px;
           display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 0 10px 18px; }
.nav { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px;
       background: none; color: var(--fg); cursor: pointer; text-align: left; font-weight: 500; }
.nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7;
           stroke-linecap: round; stroke-linejoin: round; }
.nav:hover { background: var(--raised); }
.nav.active { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); }
.sidebar .foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--muted); display: grid; gap: 8px; }
.topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 14px 24px;
          border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent);
          position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px); }
.topbar h1 { font-size: 18px; margin: 0 auto 0 0; }
.chip { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 7px; font-size: 12px;
        background: var(--raised); color: var(--fg); border: 1px solid var(--line); white-space: nowrap; }
.page { padding: 20px 24px 40px; display: grid; gap: 16px; align-content: start; }
.page > .lead { color: var(--muted); margin: 0; max-width: 760px; }
.stack { display: grid; gap: 16px; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding-bottom: 64px; }
  .sidebar { position: fixed; inset: auto 0 0 0; top: auto; height: auto; z-index: 10; flex-direction: row;
             justify-content: space-around; gap: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
             border-right: 0; border-top: 1px solid var(--line); }
  .sidebar .brand, .sidebar .foot { display: none; }
  .nav { flex-direction: column; gap: 2px; width: auto; flex: 1; padding: 6px 2px; font-size: 10.5px; text-align: center; }
  .topbar { padding: 12px 16px; }
  .page { padding: 16px; }
}

.banner { padding: 11px 14px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--orange) 55%, transparent);
          background: color-mix(in srgb, var(--orange) 8%, transparent); color: var(--strong); }

/* ---- overview ---- */
main { padding: 16px 20px; display: grid; gap: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
        box-shadow: var(--shadow); }
.tile .k { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.tile .v { font-size: 22px; font-weight: 650; color: var(--strong); margin-top: 4px;
           font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile .s { font-size: 12px; color: var(--muted); margin-top: 2px; min-height: 18px; }
.pos { color: var(--green) !important; } .neg { color: var(--red) !important; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
         min-width: 0; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow); }
.panel > h2 { margin: 0; padding: 12px 16px; font-size: 12px; letter-spacing: .07em; font-weight: 600;
              text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }
#chart { width: 100%; height: 220px; display: block; }
.scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 14px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600;
     position: sticky; top: 0; background: var(--panel); }
th:first-child, td:first-child, td.l, th.l { text-align: left; }
td:first-child { color: var(--strong); font-weight: 500; }
td.reason { white-space: normal; text-align: left; color: var(--muted); min-width: 200px; }
.empty { padding: 22px 16px; color: var(--muted); }

.feed { list-style: none; margin: 0; padding: 4px 0; max-height: 340px; overflow: auto; }
.feed li { display: flex; gap: 12px; align-items: baseline; padding: 9px 16px; }
.feed li + li { border-top: 1px solid var(--line); }
.feed .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); transform: translateY(-1px); }
.feed .open .dot { background: var(--blue); } .feed .win .dot { background: var(--green); }
.feed .loss .dot { background: var(--red); } .feed .warn .dot { background: var(--orange); }
.feed .pulse .dot { background: var(--cyan); }
.feed .pulse .dot.buy { background: var(--green); } .feed .pulse .dot.sell { background: var(--red); }
.feed .text { flex: 1; color: var(--strong); }
.feed .warn .text { color: var(--orange); }
.feed time { color: var(--muted); font-size: 12px; white-space: nowrap; }

.sig-row { display: grid; grid-template-columns: minmax(70px, 1fr) auto minmax(80px, 2fr) 44px; gap: 12px;
           align-items: center; padding: 11px 16px; }
.sig-row + .sig-row { border-top: 1px solid var(--line); }
.sig-row b { color: var(--strong); font-weight: 600; }
.sig-row .pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--strong); }
.badge { padding: 3px 11px; border-radius: 999px; font-weight: 700; font-size: 11px; letter-spacing: .06em;
         text-transform: uppercase; white-space: nowrap; }
.badge.bullish, .badge.buy { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.badge.bearish, .badge.sell { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); }
.badge.neutral, .badge.wait { background: var(--raised); color: var(--fg); }
.meter { flex: 1; min-width: 60px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }
.meter.sell i { background: var(--red); }

/* ---- overview: status summary, market list, hours, protection ---- */
.hero { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; padding: 18px 20px;
        border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow);
        background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 9%, var(--panel)), var(--panel) 60%); }
.hero-main { flex: 1 1 420px; min-width: 0; display: grid; gap: 6px; }
.hero-main h2 { margin: 0; font-size: 20px; }
.hero-main p { margin: 0; max-width: 760px; }
.hero-main .row { margin-top: 4px; }
.hero-k { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
          text-transform: uppercase; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--green); animation: pulse 2s ease-in-out infinite; }
.dot.wait { background: var(--orange); }
.hero-side { flex: 0 1 260px; display: grid; gap: 6px; }
.hero-side .k { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.hero-side .s { font-size: 13px; color: var(--strong); }
.gauge { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.gauge i { display: block; height: 100%; width: 0; background: var(--green); border-radius: 4px; transition: width .4s; }
.gauge i.warn { background: var(--orange); } .gauge i.neg { background: var(--red); }
.panel-note { padding: 10px 16px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); }
#positions-note { color: var(--orange); }
td .who { margin-left: 8px; padding: 1px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 600;
          background: var(--raised); color: var(--muted); }
tr.click { cursor: pointer; }
tr.click:hover td, tr.click:focus-visible td { background: var(--raised); }
tr.click:focus-visible { outline: none; }
.range { position: relative; width: 90px; height: 6px; border-radius: 3px; background: var(--line); }
.range i { position: absolute; top: -3px; width: 4px; height: 12px; margin-left: -2px; border-radius: 2px; background: var(--strong); }
.watch .badge { padding: 2px 8px; font-size: 10px; }
.session { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 10px; align-items: center; padding: 9px 16px; }
.session + .session { border-top: 1px solid var(--line); }
.session b { color: var(--strong); font-weight: 600; }
.session .state { font-size: 12px; font-weight: 600; color: var(--muted); }
.session.open .dot { background: var(--green); } .session.open .state { color: var(--green); }
.session .when { font-size: 12px; color: var(--muted); min-width: 110px; text-align: right; }
.rule { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 9px 16px; font-size: 13px; }
.rule + .rule { border-top: 1px solid var(--line); }
.rule span { color: var(--muted); }
.rule b { color: var(--strong); font-weight: 500; }
#positions-table th, #positions-table td { padding-left: 8px; padding-right: 8px; }
#positions-table th:first-child, #positions-table td:first-child { padding-left: 16px; }
@media (max-width: 860px) {
  /* phones: drop the columns that matter least so the tables fit without sideways scrolling */
  #positions-table th:nth-child(4), #positions-table td:nth-child(4),
  .watch th:nth-child(4), .watch td:nth-child(4) { display: none; }
  #positions-table th:first-child, #positions-table td:first-child { padding-left: 10px; }
  .hero { padding: 16px; }
  .hero-main h2 { font-size: 18px; }
  .rule { grid-template-columns: 1fr; gap: 2px; }
  .session .when { min-width: 0; }
}

/* ---- tabs / segmented ---- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: none;
       color: var(--fg); cursor: pointer; font-size: 12px; }
.tab:hover { background: var(--raised); }
.tab.active { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* ---- signals ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.signal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
          display: grid; gap: 14px; align-content: start; box-shadow: var(--shadow); }
.signal .head { display: flex; align-items: center; gap: 14px; }
.signal h3 { margin: 0; font-size: 17px; }
.ring { --p: 0; --c: var(--accent); width: 64px; height: 64px; border-radius: 50%; flex: none; display: grid;
        place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); }
.ring.sell { --c: var(--red); }
.ring span { width: 50px; height: 50px; border-radius: 50%; background: var(--panel); display: grid; place-items: center;
             font-weight: 700; color: var(--strong); font-variant-numeric: tabular-nums; font-size: 14px; }
.reasons { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.reasons li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; }
.reasons li::before { content: "✓"; color: var(--green); font-weight: 700; }
.reasons li.against::before { content: "!"; color: var(--orange); text-align: center; }
.reasons b { color: var(--strong); font-weight: 600; }
.reasons span { color: var(--muted); }

/* ---- bots ---- */
.bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.bot { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
       display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.bot.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.bot h3 { margin: 0; font-size: 16px; }
.bot .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bot p { margin: 0; }
.bot ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.bot .btn { margin-top: auto; }
.risk { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted);
        text-transform: uppercase; letter-spacing: .06em; }
.risk i { width: 14px; height: 5px; border-radius: 3px; background: var(--line); }
.risk.r1 i:nth-of-type(-n+1) { background: var(--green); }
.risk.r2 i:nth-of-type(-n+2) { background: var(--cyan); }
.risk.r3 i:nth-of-type(-n+3) { background: var(--orange); }
.risk.r4 i:nth-of-type(-n+4) { background: var(--red); }

/* ---- chart AI ---- */
.chart-ai { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .chart-ai { grid-template-columns: minmax(0, 1fr); } }
.drop { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 28px 16px; text-align: center;
        color: var(--muted); cursor: pointer; background: var(--sub); }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--fg); }
.drop strong { color: var(--strong); display: block; margin-bottom: 4px; }
.drop img { max-width: 100%; max-height: 320px; border-radius: 8px; display: block; margin: 0 auto; }
.verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.section { margin-top: 16px; }
.section h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.section p { margin: 0; }
.section ul { margin: 0; padding-left: 18px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kv div { background: var(--sub); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.kv span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kv b { color: var(--strong); font-variant-numeric: tabular-nums; font-size: 15px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent);
           border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- segmented control, selects, trade ticket, accounts ---- */
select { width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line);
         background: var(--sub); color: var(--strong); font: inherit; }
select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--sub); border: 1px solid var(--line); }
.seg button { padding: 5px 14px; border: 0; border-radius: 7px; background: none; color: var(--muted);
              cursor: pointer; font-weight: 600; font-size: 13px; }
.seg button.active { background: var(--raised); color: var(--strong); box-shadow: 0 0 0 1px var(--line); }
.seg button:focus-visible { outline: 2px solid var(--strong); outline-offset: 1px; }
.seg.wide { display: flex; margin: 14px 0 4px; }
.seg.wide button { flex: 1; padding: 9px 12px; }
.seg .buy.active { background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green); }
.seg .sell.active { background: color-mix(in srgb, var(--red) 20%, transparent); color: var(--red); }
.quote { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.quote div { background: var(--sub); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.quote span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.quote b { color: var(--strong); font-size: 18px; font-variant-numeric: tabular-nums; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 12px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.acct-list { display: grid; gap: 8px; }
.acct { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
        border: 1px solid var(--line); background: var(--sub); flex-wrap: wrap; }
.acct.active { border-color: var(--accent); }
.acct .who { flex: 1; min-width: 150px; }
.acct .who b { color: var(--strong); display: block; }
.acct .who span { color: var(--muted); font-size: 12px; }
.callout { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--sub); }
.callout.agree { border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.callout.conflict { border-color: color-mix(in srgb, var(--orange) 60%, transparent); }
.callout b { color: var(--strong); }
.quality { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 9px 12px; border-radius: 10px;
           border: 1px solid var(--line); background: var(--sub); font-size: 13px; }
.quality b { color: var(--strong); }
.quality span { color: var(--muted); }
.quality.gC { border-color: color-mix(in srgb, var(--orange) 50%, transparent); color: var(--fg); }
.scan { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.scan .tf { min-width: 34px; padding: 3px 6px; border-radius: 6px; text-align: center; font-size: 11px; font-weight: 700;
            border: 1px solid var(--line); color: var(--muted); background: var(--sub); }
.scan .tf.up { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, transparent);
               background: color-mix(in srgb, var(--green) 12%, transparent); }
.scan .tf.down { color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, transparent);
                 background: color-mix(in srgb, var(--red) 12%, transparent); }
.scan .tf.up::after { content: " ▲"; font-size: 8px; } .scan .tf.down::after { content: " ▼"; font-size: 8px; }
.scan .note { margin-left: 4px; font-size: 12px; }
.quality.gA { border-color: color-mix(in srgb, var(--green) 55%, transparent); }
.quality.gA b { color: var(--green); }
.quality.gB b { color: var(--orange); }
.plan { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.plan .kv { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.plan-notes { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; display: grid; gap: 4px; }
.plan-notes .warn { color: var(--orange); }
#trade-plan:not(:empty) { margin-top: 12px; }
.linkish { float: right; padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer;
           font-size: 12px; font-weight: 600; }
.linkish:hover { text-decoration: underline; }
#trade-risk .warn { color: var(--orange); display: block; margin-top: 4px; }
#trade-kind-note { margin: 6px 0 0; }
#trade-kind-note.warn { color: var(--orange); }
#trade-risk .linkish { font-size: inherit; }
#trade-risk b { color: var(--strong); font-weight: 600; }

/* ---- phones ---- */
@media (max-width: 860px) {
  .sidebar { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .nav { flex: 0 0 auto; min-width: 66px; min-height: 48px; justify-content: center; }
  .nav svg { width: 20px; height: 20px; }
  .topbar { gap: 8px 10px; }
  .topbar h1 { flex-basis: 100%; margin: 0; font-size: 20px; }
  .topbar .chip { display: none; }                 /* the bot's name is on the Bots page */
  .topbar .seg { margin-right: auto; }
  .topbar .btn { padding: 8px 14px; }
  #top-msg { margin: 10px 16px 0 !important; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 12px; }
  .tile .v { font-size: 19px; }
  .card { padding: 16px; }
  .btn { min-height: 42px; }
  .btn.small { min-height: 34px; }
  input, select, textarea { font-size: 16px; }     /* below 16px, phones zoom the page on focus */
  th, td { padding: 9px 10px; }
  .panel .scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .settings-grid, .grid, .bot-grid { grid-template-columns: minmax(0, 1fr); }
  .signal { padding: 16px; }
  .plan .kv, .kv { grid-template-columns: 1fr 1fr; }
  .sig-row { grid-template-columns: minmax(64px, 1fr) auto minmax(50px, 1.5fr) 40px; gap: 8px; padding: 11px 12px; }
  .feed li { padding: 10px 12px; flex-wrap: wrap; }
  .feed .text { flex-basis: calc(100% - 24px); }
  .feed time { margin-left: 20px; }
  .row.end .btn { flex: 1 1 auto; }
  .gate { margin: 4vh auto; }
  #chart { height: 180px; }
}
@media (max-width: 380px) {
  .tiles { grid-template-columns: 1fr; }
  .seg button { padding: 5px 10px; }
}

/* ---- settings ---- */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting b { color: var(--strong); font-weight: 600; display: block; }
.setting span { color: var(--muted); font-size: 13px; }
.switch { position: relative; width: 42px; height: 24px; flex: none; border-radius: 999px; border: 0; cursor: pointer;
          background: var(--line); transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
                 background: #fff; transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--strong); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---- settings: allowed range under each field ---- */
.range-hint { display: block; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.range-hint.warn { color: var(--orange); }
.risk-mode.custom { border-color: color-mix(in srgb, var(--red) 55%, transparent); }
.risk-warning { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 13px; color: var(--strong);
                border: 1px solid color-mix(in srgb, var(--red) 55%, transparent);
                background: color-mix(in srgb, var(--red) 9%, transparent); }
.chip.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 55%, transparent); }
