/* ==========================================================================
   ZKTeco ADMS Cloud — Enterprise Design System (zk-enterprise.css)
   Offline-first, CSP-safe, Light + NOC Dark Mode, Tabular Precision UI
   ========================================================================== */

:root {
    --zk-font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
    --zk-font-mono: 'JetBrains Mono', 'Cascadia Code', Consolas, 'SFMono-Regular', Menlo, monospace;

    /* Surface & Canvas Tokens (Light Mode) */
    --zk-bg-canvas: #f1f5f9;
    --zk-bg-canvas-accent: radial-gradient(1100px 420px at 18% -8%, rgba(37, 99, 235, 0.07), transparent 60%),
                           radial-gradient(900px 360px at 88% -10%, rgba(14, 165, 233, 0.06), transparent 55%);
    --zk-bg-surface: #ffffff;
    --zk-bg-subtle: #f8fafc;
    --zk-bg-muted: #f1f5f9;
    --zk-bg-topbar: rgba(255, 255, 255, 0.86);
    --zk-bg-hover: rgba(37, 99, 235, 0.035);
    --zk-bg-active-row: #eff6ff;

    /* Typography Tokens */
    --zk-text-primary: #0f172a;
    --zk-text-secondary: #475569;
    --zk-text-muted: #64748b;
    --zk-text-faint: #94a3b8;

    /* Borders & Elevation */
    --zk-border: #e2e8f0;
    --zk-border-strong: #cbd5e1;
    --zk-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --zk-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --zk-shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    --zk-shadow-lg: 0 20px 44px -10px rgba(15, 23, 42, 0.16), 0 4px 12px -2px rgba(15, 23, 42, 0.06);

    /* Brand & Semantic Accents (Al-Mo3awen Signature Orange + Enterprise Cobalt) */
    --zk-brand-orange: #ea580c;
    --zk-brand-orange-light: #f97316;
    --zk-primary: #2563eb;
    --zk-primary-hover: #1d4ed8;
    --zk-primary-soft: rgba(37, 99, 235, 0.10);
    --zk-cyan: #0284c7;
    --zk-emerald: #10b981;
    --zk-amber: #f59e0b;
    --zk-danger: #e11d48;

    /* Sidebar Dimensions */
    --zk-sidebar-width: 268px;
    --zk-sidebar-rail-width: 76px;
    --zk-radius-sm: 0.425rem;
    --zk-radius-md: 0.65rem;
    --zk-radius-lg: 0.875rem;
    --zk-radius-xl: 1.15rem;
}

html[data-sidebar="collapsed"] {
    --zk-sidebar-width: 76px;
}

[data-theme="dark"] {
    --zk-bg-canvas: #090d16;
    --zk-bg-canvas-accent: radial-gradient(1000px 400px at 20% -8%, rgba(56, 189, 248, 0.08), transparent 60%),
                           radial-gradient(850px 350px at 85% -10%, rgba(37, 99, 235, 0.08), transparent 55%);
    --zk-bg-surface: #111827;
    --zk-bg-subtle: #162032;
    --zk-bg-muted: #1e293b;
    --zk-bg-topbar: rgba(17, 24, 39, 0.84);
    --zk-bg-hover: rgba(56, 189, 248, 0.055);
    --zk-bg-active-row: rgba(37, 99, 235, 0.18);

    --zk-text-primary: #f1f5f9;
    --zk-text-secondary: #cbd5e1;
    --zk-text-muted: #94a3b8;
    --zk-text-faint: #64748b;

    --zk-border: #1e293b;
    --zk-border-strong: #334155;
    --zk-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
    --zk-shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.32);
    --zk-shadow-md: 0 10px 28px -4px rgba(0, 0, 0, 0.45);
    --zk-shadow-lg: 0 24px 48px -10px rgba(0, 0, 0, 0.65);

    --zk-primary: #3b82f6;
    --zk-primary-hover: #2563eb;
    --zk-primary-soft: rgba(59, 130, 246, 0.16);
}

/* Base Canvas & Typography */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--zk-bg-canvas);
    background-image: var(--zk-bg-canvas-accent);
    background-attachment: fixed;
    color: var(--zk-text-primary);
    font-family: var(--zk-font-sans);
    font-size: 0.925rem;
    line-height: 1.5;
}

/* Tabular Numbers for Swiss-Instrument Alignment */
.tabular-nums,
.exec-kpi-value,
.font-monospace,
code,
.badge,
.table td {
    font-variant-numeric: tabular-nums;
}

.font-monospace,
code {
    font-family: var(--zk-font-mono) !important;
    direction: ltr;
    unicode-bidi: isolate;
}

code {
    font-size: 0.82em;
    padding: 0.12rem 0.38rem;
    border-radius: 0.3rem;
    background: var(--zk-bg-muted);
    color: var(--zk-primary);
    border: 1px solid var(--zk-border);
}

[data-theme="dark"] .text-dark {
    color: var(--zk-text-primary) !important;
}
[data-theme="dark"] .text-secondary {
    color: var(--zk-text-secondary) !important;
}
[data-theme="dark"] .text-muted {
    color: var(--zk-text-muted) !important;
}
[data-theme="dark"] .bg-light {
    background-color: var(--zk-bg-subtle) !important;
}
[data-theme="dark"] .border {
    border-color: var(--zk-border-strong) !important;
}

/* Custom Subtle Scrollbars */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.42);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.65);
}

/* ==========================================================================
   1. Application Shell: Sidebar & Sticky Glass Topbar
   ========================================================================== */

.sidebar {
    min-height: 100vh;
    width: var(--zk-sidebar-width);
    background: radial-gradient(circle at 0% 0%, rgba(249, 115, 22, 0.09), transparent 36%),
                linear-gradient(180deg, #080d19 0%, #0f172a 55%, #111c33 100%);
    color: #f8fafc;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1045;
    border-right: 1px solid rgba(148, 163, 184, 0.14);
    transition: width 0.24s cubic-bezier(0.16, 1, 0.3, 1), transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 1.05rem 1rem 0.95rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.sidebar-brand-lockup {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.7rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(249, 115, 22, 0.07) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar-brand-lockup:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.065) 0%, rgba(249, 115, 22, 0.12) 100%);
    border-color: rgba(251, 146, 60, 0.28);
    transform: translateY(-1px);
}

.brand-wordmark-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.brand-wordmark-img {
    height: 31px;
    width: auto;
    object-fit: contain;
    display: block;
}

.brand-arabic-sub {
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 500;
    margin-top: 0.2rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.brand-mark-tile {
    width: 42px;
    height: 42px;
    border-radius: 0.68rem;
    background: radial-gradient(circle at 50% 35%, rgba(251, 146, 60, 0.22) 0%, rgba(15, 23, 42, 0.85) 100%);
    border: 1px solid rgba(251, 146, 60, 0.32);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-mark-tile img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.35));
}

.rail-brand-icon {
    display: none;
    width: 44px;
    height: 44px;
    margin: 0 auto;
    border-radius: 0.72rem;
    background: radial-gradient(circle at 50% 35%, rgba(251, 146, 60, 0.24) 0%, rgba(15, 23, 42, 0.92) 100%);
    border: 1px solid rgba(251, 146, 60, 0.36);
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    text-decoration: none;
    transition: all 0.18s ease;
}

.rail-brand-icon:hover {
    border-color: #fb923c;
    transform: scale(1.04);
}

.rail-brand-icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.almoawen-auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 0.95rem;
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(251, 146, 60, 0.25);
    backdrop-filter: blur(8px);
}

.almoawen-auth-logo .auth-wm {
    height: 36px;
    width: auto;
    object-fit: contain;
    display: block;
}

.almoawen-auth-logo .auth-mk {
    width: 38px;
    height: 38px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.4));
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #64748b;
    padding: 1rem 1.15rem 0.38rem;
    white-space: nowrap;
}

.sidebar .nav-link {
    color: #cbd5e1;
    padding: 0.48rem 0.68rem;
    border-radius: 0.62rem;
    margin: 0.16rem 0.72rem;
    font-size: 0.865rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.72rem;
    position: relative;
    white-space: nowrap;
    transition: all 0.16s ease;
}

.sidebar .nav-icon-box {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.98rem;
    color: #94a3b8;
    flex-shrink: 0;
    transition: all 0.16s ease;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.065);
    color: #ffffff;
}

.sidebar .nav-link:hover .nav-icon-box {
    background: rgba(255, 255, 255, 0.11);
    border-color: rgba(255, 255, 255, 0.16);
    color: #f8fafc;
    transform: scale(1.04);
}

.sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.18) 0%, rgba(37, 99, 235, 0.08) 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.28);
}

.sidebar .nav-link.active::before {
    content: "";
    position: absolute;
    left: -0.72rem;
    top: 20%;
    bottom: 20%;
    width: 3.5px;
    border-radius: 0 4px 4px 0;
    background: #f97316;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.85);
}

.sidebar .nav-link.active .nav-icon-box {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    border-color: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.38);
}

/* Contextual Sub-Navigation Branch */
.sidebar-subnav {
    margin: 0.1rem 0.72rem 0.35rem 1.72rem;
    padding-left: 0.85rem;
    border-left: 1.5px solid rgba(148, 163, 184, 0.22);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sidebar-subnav-link {
    font-size: 0.78rem;
    color: #94a3b8;
    text-decoration: none;
    padding: 0.34rem 0.6rem;
    border-radius: 0.42rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.14s ease;
}

.sidebar-subnav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-subnav-link.active {
    color: #fb923c;
    font-weight: 600;
    background: rgba(249, 115, 22, 0.11);
}

.sidebar-status-card {
    margin: 0.75rem;
    padding: 0.78rem 0.88rem;
    border-radius: 0.65rem;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.14);
    font-size: 0.73rem;
    color: #94a3b8;
}

.sidebar-rail-status {
    display: none;
    padding: 0.85rem 0;
    justify-content: center;
}

/* Desktop Collapsed Rail Mode (76px) */
@media (min-width: 992px) {
    html[data-sidebar="collapsed"] .sidebar-brand-lockup,
    html[data-sidebar="collapsed"] .sidebar-brand-meta,
    html[data-sidebar="collapsed"] .sidebar-section-label,
    html[data-sidebar="collapsed"] .sidebar .nav-label,
    html[data-sidebar="collapsed"] .sidebar .nav-ext-icon,
    html[data-sidebar="collapsed"] .sidebar-subnav,
    html[data-sidebar="collapsed"] .sidebar-status-card {
        display: none !important;
    }

    html[data-sidebar="collapsed"] .rail-brand-icon {
        display: inline-flex;
    }

    html[data-sidebar="collapsed"] .sidebar-rail-status {
        display: flex;
    }

    html[data-sidebar="collapsed"] .sidebar .nav-link {
        justify-content: center;
        padding: 0.45rem;
        margin: 0.25rem 0.75rem;
    }
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(9, 13, 22, 0.58);
    backdrop-filter: blur(2px);
    z-index: 1040;
}

.main-wrapper {
    margin-left: var(--zk-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: var(--zk-bg-topbar);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--zk-border);
    padding: 0.68rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.sidebar-collapse-btn {
    width: 34px;
    height: 34px;
    border-radius: 0.5rem;
    border: 1px solid var(--zk-border);
    background: var(--zk-bg-subtle);
    color: var(--zk-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.sidebar-collapse-btn:hover {
    border-color: var(--zk-border-strong);
    color: var(--zk-primary);
    background: var(--zk-bg-surface);
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.38rem;
    font-size: 0.73rem;
    color: var(--zk-text-muted);
    font-weight: 500;
}

.topbar-breadcrumb a {
    color: var(--zk-text-muted);
    text-decoration: none;
    transition: color 0.14s ease;
}

.topbar-breadcrumb a:hover {
    color: var(--zk-primary);
}

.topbar-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--zk-text-primary);
    letter-spacing: -0.01em;
}

.user-profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.26rem 0.68rem 0.26rem 0.32rem;
    border-radius: 999px;
    background: var(--zk-bg-subtle);
    border: 1px solid var(--zk-border);
    color: var(--zk-text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.user-profile-btn:hover,
.user-profile-btn[aria-expanded="true"] {
    border-color: var(--zk-primary);
    background: var(--zk-bg-surface);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.user-avatar-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #0284c7 100%);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}

.theme-toggle-btn {
    width: 34px;
    height: 34px;
    border-radius: 0.5rem;
    border: 1px solid var(--zk-border);
    background: var(--zk-bg-subtle);
    color: var(--zk-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
    border-color: var(--zk-border-strong);
    color: var(--zk-primary);
    background: var(--zk-bg-surface);
}

.content-area {
    padding: 1.45rem 1.6rem 2.25rem;
    flex: 1;
    min-width: 0;
    max-width: 1680px;
    width: 100%;
    margin: 0 auto;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
    }
    .sidebar-backdrop.is-open {
        display: block;
    }
    .main-wrapper {
        margin-left: 0;
    }
    .topbar {
        padding: 0.65rem 1rem;
    }
    .content-area {
        padding: 1rem 1rem 1.75rem;
    }
}

/* ==========================================================================
   2. Cards, Page Headers, Tables & Controls
   ========================================================================== */

.card {
    background-color: var(--zk-bg-surface);
    border: 1px solid var(--zk-border);
    border-radius: var(--zk-radius-lg);
    box-shadow: var(--zk-shadow-xs);
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.card-header {
    background-color: var(--zk-bg-surface);
    border-bottom: 1px solid var(--zk-border);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--zk-text-primary);
    padding: 0.9rem 1.25rem;
    border-radius: var(--zk-radius-lg) var(--zk-radius-lg) 0 0 !important;
}

.page-hero-strip {
    background: var(--zk-bg-surface);
    border: 1px solid var(--zk-border);
    border-radius: var(--zk-radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: var(--zk-shadow-xs);
    margin-bottom: 1.15rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.page-hero-icon {
    width: 44px;
    height: 44px;
    border-radius: 0.7rem;
    background: var(--zk-primary-soft);
    color: var(--zk-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-pill-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.stat-pill {
    background: var(--zk-bg-subtle);
    border: 1px solid var(--zk-border);
    border-radius: 0.5rem;
    padding: 0.35rem 0.7rem;
    font-size: 0.76rem;
    color: var(--zk-text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.stat-pill strong {
    color: var(--zk-text-primary);
    font-weight: 700;
}

/* Enterprise Sticky-Header Tables */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--zk-text-primary);
    --bs-table-border-color: var(--zk-border);
    --bs-table-hover-bg: var(--zk-bg-hover);
    --bs-table-hover-color: var(--zk-text-primary);
    margin-bottom: 0;
}

.table thead.table-light th,
.table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--zk-bg-subtle) !important;
    color: var(--zk-text-muted) !important;
    font-size: 0.69rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.055em;
    padding: 0.68rem 0.9rem;
    border-bottom: 1px solid var(--zk-border) !important;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.7rem 0.9rem;
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Search Input Box with Optional Shortcut Hint */
.table-search-box {
    position: relative;
    width: 245px;
    max-width: 100%;
}

.table-search-box .bi-search {
    position: absolute;
    left: 0.68rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--zk-text-faint);
    font-size: 0.8rem;
    pointer-events: none;
}

.table-search-box input {
    padding-left: 1.95rem;
    border-radius: 0.48rem;
    background-color: var(--zk-bg-subtle);
    border: 1px solid var(--zk-border-strong);
    color: var(--zk-text-primary);
    font-size: 0.8rem;
    transition: all 0.15s ease;
}

.table-search-box input:focus {
    background-color: var(--zk-bg-surface);
    border-color: var(--zk-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

/* Tactile Action Icon Buttons */
.btn-icon {
    width: 31px;
    height: 31px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.44rem;
    font-size: 0.88rem;
    line-height: 1;
    transition: all 0.14s ease;
}

.btn-icon:hover:not(:disabled) {
    transform: translateY(-1px);
}

/* Form Controls Refinement */
.form-control,
.form-select {
    background-color: var(--zk-bg-surface);
    border-color: var(--zk-border-strong);
    color: var(--zk-text-primary);
    border-radius: 0.48rem;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--zk-bg-surface);
    color: var(--zk-text-primary);
    border-color: var(--zk-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.btn-primary {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    border-color: #1d4ed8;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #1e40af;
}

/* Badges, CRC32 & Masked Token Pills */
.token-box {
    font-family: var(--zk-font-mono);
    font-size: 0.76rem;
    background: var(--zk-bg-subtle);
    color: var(--zk-text-secondary);
    border: 1px solid var(--zk-border-strong);
    border-radius: 0.4rem;
    padding: 0.26rem 0.55rem;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: middle;
    direction: ltr;
    unicode-bidi: isolate;
}

.crc-badge {
    font-family: var(--zk-font-mono);
    font-size: 0.79rem;
    font-weight: 700;
    letter-spacing: 0.045em;
    background: rgba(14, 165, 233, 0.12);
    color: #0284c7;
    border: 1px solid rgba(14, 165, 233, 0.28);
    border-radius: 0.4rem;
    padding: 0.2rem 0.55rem;
    display: inline-block;
    direction: ltr;
    unicode-bidi: isolate;
}

[data-theme="dark"] .crc-badge {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.3);
}

.whmcs-id-link {
    font-family: var(--zk-font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--zk-primary);
    background: var(--zk-primary-soft);
    border: 1px solid rgba(37, 99, 235, 0.22);
    border-radius: 0.35rem;
    padding: 0.1rem 0.44rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.26rem;
    white-space: nowrap;
    direction: ltr;
    unicode-bidi: isolate;
    transition: all 0.14s ease;
}

.whmcs-id-link:hover {
    background: var(--zk-primary);
    border-color: var(--zk-primary);
    color: #ffffff !important;
    transform: translateY(-1px);
}

/* ==========================================================================
   Smart Grid System: Sortable Headers, Compact Meta & Action Menus
   ========================================================================== */

.btn,
.badge,
.crc-badge {
    white-space: nowrap;
}

.table th[data-sort] {
    cursor: pointer;
    user-select: none;
    transition: color 0.14s ease, background-color 0.14s ease;
}

.table th[data-sort]:hover {
    color: var(--zk-text-primary) !important;
    background-color: var(--zk-bg-muted) !important;
}

.table th[data-sort]::after {
    content: "↕";
    font-size: 0.68rem;
    opacity: 0.35;
    margin-left: 0.32rem;
    display: inline-block;
}

.table th[data-sort][data-sort-dir="asc"]::after {
    content: "↑";
    opacity: 1;
    color: var(--zk-primary);
}

.table th[data-sort][data-sort-dir="desc"]::after {
    content: "↓";
    opacity: 1;
    color: var(--zk-primary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-dot.is-online {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.status-dot.is-offline {
    background: #94a3b8;
}

.status-dot.is-disabled {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16);
}

.smart-endpoint-pill {
    display: inline-flex;
    align-items: center;
    background: var(--zk-bg-subtle);
    border: 1px solid var(--zk-border-strong);
    border-radius: 0.45rem;
    overflow: hidden;
    white-space: nowrap;
}

.smart-endpoint-pill .crc-part {
    font-family: var(--zk-font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--zk-cyan);
    padding: 0.22rem 0.55rem;
    background: rgba(14, 165, 233, 0.09);
    border-right: 1px solid var(--zk-border-strong);
}

[data-theme="dark"] .smart-endpoint-pill .crc-part {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.14);
}

.smart-endpoint-pill .copy-part {
    border: none;
    background: transparent;
    color: var(--zk-text-secondary);
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.22rem 0.55rem;
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    cursor: pointer;
    transition: all 0.12s ease;
}

.smart-endpoint-pill .copy-part:hover {
    background: var(--zk-primary);
    color: #ffffff;
}

.smart-quota-cell {
    min-width: 185px;
    max-width: 225px;
}

.action-dots-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 0.44rem;
    border: 1px solid var(--zk-border-strong);
    background: var(--zk-bg-surface);
    color: var(--zk-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.14s ease;
}

.action-dots-btn:hover,
.action-dots-btn[aria-expanded="true"] {
    background: var(--zk-bg-subtle);
    color: var(--zk-text-primary);
    border-color: var(--zk-primary);
}

@keyframes zkMenuPop {
    from {
        opacity: 0;
        transform: scale(0.97) translateY(-4px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.smart-dropdown-menu {
    min-width: 215px;
    padding: 0.4rem;
    border-radius: 0.68rem;
    border: 1px solid var(--zk-border-strong);
    background-color: var(--zk-bg-surface);
    box-shadow: var(--zk-shadow-lg);
    font-size: 0.81rem;
    z-index: 1080;
    animation: zkMenuPop 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

.smart-dropdown-menu .dropdown-header {
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--zk-text-faint);
    padding: 0.32rem 0.65rem 0.25rem;
}

.smart-dropdown-menu .dropdown-item {
    border-radius: 0.4rem;
    padding: 0.42rem 0.65rem;
    font-weight: 500;
    color: var(--zk-text-primary);
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.smart-dropdown-menu .dropdown-item i {
    width: 1rem;
    text-align: center;
    color: var(--zk-text-muted);
    font-size: 0.9rem;
}

.smart-dropdown-menu .dropdown-item:hover {
    background-color: var(--zk-bg-subtle);
}

.smart-dropdown-menu .dropdown-item.text-danger i {
    color: var(--zk-danger);
}

.smart-dropdown-menu .dropdown-item.text-danger:hover {
    background-color: rgba(225, 29, 72, 0.09);
}

.row-clickable {
    cursor: pointer;
}

/* ==========================================================================
   3. Executive NOC Dashboard Components
   ========================================================================== */

.sys-telemetry-bar {
    background: linear-gradient(135deg, #0b1120 0%, #131f38 55%, #1e293b 100%);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: var(--zk-radius-lg);
    padding: 0.8rem 1.15rem;
    box-shadow: var(--zk-shadow-sm);
}

.sys-pill {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.45rem;
    padding: 0.26rem 0.65rem;
    font-size: 0.76rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #cbd5e1;
    white-space: nowrap;
}

.sys-pill strong {
    color: #ffffff;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.65); }
    70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.exec-kpi {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--zk-border);
    border-radius: var(--zk-radius-lg);
    background: var(--zk-bg-surface);
    padding: 1.1rem 1.2rem;
    height: 100%;
    box-shadow: var(--zk-shadow-xs);
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.exec-kpi::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--kpi-accent, #2563eb);
    opacity: 0.88;
}

.exec-kpi.kpi-blue { --kpi-accent: linear-gradient(90deg, #2563eb, #38bdf8); }
.exec-kpi.kpi-emerald { --kpi-accent: linear-gradient(90deg, #059669, #34d399); }
.exec-kpi.kpi-amber { --kpi-accent: linear-gradient(90deg, #d97706, #fbbf24); }
.exec-kpi.kpi-cyan { --kpi-accent: linear-gradient(90deg, #0284c7, #6366f1); }

.exec-kpi:hover {
    transform: translateY(-2px);
    box-shadow: var(--zk-shadow-md);
    border-color: var(--zk-border-strong);
}

.exec-kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.exec-kpi-value {
    font-size: 1.72rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: var(--zk-text-primary);
}

.mini-progress {
    height: 6px;
    background-color: var(--zk-bg-muted);
    border-radius: 999px;
    overflow: hidden;
}

.mini-progress > div {
    height: 100%;
    border-radius: 999px;
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.chart-7d-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.6rem;
    align-items: end;
    height: 184px;
    padding: 0.75rem 0.3rem 0.25rem;
}

.chart-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    padding: 0.2rem;
    border-radius: 0.5rem;
    transition: background-color 0.15s ease;
}

.chart-col:hover {
    background-color: var(--zk-bg-hover);
}

.chart-bar-track {
    width: 100%;
    max-width: 40px;
    height: 124px;
    background: var(--zk-bg-subtle);
    border: 1px solid var(--zk-border);
    border-radius: 0.45rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    position: relative;
}

.chart-seg-unfetched {
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
    width: 100%;
    min-height: 0;
}

.chart-seg-fetched {
    background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
    width: 100%;
    min-height: 0;
}

.fleet-filter-btn {
    font-size: 0.75rem;
    padding: 0.24rem 0.72rem;
    border-radius: 999px;
    border: 1px solid var(--zk-border-strong);
    background: var(--zk-bg-subtle);
    color: var(--zk-text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.14s ease;
}

.fleet-filter-btn:hover {
    background: var(--zk-bg-muted);
    color: var(--zk-text-primary);
}

.fleet-filter-btn.active {
    background: var(--zk-primary);
    border-color: var(--zk-primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.metric-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    padding: 0.18rem 0.52rem;
    border-radius: 0.38rem;
    font-size: 0.73rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ==========================================================================
   4. Split-Panel Enterprise Authentication Shell (Login & Setup)
   ========================================================================== */

.auth-page-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
}

.auth-shell {
    width: 100%;
    max-width: 940px;
    background: var(--zk-bg-surface);
    border: 1px solid var(--zk-border);
    border-radius: var(--zk-radius-xl);
    box-shadow: var(--zk-shadow-lg);
    overflow: hidden;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
}

.auth-hero-pane {
    background: radial-gradient(circle at 18% 18%, rgba(56, 189, 248, 0.20), transparent 50%),
                radial-gradient(circle at 85% 82%, rgba(37, 99, 235, 0.28), transparent 55%),
                linear-gradient(155deg, #070b14 0%, #0f172a 55%, #172554 100%);
    color: #f8fafc;
    padding: 2.5rem 2.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.auth-hero-pane::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

.auth-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.auth-feature-icon {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.26);
    color: #38bdf8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.auth-form-pane {
    padding: 2.5rem 2.35rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--zk-bg-surface);
}

.input-icon-group {
    position: relative;
}

.input-icon-group .input-lead-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--zk-text-faint);
    pointer-events: none;
    font-size: 0.95rem;
}

.input-icon-group .form-control {
    padding-left: 2.45rem;
    height: 42px;
}

.input-icon-group .pwd-toggle-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--zk-text-muted);
    width: 32px;
    height: 32px;
    border-radius: 0.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.input-icon-group .pwd-toggle-btn:hover {
    color: var(--zk-text-primary);
    background: var(--zk-bg-muted);
}

@media (max-width: 860px) {
    .auth-shell {
        grid-template-columns: 1fr;
        max-width: 460px;
    }
    .auth-hero-pane {
        padding: 1.5rem 1.75rem;
    }
    .auth-hero-features {
        display: none;
    }
    .auth-form-pane {
        padding: 1.85rem 1.75rem;
    }
}

/* ==========================================================================
   5. Modernized Biometric Enrollment Studio (DeviceDetails)
   ========================================================================== */

.biometric-studio-card {
    background: var(--zk-bg-surface);
    border: 1px solid var(--zk-border);
    border-radius: var(--zk-radius-lg);
    box-shadow: var(--zk-shadow-sm);
    overflow: hidden;
}

.biometric-studio-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #f8fafc;
    padding: 0.9rem 1.15rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.biometric-step-panel {
    background: var(--zk-bg-surface);
    border: 1px solid var(--zk-border);
    border-radius: var(--zk-radius-md);
    margin-bottom: 0.8rem;
    overflow: hidden;
}

.biometric-step-header {
    background: var(--zk-bg-subtle);
    border-bottom: 1px solid var(--zk-border);
    color: var(--zk-text-primary);
    font-weight: 700;
    font-size: 0.79rem;
    padding: 0.48rem 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.step-num-badge {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--zk-primary);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.42rem;
}

.finger-svg-wrap {
    width: 100%;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--zk-border-strong);
    border-radius: 0.5rem;
    user-select: none;
    padding: 0.25rem;
}

[data-theme="dark"] .finger-svg-wrap {
    background: linear-gradient(180deg, #162032 0%, #0f172a 100%);
}

.face-preview-box {
    width: 96px;
    height: 96px;
    border: 1.5px dashed var(--zk-border-strong);
    background: var(--zk-bg-subtle);
    border-radius: 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

/* ==========================================================================
   6. Modals, Alerts & Confirmation Dialogs
   ========================================================================== */

.modal-backdrop.show {
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: var(--zk-bg-surface);
    color: var(--zk-text-primary);
    border: 1px solid var(--zk-border-strong);
    border-radius: var(--zk-radius-lg);
    box-shadow: var(--zk-shadow-lg);
}

.modal-header {
    background-color: var(--zk-bg-subtle);
    border-bottom: 1px solid var(--zk-border);
    padding: 0.85rem 1.15rem;
}

.modal-footer {
    background-color: var(--zk-bg-subtle);
    border-top: 1px solid var(--zk-border);
    padding: 0.7rem 1.15rem;
}

.gh-modal-content {
    border: 1px solid var(--zk-border-strong);
    border-radius: var(--zk-radius-lg);
    box-shadow: var(--zk-shadow-lg);
    overflow: hidden;
}

.gh-modal-header {
    background: var(--zk-bg-subtle);
    border-bottom: 1px solid var(--zk-border);
    padding: 0.85rem 1.15rem;
}

.gh-warning-banner {
    background-color: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #92400e;
    border-radius: 0.5rem;
    padding: 0.68rem 0.85rem;
    font-size: 0.81rem;
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}

[data-theme="dark"] .gh-warning-banner {
    color: #fde68a;
}

.gh-sn-pill {
    font-family: var(--zk-font-mono);
    font-weight: 700;
    color: #e11d48;
    background: rgba(225, 29, 72, 0.1);
    border: 1px solid rgba(225, 29, 72, 0.3);
    border-radius: 0.32rem;
    padding: 0.08rem 0.42rem;
    user-select: all;
    direction: ltr;
    unicode-bidi: isolate;
}

.gh-confirm-input {
    font-family: var(--zk-font-mono);
    font-size: 0.88rem;
    border: 1px solid var(--zk-border-strong);
    border-radius: 0.48rem;
    padding: 0.48rem 0.72rem;
    direction: ltr;
}

.gh-confirm-input:focus {
    border-color: #e11d48;
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.16);
}

.gh-confirm-input.is-matched {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16);
    background-color: rgba(22, 163, 74, 0.06);
}

.gh-danger-btn {
    background-color: #e11d48;
    border-color: #be123c;
    color: #ffffff;
    font-weight: 600;
    border-radius: 0.48rem;
    padding: 0.52rem 1rem;
    transition: all 0.15s ease;
}

.gh-danger-btn:hover:not(:disabled) {
    background-color: #be123c;
    border-color: #9f1239;
    color: #ffffff;
}

.gh-danger-btn:disabled {
    background-color: var(--zk-bg-subtle);
    border-color: var(--zk-border-strong);
    color: rgba(225, 29, 72, 0.45);
    cursor: not-allowed;
    opacity: 1;
}

.confirm-icon-ring {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.content-area > .alert {
    border: 1px solid transparent;
    border-left-width: 4px;
    border-radius: 0.55rem;
    box-shadow: var(--zk-shadow-xs);
    font-weight: 500;
}

.content-area > .alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
    border-left-color: #10b981;
    color: #065f46;
}
[data-theme="dark"] .content-area > .alert-success { color: #6ee7b7; }

.content-area > .alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    border-left-color: #ef4444;
    color: #991b1b;
}
[data-theme="dark"] .content-area > .alert-danger { color: #fca5a5; }

/* Empty State Illustration Block */
.empty-state-box {
    padding: 2.25rem 1.25rem;
    text-align: center;
    color: var(--zk-text-muted);
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--zk-bg-subtle);
    border: 1px solid var(--zk-border);
    color: var(--zk-text-faint);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.65rem;
}
