/* =============================================
   كاشف الأرقام الدولية — Premium Design System v3
   Minimal · Futuristic · Dark Modern
   Comprehensive Responsive: 320px → 1400px+
   ============================================= */

/* ── Design Tokens ──────────────────────────── */

/* ── ليلي (Dark Mode) — الافتراضي ── */
:root,
[data-theme="dark"] {
    /* Surface layers */
    --bg-root:      #0a0f0d;
    --bg-base:      #0d1210;
    --bg-elevated:  #121a17;
    --bg-card:      #162019;
    --bg-hover:     #1e2e28;
    --bg-input:     #0e1512;
    --bg-sidebar:   #0b100e;

    /* Text hierarchy */
    --text-primary:   #e0f0ea;
    --text-secondary: #7a9a8e;
    --text-muted:     #4d6858;
    --text-white:     #f5fcf8;
    --text-accent:    var(--accent);

    /* Accent palette — turquoise green */
    --accent:            #00ddb3;
    --accent-hover:      #33ecd0;
    --accent-dim:        rgba(0, 221, 179, 0.08);
    --accent-glow:       rgba(0, 221, 179, 0.12);
    --accent-subtle:     rgba(0, 221, 179, 0.04);

    --accent-warm:       #fbbf24;
    --accent-warm-dim:   rgba(251, 191, 36, 0.08);
    --accent-warm-glow:  rgba(251, 191, 36, 0.12);

    --success:       #34d399;
    --success-dim:   rgba(52, 211, 153, 0.08);
    --warning:       #f59e0b;
    --warning-dim:   rgba(245, 158, 11, 0.08);
    --danger:        #f43f5e;
    --danger-dim:    rgba(244, 63, 94, 0.08);
    --info:          #60a5fa;
    --info-dim:      rgba(96, 165, 250, 0.08);

    /* Borders */
    --border:        #1a2e26;
    --border-light:  #28443a;
    --border-focus:  var(--accent);

    /* Shadows */
    --shadow-sm:   0 1px 3px rgba(0,0,0,.35);
    --shadow-md:   0 4px 14px rgba(0,0,0,.45);
    --shadow-lg:   0 12px 40px rgba(0,0,0,.55);
    --shadow-glow: 0 0 30px var(--accent-glow);

    /* Radius */
    --r-xs: 4px;
    --r-sm: 6px;
    --r-md: 8px;
    --r-lg: 12px;
    --r-xl: 16px;
    --r-full: 9999px;

    /* Timing */
    --ease: cubic-bezier(.4,0,.2,1);
    --ease-spring: cubic-bezier(.34,1.56,.64,1);
    --duration: .2s;
    --duration-slow: .4s;
    --transition: all var(--duration) var(--ease);

    /* Typography */
    --font: 'Tajawal', -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'SFMono-Regular', 'Fira Code', monospace;

    /* Sizing */
    --navbar-h: 56px;
    --sidebar-w: 220px;
    --container: 1180px;

    /* Z-indexes */
    --z-sidebar: 100;
    --z-navbar: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-toast: 500;

    /* Aliases */
    --accent-primary:    var(--accent);
    --accent-secondary:  #00b896;
    --accent-success:    var(--success);
    --accent-warning:    var(--warning);
    --accent-danger:     var(--danger);
    --accent-info:       var(--info);
    --bg-primary:        var(--bg-root);
    --bg-secondary:      var(--bg-card);
    --border-primary:    var(--border);
    --radius-md:         var(--r-md);
    --radius-lg:         var(--r-lg);

    /* Navbar bg */
    --navbar-bg: rgba(10, 15, 13, 0.85);
}

/* ── نهاري (Light Mode) ── */
[data-theme="light"] {
    --bg-root:      #f5faf8;
    --bg-base:      #eef5f2;
    --bg-elevated:  #e8f0ec;
    --bg-card:      #ffffff;
    --bg-hover:     #e0ede8;
    --bg-input:     #f0f6f3;
    --bg-sidebar:   #f8fcfa;

    --text-primary:   #1a2e26;
    --text-secondary: #4a6858;
    --text-muted:     #7a9a8e;
    --text-white:     #0a1a14;
    --text-accent:    var(--accent);

    --accent:            #00b896;
    --accent-hover:      #009e82;
    --accent-dim:        rgba(0, 184, 150, 0.08);
    --accent-glow:       rgba(0, 184, 150, 0.10);
    --accent-subtle:     rgba(0, 184, 150, 0.04);

    --accent-warm:       #d97706;
    --accent-warm-dim:   rgba(217, 119, 6, 0.08);
    --accent-warm-glow:  rgba(217, 119, 6, 0.10);

    --success:       #059669;
    --success-dim:   rgba(5, 150, 105, 0.08);
    --warning:       #d97706;
    --warning-dim:   rgba(217, 119, 6, 0.08);
    --danger:        #dc2626;
    --danger-dim:    rgba(220, 38, 38, 0.08);
    --info:          #2563eb;
    --info-dim:      rgba(37, 99, 235, 0.08);

    --border:        #d0e0d8;
    --border-light:  #b8d0c4;
    --border-focus:  var(--accent);

    --shadow-sm:   0 1px 3px rgba(0,0,0,.06);
    --shadow-md:   0 4px 14px rgba(0,0,0,.08);
    --shadow-lg:   0 12px 40px rgba(0,0,0,.10);
    --shadow-glow: 0 0 30px var(--accent-glow);

    --accent-primary:   var(--accent);
    --accent-secondary: #009e82;
    --bg-primary:       var(--bg-root);
    --bg-secondary:     var(--bg-card);
    --border-primary:   var(--border);

    --navbar-bg: rgba(245, 250, 248, 0.90);
}

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

html { scroll-behavior: smooth; font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background-color: var(--bg-root);
    background-image: url('/assets/images/bg-dark.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text-primary);
    line-height: 1.65;
    min-height: 100vh;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Light mode background */
[data-theme="light"] body {
    background-image: url('/assets/images/bg-light.png');
}

a { color: var(--accent); text-decoration: none; transition: color var(--duration) var(--ease); }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; display: block; }

::selection { background: var(--accent); color: var(--bg-root); }

/* ── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Layout ─────────────────────────────────── */
.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content { flex: 1; }

/* ── Navbar ─────────────────────────────────── */
.navbar {
    background: var(--navbar-bg);
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: var(--z-navbar);
    height: var(--navbar-h);
}

.navbar-inner {
    max-width: var(--container);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 16px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: -0.2px;
    white-space: nowrap;
}

.navbar-brand .logo-icon {
    width: 30px;
    height: 30px;
    background: var(--accent);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--bg-root);
    font-weight: 800;
    flex-shrink: 0;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
}

.navbar-nav a {
    padding: 6px 12px;
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
}

.navbar-nav a:hover,
.navbar-nav a.active {
    color: var(--text-white);
    background: var(--accent-dim);
}

.navbar-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    right: 12px;
    left: 12px;
    height: 1.5px;
    background: var(--accent);
    border-radius: var(--r-full);
}

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

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--r-sm);
    transition: var(--transition);
    line-height: 1;
}
.mobile-toggle:hover { background: var(--accent-dim); }

/* ── Buttons ────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--r-sm);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.5;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background var(--duration) var(--ease);
}

.btn:active::after { background: rgba(255,255,255,.05); }

.btn-primary {
    background: var(--accent);
    color: var(--bg-root);
    font-weight: 700;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

.btn-success { background: var(--success); color: #fff; font-weight: 700; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-warning { background: var(--warning); color: var(--bg-root); font-weight: 700; }

.btn-sm   { padding: 4px 10px; font-size: 0.78rem; }
.btn-lg   { padding: 12px 24px; font-size: 0.95rem; }
.btn-block { width: 100%; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
}

.btn-ghost:hover {
    color: var(--text-white);
    background: var(--accent-dim);
}

/* ── Cards ──────────────────────────────────── */
.card {
    background: rgba(var(--bg-card-rgb, 22,32,25), 0.95);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px;
    transition: var(--transition);
}

[data-theme="light"] .card {
    background: rgba(255, 255, 255, 0.95);
}

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-white);
}

/* ── Forms ──────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.82rem;
    letter-spacing: 0.1px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-control::placeholder { color: var(--text-muted); }

.input-group {
    display: flex;
    gap: 8px;
}

.input-group .form-control { flex: 1; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%236a6f8a' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 16px center;
    padding-left: 36px;
}

/* ── Hero Section ───────────────────────────── */
.hero {
    padding: 60px 0 48px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -30%;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-glow), transparent 70%);
    pointer-events: none;
    animation: heroPulse 8s ease-in-out infinite;
}

@keyframes heroPulse {
    0%, 100% { opacity: .3; transform: translateX(-50%) scale(1); }
    50%      { opacity: .5; transform: translateX(-50%) scale(1.05); }
}

.hero-content { position: relative; z-index: 1; }

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-white);
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.hero h1 .accent { color: var(--accent); }

.hero .subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto 28px;
    line-height: 1.75;
}

.hero-search {
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    gap: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 5px;
    transition: var(--transition);
}

.hero-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.hero-search .form-control {
    border: none;
    background: transparent;
    font-size: 0.95rem;
    padding: 9px 12px;
}

.hero-search .form-control:focus { box-shadow: none; }

.hero-search select.form-control {
    max-width: 160px;
    border-left: 1px solid var(--border);
    padding-right: 12px;
}

.hero-search .btn { border-radius: var(--r-sm); padding: 9px 20px; }

/* ── Section Headers ────────────────────────── */
.section-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 12px;
    background: var(--accent-dim);
    border: 1px solid rgba(0, 221, 179, 0.14);
    border-radius: var(--r-full);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.4px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: -0.3px;
    line-height: 1.3;
}

.section-title .accent { color: var(--accent); }

.section-subtitle {
    color: var(--text-secondary);
    max-width: 460px;
    margin: 6px auto 0;
    font-size: 0.95rem;
}

.section-header { text-align: center; margin-bottom: 40px; }

/* ── Features ───────────────────────────────── */
.features {
    padding: 60px 0;
    background: transparent;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.feature-card {
    background: rgba(var(--bg-card-rgb, 22,32,25), 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 24px 20px;
    transition: var(--transition);
    position: relative;
}

[data-theme="light"] .feature-card {
    background: rgba(255, 255, 255, 0.93);
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
    opacity: 0;
    transition: opacity var(--duration) var(--ease);
}

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

.feature-card:hover::before { opacity: 1; }

.feature-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 14px;
    background: var(--accent-dim);
    border: 1px solid rgba(0, 221, 179, 0.12);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.feature-card h3 {
    font-size: 0.98rem;
    margin-bottom: 6px;
    color: var(--text-white);
    font-weight: 700;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.55;
}

/* ── Pricing ────────────────────────────────── */
.pricing-section {
    padding: 60px 0;
    background: transparent;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    padding: 32px 0;
}

.pricing-card {
    background: rgba(var(--bg-card-rgb, 22,32,25), 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 24px;
    text-align: center;
    position: relative;
    transition: var(--transition);
}

[data-theme="light"] .pricing-card {
    background: rgba(255, 255, 255, 0.93);
}

.pricing-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-light);
}

.pricing-card.featured {
    border-color: var(--accent);
    background: linear-gradient(180deg, rgba(0, 221, 179, 0.03), var(--bg-card));
}

.pricing-card.featured::before {
    content: '\0627\0644\0623\0643\062B\0631 \0637\0644\0628\064B\0627';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--bg-root);
    padding: 2px 14px;
    border-radius: var(--r-full);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.pricing-plan {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--text-white);
}

.pricing-price {
    font-size: 1.9rem;
    font-weight: 800;
    margin: 12px 0;
    color: var(--text-white);
    letter-spacing: -0.8px;
}

.pricing-price span {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0;
}

.pricing-features {
    list-style: none;
    margin: 16px 0;
    text-align: right;
}

.pricing-features li {
    padding: 6px 0;
    color: var(--text-secondary);
    font-size: 0.84rem;
    border-bottom: 1px solid var(--border);
}

.pricing-features li:last-child { border-bottom: none; }

.pricing-features li::before {
    content: '\2713 ';
    color: var(--success);
    font-weight: 700;
}

.pricing-card.plan-warm { border-color: var(--accent-warm); }
.pricing-card.plan-warm .pricing-plan { color: var(--accent-warm); }

/* ── Dashboard Layout ───────────────────────── */
.dashboard-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: calc(100vh - var(--navbar-h));
}

/* Sidebar */
.sidebar {
    background: rgba(var(--bg-sidebar-rgb, 11,16,14), 0.96);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-left: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: var(--navbar-h);
    height: calc(100vh - var(--navbar-h));
    overflow-y: auto;
    transition: transform var(--duration-slow) var(--ease);
}

.sidebar-nav { list-style: none; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.84rem;
    transition: var(--transition);
    border-right: 2px solid transparent;
    margin: 1px 0;
}

.sidebar-nav a:hover {
    color: var(--text-secondary);
    background: var(--accent-dim);
}

.sidebar-nav a.active {
    color: var(--accent);
    background: var(--accent-dim);
    border-right-color: var(--accent);
}

.sidebar-nav .nav-icon {
    width: 16px;
    text-align: center;
    font-size: 0.9rem;
}

.sidebar-section {
    padding: 0 16px;
    margin: 14px 0 4px;
    font-size: 0.64rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.sidebar-brand {
    padding: 0 16px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 700;
}

.dashboard-content {
    padding: 24px 28px;
    max-width: 940px;
    width: 100%;
}

/* Admin sidebar distinct */
.sidebar.admin-sidebar {
    background: var(--bg-root);
    border-left-color: var(--accent-warm);
}

.sidebar.admin-sidebar .sidebar-nav a.active {
    border-right-color: var(--accent-warm);
    color: var(--accent-warm);
    background: var(--accent-warm-dim);
}

/* ── Stats Grid ─────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(var(--bg-card-rgb, 22,32,25), 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px;
    transition: var(--transition);
}

[data-theme="light"] .stat-card {
    background: rgba(255, 255, 255, 0.93);
}

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

.stat-card .stat-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.stat-card .stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: -0.4px;
}

.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: 0.76rem;
    margin-top: 1px;
}

/* ── Search Results ─────────────────────────── */
.search-results { margin-top: 16px; }

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(var(--bg-card-rgb, 22,32,25), 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-bottom: 6px;
    transition: var(--transition);
}

[data-theme="light"] .result-item {
    background: rgba(255, 255, 255, 0.93);
}

.result-item:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.result-name {
    font-weight: 600;
    color: var(--text-white);
    font-size: 0.92rem;
}

.result-number {
    font-family: var(--font-mono);
    color: var(--accent);
    direction: ltr;
    font-size: 0.86rem;
}

/* ── Tables ─────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.data-table th {
    background: var(--bg-elevated);
    padding: 10px 12px;
    text-align: right;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 9px 12px;
    border-top: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.data-table tr:hover td { background: var(--accent-dim); }

/* ── Badges ─────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: var(--r-full);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15px;
}

.badge-free      { background: rgba(77, 69, 104, 0.2); color: #7a7590; }
.badge-basic     { background: var(--info-dim); color: var(--info); }
.badge-advanced  { background: rgba(0, 221, 179, 0.10); color: #00ddb3; }
.badge-pro       { background: var(--warning-dim); color: var(--warning); }
.badge-success   { background: var(--success-dim); color: var(--success); }
.badge-danger    { background: var(--danger-dim); color: var(--danger); }
.badge-warning   { background: var(--warning-dim); color: var(--warning); }
.badge-info      { background: var(--info-dim); color: var(--info); }

/* ── Alerts ─────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--r-md);
    margin-bottom: 14px;
    font-weight: 500;
    font-size: 0.88rem;
    border: 1px solid;
}

.alert-success { background: var(--success-dim); border-color: rgba(52,211,153,.18); color: var(--success); }
.alert-danger  { background: var(--danger-dim);  border-color: rgba(244,63,94,.18);  color: var(--danger); }
.alert-warning { background: var(--warning-dim); border-color: rgba(245,158,11,.18); color: var(--warning); }
.alert-info    { background: var(--info-dim);    border-color: rgba(96,165,250,.18);  color: var(--info); }

/* ── Auth Pages ─────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: transparent;
    position: relative;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: 15%;
    right: 25%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, var(--accent-glow), transparent 70%);
    pointer-events: none;
    animation: heroPulse 10s ease-in-out infinite;
}

.auth-wrapper::after {
    content: '';
    position: absolute;
    bottom: 8%;
    left: 15%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, var(--accent-warm-dim), transparent 70%);
    pointer-events: none;
    animation: heroPulse 12s ease-in-out infinite reverse;
}

.auth-card {
    background: rgba(var(--bg-card-rgb, 22,32,25), 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 32px;
    width: 100%;
    max-width: 400px;
    position: relative;
}

[data-theme="light"] .auth-card {
    background: rgba(255, 255, 255, 0.96);
}

.auth-card h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 4px;
    color: var(--text-white);
    text-align: center;
}

.auth-card .subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 24px;
    font-size: 0.88rem;
}

.auth-divider {
    text-align: center;
    margin: 16px 0;
    position: relative;
}
.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    height: 1px;
    background: var(--border);
}
.auth-divider span {
    background: var(--bg-card);
    padding: 0 12px;
    position: relative;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.auth-footer {
    text-align: center;
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ── Footer ─────────────────────────────────── */
.footer {
    background: rgba(var(--bg-base-rgb, 13,18,16), 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-top: 1px solid var(--border);
    padding: 40px 0 20px;
}

[data-theme="light"] .footer {
    background: rgba(var(--bg-base-rgb, 238,245,242), 0.88);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 32px;
    margin-bottom: 24px;
}

.footer h4 {
    color: var(--text-white);
    margin-bottom: 12px;
    font-size: 0.9rem;
    font-weight: 700;
}

.footer p { color: var(--text-secondary); font-size: 0.85rem; }

.footer a {
    display: block;
    color: var(--text-muted);
    padding: 2px 0;
    font-size: 0.85rem;
    transition: color var(--duration) var(--ease);
}

.footer a:hover { color: var(--accent); }

.footer-bottom {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ── Loading / Animations ───────────────────── */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
}

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

.fade-in { animation: fadeIn 0.35s var(--ease) forwards; }

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

.slide-up { animation: slideUp 0.4s var(--ease) forwards; }

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

/* ── Toast ──────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    width: auto;
    max-width: calc(100vw - 32px);
}

.toast {
    padding: 10px 20px;
    border-radius: var(--r-md);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    animation: toastIn 0.25s var(--ease) forwards;
    margin-bottom: 6px;
    min-width: 260px;
    text-align: center;
}

.toast-success { background: rgba(52, 211, 153, 0.92); }
.toast-error   { background: rgba(244, 63, 94, 0.92); }
.toast-warning { background: rgba(245, 158, 11, 0.92); color: var(--bg-root); }

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

/* ── API Docs ───────────────────────────────── */
.api-endpoint {
    background: rgba(var(--bg-card-rgb, 22,32,25), 0.93);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-bottom: 10px;
    overflow: hidden;
}

[data-theme="light"] .api-endpoint {
    background: rgba(255, 255, 255, 0.93);
}

.api-endpoint-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background var(--duration) var(--ease);
}

.api-endpoint-header:hover { background: var(--accent-dim); }

.api-method {
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.api-method.get    { background: var(--success-dim); color: var(--success); }
.api-method.post   { background: var(--info-dim);    color: var(--info); }
.api-method.put    { background: var(--warning-dim);  color: var(--warning); }
.api-method.delete { background: var(--danger-dim);   color: var(--danger); }

.api-path { font-family: var(--font-mono); color: var(--text-primary); font-size: 0.82rem; }

.api-endpoint-body {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border);
    display: none;
}

.api-endpoint.open .api-endpoint-body {
    display: block;
    padding-top: 12px;
}

.code-block {
    background: var(--bg-root);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    overflow-x: auto;
    color: var(--text-secondary);
    direction: ltr;
    text-align: left;
    line-height: 1.55;
}

/* ── Modal ──────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    display: none;
    padding: 16px;
}

.modal-overlay.active { display: flex; }

.modal {
    background: rgba(var(--bg-card-rgb, 22,32,25), 0.97);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 24px;
    width: 90%;
    max-width: 460px;
    animation: fadeIn 0.2s var(--ease);
    max-height: 90vh;
    overflow-y: auto;
}

[data-theme="light"] .modal {
    background: rgba(255, 255, 255, 0.97);
}

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

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color var(--duration) var(--ease);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover { color: var(--text-white); }

/* ── Search Box ─────────────────────────────── */
.search-box { position: relative; }
.search-box .form-control { padding-right: 40px; }
.search-box .search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* ── Progress Bar ───────────────────────────── */
.progress-bar {
    height: 5px;
    background: var(--bg-elevated);
    border-radius: var(--r-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: var(--r-full);
    background: var(--accent);
    transition: width 0.5s var(--ease);
}

/* ── Utility Classes ────────────────────────── */
.text-accent  { color: var(--accent) !important; }
.text-warm    { color: var(--accent-warm) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }

.gap-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }

.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }

/* ── Page-specific ──────────────────────────── */

/* Dashboard welcome */
.dash-welcome {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.dash-welcome h2 {
    color: var(--text-white);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.2px;
}

.dash-welcome p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 1px;
}

/* Billing toggle */
.billing-toggle { display: flex; gap: 8px; }

.billing-option {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--bg-input);
    border-radius: var(--r-md);
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.billing-option:hover { border-color: var(--border-light); }
.billing-option.selected { border-color: var(--accent); background: var(--accent-dim); }
.billing-option strong { color: var(--text-white); font-size: 0.88rem; }
.billing-option small  { color: var(--text-secondary); font-size: 0.78rem; display: block; }

/* Key display */
.key-display {
    font-family: var(--font-mono);
    color: var(--text-muted);
    direction: ltr;
    font-size: 0.82rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 16px;
}

.empty-state .empty-icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 14px;
    font-size: 0.92rem;
}

/* Inline banner */
.inline-banner {
    background: rgba(var(--bg-card-rgb, 22,32,25), 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px 20px;
    max-width: 660px;
    margin: 10px auto;
    text-align: center;
}

[data-theme="light"] .inline-banner {
    background: rgba(255, 255, 255, 0.80);
}

.inline-banner.accent-border { border-color: var(--accent); }
.inline-banner.warm-border   { border-color: var(--accent-warm); }

/* Payment account display */
.payment-account {
    background: var(--bg-root);
    border-radius: var(--r-md);
    padding: 18px;
    text-align: center;
}

.payment-account .account-number {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 2px;
    font-family: var(--font-mono);
}

/* ── Hero Split Layout ──────────────────────── */
.hero-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

.hero-headline h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1.2;
    letter-spacing: -0.4px;
    margin-bottom: 0;
}

.hero-headline .accent { color: var(--accent); }

.hero-headline .section-subtitle {
    margin-top: 14px;
    text-align: right;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 12px;
    background: var(--accent-dim);
    border: 1px solid rgba(0, 221, 179, 0.14);
    border-radius: var(--r-full);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 14px;
}

.hero-grid-pattern {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: 0.08;
    pointer-events: none;
}

.hero-footnote {
    text-align: center;
    margin-top: 28px;
    position: relative;
    z-index: 1;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.hero-footnote a { color: var(--accent); font-weight: 600; }

/* ── Terminal UI ────────────────────────────── */
.hero-terminal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.terminal-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border-light);
}

.terminal-dot:nth-child(1) { background: #ff5f57; }
.terminal-dot:nth-child(2) { background: #ffbd2e; }
.terminal-dot:nth-child(3) { background: #28ca42; }

.terminal-title {
    margin-right: auto;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-family: var(--font-mono);
    letter-spacing: 0.2px;
}

.terminal-body { padding: 16px; }

.terminal-prompt {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.prompt-symbol {
    color: var(--accent);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.88rem;
    outline: none;
    direction: ltr;
}

.terminal-input::placeholder { color: var(--text-muted); }

.terminal-options {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.terminal-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-family: var(--font-mono);
}

.terminal-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-primary);
    padding: 5px 10px;
    font-size: 0.82rem;
    font-family: var(--font);
    appearance: none;
    cursor: pointer;
}

.terminal-results { margin-top: 10px; }

/* ── Grain overlay ──────────────────────────── */
/* REMOVED: was causing foggy/dark appearance at z-index 9999 opacity 0.4 */
/* .page-wrapper::before { content: ''; position: fixed; inset: 0; ... } */

/* ── Sidebar Overlay (mobile) ──────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-overlay.active { display: block; }

/* ── Sidebar mobile toggle ─────────────────── */
.sidebar-mobile-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
    width: fit-content;
    font-family: var(--font);
    transition: var(--transition);
    min-height: 44px;
}
.sidebar-mobile-toggle:hover {
    background: var(--accent-dim);
    color: var(--text-white);
}

/* ── Logo & Image Assets ───────────────────── */
.navbar-brand .logo-img {
    width: 34px;
    height: 34px;
    border-radius: var(--r-md);
    flex-shrink: 0;
    object-fit: contain;
    filter: drop-shadow(0 0 6px var(--accent-glow));
    transition: filter var(--duration) var(--ease);
}
.navbar-brand:hover .logo-img {
    filter: drop-shadow(0 0 12px var(--accent-glow));
}

.navbar-brand .logo-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: -0.2px;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.15) 100%);
    pointer-events: none;
    z-index: 0;
}

[data-theme="light"] .hero-overlay {
    background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.15) 100%);
}

.hero-badge-logo {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    object-fit: contain;
    filter: drop-shadow(0 0 4px var(--accent-glow));
}

.feature-img {
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
    border-radius: var(--r-lg);
    object-fit: cover;
    filter: drop-shadow(0 0 6px var(--accent-glow));
    transition: filter var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.feature-card:hover .feature-img {
    filter: drop-shadow(0 0 12px var(--accent-glow));
    transform: scale(1.05);
}

/* Search illustration */
.search-illustration {
    max-width: 400px;
    margin: 0 auto;
    display: block;
    border-radius: var(--r-lg);
}

/* Footer logo */
.footer-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--r-md);
    object-fit: contain;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 6px var(--accent-glow));
}

/* Auth page logo */
.auth-logo-wrap {
    text-align: center;
    margin-bottom: 8px;
}

.auth-logo {
    width: 56px;
    height: 56px;
    border-radius: var(--r-md);
    object-fit: contain;
    margin: 0 auto 12px;
    display: block;
}

/* ── Day/Night Logo Switching ──────────────── */
.logo-dark {
    display: inline-block;
}

.logo-light {
    display: none;
}

[data-theme="light"] .logo-dark {
    display: none;
}

[data-theme="light"] .logo-light {
    display: inline-block;
}

[data-theme="dark"] .logo-dark {
    display: inline-block;
}

[data-theme="dark"] .logo-light {
    display: none;
}

/* ── Theme Toggle ──────────────────────────── */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-light);
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    width: 34px;
    height: 34px;
    flex-shrink: 0;
}
.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-dim);
}
.theme-icon {
    width: 18px;
    height: 18px;
}
.theme-icon.sun { display: none; }
.theme-icon.moon { display: block; }
[data-theme="dark"] .theme-icon.sun { display: none; }
[data-theme="dark"] .theme-icon.moon { display: block; }
[data-theme="light"] .theme-icon.sun { display: block; }
[data-theme="light"] .theme-icon.moon { display: none; }

/* =============================================
   RESPONSIVE — Comprehensive Multi-Breakpoint
   Breakpoints:
     • Small phones:     320px – 480px
     • Large phones:     480px – 768px
     • Tablets:          768px – 1024px
     • Desktops:         1024px – 1400px
     • Large screens:    1400px+
   ============================================= */

/* ─────────────────────────────────────────────
   1. LARGE SCREENS — 1400px+
   ───────────────────────────────────────────── */
@media (min-width: 1400px) {
    :root { --container: 1280px; }

    .hero-headline h1 { font-size: 3rem; }

    .hero h1 { font-size: 3rem; }

    .section-title { font-size: 2rem; }

    .features-grid { gap: 18px; }

    .pricing-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; }

    .pricing-price { font-size: 2.1rem; }

    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

    .footer-grid { gap: 48px; }

    .dashboard-content { max-width: 1060px; }
}

/* ─────────────────────────────────────────────
   2. DESKTOPS — 1024px to 1399px
   ───────────────────────────────────────────── */
@media (min-width: 1024px) and (max-width: 1399px) {
    :root { --container: 1000px; }

    .hero-headline h1 { font-size: 2.4rem; }

    .hero h1 { font-size: 2.4rem; }

    .pricing-grid { grid-template-columns: repeat(4, 1fr); }

    .features-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ─────────────────────────────────────────────
   3. TABLETS — 768px to 1024px
   ───────────────────────────────────────────── */
@media (max-width: 1024px) {
    /* Container & Layout */
    .container { padding: 0 16px; }

    /* Hero split to single column */
    .hero-split {
        grid-template-columns: 1fr;
        gap: 28px;
        text-align: center;
    }

    .hero-headline h1 { font-size: 2rem; }

    .hero-headline .section-subtitle { text-align: center; }

    .hero-terminal {
        max-width: 480px;
        margin: 0 auto;
    }

    /* Features: 2 cols on tablet */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .feature-card { padding: 20px 18px; }

    /* Pricing: 2 cols on tablet */
    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 24px 0;
        gap: 12px;
    }

    .pricing-card { padding: 20px; }

    /* Section headers */
    .section-title { font-size: 1.5rem; }
    .section-subtitle { font-size: 0.9rem; }
    .section-header { margin-bottom: 32px; }

    /* Footer: 2 cols */
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }

    /* Dashboard: sidebar still visible but narrower */
    :root { --sidebar-w: 190px; }

    .dashboard-content {
        padding: 20px 22px;
        max-width: 100%;
    }

    /* Stats grid */
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 8px;
    }

    /* Auth card */
    .auth-card { max-width: 380px; padding: 28px; }

    /* Modal */
    .modal { max-width: 440px; padding: 22px; }

    /* Terminal options may wrap */
    .terminal-options { gap: 6px; }
}

/* ─────────────────────────────────────────────
   4. LARGE PHONES — 480px to 767px
   ───────────────────────────────────────────── */
/* ── Mobile: disable fixed background for performance ── */
@media (max-width: 1024px) {
    body {
        background-attachment: scroll;
    }
}

@media (max-width: 768px) {
    :root {
        --navbar-h: 52px;
        --sidebar-w: 260px;
    }

    /* Container */
    .container { padding: 0 14px; }

    /* ── Navbar mobile ── */
    .navbar { padding: 0 14px; }

    .navbar-brand {
        font-size: 0.95rem;
        gap: 6px;
    }

    .navbar-brand .logo-icon {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .navbar-brand .logo-img {
        width: 30px;
        height: 30px;
    }

    .navbar-brand .logo-text {
        font-size: 0.95rem;
    }

    .navbar-nav {
        display: none;
        position: fixed;
        top: var(--navbar-h);
        left: 0;
        right: 0;
        background: var(--navbar-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
        z-index: var(--z-navbar);
        gap: 2px;
        animation: fadeIn 0.2s var(--ease);
    }
    .navbar-nav.active { display: flex; }

    .navbar-nav a {
        padding: 12px 14px;
        border-radius: var(--r-sm);
        font-size: 0.9rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .navbar-nav a.active::after {
        right: 0;
        left: auto;
        bottom: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 2px;
        height: 60%;
    }

    .navbar-actions .btn-ghost { display: none; }

    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }

    /* ── Hero mobile ── */
    .hero {
        padding: 40px 0 32px;
    }

    .hero h1 { font-size: 1.6rem; }

    .hero .subtitle {
        font-size: 0.92rem;
        max-width: 100%;
        margin-bottom: 24px;
    }

    .hero-split {
        gap: 20px;
        padding: 0 14px;
    }

    .hero-headline h1 { font-size: 1.6rem; }

    .hero-search {
        flex-direction: column;
        padding: 8px;
        max-width: 100%;
    }

    .hero-search select.form-control {
        max-width: 100%;
        border-left: none;
        border-bottom: 1px solid var(--border);
        border-radius: 0;
    }

    .hero-search .btn {
        border-radius: var(--r-sm);
        padding: 12px 20px;
        min-height: 44px;
    }

    /* ── Features mobile ── */
    .features { padding: 40px 0; }

    .features-grid { grid-template-columns: 1fr; gap: 10px; }

    .feature-card { padding: 20px 16px; }

    .feature-img {
        width: 48px;
        height: 48px;
    }

    .feature-card:hover { transform: none; }

    /* ── Pricing mobile ── */
    .pricing-section { padding: 40px 0; }

    .pricing-grid {
        grid-template-columns: 1fr;
        padding: 20px 0;
        gap: 12px;
    }

    .pricing-card { padding: 20px 16px; }

    .pricing-card:hover { transform: none; }

    .pricing-price { font-size: 1.7rem; }

    /* ── Dashboard layout mobile rules moved to consolidated 768px block below ── */

    /* ── Stats mobile ── */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card { padding: 12px; }

    .stat-card .stat-value { font-size: 1.2rem; }

    /* ── Auth mobile ── */
    .auth-wrapper {
        padding: 16px;
        align-items: flex-start;
        padding-top: 60px;
    }

    .auth-card {
        padding: 20px 16px;
        margin: 0 auto;
        border-radius: var(--r-lg);
    }

    .auth-card h2 { font-size: 1.25rem; }

    .auth-card .form-control {
        min-height: 44px;
    }

    .auth-card .btn {
        min-height: 44px;
    }

    /* ── Footer mobile ── */
    .footer { padding: 28px 0 16px; }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* ── Section headers ── */
    .section-title { font-size: 1.4rem; }
    .section-subtitle { font-size: 0.88rem; }
    .section-header { margin-bottom: 28px; }

    /* ── Cards mobile ── */
    .card { padding: 16px; }
    .card-header { margin-bottom: 12px; padding-bottom: 10px; }

    /* ── Tables ── */
    .table-wrapper {
        margin-left: -14px;
        margin-right: -14px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .data-table { min-width: 500px; }
    .data-table th, .data-table td { padding: 8px 10px; font-size: 0.8rem; }

    /* ── Inline banner ── */
    .inline-banner { padding: 14px 16px; }

    /* ── Billing toggle ── */
    .billing-toggle { flex-direction: column; gap: 6px; }
    .billing-option { padding: 10px; min-height: 44px; }

    /* ── Result items ── */
    .result-item {
        padding: 10px 14px;
    }

    /* ── Toast ── */
    .toast-container {
        left: 12px;
        right: 12px;
        transform: none;
        width: auto;
    }

    .toast {
        min-width: unset;
        width: 100%;
        font-size: 0.82rem;
        padding: 8px 14px;
    }

    /* ── Modal ── */
    .modal-overlay { padding: 12px; align-items: flex-end; }
    .modal {
        width: 100%;
        max-width: none;
        border-radius: var(--r-lg) var(--r-lg) 0 0;
        max-height: 85vh;
        padding: 20px 16px;
    }

    .modal-close { min-width: 44px; min-height: 44px; }

    /* ── Terminal ── */
    .hero-terminal { border-radius: var(--r-md); }
    .terminal-body { padding: 12px; }
    .terminal-prompt { gap: 6px; }
    .terminal-input { font-size: 0.82rem; }
    .terminal-options { gap: 6px; }
    .terminal-select {
        padding: 8px 10px;
        font-size: 0.8rem;
        min-height: 44px;
    }

    /* ── Hero footnote ── */
    .hero-footnote { font-size: 0.8rem; margin-top: 20px; }

    /* ── Hero badge ── */
    .hero-badge { font-size: 0.68rem; padding: 3px 10px; }

    /* ── Search box ── */
    .search-box .form-control { min-height: 44px; }

    /* ── API endpoint ── */
    .api-endpoint-header {
        padding: 10px 14px;
        min-height: 44px;
        flex-wrap: wrap;
    }

    .api-path { font-size: 0.78rem; word-break: break-all; }

    /* ── Code block ── */
    .code-block { padding: 10px; font-size: 0.75rem; }

    /* ── Buttons: touch-friendly ── */
    .btn { min-height: 38px; }
    .btn-sm { min-height: 34px; }
    .btn-lg { min-height: 48px; }

    /* ── Empty state ── */
    .empty-state { padding: 32px 14px; }
    .empty-state .empty-icon { font-size: 1.8rem; }

    /* ── Dash welcome ── */
    .dash-welcome h2 { font-size: 1.15rem; }

    /* ── Payment account ── */
    .payment-account .account-number { font-size: 1.2rem; letter-spacing: 1px; }

    /* ── Key display ── */
    .key-display { font-size: 0.75rem; word-break: break-all; }

    /* ── Theme toggle touch-friendly ── */
    .theme-toggle {
        width: 38px;
        height: 38px;
    }

    /* ── Auth divider ── */
    .auth-divider span { font-size: 0.75rem; }
}

/* ─────────────────────────────────────────────
   5. SMALL PHONES — 320px to 480px
   ───────────────────────────────────────────── */
@media (max-width: 480px) {
    :root {
        --navbar-h: 50px;
        --sidebar-w: 85vw;
    }

    /* Container */
    .container { padding: 0 12px; }

    /* ── Navbar tiny ── */
    .navbar { padding: 0 10px; }

    .navbar-brand {
        font-size: 0.88rem;
        gap: 5px;
    }

    .navbar-brand .logo-icon {
        width: 26px;
        height: 26px;
        font-size: 0.75rem;
    }

    .navbar-brand .logo-img {
        width: 28px;
        height: 28px;
    }

    .navbar-brand .logo-text {
        font-size: 0.88rem;
    }

    .navbar-nav {
        padding: 10px 12px;
    }

    .navbar-nav a {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    /* ── Hero tiny ── */
    .hero {
        padding: 28px 0 24px;
    }

    .hero h1 { font-size: 1.25rem; letter-spacing: -0.3px; }

    .hero .subtitle {
        font-size: 0.85rem;
        margin-bottom: 20px;
        line-height: 1.6;
    }

    .hero-split { gap: 16px; padding: 0 12px; }

    .hero-headline h1 { font-size: 1.25rem; }

    .hero-headline .section-subtitle { font-size: 0.85rem; margin-top: 10px; }

    .hero-badge {
        font-size: 0.65rem;
        padding: 2px 8px;
        margin-bottom: 10px;
    }

    .hero-search { padding: 6px; gap: 4px; }

    .hero-search .form-control {
        padding: 10px 10px;
        font-size: 0.88rem;
    }

    .hero-search select.form-control {
        padding: 10px 10px;
        border-bottom: 1px solid var(--border);
    }

    .hero-search .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .hero-footnote {
        font-size: 0.75rem;
        margin-top: 16px;
    }

    /* ── Hero before glow smaller ── */
    .hero::before {
        width: 280px;
        height: 280px;
    }

    /* ── Terminal tiny ── */
    .terminal-bar { padding: 6px 10px; }
    .terminal-dot { width: 6px; height: 6px; }
    .terminal-title { font-size: 0.62rem; }
    .terminal-body { padding: 10px; }
    .terminal-prompt { gap: 4px; margin-bottom: 8px; }
    .prompt-symbol { font-size: 0.82rem; }
    .terminal-input { font-size: 0.78rem; }
    .terminal-label { font-size: 0.7rem; }

    .terminal-options {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .terminal-select {
        width: 100%;
        min-height: 44px;
    }

    /* ── Section headers tiny ── */
    .section-title { font-size: 1.2rem; }
    .section-label { font-size: 0.65rem; padding: 2px 8px; }
    .section-subtitle { font-size: 0.82rem; }
    .section-header { margin-bottom: 24px; }

    /* ── Features tiny ── */
    .features { padding: 28px 0; }
    .feature-card {
        padding: 16px 14px;
    }
    .feature-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    .feature-card h3 { font-size: 0.92rem; }
    .feature-card p { font-size: 0.8rem; }

    .feature-img {
        width: 42px;
        height: 42px;
    }

    /* ── Pricing tiny ── */
    .pricing-section { padding: 28px 0; }
    .pricing-grid { padding: 16px 0; gap: 10px; }
    .pricing-card { padding: 16px 14px; }
    .pricing-plan { font-size: 0.92rem; }
    .pricing-price { font-size: 1.5rem; margin: 8px 0; }
    .pricing-price span { font-size: 0.78rem; }
    .pricing-features li { font-size: 0.8rem; padding: 5px 0; }

    /* ── Dashboard tiny ── */
    .dashboard-content { padding: 14px 12px; }

    .sidebar-mobile-toggle {
        padding: 8px 10px;
        font-size: 0.82rem;
        margin-bottom: 12px;
    }

    /* ── Stats tiny ── */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .stat-card { padding: 10px; }
    .stat-card .stat-icon { width: 28px; height: 28px; font-size: 0.82rem; margin-bottom: 6px; }
    .stat-card .stat-value { font-size: 1.1rem; }
    .stat-card .stat-label { font-size: 0.7rem; }

    /* ── Dash welcome tiny ── */
    .dash-welcome {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .dash-welcome h2 { font-size: 1.05rem; }
    .dash-welcome p { font-size: 0.82rem; }

    /* ── Result items tiny ── */
    .result-item {
        flex-wrap: wrap;
        padding: 10px 12px;
        gap: 4px;
    }

    .result-name {
        font-size: 0.88rem;
        width: 100%;
    }

    .result-number {
        font-size: 0.82rem;
    }

    /* ── Tables tiny ── */
    .table-wrapper {
        margin-left: -12px;
        margin-right: -12px;
    }

    .data-table { min-width: 380px; }
    .data-table th, .data-table td { padding: 7px 8px; font-size: 0.75rem; }

    /* ── Auth tiny ── */
    .auth-wrapper { padding: 12px; padding-top: 40px; }
    .auth-card {
        padding: 18px 14px;
        border-radius: var(--r-md);
    }
    .auth-card h2 { font-size: 1.15rem; }
    .auth-card .subtitle { font-size: 0.82rem; margin-bottom: 18px; }
    .auth-footer { font-size: 0.82rem; }

    /* ── Cards tiny ── */
    .card { padding: 14px 12px; border-radius: var(--r-md); }
    .card-header { margin-bottom: 10px; padding-bottom: 8px; }
    .card-title { font-size: 0.88rem; }

    /* ── Forms tiny ── */
    .form-group { margin-bottom: 12px; }
    .form-label { font-size: 0.78rem; margin-bottom: 4px; }
    .form-control {
        padding: 10px 10px;
        font-size: 0.85rem;
        min-height: 44px;
    }

    .input-group {
        flex-direction: column;
        gap: 6px;
    }

    /* ── Buttons tiny ── */
    .btn {
        padding: 10px 16px;
        font-size: 0.82rem;
        min-height: 44px;
    }

    .btn-sm {
        padding: 8px 12px;
        font-size: 0.76rem;
        min-height: 38px;
    }

    .btn-lg {
        padding: 12px 20px;
        font-size: 0.9rem;
        min-height: 48px;
    }

    /* ── Footer tiny ── */
    .footer { padding: 20px 0 12px; }
    .footer-grid { gap: 16px; }
    .footer h4 { font-size: 0.85rem; margin-bottom: 8px; }
    .footer p { font-size: 0.82rem; }
    .footer a { font-size: 0.82rem; }
    .footer-bottom { font-size: 0.72rem; padding-top: 12px; }

    /* ── Toast tiny ── */
    .toast-container {
        left: 8px;
        right: 8px;
        top: 8px;
    }

    .toast {
        font-size: 0.78rem;
        padding: 8px 12px;
    }

    /* ── Modal tiny ── */
    .modal-overlay { padding: 8px; }
    .modal {
        padding: 16px 14px;
        border-radius: var(--r-md) var(--r-md) 0 0;
        max-height: 90vh;
    }

    /* ── Badges tiny ── */
    .badge { font-size: 0.65rem; padding: 1px 7px; }

    /* ── Alerts tiny ── */
    .alert {
        padding: 10px 12px;
        font-size: 0.82rem;
        margin-bottom: 10px;
    }

    /* ── Search box tiny ── */
    .search-box .form-control { min-height: 44px; padding-right: 36px; }
    .search-box .search-icon { right: 10px; }

    /* ── Inline banner tiny ── */
    .inline-banner { padding: 12px 14px; border-radius: var(--r-md); }

    /* ── Payment account tiny ── */
    .payment-account { padding: 14px; }
    .payment-account .account-number { font-size: 1.1rem; letter-spacing: 1px; }

    /* ── Key display tiny ── */
    .key-display { font-size: 0.7rem; }

    /* ── Empty state tiny ── */
    .empty-state { padding: 24px 12px; }
    .empty-state .empty-icon { font-size: 1.6rem; }
    .empty-state p { font-size: 0.85rem; margin-bottom: 10px; }

    /* ── API docs tiny ── */
    .api-method { font-size: 0.6rem; padding: 1px 5px; }
    .api-path { font-size: 0.72rem; }
    .code-block { padding: 8px; font-size: 0.7rem; line-height: 1.45; }

    /* ── Billing toggle tiny ── */
    .billing-toggle { gap: 4px; }
    .billing-option { padding: 8px; gap: 6px; }
    .billing-option strong { font-size: 0.82rem; }
    .billing-option small { font-size: 0.72rem; }

    /* ── Progress bar tiny ── */
    .progress-bar { height: 4px; }

    /* ── Theme toggle tiny ── */
    .theme-toggle { width: 36px; height: 36px; }
    .theme-icon { width: 16px; height: 16px; }

    /* ── Search illustration tiny ── */
    .search-illustration { max-width: 280px; }

    /* ── Auth divider tiny ── */
    .auth-divider { margin: 12px 0; }
    .auth-divider span { font-size: 0.7rem; padding: 0 8px; }

    /* ── Auth logo tiny ── */
    .auth-logo { width: 44px; height: 44px; margin-bottom: 8px; }

    /* ── Footer logo tiny ── */
    .footer-logo { width: 32px; height: 32px; }

    /* ── Spinner tiny ── */
    .spinner { width: 16px; height: 16px; }

    /* ── Utility adjustments ── */
    .gap-xs { gap: 2px; }
    .gap-sm { gap: 4px; }
    .gap-md { gap: 10px; }
    .gap-lg { gap: 16px; }
}

/* ─────────────────────────────────────────────
   6. VERY SMALL PHONES — 320px and below
   ───────────────────────────────────────────── */
@media (max-width: 340px) {
    :root { --navbar-h: 48px; }

    .navbar-brand { font-size: 0.82rem; gap: 4px; }
    .navbar-brand .logo-icon { width: 24px; height: 24px; font-size: 0.7rem; }
    .navbar-brand .logo-img { width: 26px; height: 26px; }
    .navbar-brand .logo-text { font-size: 0.82rem; }

    .hero h1 { font-size: 1.1rem; }
    .hero-headline h1 { font-size: 1.1rem; }
    .hero .subtitle { font-size: 0.8rem; }

    .section-title { font-size: 1.1rem; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 4px; }
    .stat-card .stat-value { font-size: 1rem; }

    .data-table { min-width: 320px; }

    .pricing-price { font-size: 1.35rem; }

    .btn { padding: 10px 14px; font-size: 0.8rem; }
}

/* ─────────────────────────────────────────────
   7. SAFE AREA / NOTCHED PHONES
   ───────────────────────────────────────────── */
@supports (padding: env(safe-area-inset-top)) {
    .navbar {
        padding-top: env(safe-area-inset-top);
        height: calc(var(--navbar-h) + env(safe-area-inset-top));
    }

    .sidebar.open {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .modal-overlay {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .footer {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .toast-container {
        top: calc(16px + env(safe-area-inset-top));
    }

    .auth-wrapper {
        padding-top: calc(60px + env(safe-area-inset-top));
        padding-bottom: env(safe-area-inset-bottom);
    }

    .sidebar {
        top: calc(var(--navbar-h) + env(safe-area-inset-top));
        height: calc(100vh - var(--navbar-h) - env(safe-area-inset-top));
    }
}

/* ─────────────────────────────────────────────
   8. LANDSCAPE PHONES — Height < 500px
   ───────────────────────────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
    .hero { padding: 20px 0 16px; }
    .hero h1 { font-size: 1.3rem; }
    .hero-headline h1 { font-size: 1.3rem; }
    .hero .subtitle { margin-bottom: 16px; }

    .hero-split {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .features { padding: 28px 0; }
    .pricing-section { padding: 28px 0; }

    .footer { padding: 20px 0 12px; }

    .auth-wrapper {
        padding: 12px;
        align-items: center;
        min-height: auto;
        padding-top: 20px;
    }

    .auth-card { padding: 16px; }
    .auth-card h2 { font-size: 1.1rem; }

    .modal {
        max-height: 95vh;
    }

    .sidebar {
        top: var(--navbar-h);
        height: calc(100vh - var(--navbar-h));
    }

    .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ─────────────────────────────────────────────
   9. PRINT STYLES
   ───────────────────────────────────────────── */
@media print {
    .navbar,
    .sidebar,
    .sidebar-overlay,
    .sidebar-mobile-toggle,
    .mobile-toggle,
    .theme-toggle,
    .toast-container,
    .modal-overlay,
    .page-wrapper::before,
    .hero::before,
    .auth-wrapper::before,
    .auth-wrapper::after {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
        direction: rtl;
    }

    .dashboard-layout {
        display: block;
    }

    .dashboard-content {
        max-width: 100%;
        padding: 0;
    }

    .card {
        border: 1px solid #ddd;
        break-inside: avoid;
    }

    .data-table {
        min-width: unset;
    }

    a { color: #000; text-decoration: underline; }
}

/* ─────────────────────────────────────────────
   10. REDUCED MOTION
   ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .hero::before { animation: none; opacity: 0.3; }
    .auth-wrapper::before { animation: none; opacity: 0.3; }
    .auth-wrapper::after { animation: none; opacity: 0.3; }

    html { scroll-behavior: auto; }
}

/* ─────────────────────────────────────────────
   11. HIGH CONTRAST MODE
   ───────────────────────────────────────────── */
@media (prefers-contrast: high) {
    .card { border-width: 2px; }
    .form-control { border-width: 2px; }
    .btn { border-width: 2px; }
    .badge { border: 1px solid currentColor; }

    :root, [data-theme="dark"] {
        --border: #3a5e4e;
        --border-light: #4a7e6e;
    }
}

/* ─────────────────────────────────────────────
   12. HOVER MEDIA QUERY — Touch devices
   Only show hover effects on devices that
   actually support hover (non-touch primary)
   ───────────────────────────────────────────── */
@media (hover: none) {
    .feature-card:hover { transform: none; }
    .pricing-card:hover { transform: none; }
    .btn-primary:hover { transform: none; }

    .feature-card:hover::before { opacity: 0; }

    /* Make all interactive items clearly tappable */
    .navbar-nav a:active,
    .sidebar-nav a:active {
        background: var(--accent-dim);
    }

    .result-item:active {
        border-color: var(--accent);
        background: var(--accent-dim);
    }
}

/* ─────────────────────────────────────────────
   MISSING BASE STYLES — Referenced in HTML
   but not previously defined in CSS
   ───────────────────────────────────────────── */

/* Sidebar mobile toggle button */
.sidebar-mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: var(--accent-dim);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--accent);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-mobile-toggle:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.sidebar-mobile-toggle:active {
    transform: scale(0.98);
}

.sidebar-mobile-toggle .toggle-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Sidebar overlay — dark backdrop behind mobile sidebar */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    display: none;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-overlay.active {
    display: block;
}

/* Logo image — used in navbar brand */
.logo-img {
    height: 28px;
    width: auto;
    display: none;
    flex-shrink: 0;
    object-fit: contain;
}

/* Show dark logo in dark mode */
[data-theme="dark"] .logo-dark,
:root:not([data-theme="light"]) .logo-dark {
    display: inline-block;
}

[data-theme="dark"] .logo-light,
:root:not([data-theme="light"]) .logo-light {
    display: none;
}

/* Show light logo in light mode */
[data-theme="light"] .logo-light {
    display: inline-block;
}

[data-theme="light"] .logo-dark {
    display: none;
}

/* Navbar brand logo image variant */
.navbar-brand .logo-img {
    height: 30px;
    width: auto;
}

/* Footer logo */
.footer-logo {
    height: 32px;
    width: auto;
    display: inline-block;
    object-fit: contain;
    margin-bottom: 8px;
}

/* Theme toggle button */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Theme icon (sun/moon) */
.theme-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    transition: transform var(--duration) var(--ease);
}

.theme-toggle:hover .theme-icon {
    transform: rotate(15deg);
}

/* Show sun icon in dark mode, moon in light mode */
[data-theme="dark"] .icon-sun { display: inline-block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: inline-block; }

/* ─────────────────────────────────────────────
   RESPONSIVE FIXES — 768px and below
   Overrides/corrects existing media query values
   ───────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Container tighter padding */
    .container { padding: 0 12px; }

    /* Navbar adjustments */
    .navbar-brand .logo-text { font-size: 0.9rem; }
    .navbar-brand .logo-icon { display: inline-flex; }

    /* Logo image on mobile */
    .logo-img { height: 28px; }
    .navbar-brand .logo-img { height: 28px; }

    /* Hero — correct h1 to 1.8rem as specified */
    .hero h1 { font-size: 1.8rem; }
    .hero { padding: 40px 0 32px; }

    /* Dashboard content tighter padding */
    .dashboard-content { padding: 16px; max-width: 100%; }

    /* Auth card — full width on mobile */
    .auth-card {
        max-width: 100%;
        padding: 24px 20px;
    }

    /* Result items — stacked layout on mobile */
    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    /* Dash welcome — stack on mobile */
    .dash-welcome {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Sidebar overlay — ensure visible when active */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        display: none;
        -webkit-tap-highlight-color: transparent;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Prevent body scroll when sidebar is open — DO NOT use position:fixed as it causes page shrink/corruption */
    body.sidebar-open {
        overflow: hidden;
    }

    /* Sidebar mobile toggle — show on mobile */
    .sidebar-mobile-toggle { display: flex; }

    /* Stats grid — 2 columns on mobile */
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    /* Data table — allow horizontal scroll */
    .data-table { min-width: 500px; }

    /* Hero search — column layout on mobile */
    .hero-search { flex-direction: column; }
    .hero-search select.form-control {
        max-width: 100%;
        border-left: none;
    }

    /* Grids — single column on mobile */
    .features-grid { grid-template-columns: 1fr; }
    .pricing-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .dashboard-layout { grid-template-columns: 1fr; min-height: auto; position: relative; }

    /* Hide sidebar column on mobile — sidebar is position:fixed overlay */
    .dashboard-layout > .sidebar {
        display: block; /* keep in DOM for JS but it's position:fixed */
    }

    /* Dashboard content takes full width on mobile */
    .dashboard-layout > .dashboard-content {
        grid-column: 1;
        max-width: 100%;
        width: 100%;
    }

    /* Mobile toggle visible */
    .mobile-toggle { display: flex; }

    /* Navbar nav — dropdown on mobile */
    .navbar-nav {
        display: none;
        position: fixed;
        top: var(--navbar-h);
        left: 0;
        right: 0;
        background: var(--navbar-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
        z-index: var(--z-navbar);
        gap: 2px;
    }
    .navbar-nav.active { display: flex; }

    /* Sidebar — slide-in overlay on mobile */
    .sidebar {
        position: fixed;
        top: var(--navbar-h);
        right: 0;
        bottom: 0;
        width: var(--sidebar-w);
        max-width: 85vw;
        height: calc(100vh - var(--navbar-h));
        transform: translateX(100%);
        z-index: var(--z-sidebar);
        border-left: 1px solid var(--border);
        border-right: none;
        padding: 12px 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        pointer-events: none;
        /* Prevent sidebar from affecting grid layout on mobile */
        grid-column: 1;
        grid-row: 1;
        visibility: hidden;
    }

    .sidebar.open {
        transform: translateX(0);
        pointer-events: auto;
        visibility: visible;
    }

    .sidebar-nav {
        display: flex;
        flex-direction: column;
    }

    .sidebar-nav a {
        padding: 12px 16px;
        font-size: 0.88rem;
        min-height: 44px;
    }

    .sidebar-section { display: block; }
}

/* ─────────────────────────────────────────────
   RESPONSIVE FIXES — 480px and below
   ───────────────────────────────────────────── */
@media (max-width: 480px) {
    /* Hero h1 — 1.5rem on small phones */
    .hero h1 { font-size: 1.5rem; }

    /* Stats grid — 2 columns tight */
    .stats-grid { grid-template-columns: 1fr 1fr; }

    /* Stat value smaller */
    .stat-card .stat-value { font-size: 1.1rem; }

    /* Section title — 1.4rem on small phones */
    .section-title { font-size: 1.4rem; }

    /* Pricing price */
    .pricing-price { font-size: 1.5rem; }

    /* Auth card tighter padding */
    .auth-card { padding: 20px 16px; }

    /* Modal adjustments */
    .modal {
        padding: 16px;
        width: 95%;
    }
}
