/* ============================================================
   SMS WEON — App Shell Styles  (Light + Dark Theme)
   v2.0 — Enhanced UI with Toast, Modal, Improved Components
   ============================================================ */

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }   /* prevent iOS font inflation on rotate */

/* ── Light Theme (default) ──────────────────────────────── */
:root {
    /* Surface */
    --bg:        #f5f4ff;
    --surface:   #ffffff;
    --surface-2: rgba(111,67,241,0.06);
    --surface-3: rgba(111,67,241,0.03);
    --border:    rgba(111,67,241,0.12);

    /* Text */
    --text:      #12103a;
    --muted:     #7a7599;

    /* Brand colours */
    --primary:   #6f43f1;
    --cyan:      #0895bf;
    --pink:      #db2777;
    --amber:     #d97706;
    --green:     #059669;
    --red:       #dc2626;
    --blue:      #2563eb;
    --indigo:    #4f46e5;

    /* Gradients */
    --grad:      linear-gradient(135deg, #6f43f1, #0895bf);
    --grad2:     linear-gradient(135deg, #db2777, #d97706);
    --grad3:     linear-gradient(135deg, #059669, #0895bf);
    --grad4:     linear-gradient(135deg, #6f43f1 0%, #db2777 100%);

    /* Layout */
    --sidebar-w: 260px;
    --topbar-h:  64px;
    --radius:    1rem;
    --radius-sm: .65rem;
    --radius-xs: .4rem;
    --shadow:    0 4px 24px rgba(111,67,241,0.12);
    --shadow-md: 0 8px 32px rgba(111,67,241,0.18);
    --shadow-lg: 0 16px 48px rgba(111,67,241,0.22);

    /* Sidebar specific */
    --sidebar-bg:      rgba(255,255,255,0.95);
    --sidebar-active:  rgba(111,67,241,0.10);
    --topbar-bg:       rgba(245,244,255,0.90);
    --nav-hover:       rgba(111,67,241,0.06);

    /* Toast */
    --toast-bg:    #ffffff;
    --toast-border: rgba(111,67,241,0.12);

    /* Modal */
    --modal-bg:    #ffffff;
    --overlay-bg:  rgba(12,10,50,0.55);

    color-scheme: light;
}

/* ── Dark Theme ─────────────────────────────────────────── */
html[data-theme="dark"] {
    --bg:        #060612;
    --surface:   #0d0d1f;
    --surface-2: rgba(255,255,255,.05);
    --surface-3: rgba(255,255,255,.03);
    --border:    rgba(255,255,255,.08);

    --text:      #e8eaf6;
    --muted:     rgba(232,234,246,.50);

    --primary:   #9f7dff;
    --cyan:      #22d3ee;
    --pink:      #f472b6;
    --amber:     #fbbf24;
    --green:     #34d399;
    --red:       #f87171;
    --blue:      #60a5fa;
    --indigo:    #818cf8;

    --grad:      linear-gradient(135deg, #7c3aed, #06b6d4);
    --grad2:     linear-gradient(135deg, #ec4899, #f59e0b);
    --grad3:     linear-gradient(135deg, #10b981, #06b6d4);
    --grad4:     linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);

    --shadow:    0 4px 24px rgba(0,0,0,.40);
    --shadow-md: 0 8px 32px rgba(0,0,0,.50);
    --shadow-lg: 0 16px 48px rgba(0,0,0,.60);

    --sidebar-bg:      rgba(13,13,31,.98);
    --sidebar-active:  rgba(124,58,237,.20);
    --topbar-bg:       rgba(6,6,18,.92);
    --nav-hover:       rgba(255,255,255,.04);

    --toast-bg:    #1a1a36;
    --toast-border: rgba(255,255,255,.10);

    --modal-bg:    #12122a;
    --overlay-bg:  rgba(0,0,0,.75);

    color-scheme: dark;
}

/* ── Base ───────────────────────────────────────────────── */
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    line-height: 1.6;
    transition: background .25s, color .25s;
}

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

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 500;
    transition: width .3s cubic-bezier(.4,0,.2,1), transform .3s cubic-bezier(.4,0,.2,1), background .25s;
    overflow-x: hidden; overflow-y: auto;
}
.sidebar.collapsed { width: 68px; }
.sidebar.collapsed .brand-name,
.sidebar.collapsed .brand-sub,
.sidebar.collapsed .nav-label,
.sidebar.collapsed span,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .user-mini,
.sidebar.collapsed .nav-item::after { display: none !important; }
.sidebar.collapsed .nav-item { padding: .6rem 0; justify-content: center; margin: 1px 0; border-radius: 0; }
.sidebar.collapsed .nav-item i { font-size: 1.1rem; width: auto; }
.sidebar.collapsed .sidebar-footer { padding: 1rem 0; justify-content: center; }
.sidebar.collapsed .sidebar-brand { padding: 1.25rem 0; justify-content: center; }
.sidebar.collapsed .nav-sub-list { max-height: 0 !important; }

/* Brand */
.sidebar-brand {
    display: flex; align-items: center; gap: .75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.brand-icon {
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--grad); display: flex; align-items: center; justify-content: center;
    font-size: 1rem; color: #fff;
    box-shadow: 0 0 16px rgba(111,67,241,.30);
    flex-shrink: 0;
}
html[data-theme="dark"] .brand-icon { box-shadow: 0 0 16px rgba(124,58,237,.40); }
.brand-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem; font-weight: 700;
    background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.brand-sub { font-size: .68rem; color: var(--muted); margin-top: .05rem; }

/* Nav */
.sidebar-nav { flex: 1; padding: .75rem 0 1rem; overflow-y: auto; overscroll-behavior-y: contain; }
.nav-group { margin-bottom: 0.5rem; }
.nav-label {
    display: block;
    padding: 1.25rem 1.5rem .5rem;
    font-size: .62rem; font-weight: 800; letter-spacing: .12em;
    color: var(--muted); text-transform: uppercase;
    margin-bottom: .2rem;
}
.nav-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem 1.5rem; text-decoration: none;
    color: var(--muted); font-size: .875rem; font-weight: 500;
    transition: all .18s ease; position: relative;
    margin: 1px .75rem;
    border-radius: .5rem;
}
.nav-item i { width: 18px; text-align: center; font-size: .9rem; flex-shrink: 0; transition: color .18s; }
.nav-item:hover { color: var(--text); background: var(--nav-hover); }
.nav-item.active {
    color: #fff;
    background: var(--grad);
    box-shadow: 0 4px 12px rgba(111,67,241,.35);
}
html[data-theme="dark"] .nav-item.active {
    box-shadow: 0 4px 12px rgba(124,58,237,.45);
}
.nav-item.active i { color: #fff; }
.nav-badge {
    margin-left: auto; padding: .15rem .5rem;
    background: rgba(255,255,255,.25); color: #fff;
    font-size: .6rem; font-weight: 700; border-radius: 50px;
}
.nav-item:not(.active) .nav-badge {
    background: var(--primary); color: #fff;
}

/* Sidebar Collapsible Sub-menus */
.nav-item-wrap { position: relative; }
.nav-item.has-sub { cursor: default; }
.nav-item.has-sub::after { display: none; } /* chevron now handled by .sub-toggle */

/* Dedicated chevron toggle button injected by JS */
.sub-toggle {
    margin-left: auto;
    flex-shrink: 0;
    width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: .3rem;
    cursor: pointer;
    transition: background .15s;
}
.sub-toggle::after {
    content: '\f054'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    font-size: .6rem; color: var(--muted);
    transition: transform .3s;
    display: block;
}
.sub-toggle:hover { background: var(--nav-hover); }
.nav-item.has-sub.open .sub-toggle::after { transform: rotate(90deg); }
.nav-sub-list {
    max-height: 0; overflow: hidden;
    transition: max-height .3s cubic-bezier(0,1,0.5,1);
    background: rgba(0,0,0,.02);
    margin: 0 .75rem; border-radius: 0 0 .5rem .5rem;
}
html[data-theme="dark"] .nav-sub-list { background: rgba(255,255,255,.02); }
.nav-sub-list.open,
.nav-item.has-sub.open + .nav-sub-list,
.nav-item.has-sub.active + .nav-sub-list {
    max-height: 1000px;
    transition: max-height .3s cubic-bezier(.4, 0, .2, 1);
    margin-bottom: .75rem;
}
.nav-item.nav-sub {
    margin: 1px 0; padding-left: 2.75rem; font-size: .82rem; opacity: .85;
}
.nav-item.nav-sub:hover { opacity: 1; }

/* Sidebar Grouping */
.nav-group-content { padding-bottom: .5rem; }

/* Sidebar footer */
.sidebar-footer {
    display: flex; align-items: center; gap: .75rem;
    padding: 1rem 1.25rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.user-mini { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.user-name { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.user-role { font-size: .68rem; color: var(--muted); }
.logout-btn {
    width: 32px; height: 32px; border-radius: 8px;
    background: rgba(220,38,38,.08); border: 1px solid rgba(220,38,38,.18);
    color: var(--red); display: flex; align-items: center; justify-content: center;
    text-decoration: none; font-size: .85rem; transition: all .2s;
    flex-shrink: 0;
}
html[data-theme="dark"] .logout-btn { background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.20); color: #fca5a5; }
.logout-btn:hover { background: rgba(220,38,38,.18); transform: scale(1.08); }

/* ── User avatar ────────────────────────────────────────── */
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--grad); display: flex; align-items: center; justify-content: center;
    font-size: .85rem; font-weight: 700; color: #fff; flex-shrink: 0;
    user-select: none;
}
.user-avatar.sm  { width: 28px; height: 28px; font-size: .72rem; }
.user-avatar.lg  { width: 44px; height: 44px; font-size: 1.1rem; }
.user-avatar.xl  { width: 56px; height: 56px; font-size: 1.4rem; }

/* ── Main wrap ──────────────────────────────────────────── */
.main-wrap {
    margin-left: var(--sidebar-w);
    flex: 1; display: flex; flex-direction: column;
    min-height: 100vh;
    transition: margin-left .3s cubic-bezier(.4,0,.2,1);
}
.sidebar.collapsed ~ .main-wrap,
.main-wrap.expanded { margin-left: 68px; }

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 400;
    height: var(--topbar-h);
    background: var(--topbar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.75rem; gap: 1rem;
    transition: background .25s;
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
@keyframes pulse-env { 0%,100%{opacity:1} 50%{opacity:.35} }
.sidebar-toggle {
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all .2s;
}
.sidebar-toggle:hover { background: var(--nav-hover); }
.breadcrumb { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--muted); }
.breadcrumb i { font-size: .65rem; }
.breadcrumb .current { color: var(--text); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: .6rem; }

/* RTL support (app-level shell + key controls) */
html[dir="rtl"] body { direction: rtl; }
html[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: 0;
    border-left: 1px solid var(--border);
}
html[dir="rtl"] .sidebar.collapsed { transform: translateX(100%); }
html[dir="rtl"] .main-wrap {
    margin-left: 0;
    margin-right: var(--sidebar-w);
}
html[dir="rtl"] .main-wrap.expanded { margin-right: 0; }
html[dir="rtl"] .nav-item { text-align: right; }
html[dir="rtl"] .nav-badge {
    margin-left: 0;
    margin-right: auto;
}
html[dir="rtl"] .notif-dropdown {
    right: auto;
    left: 0;
}
html[dir="rtl"] .icon-btn .badge {
    right: auto;
    left: -5px;
}
html[dir="rtl"] th,
html[dir="rtl"] td { text-align: right; }
html[dir="rtl"] .input-icon-wrap .form-control {
    padding-left: 1rem;
    padding-right: 2.5rem;
}
html[dir="rtl"] .input-icon-wrap .input-icon {
    left: auto;
    right: .85rem;
}
html[dir="rtl"] select.form-control {
    background-position: left 1rem center;
    padding-right: 1rem;
    padding-left: 2.5rem;
}
.search-bar {
    display: flex; align-items: center; gap: .6rem;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: .65rem; padding: .4rem .85rem;
    transition: all .2s;
}
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(111,67,241,.1); }
.search-bar i { color: var(--muted); font-size: .85rem; }
.search-bar input {
    background: none; border: none; outline: none;
    color: var(--text); font-size: .95rem; width: 320px;
}
.search-bar input::placeholder { color: var(--muted); }
.icon-btn {
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    position: relative; transition: all .2s;
}
.icon-btn:hover { color: var(--primary); background: var(--sidebar-active); border-color: var(--primary); }
.icon-btn .badge {
    position: absolute; top: -5px; right: -5px;
    min-width: 17px; height: 17px; border-radius: 50%;
    background: var(--red); color: #fff;
    font-size: .6rem; font-weight: 700; padding: 0 3px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--topbar-bg);
    animation: badge-pulse 2s ease infinite;
}
@keyframes badge-pulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); }
    50%      { box-shadow: 0 0 0 4px rgba(220,38,38,0); }
}
.user-chip {
    display: flex; align-items: center; gap: .5rem;
    font-size: .8rem; font-weight: 600; color: var(--text);
    cursor: pointer; padding: .3rem .6rem;
    border-radius: .5rem; transition: background .2s;
}
.user-chip:hover { background: var(--nav-hover); }

/* ── Profile Dropdown ───────────────────────────────────── */
.user-chip-wrap { position: relative; }
.profile-dropdown {
    position: absolute; top: calc(100% + 10px); right: 0;
    width: 240px;
    background: var(--toast-bg);
    border: 1px solid var(--toast-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    z-index: 1100;
    display: none; flex-direction: column;
    overflow: hidden;
    animation: dropdown-in .2s cubic-bezier(.4,0,.2,1);
}
.profile-dropdown.open { display: flex; }
.profile-dd-head {
    display: flex; align-items: center; gap: .75rem;
    padding: 1rem 1rem .85rem;
    border-bottom: 1px solid var(--border);
}
.profile-dd-avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), #5b21b6);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; font-weight: 800; color: #fff;
}
.profile-dd-name  { font-size: .82rem; font-weight: 700; color: var(--text); }
.profile-dd-email { font-size: .72rem; color: var(--muted); margin-top: .1rem; }
.profile-dd-list  { padding: .4rem 0; }
.profile-dd-item {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem 1rem; font-size: .82rem; font-weight: 500;
    color: var(--text); text-decoration: none;
    transition: background .15s;
}
.profile-dd-item i { width: 16px; text-align: center; color: var(--muted); font-size: .85rem; }
.profile-dd-item:hover { background: var(--surface-2); }
.profile-dd-item:hover i { color: var(--primary); }
.profile-dd-logout { color: var(--red, #ef4444); }
.profile-dd-logout i { color: var(--red, #ef4444); opacity: .75; }
.profile-dd-logout:hover { background: rgba(239,68,68,.08); }
.profile-dd-divider { height: 1px; background: var(--border); margin: 0; }

/* ── Theme Toggle Button ────────────────────────────────── */
.theme-toggle-btn {
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s; font-size: .9rem;
}
.theme-toggle-btn:hover { color: var(--amber); background: rgba(217,119,6,.1); border-color: var(--amber); }
.theme-toggle-btn .icon-sun  { display: none; }
.theme-toggle-btn .icon-moon { display: block; }
html[data-theme="dark"] .theme-toggle-btn .icon-sun  { display: block; }
html[data-theme="dark"] .theme-toggle-btn .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle-btn:hover { color: var(--amber); }

/* ── Notification Dropdown ──────────────────────────────── */
.notif-wrap { position: relative; }
.notif-dropdown {
    position: absolute; top: calc(100% + 10px); right: 0;
    width: 360px; max-height: 480px;
    background: var(--toast-bg);
    border: 1px solid var(--toast-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none; flex-direction: column;
    overflow: hidden;
    animation: dropdown-in .2s cubic-bezier(.4,0,.2,1);
}
.notif-dropdown.open { display: flex; }
@keyframes dropdown-in {
    from { opacity: 0; transform: translateY(-8px) scale(.98); }
    to   { opacity: 1; transform: none; }
}
.notif-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
    font-weight: 700; font-size: .875rem; color: var(--text); flex-shrink: 0;
}
.notif-head .mark-read-btn {
    font-size: .75rem; font-weight: 600; color: var(--primary);
    background: none; border: none; cursor: pointer; padding: 0;
}
.notif-head .mark-read-btn:hover { text-decoration: underline; }
.notif-list { overflow-y: auto; flex: 1; }
.notif-item {
    display: flex; gap: .85rem; padding: .85rem 1.25rem;
    border-bottom: 1px solid var(--border); transition: background .15s; cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: rgba(111,67,241,.05); }
html[data-theme="dark"] .notif-item.unread { background: rgba(124,58,237,.08); }
.notif-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--primary); flex-shrink: 0; margin-top: .35rem;
}
.notif-item:not(.unread) .notif-dot { background: transparent; }
.notif-text { font-size: .8rem; color: var(--text); line-height: 1.45; }
.notif-time { font-size: .72rem; color: var(--muted); margin-top: .2rem; }
.notif-footer {
    padding: .75rem 1.25rem; text-align: center;
    border-top: 1px solid var(--border); flex-shrink: 0;
}
.notif-footer a { font-size: .8rem; color: var(--primary); text-decoration: none; font-weight: 600; }
.notif-footer a:hover { text-decoration: underline; }
.notif-empty { padding: 2.5rem; text-align: center; color: var(--muted); font-size: .875rem; }
.notif-empty i { font-size: 2rem; margin-bottom: .75rem; display: block; opacity: .4; }

/* ── Flash Messages (top banner style) ─────────────────── */
.flash {
    display: flex; align-items: center; gap: .75rem;
    padding: .9rem 1.75rem; font-size: .875rem; font-weight: 500;
    position: relative; border-left: 4px solid transparent;
}
.flash-success {
    background: rgba(5,150,105,.08);
    border-left-color: var(--green); color: var(--green);
}
.flash-error {
    background: rgba(220,38,38,.08);
    border-left-color: var(--red); color: var(--red);
}
.flash-warning {
    background: rgba(217,119,6,.08);
    border-left-color: var(--amber); color: var(--amber);
}
.flash-info {
    background: rgba(8,149,191,.08);
    border-left-color: var(--cyan); color: var(--cyan);
}
html[data-theme="dark"] .flash-success { background: rgba(16,185,129,.10); color: #6ee7b7; }
html[data-theme="dark"] .flash-error   { background: rgba(239,68,68,.10);  color: #fca5a5; }
html[data-theme="dark"] .flash-warning { background: rgba(245,158,11,.10); color: #fcd34d; }
html[data-theme="dark"] .flash-info    { background: rgba(6,182,212,.10);  color: #67e8f9; }
.flash-close {
    margin-left: auto; background: none; border: none; color: inherit;
    cursor: pointer; font-size: 1.1rem; opacity: .7; transition: opacity .15s; padding: 0 .25rem;
}
.flash-close:hover { opacity: 1; }

/* ── Toast Notifications ────────────────────────────────── */
.toast-container {
    position: fixed; bottom: 1.5rem; right: 1.5rem;
    z-index: 9999;
    display: flex; flex-direction: column-reverse; gap: .6rem;
    pointer-events: none;
}
.toast {
    display: flex; align-items: flex-start; gap: .85rem;
    padding: .95rem 1.1rem;
    background: var(--toast-bg);
    border: 1px solid var(--toast-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 300px; max-width: 420px;
    pointer-events: all;
    animation: toast-in .3s cubic-bezier(.22,.68,0,1.2);
    position: relative; overflow: hidden;
}
.toast.toast-out {
    animation: toast-out .3s ease forwards;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px) scale(.95); }
    to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
    from { opacity: 1; transform: none; max-height: 200px; margin-bottom: 0; }
    to   { opacity: 0; transform: translateX(40px); max-height: 0; padding: 0; margin: 0; }
}
.toast-icon { font-size: 1rem; flex-shrink: 0; margin-top: .05rem; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: .85rem; font-weight: 700; color: var(--text); margin-bottom: .15rem; }
.toast-msg   { font-size: .8rem; color: var(--muted); line-height: 1.4; }
.toast-close {
    background: none; border: none; cursor: pointer;
    color: var(--muted); font-size: .9rem; padding: 0;
    flex-shrink: 0; margin-top: .1rem; transition: color .15s;
}
.toast-close:hover { color: var(--text); }
.toast-progress {
    position: absolute; bottom: 0; left: 0; height: 3px;
    border-radius: 0 0 0 var(--radius-sm);
    animation: toast-progress linear forwards;
}
@keyframes toast-progress { from { width: 100%; } to { width: 0%; } }
/* Toast variants — icon color and progress bar share the same brand colour */
.toast-success .toast-icon, .toast-success .toast-progress { color: var(--green);  background: var(--green); }
.toast-error   .toast-icon, .toast-error   .toast-progress { color: var(--red);    background: var(--red); }
.toast-warning .toast-icon, .toast-warning .toast-progress { color: var(--amber);  background: var(--amber); }
.toast-info    .toast-icon, .toast-info    .toast-progress { color: var(--cyan);   background: var(--cyan); }

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; z-index: 5000;
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    animation: fade-in-fast .2s ease;
}
.modal-overlay.modal-closing { animation: fade-out-fast .2s ease forwards; }
@keyframes fade-in-fast  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out-fast { from { opacity: 1; } to { opacity: 0; } }
.modal {
    background: var(--modal-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 480px;
    animation: modal-in .25s cubic-bezier(.22,.68,0,1.2);
}
.modal-overlay.modal-closing .modal { animation: modal-out .2s ease forwards; }
@keyframes modal-in  { from { opacity: 0; transform: scale(.92) translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes modal-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(.95); } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: .6rem; }
.modal-close {
    width: 30px; height: 30px; border-radius: 6px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: .8rem; transition: all .15s;
}
.modal-close:hover { background: var(--nav-hover); color: var(--text); }
.modal-body { padding: 1.5rem; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: .75rem;
    padding: 1rem 1.5rem; border-top: 1px solid var(--border);
}
/* Danger modal icon */
.modal-danger-icon {
    width: 52px; height: 52px; border-radius: 50%;
    background: rgba(220,38,38,.1); display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; color: var(--red); margin: 0 auto 1rem;
}
html[data-theme="dark"] .modal-danger-icon { background: rgba(239,68,68,.15); color: #fca5a5; }

/* ── Content ────────────────────────────────────────────── */
.content { flex: 1; padding: 1.75rem; }
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.75rem; flex-wrap: wrap; gap: 1rem;
}
.page-title { font-family: 'Space Grotesk',sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--text); }
.page-sub { font-size: .85rem; color: var(--muted); margin-top: .2rem; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: background .25s, border-color .25s;
}
html[data-theme="dark"] .card { background: var(--surface-2); }
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-size: .95rem; font-weight: 700; color: var(--text);
    flex-wrap: wrap; gap: .5rem;
}
.card-body { padding: 1.5rem; }

/* Chart containers: fixed height prevents resize feedback loops */
.chart-fixed {
    position: relative; height: 220px;
    min-height: 220px; max-height: 220px;
}
.chart-fixed.chart-fixed-md { height: 240px; min-height: 240px; max-height: 240px; }
.chart-fixed.chart-fixed-sm { height: 180px; min-height: 180px; max-height: 180px; }
.chart-fixed > canvas { width: 100% !important; height: 100% !important; display: block; }

/* ── Stat Cards ─────────────────────────────────────────── */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem; margin-bottom: 1.75rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    display: flex; flex-direction: column; gap: .75rem;
    transition: all .3s ease;
    position: relative; overflow: hidden;
    cursor: default;
}
html[data-theme="dark"] .stat-card { background: var(--surface-2); }
.stat-card::after {
    content: ''; position: absolute;
    bottom: -20px; right: -20px;
    width: 90px; height: 90px;
    border-radius: 50%;
    background: currentColor;
    opacity: .04;
    transition: transform .3s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card:hover::after { transform: scale(1.3); }
.stat-card .sc-top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-card .sc-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.stat-card .sc-val {
    font-family: 'Space Grotesk',sans-serif;
    font-size: 1.85rem; font-weight: 800; line-height: 1;
    color: var(--text);
}
.stat-card .sc-lbl { font-size: .78rem; color: var(--muted); font-weight: 500; margin-top: .3rem; }
.stat-card .sc-trend {
    font-size: .73rem; font-weight: 600;
    display: flex; align-items: center; gap: .25rem;
}
.trend-up   { color: var(--green); }
.trend-down { color: var(--red); }
.trend-neutral { color: var(--muted); }

/* ── Table ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
    text-align: left; padding: .85rem 1rem;
    font-size: .72rem; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    background: var(--surface);
}
.sortable-th {
    cursor: pointer; user-select: none;
    position: relative; padding-right: 1.65rem;
    transition: color .15s;
}
.sortable-th:hover { color: var(--text); }
.sortable-th::after {
    content: '↕'; position: absolute;
    right: .6rem; top: 50%; transform: translateY(-50%);
    font-size: .68rem; opacity: .45;
}
.sortable-th[data-sort-dir="asc"]::after  { content: '↑'; opacity: .95; color: var(--primary); }
.sortable-th[data-sort-dir="desc"]::after { content: '↓'; opacity: .95; color: var(--primary); }
html[data-theme="dark"] thead th { background: transparent; }
tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
html[data-theme="dark"] tbody tr { border-bottom-color: rgba(255,255,255,.04); }
tbody tr:hover { background: var(--surface-2); }
html[data-theme="dark"] tbody tr:hover { background: rgba(255,255,255,.03); }
tbody td { padding: .85rem 1rem; color: var(--text); vertical-align: middle; }
tbody tr:last-child { border-bottom: none; }
.table-empty {
    text-align: center; padding: 3rem 1rem; color: var(--muted);
}
.table-empty i { font-size: 2.5rem; display: block; margin-bottom: .75rem; opacity: .4; }
.table-empty p { font-size: .875rem; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .22rem .65rem; border-radius: 50px;
    font-size: .7rem; font-weight: 700; white-space: nowrap;
}
.badge-green  { background: rgba(5,150,105,.12);  color: #059669; }
.badge-red    { background: rgba(220,38,38,.12);   color: #dc2626; }
.badge-amber  { background: rgba(217,119,6,.12);   color: #d97706; }
.badge-purple { background: rgba(111,67,241,.12);  color: #6f43f1; }
.badge-cyan   { background: rgba(8,149,191,.12);   color: #0895bf; }
.badge-pink   { background: rgba(219,39,119,.12);  color: #db2777; }
.badge-blue   { background: rgba(37,99,235,.12);   color: #2563eb; }
html[data-theme="dark"] .badge-green  { background: rgba(16,185,129,.15);  color: #6ee7b7; }
html[data-theme="dark"] .badge-red    { background: rgba(239,68,68,.15);   color: #fca5a5; }
html[data-theme="dark"] .badge-amber  { background: rgba(245,158,11,.15);  color: #fcd34d; }
html[data-theme="dark"] .badge-purple { background: rgba(124,58,237,.15);  color: #a78bfa; }
html[data-theme="dark"] .badge-cyan   { background: rgba(6,182,212,.15);   color: #67e8f9; }
html[data-theme="dark"] .badge-pink   { background: rgba(236,72,153,.15);  color: #f9a8d4; }
html[data-theme="dark"] .badge-blue   { background: rgba(59,130,246,.15);  color: #93c5fd; }
.badge-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor; display: inline-block;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .55rem 1.25rem; border-radius: .65rem;
    font-size: .875rem; font-weight: 600;
    text-decoration: none; cursor: pointer; border: none;
    transition: all .2s ease; white-space: nowrap;
    user-select: none;
}
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 0 16px rgba(111,67,241,.25); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 0 24px rgba(111,67,241,.40); }
html[data-theme="dark"] .btn-primary { box-shadow: 0 0 16px rgba(124,58,237,.35); }
html[data-theme="dark"] .btn-primary:hover { box-shadow: 0 0 24px rgba(124,58,237,.50); }
.btn-secondary {
    background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--nav-hover); border-color: var(--primary); color: var(--primary); }
.btn-danger {
    background: rgba(220,38,38,.10); color: var(--red);
    border: 1px solid rgba(220,38,38,.20);
}
html[data-theme="dark"] .btn-danger { background: rgba(239,68,68,.15); color: #fca5a5; border-color: rgba(239,68,68,.25); }
.btn-danger:hover { background: rgba(220,38,38,.20); }
.btn-success {
    background: rgba(5,150,105,.12); color: var(--green);
    border: 1px solid rgba(5,150,105,.22);
}
.btn-success:hover { background: rgba(5,150,105,.22); }
html[data-theme="dark"] .btn-success { background: rgba(16,185,129,.15); color: #6ee7b7; border-color: rgba(16,185,129,.25); }
.btn-warning {
    background: rgba(217,119,6,.10); color: var(--amber);
    border: 1px solid rgba(217,119,6,.20);
}
.btn-warning:hover { background: rgba(217,119,6,.20); }
.btn-sm   { padding: .3rem .8rem;  font-size: .78rem; border-radius: .5rem; }
.btn-lg   { padding: .75rem 1.75rem; font-size: 1rem; border-radius: .75rem; }
.btn-icon { padding: .4rem; border-radius: .5rem; }
.btn-block { width: 100%; justify-content: center; }
/* Loading spinner on button */
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after {
    content: ''; position: absolute; inset: 0;
    margin: auto; width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: .4rem; text-transform: uppercase; letter-spacing: .04em; }
.form-label-inline { font-size: .875rem; font-weight: 500; color: var(--text); }
.form-hint { font-size: .75rem; color: var(--muted); margin-top: .3rem; }
.form-error-text { font-size: .75rem; color: var(--red); margin-top: .3rem; display: flex; align-items: center; gap: .3rem; }
.form-control {
    width: 100%; padding: .8rem 1.15rem;
    background: var(--surface); border: 1.5px solid var(--border);
    border-radius: .65rem; color: var(--text);
    font-family: 'Inter',sans-serif; font-size: .95rem; outline: none;
    transition: all .2s;
}
html[data-theme="dark"] .form-control { background: rgba(255,255,255,.05); }
.form-control::placeholder { color: var(--muted); }
.form-control:hover:not(:focus) { border-color: rgba(111,67,241,.3); }
.form-control:focus {
    border-color: var(--primary);
    background: rgba(111,67,241,.04);
    box-shadow: 0 0 0 3px rgba(111,67,241,.12);
}
html[data-theme="dark"] .form-control:focus { background: rgba(124,58,237,.08); box-shadow: 0 0 0 3px rgba(124,58,237,.15); }
.form-control.is-invalid { border-color: var(--red); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.12); }
.form-control.is-valid { border-color: var(--green); }
select.form-control {
    cursor: pointer; appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%237a7599' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m2 4 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}
html[data-theme="dark"] select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23e8eaf6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m2 4 4 4 4-4'/%3E%3C/svg%3E");
}
select[multiple].form-control { background-image: none; padding-right: 1.15rem; }

/* ── Dark mode: all selects — force dark popup in Chrome/Edge/Firefox ── */
html[data-theme="dark"] select,
html[data-theme="dark"] select.form-control {
    background-color: #1a1a36 !important;
    color: #e8eaf6 !important;
    color-scheme: dark;
    border-color: rgba(255,255,255,.12);
}
html[data-theme="dark"] select option,
html[data-theme="dark"] select.form-control option {
    background-color: #1a1a36 !important;
    color: #e8eaf6 !important;
}
html[data-theme="dark"] select option:checked,
html[data-theme="dark"] select option:hover,
html[data-theme="dark"] select.form-control option:checked {
    background-color: #3b1fa8 !important;
    color: #fff !important;
}
textarea.form-control { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
/* Input with icon */
.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-left: 2.5rem; }
.input-icon-wrap .input-icon {
    position: absolute; left: .95rem; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-size: .9rem; pointer-events: none;
}
.input-icon-wrap .input-icon-right { left: auto; right: .95rem; pointer-events: all; cursor: pointer; }

/* Datalist Arrow Styling */
input[list]::-webkit-calendar-picker-indicator {
    padding: .35rem;
    cursor: pointer;
    opacity: .5;
    transition: all .2s;
    border-radius: 4px;
}
input[list]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    background: var(--surface-2);
    transform: scale(1.1);
}
/* Checkbox & Radio */
.form-check { display: flex; align-items: center; gap: .5rem; cursor: pointer; user-select: none; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer;
}

/* ── Grid layouts ───────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }

/* ── App footer ─────────────────────────────────────────── */
.app-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.75rem;
    display: flex; justify-content: space-between; align-items: center;
    font-size: .75rem; color: var(--muted);
}

/* ── Permission Toggle (custom switch) ─────────────────── */
.perm-toggle {
    position: relative; display: inline-block;
    width: 40px; height: 22px; cursor: pointer;
}
.perm-toggle input { opacity: 0; width: 0; height: 0; }
.perm-slider {
    position: absolute; inset: 0;
    background: var(--border, #334155);
    border-radius: 22px; transition: .2s;
}
.perm-slider::before {
    content: ''; position: absolute;
    width: 16px; height: 16px; left: 3px; top: 3px;
    background: #fff; border-radius: 50%; transition: .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.perm-toggle input:checked + .perm-slider { background: var(--primary); }
.perm-toggle input:checked + .perm-slider::before { transform: translateX(18px); }
.perm-toggle input:focus-visible + .perm-slider { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Progress Bar ───────────────────────────────────────── */
.progress { height: 6px; background: var(--border); border-radius: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 6px; transition: width .6s ease; }
.progress-bar-primary { background: var(--grad); }
.progress-bar-green   { background: var(--green); }
.progress-bar-red     { background: var(--red); }
.progress-bar-amber   { background: var(--amber); }

/* ── Alert Boxes ────────────────────────────────────────── */
.alert {
    display: flex; align-items: flex-start; gap: .85rem;
    padding: 1rem 1.25rem; border-radius: var(--radius-sm);
    font-size: .875rem; margin-bottom: 1rem; border: 1px solid transparent;
}
.alert i { flex-shrink: 0; margin-top: .1rem; }
.alert-success { background: rgba(5,150,105,.08);  border-color: rgba(5,150,105,.2);  color: var(--green); }
.alert-error   { background: rgba(220,38,38,.08);  border-color: rgba(220,38,38,.2);  color: var(--red); }
.alert-warning { background: rgba(217,119,6,.08);  border-color: rgba(217,119,6,.2);  color: var(--amber); }
.alert-info    { background: rgba(8,149,191,.08);  border-color: rgba(8,149,191,.2);  color: var(--cyan); }
html[data-theme="dark"] .alert-success { background: rgba(16,185,129,.10); color: #6ee7b7; }
html[data-theme="dark"] .alert-error   { background: rgba(239,68,68,.10);  color: #fca5a5; }
html[data-theme="dark"] .alert-warning { background: rgba(245,158,11,.10); color: #fcd34d; }
html[data-theme="dark"] .alert-info    { background: rgba(6,182,212,.10);  color: #67e8f9; }

/* ── Tabs ───────────────────────────────────────────────── */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn {
    padding: .6rem 1.1rem; font-size: .85rem; font-weight: 600;
    color: var(--muted); background: none; border: none; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: all .2s; border-radius: .5rem .5rem 0 0;
}
.tab-btn:hover { color: var(--text); background: var(--surface-2); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Skeleton Loader ────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-xs);
}
@keyframes skeleton-shimmer { to { background-position: -200% 0; } }
.skeleton-text { height: 14px; margin-bottom: .5rem; border-radius: 4px; }
.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }

/* ── Utilities ──────────────────────────────────────────── */
.mt-0  { margin-top: 0; }
.mt-1  { margin-top: .5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mt-4  { margin-top: 2rem; }
.mb-0  { margin-bottom: 0; }
.mb-1  { margin-bottom: .5rem; }
.mb-2  { margin-bottom: 1rem; }
.mb-3  { margin-bottom: 1.5rem; }
.mb-4  { margin-bottom: 2rem; }
.me-1  { margin-right: .5rem; }
.ms-1  { margin-left: .5rem; }
.ms-auto { margin-left: auto; }
.p-0   { padding: 0; }
.py-1  { padding-top: .5rem; padding-bottom: .5rem; }
.px-1  { padding-left: .5rem; padding-right: .5rem; }

.text-muted   { color: var(--muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-green   { color: var(--green) !important; }
.text-red     { color: var(--red) !important; }
.text-amber   { color: var(--amber) !important; }
.text-cyan    { color: var(--cyan) !important; }
.text-sm      { font-size: .8rem; }
.text-xs      { font-size: .72rem; }
.text-lg      { font-size: 1.05rem; }
.text-bold    { font-weight: 700; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }

/* ── Display utilities ──────────────────────────────────── */
.d-none   { display: none !important; }
.d-flex,
.flex     { display: flex; }
.d-block  { display: block; }
.d-grid   { display: grid; }

/* Responsive show/hide: sm = ≥576px, md = ≥768px */
@media (min-width: 576px) {
    .d-sm-none   { display: none !important; }
    .d-sm-inline { display: inline !important; }
    .d-sm-flex   { display: flex !important; }
    .d-sm-block  { display: block !important; }
}
@media (min-width: 768px) {
    .d-md-none   { display: none !important; }
    .d-md-inline { display: inline !important; }
    .d-md-flex   { display: flex !important; }
    .d-md-block  { display: block !important; }
}

.flex-col    { flex-direction: column; }
.flex-wrap   { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.w-full { width: 100%; }

.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rounded  { border-radius: var(--radius-sm); }
.border   { border: 1px solid var(--border); }
.divider  { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* bg color helpers */
.bg-purple { background: rgba(111,67,241,.12); }
.bg-cyan   { background: rgba(8,149,191,.12); }
.bg-pink   { background: rgba(219,39,119,.12); }
.bg-amber  { background: rgba(217,119,6,.12); }
.bg-green  { background: rgba(5,150,105,.12); }
.bg-red    { background: rgba(220,38,38,.12); }
.bg-blue   { background: rgba(37,99,235,.12); }
html[data-theme="dark"] .bg-purple { background: rgba(124,58,237,.20); }
html[data-theme="dark"] .bg-cyan   { background: rgba(6,182,212,.20); }
html[data-theme="dark"] .bg-pink   { background: rgba(236,72,153,.20); }
html[data-theme="dark"] .bg-amber  { background: rgba(245,158,11,.20); }
html[data-theme="dark"] .bg-green  { background: rgba(16,185,129,.20); }
html[data-theme="dark"] .bg-red    { background: rgba(239,68,68,.20); }
html[data-theme="dark"] .bg-blue   { background: rgba(59,130,246,.20); }

/* text gradient helpers */
.text-grad-1 { background: var(--grad);  -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.text-grad-2 { background: var(--grad2); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.text-grad-3 { background: var(--grad3); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }

/* ── Fade-in animation ──────────────────────────────────── */
.fade-in {
    transition: opacity .5s ease-out, transform .5s ease-out;
}

/* ── Empty State ────────────────────────────────────────── */
.empty-state {
    text-align: center; padding: 4rem 2rem; color: var(--muted);
}
.empty-state-icon {
    width: 72px; height: 72px; border-radius: 50%;
    background: var(--surface-2); display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; color: var(--muted); margin: 0 auto 1.25rem;
}
.empty-state h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: .5rem; }
.empty-state p  { font-size: .875rem; color: var(--muted); margin-bottom: 1.5rem; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
    :root { --sidebar-w: 240px; }
}
@media (max-width: 768px) {
    /* ── Sidebar drawer ────────────────────────────────── */
    .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    html[dir="rtl"] .sidebar { transform: translateX(100%); }
    .sidebar-overlay {
        position: fixed; inset: 0; background: var(--overlay-bg);
        backdrop-filter: blur(8px); display: none; z-index: 499;
    }
    .sidebar.open ~ .sidebar-overlay,
    .sidebar-overlay.open { display: block; }
    .main-wrap { margin-left: 0 !important; }
    html[dir="rtl"] .main-wrap { margin-right: 0 !important; }

    /* ── Topbar ────────────────────────────────────────── */
    .topbar { padding: 0 .85rem; height: 56px; }
    .topbar-right { gap: .3rem; }
    .breadcrumb { display: none; }
    .search-bar { display: none !important; }
    /* LTR/RTL toggle rarely needed on mobile — hide to save space */
    a.icon-btn[href*="dir="] { display: none !important; }

    /* ── Layout grids ──────────────────────────────────── */
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; gap: 1rem; }
    .stat-cards { grid-template-columns: 1fr 1fr; gap: .75rem; }

    /* ── Page header ───────────────────────────────────── */
    .page-header { flex-direction: column; align-items: flex-start; gap: .75rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }
    .page-title { word-break: break-word; font-size: clamp(1rem, 5vw, 1.35rem); }
    /* Only primary action buttons go full-width; not every .btn */
    .page-header > .btn,
    .page-header > .btn-group > .btn { width: 100%; justify-content: center; }

    /* ── Table — horizontal scroll ─────────────────────── */
    .table-wrap {
        display: block; width: 100%; overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem; border-radius: var(--radius-sm);
    }
    .table-wrap table { min-width: 720px; }   /* wider than 600 — most tables have 6–8+ cols */
    /* Touch-friendly action buttons inside tables */
    .table-wrap td .btn,
    .table-wrap td a.btn { min-height: 34px; padding: .3rem .55rem; }
    /* Table buttons must NOT go full-width */
    .table-wrap .btn { width: auto !important; margin-top: 0 !important; }

    /* ── Forms & Card headers ──────────────────────────── */
    .card-header { padding: 1rem !important; flex-wrap: wrap; gap: .75rem; }
    /* Auto-collapse GET filter forms inside card-header */
    .card-header form,
    .card-header .filter-form {
        display: flex; flex-direction: column; width: 100%; margin: 0 !important; gap: .5rem;
    }
    .card-header form > *,
    .card-header .filter-form > * { width: 100% !important; margin: 0 !important; min-width: 0 !important; }
    /* ...but keep submit buttons their natural width */
    .card-header form > button[type="submit"],
    .card-header form > .btn { width: 100% !important; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; gap: .75rem; }
    .form-group { margin-bottom: .75rem; }
    /* Full-width only for standalone buttons in card-body, not table actions */
    .card-body > .btn,
    .card-body > form > .btn { width: 100%; margin-top: .5rem; }

    /* ── Dropdowns — prevent overflow off-screen ───────── */
    .notif-dropdown {
        position: fixed; top: 58px;
        left: .5rem; right: .5rem;
        width: auto; max-width: 100%; max-height: 70vh;
    }
    .profile-dropdown {
        position: fixed; top: 58px;
        right: .5rem; left: auto;
        max-width: calc(100vw - 1rem);
    }

    /* ── Dialogs & Toasts ──────────────────────────────── */
    .toast-container { bottom: 1rem; right: .5rem; left: .5rem; }
    .toast { max-width: 100%; min-width: 0; }
    .modal { margin: .75rem; max-width: calc(100vw - 1.5rem); }
    .modal-body { max-height: 60vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }

    /* ── iOS safe area bottom padding ──────────────────── */
    .content { padding-bottom: max(1.5rem, env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
    .stat-cards { grid-template-columns: 1fr; }
    .sc-val { font-size: 1.25rem; }
    .content { padding: .875rem; }
    /* Very small screens: reduce modal margin further */
    .modal { margin: .5rem; max-width: calc(100vw - 1rem); }
    /* Ensure icon buttons are tap-friendly at 44px minimum */
    .icon-btn, .sidebar-toggle, .theme-toggle-btn { min-width: 40px; min-height: 40px; }
}

/* ── Print ──────────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .app-footer, .toast-container, .notif-dropdown { display: none !important; }
    .main-wrap { margin-left: 0 !important; }
    html[dir="rtl"] .main-wrap { margin-right: 0 !important; }
    .content { padding: 0; }
}

/* ── Searchable Select component ────────────────────────────── */
.ss-wrap {
    position: relative;
    display: block;
    width: 100%;           /* fill parent column */
    box-sizing: border-box;
}
.ss-wrap.ss-compact {
    width: auto;           /* compact inline selects size to content */
    display: inline-block;
}

/* Trigger input */
.ss-input {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    padding-right: 2.4rem !important;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    -webkit-text-decoration: none !important;
    text-decoration: none !important;
}
.ss-wrap.ss-open .ss-input {
    cursor: default !important;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(111,67,241,.12);
}

/* Chevron arrow */
.ss-arrow {
    position: absolute; right: .72rem; top: 50%;
    transform: translateY(-50%);
    pointer-events: none; color: var(--muted); font-size: .68rem;
    transition: transform .18s, color .18s; line-height: 1;
}
.ss-wrap.ss-open .ss-arrow {
    transform: translateY(-50%) rotate(180deg);
    color: var(--primary);
}

/* Clear × button */
.ss-clear {
    position: absolute; right: 1.85rem; top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    background: var(--border); color: var(--muted);
    border-radius: 50%; border: none; padding: 0;
    font-size: .6rem; line-height: 16px; text-align: center;
    cursor: pointer; display: none; align-items: center; justify-content: center;
    transition: background .15s, color .15s; z-index: 2;
}
.ss-clear:hover { background: #ef4444; color: #fff; }
.ss-wrap.ss-has-val .ss-clear { display: flex; }

/* Dropdown panel */
.ss-panel {
    display: none;
    position: absolute; top: calc(100% + 4px); left: 0;
    min-width: 180px; width: 100%; max-width: 95vw;
    max-height: 256px;
    overflow: hidden;
    flex-direction: column;              /* ready for flex when open */
    box-sizing: border-box;
    background: var(--surface);
    border: 1.5px solid rgba(111,67,241,.55);
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 36px rgba(111,67,241,.16), 0 2px 10px rgba(0,0,0,.12);
    list-style: none; margin: 0; padding: 0;
    z-index: 9999;
    animation: ssIn .13s ease;
}
.ss-wrap.ss-open .ss-panel { display: flex; }  /* flex column enables inner list scroll */
.ss-panel.ss-above {
    top: auto; bottom: calc(100% + 4px);
    animation: ssUp .13s ease;
}
@keyframes ssIn { from { opacity:0; transform:translateY(-5px); } to { opacity:1; transform:none; } }
@keyframes ssUp { from { opacity:0; transform:translateY(5px);  } to { opacity:1; transform:none; } }

/* Inline search box inside panel */
.ss-search-row {
    display: flex; align-items: center; gap: .4rem;
    padding: .45rem .55rem; border-bottom: 1px solid var(--border);
    background: var(--surface); position: sticky; top: 0; z-index: 1;
}
.ss-search-row i { color: var(--muted); font-size: .72rem; flex-shrink: 0; }
.ss-search {
    flex: 1; border: none; background: transparent;
    font-size: .83rem; color: var(--text); outline: none;
    padding: .1rem 0; min-width: 0;
}
.ss-search::placeholder { color: var(--muted); }

/* Scrollable options list */
.ss-list {
    flex: 1 1 auto;   /* grow to fill panel, shrink when needed */
    min-height: 0;    /* critical: allows flex child to scroll */
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: .25rem 0;
}
.ss-list::-webkit-scrollbar { width: 4px; }
.ss-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Option rows */
.ss-panel li {
    padding: .5rem 1rem .5rem .85rem;
    cursor: pointer; font-size: .875rem; line-height: 1.4;
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    transition: background .08s, color .08s;
}
.ss-panel li .ss-opt-text {
    flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ss-panel li mark {
    background: rgba(111,67,241,.14); color: var(--primary);
    border-radius: 2px; padding: 0 2px; font-weight: 700; font-style: normal;
}
.ss-panel li:hover,
.ss-panel li.ss-kb { background: rgba(111,67,241,.07); color: var(--primary); }
.ss-panel li.ss-sel { font-weight: 600; color: var(--primary); background: rgba(111,67,241,.05); }
.ss-check { display: none; flex-shrink: 0; font-size: .68rem; color: var(--primary); opacity: .7; }
.ss-panel li.ss-sel .ss-check { display: block; }

.ss-panel li.ss-none {
    color: var(--muted); cursor: default; justify-content: center;
    font-style: italic; font-size: .8rem; padding: .9rem 1rem;
}

/* Results count footer */
.ss-footer {
    padding: .25rem .8rem; font-size: .7rem; color: var(--muted);
    border-top: 1px solid var(--border); text-align: right;
    background: var(--surface); position: sticky; bottom: 0;
}

/* Compact size — matches small inline selects */
.ss-wrap.ss-compact .ss-input {
    padding-top: .38rem !important;
    padding-bottom: .38rem !important;
    font-size: .83rem !important;
    height: auto !important;
}

/* Inside .input-icon-wrap — preserve icon padding */
.input-icon-wrap .ss-wrap { display: block; }
.input-icon-wrap .ss-input { padding-left: 2.5rem !important; }

/* Dark mode */
html[data-theme="dark"] .ss-input {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
html[data-theme="dark"] .ss-wrap.ss-open .ss-input {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(124,58,237,.18);
}
html[data-theme="dark"] .ss-arrow { color: #9ca3af; }
html[data-theme="dark"] .ss-wrap.ss-open .ss-arrow { color: var(--primary); }
html[data-theme="dark"] .ss-clear {
    background: rgba(255,255,255,.12); color: #9ca3af;
}
html[data-theme="dark"] .ss-clear:hover { background: #ef4444; color: #fff; }
html[data-theme="dark"] .ss-panel {
    background: #1a1a36; border-color: rgba(124,58,237,.55);
    box-shadow: 0 12px 36px rgba(0,0,0,.55);
}
html[data-theme="dark"] .ss-search-row,
html[data-theme="dark"] .ss-footer { background: #1a1a36; border-color: rgba(255,255,255,.08); }
html[data-theme="dark"] .ss-search { color: #e8eaf6; background: transparent; }
html[data-theme="dark"] .ss-search::placeholder { color: #6b7280; }
html[data-theme="dark"] .ss-panel li { color: #e8eaf6; }
html[data-theme="dark"] .ss-panel li:hover,
html[data-theme="dark"] .ss-panel li.ss-kb { background: rgba(124,58,237,.18); color: #c4b5fd; }
html[data-theme="dark"] .ss-panel li.ss-sel { background: rgba(124,58,237,.12); color: #a78bfa; }
html[data-theme="dark"] .ss-panel li mark { background: rgba(167,139,250,.18); color: #c4b5fd; }
html[data-theme="dark"] .ss-panel li.ss-none { color: #6b7280; }

/* ── Flatpickr theme overrides ────────────────────────────────────── */
.flatpickr-calendar {
    border-radius: var(--radius) !important;
    box-shadow: 0 12px 36px rgba(111,67,241,.18), 0 2px 10px rgba(0,0,0,.15) !important;
    border: 1.5px solid rgba(111,67,241,.35) !important;
    font-family: 'Inter', sans-serif !important;
}
.flatpickr-months .flatpickr-month,
.flatpickr-weekdays,
span.flatpickr-weekday {
    background: var(--primary) !important;
    color: #fff !important;
    border-radius: 0 !important;
}
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg { fill: rgba(255,255,255,.85) !important; }
.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg { fill: rgba(255,255,255,.7) !important; }
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}
.flatpickr-day.today { border-color: var(--primary) !important; }
.flatpickr-day:hover { background: rgba(111,67,241,.12) !important; border-color: var(--primary) !important; }
.flatpickr-day.inRange { background: rgba(111,67,241,.1) !important; border-color: transparent !important; }

/* Dark mode flatpickr */
.fp-dark,
html[data-theme="dark"] .flatpickr-calendar {
    background: #1a1a36 !important;
    border-color: rgba(124,58,237,.55) !important;
    color: #e8eaf6 !important;
}
html[data-theme="dark"] .flatpickr-months .flatpickr-month,
html[data-theme="dark"] .flatpickr-weekdays,
html[data-theme="dark"] span.flatpickr-weekday {
    background: #3b1fa8 !important;
}
html[data-theme="dark"] .flatpickr-day { color: #e8eaf6 !important; }
html[data-theme="dark"] .flatpickr-day:hover { background: rgba(124,58,237,.25) !important; }
html[data-theme="dark"] .flatpickr-day.flatpickr-disabled { color: #4b5563 !important; }
html[data-theme="dark"] .numInputWrapper:hover { background: rgba(255,255,255,.05) !important; }
html[data-theme="dark"] .flatpickr-current-month input.cur-year { color: #fff !important; }
html[data-theme="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months {
    background: #1a1a36 !important; color: #e8eaf6 !important;
}

/* ── Shared Pagination (sa-pager) ───────────────────────────── */
.sa-pager{display:flex;align-items:center;gap:.4rem;flex-wrap:wrap;padding:.75rem 1rem;border-top:1px solid var(--border)}
.sa-pager button{padding:.3rem .65rem;border:1px solid var(--border);border-radius:.4rem;background:var(--surface);color:var(--text);font-size:.8rem;cursor:pointer;line-height:1;transition:background .15s,color .15s}
.sa-pager button:hover:not(:disabled){background:var(--primary);color:#fff;border-color:var(--primary)}
.sa-pager button.active{background:var(--primary);color:#fff;border-color:var(--primary)}
.sa-pager button:disabled{opacity:.45;cursor:default}
.sa-pager .pg-info{font-size:.8rem;color:var(--muted);margin-left:auto}

/* ── ScholarDT: DataTable-style controls ────────────────────── */
/* .dt-filter-bar and .dt-top-bar share identical layout declarations */
.dt-filter-bar,
.dt-top-bar {
    display:flex; align-items:center; gap:.5rem; flex-wrap:wrap;
    padding:.6rem 1rem; border-bottom:1px solid var(--border);
}
/* .dt-length and .dt-filter-bar controls share identical input/select styling */
.dt-length,
.dt-filter-bar select,
.dt-filter-bar .form-control {
    padding:.28rem .55rem; border:1px solid var(--border); border-radius:.4rem;
    background:var(--surface-2); color:var(--text); font-size:.8rem; cursor:pointer;
}
.dt-filter-bar label { font-size:.79rem; color:var(--muted); white-space:nowrap; }
.dt-filter-bar .input-icon-wrap { position:relative; display:flex; align-items:center; }
.dt-filter-bar .input-icon { position:absolute; left:.6rem; pointer-events:none; color:var(--muted); }
.dt-length-wrap label {
    display:flex; align-items:center; gap:.35rem;
    font-size:.8rem; color:var(--muted); white-space:nowrap;
}
.dt-search-wrap { margin-left:auto; position:relative; display:flex; align-items:center; }
.dt-search-icon {
    position:absolute; left:.6rem; font-size:.7rem; color:var(--muted); pointer-events:none;
}
.dt-search {
    padding:.28rem .65rem .28rem 1.85rem;
    border:1px solid var(--border); border-radius:.4rem;
    background:var(--surface-2); color:var(--text); font-size:.8rem;
    width:200px; transition:border-color .2s,width .25s;
}
.dt-search:focus { outline:none; border-color:var(--primary); width:250px; }

/* ── ScholarDT bottom bar: styled like Student List pagination ── */
.dt-bottom-bar {
    display:flex; align-items:center; justify-content:space-between;
    gap:.5rem; flex-wrap:wrap;
    padding:1rem 1.5rem; border-top:1px solid var(--border);
}
.dt-info { font-size:.82rem; color:var(--muted); }
.dt-pager { display:flex; align-items:center; gap:.4rem; flex-wrap:wrap; }
/* pager buttons inherit .btn .btn-sm styles — no extra rules needed */
.dt-pager .dt-ellipsis { font-size:.8rem; color:var(--muted); padding:0 .2rem; }
.dt-no-records { text-align:center; padding:2rem 1rem; color:var(--muted); }
.dt-no-records i { font-size:1.8rem; display:block; margin-bottom:.5rem; opacity:.35; }

/* ═══════════════════════════════════════════════════════════════════════════
   Scholar Time Picker  (ScholarTP)
   ═══════════════════════════════════════════════════════════════════════════ */

/* wrapper — same block flow as the original input */
.tp-wrap {
    position: relative;
    display: block;
    width: 100%;
}

/* visible control — mirrors .form-control look */
.tp-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    gap: .5rem;
    min-height: 38px;
}
.tp-display:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(124,58,237,.18); }
.tp-display.tp-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* time text inside display */
.tp-time-val {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: .04em;
    font-size: .92rem;
    display: flex;
    align-items: center;
    gap: .1rem;
}
.tp-colon-sep { opacity: .45; margin: 0 .05rem; }
.tp-ampm-tag {
    font-size: .68rem;
    font-weight: 800;
    background: var(--primary);
    color: #fff;
    padding: .1rem .38rem;
    border-radius: .3rem;
    margin-left: .3rem;
    letter-spacing: .03em;
}
.tp-placeholder { color: var(--muted); font-weight: 500; letter-spacing: .05em; }
.tp-clock-icon  { color: var(--muted); font-size: .8rem; flex-shrink: 0; }

/* ── dropdown panel ── */
.tp-panel {
    position: fixed;
    z-index: 1300;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: .7rem;
    box-shadow: 0 10px 40px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.12);
    overflow: hidden;
    min-width: 215px;
}

/* inner flex row: hours | colon | minutes | am-pm */
.tp-inner {
    display: flex;
}

/* scrollable column (hours / minutes) */
.tp-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 200px;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;      /* Firefox */
    -ms-overflow-style: none;   /* IE/Edge */
}
.tp-col::-webkit-scrollbar { display: none; }

.tp-item {
    padding: .55rem .4rem;
    text-align: center;
    font-size: .88rem;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
    scroll-snap-align: start;
    font-variant-numeric: tabular-nums;
    transition: background .12s, color .12s;
    flex-shrink: 0;
}
.tp-item:hover { background: var(--surface-2); color: var(--text); }
.tp-item.tp-sel {
    color: var(--primary);
    background: rgba(124,58,237,.1);
}

/* colon column between hours and minutes */
.tp-sep-col {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 .25rem;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--muted);
    opacity: .5;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    pointer-events: none;
}

/* AM/PM column */
.tp-ampm-col {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
    flex-shrink: 0;
}
.tp-ampm-btn {
    flex: 1;
    padding: .55rem .85rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: .8rem;
    font-weight: 800;
    color: var(--muted);
    letter-spacing: .04em;
    transition: background .13s, color .13s;
}
.tp-ampm-btn:first-child { border-bottom: 1px solid var(--border); }
.tp-ampm-btn:hover { background: var(--surface-2); color: var(--text); }
.tp-ampm-btn.tp-sel { background: var(--primary); color: #fff; }

/* footer with Now / Clear / OK */
.tp-footer {
    display: flex;
    gap: .4rem;
    padding: .6rem .75rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    justify-content: flex-end;
    align-items: center;
}
.tp-footer .btn-secondary { margin-right: auto; }
.tp-footer .btn-secondary + .btn-secondary { margin-right: 0; }
