:root {
  --bg: #070a12;
  --bg-elevated: #0c1220;
  --surface: #111827;
  --border: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Roboto", sans-serif;
  --max: 1760px;
  --header-sticky-offset: 56px;
  --touch-min: 44px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  position: relative;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  font-family: var(--font);
  background: #090d16;
  color: var(--text);
  line-height: 1.5;
}

body {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.wrap {
  max-width: min(96vw, var(--max));
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
}

@media (min-width: 480px) {
  .wrap {
    padding-left: max(24px, env(safe-area-inset-left, 0px));
    padding-right: max(24px, env(safe-area-inset-right, 0px));
  }
}

@media (min-width: 1400px) {
  .wrap {
    padding-left: max(32px, env(safe-area-inset-left, 0px));
    padding-right: max(32px, env(safe-area-inset-right, 0px));
  }
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(7, 10, 18, 0.72);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(12px, env(safe-area-inset-top, 0px)) 0 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  min-width: 0;
}

@media (max-width: 520px) {
  .brand-tagline {
    font-size: 9px;
    max-width: 160px;
  }
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #22c55e);
  box-shadow: var(--shadow);
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-lockup [data-app-name] {
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.brand-tagline {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.25;
  max-width: 260px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.95), rgba(34, 197, 94, 0.85));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.risk-panel {
  border-color: rgba(234, 179, 8, 0.45);
  background: rgba(234, 179, 8, 0.06);
}

.risk-panel ul {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
  font-size: 14px;
}

.app-risk-banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(234, 179, 8, 0.4);
  background: rgba(234, 179, 8, 0.08);
  font-size: 13px;
  color: var(--text);
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.nav a.active {
  color: var(--text);
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Standard Commercial Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
  white-space: nowrap;
  box-sizing: border-box;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-tiny,
.btn-sm {
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 12px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
}

.btn-lg {
  height: 46px !important;
  min-height: 46px !important;
  padding: 0 22px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  border-radius: 10px !important;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-color: rgba(56, 189, 248, 0.4);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  border-color: #38bdf8;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.btn-danger {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.9) 0%, rgba(185, 28, 28, 0.9) 100%);
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #f87171;
}

.btn-success {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  border-color: #22c55e;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
}

.btn-success:hover:not(:disabled) {
  background: #15803d;
  border-color: #4ade80;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Layout */
main.page-main {
  padding: 32px 0 64px;
}

.hero {
  padding: 48px 0 24px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  align-items: center;
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .header-inner {
    flex-wrap: wrap;
    row-gap: 8px;
    align-items: center;
  }

  .header-inner .nav {
    order: 10;
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 6px;
    padding: 10px 0 4px;
    margin: 4px 0 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  .header-inner .nav::-webkit-scrollbar {
    display: none;
    height: 0;
  }

  .header-inner .nav a {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 13px;
    padding: 10px 14px;
    min-height: var(--touch-min);
    align-items: center;
    display: inline-flex;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
    max-width: min(100%, calc(100vw - 148px));
  }

  .header-actions {
    flex: 0 0 auto;
    flex-shrink: 0;
  }

  .header-actions .btn {
    padding-left: 12px;
    padding-right: 12px;
    font-size: 13px;
  }
}

.eyebrow {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.hero h1 {
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.1;
  margin: 0 0 16px;
}

.hero p.lead {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 17px;
  max-width: 52ch;
}

.hero-card {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.95), rgba(12, 18, 32, 0.92));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

@media (max-width: 640px) {
  .stat-row {
    grid-template-columns: 1fr;
  }
}

.stat {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat strong {
  display: block;
  font-size: 18px;
}

.stat span {
  font-size: 12px;
  color: var(--muted);
}

.section {
  padding: 40px 0;
}

.section h2 {
  margin: 0 0 12px;
  font-size: 26px;
}

.section p.sub {
  margin: 0 0 24px;
  color: var(--muted);
  max-width: 70ch;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.feature-card {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.feature-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.price-card {
  padding: 24px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.price-card.featured {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.price-card h3 {
  margin: 0 0 8px;
}

.price {
  font-size: 32px;
  font-weight: 800;
  margin: 12px 0;
}

.price-card ul {
  margin: 0 0 20px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
}

/* App shell */
.app-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding-bottom: 48px;
  width: 100%;
}

.app-workspace-main {
  min-width: 0;
}

.workspace-intro {
  margin: 0 0 18px;
  padding: 20px 24px;
  border-radius: 18px;
  border: 1px solid rgba(59, 130, 246, 0.28);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(34, 197, 94, 0.06));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.workspace-intro-title {
  margin: 0 0 6px;
  font-size: clamp(1.1rem, 4vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.workspace-intro-desc {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  max-width: 960px;
  line-height: 1.5;
}

.workspace-panel-stack {
  position: relative;
}

.workspace-panel-stack > .workspace-panel {
  display: none;
  margin-bottom: 0;
  animation: workspacePanelIn 0.28s ease;
}

.workspace-panel-stack > .workspace-panel.is-active {
  display: block;
}

@keyframes workspacePanelIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  .app-layout {
    gap: 20px;
  }
}

@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
    padding-bottom: max(48px, env(safe-area-inset-bottom, 0px));
  }
}

.signals-table-wrap {
  margin-top: 12px;
  max-height: 520px;
  overflow: auto;
}

.signals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 100%;
}

.signals-table th,
.signals-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.signals-table td {
  font-variant-numeric: tabular-nums;
}

.signals-table th {
  position: sticky;
  top: 0;
  background: #0d1527;
  color: #94a3b8;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  z-index: 2;
  box-shadow: 0 1px 0 var(--border);
  padding: 12px 14px;
}

.signals-table tr:hover td {
  background: rgba(59, 130, 246, 0.08);
}

.signals-table .btn-tiny {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.expiry-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
  white-space: nowrap;
}

.signal-qty-fieldset {
  margin: 0 0 8px;
  padding: 12px 14px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.signal-qty-fieldset:disabled {
  opacity: 0.72;
}

.signal-qty-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

@media (max-width: 640px) {
  .signal-qty-toggle {
    grid-template-columns: 1fr;
  }
}

.signal-qty-option {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}

.signal-qty-option input {
  margin-right: 8px;
  vertical-align: middle;
}

.signals-table input.input-inline {
  width: 100%;
  min-width: 72px;
  max-width: 100px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
}

.signals-table button.row-exec-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ATM watchlist widgets (single compact row per symbol) */
.atm-watchlist-root {
  margin-top: 10px;
}

.atm-watchlist-scroll {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(680px, 75vh);
  overflow: auto;
  padding: 2px;
}

.atm-widget-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, rgba(22, 30, 48, 0.75) 0%, rgba(13, 19, 33, 0.9) 100%);
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: all 0.15s ease;
}

.atm-widget-row:hover {
  border-color: rgba(56, 189, 248, 0.3);
  transform: translateY(-1px);
}

.atm-widget-row--qualified {
  border-color: rgba(34, 197, 94, 0.45);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(15, 23, 42, 0.9) 100%);
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.15);
}

.atm-widget-row--hold {
  border-color: rgba(255, 255, 255, 0.08);
  opacity: 0.92;
}

.atm-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.atm-pill--ok {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.atm-pill--muted {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.atm-pill--danger {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.atm-sym {
  font-size: 11px;
  max-width: min(100%, 220px);
  word-break: break-all;
  color: var(--text);
}

.atm-metric {
  color: var(--muted);
  white-space: nowrap;
}

.atm-metric--reason {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atm-widget-row .atm-qty {
  width: 72px;
  min-height: var(--touch-min);
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.atm-widget-row .atm-exec:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.side-nav {
  position: sticky;
  top: 72px;
  padding: 18px 14px;
  border-radius: 18px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(12, 18, 32, 0.95));
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.side-nav-eyebrow {
  margin: 0 8px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.85;
}

.side-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.side-nav-item .step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.side-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.side-nav-item.active {
  background: rgba(59, 130, 246, 0.18);
  color: var(--text);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.12);
}

.side-nav-item.active .step-num {
  background: rgba(59, 130, 246, 0.35);
  color: var(--text);
}

.side-nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 4px;
}

.side-nav a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.side-nav a.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--text);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

@media (max-width: 900px) {
  .side-nav {
    position: sticky;
    /* Below sticky header (brand + actions + scrolling nav row) */
    top: calc(env(safe-area-inset-top, 0px) + 112px);
    z-index: 40;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding: 12px max(12px, env(safe-area-inset-right, 0px)) 12px max(12px, env(safe-area-inset-left, 0px));
    margin-left: max(0px, calc(-1 * env(safe-area-inset-left, 0px)));
    margin-right: max(0px, calc(-1 * env(safe-area-inset-right, 0px)));
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    overscroll-behavior-x: contain;
  }

  .side-nav-eyebrow {
    display: none;
  }

  .side-nav-list {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    min-width: min-content;
  }

  .side-nav-item {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 10px 16px;
    min-height: var(--touch-min);
    border-radius: 999px;
    font-size: 12px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .side-nav-item .step-num {
    display: none;
  }
}

.panel {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.workspace-panel-stack .panel {
  margin-bottom: 0;
}

.panel-accent {
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.08);
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

.panel-danger {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
}

.hidden {
  display: none !important;
}

/* Inline status (subscription / broker) */
.status-line {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid var(--border);
}

.status-line--muted {
  background: var(--bg-elevated);
  color: var(--muted);
}

.status-line--ok {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}

.status-line--warn {
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(234, 179, 8, 0.4);
  color: #fde047;
}

.status-line--bad {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fecaca;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tabs button {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.auth-tabs button.active {
  color: var(--text);
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.12);
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  margin-bottom: 16px;
}

@media (max-width: 540px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.top-gap {
  margin-top: 12px;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  padding: 8px 12px;
  height: 40px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  box-sizing: border-box;
  font-family: inherit;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  border-color: #38bdf8;
  outline: none;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

/* ==========================================================================
   FIGMA FINTECH DESIGN SYSTEM: CHECKBOXES, RADIOS & TOGGLES
   ========================================================================== */

/* 1. Ultra-Clean Vector Checkbox (Figma Squircle + SVG Vector Checkmark) */
input[type="checkbox"]:not(.sr-only) {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  max-width: 20px !important;
  min-height: 20px !important;
  max-height: 20px !important;
  border: 1.5px solid rgba(255, 255, 255, 0.22) !important;
  border-radius: 6px !important;
  background-color: rgba(15, 23, 42, 0.85) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  cursor: pointer !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  vertical-align: middle !important;
  display: inline-block !important;
  position: relative !important;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4) !important;
}

input[type="checkbox"]:not(.sr-only):hover {
  border-color: rgba(56, 189, 248, 0.6) !important;
  background-color: rgba(22, 32, 56, 0.95) !important;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.2), inset 0 1px 2px rgba(0, 0, 0, 0.4) !important;
}

input[type="checkbox"]:not(.sr-only):focus-visible {
  outline: none !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25), inset 0 1px 2px rgba(0, 0, 0, 0.4) !important;
}

input[type="checkbox"]:not(.sr-only):active {
  transform: scale(0.92) !important;
}

/* Checked State: Precision Vector SVG Checkmark */
input[type="checkbox"]:not(.sr-only):checked {
  background-color: #0284c7 !important;
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='none' stroke='%23ffffff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3e%3cpolyline points='13 4.5 6.5 11.5 3 8'/%3e%3c/svg%3e"), linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  background-size: 78% 78%, cover !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}

/* Green Variant Checkbox (Alerts and Fills) */
input[type="checkbox"].checkbox-success:checked {
  background-color: #16a34a !important;
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='none' stroke='%23ffffff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3e%3cpolyline points='13 4.5 6.5 11.5 3 8'/%3e%3c/svg%3e"), linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
  border-color: #4ade80 !important;
  box-shadow: 0 2px 10px rgba(34, 197, 94, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}

/* 2. Modern Radios */
input[type="radio"]:not(.sr-only) {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 20px !important;
  height: 20px !important;
  border: 1.5px solid rgba(255, 255, 255, 0.22) !important;
  border-radius: 50% !important;
  background-color: rgba(15, 23, 42, 0.85) !important;
  cursor: pointer !important;
  display: inline-grid !important;
  place-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  vertical-align: middle !important;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

input[type="radio"]:not(.sr-only):hover {
  border-color: rgba(56, 189, 248, 0.6) !important;
}

input[type="radio"]:not(.sr-only):checked {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.35) !important;
}

input[type="radio"]:not(.sr-only):checked::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.6);
}

/* 3. Figma Interactive Checkbox Tile / Card (Touch-Friendly Frame) */
.checkbox-tile,
.checkbox-card {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 10px 14px !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.07) !important;
  cursor: pointer !important;
  user-select: none !important;
  transition: all 0.15s ease !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

.checkbox-tile:hover,
.checkbox-card:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

.checkbox-tile:active,
.checkbox-card:active {
  transform: scale(0.99) !important;
}

.checkbox-card-title {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #f1f5f9 !important;
}

.checkbox-card-desc {
  font-size: 11px !important;
  color: var(--text-muted) !important;
  margin-top: 2px !important;
}

/* 4. Modern Figma Fintech Toggle Switch */
.toggle-switch {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  cursor: pointer !important;
  user-select: none !important;
  margin: 0 !important;
  padding: 4px 12px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.09) !important;
  border-radius: 24px !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  height: 38px !important;
  box-sizing: border-box !important;
}

.toggle-switch:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

.toggle-switch:active {
  transform: scale(0.97) !important;
}

.toggle-switch input[type="checkbox"] {
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  min-width: 0 !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

.toggle-track {
  width: 42px !important;
  height: 22px !important;
  background: rgba(255, 255, 255, 0.16) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 20px !important;
  position: relative !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  flex-shrink: 0 !important;
  display: block !important;
}

.toggle-thumb {
  position: absolute !important;
  top: 2px !important;
  left: 2px !important;
  width: 16px !important;
  height: 16px !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
}

.toggle-switch input:checked + .toggle-track {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
  border-color: rgba(74, 222, 128, 0.4) !important;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.35) !important;
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(20px) !important;
}

.toggle-label {
  font-size: 12.5px !important;
  font-weight: 600 !important;
  color: #f1f5f9 !important;
  white-space: nowrap !important;
}

/* Risk Pill Indicator */
.risk-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 0 14px;
  height: 40px;
  box-sizing: border-box;
  font-size: 12.5px;
  color: var(--text-muted);
}
.risk-pill strong {
  color: #f1f5f9;
}

/* Commercial Filter Card & Grid for Strategy Signals */
.signals-filter-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 14px 0 12px;
}

.signals-filter-grid {
  display: grid;
  grid-template-columns: 140px repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  align-items: flex-start;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-group input,
.filter-group select {
  width: 100%;
  height: 38px;
  min-height: 38px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  box-sizing: border-box;
}

.filter-group input:focus,
.filter-group select:focus {
  border-color: #38bdf8;
  outline: none;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.filter-hint {
  font-size: 10.5px;
  color: #64748b;
  margin-top: 2px;
  white-space: nowrap;
}

.signals-action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  margin-bottom: 14px;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #020617;
  border-radius: 10px;
  padding: 12px;
  min-height: 120px;
  border: 1px solid var(--border);
  font-size: 12px;
}

.helper {
  color: var(--muted);
  margin-top: 10px;
  font-size: 13px;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  color: var(--muted);
  font-size: 13px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.footer a {
  color: var(--muted);
}

.footer a:hover {
  color: var(--text);
}

/* Table */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

th {
  background: #0f172a;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: none;
}

/* Toast Notifications (Top Center for maximum visibility above mobile navigation) */
#toast-root {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 16px));
  left: 50%;
  transform: translateX(-50%);
  right: auto;
  bottom: auto;
  width: calc(100% - 28px);
  max-width: 440px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

#toast-root .toast {
  pointer-events: auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: #0f172a;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(-12px) scale(0.96);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  word-break: break-word;
}

.toast-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-error {
  background: #1e1115;
  border-color: rgba(239, 68, 68, 0.65);
  color: #fecaca;
  box-shadow: 0 8px 30px rgba(239, 68, 68, 0.3), 0 0 0 1px rgba(239, 68, 68, 0.4) !important;
}

.toast-success, .toast-ok {
  background: #091a13;
  border-color: rgba(34, 197, 94, 0.65);
  color: #bbf7d0;
  box-shadow: 0 8px 30px rgba(34, 197, 94, 0.3), 0 0 0 1px rgba(34, 197, 94, 0.4) !important;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Trade dashboard */
.dashboard-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin: 12px 0 20px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
}

.dashboard-summary .pnl-pos {
  color: var(--success);
  font-weight: 600;
}

.dashboard-summary .pnl-neg {
  color: var(--danger);
  font-weight: 600;
}

.trades-table-wrap {
  margin-top: 12px;
  margin-bottom: 28px;
}

.trades-table-wrap h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.pnl-cell-pos {
  color: var(--success);
  font-weight: 600;
}

.pnl-cell-neg {
  color: var(--danger);
  font-weight: 600;
}

/* —— Mobile & tablet polish —— */
@media (max-width: 640px) {
  main.page-main {
    padding: 20px 0 max(40px, env(safe-area-inset-bottom, 0px));
  }

  .hero {
    padding: 28px 0 16px;
  }

  .section {
    padding: 28px 0;
  }

  .panel {
    padding: 16px;
    border-radius: 14px;
  }

  .workspace-intro {
    padding: 16px;
    border-radius: 14px;
  }

  .app-risk-banner {
    font-size: 12px;
    padding: 10px 12px;
  }

  .dashboard-summary {
    flex-direction: column;
    gap: 10px;
    font-size: 13px;
  }

  .signals-table {
    font-size: 12px;
  }

  .signals-table th,
  .signals-table td {
    padding: 8px 6px;
  }

  .signals-table-wrap {
    max-height: min(55vh, 380px);
  }

  .signals-table {
    min-width: unset;
    width: 100%;
  }

  .auth-tabs button {
    min-height: var(--touch-min);
    touch-action: manipulation;
  }

  .footer {
    padding: 24px 0 max(24px, env(safe-area-inset-bottom, 0px));
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .panel {
    padding: 18px;
  }

  .signals-table-wrap {
    max-height: 400px;
  }
}

.side-nav-item {
  -webkit-tap-highlight-color: transparent;
}

.signals-table .btn-tiny,
table .btn-tiny {
  min-height: 36px;
  touch-action: manipulation;
}

@media (pointer: coarse) {
  .btn-tiny {
    min-height: 40px;
    padding: 6px 12px;
  }
}

/* Real-Time Live Market Indices Ticker Bar */
.market-ticker-bar {
  background: rgba(15, 23, 42, 0.94);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  padding: 8px 0;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ticker-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ticker-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

.ticker-price {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  transition: color 0.3s ease;
}

.ticker-chg {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ticker-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
}

.ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.ws-live {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.ws-reconnecting {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}

.ws-subtext {
  font-size: 11px;
  opacity: 0.75;
}

.text-success {
  color: #4ade80 !important;
}

.text-danger {
  color: #f87171 !important;
}

@keyframes tickUpFlash {
  0% { color: #4ade80; text-shadow: 0 0 10px rgba(74, 222, 128, 0.8); }
  100% { color: #fff; text-shadow: none; }
}

@keyframes tickDownFlash {
  0% { color: #f87171; text-shadow: 0 0 10px rgba(248, 113, 113, 0.8); }
  100% { color: #fff; text-shadow: none; }
}

.tick-up {
  animation: tickUpFlash 0.9s ease-out;
}

.tick-down {
  animation: tickDownFlash 0.9s ease-out;
}

/* ========================================================
   PRO MOBILE TRADING APP UI (ZERODHA / TRADINGVIEW AESTHETIC)
   ======================================================== */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 900px) {
  /* 1. STRICT VIEWPORT BOUNDING: Completely eliminate left-right page movement */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
    position: relative !important;
    touch-action: pan-y !important;
    overscroll-behavior-x: none !important;
  }

  .wrap,
  .page-main,
  .app-workspace-main,
  .site-header,
  .market-ticker-bar {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .grid,
  .card-grid,
  .stat-row,
  .actions {
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* 2. Eliminate bulky desktop side navigation & banners */
  .side-nav {
    display: none !important;
  }
  .workspace-intro {
    display: none !important;
  }
  .app-risk-banner {
    padding: 10px 14px !important;
    font-size: 11px !important;
    line-height: 1.4 !important;
    margin-bottom: 14px !important;
    border-radius: 10px !important;
    background: rgba(245, 158, 11, 0.08) !important;
    border: 1px solid rgba(245, 158, 11, 0.25) !important;
  }

  /* 3. Compact Pro Mobile Header */
  .site-header {
    padding: 8px 14px !important;
    background: rgba(9, 13, 22, 0.98) !important;
    backdrop-filter: blur(16px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  }
  .site-header .nav {
    display: none !important;
  }
  .site-header .brand-logo {
    width: 28px !important;
    height: 28px !important;
  }
  .site-header .brand-lockup {
    font-size: 15px !important;
    font-weight: 700 !important;
  }
  .site-header .brand-tagline {
    display: none !important;
  }
  .site-header .header-actions .btn {
    padding: 6px 12px !important;
    font-size: 12px !important;
    min-height: 34px !important;
  }
  .site-header .header-logout-btn {
    display: none !important;
  }

  /* 4. Streamlined Live Ticker Bar (Two-Row Stacked Box to Prevent Any Overflow) */
  .market-ticker-bar {
    padding: 6px 12px !important;
    background: rgba(10, 14, 23, 0.98) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .ticker-inner {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .ticker-item {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    padding: 5px 8px !important;
    gap: 2px !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .ticker-header-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    min-width: 0 !important;
    gap: 4px !important;
  }
  .ticker-badge {
    font-size: 9.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em !important;
    padding: 1px 5px !important;
    border-radius: 4px !important;
    text-transform: uppercase !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.8) !important;
  }
  .ticker-price {
    font-size: 13px !important;
    font-weight: 700 !important;
    font-variant-numeric: tabular-nums !important;
    color: #fff !important;
    white-space: nowrap !important;
    text-align: right !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .ticker-chg {
    font-size: 10.5px !important;
    font-weight: 600 !important;
    font-variant-numeric: tabular-nums !important;
    white-space: nowrap !important;
    text-align: right !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin-top: 1px !important;
  }
  .ticker-status {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
    padding-left: 2px !important;
    margin-left: 0 !important;
  }
  .ticker-status .ws-subtext,
  .ticker-status .ws-text {
    display: none !important;
  }

  /* 5. App Layout & Content Spacing: Keep content clear of elevated bottom bar */
  .app-layout {
    grid-template-columns: 1fr !important;
    padding-top: 10px !important;
    padding-bottom: calc(125px + max(env(safe-area-inset-bottom, 0px), 32px)) !important;
    gap: 14px !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  .app-workspace-main {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  /* 6. De-Congested, Aesthetic Cards */
  .panel {
    border-radius: 16px !important;
    padding: 16px 14px !important;
    background: linear-gradient(180deg, rgba(20, 27, 44, 0.94) 0%, rgba(13, 18, 30, 0.98) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45) !important;
    margin-bottom: 16px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  .panel h2 {
    font-size: 17px !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em !important;
    margin: 0 0 10px 0 !important;
    color: #fff !important;
  }

  /* Strategy Filter Card on Mobile */
  .signals-filter-card {
    padding: 12px !important;
    margin: 10px 0 !important;
    border-radius: 10px !important;
  }
  .signals-filter-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  .signals-filter-grid .filter-group:first-child {
    grid-column: 1 / -1 !important;
  }
  .signals-action-bar {
    gap: 10px !important;
    margin: 10px 0 12px !important;
  }
  .signals-action-bar #getSignalBtn {
    width: 100% !important;
    height: 42px !important;
  }

  /* 7. Responsive Tables with Smooth Touch Scroll and Zero Page Shift */
  .signals-table-wrap,
  .table-wrap,
  .trades-table-wrap {
    border-radius: 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    background: rgba(10, 14, 22, 0.6) !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 10px 0 !important;
  }
  .signals-table,
  table {
    min-width: 100% !important;
    width: auto !important;
    border-collapse: collapse !important;
  }
  .signals-table th,
  .signals-table td,
  table th,
  table td {
    padding: 10px 8px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }
  .signals-table th,
  table th {
    font-size: 10.5px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: rgba(255, 255, 255, 0.6) !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  /* 8. Touch-Target Buttons */
  .btn {
    height: 40px !important;
    min-height: 40px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 16px !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    box-sizing: border-box !important;
  }
  .btn:active {
    transform: scale(0.97) !important;
  }
  .btn-tiny,
  .btn-sm {
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 10px !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
  }
  .signals-table .atm-exec {
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 10px !important;
    font-size: 11px !important;
  }

  /* 9. Comfortable, Touch-Friendly Inputs */
  input:not([type="checkbox"]):not([type="radio"]):not(.atm-qty):not(.input-inline),
  select,
  textarea {
    font-size: 14px !important;
    height: 40px !important;
    min-height: 40px !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    background: rgba(9, 13, 20, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  input:focus, select:focus, textarea:focus {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2) !important;
    outline: none !important;
  }

  /* Table inputs stay inline & compact */
  .signals-table input.atm-qty,
  .signals-table input.input-inline {
    width: 68px !important;
    min-width: 68px !important;
    max-width: 76px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 2px 4px !important;
    font-size: 12px !important;
    text-align: center !important;
    border-radius: 6px !important;
  }

  /* Compact numbers */
  input[type="number"].inline-compact {
    width: 65px !important;
    min-width: 65px !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 2px 6px !important;
  }

  /* Hide header logout on mobile to keep kill switch uncrowded */
  #headerLogoutBtn {
    display: none !important;
  }

  /* 10. Native Mobile Bottom Navigation Bar (Elevated Safely Above Android System Nav) */
  .mobile-bottom-nav {
    display: flex !important;
    align-items: stretch !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 54px !important;
    /* Physical elevation: 32px safe buffer guarantees buttons sit far above Android's Home/Back/Gesture area */
    padding-top: 6px !important;
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 32px) !important;
    box-sizing: content-box !important;
    background: rgba(10, 14, 23, 0.98) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    z-index: 99999 !important;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.7) !important;
  }

  .mobile-nav-btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    background: transparent !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.45) !important;
    font-size: 10.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    padding: 4px 2px !important;
    transition: color 0.15s ease, transform 0.15s ease !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  .mobile-nav-btn.hidden {
    display: none !important;
  }

  .mobile-nav-btn span {
    font-size: 10.5px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
  }

  .mobile-nav-btn .nav-svg {
    width: 22px !important;
    height: 22px !important;
    stroke: currentColor !important;
    transition: transform 0.15s ease, stroke 0.15s ease !important;
  }

  .mobile-nav-btn:active {
    transform: scale(0.92) !important;
  }

  .mobile-nav-btn.active {
    color: #38bdf8 !important;
  }

  .mobile-nav-btn.active .nav-svg {
    stroke: #38bdf8 !important;
    transform: translateY(-2px) !important;
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.6)) !important;
  }

  /* 11. Executive Account Profile & Mode Cards Styling */
  .account-profile-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.9) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 14px !important;
    padding: 14px !important;
    margin-bottom: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
  }
  .account-profile-top {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
  }
  .account-avatar {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #0284c7 0%, #6366f1 100%) !important;
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.4) !important;
    flex-shrink: 0 !important;
  }
  .account-user-meta {
    flex: 1 !important;
    min-width: 0 !important;
  }
  .account-user-name {
    font-size: 14.5px !important;
    font-weight: 700 !important;
    color: #fff !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .account-user-email {
    font-size: 11.5px !important;
    color: var(--text-muted) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin-top: 1px !important;
  }
  .account-user-badges {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin-top: 5px !important;
    flex-wrap: wrap !important;
  }
  .acc-badge {
    font-size: 9.5px !important;
    font-weight: 700 !important;
    padding: 2px 6px !important;
    border-radius: 8px !important;
    letter-spacing: 0.03em !important;
    text-transform: uppercase !important;
  }
  .acc-badge-admin {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
  }
  .acc-badge-plan {
    background: rgba(56, 189, 248, 0.15) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
  }
  .acc-badge-status {
    background: rgba(34, 197, 94, 0.15) !important;
    color: #4ade80 !important;
    border: 1px solid rgba(34, 197, 94, 0.35) !important;
  }
  .account-logout-btn {
    flex-shrink: 0 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #f87171 !important;
  }

  .account-mode-card {
    background: rgba(22, 30, 48, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px !important;
    padding: 14px !important;
    margin-top: 12px !important;
  }
  .mode-segmented-control {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    background: rgba(0, 0, 0, 0.35) !important;
    padding: 4px !important;
    border-radius: 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
  }
  .mode-segment-option {
    position: relative !important;
    cursor: pointer !important;
    margin: 0 !important;
  }
  .mode-segment-option input[type="radio"] {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
  }
  .mode-segment-option .segment-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 6px !important;
    border-radius: 9px !important;
    background: transparent !important;
    transition: all 0.2s ease !important;
    text-align: center !important;
  }
  .mode-segment-option input[type="radio"]:checked + .segment-content {
    background: rgba(56, 189, 248, 0.16) !important;
    border: 1px solid rgba(56, 189, 248, 0.45) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
  }
  .segment-title {
    font-size: 12.5px !important;
    font-weight: 700 !important;
    color: #fff !important;
  }
  .segment-sub {
    font-size: 10px !important;
    color: var(--text-muted) !important;
    margin-top: 2px !important;
  }
  .mode-segment-option input[type="radio"]:checked + .segment-content .segment-title {
    color: #38bdf8 !important;
  }

  /* 12. Accordions Group */
  .account-accordions-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    margin-top: 14px !important;
  }
  .account-accordion {
    background: rgba(16, 23, 38, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    transition: border-color 0.2s ease !important;
  }
  .account-accordion[open] {
    border-color: rgba(56, 189, 248, 0.35) !important;
  }
  .account-accordion-summary {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 14px !important;
    cursor: pointer !important;
    user-select: none !important;
    list-style: none !important;
  }
  .account-accordion-summary::-webkit-details-marker {
    display: none !important;
  }
  .acc-summary-left {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    min-width: 0 !important;
  }
  .acc-summary-icon {
    font-size: 18px !important;
    flex-shrink: 0 !important;
  }
  .acc-summary-title {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #fff !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .acc-summary-desc {
    font-size: 10.5px !important;
    color: var(--text-muted) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin-top: 1px !important;
  }
  .acc-summary-chevron {
    font-size: 13px !important;
    color: var(--text-muted) !important;
    transition: transform 0.2s ease !important;
    flex-shrink: 0 !important;
    margin-left: 8px !important;
  }
  .account-accordion[open] .acc-summary-chevron {
    transform: rotate(180deg) !important;
    color: #38bdf8 !important;
  }
  .account-accordion-body {
    padding: 14px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    background: rgba(9, 13, 22, 0.6) !important;
  }

  /* Hide footer on mobile inside app */
  footer.footer {
    display: none !important;
  }

  /* Wrap pre tags and code so they never force horizontal stretch */
  pre, code {
    white-space: pre-wrap !important;
    word-break: break-all !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
}
