/**
 * DLD Stock Movement System
 * Theme CSS — Dark & Light
 * Applied via [data-theme] on <html> element
 */

/* ══════════════════════════════════════════
   DARK THEME (default)
══════════════════════════════════════════ */
[data-theme="dark"] {
    --gold:        #c8a84b;
    --gold-light:  #e8c96a;
    --gold-dim:    #c8a84b33;

    --bg:          #0b1520;
    --panel:       #111e2d;
    --card:        #162030;
    --border:      #1e3045;
    --input-bg:    #0f1c2a;

    --text-main:   #dde8f0;
    --text-muted:  #6a8099;
    --text-label:  #9ab0c5;

    --red:         #e05555;
    --green:       #4caf82;
    --blue:        #4a8fcf;
    --purple:      #9b6fcf;

    --shadow:      0 8px 32px #00000066;
    --shadow-lg:   0 24px 80px #00000088;

    /* Component tokens */
    --nav-bg:         var(--panel);
    --sidebar-bg:     var(--panel);
    --modal-bg:       var(--card);
    --btn-muted-bg:   transparent;
    --btn-muted-text: var(--text-muted);
    --table-hover:    var(--panel);
    --overlay-bg:     #00000088;
}

/* ══════════════════════════════════════════
   LIGHT THEME
══════════════════════════════════════════ */
[data-theme="light"] {
    --gold:        #a07830;
    --gold-light:  #c49a50;
    --gold-dim:    #a0783022;

    --bg:          #f0f2f5;
    --panel:       #ffffff;
    --card:        #ffffff;
    --border:      #dce1e9;
    --input-bg:    #f7f8fa;

    --text-main:   #1a2535;
    --text-muted:  #7a8fa8;
    --text-label:  #4a6080;

    --red:         #d63c3c;
    --green:       #2e9e68;
    --blue:        #2a72b5;
    --purple:      #7150b0;

    --shadow:      0 2px 12px #00000014;
    --shadow-lg:   0 12px 40px #00000022;

    /* Component tokens */
    --nav-bg:         var(--panel);
    --sidebar-bg:     #f7f8fa;
    --modal-bg:       var(--panel);
    --btn-muted-bg:   transparent;
    --btn-muted-text: var(--text-muted);
    --table-hover:    #f0f4f8;
    --overlay-bg:     #00000055;
}

/* ══════════════════════════════════════════
   GLOBAL BASE — uses variables
══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { transition: background 0.25s, color 0.25s; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text-main);
    min-height: 100vh;
    transition: background 0.25s, color 0.25s;
}

/* ── Top Nav ── */
.topnav {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.nav-brand { display: flex; align-items: center; gap: 14px; }
.nav-logo { height: 52px; max-width: 1000px; border-radius: 6px; border: 1px solid var(--gold); object-fit: cover; background: #000; }
.nav-title { font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; font-weight: 700; color: var(--gold); }
.nav-subtitle { font-size: 0.72rem; color: var(--text-muted); letter-spacing: 0.08em; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-user { display: flex; align-items: center; gap: 10px; }
.nav-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--gold-dim); border: 2px solid var(--gold); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; color: var(--gold); }
.nav-username { font-size: 0.88rem; font-weight: 500; color: var(--text-main); }
.nav-role { font-size: 0.72rem; color: var(--gold); background: var(--gold-dim); border: 1px solid var(--gold); border-radius: 4px; padding: 1px 8px; letter-spacing: 0.05em; }

/* ── Theme Toggle Switch ── */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    user-select: none;
}
.theme-toggle-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    min-width: 30px;
    text-align: center;
    transition: color 0.2s;
}
.theme-toggle-label.active { color: var(--gold); }
.toggle-track {
    width: 42px;
    height: 22px;
    background: var(--border);
    border-radius: 11px;
    position: relative;
    transition: background 0.25s;
    border: 1px solid var(--border);
}
[data-theme="dark"] .toggle-track  { background: var(--gold-dim); border-color: var(--gold); }
[data-theme="light"] .toggle-track { background: var(--gold-dim); border-color: var(--gold); }
.toggle-thumb {
    width: 16px;
    height: 16px;
    background: var(--gold);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.25s cubic-bezier(.4,0,.2,1), background 0.25s;
    box-shadow: 0 1px 4px #00000033;
}
[data-theme="light"] .toggle-thumb { transform: translateX(20px); }

/* ── Buttons ── */
.btn-nav {
    padding: 7px 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}
.btn-nav:hover { border-color: var(--gold); color: var(--gold); }
.btn-nav.danger:hover { border-color: var(--red); color: var(--red); }
.btn-logout {
    padding: 7px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* ── Role Switcher ── */
.nav-switcher { position: relative; }
.btn-switch { padding: 7px 14px; background: var(--gold-dim); border: 1px solid var(--gold); border-radius: 6px; color: var(--gold); font-family: 'DM Sans', sans-serif; font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: all 0.2s; text-decoration: none; display: inline-block; white-space: nowrap; }
.btn-switch:hover { background: var(--gold); color: #0b1520; }
.switch-dropdown { position: relative; }
.switch-menu { display: none; position: absolute; top: calc(100% + 6px); right: 0; background: var(--card); border: 1px solid var(--border); border-radius: 8px; min-width: 160px; z-index: 300; box-shadow: var(--shadow); overflow: hidden; }
.switch-menu.open { display: block; }
.switch-menu-item { display: block; padding: 10px 16px; color: var(--text-label); font-size: 0.85rem; text-decoration: none; transition: background 0.15s, color 0.15s; }
.switch-menu-item:hover { background: var(--gold-dim); color: var(--gold); }

/* ── Layout ── */
.main { display: flex; flex: 1; }

/* ── Sidebar ── */
.sidebar { width: 220px; background: var(--sidebar-bg); border-right: 1px solid var(--border); padding: 24px 12px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-label { font-size: 0.68rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.12em; text-transform: uppercase; padding: 0 10px; margin: 10px 0 6px; }
.sidebar-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 0.88rem; color: var(--text-label); cursor: pointer; transition: all 0.15s; border: none; background: transparent; width: 100%; text-align: left; text-decoration: none; }
.sidebar-item:hover { background: var(--gold-dim); color: var(--gold); }
.sidebar-item.active { background: var(--gold-dim); color: var(--gold); font-weight: 500; }
.sidebar-icon { font-size: 1rem; width: 20px; text-align: center; }

/* ── Content ── */
.content { flex: 1; padding: 32px; overflow-y: auto; }
.page-header { margin-bottom: 28px; }
.page-title { font-family: 'Cormorant Garamond', serif; font-size: 1.7rem; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
.page-desc { font-size: 0.85rem; color: var(--text-muted); }

/* ── Stat Cards ── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 20px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); animation: fadeSlideUp 0.5s ease both; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.2s; }
.stat-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }
.stat-value { font-family: 'Cormorant Garamond', serif; font-size: 2.2rem; font-weight: 700; color: var(--gold); line-height: 1; }
.stat-icon { font-size: 1.4rem; }

/* ── Section Grid ── */
.section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 1024px) { .section-grid { grid-template-columns: 1fr; } }

/* ── Cards ── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); animation: fadeSlideUp 0.5s 0.2s ease both; }
.card-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 1rem; font-weight: 600; color: var(--text-main); }
.card-body { padding: 22px; }

/* ── Form ── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row.full { grid-template-columns: 1fr; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--text-label); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 7px; }
.form-input, .form-select { width: 100%; padding: 10px 14px; background: var(--input-bg); border: 1.5px solid var(--border); border-radius: 7px; color: var(--text-main); font-family: 'DM Sans', sans-serif; font-size: 0.88rem; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus, .form-select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
.form-select option { background: var(--card); color: var(--text-main); }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 5px; }
.form-input.with-toggle { padding-right: 36px; }
.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.pass-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.95rem; padding: 2px; transition: color 0.2s; }
.pass-toggle:hover { color: var(--gold); }

/* ── Role Checkboxes ── */
.role-group { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--input-bg); border: 1.5px solid var(--border); border-radius: 7px; transition: border-color 0.2s; }
.role-group:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
.role-group.error { border-color: var(--red); }
.role-checkbox-item { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 2px; border-radius: 5px; transition: background 0.15s; }
.role-checkbox-item:hover { background: var(--gold-dim); }
.role-checkbox-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; flex-shrink: 0; }
.role-checkbox-label { font-size: 0.88rem; color: var(--text-label); text-transform: capitalize; flex: 1; }
.role-checkbox-item input:checked ~ .role-checkbox-label { color: var(--text-main); font-weight: 500; }
.role-checkbox-desc { font-size: 0.72rem; color: var(--text-muted); }

/* ── Password Strength ── */
.password-strength { height: 4px; border-radius: 2px; background: var(--border); margin-top: 6px; overflow: hidden; }
.password-strength-bar { height: 100%; border-radius: 2px; transition: width 0.3s, background 0.3s; width: 0%; }

/* ── Buttons ── */
.btn { padding: 10px 20px; border-radius: 7px; font-family: 'DM Sans', sans-serif; font-size: 0.88rem; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; }
.btn-primary { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: #0b1520; }
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-delete-confirm { flex: 2; padding: 10px 20px; border-radius: 7px; font-family: 'DM Sans', sans-serif; font-size: 0.88rem; font-weight: 600; cursor: pointer; background: var(--red); border: none; color: #fff; transition: all 0.15s; }
.btn-delete-confirm:hover { filter: brightness(1.1); }
.btn-delete-confirm:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Alerts ── */
.alert { padding: 11px 16px; border-radius: 7px; font-size: 0.85rem; margin-bottom: 18px; display: none; gap: 10px; align-items: flex-start; }
.alert.show { display: flex; }
.alert-error   { background: #e0555522; border: 1px solid #e0555555; color: var(--red); }
.alert-success { background: #4caf8222; border: 1px solid #4caf8255; color: var(--green); }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead th { padding: 10px 14px; text-align: left; font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid var(--border); }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-label); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--table-hover); }

/* ── Badges ── */
.badge { display: inline-block; padding: 2px 9px; border-radius: 4px; font-size: 0.73rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.badge-manager    { background: var(--gold-dim);  color: var(--gold);   border: 1px solid var(--gold); }
.badge-admin      { background: #9b6fcf22;         color: var(--purple); border: 1px solid var(--purple); }
.badge-supervisor { background: #4a8fcf22;         color: var(--blue);   border: 1px solid var(--blue); }
.badge-salesman   { background: #4caf8222;         color: var(--green);  border: 1px solid var(--green); }
.badge-active     { background: #4caf8222;         color: var(--green); }
.badge-inactive   { background: #e0555522;         color: var(--red); }

/* ── Action cell ── */
.action-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: var(--overlay-bg); backdrop-filter: blur(4px); z-index: 200; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--modal-bg); border: 1px solid var(--border); border-radius: 12px; width: 100%; max-width: 420px; padding: 28px; box-shadow: var(--shadow-lg); transform: translateY(20px); transition: transform 0.25s ease; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-title { font-family: 'Cormorant Garamond', serif; font-size: 1.3rem; font-weight: 700; color: var(--text-main); }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.3rem; cursor: pointer; padding: 2px 6px; border-radius: 4px; transition: color 0.2s, background 0.2s; }
.modal-close:hover { color: var(--red); background: #e0555522; }
.modal-subtitle { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 22px; }
.modal-subtitle strong { color: var(--gold); }
.delete-user-name { color: var(--red); font-weight: 700; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); font-size: 0.88rem; }

/* ── Coming soon ── */
.coming-soon { text-align: center; max-width: 400px; }
.coming-soon-icon { font-size: 3rem; margin-bottom: 16px; }
.coming-soon h2 { font-family: 'Cormorant Garamond', serif; font-size: 1.8rem; color: var(--gold); margin-bottom: 8px; }
.coming-soon p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }
.coming-badge { display: inline-block; margin-top: 16px; padding: 5px 14px; background: #9b6fcf22; border: 1px solid var(--purple); color: var(--purple); border-radius: 20px; font-size: 0.78rem; letter-spacing: 0.08em; }

/* ── Spinner ── */
.spinner-small { display: inline-block; width: 14px; height: 14px; border: 2px solid #0b152066; border-top-color: #0b1520; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; }

/* ── Login page specific ── */
.brand-panel { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 50px; background: var(--panel); overflow: hidden; }
.brand-panel::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, var(--gold-dim) 25%, transparent 25%) -20px 0, linear-gradient(225deg, var(--gold-dim) 25%, transparent 25%) -20px 0, linear-gradient(315deg, var(--gold-dim) 25%, transparent 25%), linear-gradient(45deg, var(--gold-dim) 25%, transparent 25%); background-size: 40px 40px; background-color: var(--panel); opacity: 0.6; }
.brand-panel::after { content: ''; position: absolute; width: 400px; height: 400px; border-radius: 50%; background: radial-gradient(circle, var(--gold-dim) 0%, transparent 70%); top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.brand-content { position: relative; z-index: 1; text-align: center; animation: fadeSlideUp 0.8s ease both; }
.brand-logo-wrap { width: 100%; max-width: 320px; height: auto; border-radius: 10px; border: 2px solid var(--gold); box-shadow: 0 0 0 8px var(--gold-dim), 0 20px 60px var(--gold-dim); overflow: hidden; margin: 0 auto 32px; background: #000; display: flex; align-items: center; justify-content: center; }
.brand-logo-wrap img { width: 100%; height: auto; display: block; }
.brand-company { font-family: 'Cormorant Garamond', serif; font-size: 2rem; font-weight: 700; color: var(--gold); line-height: 1.2; letter-spacing: 0.02em; margin-bottom: 10px; }
.brand-system { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); letter-spacing: 0.15em; text-transform: uppercase; }
.brand-divider { width: 60px; height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); margin: 24px auto; }
.brand-tagline { font-size: 0.9rem; color: var(--text-label); line-height: 1.6; max-width: 260px; }
.brand-version { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); font-size: 0.72rem; color: var(--text-muted); letter-spacing: 0.08em; z-index: 1; }
.login-panel { width: 440px; min-width: 440px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 50px; background: var(--card); border-left: 1px solid var(--border); position: relative; }
.login-inner { width: 100%; animation: fadeSlideUp 0.8s 0.15s ease both; }
.login-title { font-family: 'Cormorant Garamond', serif; font-size: 1.9rem; font-weight: 600; color: var(--text-main); margin-bottom: 6px; }
.login-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 36px; }
.login-footer { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.btn-login { width: 100%; padding: 14px; background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: #0b1520; font-family: 'DM Sans', sans-serif; font-size: 0.95rem; font-weight: 700; border: none; border-radius: 8px; cursor: pointer; letter-spacing: 0.04em; transition: transform 0.15s, box-shadow 0.15s, filter 0.15s; margin-top: 8px; position: relative; overflow: hidden; }
.btn-login:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 24px var(--gold-dim); filter: brightness(1.05); }
.btn-login:disabled { opacity: 0.7; cursor: not-allowed; }
.btn-login .spinner { display: none; width: 16px; height: 16px; border: 2px solid #0b152066; border-top-color: #0b1520; border-radius: 50%; animation: spin 0.7s linear infinite; margin: 0 auto; }
.btn-login.loading .btn-text { display: none; }
.btn-login.loading .spinner { display: block; }
.or-divider { display: flex; align-items: center; gap: 12px; margin: 24px 0; color: var(--text-muted); font-size: 0.78rem; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.btn-google { width: 100%; padding: 12px; background: var(--input-bg); border: 1.5px solid var(--border); border-radius: 8px; color: var(--text-label); font-family: 'DM Sans', sans-serif; font-size: 0.88rem; font-weight: 500; cursor: not-allowed; display: flex; align-items: center; justify-content: center; gap: 10px; opacity: 0.5; position: relative; }
.btn-google-badge { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 0.65rem; background: var(--border); color: var(--text-muted); padding: 2px 6px; border-radius: 4px; }
.google-icon { width: 18px; height: 18px; flex-shrink: 0; }
.field-error { font-size: 0.78rem; color: var(--red); margin-top: 5px; display: none; }
.field-error.show { display: block; }

/* ── Animations ── */
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   RESPONSIVE — TABLET (max 1024px)
══════════════════════════════════════════ */
@media (max-width: 1024px) {

    /* Collapse two-column section grid to one */
    .section-grid { grid-template-columns: 1fr; }

    /* Tighten content padding */
    .content { padding: 24px 20px; }

    /* Shrink nav title on smaller screens */
    .nav-title { font-size: 1rem; }
    .nav-subtitle { display: none; }
}

/* ══════════════════════════════════════════
   RESPONSIVE — MOBILE (max 768px)
══════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── Body layout ── */
    body { flex-direction: column; overflow-x: hidden; }

    /* ── Top Nav ── */
    .topnav {
        padding: 0 16px;
        height: auto;
        min-height: 56px;
        flex-wrap: wrap;
        gap: 8px;
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .nav-brand { flex: 1; min-width: 0; }
    .nav-logo { height: 38px; }
    .nav-title { font-size: 0.95rem; }
    .nav-subtitle { display: none; }
    .nav-right {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 6px;
        padding-bottom: 6px;
    }
    .nav-username { display: none; }
    .nav-avatar { width: 30px; height: 30px; font-size: 0.75rem; }

    /* Hide theme label text on mobile — keep just the toggle */
    .theme-toggle-label { display: none; }

    /* Smaller nav buttons */
    .btn-nav, .btn-logout, .btn-switch {
        padding: 5px 10px;
        font-size: 0.76rem;
    }

    /* ── Sidebar → bottom drawer behaviour ── */
    .main { flex-direction: column; }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 8px 12px;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-label { display: none; }

    .sidebar-item {
        padding: 7px 12px;
        border-radius: 20px;
        font-size: 0.78rem;
        white-space: nowrap;
        width: auto;
        flex-shrink: 0;
    }

    /* ── Content ── */
    .content {
        padding: 16px;
        overflow-y: auto;
    }

    /* ── Page header ── */
    .page-title { font-size: 1.3rem; }

    /* ── Stats row — 2 columns on mobile ── */
    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 20px;
    }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 1.7rem; }
    .stat-icon { font-size: 1.1rem; }

    /* ── Cards ── */
    .card-header { padding: 14px 16px; }
    .card-body { padding: 16px; }
    .card-title { font-size: 0.92rem; }

    /* ── Forms ── */
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .form-row.full { grid-template-columns: 1fr; }
    .form-group { margin-bottom: 12px; }
    .form-input, .form-select { padding: 11px 12px; font-size: 0.92rem; }

    /* ── Table — horizontal scroll ── */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 520px; }
    thead th { padding: 8px 10px; font-size: 0.68rem; }
    tbody td { padding: 10px 10px; font-size: 0.82rem; }

    /* ── Action buttons — stack vertically in cells ── */
    .action-cell { flex-direction: column; align-items: flex-start; gap: 4px; }
    .btn-sm { width: 100%; text-align: center; padding: 6px 10px; font-size: 0.78rem; }

    /* ── Badges ── */
    .badge { font-size: 0.68rem; padding: 2px 6px; }

    /* ── Modal ── */
    .modal {
        max-width: 100% !important;
        width: calc(100vw - 32px);
        padding: 20px;
        margin: 0 16px;
    }
    .modal-title { font-size: 1.1rem; }

    /* ── Login page ── */
    .brand-panel {
        padding: 32px 24px 24px;
        min-height: auto;
        flex: none;
    }
    .brand-logo-wrap { max-width: 200px; margin-bottom: 20px; }
    .brand-company { font-size: 1.4rem; }
    .brand-tagline { display: none; }
    .brand-version { position: static; transform: none; margin-top: 12px; }
    .login-panel {
        width: 100%;
        min-width: unset;
        border-left: none;
        border-top: 1px solid var(--border);
        padding: 32px 24px 48px;
    }
    .login-title { font-size: 1.5rem; }
    .login-footer { position: static; transform: none; margin-top: 24px; text-align: center; }

    /* ── Coming soon pages ── */
    .coming-soon h2 { font-size: 1.4rem; }
    .coming-soon p { font-size: 0.85rem; }
}

/* ══════════════════════════════════════════
   RESPONSIVE — SMALL MOBILE (max 480px)
══════════════════════════════════════════ */
@media (max-width: 480px) {

    .topnav { padding: 8px 12px; }
    .nav-logo { height: 32px; }
    .nav-title { font-size: 0.85rem; }

    /* Stats — single column on very small screens */
    .stats-row { grid-template-columns: 1fr; }

    .content { padding: 12px; }

    .card-body { padding: 12px; }

    /* Larger tap targets for buttons */
    .btn, .btn-primary { padding: 12px 16px; font-size: 0.88rem; }
    .btn-login { padding: 14px; }

    /* Full-width modals */
    .modal {
        width: 100vw;
        margin: 0;
        border-radius: 12px 12px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
    }
    .modal-overlay {
        align-items: flex-end;
    }

    .login-panel { padding: 24px 16px 40px; }
    .brand-panel { padding: 24px 16px; }
}
