/* ═══════════════════════════════════════════════════════
   TURNITN Design System — app.css
   Colors extracted from favicon (#2D9CDB sky blue) 
   and logo text (#1B2A4A dark navy)
   Fonts: Lexend Deca (primary) + Calibri (secondary)
   ═══════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ────────────────────────── */
:root {
    /* Brand Colors */
    --primary: #2D9CDB;
    --primary-hover: #1A8AC7;
    --primary-light: rgba(45, 156, 219, 0.1);
    --primary-glow: rgba(45, 156, 219, 0.25);

    /* Text */
    --text-primary: #1B2A4A;
    --text-secondary: #5A6B8A;
    --text-muted: #8896AB;
    --text-inverse: #FFFFFF;

    /* Backgrounds */
    --bg-page: #F5F7FA;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F8FAFC;
    --bg-sidebar: #FFFFFF;
    --bg-input: #F1F5F9;
    --bg-input-focus: #FFFFFF;
    --bg-banner: linear-gradient(135deg, #1B2A4A 0%, #2D9CDB 100%);
    --bg-hero: linear-gradient(135deg, #F5F7FA 0%, #E8F4FD 50%, #F5F7FA 100%);

    /* Borders */
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    --border-focus: #2D9CDB;

    /* Status Colors */
    --success: #10B981;
    --success-light: rgba(16, 185, 129, 0.1);
    --warning: #F59E0B;
    --warning-light: rgba(245, 158, 11, 0.1);
    --danger: #EF4444;
    --danger-light: rgba(239, 68, 68, 0.1);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Sidebar */
    --sidebar-width: 260px;

    /* Transitions */
    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ── Dark Mode ────────────────────────────────────── */
[data-theme="dark"] {
    --primary: #3AADE4;
    --primary-hover: #4DB3E8;
    --primary-light: rgba(58, 173, 228, 0.12);
    --primary-glow: rgba(58, 173, 228, 0.2);

    --text-primary: #F0F4F8;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;

    --bg-page: #0F172A;
    --bg-card: #1E293B;
    --bg-card-hover: #253347;
    --bg-sidebar: #162032;
    --bg-input: #1E293B;
    --bg-input-focus: #253347;
    --bg-hero: linear-gradient(135deg, #0F172A 0%, #162032 50%, #0F172A 100%);

    --border: #2D3A4F;
    --border-light: #253347;
    --border-focus: #3AADE4;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.14);
}

[data-theme="dark"] .sidebar-logo img,
[data-theme="dark"] .admin-sidebar-logo img,
[data-theme="dark"] .login-logo img,
[data-theme="dark"] .auth-card-logo img,
[data-theme="dark"] .landing-nav-logo img,
[data-theme="dark"] .mobile-logo img {
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

/* ── Mobile Header & Logo ─────────────────── */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 60px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
}
.mobile-logo {
    margin-left: auto;
}
.mobile-logo img {
    height: 24px;
    display: block;
}
.admin-mobile-header {
    background: var(--bg-sidebar);
}

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }
}

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

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

body {
    font-family: 'Lexend Deca', 'Calibri', 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background var(--transition), color var(--transition);
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

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

/* ── Typography ───────────────────────────────────── */
.heading-xl { font-size: 32px; font-weight: 700; line-height: 1.2; color: var(--text-primary); }
.heading-lg { font-size: 24px; font-weight: 600; line-height: 1.3; color: var(--text-primary); }
.heading-md { font-size: 18px; font-weight: 600; line-height: 1.4; color: var(--text-primary); }
.heading-sm { font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--text-primary); }
.text-body { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }
.text-caption { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.text-small { font-size: 11px; color: var(--text-muted); }

/* ── Cards ────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-flat { box-shadow: none; }
.card-flat:hover { box-shadow: none; }

/* ── Buttons ──────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
    background: var(--primary);
    color: #FFFFFF;
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 14px var(--primary-glow); }

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

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #FFFFFF; }

.btn-success {
    background: var(--success);
    color: #FFFFFF;
}
.btn-success:hover { background: #0EA570; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-input); color: var(--text-primary); }

.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius-md); }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ── Inputs ───────────────────────────────────────── */
.input, .select, .textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all var(--transition);
}
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.input::placeholder { color: var(--text-muted); }
.textarea { min-height: 80px; resize: vertical; }

.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ── Badges ───────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-neutral { background: var(--bg-input); color: var(--text-secondary); }

@media (max-width: 480px) {
    .badge { padding: 2px 8px; font-size: 10px; }
}

/* ── Tables ───────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--bg-input);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}
.table tr:hover td { background: var(--bg-card-hover); }
.table .cell-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition-slow), background var(--transition);
}

.sidebar-logo {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo img { height: 32px; }

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
}
.sidebar-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.sidebar-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}
.sidebar-link svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    min-width: 0;
    transition: margin-left var(--transition-slow);
}

/* Hamburger */
.hamburger {
    display: none;
    position: fixed;
    top: 16px; left: 16px;
    z-index: 200;
    width: 40px; height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}
.hamburger svg { width: 20px; height: 20px; color: var(--text-primary); }

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

/* ── Theme Toggle ─────────────────────────────────── */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    user-select: none;
}
.theme-toggle:hover { background: var(--primary-light); color: var(--primary); }
.theme-toggle svg { width: 20px; height: 20px; flex-shrink: 0; }

.theme-switch {
    position: relative;
    width: 44px; height: 24px;
    background: var(--border);
    border-radius: 12px;
    transition: background var(--transition);
    flex-shrink: 0;
    margin-left: auto;
}
.theme-switch::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 20px; height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .theme-switch {
    background: var(--primary);
}
[data-theme="dark"] .theme-switch::after {
    transform: translateX(20px);
}

/* ── Progress Bar ─────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #4DB3E8);
    border-radius: 4px;
    transition: width 0.5s ease;
}
.progress-fill.warning { background: linear-gradient(90deg, var(--warning), #FBBF24); }
.progress-fill.danger { background: linear-gradient(90deg, var(--danger), #F87171); }

/* ── Skeleton Loading ─────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-card-hover) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text:last-child { width: 60%; }
.skeleton-heading { height: 24px; width: 40%; margin-bottom: 16px; }
.skeleton-card { height: 100px; border-radius: var(--radius-lg); margin-bottom: 16px; }
.skeleton-row { height: 48px; margin-bottom: 4px; }

@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ── Toast Notifications ──────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: #FFFFFF;
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.3s ease;
    max-width: 360px;
    word-break: break-word;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: #1B2A4A; }
.toast-info { background: var(--primary); }
.toast-exit { animation: toast-out 0.3s ease forwards; }

@keyframes toast-in { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(30px); } }

/* ── Upload Zone ──────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-input);
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.upload-zone svg { width: 40px; height: 40px; color: var(--primary); margin-bottom: 12px; }
.upload-zone-text { font-size: 14px; color: var(--text-secondary); }
.upload-zone-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Stat Cards ───────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    border-radius: 4px 0 0 4px;
}
.stat-card:nth-child(1)::before { background: var(--primary); }
.stat-card:nth-child(2)::before { background: var(--success); }
.stat-card:nth-child(3)::before { background: var(--warning); }
.stat-card:nth-child(4)::before { background: var(--danger); }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.stat-icon {
    width: 42px; height: 42px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }

/* ── Modal ────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    margin: 16px;
}
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; color: var(--text-primary); }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Tabs (Admin) ─────────────────────────────────── */
.admin-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    overflow-x: auto;
}
.admin-tab {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    border: none;
    background: none;
    font-family: inherit;
}
.admin-tab:hover { color: var(--text-primary); }
.admin-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ── Toggle Switch ────────────────────────────────── */
.toggle {
    position: relative;
    width: 40px; height: 22px;
    background: var(--border);
    border-radius: 11px;
    cursor: pointer;
    transition: background var(--transition);
    flex-shrink: 0;
}
.toggle.active { background: var(--success); }
.toggle::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 18px; height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: var(--shadow-sm);
}
.toggle.active::after { transform: translateX(18px); }

/* ── Job Cards ────────────────────────────────────── */
.job-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    transition: all var(--transition);
}
.job-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 12px;
}
.job-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.job-card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Utilities ────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary-color { color: var(--primary) !important; }
.text-muted { color: var(--text-muted) !important; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.word-break { word-break: break-word; }

/* ── Alert Banner ─────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}
.alert svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: var(--warning-light); color: #92400E; border: 1px solid rgba(245,158,11,0.2); }
[data-theme="dark"] .alert-warning { color: var(--warning); }
.alert-success { background: var(--success-light); color: #065F46; border: 1px solid rgba(16,185,129,0.2); }
[data-theme="dark"] .alert-success { color: var(--success); }
.alert-info { background: var(--primary-light); color: var(--primary); border: 1px solid rgba(45,156,219,0.2); }

/* ── Copy Button ──────────────────────────────────── */
.copy-field {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-family: 'Courier New', monospace;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-primary);
}
.copy-field span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition);
    padding: 4px;
    flex-shrink: 0;
}
.copy-btn:hover { color: var(--primary); }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 1024px) {
    .main-content { padding: 24px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
    .table th, .table td { padding: 10px 12px; }
    .table .cell-truncate { max-width: 140px; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .hamburger { display: flex; }
    .sidebar-overlay.active { display: block; }

    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: 64px;
    }

    .stats-grid { grid-template-columns: 1fr; }
    .heading-xl { font-size: 24px; }
    .heading-lg { font-size: 20px; }

    .admin-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table { font-size: 12px; }
    .table th, .table td { padding: 8px 10px; }
    .table .cell-truncate { max-width: 120px; }

    .modal { margin: 8px; padding: 24px; }
}

@media (max-width: 480px) {
    .main-content { padding: 12px; padding-top: 60px; }
    .card { padding: 16px; }
    .heading-xl { font-size: 22px; }
    .btn { width: 100%; justify-content: center; } /* Make all buttons full width on small mobile */
    .btn-lg { padding: 12px 20px; font-size: 14px; }
    .stats-grid { gap: 10px; }
    .stat-value { font-size: 22px; }
    .form-group { margin-bottom: 14px; }
    .input { padding: 8px 12px; }
}

/* ── Charts ───────────────────────────────────────── */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    transition: all var(--transition);
}
.chart-container:hover { box-shadow: var(--shadow-md); }
.chart-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
}
.chart-title::before {
    content: '';
    width: 4px; height: 18px;
    background: var(--primary);
    border-radius: 2px;
    flex-shrink: 0;
}
.chart-canvas { width: 100% !important; max-height: 320px; }

@media (max-width: 768px) {
    .chart-canvas { max-height: 240px; }
}

/* ── Empty State ──────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-text { font-size: 13px; }

/* ── Spin Animation ──────────────────────────────── */
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.spin-icon { animation: spin 1s linear infinite; }

/* ── Utility Classes ────────────────────────────────── */
.mb-8 { margin-bottom: 8px !important; }
.mb-16 { margin-bottom: 16px !important; }
.mb-24 { margin-bottom: 24px !important; }
.mt-16 { margin-top: 16px !important; }
.mt-24 { margin-top: 24px !important; }

.text-center { text-align: center !important; }
.text-muted { color: var(--text-muted) !important; }

/* ── Universal Overflow Safety ───────────────────── */
.main-content, .reseller-main, .admin-main, .card, .job-card, .info-card, .stat-card,
.history-card, .license-section, .upload-section, .feature-card {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ── Password Toggle ──────────────────────────────── */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.password-toggle-icon {
    position: absolute;
    right: 12px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}
.password-toggle-icon:hover {
    color: var(--text-primary);
}

/* ── Mobile Utility ──────────────────────────────── */
@media (max-width: 768px) {
    .mobile-full { width: 100% !important; max-width: 100% !important; }
}
