/* ==========================================================================
   AEGIS Protocol — Pro-Trader Risk & Liquidation Terminal Styles
   Brand Kit Compliance: 100% tokenized via brand/kit/tokens.css
   Typography: Marcellus (--display) & Inter (--text)
   Surfaces: 16px flat radius, 1px --rule borders, --raised fill
   ========================================================================== */

@import url("../brand/kit/tokens.css");
@import url("/brand/kit/tokens.css");

:root {
  --bg-base: linear-gradient(135deg, #FFF6EC 0%, #D6F5EC 45%, #DCCBFF 100%);
  --ground: #F7F1FA;
  --raised: #FFFFFF;
  --ink: #161230;
  --ink-2: #5C5778;
  --rule: rgba(22, 18, 48, 0.13);
  --accent: #07705F;
  --on-accent: #FFFFFF;
  --hedge: #A34A08;
  --danger: #B8254F;
  --violet: #6930EA;
  --display: "Marcellus", Georgia, serif;
  --text: "Inter", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-base: linear-gradient(135deg, #2B2A33 0%, #1C2238 45%, #0F2C2C 100%);
    --ground: #1C2238;
    --raised: #22403F;
    --ink: #E8ECF8;
    --ink-2: #A7AFCB;
    --rule: rgba(220, 230, 255, 0.12);
    --accent: #5FD9BE;
    --on-accent: #04110E;
    --hedge: #FFBE7A;
    --danger: #FF8A9A;
    --violet: #C9A6FF;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg-base: linear-gradient(135deg, #2B2A33 0%, #1C2238 45%, #0F2C2C 100%);
  --ground: #1C2238;
  --raised: #22403F;
  --ink: #E8ECF8;
  --ink-2: #A7AFCB;
  --rule: rgba(220, 230, 255, 0.12);
  --accent: #5FD9BE;
  --on-accent: #04110E;
  --hedge: #FFBE7A;
  --danger: #FF8A9A;
  --violet: #C9A6FF;
  color-scheme: dark;
}

/* Reset & Baseline */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  background: var(--bg-base);
  background-attachment: fixed;
  transition: background 500ms ease;
  scroll-behavior: smooth;
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

body {
  background: var(--bg-base) fixed;
  background-color: var(--ground);
  color: var(--ink);
  font-family: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  transition: color 500ms ease, background 500ms ease;
}

/* Typography & Numerics */
h1, h2, h3, .display-font {
  font-family: var(--display);
  font-weight: 400;
  text-wrap: balance;
  letter-spacing: -0.01em;
}

.font-mono, .metric-value, .stat-val, .clob-row, .terminal-body {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Semantic Token Text Colors */
.text-accent { color: var(--accent); }
.text-hedge { color: var(--hedge); }
.text-danger { color: var(--danger); }
.text-violet { color: var(--violet); }
.text-muted { color: var(--ink-2); }

/* Header Navigation Bar */
.app-header {
  height: 52px;
  background: color-mix(in srgb, var(--raised) 85%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--rule);
  padding: 0 clamp(10px, 2vw, 20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: nowrap;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-shrink: 0;
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  min-width: 0;
  position: relative;
  z-index: 20;
}

.view-mode-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.mode-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 150ms ease;
}

.mode-pill-btn:hover {
  color: var(--ink);
}

.mode-pill-btn.active {
  background: var(--raised);
  color: var(--ink);
  border-color: var(--rule);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

.mode-pill-svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  stroke: currentColor;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
}

.brand-logo-svg {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.1em;
}

.header-separator {
  width: 1px;
  height: 20px;
  background: var(--rule);
}

.network-badge, .latency-badge, .session-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--ground);
  font-size: 11px;
  color: var(--ink-2);
  white-space: nowrap;
}

.network-badge strong, .latency-badge strong, .session-badge strong {
  color: var(--ink);
  font-weight: 600;
}

.pulse-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--ground);
  color: var(--ink);
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.btn-theme-toggle:hover {
  background: var(--raised);
  border-color: var(--ink-2);
}

.wallet-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 150ms ease, transform 150ms ease;
}

.wallet-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.wallet-btn.connected {
  background: var(--ground);
  border-color: var(--rule);
  color: var(--ink);
}

.wallet-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* App Container */
.app-container {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px clamp(10px, 2vw, 22px) 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Card Surfaces (Compact & Sleek) */
.card {
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 12px 16px;
  min-width: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
  min-width: 0;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 18px;
  color: var(--ink);
}

.header-extra {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-2);
}

/* Progressive Horizontal Metrics Ticker (Seamless Infinite Loop matching Landing Page Marquee) */
.hero-metrics-ticker {
  position: relative;
  width: 100%;
  overflow: hidden;
  margin-bottom: 2px;
}

.hero-metrics-viewport {
  overflow: hidden;
  width: 100%;
  mask-image: linear-gradient(90deg, transparent 0%, #000 2%, #000 98%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 2%, #000 98%, transparent 100%);
  padding: 4px 0 6px;
}

.hero-metrics-track {
  --metric-gap: 12px;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: var(--metric-gap);
  width: max-content;
  will-change: transform;
  animation: metricsTicker 38s linear infinite;
  padding-right: var(--metric-gap);
}

.hero-metrics-viewport:hover .hero-metrics-track {
  animation-play-state: paused;
}

@keyframes metricsTicker {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

/* Reduced, Sleek, Compact Metric Cards */
.metric-card {
  width: 175px;
  min-width: 175px;
  flex: 0 0 175px;
  background: color-mix(in srgb, var(--raised) 78%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--rule);
  border-radius: 11px;
  padding: 8px 11px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.metric-label {
  font-size: 9.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 2px;
  display: flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.metric-unit {
  font-size: 9.5px;
  font-weight: 500;
  color: var(--ink-2);
}

.metric-sub {
  font-size: 9.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule);
}

.pill-accent { background: var(--ground); color: var(--accent); border-color: var(--accent); }
.pill-hedge { background: var(--ground); color: var(--hedge); border-color: var(--hedge); }
.pill-danger { background: var(--ground); color: var(--danger); border-color: var(--danger); }
.pill-muted { background: var(--ground); color: var(--ink-2); border-color: var(--rule); }
.pill-violet { background: var(--ground); color: var(--violet); border-color: var(--violet); }

/* Simulation Bar */
.simulation-bar {
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 8px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sim-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.sim-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  margin-right: 2px;
}

.sim-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--rule);
  background: var(--ground);
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
}

.sim-btn:hover {
  background: var(--raised);
  border-color: var(--ink-2);
}

.sim-btn.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
}
.sim-btn.btn-danger:hover {
  background: var(--danger);
  color: var(--on-accent);
}

.sim-btn.btn-hedge {
  color: var(--hedge);
  border-color: var(--hedge);
}
.sim-btn.btn-hedge:hover {
  background: var(--hedge);
  color: var(--on-accent);
}

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

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--rule);
  border-radius: 999px;
  transition: 200ms ease;
}

.slider::before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--raised);
  border-radius: 50%;
  transition: 200ms ease;
}

.toggle-switch input:checked + .slider {
  background-color: var(--accent);
}

.toggle-switch input:checked + .slider::before {
  transform: translateX(16px);
}

.toggle-label {
  font-size: 12px;
  color: var(--ink-2);
}

/* Core Workspace 12-Column Grid */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1.2fr);
  gap: 16px;
}

.workspace-main, .workspace-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* Position Stats Grid (Compact) */
.position-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.stat-box {
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 8px 11px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-name {
  font-size: 10.5px;
  color: var(--ink-2);
}

.stat-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.stat-sub {
  font-size: 10px;
  color: var(--ink-2);
}

/* Dynamic SVG Health Factor Gauge */
.health-gauge-section {
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gauge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  flex-wrap: wrap;
  gap: 6px;
}

.gauge-svg-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
}

.gauge-svg {
  width: 100%;
  max-width: 210px;
  height: auto;
  overflow: visible;
}

/* Linear Gauge Buffer Bar */
.gauge-track {
  height: 8px;
  background: var(--rule);
  border-radius: 999px;
  position: relative;
  display: flex;
  overflow: visible;
  margin-top: 10px;
}

.gauge-zone {
  height: 100%;
}

.zone-danger { background: var(--danger); border-radius: 999px 0 0 999px; }
.zone-warning { background: var(--hedge); }
.zone-safe { background: var(--accent); border-radius: 0 999px 999px 0; }

.gauge-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: left 300ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.marker-pin {
  width: 14px;
  height: 14px;
  background: var(--ink);
  border: 2px solid var(--raised);
  border-radius: 50%;
}

.marker-label {
  position: absolute;
  top: 18px;
  background: var(--ink);
  color: var(--raised);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-2);
  margin-top: 24px;
}

/* Active Hedge Box */
.active-hedge-box {
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 10px 14px;
}

.hedge-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.hedge-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
}

.hedge-status-badge .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.active-hedge-box.hedged .status-dot {
  background: var(--hedge);
}

.hedge-meta {
  font-size: 12px;
  color: var(--ink-2);
}

.hedge-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
  gap: 12px;
}

.hedge-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hedge-item .lbl {
  font-size: 11px;
  color: var(--ink-2);
}

.hedge-item .val {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

/* TradingView Pro Execution Chart */
.tv-chart-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 0;
}

.tv-header-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.tv-symbol-selector {
  display: flex;
  align-items: center;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.tv-symbol-btn {
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 4px 10px;
  font-family: var(--text);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tv-symbol-btn:hover {
  color: var(--ink);
}

.tv-symbol-btn.active {
  background: var(--raised);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tv-header-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.tv-intervals {
  display: flex;
  align-items: center;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.tv-interval-btn {
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 3px 8px;
  font-family: var(--text);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tv-interval-btn:hover {
  color: var(--ink);
}

.tv-interval-btn.active {
  background: var(--raised);
  color: var(--ink);
  font-weight: 700;
}

.tv-sentinel-legend {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-pill {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid var(--rule);
}

.legend-pill.pill-danger {
  background: rgba(184, 37, 79, 0.1);
  color: var(--danger);
  border-color: rgba(184, 37, 79, 0.3);
}

.legend-pill.pill-hedge {
  background: rgba(163, 74, 8, 0.1);
  color: var(--hedge);
  border-color: rgba(163, 74, 8, 0.3);
}

.tv-chart-wrapper {
  position: relative;
  width: 100%;
  height: 480px;
  min-height: 440px;
  border-radius: 12px;
  border: 1px solid var(--rule);
  background: var(--ground);
  overflow: hidden;
}

.tv-widget-embed {
  width: 100%;
  height: 100%;
}

.tv-widget-embed iframe {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
}

/* Floating AEGIS Watermark Logo */
.aegis-chart-watermark {
  position: absolute;
  top: 14px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 5;
  opacity: 0.35;
  background: var(--raised);
  border: 1px solid var(--rule);
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  user-select: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.watermark-logo-svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.watermark-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.watermark-title {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.watermark-sub {
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--accent);
}

@media (max-width: 768px) {
  .tv-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .tv-chart-wrapper {
    height: 380px;
  }
}

/* HyperCore CLOB Orderbook */
.orderbook-card .card-header {
  margin-bottom: 12px;
}

.orderbook-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.clob-table {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.clob-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  position: relative;
  overflow: hidden;
}

.clob-head {
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 6px;
}

.clob-asks .clob-row:not(.clob-head) {
  color: var(--danger);
}

.clob-bids .clob-row:not(.clob-head) {
  color: var(--accent);
}

.depth-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  opacity: 0.12;
  pointer-events: none;
}

.clob-asks .depth-bar { background: var(--danger); }
.clob-bids .depth-bar { background: var(--accent); }

.clob-mid-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 8px;
  margin: 4px 0;
}

.mid-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.mid-source {
  font-size: 11px;
  color: var(--ink-2);
}

/* Pro Configuration Form Controls */
.config-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
}

.form-select {
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--rule);
  background: var(--ground);
  color: var(--ink);
  padding: 0 10px;
  font-family: inherit;
  font-size: 11.5px;
  outline: none;
}

.form-range {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.range-bounds {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--ink-2);
}

.radio-pill-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.radio-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--rule);
  background: var(--ground);
  font-size: 11px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 150ms ease;
}

.radio-pill input {
  accent-color: var(--accent);
}

.radio-pill:has(input:checked) {
  border-color: var(--accent);
  background: var(--raised);
}

.btn-primary {
  height: 34px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 150ms ease;
}

.btn-primary:hover {
  opacity: 0.92;
}

.btn-killswitch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid var(--danger);
  background: var(--ground);
  color: var(--danger);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.btn-killswitch:hover {
  background: var(--danger);
  color: var(--on-accent);
}

/* Token Flywheel Card */
.token-metrics-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.token-metric-item {
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.t-lbl {
  font-size: 12px;
  color: var(--ink-2);
}

.t-val {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.t-sub {
  font-size: 11px;
  color: var(--ink-2);
}

.progress-bar {
  height: 6px;
  background: var(--rule);
  border-radius: 999px;
  margin-top: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--violet);
  border-radius: 999px;
}

/* Real-Time Terminal Audit Log */
.audit-card {
  padding: 20px 24px;
}

.terminal-body {
  height: 180px;
  overflow-y: auto;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink);
  display: flex;
  flex-direction: column-reverse;
}

.log-entry {
  display: flex;
  gap: 12px;
  word-break: break-all;
}

.log-time {
  color: var(--ink-2);
  flex-shrink: 0;
}

.log-tag {
  font-weight: 600;
  flex-shrink: 0;
}

.log-tag.accent { color: var(--accent); }
.log-tag.hedge { color: var(--hedge); }
.log-tag.danger { color: var(--danger); }
.log-tag.violet { color: var(--violet); }

/* Notification Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 14px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  font-size: 13px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 200ms ease;
  max-width: 360px;
}

@keyframes slideIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Responsive Media Queries (Zero horizontal overflow at 390px) */
@media (max-width: 1024px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-header {
    height: 48px;
    padding: 0 10px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
  }
  .header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }
  .header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 1 auto;
    min-width: 0;
  }
  .view-mode-switcher {
    padding: 2px;
    gap: 2px;
  }
  .mode-pill-btn {
    height: 26px;
    padding: 0 6px;
    font-size: 11px;
  }
  .mode-pill-btn .mode-label {
    display: none !important;
  }
  .header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }
  .header-separator, .latency-badge, .session-badge, .beta-badge, .btn-theme-toggle, .btn-settings-toggle, .faucet-pill-btn, .brand-sub {
    display: none !important;
  }
  .brand-logo-svg {
    width: 24px;
    height: 24px;
  }
  .brand-title {
    font-size: 16px;
  }
  .network-badge {
    display: none !important;
  }
  .wallet-btn {
    height: 28px;
    padding: 0 10px;
    font-size: 11px;
    max-width: 125px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .app-drawer-btn {
    width: 30px;
    height: 30px;
  }
  .app-container {
    padding: 10px 10px 24px;
    gap: 10px;
  }
  .workspace-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .workspace-main, .workspace-sidebar {
    gap: 12px;
  }
  .card {
    padding: 10px 12px;
    border-radius: 12px;
  }
  .gauge-svg {
    max-width: 180px;
  }
  .hero-metrics {
    grid-template-columns: 1fr;
  }
  .simulation-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 6px 10px;
    gap: 6px;
  }
  .sim-left {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .sim-btn {
    width: 100%;
    text-align: center;
    height: 24px;
    font-size: 10.5px;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 0 8px;
    gap: 4px;
  }
  .brand-title {
    font-size: 15px;
  }
  .mode-pill-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    justify-content: center;
  }
  .wallet-btn {
    height: 26px;
    padding: 0 8px;
    font-size: 10.5px;
    max-width: 115px;
  }
  .metric-card {
    width: 145px;
    min-width: 145px;
    flex: 0 0 145px;
    padding: 6px 8px;
  }
  .metric-value {
    font-size: 12px;
  }
  .stat-val {
    font-size: 12.5px;
  }
}

/* Session Key Delegation Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal-card {
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header-row h3 {
  font-family: var(--display);
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 0;
}

.modal-close-icon {
  background: transparent;
  border: none;
  color: var(--ink-2);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-desc {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}

.modal-input {
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 12px;
  color: var(--ink);
  outline: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* ==========================================================================
   VIEW MODE SWITCHING & LITE AUTO-PILOT INTERFACE
   ========================================================================== */

/* View Mode Visibility Rules */
body.mode-pro .lite-only,
body:not(.mode-lite) .lite-only {
  display: none !important;
}

body.mode-pro .pro-only,
body:not(.mode-lite) .pro-only {
  display: block;
}

body.mode-lite .pro-only {
  display: none !important;
}

body.mode-lite .lite-only {
  display: flex !important;
}

body.mode-lite .lite-card {
  display: flex !important;
  flex-direction: column;
}

body.mode-lite .lite-telemetry-card {
  display: flex !important;
  flex-direction: column;
}

/* --- Lite Auto-Pilot Card --- */
.lite-card {
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.lite-card-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
  margin-top: -8px;
}

.header-icon-svg {
  flex-shrink: 0;
  stroke: var(--accent);
}

.lite-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.lite-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  flex-wrap: wrap;
}

.lite-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ground);
  border: 1px solid var(--rule);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.lite-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.lite-faucet-note {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-2);
}

/* Micro-amount testnet deposit chips */
.micro-amount-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.micro-chip-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid var(--rule);
  background: var(--ground);
  color: var(--ink);
  cursor: pointer;
  transition: all 150ms ease;
  min-width: 0;
  font-family: inherit;
}

.micro-chip-btn:hover {
  background: var(--raised);
  border-color: var(--ink-2);
}

.micro-chip-btn.active {
  background: var(--raised);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.micro-chip-btn .chip-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.micro-chip-btn.active .chip-val {
  color: var(--accent);
}

.micro-chip-btn .chip-usd {
  font-size: 11px;
  color: var(--ink-2);
  white-space: nowrap;
}

/* Strategy Preset Cards */
.presets-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.preset-card {
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: all 180ms ease;
  user-select: none;
  min-width: 0;
}

.preset-card:hover {
  background: var(--raised);
  border-color: var(--ink-2);
}

.preset-card.active {
  background: var(--raised);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.preset-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.preset-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-name {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}

.preset-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule);
}

.preset-radio-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--rule);
  position: relative;
  flex-shrink: 0;
  transition: all 150ms ease;
}

.preset-card.active .preset-radio-indicator {
  border-color: var(--accent);
  background: var(--accent);
}

.preset-card.active .preset-radio-indicator::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--on-accent);
}

.preset-specs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 10px;
  background: var(--ground);
  border-radius: 8px;
  border: 1px solid var(--rule);
  font-size: 11px;
}

.preset-card.active .preset-specs-grid {
  background: var(--ground);
}

.preset-spec {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.preset-spec .spec-k {
  color: var(--ink-2);
  font-size: 10.5px;
}

.preset-spec .spec-v {
  font-weight: 600;
  color: var(--ink);
}

.preset-desc {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-2);
  margin: 0;
}

/* Lite Telemetry Readout Box */
.lite-summary-box {
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  min-width: 0;
}

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

.summary-row .s-k {
  color: var(--ink-2);
}

.summary-row .s-v {
  font-weight: 600;
  color: var(--ink);
}

/* Lite Action Button Area */
.lite-action-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.lite-activate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  width: 100%;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: all 180ms ease;
}

.lite-activate-btn.armed {
  background: var(--ground);
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-icon-svg {
  flex-shrink: 0;
  stroke: currentColor;
}

.lite-guarantee-note {
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-2);
  text-align: center;
}

/* Lite Telemetry Safeguards Card in Main Column */
.lite-telemetry-card {
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 24px;
  gap: 16px;
  min-width: 0;
}

.lite-telemetry-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.lite-feature-box {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 16px;
  min-width: 0;
}

.feat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--raised);
  border: 1px solid var(--rule);
  color: var(--accent);
  flex-shrink: 0;
}

.feat-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.feat-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.feat-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0;
}

.feat-desc code {
  font-family: inherit;
  font-size: 11px;
  background: var(--raised);
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid var(--rule);
}

@media (max-width: 768px) {
  .micro-amount-chips {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .preset-specs-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    font-size: 10.5px;
  }
  .lite-card {
    padding: 18px 16px;
  }
}

/* ==========================================================================
   AEGIS Terminal Navigation & Session Drawer (Top-Left Hamburger Menu)
   ========================================================================== */
.app-drawer-btn {
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 34px;
  height: 34px;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

.app-drawer-btn:hover {
  border-color: var(--accent);
  background: var(--raised);
}

.app-drawer-btn span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.app-drawer-btn[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}

.app-drawer-btn[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.app-drawer-btn[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.app-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(340px, 88vw);
  background: var(--raised);
  border-right: 1px solid var(--rule);
  z-index: 999;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.15);
  overflow-y: auto;
}

.app-drawer.active {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}

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

.drawer-logo-svg {
  width: 26px;
  height: 26px;
}

.drawer-title {
  font-family: var(--display);
  font-size: 1.2rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.drawer-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-2);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s ease;
}

.drawer-close-btn:hover {
  color: var(--ink);
}

/* Slim One-Line Drawer Feature Cards */
.drawer-nav-slim {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-card-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 12px;
  color: var(--ink);
  font-family: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
  width: 100%;
  box-sizing: border-box;
}

.drawer-card-item:hover {
  background: var(--raised);
  border-color: var(--accent);
  transform: translateX(2px);
}

.drawer-card-item.active {
  background: var(--raised);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.drawer-card-item .d-icon {
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1;
}

.drawer-card-item .d-title {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-card-item .d-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--ground);
  color: var(--ink-2);
  border: 1px solid var(--rule);
}

.drawer-card-item .d-badge.pill-accent {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.drawer-card-item .d-arrow {
  color: var(--ink-2);
  font-size: 13px;
}

.drawer-divider-slim {
  height: 1px;
  background: var(--rule);
  margin: 4px 0;
}

.drawer-status-footer {
  padding: 10px 12px;
  background: color-mix(in srgb, var(--ground) 60%, transparent);
  border: 1px solid var(--rule);
  border-radius: 10px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.status-footer-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   Terminal View Settings Modal & Backdrop
   ========================================================================== */
.btn-settings-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--ground);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.btn-settings-toggle:hover {
  background: var(--raised);
  border-color: var(--ink-2);
}

.settings-backdrop, .wallet-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.settings-backdrop.active, .wallet-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.settings-modal, .wallet-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(460px, 92vw);
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 22px;
  z-index: 999;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-modal.active, .wallet-modal.active {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.settings-modal-header, .wallet-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.settings-modal-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.settings-modal-title-row h3 {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 400;
}

.settings-close-btn, .wallet-modal-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-2);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s ease;
}

.settings-close-btn:hover, .wallet-modal-close-btn:hover {
  color: var(--ink);
}

.settings-modal-sub {
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 16px;
}

.settings-toggles-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.settings-toggle-item:hover {
  border-color: var(--ink-2);
}

.settings-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.settings-toggle-text strong {
  font-size: 12.5px;
  color: var(--ink);
}

.settings-toggle-text small {
  font-size: 11px;
  color: var(--ink-2);
}

.settings-toggle-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.settings-modal-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: flex-end;
}

.settings-reset-btn {
  font-size: 12px;
  color: var(--ink-2);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 150ms ease;
}

.settings-reset-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* ==========================================================================
   Hyperliquid-Style Web3 Wallet Selection Modal
   ========================================================================== */
.wallet-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wallet-option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 12px;
  cursor: pointer;
  color: var(--ink);
  text-align: left;
  transition: all 150ms ease;
  width: 100%;
}

.wallet-option-item:hover {
  background: var(--raised);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.wallet-option-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wallet-option-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wallet-option-info strong {
  font-size: 13px;
}

.wallet-option-info span {
  font-size: 11px;
  color: var(--ink-2);
}

.wallet-option-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
}

/* ==========================================================================
   Dedicated Pro Trading Terminal & Markets View (#tradingTerminalView)
   ========================================================================== */
#tradingTerminalView {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.tt-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 12px 18px;
  flex-wrap: wrap;
  gap: 14px;
}

.tt-topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.tt-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--ground);
  border: 1px solid var(--rule);
  color: var(--ink);
  font-family: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tt-back-btn:hover {
  background: var(--raised);
  border-color: var(--accent);
  color: var(--accent);
}

.tt-separator {
  width: 1px;
  height: 24px;
  background: var(--rule);
}

.tt-coin-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tt-coin-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ground);
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tt-coin-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}

.tt-coin-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tt-coin-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tt-coin-pair {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.tt-coin-fullname {
  font-size: 11px;
  color: var(--ink-2);
}

.tt-topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.tt-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tt-stat-lbl {
  font-size: 10px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tt-stat-val {
  font-size: 13.5px;
  font-weight: 600;
}

/* Workspace Grid (Sidebar + Chart) */
.tt-workspace-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  align-items: start;
}

.tt-market-sidebar {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.market-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.market-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.market-count-pill {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--ground);
  color: var(--ink-2);
  border: 1px solid var(--rule);
}

.market-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.market-search-wrap .search-icon {
  position: absolute;
  left: 10px;
  color: var(--ink-2);
  pointer-events: none;
}

.market-search-input {
  width: 100%;
  height: 34px;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0 10px 0 32px;
  font-family: var(--text);
  font-size: 11.5px;
  color: var(--ink);
  transition: border-color 0.15s ease;
}

.market-search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.market-cat-tabs {
  display: flex;
  align-items: center;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
  overflow-x: auto;
}

.market-cat-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 3px 8px;
  font-family: var(--text);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.market-cat-btn:hover {
  color: var(--ink);
}

.market-cat-btn.active {
  background: var(--raised);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.markets-scroll-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 430px;
  overflow-y: auto;
  padding-right: 2px;
}

.market-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  width: 100%;
  text-align: left;
  font-family: var(--text);
  gap: 8px;
}

.market-row-item:hover {
  background: var(--ground);
}

.market-row-item.active {
  background: var(--ground);
  border-color: var(--accent);
}

.market-row-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.market-token-logo-wrap {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ground);
  border: 1px solid var(--rule);
  overflow: hidden;
}

.market-token-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.market-token-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--accent);
  background: var(--ground);
  text-transform: uppercase;
}

.market-row-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.market-row-symbol-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.market-row-symbol {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.market-row-lev {
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0 4px;
  line-height: 1.3;
}

.market-row-name {
  font-size: 10px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.market-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}

.market-row-price {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.market-row-change {
  font-size: 10px;
  font-weight: 600;
}

.market-row-change.pos {
  color: var(--accent);
}

.market-row-change.neg {
  color: var(--danger);
}

.custom-ticker-box {
  border-top: 1px solid var(--rule);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.custom-ticker-lbl {
  font-size: 10px;
  color: var(--ink-2);
  text-transform: uppercase;
}

.custom-ticker-input-row {
  display: flex;
  gap: 6px;
}

.custom-ticker-input {
  flex: 1;
  height: 30px;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 11px;
  color: var(--ink);
}

.custom-ticker-btn {
  height: 30px;
  padding: 0 10px;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 6px;
  font-family: var(--text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

/* TradingView & HyperCore Chart Main Container in TT */
.tt-chart-main {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tt-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.tt-chart-toolbar-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.tt-engine-pills {
  display: inline-flex;
  align-items: center;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.tt-engine-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
}

.tt-engine-btn:hover {
  color: var(--ink);
}

.tt-engine-btn.active {
  background: var(--raised);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tt-ohlc-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--ink-2);
  flex-wrap: wrap;
}

.tt-ohlc-bar strong {
  color: var(--ink);
  font-weight: 600;
}

.tt-intervals {
  display: flex;
  align-items: center;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.tt-interval-btn {
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 3px 8px;
  font-family: var(--text);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tt-interval-btn:hover {
  color: var(--ink);
}

.tt-interval-btn.active {
  background: var(--raised);
  color: var(--ink);
  font-weight: 700;
}

.tt-hypercore-canvas-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#hypercore_canvas_chart {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(28, 34, 56, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  z-index: 10;
}

.chart-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.tt-chart-container {
  position: relative;
  width: 100%;
  height: 580px;
  min-height: 520px;
  border-radius: 12px;
  border: 1px solid var(--rule);
  background: var(--ground);
  overflow: hidden;
}

.tt-tv-embed {
  width: 100%;
  height: 100%;
}

.tt-tv-embed iframe {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
}

@media (max-width: 960px) {
  .tt-workspace-grid {
    grid-template-columns: 1fr;
  }
  .tt-chart-container {
    height: 420px;
  }
}

/* ==========================================================================
   WALLET ACCOUNT MODAL & REAL-TIME BALANCES
   ========================================================================== */
.wallet-account-card {
  max-width: 540px;
}

.wallet-address-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 10px 14px;
}

.wallet-address-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.wallet-avatar-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.wallet-address-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.wallet-full-addr {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-network-label {
  font-size: 11px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 5px;
}

.wallet-address-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.wallet-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--raised);
  border: 1px solid var(--rule);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
}

.wallet-action-btn:hover {
  background: var(--ground);
  border-color: var(--accent);
  color: var(--accent);
}

.wallet-balances-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.wallet-bal-card {
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.wallet-bal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.wallet-token-name {
  font-size: 11.5px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.token-badge-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  background: var(--raised);
  border: 1px solid var(--rule);
  color: var(--accent);
}

.wallet-bal-val {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.wallet-bal-sub {
  font-size: 11px;
  color: var(--ink-2);
}

.wallet-vault-card {
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wallet-vault-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-2);
}

.wallet-vault-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
}

.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
}

.btn-danger-outline:hover {
  background: var(--danger);
  color: #FFFFFF;
}

/* Flash tick animations */
@keyframes priceFlashGreen {
  0% { background-color: rgba(7, 112, 95, 0.28); color: var(--accent); }
  100% { background-color: transparent; }
}

@keyframes priceFlashRed {
  0% { background-color: rgba(184, 37, 79, 0.28); color: var(--danger); }
  100% { background-color: transparent; }
}

.price-flash-up {
  animation: priceFlashGreen 900ms ease-out;
}

.price-flash-down {
  animation: priceFlashRed 900ms ease-out;
}

.live-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(7, 112, 95, 0.5);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% {
    box-shadow: 0 0 0 0 rgba(7, 112, 95, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(7, 112, 95, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(7, 112, 95, 0);
  }
}

.faucet-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--ground);
  border: 1px solid var(--rule);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
  white-space: nowrap !important;
  flex-shrink: 0;
  line-height: 1;
}

.faucet-pill-btn:hover {
  background: var(--raised);
  border-color: var(--accent);
}

/* Responsive Header Utilities */
.hide-compact {
  display: inline-flex;
}
.hide-laptop {
  display: inline-flex;
}

@media (max-width: 1350px) {
  .hide-compact { display: none !important; }
}

@media (max-width: 1180px) {
  .hide-laptop { display: none !important; }
}






