/* ═══════════════════════════════════════════════════════════════
   BBTI Markets — Global Design System
   Dark Bloomberg-inspired theme | Glass morphism cards
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ───────────────────────────────────────────────── */
:root {
  --bg:            #07090f;
  --bg2:           #0a0e1a;
  --bg3:           #0d1220;
  --card:          #0f1629;
  --card2:         #121c34;
  --border:        #1a2640;
  --border2:       #243555;

  --blue:          #2563eb;
  --blue-light:    #3b82f6;
  --cyan:          #06b6d4;
  --cyan-light:    #22d3ee;
  --green:         #10b981;
  --green-light:   #34d399;
  --red:           #ef4444;
  --red-light:     #f87171;
  --amber:         #f59e0b;
  --purple:        #8b5cf6;

  --text:          #e2e8f0;
  --text2:         #94a3b8;
  --text3:         #64748b;
  --text4:         #334155;

  --grad-main:     linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #06b6d4 100%);
  --grad-card:     linear-gradient(145deg, #0f1629 0%, #0d1526 100%);
  --grad-green:    linear-gradient(135deg, #064e3b, #10b981);
  --grad-red:      linear-gradient(135deg, #7f1d1d, #ef4444);

  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     16px;
  --shadow:        0 4px 24px rgba(0, 0, 0, .5);
  --shadow-blue:   0 0 32px rgba(37, 99, 235, .25);
  --shadow-glow:   0 0 60px rgba(6, 182, 212, .15);

  --font:          'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:     'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  --transition:    all .2s cubic-bezier(.4, 0, .2, 1);
  --transition-slow: all .4s cubic-bezier(.4, 0, .2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family:      var(--font);
  background-color: var(--bg);
  color:            var(--text);
  min-height:       100vh;
  line-height:      1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x:       hidden;
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar               { width: 6px; height: 6px; }
::-webkit-scrollbar-track         { background: var(--bg2); }
::-webkit-scrollbar-thumb         { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover   { background: var(--blue); }

/* ── Typography ──────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.2; color: var(--text); }
p  { color: var(--text2); }
a  { color: var(--cyan); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--cyan-light); }
code, pre { font-family: var(--font-mono); }

/* ── Animated gradient background ───────────────────────────── */
.bg-animated {
  background: var(--bg);
  position: relative;
}
.bg-animated::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(37, 99, 235, .07) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(6, 182, 212, .05) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 0%,  rgba(139, 92, 246, .04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ── Nav ─────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 60px;
  background: rgba(10, 14, 26, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2.5px;
  background: var(--grad-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-brand span { font-weight: 300; opacity: .7; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  border: 1px solid transparent;
}
.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: rgba(37, 99, 235, .12);
  border-color: rgba(37, 99, 235, .25);
}
.nav-link.active { color: var(--cyan); }
.nav-icon { font-size: 15px; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.card:hover { border-color: var(--border2); box-shadow: var(--shadow); }
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(6, 182, 212, .4), transparent);
  opacity: 0;
  transition: var(--transition-slow);
}
.card:hover::before { opacity: 1; }

.card-sm   { padding: 16px; border-radius: var(--radius-sm); }
.card-lg   { padding: 32px; border-radius: var(--radius-lg); }
.card-glow { box-shadow: var(--shadow-glow); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.06);
  opacity: 0;
  transition: var(--transition);
}
.btn:not(:disabled):hover::after { opacity: 1; }
.btn:not(:disabled):active { transform: scale(.98); }

.btn-primary {
  background: var(--grad-main);
  color: #fff;
  box-shadow: 0 2px 12px rgba(37, 99, 235, .35);
}
.btn-primary:not(:disabled):hover {
  box-shadow: 0 4px 20px rgba(37, 99, 235, .5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border2);
}
.btn-secondary:not(:disabled):hover {
  border-color: var(--blue);
  background: rgba(37, 99, 235, .08);
}

.btn-danger {
  background: rgba(239, 68, 68, .15);
  color: var(--red-light);
  border: 1px solid rgba(239, 68, 68, .3);
}
.btn-danger:not(:disabled):hover {
  background: rgba(239, 68, 68, .25);
  border-color: var(--red);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid transparent;
}
.btn-ghost:not(:disabled):hover { color: var(--text); background: rgba(255,255,255,.05); }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 15px; }
.btn-full { width: 100%; }

/* Spinner inside button */
.btn .spinner { display: none; }
.btn.loading .btn-text { display: none; }
.btn.loading .spinner { display: block; }

/* ── Inputs ──────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: .5px;
  text-transform: uppercase;
}
.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}
.form-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.form-input::placeholder { color: var(--text4); }
.form-input.error { border-color: var(--red); box-shadow: 0 0 0 3px rgba(239, 68, 68, .1); }
.form-input.success { border-color: var(--green); }
.form-hint { font-size: 12px; color: var(--text3); }
.form-error { font-size: 12px; color: var(--red-light); }

/* Password input wrapper */
.input-wrap { position: relative; }
.input-wrap .form-input { padding-right: 44px; }
.input-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  font-size: 16px;
  padding: 0;
  transition: var(--transition);
}
.input-toggle:hover { color: var(--text2); }

/* ── Password strength ───────────────────────────────────────── */
.strength-bar {
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  margin-top: 6px;
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  border-radius: 2px;
  transition: var(--transition-slow);
  width: 0%;
}
.strength-0 .strength-fill { background: var(--red);   width: 25%; }
.strength-1 .strength-fill { background: var(--amber); width: 50%; }
.strength-2 .strength-fill { background: var(--amber); width: 75%; }
.strength-3 .strength-fill { background: var(--green); width: 100%; }
.strength-label { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .6);
  transform: scale(.94) translateY(8px);
  transition: var(--transition);
  position: relative;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 20px;
  cursor: pointer;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  transition: var(--transition);
}
.modal-close:hover { color: var(--text); background: rgba(255,255,255,.06); }
.modal-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.modal-sub   { font-size: 13px; color: var(--text2); margin-bottom: 24px; }

/* ── OTP / Code input ────────────────────────────────────────── */
.otp-group { display: flex; gap: 10px; justify-content: center; margin: 8px 0; }
.otp-input {
  width: 48px; height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--cyan);
  outline: none;
  transition: var(--transition);
}
.otp-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .2); }
.otp-input.filled { border-color: var(--cyan); }

/* ── Alerts / Toasts ─────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-error   { background: rgba(239, 68, 68, .1);  border: 1px solid rgba(239, 68, 68, .25);  color: var(--red-light); }
.alert-success { background: rgba(16, 185, 129, .1); border: 1px solid rgba(16, 185, 129, .25); color: var(--green-light); }
.alert-info    { background: rgba(37, 99, 235, .1);  border: 1px solid rgba(37, 99, 235, .25);  color: var(--blue-light); }
.alert-warn    { background: rgba(245, 158, 11, .1); border: 1px solid rgba(245, 158, 11, .25); color: var(--amber); }

/* Toast system */
#toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  min-width: 280px;
  max-width: 380px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: all;
  animation: toastIn .3s cubic-bezier(.34,1.56,.64,1);
  backdrop-filter: blur(12px);
}
.toast.out { animation: toastOut .3s ease forwards; }
.toast-error   { background: rgba(239,68,68,.2);   border: 1px solid rgba(239,68,68,.4);   color: var(--red-light); }
.toast-success { background: rgba(16,185,129,.2);  border: 1px solid rgba(16,185,129,.4);  color: var(--green-light); }
.toast-info    { background: rgba(37,99,235,.2);   border: 1px solid rgba(37,99,235,.4);   color: var(--blue-light); }
@keyframes toastIn  { from { opacity: 0; transform: translateX(20px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(20px) scale(.9); } }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.badge-green  { background: rgba(16,185,129,.15); color: var(--green-light); }
.badge-red    { background: rgba(239,68,68,.15);  color: var(--red-light); }
.badge-amber  { background: rgba(245,158,11,.15); color: var(--amber); }
.badge-blue   { background: rgba(37,99,235,.15);  color: var(--blue-light); }
.badge-cyan   { background: rgba(6,182,212,.15);  color: var(--cyan-light); }

/* ── Stat / value displays ───────────────────────────────────── */
.stat-value { font-size: 28px; font-weight: 800; line-height: 1; color: var(--text); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .8px; margin-top: 4px; }
.change-pos { color: var(--green); }
.change-neg { color: var(--red); }
.change-neu { color: var(--text3); }

/* ── Dividers ────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.divider-text {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text3);
  font-size: 12px;
  margin: 20px 0;
}
.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner-lg { width: 40px; height: 40px; border-width: 3px; border-top-color: var(--cyan); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  padding: 28px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title { font-size: 22px; font-weight: 800; }
.page-sub   { font-size: 13px; color: var(--text3); margin-top: 2px; }

/* ── Search input ────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 16px;
  color: var(--text3);
  font-size: 16px;
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 14px 18px 14px 46px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
}
.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12), var(--shadow-blue);
  background: var(--card2);
}
.search-input::placeholder { color: var(--text4); }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeUp   { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse    { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes glow     { 0%,100% { box-shadow: 0 0 20px rgba(6,182,212,.2); } 50% { box-shadow: 0 0 40px rgba(6,182,212,.4); } }
@keyframes shimmer  {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.fade-up  { animation: fadeUp  .4s ease both; }
.fade-in  { animation: fadeIn  .3s ease both; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--card2) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}

/* ── Utility ─────────────────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-4       { gap: 4px; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.gap-16      { gap: 16px; }
.gap-20      { gap: 20px; }
.gap-24      { gap: 24px; }
.grid        { display: grid; }
.w-full      { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm     { font-size: 13px; }
.text-xs     { font-size: 11px; }
.text-2      { color: var(--text2); }
.text-3      { color: var(--text3); }
.text-cyan   { color: var(--cyan); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.font-mono   { font-family: var(--font-mono); }
.font-bold   { font-weight: 700; }
.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.mt-20  { margin-top: 20px; }
.mt-24  { margin-top: 24px; }
.mb-24  { margin-bottom: 24px; }
.hidden { display: none !important; }
.relative { position: relative; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile-first overrides
   ═══════════════════════════════════════════════════════════════ */

/* ── Hamburger button ────────────────────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition);
  z-index: 110;
}
.nav-hamburger:hover { background: rgba(255,255,255,.06); }
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text2);
  border-radius: 2px;
  transition: var(--transition);
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); background: var(--cyan); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); background: var(--cyan); }

/* ── Mobile nav overlay ──────────────────────────────────────── */
@media (max-width: 800px) {
  .nav { padding: 0 16px; position: sticky; top: 0; z-index: 100; }
  .nav-hamburger { display: flex; }

  .nav-links {
    position: fixed;
    top: 60px;
    left: 0; right: 0;
    flex-direction: column;
    background: rgba(7, 9, 15, .98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px 20px;
    gap: 4px;
    z-index: 99;
    /* Hidden state */
    transform: translateY(-110%);
    opacity: 0;
    pointer-events: none;
    transition: transform .28s cubic-bezier(.4,0,.2,1), opacity .28s ease;
  }
  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }
  .nav-link {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    border: 1px solid transparent;
  }
  .nav-link:hover, .nav-link.active {
    background: rgba(6,182,212,.08);
    border-color: rgba(6,182,212,.2);
  }
  /* Logout button in mobile nav */
  .nav-links .btn {
    width: 100%;
    margin: 8px 0 0 0;
    justify-content: center;
    padding: 12px;
  }
}

/* ── Cards ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .card-lg  { padding: 18px; border-radius: 10px; }
  .card     { padding: 16px; }
  .card-sm  { padding: 12px; }
  .modal    { padding: 20px; border-radius: 14px; max-width: 100%; }
}

/* ── OTP inputs ──────────────────────────────────────────────── */
@media (max-width: 400px) {
  .otp-group { gap: 6px; }
  .otp-input { width: 40px; height: 48px; font-size: 18px; }
}

/* ── Buttons ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .btn-lg { padding: 12px 20px; font-size: 14px; }
}

/* ── Dashboard search ────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero-brand { font-size: 30px; letter-spacing: 2px; }
  .hero-sub   { font-size: 10px; letter-spacing: 3px; margin-bottom: 32px; }
  .search-bar-wrap { flex-direction: column; gap: 8px; }
  .hero-search-input  { border-radius: 12px !important; padding: 14px 16px 14px 44px; font-size: 14px; }
  .hero-search-btn    { border-radius: 12px !important; width: 100%; padding: 14px; }
  .hero-search-icon   { top: 50%; }
  .result-item { padding: 12px 14px; }
  .result-ticker { font-size: 14px; min-width: 60px; }
  .result-name   { font-size: 13px; }
}

/* ── Ticker page ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .ticker-layout { padding: 16px 14px 40px; }

  .ticker-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 20px;
  }
  .ticker-symbol  { font-size: 28px; }
  .ticker-price   { font-size: 30px; }
  .ticker-change  { font-size: 15px; }
  .ticker-price-block { text-align: left; }
  .ticker-actions { justify-content: flex-start; flex-wrap: wrap; }

  /* Time-range buttons: horizontally scrollable */
  .time-ranges {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    gap: 6px;
  }
  .time-ranges::-webkit-scrollbar { height: 2px; }
  .range-btn { flex-shrink: 0; padding: 6px 10px; font-size: 11px; }

  /* Chart height */
  .chart-wrap { height: 260px; }

  /* Chart stats: 2 columns */
  .chart-stat-row { grid-template-columns: 1fr 1fr; }

  /* Overview grid: 1 column */
  .overview-grid { grid-template-columns: 1fr; gap: 12px; }
  .overview-section { padding: 14px; }
  .ov-val { max-width: 60%; }
}

/* ── Favourites grid ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .fav-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .fav-sym  { font-size: 18px; }
}
@media (max-width: 380px) {
  .fav-grid { grid-template-columns: 1fr; }
}

/* ── Settings page ───────────────────────────────────────────── */
@media (max-width: 700px) {
  .settings-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Sidebar becomes a scrollable horizontal tab bar */
  .s-nav {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
  }
  .s-nav::-webkit-scrollbar { height: 2px; }
  .s-nav-item {
    flex-shrink: 0;
    white-space: nowrap;
    border-radius: 100px;
    padding: 8px 16px;
    font-size: 12px;
    border: 1px solid var(--border);
  }
  .s-nav-item.active {
    background: rgba(6,182,212,.12);
    border-color: rgba(6,182,212,.35);
  }
  .s-nav-icon { display: none; }

  /* Section padding */
  .s-section { padding: 16px; }
}

/* ── Auth page ───────────────────────────────────────────────── */
@media (max-width: 500px) {
  .auth-logo-name { font-size: 24px; letter-spacing: 2px; }
  .auth-logo-sub  { font-size: 9px;  letter-spacing: 3px; }
}

/* ── Page header ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .page-header { padding: 0 0 16px; }
  .page-title  { font-size: 18px; }
}

/* ── Toast ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
  #toast-container { bottom: 16px; right: 16px; left: 16px; }
  .toast { min-width: unset; max-width: 100%; }
}

/* ── General mobile typography & spacing ─────────────────────── */
@media (max-width: 480px) {
  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
  h3 { font-size: 15px; }
  .stat-value { font-size: 22px; }
}

/* ── Safe area insets (notch/home-bar devices) ───────────────── */
@supports (padding: max(0px)) {
  .nav { padding-left:  max(28px, env(safe-area-inset-left)); padding-right: max(28px, env(safe-area-inset-right)); }
  .ticker-layout, .page-wrap { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
}

