/* =============================================================================
   ALAKWI TRADING - Premium Terminal Interface
   A dark, sophisticated trading dashboard with terminal aesthetics
   ============================================================================= */

/* -----------------------------------------------------------------------------
   CSS Custom Properties
   ----------------------------------------------------------------------------- */
:root {
  /* Core palette */
  --bg-deep: #0D1117;
  --bg-surface: #161B22;
  --bg-elevated: #1C2128;
  --bg-hover: #21262D;

  /* Accent colors */
  --accent-positive: #00D4AA;
  --accent-positive-dim: rgba(0, 212, 170, 0.15);
  --accent-negative: #FF6B6B;
  --accent-negative-dim: rgba(255, 107, 107, 0.15);
  --accent-warning: #FFB800;
  --accent-warning-dim: rgba(255, 184, 0, 0.15);
  --accent-info: #58A6FF;
  --accent-info-dim: rgba(88, 166, 255, 0.15);

  /* Text hierarchy */
  --text-primary: #E6EDF3;
  --text-secondary: #8B949E;
  --text-tertiary: #6E7681;

  /* Borders & dividers */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-emphasis: rgba(255, 255, 255, 0.15);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-glow-positive: 0 0 20px rgba(0, 212, 170, 0.3);
  --shadow-glow-negative: 0 0 20px rgba(255, 107, 107, 0.3);

  /* Typography */
  --font-display: 'Outfit', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

/* -----------------------------------------------------------------------------
   Light Mode Theme
   ----------------------------------------------------------------------------- */
[data-theme="light"] {
  /* Core palette - Light backgrounds */
  --bg-deep: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-elevated: #F1F5F9;
  --bg-hover: #E2E8F0;

  /* Accent colors - Slightly adjusted for better contrast on light */
  --accent-positive: #00B894;
  --accent-positive-dim: rgba(0, 184, 148, 0.12);
  --accent-negative: #E74C3C;
  --accent-negative-dim: rgba(231, 76, 60, 0.12);
  --accent-warning: #F39C12;
  --accent-warning-dim: rgba(243, 156, 18, 0.12);
  --accent-info: #3498DB;
  --accent-info-dim: rgba(52, 152, 219, 0.12);

  /* Text hierarchy - Dark text for light mode */
  --text-primary: #1E293B;
  --text-secondary: #475569;
  --text-tertiary: #94A3B8;

  /* Borders & dividers - Darker borders for light backgrounds */
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-default: rgba(0, 0, 0, 0.1);
  --border-emphasis: rgba(0, 0, 0, 0.15);

  /* Shadows - Softer shadows for light mode */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-glow-positive: 0 0 20px rgba(0, 184, 148, 0.25);
  --shadow-glow-negative: 0 0 20px rgba(231, 76, 60, 0.25);
}

/* Light mode specific overrides for elements that need special handling */
[data-theme="light"] .app-header {
  background: rgba(248, 250, 252, 0.9);
}

[data-theme="light"] .bottom-nav {
  background: rgba(248, 250, 252, 0.95);
}

[data-theme="light"] .login-bg .grid-overlay {
  background-image:
    linear-gradient(rgba(0, 184, 148, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 184, 148, 0.06) 1px, transparent 1px);
}

[data-theme="light"] .glow-orb.orb-1 {
  background: var(--accent-positive);
  opacity: 0.15;
}

[data-theme="light"] .glow-orb.orb-2 {
  background: var(--accent-info);
  opacity: 0.15;
}

[data-theme="light"] .btn-primary {
  background: linear-gradient(135deg, var(--accent-positive) 0%, #00997A 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 16px rgba(0, 184, 148, 0.25);
}

[data-theme="light"] .btn-primary:hover {
  box-shadow: 0 6px 24px rgba(0, 184, 148, 0.35);
}

[data-theme="light"] .account-hero {
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-elevated) 100%);
  box-shadow: var(--shadow-md);
}

[data-theme="light"] .defense-card {
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(243, 156, 18, 0.08) 100%);
  border-color: rgba(243, 156, 18, 0.25);
}

[data-theme="light"] .modal-sheet {
  background: var(--bg-surface);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .toast {
  background: linear-gradient(135deg, var(--accent-positive) 0%, #00997A 100%);
}

[data-theme="light"] .toast.negative {
  background: linear-gradient(135deg, var(--accent-negative) 0%, #C0392B 100%);
}

[data-theme="light"] .toast.warning {
  background: linear-gradient(135deg, var(--accent-warning) 0%, #D68910 100%);
}

[data-theme="light"] .notification-card.unread {
  background: linear-gradient(90deg, rgba(52, 152, 219, 0.08) 0%, var(--bg-surface) 20%);
}

[data-theme="light"] .toggle input:checked + .toggle-track::after {
  background: white;
}

[data-theme="light"] #app {
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .sparkline-area {
  fill: url(#sparkline-gradient-light);
}

[data-theme="light"] .sparkline-line {
  stroke: var(--accent-positive);
}

/* Theme toggle icon styling */
.theme-icon {
  width: 20px;
  height: 20px;
  transition: transform var(--duration-normal) var(--ease-out);
}

.theme-icon.sun {
  display: none;
}

.theme-icon.moon {
  display: block;
}

[data-theme="light"] .theme-icon.sun {
  display: block;
}

[data-theme="light"] .theme-icon.moon {
  display: none;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-display);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  touch-action: manipulation;
}

#app {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--bg-deep);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
}

input:focus, button:focus {
  outline: none;
}

.hidden {
  display: none !important;
}

/* -----------------------------------------------------------------------------
   Toast Notification
   ----------------------------------------------------------------------------- */
.toast {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  width: calc(100% - 24px);
  max-width: 456px;
  background: linear-gradient(135deg, var(--accent-positive) 0%, #00A388 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  box-shadow: var(--shadow-lg), var(--shadow-glow-positive);
  z-index: 9999;
  transition: transform var(--duration-slow) var(--ease-out);
}

.toast.show {
  transform: translateX(-50%) translateY(calc(env(safe-area-inset-top, 12px) + 12px));
}

.toast.negative {
  background: linear-gradient(135deg, var(--accent-negative) 0%, #E05555 100%);
  box-shadow: var(--shadow-lg), var(--shadow-glow-negative);
}

.toast.warning {
  background: linear-gradient(135deg, var(--accent-warning) 0%, #E5A500 100%);
}

.toast-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-icon svg {
  width: 22px;
  height: 22px;
  color: white;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  font-size: 15px;
  color: white;
}

.toast-body {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-mono);
}

.toast-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity var(--duration-fast);
}

.toast-close:hover {
  opacity: 1;
}

.toast-close svg {
  width: 18px;
  height: 18px;
  color: white;
}

/* -----------------------------------------------------------------------------
   Login Screen
   ----------------------------------------------------------------------------- */
#login-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-2xl);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 212, 170, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 170, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
}

.orb-1 {
  width: 300px;
  height: 300px;
  background: var(--accent-positive);
  top: -100px;
  right: -100px;
  animation: float 8s ease-in-out infinite;
}

.orb-2 {
  width: 200px;
  height: 200px;
  background: var(--accent-info);
  bottom: -50px;
  left: -50px;
  animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, -20px); }
}

.login-container {
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.logo-mark {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-lg);
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-text {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-primary);
}

.logo-tagline {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3em;
  color: var(--accent-positive);
  margin-top: var(--space-xs);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.input-field {
  position: relative;
}

.input-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.input-field input {
  width: 100%;
  height: 52px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 var(--space-lg);
  font-size: 15px;
  color: var(--text-primary);
  transition: all var(--duration-normal) var(--ease-out);
}

.input-field input::placeholder {
  color: var(--text-tertiary);
}

.input-field input:focus {
  border-color: var(--accent-positive);
  background: var(--bg-elevated);
}

.input-glow {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent-positive);
  transition: all var(--duration-normal) var(--ease-out);
  transform: translateX(-50%);
  border-radius: var(--radius-full);
}

.input-field input:focus ~ .input-glow {
  width: 100%;
  box-shadow: 0 0 20px var(--accent-positive);
}

.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  right: 0;
  top: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: color var(--duration-fast);
}

.password-toggle:hover {
  color: var(--text-primary);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
}

.remember-me input {
  position: absolute;
  opacity: 0;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}

.remember-me input:checked + .checkmark {
  background: var(--accent-positive);
  border-color: var(--accent-positive);
}

.checkmark::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.remember-me input:checked + .checkmark::after {
  opacity: 1;
}

.btn-primary {
  height: 52px;
  background: linear-gradient(135deg, var(--accent-positive) 0%, #00A388 100%);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  color: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: 0 4px 16px rgba(0, 212, 170, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 212, 170, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary svg {
  width: 18px;
  height: 18px;
}

.btn-secondary {
  height: 48px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all var(--duration-fast);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--border-emphasis);
}

.login-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: var(--space-2xl);
}

.login-footer::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent-positive);
  border-radius: 50%;
  margin-right: var(--space-sm);
  vertical-align: middle;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* -----------------------------------------------------------------------------
   Main App Layout
   ----------------------------------------------------------------------------- */
#main-app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: env(safe-area-inset-top, 0) var(--space-lg) 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  width: 80px;
}

.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--accent-positive-dim);
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 212, 170, 0.2);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-positive);
  border-radius: 50%;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.5);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 0 4px rgba(0, 212, 170, 0);
    opacity: 0.8;
  }
}

.status-text {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent-positive);
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.header-action {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--duration-fast);
}

.header-action:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.header-action svg {
  width: 22px;
  height: 22px;
}

/* Screen Container */
#screen-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.screen-content {
  display: none;
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + 80px);
  animation: fadeIn var(--duration-normal) var(--ease-out);
}

.screen-content.active {
  display: block;
}

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

/* -----------------------------------------------------------------------------
   Dashboard Screen
   ----------------------------------------------------------------------------- */
.last-update {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}

.last-update svg {
  width: 12px;
  height: 12px;
}

/* Card Base */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: all var(--duration-fast);
}

.card:hover {
  border-color: var(--border-default);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-lg);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.card-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  width: 100%;
  padding: var(--space-md);
  margin-top: var(--space-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-positive);
  background: var(--accent-positive-dim);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast);
}

.card-action:hover {
  background: rgba(0, 212, 170, 0.2);
}

.card-action svg {
  width: 16px;
  height: 16px;
}

/* Account Hero Card */
.account-hero {
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border-default);
  padding: var(--space-xl);
}

.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
}

.card-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
}

.trend-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.trend-badge.positive {
  background: var(--accent-positive-dim);
  color: var(--accent-positive);
}

.trend-badge.negative {
  background: var(--accent-negative-dim);
  color: var(--accent-negative);
}

.trend-badge svg {
  width: 14px;
  height: 14px;
}

.hero-metrics {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  margin-bottom: var(--space-lg);
}

.metric-primary {
  flex: 1;
}

.metric-label {
  display: block;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.metric-divider {
  width: 1px;
  height: 48px;
  background: var(--border-default);
}

.sparkline-container {
  height: 40px;
  margin-bottom: var(--space-lg);
  position: relative;
}

.sparkline {
  width: 100%;
  height: 100%;
}

.sparkline-line {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
}

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

.stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.stat-value.positive {
  color: var(--accent-positive);
}

.stat-value.negative {
  color: var(--accent-negative);
}

/* Defense Chain Card */
.defense-card {
  border-color: rgba(255, 184, 0, 0.2);
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(255, 184, 0, 0.05) 100%);
}

.shield-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-warning);
}

.defense-level {
  font-size: 12px;
  color: var(--accent-warning);
  font-weight: 500;
}

.defense-loss {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-negative);
}

.defense-progress {
  margin-bottom: var(--space-lg);
}

.progress-track {
  display: flex;
  gap: 3px;
  margin-bottom: var(--space-sm);
}

.progress-segment {
  flex: 1;
  height: 8px;
  border-radius: 2px;
  background: var(--bg-elevated);
  transition: all var(--duration-fast);
}

.progress-segment:first-child {
  border-radius: 4px 2px 2px 4px;
}

.progress-segment:last-child {
  border-radius: 2px 4px 4px 2px;
}

.progress-segment.filled.level-safe {
  background: var(--accent-positive);
  box-shadow: 0 0 8px rgba(0, 212, 170, 0.4);
}

.progress-segment.filled.level-caution {
  background: var(--accent-warning);
  box-shadow: 0 0 8px rgba(255, 184, 0, 0.4);
}

.progress-segment.filled.level-danger {
  background: var(--accent-negative);
  box-shadow: 0 0 8px rgba(255, 107, 107, 0.4);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  padding: 0 var(--space-xs);
}

.defense-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.duration {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.duration svg {
  width: 14px;
  height: 14px;
}

.status-badge {
  padding: 4px 10px;
  background: var(--accent-warning-dim);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent-warning);
}

/* Active Trades Preview */
.trades-summary {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.trade-count {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.total-pnl {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
}

.total-pnl.positive {
  color: var(--accent-positive);
}

.total-pnl.negative {
  color: var(--accent-negative);
}

.trades-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.trade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast);
}

.trade-row:hover {
  background: var(--bg-hover);
}

.trade-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.trade-symbol {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.trade-type {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.trade-type.buy {
  background: var(--accent-positive-dim);
  color: var(--accent-positive);
  border: 1px solid rgba(0, 212, 170, 0.3);
}

.trade-type.sell {
  background: var(--accent-negative-dim);
  color: var(--accent-negative);
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.trade-volume {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.trade-profit {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.trade-profit.positive {
  color: var(--accent-positive);
}

.trade-profit.negative {
  color: var(--accent-negative);
}

/* Equity Chart */
.chart-card .card-header {
  margin-bottom: var(--space-md);
}

.chart-period {
  padding: 4px 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.chart-container {
  height: 180px;
  position: relative;
}

/* Activity Feed */
.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon svg {
  width: 16px;
  height: 16px;
}

.activity-icon.trade-opened {
  background: var(--accent-positive-dim);
  color: var(--accent-positive);
}

.activity-icon.trade-closed {
  background: var(--accent-info-dim);
  color: var(--accent-info);
}

.activity-icon.defense {
  background: var(--accent-warning-dim);
  color: var(--accent-warning);
}

.activity-icon.error {
  background: var(--accent-negative-dim);
  color: var(--accent-negative);
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-text {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.activity-time {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* -----------------------------------------------------------------------------
   Trades Screen
   ----------------------------------------------------------------------------- */
.trades-header {
  margin: calc(-1 * var(--space-lg));
  margin-bottom: var(--space-lg);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.stats-bar {
  display: flex;
  padding: var(--space-lg);
  gap: var(--space-lg);
}

.stat-block {
  flex: 1;
  text-align: center;
}

.stat-block .stat-label {
  display: block;
  margin-bottom: 4px;
}

.stat-block .stat-value {
  font-size: 18px;
}

.filter-bar {
  display: flex;
  gap: var(--space-sm);
  padding: 0 var(--space-lg) var(--space-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all var(--duration-fast);
}

.filter-chip svg {
  width: 14px;
  height: 14px;
}

.filter-chip:hover {
  border-color: var(--border-default);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--accent-positive-dim);
  border-color: rgba(0, 212, 170, 0.3);
  color: var(--accent-positive);
}

.trade-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.trade-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: all var(--duration-fast);
  cursor: pointer;
}

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

.trade-card:active {
  transform: translateY(0);
}

.trade-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.trade-card-symbol {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.trade-card-symbol .symbol {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.trade-card-profit {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
}

.trade-card-profit.positive {
  color: var(--accent-positive);
}

.trade-card-profit.negative {
  color: var(--accent-negative);
}

.trade-card-details {
  display: flex;
  gap: var(--space-lg);
}

.trade-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.trade-detail .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.trade-detail .value {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

/* -----------------------------------------------------------------------------
   Notifications Screen
   ----------------------------------------------------------------------------- */
.notification-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.notification-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  position: relative;
  transition: all var(--duration-fast);
}

.notification-card:hover {
  border-color: var(--border-default);
}

.notification-card.unread {
  border-left: 3px solid var(--accent-info);
  background: linear-gradient(90deg, rgba(88, 166, 255, 0.05) 0%, var(--bg-surface) 20%);
}

.notification-card.unread .notification-title::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent-info);
  border-radius: 50%;
  margin-right: var(--space-sm);
  vertical-align: middle;
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-sm);
}

.notification-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.notification-time {
  font-size: 11px;
  color: var(--text-tertiary);
}

.notification-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* -----------------------------------------------------------------------------
   Settings Screen
   ----------------------------------------------------------------------------- */
.settings-group {
  margin-bottom: var(--space-xl);
}

.settings-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
  padding-left: var(--space-xs);
}

.settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-info {
  flex: 1;
}

.setting-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.setting-desc {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  cursor: pointer;
}

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

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  transition: all var(--duration-fast);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--duration-normal) var(--ease-out);
}

.toggle input:checked + .toggle-track {
  background: var(--accent-positive);
  border-color: var(--accent-positive);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
  background: white;
}

/* Quiet Hours Config */
.quiet-config {
  padding: var(--space-lg);
  padding-top: 0;
}

.time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
}

.time-row span {
  font-size: 13px;
  color: var(--text-secondary);
}

.time-picker {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-primary);
  transition: all var(--duration-fast);
}

.time-picker:hover {
  border-color: var(--border-default);
}

.time-picker svg {
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
}

/* Settings Link */
.settings-link {
  display: flex;
  align-items: center;
  width: 100%;
  padding: var(--space-lg);
  text-align: left;
  transition: background var(--duration-fast);
}

.settings-link:hover {
  background: var(--bg-elevated);
}

.settings-link svg {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  margin-left: auto;
}

/* Save Button */
.save-btn {
  width: 100%;
  margin-top: var(--space-lg);
}

/* Balance Alert Configuration */
.balance-alert-config {
  padding: var(--space-lg);
  padding-top: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-height var(--duration-slow) var(--ease-out),
    opacity var(--duration-normal) var(--ease-out),
    padding var(--duration-slow) var(--ease-out);
}

.balance-alert-config.visible {
  max-height: 200px;
  opacity: 1;
  padding: var(--space-lg);
  padding-top: var(--space-md);
}

.balance-threshold-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.threshold-label {
  font-size: 13px;
  color: var(--text-secondary);
  flex-shrink: 1;
}

.currency-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--duration-fast);
  min-width: 120px;
}

.currency-input-wrapper:hover {
  border-color: var(--border-emphasis);
}

.currency-input-wrapper:focus-within {
  border-color: var(--accent-positive);
  box-shadow: 0 0 0 3px var(--accent-positive-dim);
}

.currency-prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-md);
  height: 40px;
  background: var(--bg-hover);
  color: var(--accent-positive);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  border-right: 1px solid var(--border-subtle);
}

.currency-input {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-md);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
  -moz-appearance: textfield;
}

.currency-input::placeholder {
  color: var(--text-tertiary);
}

.currency-input::-webkit-outer-spin-button,
.currency-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.threshold-helper {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.5;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent-info);
}

.threshold-helper svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--accent-info);
  margin-top: 1px;
}

/* Light mode adjustments for balance alert */
[data-theme="light"] .currency-prefix {
  background: var(--bg-elevated);
}

[data-theme="light"] .currency-input-wrapper:focus-within {
  box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.15);
}

[data-theme="light"] .threshold-helper {
  background: rgba(52, 152, 219, 0.08);
}

/* -----------------------------------------------------------------------------
   Bottom Navigation
   ----------------------------------------------------------------------------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 8px;
  color: var(--text-tertiary);
  transition: all var(--duration-fast);
  position: relative;
}

.nav-btn svg {
  width: 22px;
  height: 22px;
  transition: transform var(--duration-fast);
}

.nav-btn span {
  font-size: 10px;
  font-weight: 500;
}

.nav-btn:hover {
  color: var(--text-secondary);
}

.nav-btn.active {
  color: var(--accent-positive);
}

.nav-btn.active svg {
  transform: scale(1.1);
}

.nav-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 40px;
  height: 2px;
  background: var(--accent-positive);
  border-radius: 0 0 2px 2px;
  transition: transform var(--duration-fast);
}

.nav-btn.active::before {
  transform: translateX(-50%) scaleX(1);
}

.notification-badge {
  position: absolute;
  top: 6px;
  right: 50%;
  transform: translateX(14px);
  min-width: 18px;
  height: 18px;
  background: var(--accent-negative);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* -----------------------------------------------------------------------------
   Modals
   ----------------------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn var(--duration-normal);
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  background: var(--bg-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp var(--duration-slow) var(--ease-out);
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border-emphasis);
  border-radius: var(--radius-full);
  margin: var(--space-md) auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
  font-size: 17px;
  font-weight: 600;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--duration-fast);
}

.modal-close:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl);
}

.modal-footer {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border-subtle);
}

.modal-footer button {
  flex: 1;
}

/* Account Modal */
.account-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  transition: all var(--duration-fast);
}

.account-card.active {
  border-color: var(--accent-positive);
  background: var(--accent-positive-dim);
}

.account-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

.account-card.active .account-indicator {
  background: var(--accent-positive);
  box-shadow: 0 0 8px var(--accent-positive);
}

.account-info {
  flex: 1;
}

.account-name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.account-number {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.account-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-positive);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.switch-btn {
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all var(--duration-fast);
}

.switch-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-emphasis);
}

/* Trade Detail Modal */
.modal-sheet.trade-detail {
  min-height: 50vh;
}

.trade-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
}

.trade-detail-symbol {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.trade-detail-symbol .symbol {
  font-size: 24px;
  font-weight: 700;
}

.trade-detail-profit {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
}

.trade-detail-section {
  margin-bottom: var(--space-xl);
}

.trade-detail-section h4 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}

.trade-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.trade-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trade-detail-item .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.trade-detail-item .value {
  font-size: 15px;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* Filter Modal Options */
.filter-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.filter-option {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.filter-option:hover {
  border-color: var(--border-default);
}

.filter-option.selected {
  border-color: var(--accent-positive);
  background: var(--accent-positive-dim);
}

.filter-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-positive);
}

.filter-option span {
  font-size: 14px;
  color: var(--text-primary);
}

/* -----------------------------------------------------------------------------
   Responsive & Media Queries
   ----------------------------------------------------------------------------- */
@media (min-width: 481px) {
  #app {
    border-left: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
  }
}

/* Animation for page transitions */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Smooth scrollbar for WebKit */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-emphasis);
}

/* Focus visible states */
:focus-visible {
  outline: 2px solid var(--accent-positive);
  outline-offset: 2px;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
