:root {
  color-scheme: dark;
  --bg: #080b10;
  --bg-soft: #0d1118;
  --surface: #111720;
  --surface-2: #151d28;
  --surface-3: #1a2330;
  --line: #222d3b;
  --line-strong: #2c3948;
  --text: #f4f7fb;
  --muted: #8491a3;
  --muted-2: #5c697b;
  --green: #31d07d;
  --green-soft: rgba(49, 208, 125, .12);
  --red: #ff5f6d;
  --red-soft: rgba(255, 95, 109, .12);
  --amber: #f0b95a;
  --amber-soft: rgba(240, 185, 90, .12);
  --blue: #5b8cff;
  --blue-soft: rgba(91, 140, 255, .13);
  --radius: 20px;
  --radius-sm: 13px;
  --shadow: 0 18px 60px rgba(0, 0, 0, .24);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body { min-width: 320px; }
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell { width: 100%; max-width: 760px; min-height: 100vh; margin: 0 auto; padding: env(safe-area-inset-top) 0 calc(96px + env(safe-area-inset-bottom)); }
.content-area { padding: 16px 18px 24px; }
.page { animation: page-in .18s ease-out; }

@keyframes page-in { from { opacity: .55; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; padding: 11px 18px; border-bottom: 1px solid rgba(255,255,255,.05); background: rgba(8, 11, 16, .88); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.brand-lockup, .topbar-actions, .symbol-row, .decision-topline, .metric-row, .section-heading, .page-heading, .user-head, .identity-row { display: flex; align-items: center; }
.brand-lockup { gap: 11px; }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; border: 1px solid #26303d; border-radius: 18px; background: linear-gradient(145deg, #1d2633, #0e131b); font-weight: 800; font-size: 22px; letter-spacing: -.08em; box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.brand-mark-small { width: 38px; height: 38px; border-radius: 12px; font-size: 15px; }
.brand-title { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: .055em; }
.brand-subtitle { margin: 2px 0 0; color: var(--muted); font-size: 10px; letter-spacing: .04em; }
.topbar-actions { gap: 8px; }
.identity-row { justify-content: space-between; padding: 10px 18px; border-bottom: 1px solid rgba(255,255,255,.04); color: var(--muted); font-size: 11px; }
.paper-badge { color: var(--amber); font-weight: 700; letter-spacing: .07em; }

.eyebrow { margin: 0 0 7px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .15em; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(27px, 8vw, 39px); letter-spacing: -.045em; }
h2 { margin: 0; font-size: 25px; line-height: 1.05; letter-spacing: -.035em; }
h3 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-variant-numeric: tabular-nums; }
.compact { font-size: 11px !important; }

.gate-card { width: min(430px, calc(100vw - 36px)); margin: 14vh auto 0; padding: 30px; border: 1px solid var(--line); border-radius: 28px; background: linear-gradient(160deg, #131a24, #0b0f15); box-shadow: var(--shadow); text-align: center; }
.gate-card .brand-mark { margin: 0 auto 24px; }
.gate-message { margin: 14px auto 22px; max-width: 320px; color: var(--muted); }

.status-pill, .tag, .asset-badge { display: inline-flex; align-items: center; gap: 6px; width: fit-content; border: 1px solid var(--line); border-radius: 999px; padding: 5px 8px; font-size: 9px; font-weight: 800; letter-spacing: .09em; white-space: nowrap; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.status-neutral { color: var(--muted); background: rgba(255,255,255,.02); }
.status-live, .status-win { color: var(--green); background: var(--green-soft); border-color: rgba(49,208,125,.2); }
.status-stale, .status-loss { color: var(--red); background: var(--red-soft); border-color: rgba(255,95,109,.2); }
.status-open { color: var(--amber); background: var(--amber-soft); border-color: rgba(240,185,90,.2); }
.tag { color: #bdc9d8; background: var(--surface-2); letter-spacing: .03em; }
.asset-badge { color: var(--amber); border-color: rgba(240,185,90,.2); background: var(--amber-soft); }

.market-header, .page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 8px 0 18px; }
.symbol-row { gap: 10px; }
.horizon-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 13px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: #0b0f15; }
.horizon-option { min-height: 38px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 800; letter-spacing: .09em; cursor: pointer; }
.horizon-option.active { color: var(--text); background: var(--surface-3); box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }
.horizon-option:disabled { opacity: .35; cursor: not-allowed; }

.decision-card, .info-card, .recent-card, .metric-card, .user-card { border: 1px solid var(--line); background: linear-gradient(160deg, rgba(20,27,37,.98), rgba(13,18,25,.98)); box-shadow: inset 0 1px 0 rgba(255,255,255,.025); }
.decision-card { position: relative; overflow: hidden; padding: 18px; border-radius: 24px; }
.decision-card::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 82% 4%, rgba(255,255,255,.06), transparent 36%); }
.decision-up { border-color: rgba(49,208,125,.27); background: linear-gradient(160deg, rgba(20,38,33,.98), rgba(12,21,19,.98)); }
.decision-down { border-color: rgba(255,95,109,.25); background: linear-gradient(160deg, rgba(42,25,29,.98), rgba(23,15,18,.98)); }
.decision-skip { border-color: var(--line); }
.decision-topline { position: relative; justify-content: space-between; color: var(--muted); font-size: 10px; }
.decision-main { position: relative; display: flex; align-items: center; gap: 15px; margin: 26px 0 7px; }
.decision-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 17px; background: rgba(255,255,255,.045); font-size: 30px; font-weight: 300; }
.decision-up .decision-icon { color: var(--green); background: var(--green-soft); }
.decision-down .decision-icon { color: var(--red); background: var(--red-soft); }
.decision-label { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .14em; color: var(--muted); }
.decision-confidence { margin: 2px 0 0; font-size: 34px; font-weight: 750; line-height: 1; letter-spacing: -.05em; }
.decision-note { position: relative; min-height: 40px; margin: 14px 0 19px; color: #a5b0bf; font-size: 12px; }
.probability-grid { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.probability-item { padding: 12px; border-radius: 14px; background: rgba(5,8,12,.38); }
.metric-row { justify-content: space-between; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.metric-row strong { color: var(--text); font-size: 14px; }
.meter { height: 4px; margin-top: 9px; overflow: hidden; border-radius: 999px; background: #252d38; }
.meter span { display: block; width: 0; height: 100%; border-radius: inherit; transition: width .24s ease; }
#up-meter { background: var(--green); }
#down-meter { background: var(--red); }

.metric-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.metric-card { min-width: 0; padding: 13px 12px; border-radius: 16px; }
.metric-label, .info-grid span { display: block; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .06em; }
.metric-card strong { display: block; margin: 4px 0 1px; font-size: 17px; font-variant-numeric: tabular-nums; }
.metric-card small { display: block; color: var(--muted-2); font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }

.info-card, .recent-card { margin-top: 10px; padding: 17px; border-radius: var(--radius); }
.info-card-head, .section-heading { justify-content: space-between; gap: 12px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; margin-top: 17px; }
.info-grid strong { display: block; margin-top: 4px; font-size: 13px; font-weight: 650; }
.section-heading { margin-bottom: 13px; }
.section-heading h3 { margin-top: -2px; }
.text-button { padding: 5px 0; border: 0; background: transparent; color: var(--blue); font-size: 11px; font-weight: 700; cursor: pointer; }

.signal-list { display: grid; gap: 8px; }
.signal-row { display: grid; grid-template-columns: minmax(92px, 1.2fr) minmax(60px, .65fr) minmax(76px, .8fr) minmax(64px, .6fr); align-items: center; gap: 8px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(7,10,15,.46); }
.compact-list .signal-row:nth-child(n+5) { display: none; }
.signal-primary { display: flex; align-items: center; gap: 9px; min-width: 0; }
.direction-chip { width: 29px; height: 29px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 9px; font-size: 15px; font-weight: 800; }
.direction-up { color: var(--green); background: var(--green-soft); }
.direction-down { color: var(--red); background: var(--red-soft); }
.direction-skip { color: var(--muted); background: rgba(255,255,255,.04); }
.signal-main { min-width: 0; }
.signal-main strong { display: block; font-size: 12px; }
.signal-main small, .signal-cell small { display: block; color: var(--muted-2); font-size: 9px; }
.signal-cell { min-width: 0; text-align: right; font-variant-numeric: tabular-nums; }
.signal-cell strong { font-size: 11px; font-weight: 650; }
.empty-state { margin: 0; padding: 22px 10px; color: var(--muted); font-size: 12px; text-align: center; }

.filter-row { display: flex; gap: 7px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: 10px; font-weight: 750; cursor: pointer; }
.filter-chip.active { color: var(--text); border-color: var(--line-strong); background: var(--surface-3); }

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-bottom: 10px; }
.stat-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.stat-card span { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.stat-card strong { display: block; margin-top: 5px; font-size: 23px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.stat-card small { display: block; margin-top: 2px; color: var(--muted-2); font-size: 9px; }
.stats-details { display: grid; gap: 0; }
.stat-detail { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 43px; border-bottom: 1px solid rgba(255,255,255,.05); font-size: 11px; }
.stat-detail:last-child { border-bottom: 0; }
.stat-detail span { color: var(--muted); }
.stat-detail strong { max-width: 65%; text-align: right; font-size: 11px; overflow-wrap: anywhere; }

.add-user-card { margin-top: 0; }
.add-user-card form { display: grid; gap: 13px; }
label { display: grid; gap: 7px; color: #c4ccd7; font-size: 10px; font-weight: 700; letter-spacing: .025em; }
input, select { width: 100%; min-height: 45px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 12px; outline: 0; color: var(--text); background: #0b1017; }
input:focus, select:focus { border-color: #52647b; box-shadow: 0 0 0 3px rgba(91,140,255,.08); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 0; }
.switch-row span { display: grid; gap: 3px; }
.switch-row strong { font-size: 11px; }
.switch-row small { color: var(--muted); font-size: 9px; font-weight: 500; }
.switch-row input { appearance: none; width: 42px; height: 24px; min-height: 24px; padding: 0; flex: 0 0 auto; border-radius: 999px; background: #293241; cursor: pointer; transition: .18s ease; }
.switch-row input::after { content: ""; display: block; width: 18px; height: 18px; margin: 2px; border-radius: 50%; background: #c8d0db; transition: transform .18s ease; }
.switch-row input:checked { border-color: rgba(49,208,125,.4); background: var(--green); }
.switch-row input:checked::after { transform: translateX(18px); background: #07120c; }
.feedback { min-height: 18px; margin: 0; color: var(--muted); font-size: 10px; }
.users-heading { margin: 21px 2px 8px; }
.users-list { display: grid; gap: 9px; }
.user-card { padding: 15px; border-radius: 17px; }
.user-head { justify-content: space-between; gap: 12px; }
.user-name { margin: 0; font-size: 13px; font-weight: 700; }
.user-id { margin: 2px 0 0; color: var(--muted); font-size: 9px; }
.user-meta { display: flex; flex-wrap: wrap; gap: 8px 13px; margin: 12px 0; color: var(--muted); font-size: 9px; }
.user-actions, .role-editor { display: flex; gap: 7px; align-items: end; flex-wrap: wrap; }
.role-editor { margin: 11px 0 8px; }
.role-editor label { min-width: 130px; flex: 1; }
.role-editor select { min-height: 38px; }
.protected { margin: 11px 0 0; color: var(--muted); font-size: 9px; }

.button, .icon-button { border: 1px solid var(--line); color: var(--text); background: var(--surface-2); cursor: pointer; }
.button { min-height: 43px; padding: 9px 14px; border-radius: 12px; font-size: 11px; font-weight: 750; }
.button-primary { border-color: #dde5ef; color: #081019; background: #eef3f8; }
.button-secondary { background: var(--surface-2); }
.button-danger { border-color: rgba(255,95,109,.28); color: #ff9099; background: var(--red-soft); }
.full-width { width: 100%; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border-radius: 11px; font-size: 16px; }
.icon-button-large { width: 39px; height: 39px; }
.button:disabled, .icon-button:disabled { opacity: .42; cursor: default; }
.button:active, .icon-button:active, .nav-item:active { transform: scale(.98); }

.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: 0; width: min(760px, 100%); transform: translateX(-50%); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 7px 10px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.06); background: rgba(10, 13, 18, .94); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); }
.nav-item { min-height: 52px; display: grid; place-items: center; align-content: center; gap: 2px; border: 0; border-radius: 12px; color: var(--muted-2); background: transparent; font-size: 9px; font-weight: 700; cursor: pointer; }
.nav-item.active { color: var(--text); }
.nav-icon { font-size: 18px; line-height: 1; }
.nav-item.active .nav-icon { color: var(--blue); }

dialog { width: min(420px, calc(100vw - 32px)); padding: 21px; border: 1px solid var(--line-strong); border-radius: 20px; color: var(--text); background: #111821; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.68); backdrop-filter: blur(3px); }
dialog h2 { font-size: 20px; }
dialog p:not(.eyebrow) { color: var(--muted); font-size: 12px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }

@media (min-width: 620px) {
  .content-area { padding-left: 24px; padding-right: 24px; }
  .decision-card { padding: 22px; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .signal-row { grid-template-columns: minmax(150px, 1.4fr) repeat(3, 1fr); }
}

@media (max-width: 390px) {
  .content-area { padding-left: 13px; padding-right: 13px; }
  .topbar { padding-left: 13px; padding-right: 13px; }
  .identity-row { padding-left: 13px; padding-right: 13px; }
  .metric-cards { gap: 6px; }
  .metric-card { padding: 11px 9px; }
  .metric-card strong { font-size: 15px; }
  .signal-row { grid-template-columns: minmax(88px, 1.25fr) minmax(53px, .7fr) minmax(56px, .7fr); }
  .signal-row .signal-result-cell { display: none; }
}

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