@font-face {
    font-family: 'IRANSans';
    src: url('fonts/IRANSansWeb_Regular.woff2') format('woff2'),
         url('fonts/IRANSansWeb_Regular.woff') format('woff');
    font-weight: 400;
}
@font-face {
    font-family: 'IRANSans';
    src: url('fonts/IRANSansWeb_Bold.woff2') format('woff2'),
         url('fonts/IRANSansWeb_Bold.woff') format('woff');
    font-weight: 700;
}

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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --bg: #0f172a;
    --surface: #1e293b;
    --surface2: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --profit: #22c55e;
    --loss: #ef4444;
    --buy-bg: rgba(34,197,94,0.15);
    --sell-bg: rgba(239,68,68,0.15);
}

body {
    font-family: 'IRANSans', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    direction: rtl;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ── Navbar ── */
.navbar {
    background: rgba(15,23,42,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    padding: 0 1.5rem;
    height: 60px;
    display: flex; align-items: center; justify-content: space-between;
}
.navbar-brand {
    display: flex; align-items: center; gap: 8px;
    font-size: 1.2rem; font-weight: 700;
    color: var(--text);
}
.navbar-brand svg { color: var(--primary); width: 24px; height: 24px; }
.navbar-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
    padding: 0.4rem 0.75rem; border-radius: 6px;
    color: var(--text-muted); font-size: 0.875rem; font-weight: 500;
    transition: all 0.15s;
}
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--primary); }
.navbar-actions { display: flex; align-items: center; gap: 8px; }

/* ── Notification button ── */
.notif-btn {
    display: none; /* shown via JS only on mobile when permission=default */
    align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(250,204,21,0.15);
    border: 1.5px solid rgba(250,204,21,0.4);
    color: #facc15; cursor: pointer; flex-shrink: 0;
    animation: notif-pulse 2s infinite;
    position: absolute; right: 1rem;
}
.notif-btn svg { width: 16px; height: 16px; }
@keyframes notif-pulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(250,204,21,0.3); }
    50%      { box-shadow: 0 0 0 6px rgba(250,204,21,0); }
}
@media (min-width: 769px) { .notif-btn { display: none !important; } }

/* ── User dropdown ── */
.nav-sub-btn { display: flex; align-items: center; gap: 6px; }
.sub-badge {
    background: var(--primary); color: #fff;
    font-size: 0.72rem; font-weight: 700;
    padding: 1px 7px; border-radius: 50px;
    margin-right: 2px;
}
.user-menu { position: relative; }
.user-menu-trigger {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; padding: 0.3rem 0.6rem 0.3rem 0.5rem;
    color: var(--text); font-size: 0.85rem; font-weight: 500;
    cursor: pointer; font-family: inherit; transition: border-color 0.15s;
}
.user-menu-trigger:hover { border-color: var(--primary); }
.user-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700; flex-shrink: 0;
}
.user-menu-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown {
    position: absolute; top: calc(100% + 8px); left: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 6px;
    min-width: 180px; z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    display: none;
}
.user-dropdown.open { display: block; }
.dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 0.55rem 0.75rem; border-radius: 7px;
    font-size: 0.875rem; color: var(--text-muted);
    transition: all 0.12s; white-space: nowrap;
}
.dropdown-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.dropdown-item:hover { background: var(--surface2); color: var(--text); }
.dropdown-item-danger { color: #fca5a5; }
.dropdown-item-danger:hover { background: rgba(239,68,68,0.12); color: #fca5a5; }
.dropdown-divider { height: 1px; background: var(--border); margin: 5px 0; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 0.55rem 1.2rem; border-radius: 8px;
    font-size: 0.875rem; font-weight: 600; border: none;
    transition: all 0.15s; cursor: pointer;
}
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface2); }
.btn-danger { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-full { width: 100%; }

/* ── Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}
.card-hover { transition: border-color 0.2s, transform 0.2s; }
.card-hover:hover { border-color: var(--primary); transform: translateY(-1px); }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.4rem; font-weight: 500; }
.form-input, .form-select, .form-textarea {
    width: 100%; background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 0.65rem 0.9rem;
    color: var(--text); font-size: 0.9rem; font-family: inherit;
    transition: border-color 0.15s; outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: none; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Alerts ── */
.alert { padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.875rem; margin-bottom: 1rem; }
.alert-error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.page { padding: 2rem 1.5rem; max-width: 1200px; margin: 0 auto; }
.page-header { margin-bottom: 1.75rem; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; }
.page-header p { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.3rem; }

/* ── Footer ── */
footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 4rem;
}

/* ── Auth layout ── */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 1.5rem; }
.auth-logo svg { width: 32px; height: 32px; color: var(--primary); }
.auth-logo span { font-size: 1.4rem; font-weight: 700; }
.auth-heading { text-align: center; margin-bottom: 1.5rem; }
.auth-heading h1 { font-size: 1.3rem; font-weight: 700; }
.auth-heading p { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.25rem; }
.auth-footer-link { text-align: center; margin-top: 1.25rem; font-size: 0.85rem; color: var(--text-muted); }
.auth-footer-link a { color: var(--primary); }

/* ── Landing ── */
.hero {
    position: relative; overflow: hidden;
    padding: 5rem 1.5rem 4rem;
    text-align: center;
}
.hero::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 0, rgba(99,102,241,0.15) 0, transparent 70%);
    pointer-events: none;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 700; line-height: 1.15; }
.hero h1 span { color: var(--primary-light); }
.hero p { color: var(--text-muted); font-size: 1.05rem; max-width: 520px; margin: 1rem auto 0; }
.hero-actions { display: flex; gap: 12px; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }
.section { padding: 3rem 1.5rem; max-width: 1200px; margin: 0 auto; }
.section-title { font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: 2rem; }
.markets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.market-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.market-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 0.9rem; }
.market-icon svg { width: 22px; height: 22px; }
.market-icon.crypto { background: rgba(251,146,60,0.15); color: #fb923c; }
.market-icon.stocks { background: rgba(96,165,250,0.15); color: #60a5fa; }
.market-icon.forex  { background: rgba(74,222,128,0.15); color: #4ade80; }
.market-icon.metals { background: rgba(250,204,21,0.15); color: #facc15; }
.market-card h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 0.3rem; }
.market-card p { font-size: 0.82rem; color: var(--text-muted); }
.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.feature-card { text-align: center !important; align-items: center; display: flex; flex-direction: column; }
.feature-card h3, .feature-card p { text-align: center !important; width: 100%; }
.feature-icon { width: 44px; height: 44px; border-radius: 10px; background: rgba(99,102,241,0.12); display: flex; align-items: center; justify-content: center; margin: 0 auto 0.9rem; }
.feature-icon svg { width: 22px; height: 22px; color: var(--primary-light); }
.feature-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.4rem; }
.feature-card p { font-size: 0.82rem; color: var(--text-muted); }
.cta-card { text-align: center; padding: 3rem 1.5rem; }
.cta-card h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.5rem; }
.cta-card p { color: var(--text-muted); margin-bottom: 1.5rem; }

/* ── Signals ── */
.cat-tabs {
    display: flex; gap: 0; margin-bottom: 1rem;
    background: var(--surface); border-radius: 12px; padding: 4px;
}
.cat-tab {
    flex: 1; padding: 0.5rem 0.75rem; border-radius: 8px;
    font-size: 0.82rem; font-weight: 600; border: none; cursor: pointer;
    background: transparent; color: var(--text-muted); transition: all 0.15s;
    font-family: inherit; white-space: nowrap; text-align: center;
}
.cat-tab:hover { color: var(--text); }
.cat-tab.active { background: var(--primary); color: #fff; }
.tab-count {
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.18); color: inherit;
    font-size: 0.65rem; font-weight: 700;
    min-width: 18px; height: 18px; border-radius: 50px;
    padding: 0 5px; margin-right: 4px;
}
.cat-tab:not(.active) .tab-count { background: var(--surface2); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1.5rem; }
.filter-btn {
    padding: 0.4rem 1rem; border-radius: 50px;
    font-size: 0.82rem; font-weight: 500; border: 1px solid var(--border);
    background: transparent; color: var(--text-muted); cursor: pointer; transition: all 0.15s;
    font-family: inherit;
}
.filter-btn:hover { border-color: var(--primary); color: var(--text); }
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.signals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.6rem; }
.signal-card { display: flex; flex-direction: column; padding: 0.75rem !important; }
.signal-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 0.6rem; }
.signal-asset { font-size: 0.95rem; font-weight: 700; flex-shrink: 0; }
.signal-badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.signal-badges .badge { font-size: 0.68rem; padding: 0.1rem 0.45rem; }
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 0.2rem 0.6rem; border-radius: 50px;
    font-size: 0.75rem; font-weight: 600;
}
.badge-cat-crypto  { background: rgba(251,146,60,0.15);  color: #fb923c; border: 1px solid rgba(251,146,60,0.25); }
.badge-cat-stocks  { background: rgba(96,165,250,0.15);  color: #60a5fa; border: 1px solid rgba(96,165,250,0.25); }
.badge-cat-forex   { background: rgba(74,222,128,0.15);  color: #4ade80; border: 1px solid rgba(74,222,128,0.25); }
.badge-cat-metals  { background: rgba(250,204,21,0.15);  color: #facc15; border: 1px solid rgba(250,204,21,0.25); }
.badge-buy { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.badge-sell { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.badge-active { background: rgba(96,165,250,0.15); color: #93c5fd; border: 1px solid rgba(96,165,250,0.25); }
.badge-closed { background: rgba(148,163,184,0.15); color: #94a3b8; border: 1px solid rgba(148,163,184,0.25); }
.badge-hit_tp { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.badge-hit_sl { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.signal-prices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 0.5rem; }
.price-box { background: rgba(15,23,42,0.5); border-radius: 6px; padding: 0.35rem 0.45rem; }
.price-box .label { font-size: 0.65rem; color: var(--text-muted); margin-bottom: 2px; white-space: nowrap; }
.price-box .value { font-size: 0.78rem; font-weight: 600; direction: ltr; text-align: left; }
.price-box .value.profit { color: var(--profit); }
.price-box .value.loss { color: var(--loss); }
.signal-desc { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.4rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.signal-date { font-size: 0.7rem; color: var(--text-muted); display: flex; align-items: center; gap: 3px; margin-top: auto; }
.signal-date svg { width: 11px; height: 11px; }
.empty-state { text-align: center; padding: 4rem 1rem; }
.empty-state svg { width: 48px; height: 48px; color: var(--surface2); margin: 0 auto 1rem; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.empty-state p { font-size: 0.85rem; color: var(--surface2); }

/* ── Admin Layout ── */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 220px; background: var(--surface); border-left: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 1.25rem 0.75rem;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-logo { display: flex; align-items: center; gap: 8px; padding: 0.25rem 0.5rem; margin-bottom: 1.5rem; }
.admin-logo svg { width: 22px; height: 22px; color: var(--primary); }
.admin-logo span { font-size: 1rem; font-weight: 700; }
.admin-nav-link {
    display: flex; align-items: center; gap: 8px;
    padding: 0.55rem 0.75rem; border-radius: 8px;
    color: var(--text-muted); font-size: 0.875rem; font-weight: 500;
    transition: all 0.15s; margin-bottom: 2px;
}
.admin-nav-link:hover, .admin-nav-link.active { background: rgba(99,102,241,0.1); color: var(--text); }
.admin-nav-link.active { color: var(--primary); }
.admin-nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.admin-sidebar-bottom { margin-top: auto; }
.admin-main { flex: 1; padding: 2rem; min-width: 0; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; }
.admin-topbar h1 { font-size: 1.4rem; font-weight: 700; }
.user-pill {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 50px; padding: 0.3rem 0.9rem 0.3rem 0.3rem;
    font-size: 0.85rem;
}
.avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--primary); display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700;
}

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { padding: 1.25rem; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.6rem; }
.stat-value { font-size: 2rem; font-weight: 700; }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { text-align: right; padding: 0.75rem 1rem; color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border); font-size: 0.8rem; white-space: nowrap; }
td { padding: 0.85rem 1rem; border-bottom: 1px solid rgba(51,65,85,0.5); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(30,41,59,0.4); }
.td-actions { display: flex; gap: 6px; }

/* ── Modal ── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; padding: 1.5rem; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; padding: 0.2rem; }
.modal-close:hover { color: var(--text); }

/* ══════════════════════════════════════
   MOBILE RESPONSIVE
   ══════════════════════════════════════ */

/* ── Hamburger button ── */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text);
    flex-direction: column;
    gap: 5px;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: all 0.25s;
}

@media (max-width: 768px) {
    /* Navbar */
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 0 1rem;
        position: relative;
    }
    .navbar-brand { padding: 0.75rem 0; }
    .nav-toggle { display: flex; }

    .navbar-nav {
        display: none;
        flex-direction: column;
        width: 100%;
        padding: 0.5rem 0 1rem;
        gap: 2px;
        order: 3;
    }
    .navbar-nav.open { display: flex; }
    .nav-link { padding: 0.65rem 0.5rem; font-size: 0.95rem; }

    .navbar-actions {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 8px;
        padding: 0 0 1rem;
        order: 4;
    }
    .navbar-actions.open { display: flex; }
    .navbar-actions .btn { width: 100%; justify-content: center; }

    /* Hero */
    .hero { padding: 3rem 1rem 2.5rem; }
    .hero h1 { font-size: 1.9rem; }
    .hero p { font-size: 0.92rem; }
    .hero-actions { flex-direction: column; align-items: center; }
    .hero-actions .btn { width: 100%; max-width: 280px; }

    /* Sections */
    .section { padding: 2rem 1rem; }
    .section-title { font-size: 1.15rem; margin-bottom: 1.25rem; }
    .markets-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
    .features-grid { grid-template-columns: 1fr; }
    .cta-card { padding: 2rem 1rem; }
    .cta-card h2 { font-size: 1.15rem; }

    /* Signals */
    .page { padding: 1rem 0.75rem; }
    .page-header h1 { font-size: 1.25rem; }
    .signals-grid { grid-template-columns: 1fr; gap: 0.5rem; }

    /* Category tabs — scrollable row on mobile */
    .cat-tabs {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        border-radius: 10px;
        padding: 3px;
        gap: 3px;
        margin-bottom: 0.75rem;
    }
    .cat-tabs::-webkit-scrollbar { display: none; }
    .cat-tab {
        flex: 0 0 auto;
        font-size: 0.8rem;
        padding: 0.45rem 0.9rem;
    }

    /* Status filters — scrollable row on mobile */
    .filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 6px;
        margin-bottom: 1rem;
        padding-bottom: 2px;
    }
    .filters::-webkit-scrollbar { display: none; }
    .filter-btn {
        flex: 0 0 auto;
        font-size: 0.78rem;
        padding: 0.35rem 0.8rem;
        white-space: nowrap;
    }

    /* Signal card prices — 2x2 on small screens */
    .signal-prices { grid-template-columns: repeat(2, 1fr); gap: 4px; }
    .price-box { padding: 0.35rem 0.5rem; }
    .price-box .label { font-size: 0.65rem; }
    .price-box .value { font-size: 0.8rem; }

    /* Signal card header badges — tighter */
    .signal-badges { gap: 3px; }
    .signal-badges .badge { font-size: 0.65rem; padding: 0.08rem 0.4rem; }

    /* Auth */
    .auth-card { padding: 0 0.25rem; }
    .auth-logo span { font-size: 1.2rem; }

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

    /* Admin layout — stack sidebar on top */
    .admin-layout { flex-direction: column; }
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0.75rem;
        gap: 4px;
        border-left: none;
        border-bottom: 1px solid var(--border);
    }
    .admin-logo { display: none; }
    .admin-sidebar-bottom { margin-top: 0; display: contents; }
    .admin-nav-link { font-size: 0.8rem; padding: 0.45rem 0.65rem; }
    .admin-main { padding: 1rem; }
    .admin-topbar { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .admin-topbar h1 { font-size: 1.2rem; }

    /* Table on mobile */
    .table-wrap { font-size: 0.8rem; }
    th, td { padding: 0.6rem 0.65rem; }

    /* Form grid */
    .form-grid-2 { grid-template-columns: 1fr; }

    /* Modal */
    .modal { padding: 1.25rem; }
}

@media (max-width: 420px) {
    .markets-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.6rem; }
    .signal-prices { grid-template-columns: repeat(2, 1fr); }
    .page { padding: 0.75rem 0.6rem; }
}

/* ── Payment history responsive table ── */
@media (max-width: 768px) {
    .pay-history-card { padding: 0 !important; }

    .pay-table thead { display: none; }

    .pay-table,
    .pay-table tbody,
    .pay-table tr { display: block; width: 100%; }

    .pay-table tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0;
        border-bottom: 1px solid var(--border);
        padding: 0.75rem 1rem;
    }
    .pay-table tr:last-child { border-bottom: none; }

    .pay-table td {
        display: flex;
        flex-direction: column;
        gap: 3px;
        padding: 0.25rem 0;
        border-bottom: none;
        font-size: 0.85rem;
    }

    .pay-table td::before {
        content: attr(data-label);
        font-size: 0.7rem;
        color: var(--text-muted);
        font-weight: 500;
    }

    /* hide ref-id column on mobile */
    .pay-table .col-refid { display: none; }

    /* status badge cell — span full width */
    .pay-table td:nth-child(4) { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 8px; }
    .pay-table td:nth-child(4)::before { min-width: fit-content; }
}

/* ── Bottom Navigation (mobile, logged-in only) ── */
.bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: rgba(15,23,42,0.97);
        backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
        z-index: 200;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 0.6rem 0.25rem;
        color: var(--text-muted);
        font-size: 0.68rem;
        font-weight: 500;
        transition: color 0.15s;
        text-decoration: none;
    }
    .bottom-nav-item svg {
        width: 22px; height: 22px;
    }
    .bottom-nav-item.active {
        color: var(--primary-light);
    }
    .bottom-nav-item.active svg {
        stroke: var(--primary-light);
    }

    /* push page content above bottom nav */
    body.has-bottom-nav {
        padding-bottom: calc(65px + env(safe-area-inset-bottom));
    }

    /* hide top navbar links on mobile when bottom nav exists */
    body.has-bottom-nav .navbar-nav,
    body.has-bottom-nav .navbar-actions {
        display: none !important;
    }
    body.has-bottom-nav .nav-toggle {
        display: none;
    }
    body.has-bottom-nav .navbar {
        justify-content: center;
    }
    body.has-bottom-nav .page-header {
        display: none;
    }
}
