/* ─── DataPulse — Dark Theme Stylesheet ──────────────────────────────────── */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a1f2e;
    --bg-input: #1e2538;
    --bg-hover: #252d40;
    --border: #2a3347;
    --border-light: #343d54;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99,102,241,0.25);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --success: #10b981;
    --success-bg: rgba(16,185,129,0.08);
    --danger: #ef4444;
    --danger-bg: rgba(239,68,68,0.08);
    --warning: #f59e0b;
    --warning-bg: rgba(245,158,11,0.08);
    --mtn-yellow: #ffcc00;
    --airtel-red: #e4002b;
    --glo-green: #50b848;
    --nine-green: #006b53;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --sidebar-width: 260px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'Space Mono', monospace; }

/* ─── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.sidebar-brand {
    padding: 24px 20px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid var(--border);
}
.brand-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #fff;
}
.brand-text { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.5px; }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: var(--radius-sm);
    color: var(--text-secondary); font-weight: 500; font-size: 0.9rem;
    transition: all 0.2s; margin-bottom: 4px; text-decoration: none;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.nav-item.active { background: var(--accent-glow); color: var(--accent-light); }
.nav-item i { width: 20px; text-align: center; font-size: 15px; }
.sidebar-footer {
    padding: 16px 16px 20px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.user-info { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 14px; color: #fff; flex-shrink: 0;
}
.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-weight: 600; font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); background: none; border: none;
    cursor: pointer; transition: all 0.2s; flex-shrink: 0; text-decoration: none;
}
.logout-btn:hover { background: var(--danger-bg); color: var(--danger); }
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90;
}
.sidebar-overlay.show { display: block; }

/* ─── Main Content ─────────────────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-width); min-height: 100vh; }
.top-bar {
    padding: 16px 32px;
    display: flex; align-items: center; gap: 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    position: sticky; top: 0; z-index: 50;
}
.page-title { font-size: 1.15rem; font-weight: 600; flex: 1; }
.menu-toggle {
    display: none; background: none; border: none;
    color: var(--text-primary); font-size: 20px; cursor: pointer;
    padding: 6px;
}
.content-area { padding: 24px 32px 40px; }

/* ─── Cards ────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
    margin-bottom: 0;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; gap: 12px;
}
.card-title { font-size: 1rem; font-weight: 600; }
.card-subtitle { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* ─── Buttons ──────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 18px; border: none; border-radius: var(--radius-sm);
    font-family: inherit; font-size: 0.85rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s; text-decoration: none;
    white-space: nowrap; line-height: 1.4;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #5558e6; text-decoration: none; color: #fff; }
.btn-secondary { background: var(--bg-hover); color: var(--text-secondary); }
.btn-secondary:hover { background: var(--border); color: var(--text-primary); text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Forms ────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.82rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-input, .form-select {
    width: 100%; padding: 10px 14px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-family: inherit; font-size: 0.88rem;
    transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input::placeholder { color: var(--text-muted); }
.form-select { -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* ─── Flash Messages ───────────────────────────────────────────────────── */
.flash-msg {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--radius-sm);
    font-size: 0.85rem; transition: opacity 0.5s;
}
.flash-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.flash-error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.flash-info { background: var(--accent-glow); color: var(--accent-light); border: 1px solid rgba(99,102,241,0.2); }
.flash-close { background: none; border: none; color: inherit; cursor: pointer; margin-left: auto; opacity: 0.6; }

/* ─── Stats Grid ───────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    display: flex; align-items: center; gap: 14px;
}
.stat-icon {
    width: 48px; height: 48px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.stat-icon.purple { background: rgba(99,102,241,0.12); color: var(--accent-light); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.blue { background: rgba(59,130,246,0.12); color: #60a5fa; }
.stat-icon.yellow { background: var(--warning-bg); color: var(--warning); }
.stat-label { font-size: 0.78rem; color: var(--text-muted); }
.stat-value { font-size: 1.5rem; font-weight: 700; font-family: 'Space Mono', monospace; line-height: 1.2; }
.stat-value.small { font-size: 1.1rem; }

/* ─── Grid Layout ──────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ─── Tables ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 14px; text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); background: var(--bg-input); font-weight: 600; border-bottom: 1px solid var(--border); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(99,102,241,0.04); }

/* ─── Badges ───────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-network {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 700;
    letter-spacing: 0.3px;
}
.badge-mtn { background: rgba(255,204,0,0.12); color: var(--mtn-yellow); }
.badge-airtel { background: rgba(228,0,43,0.12); color: var(--airtel-red); }
.badge-glo { background: rgba(80,184,72,0.12); color: var(--glo-green); }
.badge-9mobile, .badge-nmobile { background: rgba(0,107,83,0.12); color: var(--nine-green); }

/* ─── Contacts Grid ────────────────────────────────────────────────────── */
.contacts-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px;
}
.contact-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    transition: all 0.2s; position: relative;
}
.contact-card:hover { border-color: var(--border-light); }
.contact-actions {
    position: absolute; top: 12px; right: 12px;
    display: flex; gap: 4px; opacity: 0; transition: opacity 0.2s;
}
.contact-card:hover .contact-actions { opacity: 1; }
.contact-actions button {
    width: 30px; height: 30px; border-radius: 6px;
    background: var(--bg-hover); border: none; color: var(--text-muted);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 12px; transition: all 0.2s;
}
.contact-actions button:hover { color: var(--accent-light); background: var(--accent-glow); }
.contact-actions button.del:hover { color: var(--danger); background: var(--danger-bg); }
.contact-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.contact-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 16px; color: #fff; flex-shrink: 0;
}
.contact-avatar.mtn { background: linear-gradient(135deg, #ffcc00, #e6b800); color: #333; }
.contact-avatar.airtel { background: linear-gradient(135deg, #e4002b, #c70025); }
.contact-avatar.glo { background: linear-gradient(135deg, #50b848, #3d9e36); }
.contact-avatar.nmobile { background: linear-gradient(135deg, #006b53, #005542); }
.contact-name { font-weight: 600; font-size: 0.92rem; }
.contact-position { font-size: 0.75rem; color: var(--text-muted); }
.contact-phone { font-size: 0.82rem; color: var(--text-secondary); font-family: 'Space Mono', monospace; }

/* ─── Search Box ───────────────────────────────────────────────────────── */
.search-box { position: relative; }
.search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; }
.search-box .form-input { padding-left: 40px; }

/* ─── Modals ───────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    z-index: 200; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); max-width: 500px; width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 4px; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ─── Steps ────────────────────────────────────────────────────────────── */
.steps {
    display: flex; align-items: center; justify-content: center;
    gap: 0; margin-bottom: 28px; padding: 0 20px;
}
.step {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.82rem; color: var(--text-muted); font-weight: 500;
}
.step-num {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--bg-input); border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.78rem; font-family: 'Space Mono', monospace;
    transition: all 0.3s;
}
.step.active .step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.active { color: var(--text-primary); }
.step.done .step-num { background: var(--success); border-color: var(--success); color: #fff; }
.step.done { color: var(--success); }
.step-connector { width: 50px; height: 2px; background: var(--border); margin: 0 8px; transition: background 0.3s; }
.step-connector.done { background: var(--success); }

/* ─── Network Tabs ─────────────────────────────────────────────────────── */
.network-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.network-tab {
    padding: 8px 18px; border-radius: 20px;
    background: var(--bg-input); border: 1px solid var(--border);
    color: var(--text-secondary); font-size: 0.82rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.network-tab:hover { border-color: var(--border-light); color: var(--text-primary); }
.network-tab.active-mtn { background: rgba(255,204,0,0.12); border-color: var(--mtn-yellow); color: var(--mtn-yellow); }
.network-tab.active-airtel { background: rgba(228,0,43,0.12); border-color: var(--airtel-red); color: var(--airtel-red); }
.network-tab.active-glo { background: rgba(80,184,72,0.12); border-color: var(--glo-green); color: var(--glo-green); }
.network-tab.active-9mobile { background: rgba(0,107,83,0.12); border-color: var(--nine-green); color: var(--nine-green); }

/* ─── Airtime Amount Input ─────────────────────────────────────────────── */
.airtime-amount-section { padding: 4px 0; }
.airtime-input-wrap {
    display: flex; align-items: center; position: relative;
    background: var(--bg-input); border: 2px solid var(--border);
    border-radius: var(--radius); transition: border-color 0.2s;
}
.airtime-input-wrap:focus-within { border-color: var(--accent); }
.airtime-currency {
    padding: 0 4px 0 16px; font-family: 'Space Mono', monospace;
    font-size: 1.3rem; font-weight: 700; color: var(--text-muted);
}
.airtime-input {
    border: none !important; background: none !important; outline: none !important;
    font-family: 'Space Mono', monospace; font-size: 1.3rem; font-weight: 700;
    padding: 14px 16px 14px 4px; color: var(--text-primary); flex: 1; min-width: 0;
}
.airtime-input::placeholder { color: var(--border-light); font-weight: 400; }
.airtime-hint {
    font-size: 0.78rem; color: var(--text-muted); margin-top: 8px;
    transition: color 0.2s;
}
.airtime-presets {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px;
}
.airtime-preset {
    padding: 11px 8px; font-family: 'Space Mono', monospace; font-size: 0.84rem;
    font-weight: 600; background: var(--bg-input); color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: all 0.2s; text-align: center;
}
.airtime-preset:hover { border-color: var(--border-light); background: var(--bg-hover); }
.airtime-preset.active {
    border-color: var(--accent); background: var(--accent-glow);
    color: var(--accent-light); box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ─── Plan Category Filter ────────────────────────────────────────────── */
.plan-categories {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px; margin-bottom: 16px;
    padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.plan-cat-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 12px 10px; font-size: 0.76rem; font-family: inherit; font-weight: 500;
    background: linear-gradient(135deg, var(--bg-input) 0%, var(--bg-card) 100%);
    color: var(--text-muted);
    border: 1px solid var(--border); border-radius: var(--radius);
    cursor: pointer; transition: all 0.25s ease; white-space: nowrap;
    position: relative; overflow: hidden;
}
.plan-cat-btn::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(124,58,237,0.08) 100%);
    opacity: 0; transition: opacity 0.25s;
}
.plan-cat-btn:hover { border-color: var(--border-light); color: var(--text-secondary); transform: translateY(-1px); }
.plan-cat-btn:hover::before { opacity: 1; }
.plan-cat-btn:active { transform: translateY(0); }
.plan-cat-btn.active {
    background: linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(124,58,237,0.1) 100%);
    border-color: var(--accent); color: var(--accent-light); font-weight: 600;
    box-shadow: 0 0 12px rgba(99,102,241,0.15), inset 0 1px 0 rgba(255,255,255,0.05);
}
.plan-cat-btn.active::before { opacity: 0; }
.plan-cat-btn i {
    font-size: 1.1rem; margin-bottom: 2px;
    transition: transform 0.25s, color 0.25s;
}
.plan-cat-btn:hover i { transform: scale(1.1); }
.plan-cat-btn.active i { color: var(--accent-light); transform: scale(1.1); }
.cat-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 18px; padding: 0 6px;
    font-size: 0.65rem; font-weight: 700; border-radius: 9px;
    background: var(--bg-hover); color: var(--text-muted);
    transition: all 0.25s;
}
.plan-cat-btn.active .cat-count {
    background: var(--accent); color: #fff;
    box-shadow: 0 2px 6px rgba(99,102,241,0.3);
}
/* Prompt shown before a category is selected */
.plan-pick-prompt {
    text-align: center; padding: 36px 20px; color: var(--text-muted);
}
.plan-pick-prompt i {
    font-size: 2rem; margin-bottom: 10px; display: block;
    color: var(--border-light);
}
.plan-pick-prompt p { font-size: 0.88rem; }

/* ─── Products List ────────────────────────────────────────────────────── */
.products-list { max-height: 400px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.product-item {
    padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: all 0.2s;
}
.product-item:hover { border-color: var(--border-light); background: var(--bg-hover); }
.product-item.selected { border-color: var(--accent); background: var(--accent-glow); box-shadow: 0 0 0 2px var(--accent-glow); }
.product-title { font-weight: 500; font-size: 0.85rem; margin-bottom: 6px; }
.product-meta { display: flex; gap: 16px; font-size: 0.78rem; color: var(--text-muted); flex-wrap: wrap; }
.product-price { font-family: 'Space Mono', monospace; font-weight: 700; color: var(--success); }

/* ─── Purchase Summary ─────────────────────────────────────────────────── */
.purchase-summary { display: flex; flex-direction: column; }
.summary-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0; border-bottom: 1px solid var(--border);
}
.summary-label { font-size: 0.85rem; color: var(--text-muted); }
.summary-value { font-size: 0.88rem; font-weight: 500; }

/* ─── Empty State ──────────────────────────────────────────────────────── */
.empty-state {
    text-align: center; padding: 48px 20px; color: var(--text-muted);
}
.empty-state i { font-size: 40px; margin-bottom: 16px; opacity: 0.4; display: block; }
.empty-state h3 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 0.85rem; margin-bottom: 16px; }

/* ─── Filters Bar ──────────────────────────────────────────────────────── */
.filters-bar {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 20px;
    margin-bottom: 20px;
}
.filters-bar .form-select { min-width: 140px; width: auto; }

/* ─── Pagination ───────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; margin-top: 20px; }
.pagination a, .pagination span {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.82rem; font-weight: 500; text-decoration: none;
}
.pagination a { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); transition: all 0.2s; }
.pagination a:hover { border-color: var(--accent); color: var(--accent-light); }
.pagination .current { background: var(--accent); color: #fff; }

/* ─── Receipt ──────────────────────────────────────────────────────────── */
.receipt-container { max-width: 520px; margin: 0 auto; }
.receipt-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.receipt-header { text-align: center; padding: 32px 24px 20px; }
.receipt-icon { font-size: 48px; color: var(--success); margin-bottom: 12px; }
.receipt-header h2 { font-size: 1.1rem; }
.receipt-body { padding: 0 24px 24px; }
.receipt-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; border-bottom: 1px solid var(--border);
}
.receipt-row .label { font-size: 0.82rem; color: var(--text-muted); }
.receipt-row .value { font-size: 0.88rem; font-weight: 500; }
.receipt-ref {
    text-align: center; padding: 16px;
    background: var(--bg-input); border-radius: var(--radius-sm);
    margin-top: 16px;
}
.ref-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.ref-value { font-family: 'Space Mono', monospace; font-weight: 700; font-size: 0.88rem; color: var(--accent-light); word-break: break-all; }
.receipt-footer {
    padding: 16px 24px; border-top: 1px solid var(--border);
    display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}

/* ─── Settings API Key ─────────────────────────────────────────────────── */
.api-key-display {
    font-family: 'Space Mono', monospace; font-size: 0.88rem;
    padding: 14px 18px; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    display: flex; align-items: center; gap: 10px;
    color: var(--text-secondary); word-break: break-all;
}
.locked-icon { color: var(--success); }

/* ─── Result Modal ─────────────────────────────────────────────────────── */
.result-success .result-icon, .result-failed .result-icon { font-size: 48px; margin-bottom: 16px; }
.result-success .result-icon { color: var(--success); }
.result-success h3 { color: var(--success); }

/* ─── Spinner ──────────────────────────────────────────────────────────── */
.spinner {
    width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2); border-top-color: #fff;
    animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Login Page ───────────────────────────────────────────────────────── */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
    background: linear-gradient(135deg, #0a0e1a 0%, #111827 50%, #0f172a 100%);
}
.login-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 40px;
    max-width: 420px; width: 100%; box-shadow: var(--shadow);
}
.login-card .brand { text-align: center; margin-bottom: 32px; }
.login-card .brand h1 { font-size: 1.8rem; font-weight: 700; margin-top: 12px; }
.login-card .brand p { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }

/* ─── Receipt download dropdown ────────────────────────────────────────── */
.download-dropdown { position: relative; display: inline-block; }
.download-menu {
    display: none !important;
    position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    background: var(--bg-secondary); border: 1px solid var(--border-light); border-radius: var(--radius-sm);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4); min-width: 190px; z-index: 200; overflow: hidden;
}
.download-menu.show { display: block !important; }
.download-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 16px;
    background: none; border: none; color: var(--text-secondary); font-size: 0.84rem;
    cursor: pointer; transition: background 0.15s, color 0.15s; font-family: inherit;
}
.download-menu button:hover,
.download-menu button:active { background: var(--bg-hover); color: var(--text-primary); }
.download-menu button i { width: 18px; text-align: center; color: var(--accent-light); font-size: 0.9rem; }

/* ─── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .content-area { padding: 16px; }
    .top-bar { padding: 12px 16px; }
    .grid-2 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
    .stat-card { padding: 14px; }
    .contacts-grid { grid-template-columns: 1fr; }
    .contact-actions { opacity: 1; }
    .steps span { display: none; }
    .step-connector { width: 30px; }
    .filters-bar { flex-direction: column; }
    .filters-bar form { flex-direction: column; }
    .filters-bar .form-select { width: 100%; min-width: auto; }
    .plan-categories { grid-template-columns: repeat(3, 1fr); gap: 6px; padding-bottom: 12px; }
    .plan-cat-btn { padding: 10px 6px; font-size: 0.72rem; }
    .plan-cat-btn i { font-size: 0.95rem; }
    .pagination { flex-wrap: wrap; }

    /* Receipt mobile */
    .receipt-row { flex-direction: column; align-items: flex-start; gap: 4px; }
    .receipt-row .value { font-size: 0.85rem; }
    .receipt-body { padding: 0 16px 16px; }
    .receipt-header { padding: 24px 16px 16px; }

    /* Download dropdown: position below button on mobile */
    .download-menu {
        bottom: auto !important; top: calc(100% + 8px) !important;
        left: 0 !important; transform: none !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
    }

    /* ── Transaction table → compact list items ── */
    .table-wrap { overflow: visible !important; border: none !important; border-radius: 0 !important; }

    .txn-table thead { display: none !important; }
    .txn-table,
    .txn-table tbody { display: block; width: 100%; }

    .txn-table tr {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "contact  amount"
            "product  status"
            "date     action";
        gap: 2px 10px;
        background: none;
        border: none;
        border-bottom: 1px solid var(--border);
        border-radius: 0;
        padding: 12px 14px;
        margin: 0;
    }
    .txn-table tr:last-child { border-bottom: none; }

    .txn-table td {
        display: flex; align-items: center;
        padding: 2px 0; border: none; background: none;
        max-width: none !important; white-space: normal !important;
        overflow: visible !important; text-overflow: unset !important;
        font-size: 0.84rem;
    }
    .txn-table td div {
        white-space: normal !important; overflow: visible !important; text-overflow: unset !important;
    }
    /* Hide all labels */
    .txn-table td::before { display: none !important; }

    /* Hide Ref ID & Network (network name is in product text) */
    .txn-table td[data-label="Ref ID"]  { display: none !important; }
    .txn-table td[data-label="Network"] { display: none !important; }

    /* Grid area assignments */
    .txn-table td[data-label="Contact"] {
        grid-area: contact; font-weight: 500;
    }
    .txn-table td[data-label="Amount"] {
        grid-area: amount; justify-content: flex-end;
        font-family: 'Space Mono', monospace; font-weight: 700; font-size: 0.9rem;
    }
    .txn-table td[data-label="Product"] {
        grid-area: product;
        font-size: 0.78rem; color: var(--text-secondary);
        padding-top: 4px;
    }
    .txn-table td[data-label="Status"] {
        grid-area: status; justify-content: flex-end;
        padding-top: 4px;
    }
    .txn-table td[data-label="Date"] {
        grid-area: date;
        font-size: 0.75rem; color: var(--text-muted);
        padding-top: 4px;
    }
    .txn-table td[data-label=""] {
        grid-area: action; justify-content: flex-end;
        padding-top: 4px;
    }
}

/* ─── Print ────────────────────────────────────────────────────────────── */
@media print {
    .sidebar, .top-bar, .menu-toggle, .sidebar-overlay, .flash-container,
    .download-dropdown { display: none !important; }
    .receipt-container > div:last-child { display: none !important; }
    .main-content { margin-left: 0 !important; }
    body { background: #fff; color: #000; }
    .receipt-card { border: 1px solid #ddd; box-shadow: none; background: #fff; }
    .receipt-row { border-color: #eee; flex-direction: row !important; align-items: center !important; }
    .receipt-row .label { color: #666; }
    .badge-network { border: 1px solid #ddd; }
    .receipt-ref { background: #f5f5f5; }
    .ref-value { color: #333; }
}

/* ─── Auth Code Shake Animation ───────────────────────────────────────── */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}
