:root {
    color-scheme: dark;
    --bg: #050b14;
    --surface: rgba(11, 24, 40, .92);
    --surface-2: #0d1c2d;
    --surface-3: #122338;
    --border: rgba(148, 177, 206, .15);
    --border-strong: rgba(148, 177, 206, .28);
    --text: #f2f7fb;
    --muted: #8fa5ba;
    --teal: #2ed9be;
    --teal-dark: #0a9f91;
    --blue: #62a8ff;
    --amber: #f5bb50;
    --red: #ff647c;
    --green: #3ce0a2;
    --radius: 20px;
    --shadow: 0 24px 70px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }
html { max-width: 100%; overflow-x: clip; scroll-behavior: smooth; }
body {
    width: 100%;
    max-width: 100%;
    min-width: 320px;
    overflow-x: clip;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

.ambient { position: fixed; z-index: -1; width: 520px; height: 520px; border-radius: 50%; filter: blur(120px); opacity: .12; }
.ambient-one { top: -240px; right: 8%; background: #1fd8be; }
.ambient-two { bottom: -260px; left: 15%; background: #276be6; }
.app-shell { width: 100%; min-height: 100vh; overflow-x: clip; }

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    height: 78px; padding: 0 28px;
    background: rgba(5, 11, 20, .86); border-bottom: 1px solid var(--border);
    backdrop-filter: blur(22px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand img { width: 44px; height: 44px; object-fit: contain; }
.brand span, .account-button > span:nth-child(2), .site-footer > div span { display: flex; flex-direction: column; }
.brand b { font-size: 15px; letter-spacing: .04em; }
.brand small, .account-button small, .site-footer small { color: var(--muted); font-size: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.connection-pill { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.connection-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 12px var(--amber); }
.connection-pill.online i { background: var(--green); box-shadow: 0 0 12px var(--green); }
.connection-pill.offline i { background: var(--red); box-shadow: 0 0 12px var(--red); }
.account-button {
    display: flex; align-items: center; gap: 11px; min-width: 280px;
    padding: 9px 12px; border: 1px solid var(--border); border-radius: 14px;
    background: rgba(255, 255, 255, .035); cursor: pointer; text-align: left;
}
.account-button:hover { border-color: rgba(46, 217, 190, .4); background: rgba(46, 217, 190, .06); }
.account-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: rgba(46, 217, 190, .14); color: var(--teal); font-weight: 800; }
.account-button b { margin-top: 2px; font-size: 13px; }
.account-balance { margin-left: auto; color: var(--teal); font-size: 14px; font-weight: 800; }
.chevron { color: var(--muted); }

.workspace-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-width: 0; min-height: calc(100vh - 78px); }
.sidebar { position: sticky; top: 78px; align-self: start; height: calc(100vh - 78px); padding: 28px 18px; border-right: 1px solid var(--border); }
.sidebar nav { display: grid; gap: 6px; }
.nav-item {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px;
    border: 0; border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer; text-align: left;
}
.nav-item span { display: grid; place-items: center; width: 24px; height: 24px; font-size: 17px; }
.nav-item:hover, .nav-item.active { background: rgba(46, 217, 190, .09); color: var(--text); }
.nav-item.active { box-shadow: inset 3px 0 var(--teal); }
.sidebar-card { margin-top: 30px; padding: 17px; border: 1px solid rgba(46, 217, 190, .17); border-radius: 16px; background: linear-gradient(145deg, rgba(46, 217, 190, .08), rgba(98, 168, 255, .04)); }
.eyebrow { color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.sidebar-card strong { display: block; margin-top: 8px; font-size: 14px; }
.sidebar-card p, .panel-copy { color: var(--muted); font-size: 12px; line-height: 1.6; }
.sidebar-links { position: absolute; bottom: 25px; left: 24px; right: 24px; display: grid; gap: 11px; }
.sidebar-links a { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.sidebar-links a:hover { color: var(--teal); }

main { min-width: 0; padding: 38px clamp(20px, 3vw, 48px) 54px; }
.view { display: none; }
.view.active { display: block; animation: fade-in .22s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(5px); } }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; min-width: 0; margin-bottom: 26px; }
.page-heading > *, .bot-control > *, .metric-grid > *, .control-grid > *, .panel-heading > *, .site-footer > * { min-width: 0; }
.page-heading.compact { align-items: center; }
.page-heading h1 { margin: 8px 0 7px; font-size: clamp(29px, 4vw, 46px); line-height: 1.05; letter-spacing: -.04em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.bot-control { display: flex; align-items: center; gap: 18px; padding: 8px 8px 8px 18px; border: 1px solid var(--border); border-radius: 16px; background: rgba(255,255,255,.025); }
.bot-control > div { display: flex; flex-direction: column; min-width: 110px; }
.bot-control small { color: var(--muted); font-size: 10px; }
.bot-control strong { margin-top: 3px; font-size: 13px; }

.primary, .secondary {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 0 18px;
    border-radius: 12px; border: 1px solid transparent; font-weight: 800; font-size: 12px; cursor: pointer;
}
.primary { background: var(--teal); color: #021712; box-shadow: 0 12px 28px rgba(46,217,190,.16); }
.primary:hover { background: #48e4cb; transform: translateY(-1px); }
.primary.running { background: var(--red); color: #fff; box-shadow: 0 12px 28px rgba(255,100,124,.16); }
.primary:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.secondary { border-color: var(--border-strong); background: transparent; color: var(--text); }
.secondary:hover { border-color: var(--teal); }
.full { width: 100%; margin-top: 12px; }
.text-button { border: 0; padding: 0; background: none; color: var(--muted); font-size: 11px; cursor: pointer; }
.text-button:hover { color: var(--teal); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 13px; }
.metric-card { position: relative; min-height: 126px; padding: 20px; overflow: hidden; border: 1px solid var(--border); border-radius: 17px; background: linear-gradient(145deg, rgba(17,34,54,.9), rgba(8,18,31,.88)); }
.metric-card::after { content: ""; position: absolute; right: -30px; bottom: -55px; width: 110px; height: 110px; border-radius: 50%; background: rgba(46,217,190,.07); filter: blur(4px); }
.metric-card span { display: block; color: var(--muted); font-size: 11px; }
.metric-card strong { display: block; margin: 15px 0 7px; font-size: clamp(21px, 2vw, 28px); letter-spacing: -.03em; }
.metric-card small { color: #627b92; font-size: 10px; }
.metric-card.positive strong { color: var(--green); }
.metric-card.negative strong { color: var(--red); }

.control-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 13px; }
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.strategy-panel, .market-panel, .risk-panel, .signal-panel { padding: 23px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 19px; }
.panel-heading h2 { margin: 6px 0 0; font-size: 18px; letter-spacing: -.02em; }
.field-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
select, input {
    width: 100%; border: 1px solid var(--border-strong); border-radius: 11px;
    background: #071421; color: var(--text); outline: none;
}
select { height: 47px; padding: 0 13px; cursor: pointer; }
input { height: 42px; padding: 0 12px; }
select:focus, input:focus { border-color: rgba(46,217,190,.7); box-shadow: 0 0 0 3px rgba(46,217,190,.08); }
.strategy-summary { display: grid; grid-template-columns: auto 1fr; gap: 9px 13px; margin-top: 16px; padding: 15px; border-radius: 13px; background: rgba(255,255,255,.026); }
.strategy-summary .tag { align-self: start; padding: 5px 8px; border-radius: 7px; background: rgba(98,168,255,.12); color: var(--blue); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.strategy-summary p { grid-column: 2; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.strategy-summary small { color: #698198; }

.selection-count { padding: 6px 9px; border-radius: 8px; background: rgba(46,217,190,.1); color: var(--teal); font-size: 10px; font-weight: 800; }
.market-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; max-height: 230px; overflow: auto; padding-right: 4px; }
.market-option { position: relative; }
.market-option input { position: absolute; opacity: 0; pointer-events: none; }
.market-option span { display: flex; align-items: center; gap: 10px; min-height: 51px; padding: 10px 11px; border: 1px solid var(--border); border-radius: 11px; color: var(--muted); cursor: pointer; font-size: 11px; }
.market-option span::before { content: ""; width: 16px; height: 16px; border: 1px solid var(--border-strong); border-radius: 5px; }
.market-option input:checked + span { border-color: rgba(46,217,190,.55); background: rgba(46,217,190,.07); color: var(--text); }
.market-option input:checked + span::before { background: var(--teal); box-shadow: inset 0 0 0 4px #082018; }
.market-option input:disabled + span { opacity: .35; cursor: not-allowed; }
.skeleton { height: 50px; border-radius: 11px; background: linear-gradient(90deg,#0c1a2a,#13273b,#0c1a2a); background-size: 200%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.risk-panel { grid-column: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid label, .factor-field { display: grid; gap: 7px; }
.form-grid label span, .factor-field span { color: var(--muted); font-size: 10px; }
.toggle-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--border); }
.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.switch input { position:absolute; width:1px; height:1px; margin:0; padding:0; opacity:0; pointer-events:none; }
.switch > span { position: relative; width: 34px; height: 19px; flex: 0 0 auto; border-radius: 10px; background: #23384d; }
.switch > span::after { content:""; position:absolute; top:3px; left:3px; width:13px; height:13px; border-radius:50%; background:#8ca0b2; transition:.18s; }
.switch input:checked + span { background: rgba(46,217,190,.3); }
.switch input:checked + span::after { left:18px; background:var(--teal); }
.switch b { font-size: 10px; }
.factor-field { grid-column: 1 / -1; grid-template-columns: 1fr 80px; align-items: center; }
.factor-field input { height: 36px; }
.risk-note { margin-top: 16px; padding: 12px 13px; border: 1px solid rgba(245,187,80,.18); border-radius: 11px; background: rgba(245,187,80,.055); color: #bca778; font-size: 10px; line-height: 1.55; }

.signal-panel { grid-column: 2; grid-row: 2; }
.signal-state { padding: 6px 9px; border-radius: 8px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.signal-state.neutral { color: var(--muted); background: rgba(143,165,186,.1); }
.signal-state.ready { color: var(--green); background: rgba(60,224,162,.1); }
.signal-state.wait { color: var(--amber); background: rgba(245,187,80,.1); }
.signal-main { display: grid; grid-template-columns: 1fr 105px; align-items: center; gap: 18px; padding: 18px; border-radius: 15px; background: linear-gradient(135deg,rgba(46,217,190,.055),rgba(98,168,255,.04)); }
.signal-main small { color: var(--muted); font-size: 10px; }
.signal-main strong { display: block; margin: 7px 0; font-size: 24px; }
.signal-main p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.confidence-ring { --score: 0; display:grid; place-items:center; width:92px; height:92px; border-radius:50%; background: conic-gradient(var(--teal) calc(var(--score) * 1%), rgba(255,255,255,.07) 0); }
.confidence-ring::before { content:""; grid-area:1/1; width:72px; height:72px; border-radius:50%; background:#0a1928; }
.confidence-ring span { z-index:1; grid-area:1/1; display:flex; flex-direction:column; align-items:center; }
.confidence-ring b { font-size:22px; }
.confidence-ring small { font-size:8px; text-transform:uppercase; }
.digit-distribution { display:grid; grid-template-columns:repeat(10,1fr); align-items:end; gap:5px; height:95px; margin-top:20px; }
.digit-bar { display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; gap:5px; }
.digit-bar i { width:100%; min-height:3px; border-radius:4px 4px 2px 2px; background:linear-gradient(var(--blue),rgba(98,168,255,.25)); transition:height .25s; }
.digit-bar b { font-size:9px; }
.digit-bar small { color:#5d748a; font-size:7px; }
.history-strip { display:flex; gap:5px; margin-top:17px; overflow:hidden; }
.history-strip span { display:grid; place-items:center; flex:0 0 24px; width:24px; height:24px; border:1px solid var(--border); border-radius:7px; color:var(--muted); font-size:9px; }
.history-strip span.latest { border-color:var(--teal); color:var(--teal); background:rgba(46,217,190,.08); }

.recent-panel { margin-top:13px; padding:23px; }
.table-wrap { width:100%; max-width:100%; overflow-x:auto; overscroll-behavior-inline:contain; -webkit-overflow-scrolling:touch; }
table { width:100%; border-collapse:collapse; min-width:780px; }
th { padding:10px 12px; border-bottom:1px solid var(--border); color:#60768c; font-size:9px; text-align:left; text-transform:uppercase; letter-spacing:.08em; }
td { padding:14px 12px; border-bottom:1px solid rgba(148,177,206,.08); color:#aebdca; font-size:10px; }
td.positive { color:var(--green); font-weight:800; }
td.negative { color:var(--red); font-weight:800; }
.empty-row td { padding:34px; text-align:center; color:#60768c; }
.status-badge { padding:5px 8px; border-radius:7px; background:rgba(143,165,186,.1); }
.status-badge.won { color:var(--green); background:rgba(60,224,162,.08); }
.status-badge.lost { color:var(--red); background:rgba(255,100,124,.08); }

.filter-row { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:18px; }
.filter-row button { padding:9px 13px; border:1px solid var(--border); border-radius:10px; background:transparent; color:var(--muted); cursor:pointer; font-size:10px; }
.filter-row button.active, .filter-row button:hover { border-color:rgba(46,217,190,.4); color:var(--teal); background:rgba(46,217,190,.06); }
.strategy-library { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:13px; }
.strategy-card { display:flex; flex-direction:column; min-height:285px; padding:22px; border:1px solid var(--border); border-radius:18px; background:linear-gradient(145deg,rgba(17,34,54,.88),rgba(8,18,31,.9)); }
.strategy-card .card-top { display:flex; justify-content:space-between; gap:12px; }
.strategy-card .number { color:#4d6982; font-size:10px; font-weight:800; }
.strategy-card .category { padding:5px 8px; border-radius:7px; background:rgba(98,168,255,.1); color:var(--blue); font-size:8px; font-weight:800; text-transform:uppercase; }
.strategy-card h2 { margin:18px 0 9px; font-size:19px; }
.strategy-card p { margin:0; color:var(--muted); font-size:11px; line-height:1.65; }
.strategy-card dl { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin:20px 0; }
.strategy-card dt { color:#577087; font-size:8px; text-transform:uppercase; }
.strategy-card dd { margin:4px 0 0; font-size:10px; }
.strategy-card button { margin-top:auto; min-height:40px; border:1px solid var(--border); border-radius:10px; background:rgba(255,255,255,.025); cursor:pointer; font-size:10px; font-weight:800; }
.strategy-card button:hover { border-color:var(--teal); color:var(--teal); }

.event-list { display:grid; gap:0; min-height:240px; }
.event-item { display:grid; grid-template-columns:90px 100px 1fr; gap:16px; padding:16px 4px; border-bottom:1px solid var(--border); font-size:11px; }
.event-item time, .event-item span { color:var(--muted); }
.event-item strong { font-weight:600; }
.event-item.error strong { color:var(--red); }
.event-item.trade strong { color:var(--teal); }
.empty-message { place-self:center; color:var(--muted); }

.site-footer { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:20px; padding:28px 32px; border-top:1px solid var(--border); background:#030912; color:var(--muted); }
.site-footer > div { display:flex; align-items:center; gap:10px; }
.site-footer img { width:38px; height:38px; object-fit:contain; }
.site-footer b { color:var(--text); font-size:12px; }
.site-footer p { margin:0; font-size:10px; text-align:center; }
.site-footer nav { display:flex; gap:14px; font-size:9px; }
.site-footer nav a:hover { color:var(--teal); }
.site-footer > small { grid-column:1/-1; max-width:1100px; margin:auto; text-align:center; line-height:1.55; }

dialog { max-width:calc(100vw - 28px); padding:0; border:1px solid var(--border-strong); border-radius:22px; background:#081522; color:var(--text); box-shadow:0 40px 120px #000; }
dialog::backdrop { background:rgba(1,5,10,.8); backdrop-filter:blur(8px); }
.auth-dialog { width:min(820px,calc(100vw - 28px)); grid-template-columns:.85fr 1.15fr; overflow:hidden; }
.auth-dialog[open] { display:grid; }
.dialog-art { display:flex; flex-direction:column; justify-content:flex-end; min-height:500px; padding:34px; background:radial-gradient(circle at 30% 20%,rgba(46,217,190,.19),transparent 45%),linear-gradient(155deg,#102a3c,#07111d); }
.dialog-art img { position:absolute; top:32px; width:58px; }
.dialog-art span { color:var(--teal); font-size:10px; font-weight:800; letter-spacing:.14em; text-transform:uppercase; }
.dialog-art h2 { margin:10px 0; font-size:32px; line-height:1.12; }
.dialog-art p, .dialog-content > p { color:var(--muted); font-size:12px; line-height:1.65; }
.dialog-content { position:relative; padding:45px 40px; }
.dialog-content h2 { margin:9px 0 10px; font-size:25px; }
.dialog-close { position:absolute; top:16px; right:18px; width:34px; height:34px; border:0; border-radius:50%; background:rgba(255,255,255,.05); color:var(--muted); cursor:pointer; font-size:20px; }
.guest-button { min-height:44px; margin-top:10px; border:0; background:transparent; color:var(--teal); cursor:pointer; font:inherit; font-size:11px; font-weight:800; }
.guest-button:hover { color:#7af7e2; text-decoration:underline; text-underline-offset:4px; }
.guest-button:focus-visible { outline:2px solid var(--teal); outline-offset:2px; border-radius:10px; }
.security-list { display:grid; gap:8px; margin:22px 0; padding:15px; border-radius:12px; background:rgba(255,255,255,.025); color:#91a8ba; font-size:10px; }
.fine-print { margin-bottom:0; font-size:9px !important; }
.account-dialog { width:min(480px,calc(100vw - 28px)); padding:26px; }
.modal-heading { display:flex; justify-content:space-between; align-items:flex-start; }
.modal-heading h2 { margin:7px 0 18px; }
.modal-heading .dialog-close { position:static; }
.account-list { display:grid; gap:9px; }
.account-row { display:flex; align-items:center; gap:12px; width:100%; padding:13px; border:1px solid var(--border); border-radius:12px; background:rgba(255,255,255,.02); cursor:pointer; text-align:left; }
.account-row:hover, .account-row.active { border-color:rgba(46,217,190,.5); background:rgba(46,217,190,.06); }
.account-row .account-meta { display:flex; flex-direction:column; }
.account-row small { color:var(--muted); font-size:9px; }
.account-row strong:last-child { margin-left:auto; color:var(--teal); font-size:12px; }
.danger-link { margin-top:20px; border:0; background:none; color:var(--red); cursor:pointer; font-size:11px; }
.confirm-dialog { width:min(500px,calc(100vw - 28px)); padding:31px; text-align:center; }
.warning-icon { display:grid; place-items:center; width:48px; height:48px; margin:auto; border-radius:50%; background:rgba(255,100,124,.12); color:var(--red); font-size:24px; font-weight:900; }
.confirm-dialog h2 { margin:16px 0 9px; }
.confirm-dialog p { color:var(--muted); font-size:12px; line-height:1.65; }
.acknowledge { display:flex; gap:10px; margin:20px 0; padding:14px; border:1px solid var(--border); border-radius:12px; text-align:left; color:#aebdca; font-size:10px; line-height:1.5; }
.acknowledge input { width:16px; height:16px; flex:0 0 auto; }
.dialog-actions { display:flex; justify-content:flex-end; gap:9px; }
.toast-region { position:fixed; right:18px; bottom:18px; z-index:100; display:grid; gap:9px; width:min(360px,calc(100vw - 36px)); }
.toast { padding:14px 16px; border:1px solid var(--border-strong); border-left:3px solid var(--teal); border-radius:12px; background:#0b1a29; box-shadow:var(--shadow); font-size:11px; animation:toast-in .2s ease; }
.toast.error { border-left-color:var(--red); }
.toast.warning { border-left-color:var(--amber); }
@keyframes toast-in { from { opacity:0; transform:translateY(10px); } }
.mobile-nav { display:none; }

@media (max-width: 1100px) {
    .metric-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .strategy-library { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 820px) {
    .topbar { height:68px; padding:0 16px; }
    .brand img { width:38px; height:38px; }
    .brand span { display:none; }
    .connection-pill span { display:none; }
    .account-button { min-width:0; padding:7px; border:0; background:transparent; }
    .account-button > span:nth-child(2), .account-balance, .chevron { display:none; }
    .workspace-layout { display:block; }
    .sidebar { display:none; }
    .mobile-nav { position:sticky; top:68px; z-index:19; display:grid; grid-template-columns:repeat(3,1fr); padding:0 12px; background:rgba(5,11,20,.94); border-bottom:1px solid var(--border); backdrop-filter:blur(18px); }
    .mobile-nav button { height:48px; border:0; border-bottom:2px solid transparent; background:none; color:var(--muted); font-size:10px; }
    .mobile-nav button.active { color:var(--teal); border-bottom-color:var(--teal); }
    main { padding:26px 14px 40px; }
    .page-heading { align-items:flex-start; flex-direction:column; }
    .bot-control { width:100%; justify-content:space-between; }
    .control-grid { grid-template-columns:1fr; }
    .risk-panel, .signal-panel { grid-column:auto; grid-row:auto; }
    .site-footer { grid-template-columns:1fr; text-align:center; }
    .site-footer > div, .site-footer nav { justify-content:center; }
    .site-footer > small { grid-column:auto; }
    dialog, .auth-dialog {
        width: calc(100vw - 28px);
        max-width: calc(100vw - 28px);
    }
    .auth-dialog[open] { display:block; }
    .dialog-art, .dialog-content { width:100%; min-width:0; overflow-wrap:anywhere; }
    .dialog-art { min-height:230px; padding:28px; }
    .dialog-art img { position:static; width:48px; margin-bottom:36px; }
    .dialog-art h2 { font-size:25px; }
    .dialog-content { padding:31px 25px; }
    .dialog-content .primary, .dialog-content .secondary { width:100%; }
}
@media (max-width: 560px) {
    .topbar { padding-inline:max(12px,env(safe-area-inset-left)) max(12px,env(safe-area-inset-right)); }
    .mobile-nav { padding-inline:max(8px,env(safe-area-inset-left)) max(8px,env(safe-area-inset-right)); }
    main { padding-right:max(12px,env(safe-area-inset-right)); padding-left:max(12px,env(safe-area-inset-left)); }
    .page-heading h1 { font-size:31px; }
    .page-heading { gap:18px; }
    .bot-control { align-items:stretch; flex-direction:column; gap:12px; padding:14px; }
    .bot-control > div { min-width:0; }
    .bot-control .primary { width:100%; }
    .metric-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
    .metric-card { min-height:108px; padding:16px; }
    .metric-card strong { margin:12px 0 5px; font-size:20px; }
    .panel { border-radius:17px; }
    .strategy-panel, .market-panel, .risk-panel, .signal-panel, .recent-panel { padding:18px; }
    .market-list { grid-template-columns:1fr; max-height:260px; }
    .signal-main { grid-template-columns:1fr 78px; padding:14px; }
    .confidence-ring { width:72px; height:72px; }
    .confidence-ring::before { width:56px; height:56px; }
    .confidence-ring b { font-size:17px; }
    .digit-distribution { gap:3px; }
    .form-grid { gap:9px; }
    .toggle-row { grid-template-columns:1fr; }
    .strategy-library { grid-template-columns:1fr; }
    .event-item { grid-template-columns:65px 1fr; }
    .event-item strong { grid-column:1/-1; }
    .site-footer { padding:24px max(14px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left)); }
    .site-footer nav { flex-wrap:wrap; }
}

@media (max-width: 390px) {
    .metric-grid { grid-template-columns:1fr; }
    .metric-card { min-height:96px; }
    .form-grid { grid-template-columns:1fr; }
    .signal-main { grid-template-columns:1fr; }
    .confidence-ring { margin:auto; }
    .dialog-actions { flex-direction:column-reverse; }
    .dialog-actions .primary, .dialog-actions .secondary { width:100%; }
}

.error-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.error-card {
    width: min(640px, 100%);
    padding: clamp(28px, 7vw, 64px);
    border: 1px solid var(--border);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.error-card img { width: 64px; margin-bottom: 28px; }
.error-card h1 { margin: 12px 0; font-size: clamp(2rem, 6vw, 4rem); line-height: 1; }
.error-card p { color: var(--muted); line-height: 1.7; }
.error-card div { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.error-card a { text-decoration: none; }

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