:root {
  --bg-base: #040406;
  --bg-panel: #0a0a0f;
  --bg-elevated: #111118;
  --bg-hover: #181822;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #ececf1;
  --text-muted: #8b8b9a;
  --text-dim: #5c5c6a;
  --buy: #00e599;
  --buy-dim: rgba(0, 229, 153, 0.12);
  --buy-strong: #00c47f;
  --sell: #ff4d6a;
  --sell-dim: rgba(255, 77, 106, 0.12);
  --brand-snipe: #00ADEF;
  --brand-shares: #F7941D;
  --brand-snap-light: #5BCFFF;
  --brand-shares-light: #FBB03B;
  --accent: #00ADEF;
  --accent-dim: rgba(0, 173, 239, 0.15);
  --warn: #ffb020;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-brand: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --ob-head-h: 22px;
  --ob-row-h: 20px;
  --ob-visible-rows: 6;
  --ob-pane-h: calc(var(--ob-head-h) + var(--ob-row-h) * var(--ob-visible-rows));
  --ob-col-price: 34%;
  --ob-col-shares: 33%;
  --ob-col-total: 33%;
  --ob-cols: var(--ob-col-price) var(--ob-col-shares) var(--ob-col-total);
  --danger: #ff4d6a;
  --danger-dim: rgba(255, 77, 106, 0.12);
  --app-gradient-1: rgba(0, 173, 239, 0.08);
  --app-gradient-2: rgba(247, 148, 29, 0.05);
  --app-gradient-3: rgba(0, 229, 153, 0.04);
  --topbar-bg: rgba(10, 10, 15, 0.85);
  --hotkeys-bg: rgba(10, 10, 15, 0.9);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --surface-subtle: rgba(255, 255, 255, 0.05);
  --surface-overlay: rgba(0, 0, 0, 0.65);
  --accent-border: rgba(0, 173, 239, 0.35);
  --accent-glow: rgba(0, 173, 239, 0.08);
  --market-active-border: rgba(0, 229, 153, 0.35);
  --cricket-active-bg: rgba(0, 173, 239, 0.12);
  --cricket-active-border: rgba(0, 173, 239, 0.35);
  --cricket-live: #2ebd85;
  --outcome-yes-bg: #2ebd85;
  --outcome-no-bg: #e8616f;
  --cancel-market-bg: rgba(96, 165, 250, 0.08);
  --cancel-market-border: rgba(96, 165, 250, 0.35);
  --cancel-market-color: #60a5fa;
  --cancel-market-hover: rgba(96, 165, 250, 0.16);
  --ob-bg: #141416;
  --ob-spread-bg: #101012;
  --ob-border: rgba(255, 255, 255, 0.06);
  --ob-muted: #6b7280;
  --ob-muted-hover: #9ca3af;
  --ob-cell-text: #f5f5f5;
  --ob-outcome-label: #c9a227;
  --ob-ask-price: #e8616f;
  --ob-bid-price: #2ebd85;
  --ob-row-hover: rgba(255, 255, 255, 0.03);
  --spread-mid: #f59e0b;
  --sell-light: #ff6b84;
  --sell-pos-strong: #ff8888;
  --btn-buy-text: #001a10;
  --snipe-header-on-bg: rgba(255, 176, 32, 0.15);
  --snipe-header-on-border: rgba(255, 176, 32, 0.35);
  --snipe-power-on-border: rgba(52, 211, 153, 0.45);
  --snipe-power-on-bg: rgba(52, 211, 153, 0.08);
  --snipe-power-on-thumb: rgba(52, 211, 153, 0.85);
  --snipe-section-bg: rgba(255, 176, 32, 0.04);
  --snipe-outcome-active-bg: rgba(255, 176, 32, 0.12);
  --snipe-outcome-active-border: rgba(255, 176, 32, 0.4);
  --cancel-all-bg: rgba(255, 90, 110, 0.08);
  --cancel-all-border: rgba(255, 90, 110, 0.45);
  --cancel-all-hover: rgba(255, 90, 110, 0.16);
  --sell-section-bg: rgba(255, 77, 106, 0.03);
  --sell-pos-card-bg: rgba(255, 77, 106, 0.06);
  --sell-pos-card-border: rgba(255, 77, 106, 0.15);
  --seg-active-border: rgba(108, 140, 255, 0.35);
  --preset-plus-border: rgba(52, 211, 153, 0.55);
  --preset-minus-border: rgba(248, 113, 113, 0.55);
  --latency-fast-border: rgba(0, 229, 153, 0.25);
  --toast-ok-border: rgba(0, 229, 153, 0.4);
  --toast-err-border: rgba(255, 77, 106, 0.4);
  --toast-warn-border: rgba(255, 176, 32, 0.4);
  --theme-toggle-active-bg: rgba(255, 255, 255, 0.1);
  --theme-toggle-icon: #ececf1;
  --theme-toggle-icon-muted: #5c5c6a;
  --pin-dot-border: rgba(255, 255, 255, 0.22);
  --pin-dot-active-border: #a8b8ff;
  --pin-dot-active-bg: rgba(0, 173, 239, 0.12);
  --pin-dot-focus-border: #8aa4ff;
  --pin-dot-filled-glow: rgba(0, 173, 239, 0.5);
  --pin-dot-active-ring: rgba(0, 173, 239, 0.15);
}

body[data-terminal-theme="light"] {
  --bg-base: #e9ecf1;
  --bg-panel: #ffffff;
  --bg-elevated: #f3f5f8;
  --bg-hover: #e4e8ef;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --buy: #059669;
  --buy-dim: rgba(5, 150, 105, 0.12);
  --buy-strong: #047857;
  --sell: #dc2626;
  --sell-dim: rgba(220, 38, 38, 0.1);
  --accent: #0284c7;
  --accent-dim: rgba(2, 132, 199, 0.12);
  --warn: #d97706;
  --danger: #dc2626;
  --danger-dim: rgba(220, 38, 38, 0.1);
  --shadow: 0 16px 48px rgba(15, 23, 42, 0.12);
  --app-gradient-1: rgba(0, 173, 239, 0.07);
  --app-gradient-2: rgba(247, 148, 29, 0.05);
  --app-gradient-3: rgba(5, 150, 105, 0.05);
  --topbar-bg: rgba(255, 255, 255, 0.94);
  --hotkeys-bg: rgba(255, 255, 255, 0.96);
  --surface-hover: rgba(15, 23, 42, 0.06);
  --surface-subtle: rgba(15, 23, 42, 0.04);
  --surface-overlay: rgba(15, 23, 42, 0.42);
  --accent-border: rgba(2, 132, 199, 0.35);
  --accent-glow: rgba(2, 132, 199, 0.1);
  --market-active-border: rgba(5, 150, 105, 0.4);
  --cricket-active-bg: rgba(2, 132, 199, 0.1);
  --cricket-active-border: rgba(2, 132, 199, 0.32);
  --cricket-live: #059669;
  --outcome-yes-bg: #059669;
  --outcome-no-bg: #dc2626;
  --cancel-market-bg: rgba(37, 99, 235, 0.08);
  --cancel-market-border: rgba(37, 99, 235, 0.3);
  --cancel-market-color: #2563eb;
  --cancel-market-hover: rgba(37, 99, 235, 0.14);
  --ob-bg: #f8fafc;
  --ob-spread-bg: #f1f5f9;
  --ob-border: rgba(15, 23, 42, 0.1);
  --ob-muted: #64748b;
  --ob-muted-hover: #475569;
  --ob-cell-text: #1e293b;
  --ob-outcome-label: #b45309;
  --ob-ask-price: #dc2626;
  --ob-bid-price: #059669;
  --ob-row-hover: rgba(15, 23, 42, 0.04);
  --spread-mid: #d97706;
  --sell-light: #ef4444;
  --sell-pos-strong: #dc2626;
  --btn-buy-text: #ffffff;
  --snipe-header-on-bg: rgba(217, 119, 6, 0.12);
  --snipe-header-on-border: rgba(217, 119, 6, 0.35);
  --snipe-power-on-border: rgba(5, 150, 105, 0.45);
  --snipe-power-on-bg: rgba(5, 150, 105, 0.08);
  --snipe-power-on-thumb: rgba(5, 150, 105, 0.9);
  --snipe-section-bg: rgba(217, 119, 6, 0.05);
  --snipe-outcome-active-bg: rgba(217, 119, 6, 0.12);
  --snipe-outcome-active-border: rgba(217, 119, 6, 0.38);
  --cancel-all-bg: rgba(220, 38, 38, 0.08);
  --cancel-all-border: rgba(220, 38, 38, 0.35);
  --cancel-all-hover: rgba(220, 38, 38, 0.14);
  --sell-section-bg: rgba(220, 38, 38, 0.03);
  --sell-pos-card-bg: rgba(220, 38, 38, 0.06);
  --sell-pos-card-border: rgba(220, 38, 38, 0.16);
  --seg-active-border: rgba(2, 132, 199, 0.35);
  --preset-plus-border: rgba(5, 150, 105, 0.45);
  --preset-minus-border: rgba(220, 38, 38, 0.45);
  --latency-fast-border: rgba(5, 150, 105, 0.3);
  --toast-ok-border: rgba(5, 150, 105, 0.4);
  --toast-err-border: rgba(220, 38, 38, 0.4);
  --toast-warn-border: rgba(217, 119, 6, 0.4);
  --theme-toggle-active-bg: rgba(2, 132, 199, 0.14);
  --theme-toggle-icon: #0f172a;
  --theme-toggle-icon-muted: #94a3b8;
  --pin-dot-border: rgba(15, 23, 42, 0.22);
  --pin-dot-active-border: #0284c7;
  --pin-dot-active-bg: rgba(2, 132, 199, 0.1);
  --pin-dot-focus-border: #0369a1;
  --pin-dot-filled-glow: rgba(2, 132, 199, 0.35);
  --pin-dot-active-ring: rgba(2, 132, 199, 0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 173, 239, 0.08), transparent),
    radial-gradient(ellipse 50% 35% at 90% 10%, rgba(247, 148, 29, 0.05), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(0, 229, 153, 0.04), transparent),
    var(--bg-base);
}

.hidden { display: none !important; }

/* Auth */
.auth-screen, .setup-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-screen {
  position: relative;
}

.auth-recommendation {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(0, 173, 239, 0.28);
  background:
    linear-gradient(135deg, rgba(0, 173, 239, 0.12), rgba(247, 148, 29, 0.06)),
    var(--bg-elevated);
  box-shadow:
    0 0 0 1px rgba(0, 173, 239, 0.06) inset,
    0 8px 24px rgba(0, 173, 239, 0.1);
}

.auth-recommendation-icon {
  flex-shrink: 0;
  font-size: 15px;
  line-height: 1.4;
}

.auth-recommendation p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
}

.telegram-contact-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2aabee, #229ed9);
  color: #fff;
  box-shadow:
    0 8px 28px rgba(42, 171, 238, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.telegram-contact-btn svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.telegram-contact-btn:hover {
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.06);
  box-shadow:
    0 12px 32px rgba(42, 171, 238, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.16) inset;
}

.telegram-contact-btn:active {
  transform: scale(0.98);
}

@media (max-width: 480px) {
  .telegram-contact-btn {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    width: 48px;
    height: 48px;
  }

  .telegram-contact-btn svg {
    width: 24px;
    height: 24px;
  }
}

.auth-card, .setup-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent), var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.auth-brand { text-align: center; margin-bottom: 28px; }
.brand-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  display: block;
  filter: drop-shadow(0 8px 24px rgba(0, 173, 239, 0.35));
}
.brand-title,
.logo-text {
  font-family: var(--font-brand);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.logo-snipe { color: var(--brand-snipe); }
.logo-shares { color: var(--brand-shares); }

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.logo-text-topbar {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.auth-brand p, .setup-card > p { color: var(--text-muted); margin-top: 6px; font-size: 13px; line-height: 1.5; }

.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px;
}
.auth-tab {
  padding: 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  cursor: pointer; font-weight: 600;
}
.auth-tab.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(0, 173, 239, 0.35); }

.auth-form label, .setup-form label {
  display: block; margin-bottom: 14px;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.auth-form input, .setup-form input {
  display: block; width: 100%; margin-top: 6px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
}
.auth-form input:focus, .setup-form input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.auth-error { color: var(--sell); font-size: 12px; margin-top: 12px; min-height: 18px; }

.auth-step-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.auth-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  text-align: center;
  margin: 12px 0 4px;
}

.auth-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-ui);
}

.auth-link:hover {
  text-decoration: underline;
}

.setup-cancel-wrap {
  text-align: center;
  margin-top: 12px;
}

.setup-card { width: min(480px, 100%); }
.setup-card h2 { font-size: 20px; margin-bottom: 8px; }

/* Buttons */
.btn {
  border: none; border-radius: var(--radius-sm);
  padding: 10px 16px; font-weight: 600; cursor: pointer;
  font-family: var(--font-ui); font-size: 12px;
  transition: transform 0.08s, opacity 0.08s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.snipe-btn-locked {
  opacity: 0.28;
  filter: grayscale(0.85);
  pointer-events: none;
}
.btn-block { width: 100%; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5568d4);
  color: #fff; margin-top: 8px;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); }
.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(255, 77, 106, 0.35);
}
.btn-danger:hover { filter: brightness(1.08); background: rgba(255, 77, 106, 0.18); }
.btn-sm { padding: 6px 10px; font-size: 11px; }
.btn-team-a {
  background: linear-gradient(180deg, var(--buy), var(--buy-strong));
  color: var(--btn-buy-text);
  font-weight: 700;
}
.btn-team-b {
  background: linear-gradient(180deg, var(--sell-light), var(--sell));
  color: #fff;
  font-weight: 700;
}
.btn-buy {
  background: linear-gradient(180deg, var(--buy), var(--buy-strong));
  color: var(--btn-buy-text); font-weight: 700;
}
.btn-buy.alt { background: linear-gradient(180deg, var(--sell-light), var(--sell)); color: #fff; }
.btn-sell {
  background: linear-gradient(180deg, var(--buy), var(--buy-strong));
  color: var(--btn-buy-text); font-weight: 700;
}
.btn-sell.alt { background: linear-gradient(180deg, var(--sell-light), var(--sell)); color: #fff; }

/* App shell — viewport-locked on full screen */
.app {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--app-gradient-1), transparent),
    radial-gradient(ellipse 50% 35% at 90% 10%, var(--app-gradient-2), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, var(--app-gradient-3), transparent),
    var(--bg-base);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  z-index: 100;
  min-width: 0;
}

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-left { flex: 1 1 auto; min-width: 0; }
.topbar-right { flex: 0 0 auto; justify-content: flex-end; margin-left: auto; }

.logo { display: flex; align-items: center; gap: 10px; }

.conn-pill, .latency-pill, .balance-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  min-height: 28px;
}
.conn-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--sell);
  box-shadow: 0 0 8px var(--sell);
}
.conn-pill.online .conn-dot {
  background: var(--buy);
  box-shadow: 0 0 8px var(--buy);
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--theme-toggle-icon-muted);
  cursor: pointer;
  line-height: 0;
  transition: color 0.15s, background 0.15s;
}

.theme-toggle-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle-btn:hover {
  color: var(--theme-toggle-icon);
}

.theme-toggle-btn.active {
  color: var(--theme-toggle-icon);
  background: var(--theme-toggle-active-bg);
}

.latency-pill.fast { color: var(--buy); border-color: var(--latency-fast-border); }
.latency-pill.mid { color: var(--warn); }
.latency-pill.slow { color: var(--sell); }

.chip-label { color: var(--text-dim); font-size: 10px; text-transform: uppercase; }
.chip-value { color: var(--buy); font-weight: 700; font-size: 14px; }
.balance-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  margin-left: 2px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.balance-refresh-btn:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-hover);
}
.balance-refresh-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.search-wrap {
  display: flex;
  gap: 8px;
  min-width: 0;
}
.search-wrap input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
}
.search-wrap input:focus {
  outline: none; border-color: var(--accent);
}

.search-panel {
  position: relative;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn-search-toggle:hover,
.btn-search-toggle.active {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-panel.open .search-wrap {
  display: flex;
  width: min(380px, calc(100vw - 220px));
  max-width: 420px;
}

@media (max-width: 1280px) {
  .search-panel.open .search-wrap {
    position: fixed;
    width: auto;
    max-width: none;
    height: auto;
  }
}

.search-wrap.hidden {
  display: none;
}

@media (min-width: 1281px) {
  .search-panel {
    height: 36px;
    flex-shrink: 0;
  }

  .search-panel.open .search-wrap {
    position: absolute;
    right: calc(100% + 8px);
    top: 0;
    display: flex;
    align-items: center;
    width: min(380px, calc(100vw - 280px));
    max-width: 420px;
    height: 36px;
    z-index: 110;
  }

  .search-panel.open .search-wrap input {
    height: 36px;
    padding: 0 12px;
    box-sizing: border-box;
  }

  .search-panel.open .search-wrap .btn-ghost,
  .search-panel.open .search-wrap .btn-search-close {
    height: 36px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    box-sizing: border-box;
  }
}

.btn-search-close {
  padding: 8px 10px;
  font-size: 16px;
  line-height: 1;
}

.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text);
  cursor: pointer; font-weight: 600;
}
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 160px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.user-dropdown button {
  display: block; width: 100%; text-align: left;
  padding: 10px 14px; border: none;
  background: transparent; color: var(--text);
  cursor: pointer;
}
.user-dropdown button:hover { background: var(--bg-hover); }

.user-dropdown-identity {
  display: none;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
}

.zoom-control {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
}
.zoom-slider {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 4px;
  margin: 0;
  background: var(--brand-shares);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brand-snipe);
  border: none;
  cursor: pointer;
}
.zoom-slider::-moz-range-track {
  height: 4px;
  background: var(--brand-shares);
  border-radius: 2px;
  border: none;
}
.zoom-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brand-snipe);
  border: none;
  cursor: pointer;
}

/* Workspace */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr) minmax(0, 220px);
  gap: 14px;
  padding: 14px;
  min-height: 0;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-head.compact { padding: 10px 14px; }
.panel-head h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; }
.badge {
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--accent-dim); color: var(--accent);
}

.markets-panel {
  gap: 0;
}

.markets-split {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.cricket-section {
  flex: 4 1 0;
  border-bottom: 1px solid var(--border);
}

.markets-section {
  flex: 6 1 0;
}

.markets-section .event-title {
  flex-shrink: 0;
}

.cricket-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
}

.markets-panel .event-title {
  padding: 10px 16px;
  font-size: 12px; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}

.market-list {
  flex: 1; min-height: 0; overflow-y: auto; padding: 8px;
}
.cricket-list,
.market-list,
.ob-asks-pane,
.ob-bids-pane,
.activity-feed,
.positions-table-wrap,
.trade-panel,
.center-panel,
html,
body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.cricket-list::-webkit-scrollbar,
.market-list::-webkit-scrollbar,
.ob-asks-pane::-webkit-scrollbar,
.ob-bids-pane::-webkit-scrollbar,
.activity-feed::-webkit-scrollbar,
.positions-table-wrap::-webkit-scrollbar,
.trade-panel::-webkit-scrollbar,
.center-panel::-webkit-scrollbar,
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.market-item {
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.market-item:hover { background: var(--bg-hover); border-color: var(--border); }
.market-item.active {
  background: var(--buy-dim);
  border-color: var(--market-active-border);
}
.market-q { font-size: 12px; font-weight: 500; line-height: 1.35; color: var(--text); }
.market-meta { display: flex; justify-content: space-between; margin-top: 4px; font-size: 10px; color: var(--text-dim); font-family: var(--font-mono); }

.cricket-item {
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.cricket-item:hover { background: var(--bg-hover); border-color: var(--border); }
.cricket-item.active {
  background: var(--cricket-active-bg);
  border-color: var(--cricket-active-border);
}
.cricket-title { font-size: 12px; font-weight: 500; line-height: 1.35; color: var(--text); }
.cricket-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.cricket-status { text-transform: capitalize; }
.cricket-status.live { color: var(--cricket-live); }
.cricket-status.upcoming { color: var(--accent); }
.cricket-status.past { color: var(--text-dim); }
.cricket-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}
.cricket-guide {
  padding: 10px 8px;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.55;
  text-align: left;
}
.cricket-guide strong {
  color: var(--text-muted);
  font-weight: 600;
}

.center-panel {
  padding: 0;
  gap: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.market-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.market-header > div:first-child {
  flex: 1;
  min-width: 0;
}
.market-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 2px; }
.market-header h2 {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.market-header-tabs { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.btn-cancel-market {
  padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--cancel-market-border);
  background: var(--cancel-market-bg);
  color: var(--cancel-market-color);
  cursor: pointer; font-weight: 600; font-size: 11px; white-space: nowrap;
}
.btn-cancel-market:hover { background: var(--cancel-market-hover); }
.outcome-tabs { display: flex; gap: 6px; }
.outcome-tab {
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer; font-weight: 600; font-size: 11px;
}
.outcome-tab.active[data-tab="0"] {
  background: var(--outcome-yes-bg);
  color: #ffffff;
  border-color: var(--outcome-yes-bg);
}
.outcome-tab.active[data-tab="1"] {
  background: var(--outcome-no-bg);
  color: #ffffff;
  border-color: var(--outcome-no-bg);
}

.orderbook-panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.ob-head {
  display: grid;
  grid-template-columns: var(--ob-cols);
  align-items: center;
  padding: 6px 8px;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted);
  flex-shrink: 0;
}
.ob-head-left {
  display: flex;
  align-items: center;
  gap: 5px;
  grid-column: 1;
  justify-self: start;
}
.ob-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px;
  border: none;
  background: transparent;
  color: var(--ob-muted);
  cursor: pointer;
  opacity: 0.85;
  border-radius: 3px;
  line-height: 0;
}
.ob-refresh-btn:hover {
  color: var(--ob-muted-hover);
  opacity: 1;
  background: var(--surface-subtle);
}
.ob-outcome-label {
  grid-column: 2;
  justify-self: center;
  text-align: center;
  color: var(--ob-outcome-label);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  padding: 0 4px;
}
.ob-status {
  grid-column: 3;
  justify-self: end;
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-weight: 500;
  text-transform: none;
}
.ob-status.live { color: var(--buy); }

.ob-grid { display: none; }

.ob-scroll-wrap {
  flex: 0 0 auto;
  padding: 0 10px 8px;
  display: flex;
  flex-direction: column;
}

.ob-scroll {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--ob-border);
  border-radius: var(--radius-sm);
  background: var(--ob-bg);
}

.ob-asks-pane,
.ob-bids-pane {
  flex: 0 0 auto;
  height: var(--ob-pane-h);
  max-height: var(--ob-pane-h);
  overflow-x: hidden;
  overflow-y: auto;
  contain: paint;
  background: var(--ob-bg);
  -webkit-overflow-scrolling: touch;
}

.ob-asks-pane {
  display: flex;
  flex-direction: column;
}

.ob-asks-pane > .ob-table {
  margin-top: auto;
  flex-shrink: 0;
}

.ob-bids-pane > .ob-table {
  flex-shrink: 0;
}

.ob-scroll::-webkit-scrollbar { width: 0; height: 0; }

.ob-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--font-ui);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.ob-table col.ob-col-price { width: var(--ob-col-price); }
.ob-table col.ob-col-shares { width: var(--ob-col-shares); }
.ob-table col.ob-col-total { width: var(--ob-col-total); }

.ob-asks-pane .ob-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.ob-bids-pane .ob-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.ob-table th {
  font-size: 9px;
  color: var(--ob-muted);
  font-weight: 600;
  padding: 4px 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--ob-bg);
}

.ob-table th.ob-col-price { text-align: left; }
.ob-table th.ob-col-shares { text-align: center; padding-left: 4px; padding-right: 4px; }
.ob-table th.ob-col-total { text-align: right; }

.ob-table td {
  padding: 3px 8px;
  cursor: pointer;
  line-height: 1.4;
  white-space: nowrap;
}

.ob-table td.ob-col-price { text-align: left; }
.ob-table td.ob-col-shares {
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
  color: var(--ob-cell-text);
  font-weight: 400;
}
.ob-table td.ob-col-total {
  text-align: right;
  color: var(--ob-cell-text);
  font-weight: 400;
}

.ob-table tr.ob-ask-row td.ob-col-price { color: var(--ob-ask-price); font-weight: 500; }
.ob-table tr.ob-bid-row td.ob-col-price { color: var(--ob-bid-price); font-weight: 500; }
.ob-table tr:hover td { background: var(--ob-row-hover); }

.ob-spread-row {
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: var(--ob-cols);
  padding: 4px 8px;
  font-size: 10px;
  color: var(--ob-muted);
  font-family: var(--font-ui);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--ob-spread-bg);
  letter-spacing: 0.02em;
  line-height: 1.3;
}
.ob-spread-inner {
  grid-column: 2;
  text-align: center;
}
.ob-spread-row.spread-tight .ob-spread-inner { color: var(--ob-bid-price); }
.ob-spread-row.spread-mid .ob-spread-inner { color: var(--spread-mid); }
.ob-spread-row.spread-wide .ob-spread-inner { color: var(--ob-ask-price); }

.ob-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}

.positions-panel {
  flex: 0 0 auto;
  min-height: auto;
  display: flex;
  flex-direction: column;
  overflow: visible;
}
.positions-table-wrap {
  flex: 0 0 auto;
  min-height: auto;
  overflow: visible;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
  text-align: left; padding: 8px 14px;
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-panel);
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-family: var(--font-mono); }
.data-table .empty { text-align: center; color: var(--text-dim); font-family: var(--font-ui); }
.pnl-pos { color: var(--buy); }
.pnl-neg { color: var(--sell); }

/* Trade deck — Buy | Snipe | Sell */
.trade-deck {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.trade-deck .trade-section {
  border-right: 1px solid var(--border);
  border-bottom: none;
  min-height: 0;
}

.trade-deck .sell-section { border-right: none; }

/* Snipe slot — fixed width; on/off only disables content */
.snipe-slot {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-height: 0;
  min-width: 0;
}

.snipe-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.snipe-header {
  text-align: center;
  padding: 6px 8px;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.snipe-slot.snipe-on .snipe-header {
  background: var(--snipe-header-on-bg);
  color: var(--warn);
  border-color: var(--snipe-header-on-border);
}

.snipe-power-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 0;
  flex-shrink: 0;
}

.field-row-inline .snipe-power-toggle {
  align-self: center;
}

.snipe-power-track {
  display: block;
  width: 44px;
  height: 22px;
  border-radius: 11px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}

.snipe-power-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: left 0.15s, background 0.15s;
}

.snipe-power-toggle.on .snipe-power-track {
  border-color: var(--snipe-power-on-border);
  background: var(--snipe-power-on-bg);
}

.snipe-power-toggle.on .snipe-power-thumb {
  left: calc(100% - 18px);
  background: var(--snipe-power-on-thumb);
}

.snipe-slot.snipe-off .snipe-section > *:not(#snipe-type-field) {
  pointer-events: none;
  opacity: 0.42;
}

.snipe-slot.snipe-off #snipe-type-control {
  pointer-events: none;
  opacity: 0.42;
}

.snipe-section {
  background: linear-gradient(180deg, var(--snipe-section-bg), transparent);
  border-bottom: none;
  flex: 1;
}

.snipe-slot.snipe-off .snipe-section {
  background: transparent;
}

.stats-panel {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.exec-stats.vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  margin-bottom: 0;
}

.btn-cancel-all {
  margin-bottom: 10px;
  border: 1px solid var(--cancel-all-border);
  background: var(--cancel-all-bg);
  color: var(--sell);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.btn-cancel-all:hover {
  background: var(--cancel-all-hover);
  border-color: var(--sell);
}

.sidebar-activity {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  overflow: hidden;
}

.sidebar-activity .panel-head.compact {
  border-bottom: 1px solid var(--border);
}
.activity-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-clear-activity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border: none;
  background: transparent;
  color: var(--ob-muted);
  cursor: pointer;
  opacity: 0.85;
  border-radius: 3px;
  line-height: 0;
}
.btn-clear-activity:hover {
  color: var(--ob-ask-price);
  opacity: 1;
  background: var(--surface-subtle);
}

.sidebar-activity .activity-feed {
  flex: 1;
  min-height: 0;
}

.snipe-help { display: none; }

.trade-panel {
  padding: 0;
  overflow-y: auto;
  gap: 0;
}

.trade-section {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.section-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.section-collapse-btn {
  padding: 0 4px;
  border: none;
  background: none;
  color: inherit;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
}

.section-collapse-btn:hover { opacity: 1; }

.trade-section.collapsed .section-head { margin-bottom: 0; }
.trade-section.collapsed .trade-section-body { display: none; }

.section-head .hint {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
  font-size: 10px;
}

.buy-head { color: var(--buy); }
.snipe-head { color: var(--warn); }
.sell-head { color: var(--sell); }

.btn-snipe {
  background: linear-gradient(180deg, var(--buy), var(--buy-strong));
  color: var(--btn-buy-text);
  font-weight: 700;
}

.btn-snipe.alt {
  background: linear-gradient(180deg, var(--sell-light), var(--sell));
  color: #fff;
}

.sell-section {
  background: var(--sell-section-bg);
  border-bottom: none;
}

.sell-pos-display {
  margin-bottom: 8px;
}

.sell-pos-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--sell-pos-card-bg);
  border: 1px solid var(--sell-pos-card-border);
  margin-bottom: 8px;
  font-size: 11px;
}

.sell-pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.sell-pos-grid span {
  display: block;
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.sell-pos-grid strong {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--sell-pos-strong);
}

.empty-pos {
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 0 8px;
}

.center-activity { display: none; }

.trade-panel .exec-stats {
  margin: 0;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
}

/* removed old trade-tabs */
.trade-tabs { display: none; }

.field-row { margin-bottom: 8px; }

.field-row-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field-row-duo .duo-field {
  margin-bottom: 0;
}

.snipe-outcome-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

.snipe-outcome-tab {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
}

.snipe-outcome-tab.active {
  background: var(--snipe-outcome-active-bg);
  color: var(--warn);
  border-color: var(--snipe-outcome-active-border);
}

#snipe-price[readonly] {
  cursor: default;
  color: var(--text-muted);
  background: var(--bg-base);
  border-color: var(--border);
  pointer-events: none;
}

.field-row-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-row-inline > label {
  margin-bottom: 0;
  flex-shrink: 0;
}

.field-row-inline .seg-control {
  flex: 1;
  max-width: 160px;
}

.field-hint {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
  font-size: 9px;
}

.field-row label {
  display: block; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim); margin-bottom: 6px;
}
.field-row label .unit { color: var(--text-muted); }
.field-row input {
  width: 100%; padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px; font-weight: 600;
}
.field-row input:focus { outline: none; border-color: var(--accent); }
.field-row input.input-invalid { border-color: var(--sell); }
.field-row input.input-invalid:focus { border-color: var(--sell); }
.field-input-wrap { position: relative; }
.field-error-tip {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  font-size: 10px;
  font-weight: 600;
  color: var(--sell);
  line-height: 1.2;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 3;
}
.field-error-tip.visible {
  opacity: 1;
  visibility: visible;
}
.field-row.disabled { opacity: 0.4; pointer-events: none; }

.seg-control {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.seg {
  padding: 9px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer; font-weight: 600;
}
.seg.active { background: var(--accent-dim); color: var(--accent); border-color: var(--seg-active-border); }

.size-presets {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px;
}
.size-presets button {
  flex: 1; min-width: 52px;
  padding: 7px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px; cursor: pointer;
}
.size-presets button:hover { border-color: var(--accent); color: var(--accent); }
.size-presets button.preset-plus { border-color: var(--preset-plus-border); color: var(--buy); }
.size-presets button.preset-plus:hover { border-color: var(--buy); color: var(--buy); }
.size-presets button.preset-minus { border-color: var(--preset-minus-border); color: var(--sell); }
.size-presets button.preset-minus:hover { border-color: var(--sell); color: var(--sell); }

.trade-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.trade-actions .btn { padding: 14px 10px; font-size: 12px; }

.exec-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}
.exec-stats span { display: block; font-size: 10px; color: var(--text-dim); text-transform: uppercase; }
.exec-stats strong { font-family: var(--font-mono); font-size: 16px; color: var(--buy); }

.activity-panel {
  flex: 1; min-height: 140px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.activity-feed {
  flex: 1; overflow-x: hidden; overflow-y: auto; padding: 8px 12px 12px;
  font-family: var(--font-mono); font-size: 11px;
}
.activity-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  border-left: 3px solid var(--border);
  background: var(--bg-elevated);
  word-break: break-word;
  line-height: 1.4;
}
.activity-item.ok { border-left-color: var(--buy); }
.activity-item.err { border-left-color: var(--sell); }
.activity-item .time { color: var(--text-dim); font-size: 10px; }

.hotkeys-bar {
  display: flex; flex-wrap: wrap; gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  background: var(--hotkeys-bg);
  color: var(--text-dim);
  font-size: 11px;
}
.hotkeys-bar kbd {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  margin-right: 4px;
}

.toast-root {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 1000; pointer-events: none;
  max-width: min(420px, calc(100vw - 40px));
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 12px;
  animation: slideIn 0.2s ease;
  pointer-events: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.ok { border-color: var(--toast-ok-border); }
.toast.err { border-color: var(--toast-err-border); }
.toast.warn { border-color: var(--toast-warn-border); color: var(--warn); }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: var(--surface-overlay); backdrop-filter: blur(4px); }
.modal-card-wide {
  max-width: 480px;
}

.withdraw-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

#withdraw-form select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
}

.modal-card {
  position: relative;
  width: min(480px, calc(100% - 32px));
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent; color: var(--text);
  cursor: pointer; font-size: 20px; line-height: 1;
}

.setup-hint {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 8px;
}

.wallet-setup {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.wallet-info {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.wallet-info.compact { margin-top: 12px; }

.wallet-info code {
  font-family: var(--font-mono);
  font-size: 11px;
  word-break: break-all;
  color: var(--accent);
}

.wallet-status {
  font-size: 12px;
  color: var(--warn);
}

.wallet-status.deployed { color: var(--buy); }

.wallet-actions {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.bridge-addresses {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.bridge-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.bridge-row code {
  font-family: var(--font-mono);
  font-size: 10px;
  word-break: break-all;
  color: var(--text);
}

.onboarding-steps {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.onboarding-step {
  font-size: 11px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.onboarding-step.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.onboarding-step.done {
  border-color: var(--buy);
  color: var(--buy);
}

.onboarding-panel {
  margin-top: 8px;
}

.terminal-setup-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 12px 12px;
  gap: 10px;
}

.terminal-setup-spinner {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 8px;
}

.terminal-setup-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 173, 239, 0.15);
  border-top-color: var(--brand-snap);
  border-right-color: rgba(247, 148, 29, 0.55);
  animation: terminal-setup-spin 1.1s linear infinite;
}

.terminal-setup-core {
  position: absolute;
  inset: 14px;
  width: calc(100% - 28px);
  height: calc(100% - 28px);
  object-fit: contain;
  animation: terminal-setup-pulse 2.4s ease-in-out infinite;
  filter: drop-shadow(0 4px 16px rgba(0, 173, 239, 0.3));
}

.terminal-setup-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.terminal-setup-message {
  margin: 0;
  font-size: 13px;
  color: var(--accent);
  min-height: 1.4em;
  transition: opacity 0.35s ease;
}

.terminal-setup-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 320px;
}

@keyframes terminal-setup-spin {
  to { transform: rotate(360deg); }
}

@keyframes terminal-setup-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.96); opacity: 0.85; }
}

.enable-trading-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}

.enable-trading-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.enable-trading-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.enable-trading-item.done {
  border-color: rgba(34, 197, 94, 0.35);
}

.enable-trading-item.done .et-icon {
  color: var(--buy);
}

.enable-trading-item.pending .et-icon {
  color: var(--text-muted);
}

.et-icon {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.et-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.et-body strong {
  font-size: 13px;
}

.et-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.enable-trading-item.done .et-action {
  opacity: 0.6;
  pointer-events: none;
}

.wallet-chip .chip-value.mono {
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ── Compact: split-screen / narrow window only (full screen unchanged) ── */
@media (min-width: 1281px) {
  .center-panel {
    overflow-x: hidden;
    overflow-y: auto;
  }
}

@media (max-width: 1280px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app {
    height: auto;
    min-height: 100dvh;
    max-height: none;
    overflow: visible;
  }

  .workspace {
    flex: 1 1 auto;
    grid-template-columns: 1fr;
    align-content: start;
  }

  .markets-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 168px;
    max-height: min(28vh, 240px);
    overflow: hidden;
  }

  .markets-panel .markets-split {
    min-height: 0;
    height: 100%;
  }

  .markets-panel .cricket-section {
    border-bottom: none;
    border-right: 1px solid var(--border);
  }

  .markets-panel .event-title {
    padding: 6px 12px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .stats-panel { display: none; }

  .topbar {
    gap: 8px;
    padding: 8px 12px;
    overflow: visible;
  }
  .topbar-left {
    flex-wrap: nowrap;
    overflow: hidden;
  }
  .topbar-right {
    flex-wrap: nowrap;
    gap: 8px;
    overflow: visible;
  }
  .logo-text-topbar {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .balance-chip {
    padding: 5px 10px;
  }
  .balance-chip .chip-label {
    display: none;
  }
  .user-btn #user-name {
    display: none;
  }
  .user-dropdown-identity {
    display: block;
  }
  .chip-value {
    font-size: 12px;
  }

  .search-panel.open .search-wrap {
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(env(safe-area-inset-top, 0px) + 52px);
    width: auto;
    max-width: none;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 10px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: 200;
  }

  .search-panel.open .search-wrap input {
    flex: 1 1 100%;
    min-width: 0;
  }

  .center-panel { overflow: visible; }

  .market-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }

  .market-header > div:first-child {
    min-width: 0;
    width: 100%;
  }

  .market-header h2 {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .market-header-tabs {
    flex-wrap: wrap;
    width: 100%;
    gap: 6px;
  }

  .btn-cancel-market {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
  }

  .outcome-tabs {
    flex: 1 1 auto;
    min-width: 0;
  }

  .outcome-tab {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .toast-root {
    top: calc(env(safe-area-inset-top, 0px) + 56px);
    bottom: auto;
    left: 12px;
    right: 12px;
    max-width: none;
    align-items: stretch;
  }

  .toast {
    width: 100%;
    max-width: 100%;
    text-align: center;
    font-size: 11px;
    padding: 10px 14px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
  }

  .positions-panel {
    flex: 0 0 auto;
  }

  .trade-deck { grid-template-columns: 1fr; }

  .trade-deck .trade-section {
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: auto;
  }

  .snipe-slot {
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: nowrap;
    gap: 6px;
    padding: 8px 10px;
  }
  .topbar-left { gap: 6px; }
  .topbar-right { gap: 6px; }
  .logo-text-topbar { font-size: 15px; }
  .conn-pill { padding: 5px 8px; min-height: 26px; }
  .balance-chip { padding: 4px 8px; gap: 6px; }
  .chip-label { font-size: 9px; }
  .chip-value { font-size: 11px; }
  .user-btn { padding: 6px 10px; font-size: 11px; }
  .btn-search-toggle { width: 32px; height: 32px; }
  .balance-refresh-btn {
    width: 20px;
    height: 20px;
    font-size: 13px;
  }
  .market-header-tabs {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-cancel-market {
    width: 100%;
  }
  .outcome-tabs {
    width: 100%;
  }
  .markets-panel {
    min-height: 150px;
    max-height: min(32vh, 220px);
  }
}

/* PIN entry (6-dot style) */
.pin-section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 20px 0 6px;
  letter-spacing: -0.01em;
}
.pin-entry { margin: 14px 0 18px; text-align: center; cursor: text; }
.pin-entry-label, .pin-entry-sublabel {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.pin-entry-sublabel { margin-top: -6px; margin-bottom: 10px; text-align: left; }
.pin-dots-wrap {
  position: relative;
  max-width: 280px;
  margin: 0 auto;
  height: 52px;
}
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 16px;
  height: 100%;
  align-items: center;
}
.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--pin-dot-border);
  background: transparent;
  transition: border-color 0.18s, background 0.18s, transform 0.18s, box-shadow 0.18s;
}
.pin-dot.filled {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 14px var(--pin-dot-filled-glow);
  transform: scale(1.02);
}
.pin-dot.active {
  border-color: var(--pin-dot-active-border);
  background: var(--pin-dot-active-bg);
  transform: scale(1.12);
  box-shadow: 0 0 0 3px var(--pin-dot-active-ring);
}
.pin-digit-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  background: transparent;
  cursor: text;
}
.pin-entry:focus-within .pin-dot.active { border-color: var(--pin-dot-focus-border); }
#pin-unlock-panel .auth-card-inner { text-align: center; max-width: 360px; margin: 0 auto; }
.pin-unlock-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.pin-unlock-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; line-height: 1.5; }
.pin-unlock-form .pin-unlock-submit { display: none; }
.pin-unlock-form .pin-entry { margin-top: 0; }
.signup-username-locked {
  text-align: center;
  margin: 4px 0 18px;
  font-size: 13px;
  color: var(--text-muted);
}
.signup-username-locked #signup-username-display {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}
.signup-password-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: -6px 0 12px;
  line-height: 1.45;
}
.modal-card-wide-pin { width: min(440px, 100%); }
.auth-card.recover-active { padding: 18px 20px 16px; width: min(400px, 100%); }
.auth-card.recover-active .auth-brand { margin-bottom: 10px; }
.auth-card.recover-active .brand-icon { width: 56px; height: 56px; margin-bottom: 8px; }
.auth-card.recover-active .auth-brand h1 { font-size: 17px; }
.auth-card.recover-active .auth-brand p { display: none; }
.auth-screen.recover-active { padding: 16px 12px; }
#recover-account-panel .auth-step-title { font-size: 15px; margin-bottom: 2px; }
#recover-account-panel .recover-hint { margin: 0 0 8px; font-size: 11.5px; line-height: 1.35; }
#recover-account-panel .auth-form-compact label { margin-bottom: 7px; font-size: 10px; }
#recover-account-panel .auth-form-compact input { margin-top: 3px; padding: 8px 10px; font-size: 12px; }
#recover-account-panel .signup-password-hint { margin: -2px 0 6px; font-size: 10.5px; line-height: 1.3; }
#recover-account-panel .pin-section-title { margin: 8px 0 0; font-size: 12px; font-weight: 600; }
#recover-account-panel .pin-entry-sublabel { margin: 4px 0 4px; font-size: 10.5px; }
#recover-account-panel .pin-entry { margin: 2px 0 6px; }
#recover-account-panel .pin-dots-wrap { height: 40px; max-width: 240px; }
#recover-account-panel .pin-dots { gap: 12px; }
#recover-account-panel .pin-dot { width: 13px; height: 13px; }
#recover-account-panel .btn-block { padding: 9px 12px; margin-top: 2px; font-size: 13px; }
#recover-account-panel .auth-links { margin: 6px 0 0; }
.auth-card.recover-active #auth-error { margin-top: 8px; min-height: 16px; }
.settings-divider { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.settings-section-title { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
.settings-details { margin-bottom: 12px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px 12px; }
.settings-details summary { cursor: pointer; font-weight: 500; padding: 12px 0; list-style: none; }
.settings-details summary::-webkit-details-marker { display: none; }
.settings-form { margin-top: 4px; }
.settings-success { color: var(--buy); font-size: 13px; margin-top: 10px; }
.settings-delete-btn { margin-top: 4px; }
.delete-account-warning {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 14px;
}
#delete-account-modal .modal-card { max-width: 440px; }
#settings-modal .modal-card { max-width: 440px; max-height: 90vh; overflow-y: auto; }
