/* ============================================================
   ADMINFACE Design System v2.0
   Modern SaaS UI — clean, fast, accessible
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800;1,14..32,400&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
    --sidebar-width:           260px;
    --sidebar-collapsed-width:  68px;
    --topbar-height:            58px;

    --sidebar-bg:        #0F172A;
    --sidebar-text:      #94A3B8;
    --sidebar-hover:     #1E293B;
    --sidebar-active:    #0EA5E9;
    --sidebar-active-bg: rgba(14,165,233,.12);
    --sidebar-border:    rgba(255,255,255,.06);

    --brand-color: #0EA5E9;
    --brand-hover: #0284C7;
    --brand-lt:    #E0F2FE;
    --brand-bd:    #BAE6FD;
    --brand-rgb:   14, 165, 233;

    --clr-success: #10B981;
    --clr-warn:    #F59E0B;
    --clr-danger:  #EF4444;
    --clr-info:    #06B6D4;
    --clr-purple:  #8B5CF6;

    --bg:      #F1F5F9;
    --card:    #FFFFFF;
    --border:  #E2E8F0;
    --text:    #0F172A;
    --muted:   #64748B;
    --subtle:  #F8FAFC;
    --tbl-hd:  #F8FAFC;
    --tbl-hov: #EFF6FF;

    --font-heading: 'Inter', system-ui, sans-serif;
    --font-body:    'Inter', system-ui, sans-serif;
    --font-ui:      'Inter', system-ui, sans-serif;
    --font-data:    'IBM Plex Mono', monospace;

    --r-xs:  4px;
    --r-sm:  6px;
    --r:     8px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 18px;
    --r-2xl:24px;

    --shadow-xs: 0 1px 2px 0 rgba(15,23,42,.05);
    --shadow-sm: 0 1px 3px 0 rgba(15,23,42,.08),0 1px 2px -1px rgba(15,23,42,.06);
    --shadow-md: 0 4px 6px -1px rgba(15,23,42,.08),0 2px 4px -2px rgba(15,23,42,.06);
    --shadow-lg: 0 10px 15px -3px rgba(15,23,42,.10),0 4px 6px -4px rgba(15,23,42,.07);
    --shadow-xl: 0 20px 25px -5px rgba(15,23,42,.12),0 8px 10px -6px rgba(15,23,42,.06);
    --shadow-2xl:0 25px 50px -12px rgba(15,23,42,.20);

    --transition:      200ms cubic-bezier(0.4,0,0.2,1);
    --transition-slow: 280ms cubic-bezier(0.4,0,0.2,1);
}

*,*::before,*::after { box-sizing: border-box; }

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    margin: 0;
    overflow: hidden;
    height: 100vh;
    line-height: 1.6;
}

body.login-page {
    overflow: auto;
    height: auto;
    min-height: 100vh;
    background: var(--bg);
}

h1,h2,h3,h4,h5,h6 {
    font-family: var(--font-heading);
    letter-spacing: -0.025em;
    font-weight: 700;
}

a { transition: color var(--transition); }

/* ============================================================
   LAYOUT
   ============================================================ */
#wrapper {
    display: flex;
    height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.oms-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    z-index: 1000;
    transition: width var(--transition-slow), min-width var(--transition-slow), transform var(--transition-slow);
    overflow: hidden;
    will-change: width;
}

/* ── Brand ── */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    height: var(--topbar-height);
    flex-shrink: 0;
    border-bottom: 1px solid var(--sidebar-border);
    overflow: hidden;
}

.sidebar-brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--sidebar-active);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
    transition: background var(--transition);
}

.sidebar-brand-name {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    white-space: nowrap;
    flex: 1;
    overflow: hidden;
    transition: opacity var(--transition);
}

.sidebar-pin-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--sidebar-text);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition), transform var(--transition-slow);
    margin-inline-start: auto;
    padding: 0;
}

.sidebar-pin-btn:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

/* ── User pill ── */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--sidebar-border);
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-circle {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--sidebar-active);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .78rem;
    flex-shrink: 0;
    letter-spacing: .02em;
}

/* ── Presence indicator (available / away) ─────────────────── */
.presence-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.presence-dot {
    position: absolute;
    inset-inline-end: -2px;
    bottom: -2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,.05);
}
.presence-dot.available { background: #22c55e; }
.presence-dot.away      { background: #94a3b8; }
[data-theme="dark"] .presence-dot { border-color: var(--card, #1e293b); }

.sidebar-user-info {
    overflow: hidden;
    flex: 1;
    min-width: 0;
    transition: opacity var(--transition);
}

.sidebar-user-name {
    font-size: .82rem;
    font-weight: 600;
    color: #E2E8F0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-user-role {
    font-size: .63rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--sidebar-text);
    opacity: .7;
}

/* ── Nav ──
   .sidebar-nav-wrap takes the flexible remaining space in the
   sidebar's flex column; .sidebar-nav is pinned to fill that box via
   absolute positioning (top/bottom/left/right:0) instead of sizing
   itself off flex-basis, so it always has a hard, scrollable height
   regardless of content. */
.sidebar-nav-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
}

.sidebar-nav {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    height: 100%;
    padding: 8px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.06) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 99px; }

.nav-section {
    padding: 14px 16px 4px;
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(148,163,184,.45);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition);
    line-height: 1;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    margin: 1px 8px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .845rem;
    font-weight: 500;
    border-radius: var(--r);
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #E2E8F0;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active-bg);
    color: #fff;
    font-weight: 600;
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    inset-inline-start: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 0 3px 3px 0;
    background: var(--sidebar-active);
}
[dir="rtl"] .sidebar-nav .nav-link.active::before {
    border-radius: 3px 0 0 3px;
}

.sidebar-nav .nav-link i {
    width: 18px;
    text-align: center;
    font-size: .95rem;
    flex-shrink: 0;
}

.nav-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: opacity var(--transition);
}

.sidebar-nav .nav-link .badge {
    flex-shrink: 0;
    font-size: .6rem;
    padding: 2px 6px;
    transition: opacity var(--transition);
}

/* ── Sidebar Footer ── */
.sidebar-footer {
    padding: 6px 0;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-footer .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    margin: 1px 8px;
    text-decoration: none;
    font-size: .845rem;
    font-weight: 500;
    border-radius: var(--r);
    white-space: nowrap;
    overflow: hidden;
    transition: background var(--transition), color var(--transition);
}

.sidebar-footer .nav-link:hover { background: var(--sidebar-hover); }

.sidebar-footer .nav-link i {
    width: 18px;
    text-align: center;
    font-size: .95rem;
    flex-shrink: 0;
}

/* ── Collapsed State (desktop icon-only) ── */
body.sidebar-collapsed .oms-sidebar {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed #page-content {
    inset-inline-start: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-brand-name,
body.sidebar-collapsed .sidebar-user-info,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .sidebar-nav .badge,
body.sidebar-collapsed .nav-section {
    opacity: 0;
    pointer-events: none;
}

body.sidebar-collapsed .sidebar-nav .nav-link,
body.sidebar-collapsed .sidebar-footer .nav-link {
    justify-content: center;
    padding: 9px;
    gap: 0;
    margin: 2px 8px;
}

body.sidebar-collapsed .sidebar-nav .nav-link.active::before { display: none; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0 10px; }
body.sidebar-collapsed .sidebar-pin-btn { transform: rotate(180deg); margin-inline-start: 0; }
body.sidebar-collapsed .sidebar-user { justify-content: center; padding: 10px; }

/* CSS tooltips for collapsed state */
body.sidebar-collapsed .oms-sidebar [data-tip] {
    position: relative;
}
body.sidebar-collapsed .oms-sidebar [data-tip]:hover::after {
    content: attr(data-tip);
    position: fixed;
    inset-inline-start: calc(var(--sidebar-collapsed-width) + 10px);
    background: #1E293B;
    color: #F1F5F9;
    padding: 5px 11px;
    border-radius: var(--r-sm);
    font-size: .78rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 9999;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,.08);
    letter-spacing: 0;
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
#page-content {
    position: fixed;
    top: 0;
    inset-inline-start: var(--sidebar-width);
    inset-inline-end: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: inset-inline-start var(--transition-slow);
}

/* ── Top Navbar ── */
.top-navbar {
    height: var(--topbar-height);
    background: rgba(255,255,255,.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-block: 0;
    padding-inline-start: 14px;
    padding-inline-end: 18px;
    flex-shrink: 0;
    z-index: 900;
    gap: 10px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Icon button base */
.topbar-btn {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--muted);
    border-radius: var(--r);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    position: relative;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
    flex-shrink: 0;
}

.topbar-btn:hover {
    background: var(--subtle);
    color: var(--text);
}

/* Sidebar toggle duplicates sidebarPinBtn on desktop — only needed on mobile/tablet */
@media (min-width: 1025px) {
    #sidebarToggle { display: none; }
}

.topbar-btn .count-badge {
    position: absolute;
    top: 2px; inset-inline-end: 2px;
    min-width: 15px; height: 15px;
    padding: 0 3px;
    border-radius: 99px;
    background: var(--clr-danger);
    color: #fff;
    font-size: .55rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* Search trigger */
.topbar-search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 33px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--subtle);
    color: var(--muted);
    font-size: .82rem;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
    white-space: nowrap;
    user-select: none;
    font-family: var(--font-ui);
}

.topbar-search-btn:hover {
    background: #fff;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.1);
    color: var(--text);
}

.topbar-search-btn kbd {
    font-family: var(--font-data);
    font-size: .68rem;
    background: var(--border);
    border: 1px solid #CBD5E1;
    border-radius: 4px;
    padding: 1px 5px;
    color: var(--muted);
}

/* User avatar */
.topbar-avatar {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: var(--brand-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .72rem;
    cursor: pointer;
    border: none;
    flex-shrink: 0;
    transition: opacity var(--transition), transform var(--transition);
    text-decoration: none;
}

.topbar-avatar:hover { opacity: .88; transform: scale(1.05); }

.topbar-avatar-dd { box-shadow: 0 8px 24px rgba(0,0,0,.12) !important; border-radius: 10px !important; }
.topbar-avatar-dd .dropdown-item {
    display: flex; align-items: center; gap: .5rem;
    font-size: .855rem; padding: .45rem .85rem;
    border-radius: 6px; color: var(--text);
}
.topbar-avatar-dd .dropdown-item i { width: 16px; text-align: center; flex-shrink: 0; }
.topbar-avatar-dd .dropdown-item:hover { background: var(--hover-bg, #f1f5f9); }
.topbar-avatar-dd .dropdown-item.text-danger:hover { background: #fef2f2; }

/* Date label */
.topbar-date {
    font-size: .77rem;
    color: var(--muted);
    white-space: nowrap;
    padding: 0 6px;
}

/* ── Main Content ── */
.main-content {
    padding: 24px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    animation: fadeUp .35s ease both;
}

.main-content::-webkit-scrollbar { width: 5px; }
.main-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.main-content::-webkit-scrollbar-thumb:hover { background: #CBD5E1; }

/* App Footer */
.app-footer {
    padding: .5rem 1.5rem;
    font-size: .72rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    background: var(--card);
    border-top: 1px solid var(--border);
    color: var(--muted);
    flex-shrink: 0;
}

.app-footer a {
    color: var(--muted);
    text-decoration: none;
    transition: color var(--transition);
}
.app-footer a:hover { color: var(--brand-color); }

/* Sidebar overlay (mobile) */
#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(15,23,42,.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    cursor: pointer;
    animation: overlayFadeIn .2s ease;
}

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

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.page-header h4 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
    letter-spacing: -0.03em;
}

.page-header h4 i { opacity: .8; }

/* ============================================================
   STAT CARDS v2
   ============================================================ */
.stat-card {
    background: var(--card);
    border-radius: var(--r-lg);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    animation: fadeUp .35s ease both;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(var(--brand-rgb),.25);
    color: inherit;
}

.stat-icon {
    width: 50px; height: 50px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

/* Icon colour variants */
.stat-icon.blue   { background: linear-gradient(135deg,#EFF6FF,#DBEAFE); color: #3B82F6; }
.stat-icon.green  { background: linear-gradient(135deg,#F0FDF4,#DCFCE7); color: #16A34A; }
.stat-icon.orange { background: linear-gradient(135deg,#FFF7ED,#FFEDD5); color: #EA580C; }
.stat-icon.purple { background: linear-gradient(135deg,#FAF5FF,#EDE9FE); color: #9333EA; }
.stat-icon.red    { background: linear-gradient(135deg,#FEF2F2,#FEE2E2); color: #DC2626; }
.stat-icon.teal   { background: linear-gradient(135deg,#F0FDFA,#CCFBF1); color: #0D9488; }
.stat-icon.sky    { background: linear-gradient(135deg,#F0F9FF,#E0F2FE); color: #0284C7; }
.stat-icon.pink   { background: linear-gradient(135deg,#FDF2F8,#FCE7F3); color: #BE185D; }
.stat-icon.amber  { background: linear-gradient(135deg,#FFFBEB,#FEF3C7); color: #B45309; }

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: .7rem;
    color: var(--muted);
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 600;
}

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.oms-card {
    background: var(--card);
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    animation: fadeUp .3s ease both;
    overflow: hidden;
}

.oms-card-header {
    padding: 13px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--tbl-hd);
    font-weight: 700;
    font-size: .875rem;
    letter-spacing: -0.01em;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.oms-card-body { padding: 20px; }

.oms-card.card-hover {
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.oms-card.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(var(--brand-rgb),.25);
}

/* ============================================================
   TABLES
   ============================================================ */
.table-oms {
    margin: 0;
    width: 100%;
}

.table-oms thead th {
    background: var(--tbl-hd);
    color: var(--muted);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
    white-space: nowrap;
}

.table-oms tbody td {
    padding: 11px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
    transition: background .1s;
}

.table-oms tbody tr:last-child td { border-bottom: none; }
.table-oms tbody tr:hover td { background: var(--tbl-hov); }

/* Summary rows (invoice subtotal/tax/total) — heavier top border to read as
   a totals block, distinct from the line-item rows above it. */
.table-oms tfoot td {
    padding: 8px 16px;
    font-size: .875rem;
    border-bottom: none;
}
.table-oms tfoot tr:first-child td { border-top: 2px solid var(--border); padding-top: 12px; }

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================================
   MODULE TILES (dashboard grid)
   ============================================================ */
.module-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 22px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    text-decoration: none;
    color: var(--text);
    text-align: center;
    transition: transform .2s, box-shadow .2s, border-color .2s;
    box-shadow: var(--shadow-xs);
    animation: fadeUp .35s ease both;
}

.module-tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(var(--brand-rgb),.3);
    color: var(--text);
}

.module-tile-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    background: var(--brand-lt);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--brand-color);
    transition: transform .2s;
}

.module-tile:hover .module-tile-icon { transform: scale(1.08); }

.module-tile-label {
    font-size: .76rem;
    font-weight: 600;
    color: var(--muted);
    line-height: 1.3;
}

/* ============================================================
   LOGIN PAGE v2 — split layout
   ============================================================ */
.login-wrapper {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.login-left {
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    width: 700px; height: 700px;
    border-radius: 50%;
    background: radial-gradient(circle,rgba(14,165,233,.14) 0%,transparent 65%);
    top: -250px; inset-inline-start: -250px;
    pointer-events: none;
}

.login-left::after {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle,rgba(139,92,246,.1) 0%,transparent 65%);
    bottom: -150px; inset-inline-end: -150px;
    pointer-events: none;
}

.login-left-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 340px;
}

.login-brand-mark {
    width: 60px; height: 60px;
    border-radius: 16px;
    background: var(--brand-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.7rem;
    margin: 0 auto 22px;
    box-shadow: 0 8px 30px rgba(14,165,233,.4);
}

.login-left-title {
    font-size: 1.7rem;
    font-weight: 800;
    color: #F1F5F9;
    letter-spacing: -0.04em;
    margin-bottom: 10px;
    line-height: 1.2;
}

.login-left-desc {
    font-size: .875rem;
    color: #64748B;
    line-height: 1.7;
    margin-bottom: 32px;
}

.login-feature-list {
    list-style: none;
    padding: 0; margin: 0;
    text-align: start;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-feature-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .84rem;
    color: #94A3B8;
}

.login-feature-list li i {
    width: 22px; height: 22px;
    border-radius: 6px;
    background: rgba(14,165,233,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-color);
    font-size: .8rem;
    flex-shrink: 0;
}

.login-right {
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.login-form-wrap {
    width: 100%;
    max-width: 380px;
}

.login-form-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.04em;
    margin-bottom: 4px;
}

.login-form-sub {
    font-size: .875rem;
    color: var(--muted);
    margin-bottom: 28px;
}

/* Legacy centered card — kept for compatibility */
.login-card {
    background: var(--card);
    border-radius: var(--r-2xl);
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-2xl);
    animation: scaleIn .28s ease both;
}

.login-logo {
    width: 52px; height: 52px;
    background: var(--brand-color);
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    margin: 0 auto 20px;
    box-shadow: 0 4px 20px rgba(var(--brand-rgb),.35);
}

/* ============================================================
   COMMAND PALETTE
   ============================================================ */
.cmd-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 72px 16px;
}

.cmd-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn .12s ease;
}

.cmd-modal {
    position: relative;
    width: 100%;
    max-width: 560px;
    background: var(--card);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-2xl);
    border: 1px solid var(--border);
    overflow: hidden;
    animation: scaleIn .15s ease;
}

.cmd-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.cmd-search-icon { color: var(--muted); font-size: 1rem; flex-shrink: 0; }

.cmd-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text);
    outline: none;
    font-family: var(--font-ui);
}

.cmd-input::placeholder { color: var(--muted); }

.cmd-results {
    max-height: 370px;
    overflow-y: auto;
    padding: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.cmd-results::-webkit-scrollbar { width: 4px; }
.cmd-results::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.cmd-group-label {
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    font-weight: 700;
    color: var(--muted);
    padding: 10px 10px 4px;
}

.cmd-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: var(--r);
    cursor: pointer;
    transition: background .1s;
    text-decoration: none;
    color: var(--text);
    font-size: .875rem;
    border: none;
    background: none;
    width: 100%;
    text-align: start;
}

.cmd-item:hover,
.cmd-item.cmd-active {
    background: var(--brand-lt);
    color: var(--text);
}

.cmd-item-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--tbl-hd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    color: var(--brand-color);
    flex-shrink: 0;
}

.cmd-item.cmd-active .cmd-item-icon {
    background: var(--brand-color);
    color: #fff;
}

.cmd-item-label { flex: 1; font-weight: 500; }

.cmd-item-section {
    font-size: .7rem;
    color: var(--muted);
    background: var(--tbl-hd);
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 600;
    white-space: nowrap;
}

.cmd-footer {
    padding: 9px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 16px;
    font-size: .7rem;
    color: var(--muted);
    background: var(--tbl-hd);
}

.cmd-footer span { display: flex; align-items: center; gap: 4px; }

.cmd-footer kbd {
    font-family: var(--font-data);
    font-size: .65rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    color: var(--text);
}

.cmd-empty {
    padding: 36px 20px;
    text-align: center;
    color: var(--muted);
    font-size: .875rem;
}

/* ============================================================
   ATTENDANCE CALENDAR
   ============================================================ */
.att-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.att-cell {
    aspect-ratio: 1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .73rem;
    font-weight: 600;
    transition: transform .15s;
}
.att-cell:hover { transform: scale(1.08); }

.att-present  { background:#dcfce7; color:#16a34a; }
.att-absent   { background:#fee2e2; color:#dc2626; }
.att-late     { background:#fef9c3; color:#ca8a04; }
.att-half_day { background:#dbeafe; color:#2563eb; }
.att-holiday  { background:#f3f4f6; color:#6b7280; }
.att-empty    { background:#f8fafc; color:#cbd5e1; }

/* Attendance heatmap intensity (org-wide % present per day) */
.heat-0 { background:#f8fafc; color:#cbd5e1; }
.heat-1 { background:#fee2e2; color:#b91c1c; }
.heat-2 { background:#fef9c3; color:#a16207; }
.heat-3 { background:#bbf7d0; color:#15803d; }
.heat-4 { background:#22c55e; color:#fff; }

/* Clock */
.clock-display {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--brand-color);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 52px 32px;
    text-align: center;
}

.empty-state-icon {
    width: 68px; height: 68px;
    border-radius: 18px;
    background: var(--tbl-hd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--muted);
    opacity: .6;
    margin-bottom: 18px;
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.empty-state-desc {
    font-size: .85rem;
    color: var(--muted);
    max-width: 300px;
    line-height: 1.6;
}

.empty-state .btn { margin-top: 20px; }

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge {
    font-family: var(--font-ui);
    font-size: .67rem;
    font-weight: 600;
    letter-spacing: .025em;
    padding: 3px 8px;
    border-radius: 99px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 99px;
    white-space: nowrap;
}

.status-badge::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.status-badge.success { background:#f0fdf4; color:#15803d; }
.status-badge.warning { background:#fffbeb; color:#92400e; }
.status-badge.danger  { background:#fef2f2; color:#b91c1c; }
.status-badge.info    { background:#f0f9ff; color:#0369a1; }
.status-badge.muted   { background:var(--tbl-hd); color:var(--muted); }
.status-badge.purple  { background:#f5f3ff; color:#5b21b6; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    border-radius: var(--r-md);
    border: 1px solid transparent;
    font-size: .875rem;
    box-shadow: var(--shadow-sm);
    animation: slideInDown .22s ease both;
}

.alert-success { background:#f0fdf4; border-color:#bbf7d0; color:#15803d; }
.alert-danger  { background:#fef2f2; border-color:#fecaca; color:#b91c1c; }
.alert-warning { background:#fffbeb; border-color:#fde68a; color:#92400e; }
.alert-info    { background:#f0f9ff; border-color:#bae6fd; color:#0369a1; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: .875rem;
    line-height: 1;
    padding: 9px 18px;
    border-radius: var(--r);
    border-width: 1.5px;
    border-style: solid;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    user-select: none;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .2s ease, transform .12s ease;
}

.btn:active:not(:disabled) { transform: scale(.96); }
.btn:disabled,.btn.disabled { opacity:.5; cursor:not-allowed; pointer-events:none; }

.btn .btn-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,.3);
    transform: scale(0);
    animation: btnRipple .55s linear;
    pointer-events: none;
}

.btn-primary {
    --bs-btn-color:#fff; --bs-btn-bg:#0EA5E9; --bs-btn-border-color:#0EA5E9;
    --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#0284C7; --bs-btn-hover-border-color:#0284C7;
    --bs-btn-active-color:#fff; --bs-btn-active-bg:#0284C7; --bs-btn-active-border-color:#0284C7;
    --bs-btn-focus-shadow-rgb:14,165,233;
    --bs-btn-disabled-color:#fff; --bs-btn-disabled-bg:#0EA5E9; --bs-btn-disabled-border-color:#0EA5E9;
}
.btn-primary:hover { box-shadow:0 4px 16px rgba(14,165,233,.35); transform:translateY(-1px); }
.btn-primary:focus-visible { box-shadow:0 0 0 3px rgba(14,165,233,.30); outline:none; }
.btn-primary:active { transform:translateY(0) scale(.96); box-shadow:none; }

.btn-secondary {
    --bs-btn-color:#fff; --bs-btn-bg:#334155; --bs-btn-border-color:#334155;
    --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#1E293B; --bs-btn-hover-border-color:#1E293B;
    --bs-btn-active-color:#fff; --bs-btn-active-bg:#1E293B; --bs-btn-active-border-color:#1E293B;
    --bs-btn-disabled-color:#fff; --bs-btn-disabled-bg:#334155; --bs-btn-disabled-border-color:#334155;
}
.btn-secondary:hover { box-shadow:0 4px 16px rgba(51,65,85,.30); transform:translateY(-1px); }

.btn-success {
    --bs-btn-color:#fff; --bs-btn-bg:#10B981; --bs-btn-border-color:#10B981;
    --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#059669; --bs-btn-hover-border-color:#059669;
    --bs-btn-active-color:#fff; --bs-btn-active-bg:#059669; --bs-btn-active-border-color:#059669;
    --bs-btn-disabled-color:#fff; --bs-btn-disabled-bg:#10B981; --bs-btn-disabled-border-color:#10B981;
}
.btn-success:hover { box-shadow:0 4px 16px rgba(16,185,129,.30); transform:translateY(-1px); }

.btn-danger {
    --bs-btn-color:#fff; --bs-btn-bg:#EF4444; --bs-btn-border-color:#EF4444;
    --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#DC2626; --bs-btn-hover-border-color:#DC2626;
    --bs-btn-active-color:#fff; --bs-btn-active-bg:#DC2626; --bs-btn-active-border-color:#DC2626;
    --bs-btn-disabled-color:#fff; --bs-btn-disabled-bg:#EF4444; --bs-btn-disabled-border-color:#EF4444;
}
.btn-danger:hover { box-shadow:0 4px 16px rgba(239,68,68,.30); transform:translateY(-1px); }

.btn-warning {
    --bs-btn-color:#fff; --bs-btn-bg:#F59E0B; --bs-btn-border-color:#F59E0B;
    --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#D97706; --bs-btn-hover-border-color:#D97706;
    --bs-btn-active-color:#fff; --bs-btn-active-bg:#D97706; --bs-btn-active-border-color:#D97706;
    --bs-btn-disabled-color:#fff; --bs-btn-disabled-bg:#F59E0B; --bs-btn-disabled-border-color:#F59E0B;
}
.btn-warning:hover { box-shadow:0 4px 16px rgba(245,158,11,.30); transform:translateY(-1px); }

.btn-info {
    --bs-btn-color:#fff; --bs-btn-bg:#06B6D4; --bs-btn-border-color:#06B6D4;
    --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#0891B2; --bs-btn-hover-border-color:#0891B2;
    --bs-btn-active-color:#fff; --bs-btn-active-bg:#0891B2; --bs-btn-active-border-color:#0891B2;
    --bs-btn-disabled-color:#fff; --bs-btn-disabled-bg:#06B6D4; --bs-btn-disabled-border-color:#06B6D4;
}
.btn-info:hover { box-shadow:0 4px 16px rgba(6,182,212,.30); transform:translateY(-1px); }

.btn-light {
    --bs-btn-color:#1E293B; --bs-btn-bg:#FFFFFF; --bs-btn-border-color:#E2E8F0;
    --bs-btn-hover-color:#1E293B; --bs-btn-hover-bg:#F8FAFC; --bs-btn-hover-border-color:#CBD5E1;
    --bs-btn-active-color:#1E293B; --bs-btn-active-bg:#F1F5F9; --bs-btn-active-border-color:#CBD5E1;
    --bs-btn-disabled-color:#64748B; --bs-btn-disabled-bg:#FFFFFF; --bs-btn-disabled-border-color:#E2E8F0;
}
.btn-light:hover { box-shadow:0 2px 10px rgba(0,0,0,.08); transform:translateY(-1px); }

.btn-outline-primary {
    --bs-btn-color:#0EA5E9; --bs-btn-bg:transparent; --bs-btn-border-color:#0EA5E9;
    --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#0EA5E9; --bs-btn-hover-border-color:#0EA5E9;
    --bs-btn-active-color:#fff; --bs-btn-active-bg:#0284C7; --bs-btn-active-border-color:#0284C7;
    --bs-btn-disabled-color:#0EA5E9; --bs-btn-disabled-bg:transparent; --bs-btn-disabled-border-color:#0EA5E9;
}
.btn-outline-primary:hover { box-shadow:0 4px 16px rgba(14,165,233,.22); transform:translateY(-1px); }

.btn-outline-secondary {
    --bs-btn-color:#475569; --bs-btn-bg:transparent; --bs-btn-border-color:#E2E8F0;
    --bs-btn-hover-color:#1E293B; --bs-btn-hover-bg:#F8FAFC; --bs-btn-hover-border-color:#CBD5E1;
    --bs-btn-active-color:#1E293B; --bs-btn-active-bg:#F1F5F9; --bs-btn-active-border-color:#CBD5E1;
    --bs-btn-disabled-color:#475569; --bs-btn-disabled-bg:transparent; --bs-btn-disabled-border-color:#E2E8F0;
}
.btn-outline-secondary:hover { transform:translateY(-1px); }

.btn-outline-success {
    --bs-btn-color:#10B981; --bs-btn-bg:transparent; --bs-btn-border-color:#10B981;
    --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#10B981; --bs-btn-hover-border-color:#10B981;
    --bs-btn-active-color:#fff; --bs-btn-active-bg:#059669; --bs-btn-active-border-color:#059669;
    --bs-btn-disabled-color:#10B981; --bs-btn-disabled-bg:transparent; --bs-btn-disabled-border-color:#10B981;
}
.btn-outline-success:hover { box-shadow:0 4px 16px rgba(16,185,129,.22); transform:translateY(-1px); }

.btn-outline-danger {
    --bs-btn-color:#EF4444; --bs-btn-bg:transparent; --bs-btn-border-color:#EF4444;
    --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#EF4444; --bs-btn-hover-border-color:#EF4444;
    --bs-btn-active-color:#fff; --bs-btn-active-bg:#DC2626; --bs-btn-active-border-color:#DC2626;
    --bs-btn-disabled-color:#EF4444; --bs-btn-disabled-bg:transparent; --bs-btn-disabled-border-color:#EF4444;
}
.btn-outline-danger:hover { box-shadow:0 4px 16px rgba(239,68,68,.22); transform:translateY(-1px); }

.btn-outline-warning {
    --bs-btn-color:#F59E0B; --bs-btn-bg:transparent; --bs-btn-border-color:#F59E0B;
    --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#F59E0B; --bs-btn-hover-border-color:#F59E0B;
    --bs-btn-active-color:#fff; --bs-btn-active-bg:#D97706; --bs-btn-active-border-color:#D97706;
    --bs-btn-disabled-color:#F59E0B; --bs-btn-disabled-bg:transparent; --bs-btn-disabled-border-color:#F59E0B;
}
.btn-outline-warning:hover { transform:translateY(-1px); }

.btn-ghost {
    --bs-btn-color:#64748B; --bs-btn-bg:transparent; --bs-btn-border-color:transparent;
    --bs-btn-hover-color:#1E293B; --bs-btn-hover-bg:#F8FAFC; --bs-btn-hover-border-color:transparent;
    --bs-btn-active-color:#1E293B; --bs-btn-active-bg:#F1F5F9; --bs-btn-active-border-color:transparent;
    --bs-btn-disabled-color:#64748B; --bs-btn-disabled-bg:transparent; --bs-btn-disabled-border-color:transparent;
}

.btn-sm  { font-size:.78rem;  padding:6px 13px;  border-radius:var(--r-sm); gap:5px; }
.btn-lg  { font-size:1rem;    padding:12px 26px; border-radius:var(--r-md); gap:8px; font-weight:600; }
.btn-icon        { padding:8px;  width:36px; height:36px; border-radius:var(--r); }
.btn-icon.btn-sm { padding:6px;  width:30px; height:30px; }
.btn-icon.btn-lg { padding:10px; width:44px; height:44px; }

.btn.btn-loading { pointer-events:none; opacity:.8; }
.btn.btn-loading::before {
    content:'';
    width:13px; height:13px;
    border:2px solid rgba(255,255,255,.35);
    border-top-color:#fff;
    border-radius:50%;
    animation:btnSpin .6s linear infinite;
    flex-shrink:0;
}
.btn-loading.btn-outline-primary::before,.btn-loading.btn-ghost::before {
    border-color:rgba(14,165,233,.25); border-top-color:#0EA5E9;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control,.form-select {
    font-family: var(--font-ui);
    font-size: .875rem;
    border-radius: var(--r-sm);
    border-color: var(--border);
    background-color: var(--card);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}

.form-label {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .03em;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 5px;
}

.form-control:focus,.form-select:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.12);
    outline: none;
    background-color: var(--card);
}

.form-control::placeholder { color:#94A3B8; }
.form-text { font-size:.775rem; color:var(--muted); margin-top:4px; }

.input-group-text {
    background: var(--tbl-hd);
    border-color: var(--border);
    color: var(--muted);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.divider-label {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 16px 0;
}
.divider-label::before,.divider-label::after { content:''; flex:1; height:1px; background:var(--border); }

.breadcrumb { font-size:.8rem; color:var(--muted); margin-bottom:4px; }
.breadcrumb-item + .breadcrumb-item::before { color:var(--border); }
.breadcrumb-item.active { color:var(--text); font-weight:500; }

.skeleton {
    background: linear-gradient(90deg,var(--tbl-hd) 25%,var(--border) 50%,var(--tbl-hd) 75%);
    background-size: 400px 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: var(--r-sm);
}
.skeleton-text   { height:13px; margin-bottom:8px; }
.skeleton-title  { height:20px; width:50%; margin-bottom:12px; }
.skeleton-avatar { width:44px; height:44px; border-radius:50%; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp      { from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:translateY(0)} }
@keyframes fadeIn      { from{opacity:0} to{opacity:1} }
@keyframes fadeOut     { from{opacity:1} to{opacity:0} }
@keyframes scaleIn     { from{opacity:0;transform:scale(.95)} to{opacity:1;transform:scale(1)} }
@keyframes slideInDown { from{opacity:0;transform:translateY(-10px)} to{opacity:1;transform:translateY(0)} }
@keyframes slideInRight{ from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }
@keyframes shimmer     { 0%{background-position:-400px 0} 100%{background-position:400px 0} }
@keyframes progressFill{ from{width:0} }
@keyframes btnRipple   { to{transform:scale(4);opacity:0} }
@keyframes btnSpin     { to{transform:rotate(360deg)} }

.anim-fade-up    { animation:fadeUp    .35s ease both; }
.anim-fade-in    { animation:fadeIn    .3s  ease both; }
.anim-scale-in   { animation:scaleIn   .25s ease both; }
.anim-slide-down { animation:slideInDown .25s ease both; }

.anim-stagger>* { animation:fadeUp .35s ease both; }
.anim-stagger>*:nth-child(1){animation-delay:.04s}
.anim-stagger>*:nth-child(2){animation-delay:.08s}
.anim-stagger>*:nth-child(3){animation-delay:.12s}
.anim-stagger>*:nth-child(4){animation-delay:.16s}
.anim-stagger>*:nth-child(5){animation-delay:.20s}
.anim-stagger>*:nth-child(6){animation-delay:.24s}
.anim-stagger>*:nth-child(n+7){animation-delay:.28s}

.row .stat-card:nth-child(1){animation-delay:.04s}
.row .stat-card:nth-child(2){animation-delay:.08s}
.row .stat-card:nth-child(3){animation-delay:.12s}
.row .stat-card:nth-child(4){animation-delay:.16s}
.row .stat-card:nth-child(5){animation-delay:.20s}
.row .stat-card:nth-child(6){animation-delay:.24s}

.progress-bar { animation:progressFill .8s cubic-bezier(.4,0,.2,1) both; }

/* ============================================================
   ROLE THEMES
   ============================================================ */

/* ── Admin: Purple ── */
body[data-role="admin"] {
    --brand-color:      #7C3AED;
    --brand-hover:      #6D28D9;
    --brand-lt:         #F5F3FF;
    --brand-bd:         #DDD6FE;
    --brand-rgb:        124,58,237;
    --sidebar-bg:       #1E1B4B;
    --sidebar-hover:    #2D2A6E;
    --sidebar-active:   #8B5CF6;
    --sidebar-active-bg:rgba(139,92,246,.14);
    --sidebar-text:     #C4B5FD;
    --tbl-hov:          #F5F3FF;
}
body[data-role="admin"] .btn-primary {
    --bs-btn-bg:#7C3AED; --bs-btn-border-color:#7C3AED;
    --bs-btn-hover-bg:#6D28D9; --bs-btn-hover-border-color:#6D28D9;
    --bs-btn-active-bg:#6D28D9; --bs-btn-active-border-color:#6D28D9;
    --bs-btn-disabled-bg:#7C3AED; --bs-btn-disabled-border-color:#7C3AED;
}
body[data-role="admin"] .btn-primary:hover { box-shadow:0 4px 16px rgba(124,58,237,.35); }
body[data-role="admin"] .btn-primary:focus-visible { box-shadow:0 0 0 3px rgba(124,58,237,.30); }
body[data-role="admin"] .btn-outline-primary {
    --bs-btn-color:#7C3AED; --bs-btn-border-color:#7C3AED;
    --bs-btn-hover-bg:#7C3AED; --bs-btn-hover-border-color:#7C3AED;
    --bs-btn-active-bg:#6D28D9; --bs-btn-active-border-color:#6D28D9;
    --bs-btn-disabled-color:#7C3AED; --bs-btn-disabled-border-color:#7C3AED;
}
body[data-role="admin"] .btn-outline-primary:hover { box-shadow:0 4px 16px rgba(124,58,237,.22); }
body[data-role="admin"] .stat-icon.blue { background:linear-gradient(135deg,#F5F3FF,#EDE9FE); color:#7C3AED; }
body[data-role="admin"] .avatar-circle  { background:#7C3AED; }
body[data-role="admin"] .topbar-avatar  { background:#7C3AED; }
body[data-role="admin"] .sidebar-brand-icon { background:#8B5CF6; }
body[data-role="admin"] .form-control:focus,.btn[data-role="admin"] .form-select:focus { border-color:#7C3AED; box-shadow:0 0 0 3px rgba(124,58,237,.12); }
body[data-role="admin"] .form-control:focus,.form-select:focus { border-color:#7C3AED; box-shadow:0 0 0 3px rgba(124,58,237,.12); }
body[data-role="admin"] .progress-bar   { background-color:#7C3AED; }
body[data-role="admin"] .text-primary   { color:#7C3AED !important; }
body[data-role="admin"] .bg-primary     { background-color:#7C3AED !important; }
body[data-role="admin"] .border-primary { border-color:#7C3AED !important; }
body[data-role="admin"] .badge.bg-primary { background-color:#7C3AED !important; }
body[data-role="admin"] .module-tile-icon { background:#F5F3FF; color:#7C3AED; }
body[data-role="admin"] .cmd-item-icon  { color:#7C3AED; }
body[data-role="admin"] .cmd-item.cmd-active .cmd-item-icon { background:#7C3AED; }

/* ── HR: Teal ── */
body[data-role="hr"] {
    --brand-color:      #0D9488;
    --brand-hover:      #0F766E;
    --brand-lt:         #F0FDFA;
    --brand-bd:         #99F6E4;
    --brand-rgb:        13,148,136;
    --sidebar-bg:       #134E4A;
    --sidebar-hover:    #1A5E59;
    --sidebar-active:   #14B8A6;
    --sidebar-active-bg:rgba(20,184,166,.14);
    --sidebar-text:     #99F6E4;
    --tbl-hov:          #F0FDFA;
}
body[data-role="hr"] .btn-primary {
    --bs-btn-bg:#0D9488; --bs-btn-border-color:#0D9488;
    --bs-btn-hover-bg:#0F766E; --bs-btn-hover-border-color:#0F766E;
    --bs-btn-active-bg:#0F766E; --bs-btn-active-border-color:#0F766E;
    --bs-btn-disabled-bg:#0D9488; --bs-btn-disabled-border-color:#0D9488;
}
body[data-role="hr"] .btn-primary:hover { box-shadow:0 4px 16px rgba(13,148,136,.35); }
body[data-role="hr"] .btn-primary:focus-visible { box-shadow:0 0 0 3px rgba(13,148,136,.30); }
body[data-role="hr"] .btn-outline-primary {
    --bs-btn-color:#0D9488; --bs-btn-border-color:#0D9488;
    --bs-btn-hover-bg:#0D9488; --bs-btn-hover-border-color:#0D9488;
    --bs-btn-active-bg:#0F766E; --bs-btn-active-border-color:#0F766E;
    --bs-btn-disabled-color:#0D9488; --bs-btn-disabled-border-color:#0D9488;
}
body[data-role="hr"] .btn-outline-primary:hover { box-shadow:0 4px 16px rgba(13,148,136,.22); }
body[data-role="hr"] .stat-icon.blue { background:linear-gradient(135deg,#F0FDFA,#CCFBF1); color:#0D9488; }
body[data-role="hr"] .avatar-circle  { background:#0D9488; }
body[data-role="hr"] .topbar-avatar  { background:#0D9488; }
body[data-role="hr"] .sidebar-brand-icon { background:#14B8A6; }
body[data-role="hr"] .form-control:focus,.form-select:focus { border-color:#0D9488; box-shadow:0 0 0 3px rgba(13,148,136,.12); }
body[data-role="hr"] .progress-bar   { background-color:#0D9488; }
body[data-role="hr"] .text-primary   { color:#0D9488 !important; }
body[data-role="hr"] .bg-primary     { background-color:#0D9488 !important; }
body[data-role="hr"] .border-primary { border-color:#0D9488 !important; }
body[data-role="hr"] .badge.bg-primary { background-color:#0D9488 !important; }
body[data-role="hr"] .module-tile-icon { background:#F0FDFA; color:#0D9488; }
body[data-role="hr"] .cmd-item-icon  { color:#0D9488; }
body[data-role="hr"] .cmd-item.cmd-active .cmd-item-icon { background:#0D9488; }

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] body,
[data-theme="dark"] {
    --bg:      #0B1120;
    --card:    #1E293B;
    --border:  #334155;
    --text:    #F1F5F9;
    --muted:   #94A3B8;
    --subtle:  #162032;
    --tbl-hd:  #162032;
    --tbl-hov: #1E2D45;
}

[data-theme="dark"] body { background:var(--bg); color:var(--text); }

[data-theme="dark"] .top-navbar {
    background: rgba(30,41,59,.92);
    border-bottom-color: var(--border);
}

[data-theme="dark"] .topbar-search-btn {
    background: var(--subtle);
    border-color: var(--border);
    color: var(--muted);
}
[data-theme="dark"] .topbar-search-btn:hover {
    background: var(--card);
    border-color: var(--brand-color);
}

[data-theme="dark"] .topbar-btn { color:var(--muted); }
[data-theme="dark"] .topbar-btn:hover { background:var(--subtle); color:var(--text); }

[data-theme="dark"] .oms-card { background:var(--card); border-color:var(--border); }
[data-theme="dark"] .oms-card-header { background:var(--subtle); border-color:var(--border); color:var(--text); }

[data-theme="dark"] .stat-card { background:var(--card); border-color:var(--border); }
[data-theme="dark"] .table-oms thead th { background:var(--subtle); border-color:var(--border); }
[data-theme="dark"] .table-oms tbody td { border-color:var(--border); color:var(--text); }
[data-theme="dark"] .table-oms tbody tr:hover td { background:var(--tbl-hov); }
[data-theme="dark"] .table-oms tfoot tr:first-child td { border-top-color:var(--border); }

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: var(--subtle);
    border-color: var(--border);
    color: var(--text);
}
[data-theme="dark"] .form-control::placeholder { color:#475569; }
[data-theme="dark"] .input-group-text { background:var(--subtle); border-color:var(--border); color:var(--muted); }

[data-theme="dark"] .btn-light {
    --bs-btn-bg:#334155; --bs-btn-border-color:#475569; --bs-btn-color:#F1F5F9;
    --bs-btn-hover-bg:#475569; --bs-btn-hover-color:#F1F5F9;
}

[data-theme="dark"] .login-right { background:var(--card); }
[data-theme="dark"] .login-card  { background:var(--card); border-color:var(--border); }

[data-theme="dark"] .cmd-modal  { background:var(--card); border-color:var(--border); }
[data-theme="dark"] .cmd-footer { background:var(--subtle); border-color:var(--border); }
[data-theme="dark"] .cmd-group-label { color:var(--muted); }
[data-theme="dark"] .cmd-item:hover,
[data-theme="dark"] .cmd-item.cmd-active { background:var(--subtle); }
[data-theme="dark"] .cmd-item-icon { background:var(--subtle); }
[data-theme="dark"] .cmd-footer kbd { background:var(--card); border-color:var(--border); color:var(--text); }

[data-theme="dark"] .alert-success { background:rgba(16,185,129,.1); border-color:rgba(16,185,129,.3); color:#34D399; }
[data-theme="dark"] .alert-danger  { background:rgba(239,68,68,.1);  border-color:rgba(239,68,68,.3);  color:#F87171; }
[data-theme="dark"] .alert-warning { background:rgba(245,158,11,.1); border-color:rgba(245,158,11,.3); color:#FCD34D; }
[data-theme="dark"] .alert-info    { background:rgba(6,182,212,.1);  border-color:rgba(6,182,212,.3);  color:#22D3EE; }

[data-theme="dark"] .status-badge.success { background:rgba(16,185,129,.12); color:#34D399; }
[data-theme="dark"] .status-badge.warning { background:rgba(245,158,11,.12); color:#FCD34D; }
[data-theme="dark"] .status-badge.danger  { background:rgba(239,68,68,.12);  color:#F87171; }
[data-theme="dark"] .status-badge.info    { background:rgba(6,182,212,.12);  color:#22D3EE; }
[data-theme="dark"] .status-badge.muted   { background:var(--subtle); color:var(--muted); }

[data-theme="dark"] .empty-state-icon { background:var(--subtle); }
[data-theme="dark"] .module-tile { background:var(--card); border-color:var(--border); color:var(--text); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .oms-sidebar {
        transform: translateX(-100%);
        height: calc(100vh - 56px - env(safe-area-inset-bottom, 0px));
    }
    [dir="rtl"] .oms-sidebar { transform: translateX(100%); }
    #page-content { inset-inline-start: 0 !important; }

    /* Full-screen mobile navigation grid */
    body.sidebar-open .oms-sidebar {
        transform: translateX(0);
        width: 100vw !important;
        min-width: 100vw !important;
    }

    body.sidebar-open #sidebar-overlay { display: block; }

    /* Nav items as icon tiles */
    body.sidebar-open .sidebar-nav {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        padding: 8px 12px;
        align-content: start;
        -webkit-overflow-scrolling: touch;
    }
    body.sidebar-open .sidebar-nav .nav-link {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 10px 4px;
        border-radius: 10px;
        text-align: center;
        min-height: 70px;
        font-size: .68rem;
        white-space: normal;
        line-height: 1.2;
        position: relative;
        overflow: visible;
    }
    body.sidebar-open .sidebar-nav .nav-link i { font-size: 1.3rem; width: auto; }
    body.sidebar-open .sidebar-nav .nav-label {
        white-space: normal;
        overflow: hidden;
        text-overflow: clip;
        flex: none;
        width: 100%;
    }
    body.sidebar-open .sidebar-nav .nav-link::before { display: none; }
    body.sidebar-open .sidebar-nav .nav-link .badge {
        position: absolute;
        top: 4px; inset-inline-end: 4px;
        min-width: 14px; height: 14px;
        font-size: .5rem; padding: 1px 3px;
    }
    body.sidebar-open .sidebar-nav .nav-section {
        grid-column: 1 / -1;
        padding: 10px 4px 15px;
    }

    /* Footer as compact horizontal row */
    body.sidebar-open .sidebar-footer {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
        padding: 8px 12px;
    }
    body.sidebar-open .sidebar-footer .nav-link {
        flex-direction: column;
        gap: 3px;
        font-size: .63rem;
        padding: 6px 8px;
        border-radius: 8px;
        align-items: center;
        justify-content: center;
        flex: none;
    }
    body.sidebar-open .sidebar-footer .nav-link i { width: auto; font-size: .95rem; }

    /* Reset collapsed styles on mobile */
    body.sidebar-collapsed.sidebar-open .sidebar-brand-name,
    body.sidebar-collapsed.sidebar-open .sidebar-user-info,
    body.sidebar-collapsed.sidebar-open .nav-label,
    body.sidebar-collapsed.sidebar-open .sidebar-nav .badge,
    body.sidebar-collapsed.sidebar-open .nav-section { opacity:1; pointer-events:auto; }
    body.sidebar-collapsed.sidebar-open .sidebar-nav .nav-link { gap:4px; }
    body.sidebar-collapsed.sidebar-open .sidebar-footer .nav-link { gap:3px; }
    body.sidebar-collapsed.sidebar-open .sidebar-brand { justify-content:flex-start; padding:0 14px; }
    body.sidebar-collapsed.sidebar-open .sidebar-user { justify-content:flex-start; padding:10px 14px; }
    body.sidebar-collapsed.sidebar-open .sidebar-pin-btn { transform:none; }
}

@media (max-width: 400px) {
    body.sidebar-open .sidebar-nav {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 576px) {
    .main-content { padding:16px; }
    .login-wrapper { grid-template-columns:1fr; }
    .login-left { display:none; }
    .login-right { padding:32px 24px; }
    .page-header { flex-direction:column; align-items:flex-start; gap:8px; }
    .topbar-date { display:none; }
}

/* Module toggle switches (Settings → Modules) — enlarge tap target so
   small module rows are easy to hit accurately on touch screens */
.module-toggle-row {
    min-height: 44px;
    padding-top: 6px;
    padding-bottom: 6px;
}
.module-toggle-row .form-check-label {
    display: block;
    width: 100%;
    padding: 4px 0;
    cursor: pointer;
}

/* Z-index fixes */
.modal-backdrop { z-index:950 !important; }
.modal          { z-index:1001 !important; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,*::before,*::after {
        animation-duration:.01ms !important;
        animation-iteration-count:1 !important;
        transition-duration:.01ms !important;
    }
}

/* ============================================================
   MOBILE BOTTOM NAVIGATION
   ============================================================ */
.mob-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1100;
    background: var(--sidebar-bg);
    border-top: 1px solid var(--sidebar-border);
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding: 0 4px env(safe-area-inset-bottom, 0px);
    align-items: stretch;
}

.mob-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #64748B;
    text-decoration: none;
    font-size: .6rem;
    font-weight: 500;
    border-radius: 8px;
    padding: 6px 2px 4px;
    min-width: 0;
    transition: color .15s, background .15s;
    cursor: pointer;
    background: none;
    border: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.mob-nav-item i {
    font-size: 1.22rem;
    display: block;
    line-height: 1;
}

/* ============================================================
   GETTING STARTED / SETUP GUIDE OFFCANVAS
   ============================================================ */
.setup-guide-offcanvas {
    width: 50vw !important;
    background: var(--card);
    color: var(--text);
}
@media (max-width: 768px) {
    .setup-guide-offcanvas { width: 100vw !important; }
}

.setup-guide-steps {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setup-guide-step {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.setup-guide-step:last-child { border-bottom: none; }

.setup-guide-step-marker {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--subtle);
    border: 1px solid var(--border);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
}
.setup-guide-step.is-done .setup-guide-step-marker {
    background: var(--clr-success);
    border-color: var(--clr-success);
    color: #fff;
}

.setup-guide-step-title { font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.setup-guide-step-text  { font-size: .85rem; color: var(--muted); line-height: 1.45; }
.setup-guide-step.is-done .setup-guide-step-title { color: var(--muted); }

.setup-guide-more {
    margin-top: 24px;
    padding: 14px 16px;
    background: var(--subtle);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-size: .85rem;
    color: var(--muted);
    line-height: 1.5;
}
.setup-guide-more a { font-weight: 600; white-space: nowrap; }

.mob-nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    line-height: 1.2;
}

.mob-nav-item.active {
    color: var(--brand-color);
}

.mob-nav-item:active,
.mob-nav-item:focus {
    background: rgba(255,255,255,.05);
    color: #CBD5E1;
}

.mob-nav-item.active i {
    filter: drop-shadow(0 0 4px rgba(14,165,233,.5));
}

@media (max-width: 1024px) {
    .mob-bottom-nav { display: flex; }
    .main-content   { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
    .app-footer     { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
    /* Bottom AdSense banner competes for space with the fixed mobile nav bar — hide it below desktop widths */
    #ads-banner-bottom { display: none !important; }
}

/* ============================================================
   PWA BANNERS
   ============================================================ */
#pwaInstallBanner,#pwaIosBanner {
    display:none;
    position:fixed;
    bottom:0; left:0; right:0;
    z-index:9999;
    background:#0F172A;
    border-top:1px solid #334155;
    padding:14px 20px;
    box-shadow:0 -4px 24px rgba(0,0,0,.4);
    animation:pwaSlideUp .35s cubic-bezier(.4,0,.2,1);
}

@keyframes pwaSlideUp {
    from { transform:translateY(100%); opacity:0; }
    to   { transform:translateY(0);    opacity:1; }
}

/* ============================================================
   NOTIFICATION PANEL
   ============================================================ */
.notif-wrapper { position:relative; }

.notif-panel {
    display:none;
    position:absolute;
    top:calc(100% + 6px);
    inset-inline-end:0;
    width:340px;
    background:var(--card);
    border:1px solid var(--border);
    border-radius:12px;
    box-shadow:0 8px 32px rgba(0,0,0,.14),0 1px 4px rgba(0,0,0,.07);
    z-index:8000;
    overflow:hidden;
    flex-direction:column;
    animation:notifFadeIn .14s ease;
}
.notif-panel.open { display:flex; }

@keyframes notifFadeIn {
    from { opacity:0; transform:translateY(-5px); }
    to   { opacity:1; transform:translateY(0); }
}

.notif-panel-hd {
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:11px 14px 9px;
    border-bottom:1px solid var(--border);
    font-size:.875rem;
    font-weight:600;
    color:var(--text);
    flex-shrink:0;
}

.notif-clear-all {
    font-size:.73rem;
    font-weight:500;
    color:var(--brand-color);
    background:none;
    border:none;
    cursor:pointer;
    padding:2px 6px;
    border-radius:var(--r-sm);
    transition:background .14s;
}
.notif-clear-all:hover { background:var(--brand-lt); }

.notif-tabs-row {
    display:flex;
    gap:2px;
    padding:7px 10px 0;
    border-bottom:1px solid var(--border);
    flex-shrink:0;
}

.notif-tab {
    display:inline-flex;
    align-items:center;
    gap:4px;
    padding:5px 10px 6px;
    border:none;
    background:none;
    border-radius:6px 6px 0 0;
    font-size:.775rem;
    font-weight:500;
    color:var(--muted);
    cursor:pointer;
    white-space:nowrap;
    transition:color .13s,background .13s;
}
.notif-tab:hover { color:var(--text); background:var(--subtle); }
.notif-tab.active { color:var(--brand-color); font-weight:600; background:var(--brand-lt); }

.ntab-badge {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:15px;
    height:15px;
    padding:0 4px;
    border-radius:8px;
    background:var(--brand-color);
    color:#fff;
    font-size:.62rem;
    font-weight:700;
    line-height:1;
}

.notif-list {
    max-height:300px;
    overflow-y:auto;
    overflow-x:hidden;
    flex:1;
}

.notif-item {
    display:flex;
    align-items:flex-start;
    gap:10px;
    padding:10px 14px;
    border-bottom:1px solid var(--border);
    text-decoration:none;
    color:var(--text);
    transition:background .12s;
}
.notif-item:last-child { border-bottom:none; }
.notif-item:hover { background:var(--subtle); }

.notif-item-icon {
    width:28px; height:28px;
    border-radius:50%;
    background:var(--subtle);
    display:flex; align-items:center; justify-content:center;
    font-size:.82rem;
    flex-shrink:0;
    margin-top:1px;
}

.notif-item-body { flex:1; min-width:0; }

.notif-item-title {
    font-size:.81rem;
    font-weight:600;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    color:var(--text);
}

.notif-item-preview {
    font-size:.75rem;
    color:var(--muted);
    margin-top:1px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.notif-item-time {
    font-size:.7rem;
    color:var(--muted);
    flex-shrink:0;
    margin-top:2px;
    white-space:nowrap;
}

.notif-empty,.notif-loading {
    text-align:center;
    padding:26px 16px;
    color:var(--muted);
    font-size:.82rem;
}

.notif-panel-ft {
    display:flex;
    justify-content:center;
    gap:14px;
    padding:8px 14px;
    border-top:1px solid var(--border);
    background:var(--subtle);
    flex-shrink:0;
}
.notif-panel-ft a {
    font-size:.75rem;
    color:var(--brand-color);
    text-decoration:none;
    font-weight:500;
}
.notif-panel-ft a:hover { text-decoration:underline; }

[data-theme="dark"] .notif-panel {
    background:var(--card);
    border-color:var(--border);
    box-shadow:0 8px 32px rgba(0,0,0,.45);
}
[data-theme="dark"] .notif-panel-ft { background:var(--subtle); }
[data-theme="dark"] .notif-item:hover { background:var(--subtle); }
[data-theme="dark"] .notif-clear-all:hover { background:rgba(14,165,233,.15); }
[data-theme="dark"] .notif-item-icon { background:rgba(255,255,255,.07); }

@media (max-width:600px) {
    .notif-panel {
        position: fixed;
        top: calc(var(--topbar-height) + 8px);
        left: 12px;
        right: 12px;
        width: auto;
    }
}

/* ============================================================
   TABS / ACCORDION / TIMELINE — shared rich-content components
   No custom styling previously existed for Bootstrap's nav-tabs or
   accordion; these follow the same card/badge language already used
   elsewhere (--r-lg radii, --brand-color accent, --tbl-hd subtle fill)
   so they read as native rather than bolted on. Used first on the
   Patient Profile tabs and Consultation Summary timeline.
   ============================================================ */

/* ── Segmented pill tabs ── */
.nav-tabs {
    border-bottom: none;
    background: var(--tbl-hd);
    border-radius: var(--r-md);
    padding: 4px;
    gap: 2px;
    display: flex;
    flex-wrap: wrap;
}
.nav-tabs .nav-link {
    border: none;
    border-radius: var(--r-sm);
    color: var(--muted);
    font-weight: 600;
    font-size: .85rem;
    padding: 8px 16px;
    transition: background var(--transition,200ms cubic-bezier(.4,0,.2,1)), color var(--transition,200ms cubic-bezier(.4,0,.2,1));
}
.nav-tabs .nav-link:hover {
    color: var(--text);
    background: rgba(var(--brand-rgb), .08);
    isolation: isolate;
}
.nav-tabs .nav-link.active {
    background: var(--card);
    color: var(--brand-color);
    box-shadow: var(--shadow-xs);
}

/* ── Accordion, restyled to match .oms-card ── */
.accordion-item {
    border: 1px solid var(--border);
    border-radius: var(--r-lg) !important;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: var(--shadow-xs);
}
.accordion-item:last-child { margin-bottom: 0; }
.accordion-button {
    font-weight: 600;
    background: var(--card);
    color: var(--text);
}
.accordion-button:not(.collapsed) {
    background: var(--brand-lt);
    color: var(--brand-hover);
    box-shadow: none;
}
.accordion-button:focus { box-shadow: none; border-color: var(--border); }
.accordion-button::after { flex-shrink: 0; }
.accordion-body { background: var(--card); border-top: 1px solid var(--border); }

/* ── Clinical visit timeline (Consultation Summary) ──
   A colored connector rail + dot per visit, echoing a real chart's
   visit history rather than a plain stacked accordion. */
.visit-timeline {
    position: relative;
    padding-left: 22px;
}
.visit-timeline::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: var(--border);
}
.visit-timeline .accordion-item { position: relative; }
.visit-timeline .accordion-item::before {
    content: "";
    position: absolute;
    left: -22px;
    top: 22px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--card);
    border: 3px solid var(--brand-color);
    z-index: 1;
}
.visit-timeline .accordion-item:first-child::before { border-color: var(--clr-success); }

[data-theme="dark"] .nav-tabs .nav-link.active { background: var(--subtle); }
[data-theme="dark"] .accordion-button:not(.collapsed) { background: rgba(var(--brand-rgb), .16); }

/* ── Section label — for grouping a form into visually distinct blocks
   (icon + uppercase muted heading), reused wherever a form has multiple
   logical sections rather than one flat list of fields. ── */
.section-label {
    font-weight: 700;
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .06em;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}
.section-label i { color: var(--brand-color); font-size: .9rem; }

/* ── Chip-style option picker — a hidden radio + styled label "chip"
   instead of a plain radio-button list, for any "pick one of a small set
   of available options" UI (appointment time slots, admission beds, etc.)
   so picking reads as a set of clickable buttons rather than a form
   checklist. Generic on purpose — reused wherever this shape shows up. ── */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-input {
    position: absolute;
    width: 1px; height: 1px;
    opacity: 0;
    pointer-events: none;
}
.chip-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    padding: 8px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    background: var(--card);
    color: var(--text);
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
    transition: background var(--transition,150ms ease), border-color var(--transition,150ms ease), color var(--transition,150ms ease);
    user-select: none;
}
.chip-label:hover { border-color: var(--brand-bd); background: var(--brand-lt); }
.chip-input:checked + .chip-label { background: var(--brand-color); border-color: var(--brand-color); color: #fff; }
.chip-input:focus-visible + .chip-label { outline: 2px solid var(--brand-color); outline-offset: 2px; }
[data-theme="dark"] .chip-label:hover { background: rgba(var(--brand-rgb), .12); }

/* ── Vertical pill nav (Settings' sidebar tab list) — same accent
   language as .nav-tabs, adapted for a stacked list instead of a
   segmented strip. Scoped narrowly since nav-pills is currently only
   used on the Settings page. ── */
.nav-pills .nav-link {
    border-radius: var(--r-sm);
    color: var(--muted);
    font-weight: 600;
    font-size: .85rem;
    padding: 10px 12px;
    transition: background var(--transition,200ms cubic-bezier(.4,0,.2,1)), color var(--transition,200ms cubic-bezier(.4,0,.2,1));
}
.nav-pills .nav-link:hover { color: var(--text); background: var(--subtle); }
.nav-pills .nav-link.active {
    background: var(--brand-lt);
    color: var(--brand-hover);
    font-weight: 700;
}
.nav-pills .nav-link i { width: 18px; text-align: center; }
[data-theme="dark"] .nav-pills .nav-link.active { background: rgba(var(--brand-rgb), .16); }

/* ============================================================
   PAGINATION  (.oms-pagination — output of paginationLinks())
   ------------------------------------------------------------
   Replaces the Bootstrap .pagination default. Sits as a full-width
   flex row so it reads the same whether the call site wraps it in a
   plain .p-3 or in a .d-flex.justify-content-end footer: the record
   summary hugs the left, the controls the right.
   ============================================================ */
.oms-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    width: 100%;
}

.oms-pagination .page-summary {
    font-size: .78rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.oms-pagination .page-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;   /* stays right even when the summary is absent */
}

.oms-pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
    box-shadow: none;
    transition: background var(--transition,200ms cubic-bezier(.4,0,.2,1)),
                color      var(--transition,200ms cubic-bezier(.4,0,.2,1)),
                border-color var(--transition,200ms cubic-bezier(.4,0,.2,1));
}

.oms-pagination a.page-link:hover {
    background: var(--subtle);
    border-color: var(--border);
    color: var(--text);
}
.oms-pagination a.page-link:focus-visible {
    outline: 2px solid var(--brand-color);
    outline-offset: 1px;
}

.oms-pagination .page-link.is-current {
    background: var(--brand-color);
    border-color: var(--brand-color);
    color: #fff;
    cursor: default;
}

.oms-pagination .page-arrow {
    border-color: var(--border);
    color: var(--text);
}
.oms-pagination .page-arrow i { font-size: .75rem; }

.oms-pagination .page-link.is-disabled {
    opacity: .38;
    cursor: default;
    border-color: var(--border);
}

.oms-pagination .page-gap {
    padding: 0 2px;
    color: var(--muted);
    font-size: .8rem;
    user-select: none;
}

/* Numbers are the first thing to go on a narrow screen — the arrows and
   the record count still tell you where you are. */
@media (max-width: 575.98px) {
    .oms-pagination { justify-content: center; }
    .oms-pagination .page-links { margin-left: 0; }
    .oms-pagination .page-links .page-link:not(.page-arrow):not(.is-current),
    .oms-pagination .page-gap { display: none; }
}

[data-theme="dark"] .oms-pagination a.page-link:hover { background: var(--subtle); }
[data-theme="dark"] .oms-pagination .page-link.is-current { color: #06131f; }

/* ============================================================
   CONSULTATION FORM  (modules/consultations/create|edit)
   ------------------------------------------------------------
   Two columns instead of one 900px-capped card: the clinical
   narrative (complaints → diagnosis → Rx → surgeries) on the left,
   and the structured short fields (vitals, advice, follow-up) plus
   the save actions in a rail that stays put while the left side
   scrolls. Below 1400px it collapses back to a single column.

   .consult-card / .consult-rail are also used by the appointment
   booking screen, which wants the same main-plus-sticky-rail shape.
   ============================================================ */
.consult-card { overflow: visible; }               /* catalog dropdowns escape the card */
.consult-card .oms-card-header { padding: 11px 18px; }
.consult-card .oms-card-header .section-label { margin-bottom: 0; }
.consult-card .oms-card-body { padding: 16px 18px; }

@media (min-width: 1400px) {
    .consult-rail { position: sticky; top: 0; }
}

/* Vitals: a dense grid rather than six equal Bootstrap columns, so six
   numbers occupy a rail instead of a full-width row of near-empty space. */
.consult-vitals {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 14px;
}
@media (min-width: 576px) and (max-width: 1399.98px) {
    .consult-vitals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.consult-vitals .vital-field label {
    display: block;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    margin-bottom: 4px;
}
.consult-vitals .vital-field input { font-variant-numeric: tabular-nums; }

.consult-actions .btn { font-weight: 600; }

/* ── Quick date-range chips — link-based siblings of .chip-label (which is
   radio-driven and so can't express a GET-navigation filter). Used above a
   from/to pair to make the common ranges one click instead of two date
   pickers. ── */
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    color: var(--muted);
    font-size: .78rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--transition,150ms ease), border-color var(--transition,150ms ease), color var(--transition,150ms ease);
}
a.filter-chip:hover { border-color: var(--brand-bd); background: var(--brand-lt); color: var(--brand-hover); }
.filter-chip.is-active {
    background: var(--brand-color);
    border-color: var(--brand-color);
    color: #fff;
}
a.filter-chip:focus-visible { outline: 2px solid var(--brand-color); outline-offset: 2px; }
[data-theme="dark"] a.filter-chip:hover { background: rgba(var(--brand-rgb), .12); }
[data-theme="dark"] .filter-chip.is-active { color: #06131f; }

/* ============================================================
   APPOINTMENT BOOKING  (modules/appointments/create)
   ------------------------------------------------------------
   A three-step single screen: who → when → confirm. The slot
   grid and the running summary replace the old "submit a GET to
   see availability" round-trip.
   ============================================================ */

/* Numbered step marker inside a .section-label card header. */
.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--brand-color);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Date stepper ── */
.date-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.date-nav input[type="date"] { width: auto; min-width: 165px; }
.date-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: background var(--transition,150ms ease), border-color var(--transition,150ms ease);
}
.date-nav-btn:hover { background: var(--subtle); border-color: var(--brand-bd); }
.date-nav-btn:focus-visible { outline: 2px solid var(--brand-color); outline-offset: 1px; }

/* ── Slots, split into morning / afternoon / evening ──
   A flat list of 30+ times is unscannable; the part of day is how
   people actually ask for an appointment. */
.slot-group + .slot-group { margin-top: 18px; }
.slot-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    margin-bottom: 9px;
}
.slot-group-title span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    padding: 0 6px;
    height: 18px;
    border-radius: 999px;
    background: var(--subtle);
    border: 1px solid var(--border);
    font-size: .66rem;
    color: var(--muted);
}

.slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
    gap: 8px;
}

.slot-chip {
    padding: 9px 6px;
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    background: var(--card);
    color: var(--text);
    font-size: .82rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background var(--transition,150ms ease), border-color var(--transition,150ms ease), color var(--transition,150ms ease);
}
.slot-chip:hover { border-color: var(--brand-bd); background: var(--brand-lt); color: var(--brand-hover); }
.slot-chip:focus-visible { outline: 2px solid var(--brand-color); outline-offset: 2px; }
.slot-chip.is-selected {
    background: var(--brand-color);
    border-color: var(--brand-color);
    color: #fff;
}
[data-theme="dark"] .slot-chip:hover { background: rgba(var(--brand-rgb), .12); }
[data-theme="dark"] .slot-chip.is-selected { color: #06131f; }

.slot-empty {
    text-align: center;
    padding: 34px 16px;
    color: var(--muted);
    font-size: .85rem;
}
.slot-empty i { font-size: 1.7rem; display: block; margin-bottom: 10px; opacity: .55; }

/* ── Running booking summary in the rail ── */
.booking-summary { list-style: none; padding: 0; margin: 0; }
.booking-summary li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.booking-summary li:last-child { border-bottom: 0; }
.booking-summary .bs-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .76rem;
    color: var(--muted);
    white-space: nowrap;
}
.booking-summary .bs-label i { color: var(--brand-color); font-size: .82rem; }
.booking-summary .bs-value {
    font-size: .84rem;
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}
.booking-summary .bs-value.is-empty { font-weight: 500; color: var(--muted); font-style: italic; }
