/* ═══════════════════════════════════════════════════
   Private Member Club — Dark Theme (Metafy-inspired)
   Deep purple/dark backgrounds, amber/gold accents,
   rounded cards, modern aesthetic
   ═══════════════════════════════════════════════════ */

/* ─── CSS Variables ─── */
:root {
    /* Core palette */
    --accent: #d4a843;
    --accent-hover: #e6bc5a;
    --accent-dim: rgba(212,168,67,.15);
    --purple: #8b5cf6;
    --purple-dim: rgba(139,92,246,.15);

    --success: #34d399;
    --success-dim: rgba(52,211,153,.15);
    --warning: #fbbf24;
    --warning-dim: rgba(251,191,36,.15);
    --danger: #f87171;
    --danger-dim: rgba(248,113,113,.15);
    --info: #38bdf8;
    --info-dim: rgba(56,189,248,.15);

    /* Dark surfaces */
    --bg-body: #0f0b1a;
    --bg-sidebar: #0d0917;
    --bg-card: #1a1425;
    --bg-card-hover: #221a30;
    --bg-elevated: #241c33;
    --bg-input: #1e1630;
    --bg-header: rgba(15,11,26,.85);

    /* Borders */
    --border: rgba(255,255,255,.07);
    --border-light: rgba(255,255,255,.04);
    --border-focus: var(--accent);

    /* Text */
    --text-primary: #f0edf5;
    --text-secondary: #a89ec2;
    --text-muted: #6b5f82;
    --text-dim: #4a4062;

    /* Layout */
    --sidebar-width: 240px;
    --header-height: 60px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    /* Shadows */
    --shadow: 0 2px 8px rgba(0,0,0,.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.5);
    --shadow-glow: 0 0 20px rgba(212,168,67,.15);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
::selection { background: rgba(212,168,67,.3); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Layout ─── */
.app-layout { display: flex; min-height: 100vh; }

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform .3s ease;
}
.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
}
.sidebar-header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
}
.sidebar-header span {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: block;
    margin-top: 3px;
    letter-spacing: 0.03em;
}

.sidebar-nav { padding: 12px 0; }
.sidebar-nav .nav-section {
    padding: 16px 20px 6px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all .15s;
    border-radius: 0;
    border-left: 3px solid transparent;
    margin: 1px 0;
}
.sidebar-nav a:hover {
    background: rgba(255,255,255,.04);
    color: var(--text-primary);
}
.sidebar-nav a.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-left-color: var(--accent);
}
.sidebar-nav a svg {
    width: 18px; height: 18px;
    flex-shrink: 0;
    opacity: .6;
}
.sidebar-nav a:hover svg { opacity: .85; }
.sidebar-nav a.active svg { opacity: 1; color: var(--accent); }

/* Sidebar user footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* ─── Main Content ─── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

/* ─── Top Header ─── */
.top-header {
    height: var(--header-height);
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.top-header .breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.top-header .breadcrumb strong {
    color: var(--text-primary);
    font-weight: 600;
}
.top-header .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #b8860b);
    color: #0f0b1a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

/* ─── Page Content ─── */
.page-content { padding: 28px; }
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ─── Cards ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,.02);
}
.card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}
.card-body { padding: 20px; }
.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,.15);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* ─── Stat Cards ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
    position: relative;
    overflow: hidden;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 6px;
    line-height: 1.1;
}
.stat-card .stat-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
}
.stat-card.primary::before { background: var(--purple); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.info::before { background: var(--info); }
.stat-card.danger::before { background: var(--danger); }

/* ─── Tables ─── */
.table-responsive { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: rgba(0,0,0,.2);
    border-bottom: 1px solid var(--border);
}
table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
    vertical-align: middle;
    color: var(--text-secondary);
}
table td a { color: var(--text-primary); font-weight: 500; }
table td a:hover { color: var(--accent); }
table tbody tr { transition: background .1s; }
table tbody tr:hover { background: rgba(255,255,255,.02); }
table tbody tr:last-child td { border-bottom: none; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
    font-family: inherit;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #b8860b);
    color: #0f0b1a;
    border: none;
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), #d4a843);
    color: #0f0b1a;
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-secondary:hover {
    background: rgba(255,255,255,.08);
    color: var(--text-primary);
}

.btn-success { background: var(--success); color: #0f0b1a; }
.btn-success:hover { background: #4ade80; color: #0f0b1a; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #ef4444; color: #fff; }

.btn-warning { background: var(--warning); color: #0f0b1a; }
.btn-warning:hover { background: #fcd34d; color: #0f0b1a; }

.btn-sm { padding: 5px 12px; font-size: 0.76rem; }
.btn-xs { padding: 3px 8px; font-size: 0.7rem; border-radius: var(--radius-xs); }
.btn-lg { padding: 12px 28px; font-size: 0.95rem; border-radius: var(--radius); }

.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ─── Forms ─── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    letter-spacing: 0.02em;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
}
.form-control::placeholder { color: var(--text-dim); }
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212,168,67,.12);
    background: var(--bg-elevated);
}
select.form-control {
    appearance: auto;
    background: var(--bg-input);
    color: var(--text-primary);
}
select.form-control option {
    background: var(--bg-card);
    color: var(--text-primary);
}
textarea.form-control { resize: vertical; min-height: 100px; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.form-check input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}
.form-check label {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 0;
    cursor: pointer;
}
.form-hint {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 3px;
}

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 100px;
    white-space: nowrap;
    letter-spacing: 0.02em;
}
.badge-primary { background: var(--purple-dim); color: var(--purple); }
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-danger { background: var(--danger-dim); color: var(--danger); }
.badge-info { background: var(--info-dim); color: var(--info); }
.badge-gray { background: rgba(255,255,255,.06); color: var(--text-muted); }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 100px;
    color: #fff;
}
.tag .tag-remove {
    cursor: pointer;
    opacity: .7;
    font-size: 0.85rem;
    line-height: 1;
    margin-left: 2px;
}
.tag .tag-remove:hover { opacity: 1; }

/* ─── Alerts ─── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid;
}
.alert-success { background: var(--success-dim); color: var(--success); border-color: rgba(52,211,153,.2); }
.alert-error { background: var(--danger-dim); color: var(--danger); border-color: rgba(248,113,113,.2); }
.alert-warning { background: var(--warning-dim); color: var(--warning); border-color: rgba(251,191,36,.2); }
.alert-info { background: var(--info-dim); color: var(--info); border-color: rgba(56,189,248,.2); }

/* ─── Pagination ─── */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    justify-content: center;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    font-size: 0.78rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    background: var(--bg-card);
    transition: all .15s;
}
.pagination a:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: rgba(255,255,255,.12);
}
.pagination .active {
    background: var(--accent);
    color: #0f0b1a;
    border-color: var(--accent);
    font-weight: 600;
}
.pagination .disabled { opacity: .3; pointer-events: none; }

/* ─── Tabs ─── */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    gap: 0;
}
.tabs a {
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all .15s;
}
.tabs a:hover { color: var(--text-primary); }
.tabs a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ─── Filter Bar ─── */
.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.filter-bar .form-control {
    width: auto;
    min-width: 150px;
}
.filter-bar input[type="search"] {
    min-width: 240px;
}

/* ─── Timeline ─── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 8px; top: 0; bottom: 0;
    width: 2px;
    background: var(--border);
}
.timeline-item {
    position: relative;
    padding-bottom: 20px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px; top: 4px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--text-dim);
    border: 2px solid var(--bg-card);
}
.timeline-item.email_in::before { background: var(--info); }
.timeline-item.email_out::before { background: var(--purple); }
.timeline-item.sms_in::before { background: var(--success); }
.timeline-item.sms_out::before { background: var(--warning); }
.timeline-item.phone::before { background: var(--text-muted); }
.timeline-item.note::before { background: #a78bfa; }
.timeline-item.system::before { background: var(--text-dim); }

.timeline-item .timeline-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.timeline-item .timeline-header strong {
    color: var(--text-primary);
}
.timeline-item .timeline-body {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ─── Grid Layouts ─── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-sidebar { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

/* ─── Utilities ─── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.72rem; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.p-0 { padding: 0 !important; }
.gap-1 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* ─── Login Page ─── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(139,92,246,.12) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(212,168,67,.08) 0%, transparent 50%);
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.login-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}
.login-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state svg {
    width: 48px; height: 48px;
    margin-bottom: 12px;
    opacity: .3;
}
.empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.empty-state p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ─── Decorative background glow ─── */
.page-content {
    position: relative;
}
.page-content::before {
    content: '';
    position: fixed;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(139,92,246,.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.page-content > * { position: relative; z-index: 1; }

/* ─── Hamburger Menu Button ─── */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-xs);
    transition: background .15s;
}
.menu-toggle:hover { background: rgba(255,255,255,.06); }
.menu-toggle svg { width: 24px; height: 24px; display: block; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 99;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ─── Responsive: Tablet (≤1024px) ─── */
@media (max-width: 1024px) {
    .grid-2, .grid-3, .grid-sidebar { grid-template-columns: 1fr; }

    .page-header { gap: 12px; }
    .page-header h2 { font-size: 1.3rem; }

    .btn-group { gap: 4px; }

    /* Tables: ensure scroll */
    .table-responsive { -webkit-overflow-scrolling: touch; }
}

/* ─── Responsive: Mobile (≤768px) ─── */
@media (max-width: 768px) {
    /* Sidebar */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 200;
    }
    .sidebar.open { transform: translateX(0); }

    /* Show hamburger */
    .menu-toggle { display: block; }

    /* Main content takes full width */
    .main-content { margin-left: 0; }

    /* Top header */
    .top-header {
        padding: 0 12px;
        height: 54px;
        gap: 8px;
    }
    .top-header .breadcrumb { font-size: 0.8rem; }
    .top-header .user-info { gap: 8px; font-size: 0.78rem; }
    .top-header .user-info span { display: none; }
    .user-avatar { width: 30px; height: 30px; font-size: 0.7rem; }

    /* Page content */
    .page-content { padding: 14px; }
    .page-content::before { display: none; }

    /* Page header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 16px;
    }
    .page-header h2 { font-size: 1.2rem; }
    .page-header .btn-group { width: 100%; }
    .page-header .btn-group .btn { flex: 1; justify-content: center; font-size: 0.75rem; padding: 6px 10px; }

    /* Stats grid */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }
    .stat-card { padding: 14px; }
    .stat-card .stat-value { font-size: 1.5rem; }
    .stat-card .stat-label { font-size: 0.68rem; }

    /* Cards */
    .card { border-radius: var(--radius-sm); }
    .card-header { padding: 12px 14px; }
    .card-header h3 { font-size: 0.85rem; }
    .card-body { padding: 14px; }
    .card-footer { padding: 10px 14px; }
    .mb-3 { margin-bottom: 14px; }

    /* Tables */
    table th { padding: 8px 10px; font-size: 0.65rem; }
    table td { padding: 10px; font-size: 0.78rem; }
    .table-responsive { margin: 0 -14px; padding: 0 14px; }

    /* Buttons — touch-friendly */
    .btn { padding: 10px 16px; font-size: 0.8rem; min-height: 40px; }
    .btn-sm { padding: 8px 12px; font-size: 0.75rem; min-height: 36px; }
    .btn-xs { padding: 6px 10px; font-size: 0.7rem; min-height: 32px; }
    .btn-lg { padding: 14px 24px; font-size: 0.9rem; }
    .btn-group { gap: 6px; }
    .btn:hover { transform: none; } /* disable hover lift on touch */

    /* Forms — full-width everything */
    .form-control {
        padding: 12px 14px;
        font-size: 0.85rem;
        min-height: 44px; /* iOS tap target */
    }
    select.form-control { min-height: 44px; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .form-group { margin-bottom: 14px; }
    .form-group label { font-size: 0.78rem; margin-bottom: 4px; }
    .form-check input[type="checkbox"] { width: 20px; height: 20px; }
    .form-check label { font-size: 0.82rem; }

    /* Filter bar */
    .filter-bar {
        flex-direction: column;
        padding: 12px;
        gap: 8px;
    }
    .filter-bar .form-control,
    .filter-bar input[type="search"] {
        min-width: 100% !important;
        width: 100% !important;
    }
    .filter-bar form { flex-direction: column !important; width: 100%; gap: 8px !important; }
    .filter-bar .btn { width: 100%; justify-content: center; }

    /* Badges — slightly larger for readability */
    .badge { font-size: 0.68rem; padding: 3px 8px; }
    .tag { font-size: 0.68rem; }

    /* Tabs */
    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tabs a { padding: 10px 14px; font-size: 0.8rem; white-space: nowrap; }

    /* Timeline */
    .timeline { padding-left: 22px; }
    .timeline-item .timeline-header { font-size: 0.72rem; gap: 4px; }
    .timeline-item .timeline-body { padding: 8px 10px; font-size: 0.8rem; }

    /* Pagination */
    .pagination { gap: 2px; flex-wrap: wrap; }
    .pagination a, .pagination span {
        padding: 8px 12px;
        font-size: 0.75rem;
        min-height: 36px;
        display: flex;
        align-items: center;
    }

    /* Login page */
    .login-page { padding: 16px; }
    .login-card { padding: 24px; border-radius: 12px; }
    .login-card h1 { font-size: 1.3rem; }

    /* Utilities */
    .truncate { max-width: 140px; }

    /* Grid sidebar: stack on mobile */
    .grid-sidebar { gap: 14px; }
    .grid-2, .grid-3 { gap: 14px; }

    /* Admin permissions grid */
    .card .card-body div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* ─── Responsive: Small phone (≤480px) ─── */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; gap: 8px; }
    .stat-card .stat-value { font-size: 1.3rem; }

    .page-content { padding: 10px; }

    .page-header h2 { font-size: 1.1rem; }
    .page-header .btn-group { flex-direction: column; }
    .page-header .btn-group .btn { width: 100%; }

    table th { font-size: 0.6rem; padding: 6px 8px; }
    table td { font-size: 0.72rem; padding: 8px; }

    .card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .card-header .btn { width: 100%; justify-content: center; }

    .btn-group { flex-wrap: wrap; }

    .timeline-item .timeline-header { flex-direction: column; align-items: flex-start; gap: 2px; }

    /* Hide less important table columns on very small screens */
    .hide-xs { display: none !important; }
}
