/* ============================================================
   VMS Pro — Core Application Styles  (v2 — Premium Redesign)
   Path: /vms/assets/css/vms.css
   ============================================================ */

/* ─────────────────────────────────────────────────────────────
   DESIGN TOKENS
   ───────────────────────────────────────────────────────────── */
:root {
    /* Brand */
    --vms-accent:        #2563EB;
    --vms-accent-dark:   #1D4ED8;
    --vms-accent-hover:  #1E40AF;
    --vms-accent-light:  #EFF6FF;
    --vms-accent-soft:   rgba(37, 99, 235, 0.08);
    --vms-accent-ring:   rgba(37, 99, 235, 0.25);

    /* Surfaces */
    --vms-bg:            #F0F4F8;
    --vms-bg-alt:        #F8FAFC;
    --vms-surface:       #FFFFFF;
    --vms-surface-2:     #F8FAFC;
    --vms-surface-3:     #F1F5F9;

    /* Borders */
    --vms-border:        #E2E8F0;
    --vms-border-strong: #CBD5E1;

    /* Text */
    --vms-text:          #0F172A;
    --vms-text-muted:    #64748B;
    --vms-text-light:    #94A3B8;
    --vms-text-xlight:   #CBD5E1;

    /* Semantic */
    --vms-success:       #10B981;
    --vms-warning:       #F59E0B;
    --vms-danger:        #EF4444;
    --vms-info:          #06B6D4;

    /* Layout */
    --vms-sidebar-w:              260px;
    --vms-sidebar-collapsed-w:    72px;
    --vms-topbar-h:               62px;

    /* Spacing scale */
    --space-xs:   0.375rem;
    --space-sm:   0.625rem;
    --space-md:   1rem;
    --space-lg:   1.5rem;
    --space-xl:   2rem;

    /* Shape */
    --vms-radius-sm:  7px;
    --vms-radius:     10px;
    --vms-radius-lg:  14px;
    --vms-radius-xl:  18px;

    /* Elevation */
    --vms-shadow-xs:  0 1px 2px rgba(15, 23, 42, 0.04);
    --vms-shadow:     0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --vms-shadow-md:  0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
    --vms-shadow-lg:  0 12px 32px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.06);
    --vms-shadow-xl:  0 24px 48px rgba(15, 23, 42, 0.12), 0 8px 16px rgba(15, 23, 42, 0.08);

    /* Typography */
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'DM Mono', 'Fira Code', monospace;

    /* Transitions */
    --trans-fast:   all 0.15s ease;
    --trans-normal: all 0.22s ease;
    --trans-slow:   all 0.35s ease;
}

/* ─────────────────────────────────────────────────────────────
   RESET & BASE
   ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    color: var(--vms-text);
    background: var(--vms-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─────────────────────────────────────────────────────────────
   LAYOUT SHELL
   ───────────────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    min-width: 0;
    margin-left: var(--vms-sidebar-w);
    display: flex;
    flex-direction: column;
    transition: margin-left 0.28s ease;
}

.sidebar-collapsed .main-content {
    margin-left: var(--vms-sidebar-collapsed-w);
}

.page-content {
    flex: 1;
    padding: var(--space-lg);
    margin-top: var(--vms-topbar-h);
}

/* ─────────────────────────────────────────────────────────────
   PAGE HEADER
   ───────────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--vms-text);
    margin: 0;
    letter-spacing: -0.025em;
    line-height: 1.25;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--vms-text-muted);
    margin: 0.3rem 0 0;
    font-weight: 400;
}

/* ─────────────────────────────────────────────────────────────
   CARDS — BASE
   ───────────────────────────────────────────────────────────── */
.card {
    background: var(--vms-surface);
    border: 1px solid var(--vms-border);
    border-radius: var(--vms-radius-lg);
    box-shadow: var(--vms-shadow);
    overflow: hidden;
    transition: box-shadow 0.22s ease;
}

.card-header {
    background: var(--vms-surface);
    border-bottom: 1px solid var(--vms-border);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.card-title {
    font-size: 0.9375rem;
    font-weight: 650;
    margin: 0;
    color: var(--vms-text);
    letter-spacing: -0.01em;
}

.card-body { padding: 1.25rem; }

.card-footer {
    padding: 0.875rem 1.25rem;
    background: var(--vms-surface-2);
    border-top: 1px solid var(--vms-border);
}

/* ─────────────────────────────────────────────────────────────
   STAT CARDS — PREMIUM REDESIGN
   ───────────────────────────────────────────────────────────── */
.stat-card {
    background: var(--vms-surface);
    border: 1px solid var(--vms-border);
    border-radius: var(--vms-radius-lg);
    padding: 1.375rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--vms-shadow);
    transition: box-shadow 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
    min-height: 110px;
}

/* Subtle shimmer line at top */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    transition: background 0.22s ease;
    border-radius: var(--vms-radius-lg) var(--vms-radius-lg) 0 0;
}

.stat-card:hover {
    box-shadow: var(--vms-shadow-md);
    transform: translateY(-3px);
    border-color: var(--vms-border-strong);
}

/* Colour-coded top stripe on hover */
.stat-card:hover::before { background: var(--sc-accent, var(--vms-accent)); }

/* Icon container */
.stat-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: var(--vms-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.22s ease;
}

.stat-card:hover .stat-icon { transform: scale(1.08); }
.stat-icon svg, .stat-icon i { width: 22px; height: 22px; }

/* Icon colour variants */
.stat-icon.blue   { background: #EFF6FF; color: #2563EB; --sc-accent: #2563EB; }
.stat-icon.green  { background: #F0FDF4; color: #059669; --sc-accent: #059669; }
.stat-icon.orange { background: #FFF7ED; color: #EA580C; --sc-accent: #EA580C; }
.stat-icon.red    { background: #FFF1F2; color: #DC2626; --sc-accent: #DC2626; }
.stat-icon.purple { background: #FAF5FF; color: #7C3AED; --sc-accent: #7C3AED; }
.stat-icon.teal   { background: #F0FDFA; color: #0D9488; --sc-accent: #0D9488; }
.stat-icon.indigo { background: #EEF2FF; color: #4338CA; --sc-accent: #4338CA; }

.stat-info {
    min-width: 0;
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 760;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--vms-text);
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--vms-text-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.stat-change {
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    line-height: 1;
}
.stat-change svg, .stat-change i { width: 10px; height: 10px; flex-shrink: 0; }
.stat-change.up   { color: var(--vms-success); }
.stat-change.down { color: var(--vms-danger); }

/* ─── Stat Grid: 3 per row on desktop, 2 tablet, 1 mobile ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1199.98px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 767.98px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 479.98px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────────────────────── */
.btn {
    border-radius: var(--vms-radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--trans-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-accent {
    background: var(--vms-accent);
    border-color: var(--vms-accent);
    color: #fff;
    box-shadow: 0 1px 3px rgba(37,99,235,.3);
}
.btn-accent:hover {
    background: var(--vms-accent-dark);
    border-color: var(--vms-accent-dark);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}

/* Action button (icon-only small) */
.vms-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid var(--vms-border);
    background: var(--vms-surface);
    color: var(--vms-text-muted);
    cursor: pointer;
    transition: var(--trans-fast);
    text-decoration: none;
    padding: 0;
}
.vms-action-btn:hover {
    border-color: var(--vms-accent);
    color: var(--vms-accent);
    background: var(--vms-accent-light);
}

/* Btn sizes */
.btn-xs { padding: .2rem .55rem; font-size: .75rem; border-radius: 6px; }

/* ─────────────────────────────────────────────────────────────
   TABLES
   ───────────────────────────────────────────────────────────── */
.table { font-size: 0.875rem; margin-bottom: 0; }

.table th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--vms-text-muted);
    white-space: nowrap;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--vms-border);
    background: var(--vms-surface-3);
}

.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--vms-border);
    color: var(--vms-text);
}

.table tbody tr:last-child td { border-bottom: 0; }

.table-hover tbody tr:hover td {
    background: var(--vms-accent-light);
    transition: background 0.12s ease;
}

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--vms-border);
    border-radius: 8px;
    padding: .4rem .85rem;
    font-size: .85rem;
    outline: none;
    transition: var(--trans-fast);
    background: var(--vms-surface);
    color: var(--vms-text);
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--vms-accent);
    box-shadow: 0 0 0 3px var(--vms-accent-ring);
}
.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--vms-border);
    border-radius: 8px;
    padding: .35rem .6rem;
    font-size: .85rem;
}
.dataTables_wrapper .dataTables_info { font-size: .8rem; color: var(--vms-text-muted); }
.dataTables_wrapper .paginate_button { border-radius: 7px !important; font-size: .82rem !important; }
.dataTables_wrapper .paginate_button.current {
    background: var(--vms-accent) !important;
    border-color: var(--vms-accent) !important;
    color: #fff !important;
}

/* ─────────────────────────────────────────────────────────────
   BADGES
   ───────────────────────────────────────────────────────────── */
.badge {
    font-size: 0.695rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    padding: 0.28em 0.65em;
    border-radius: 5px;
}

/* ─────────────────────────────────────────────────────────────
   AVATAR
   ───────────────────────────────────────────────────────────── */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

/* ─────────────────────────────────────────────────────────────
   VISITOR PHOTO THUMB
   ───────────────────────────────────────────────────────────── */
.visitor-thumb {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--vms-border);
}

/* ─────────────────────────────────────────────────────────────
   STATUS DOTS
   ───────────────────────────────────────────────────────────── */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.4rem;
    flex-shrink: 0;
}
.status-dot.online  { background: #10B981; box-shadow: 0 0 0 2px #DCFCE7; }
.status-dot.offline { background: #94A3B8; }
.status-dot.alert   { background: #EF4444; box-shadow: 0 0 0 2px #FEE2E2; }

/* ─────────────────────────────────────────────────────────────
   CHART WRAPPERS
   ───────────────────────────────────────────────────────────── */
.chart-wrapper { position: relative; width: 100%; }

/* ─────────────────────────────────────────────────────────────
   UTILITY — SOFT BACKGROUNDS
   ───────────────────────────────────────────────────────────── */
.bg-primary-soft { background: #EFF6FF; color: #2563EB; }
.bg-success-soft { background: #F0FDF4; color: #059669; }
.bg-warning-soft { background: #FFFBEB; color: #D97706; }
.bg-danger-soft  { background: #FFF1F2; color: #DC2626; }
.bg-purple-soft  { background: #FAF5FF; color: #7C3AED; }

/* ─────────────────────────────────────────────────────────────
   FORM CONTROLS
   ───────────────────────────────────────────────────────────── */
.form-control, .form-select {
    border: 1px solid var(--vms-border);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--vms-text);
    padding: 0.5rem 0.875rem;
    background: var(--vms-surface);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--vms-accent);
    box-shadow: 0 0 0 3px var(--vms-accent-ring);
    outline: none;
}

.form-control::placeholder { color: var(--vms-text-light); }

.form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--vms-text-muted);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Input group */
.input-group .form-control:focus { z-index: 3; }
.input-group .btn { border-radius: 0 8px 8px 0 !important; }
.input-group .form-control { border-radius: 8px 0 0 8px !important; }

/* ─────────────────────────────────────────────────────────────
   ALERTS
   ───────────────────────────────────────────────────────────── */
.alert {
    border-radius: var(--vms-radius);
    font-size: 0.875rem;
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

/* ─────────────────────────────────────────────────────────────
   MODALS
   ───────────────────────────────────────────────────────────── */
.modal-content {
    border: 1px solid var(--vms-border);
    border-radius: var(--vms-radius-xl);
    box-shadow: var(--vms-shadow-xl);
    overflow: hidden;
}
.modal-header {
    border-bottom: 1px solid var(--vms-border);
    padding: 1.125rem 1.375rem;
    background: var(--vms-surface-2);
}
.modal-footer {
    border-top: 1px solid var(--vms-border);
    padding: 1rem 1.375rem;
    background: var(--vms-surface-2);
}
.modal-body { padding: 1.375rem; }

/* ─────────────────────────────────────────────────────────────
   TOPBAR SPECIFIC
   ───────────────────────────────────────────────────────────── */
.topbar-checkin-btn {
    font-size: 0.8125rem;
    padding: 0.375rem 0.875rem;
    border-radius: 8px;
}

/* ─────────────────────────────────────────────────────────────
   EMPTY STATE
   ───────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
    color: var(--vms-text-muted);
}
.empty-state svg { width: 52px; height: 52px; margin-bottom: 1rem; opacity: 0.2; }
.empty-state p   { font-size: 0.9375rem; margin: 0; }

/* ─────────────────────────────────────────────────────────────
   PAGINATION
   ───────────────────────────────────────────────────────────── */
.pagination .page-link {
    border-radius: 7px !important;
    font-size: 0.82rem;
    border-color: var(--vms-border);
    color: var(--vms-text-muted);
    margin: 0 2px;
    padding: 0.3rem 0.65rem;
}
.pagination .page-item.active .page-link {
    background: var(--vms-accent);
    border-color: var(--vms-accent);
}
.pagination .page-link:focus { box-shadow: 0 0 0 3px var(--vms-accent-ring); }

/* ─────────────────────────────────────────────────────────────
   RING ACCENT
   ───────────────────────────────────────────────────────────── */
.ring-accent { outline: 2px solid var(--vms-accent); outline-offset: 2px; }

/* ─────────────────────────────────────────────────────────────
   NOTIFICATIONS DROPDOWN
   ───────────────────────────────────────────────────────────── */
.notification-dropdown {
    width: 340px;
    max-height: 480px;
    overflow-y: auto;
    padding: 0;
    border: 1px solid var(--vms-border);
    border-radius: var(--vms-radius-lg);
    box-shadow: var(--vms-shadow-lg);
}
.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--vms-text);
    background: var(--vms-surface-2);
    border-bottom: 1px solid var(--vms-border);
    position: sticky;
    top: 0;
    z-index: 2;
}
.notification-mark-all { font-size: 0.775rem; color: var(--vms-accent); font-weight: 500; text-decoration: none; }
.notification-item { border-bottom: 1px solid var(--vms-border); }
.notification-item.unread { background: var(--vms-accent-soft); }
.notification-item a { padding: 0.75rem 1rem; display: flex; gap: 0.75rem; }
.notif-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--vms-surface-3); }
.notif-title { font-size: 0.8rem; font-weight: 500; color: var(--vms-text); line-height: 1.35; }
.notif-time  { font-size: 0.72rem; color: var(--vms-text-muted); margin-top: 0.2rem; }
.notification-footer { padding: 0.75rem 1rem; text-align: center; }
.notification-footer a { font-size: 0.82rem; color: var(--vms-accent); text-decoration: none; font-weight: 500; }
.notification-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--vms-danger);
    border: 2px solid var(--vms-surface);
}

/* ─────────────────────────────────────────────────────────────
   TOPBAR DROPDOWNS
   ───────────────────────────────────────────────────────────── */
.user-dropdown {
    width: 230px;
    border: 1px solid var(--vms-border);
    border-radius: var(--vms-radius-lg);
    box-shadow: var(--vms-shadow-lg);
    padding: 0.5rem 0;
}
.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem 0.75rem;
    border-bottom: 1px solid var(--vms-border);
    margin-bottom: 0.25rem;
}
.user-avatar-lg {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.user-dropdown .dropdown-item {
    font-size: 0.875rem;
    padding: 0.45rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--vms-text);
    border-radius: 0;
}
.user-dropdown .dropdown-item:hover { background: var(--vms-accent-light); color: var(--vms-accent); }
.topbar-icon-btn {
    background: none;
    border: 1px solid var(--vms-border);
    border-radius: 9px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--vms-text-muted);
    cursor: pointer;
    transition: var(--trans-fast);
    position: relative;
}
.topbar-icon-btn:hover { background: var(--vms-accent-light); border-color: var(--vms-accent); color: var(--vms-accent); }

/* ─────────────────────────────────────────────────────────────
   DASHBOARD — QUICK STATS ROW (ACTIVE NOW BANNER)
   ───────────────────────────────────────────────────────────── */
.active-now-card {
    background: linear-gradient(135deg, #1E40AF 0%, #2563EB 50%, #3B82F6 100%);
    border-radius: var(--vms-radius-lg);
    padding: 1.25rem 1.5rem;
    color: #fff;
    box-shadow: 0 4px 16px rgba(37,99,235,.35);
    position: relative;
    overflow: hidden;
}
.active-now-card::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 140px; height: 140px;
    border-radius: 50%;
    background: rgba(255,255,255,.07);
}
.active-now-card::after {
    content: '';
    position: absolute;
    bottom: -20px; right: 40px;
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,.05);
}

/* ─────────────────────────────────────────────────────────────
   DASHBOARD — ACTIVE VISITOR LIST ITEM
   ───────────────────────────────────────────────────────────── */
.active-visitor-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    border-bottom: 1px solid var(--vms-border);
    transition: background 0.12s ease;
}
.active-visitor-item:last-child { border-bottom: 0; }
.active-visitor-item:hover { background: var(--vms-accent-soft); }

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 1rem; }
    .stats-grid   { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575.98px) {
    .stat-value   { font-size: 1.5rem; }
    .page-title   { font-size: 1.125rem; }
    .stats-grid   { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .stat-card    { padding: 1rem; min-height: 90px; }
    .stat-icon    { width: 40px; height: 40px; min-width: 40px; }
    .stat-label   { font-size: 0.72rem; }
}

@media (max-width: 360px) {
    .stats-grid { grid-template-columns: 1fr; }
}
/* ============================================================
   VMS Pro — Core Styles  (v3 — Icon + Grid Fix)
   Path: /vms/assets/css/vms.css
   ============================================================ */

/* ─── Design Tokens ─────────────────────────────────────────── */
:root {
    --vms-accent:        #2563EB;
    --vms-accent-dark:   #1D4ED8;
    --vms-accent-hover:  #1E40AF;
    --vms-accent-light:  #EFF6FF;
    --vms-accent-soft:   rgba(37,99,235,.08);
    --vms-accent-ring:   rgba(37,99,235,.22);

    --vms-bg:            #F0F4F8;
    --vms-bg-alt:        #F8FAFC;
    --vms-surface:       #FFFFFF;
    --vms-surface-2:     #F8FAFC;
    --vms-surface-3:     #F1F5F9;

    --vms-border:        #E2E8F0;
    --vms-border-strong: #CBD5E1;

    --vms-text:          #0F172A;
    --vms-text-muted:    #64748B;
    --vms-text-light:    #94A3B8;

    --vms-success:  #10B981;
    --vms-warning:  #F59E0B;
    --vms-danger:   #EF4444;
    --vms-info:     #06B6D4;

    --vms-sidebar-w:           260px;
    --vms-sidebar-collapsed-w: 72px;
    --vms-topbar-h:            62px;

    --vms-radius-sm: 7px;
    --vms-radius:    10px;
    --vms-radius-lg: 14px;
    --vms-radius-xl: 18px;

    --vms-shadow:    0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
    --vms-shadow-md: 0 4px 12px rgba(15,23,42,.09), 0 2px 4px rgba(15,23,42,.04);
    --vms-shadow-lg: 0 12px 32px rgba(15,23,42,.11), 0 4px 8px rgba(15,23,42,.05);
    --vms-shadow-xl: 0 24px 48px rgba(15,23,42,.13), 0 8px 16px rgba(15,23,42,.07);

    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'DM Mono', 'Fira Code', monospace;
}

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    font-size: .9375rem;
    color: var(--vms-text);
    background: var(--vms-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ─── Layout ─────────────────────────────────────────────────── */
.app-layout   { display: flex; min-height: 100vh; }
.main-content { flex: 1; min-width: 0; margin-left: var(--vms-sidebar-w); display: flex; flex-direction: column; transition: margin-left .28s ease; }
.sidebar-collapsed .main-content { margin-left: var(--vms-sidebar-collapsed-w); }
.page-content { flex: 1; padding: 1.5rem; margin-top: var(--vms-topbar-h); }

/* ─── Page Header ────────────────────────────────────────────── */
.page-header  { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.75rem; }
.page-title   { font-size: 1.375rem; font-weight: 700; color: var(--vms-text); margin: 0; letter-spacing: -.025em; line-height: 1.25; }
.page-subtitle{ font-size: .875rem; color: var(--vms-text-muted); margin: .3rem 0 0; }

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
    background: var(--vms-surface);
    border: 1px solid var(--vms-border);
    border-radius: var(--vms-radius-lg);
    box-shadow: var(--vms-shadow);
    overflow: hidden;
}
.card-header {
    background: var(--vms-surface);
    border-bottom: 1px solid var(--vms-border);
    padding: 1rem 1.25rem;
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
}
.card-title  { font-size: .9375rem; font-weight: 650; margin: 0; color: var(--vms-text); letter-spacing: -.01em; }
.card-body   { padding: 1.25rem; }
.card-footer { padding: .875rem 1.25rem; background: var(--vms-surface-2); border-top: 1px solid var(--vms-border); }

/* ═══════════════════════════════════════════════════════════════
   STAT CARDS — COMPLETE REBUILD WITH ICON FIX
   ═══════════════════════════════════════════════════════════ */
.stat-card {
    background: var(--vms-surface);
    border: 1px solid var(--vms-border);
    border-radius: var(--vms-radius-lg);
    padding: 1.25rem 1.2rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--vms-shadow);
    transition: box-shadow .22s ease, transform .22s ease, border-color .22s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
    min-height: 108px;
    cursor: default;
}

/* Coloured accent stripe at top (appears on hover) */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--sc-color, transparent);
    border-radius: var(--vms-radius-lg) var(--vms-radius-lg) 0 0;
    opacity: 0;
    transition: opacity .22s ease;
}
.stat-card:hover { box-shadow: var(--vms-shadow-md); transform: translateY(-2px); border-color: var(--vms-border-strong); }
.stat-card:hover::before { opacity: 1; }

/* ── Icon container ── */
.stat-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: var(--vms-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform .22s ease;
}
.stat-card:hover .stat-icon { transform: scale(1.07); }

/*
 * FIX: Target BOTH <svg> (after feather.replace) AND <i data-feather>
 * (before replace runs). This ensures icons always show at correct size.
 */
.stat-icon svg,
.stat-icon i[data-feather] {
    width: 22px !important;
    height: 22px !important;
    display: block;
    flex-shrink: 0;
}

/* Colour variants — each sets its own --sc-color for the hover stripe */
.stat-icon.blue   { background: #EFF6FF; color: #2563EB; --sc-color: #2563EB; }
.stat-icon.green  { background: #F0FDF4; color: #059669; --sc-color: #059669; }
.stat-icon.orange { background: #FFF7ED; color: #EA580C; --sc-color: #EA580C; }
.stat-icon.red    { background: #FFF1F2; color: #DC2626; --sc-color: #DC2626; }
.stat-icon.purple { background: #FAF5FF; color: #7C3AED; --sc-color: #7C3AED; }
.stat-icon.teal   { background: #F0FDFA; color: #0D9488; --sc-color: #0D9488; }
.stat-icon.indigo { background: #EEF2FF; color: #4338CA; --sc-color: #4338CA; }

/* ── Text content ── */
.stat-info   { min-width: 0; flex: 1; }
.stat-value  { font-size: 1.8rem; font-weight: 780; line-height: 1; letter-spacing: -.04em; color: var(--vms-text); margin-bottom: .28rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-label  { font-size: .78rem; color: var(--vms-text-muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.stat-change { font-size: .7rem; font-weight: 600; margin-top: .32rem; display: flex; align-items: center; gap: .2rem; line-height: 1; }
.stat-change svg,
.stat-change i[data-feather] { width: 10px !important; height: 10px !important; flex-shrink: 0; }
.stat-change.up   { color: var(--vms-success); }
.stat-change.down { color: var(--vms-danger); }

/* ═══════════════════════════════════════════════════════════════
   STATS GRID — 3 per row desktop / 2 tablet / 1 mobile
   ═══════════════════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
@media (max-width: 991.98px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 479.98px) { .stats-grid { grid-template-columns: 1fr; } }

/* 4-col variant for user management */
.stats-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}
@media (max-width: 991.98px) { .stats-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 479.98px) { .stats-grid-4 { grid-template-columns: repeat(2, 1fr); } }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
    border-radius: var(--vms-radius-sm);
    font-weight: 500;
    font-size: .875rem;
    transition: all .15s ease;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.btn-accent {
    background: var(--vms-accent);
    border-color: var(--vms-accent);
    color: #fff;
    box-shadow: 0 1px 3px rgba(37,99,235,.28);
}
.btn-accent:hover {
    background: var(--vms-accent-dark);
    border-color: var(--vms-accent-dark);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}

/* Icon-only action button (used in tables) */
.vms-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid var(--vms-border);
    background: var(--vms-surface);
    color: var(--vms-text-muted);
    cursor: pointer;
    transition: all .15s ease;
    text-decoration: none;
    padding: 0;
    flex-shrink: 0;
}
.vms-action-btn:hover {
    border-color: var(--vms-accent);
    color: var(--vms-accent);
    background: var(--vms-accent-light);
}
/* FIX: icon sizing inside action buttons */
.vms-action-btn svg,
.vms-action-btn i[data-feather] { width: 13px !important; height: 13px !important; display: block; }

.btn-xs { padding: .2rem .55rem; font-size: .75rem; border-radius: 6px; }

/* ─── Tables ─────────────────────────────────────────────────── */
.table { font-size: .875rem; margin-bottom: 0; }
.table th {
    font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .07em; color: var(--vms-text-muted);
    white-space: nowrap; padding: .75rem 1rem;
    border-bottom: 2px solid var(--vms-border);
    background: var(--vms-surface-3);
}
.table td { padding: .75rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--vms-border); color: var(--vms-text); }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:hover td { background: var(--vms-accent-soft); transition: background .12s ease; }

/* DataTables */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--vms-border); border-radius: 8px;
    padding: .4rem .85rem; font-size: .85rem; outline: none;
    transition: all .15s ease; background: var(--vms-surface); color: var(--vms-text);
}
.dataTables_wrapper .dataTables_filter input:focus { border-color: var(--vms-accent); box-shadow: 0 0 0 3px var(--vms-accent-ring); }
.dataTables_wrapper .dataTables_length select { border: 1px solid var(--vms-border); border-radius: 8px; padding: .35rem .6rem; font-size: .85rem; }
.dataTables_wrapper .dataTables_info { font-size: .8rem; color: var(--vms-text-muted); }
.dataTables_wrapper .paginate_button { border-radius: 7px !important; font-size: .82rem !important; }
.dataTables_wrapper .paginate_button.current { background: var(--vms-accent) !important; border-color: var(--vms-accent) !important; color: #fff !important; }

/* ─── Badges ─────────────────────────────────────────────────── */
.badge { font-size: .695rem; font-weight: 650; letter-spacing: .04em; padding: .28em .65em; border-radius: 5px; }

/* ─── Avatar ─────────────────────────────────────────────────── */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .8125rem; font-weight: 700; color: #fff; flex-shrink: 0; letter-spacing: .02em; }

/* ─── Visitor thumb ──────────────────────────────────────────── */
.visitor-thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; border: 2px solid var(--vms-border); }

/* ─── Status dots ────────────────────────────────────────────── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: .4rem; flex-shrink: 0; }
.status-dot.online  { background: #10B981; box-shadow: 0 0 0 2px #DCFCE7; }
.status-dot.offline { background: #94A3B8; }
.status-dot.alert   { background: #EF4444; box-shadow: 0 0 0 2px #FEE2E2; }

/* ─── Chart wrapper ──────────────────────────────────────────── */
.chart-wrapper { position: relative; width: 100%; }

/* ─── Soft bg helpers ────────────────────────────────────────── */
.bg-primary-soft { background: #EFF6FF; color: #2563EB; }
.bg-success-soft { background: #F0FDF4; color: #059669; }
.bg-warning-soft { background: #FFFBEB; color: #D97706; }
.bg-danger-soft  { background: #FFF1F2; color: #DC2626; }

/* ─── Forms ──────────────────────────────────────────────────── */
.form-control, .form-select {
    border: 1px solid var(--vms-border); border-radius: 8px;
    font-size: .875rem; color: var(--vms-text);
    padding: .5rem .875rem; background: var(--vms-surface);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.form-control:focus, .form-select:focus { border-color: var(--vms-accent); box-shadow: 0 0 0 3px var(--vms-accent-ring); outline: none; }
.form-control::placeholder { color: var(--vms-text-light); }
.form-label { font-size: .8125rem; font-weight: 600; color: var(--vms-text-muted); margin-bottom: .35rem; text-transform: uppercase; letter-spacing: .05em; }

/* Input group icon fix */
.input-group .btn svg,
.input-group .btn i[data-feather] { width: 14px !important; height: 14px !important; }

/* ─── Alerts ─────────────────────────────────────────────────── */
.alert { border-radius: var(--vms-radius); font-size: .875rem; border: 1px solid transparent; }

/* ─── Modals ─────────────────────────────────────────────────── */
.modal-content  { border: 1px solid var(--vms-border); border-radius: var(--vms-radius-xl); box-shadow: var(--vms-shadow-xl); overflow: hidden; }
.modal-header   { border-bottom: 1px solid var(--vms-border); padding: 1.125rem 1.375rem; background: var(--vms-surface-2); }
.modal-footer   { border-top: 1px solid var(--vms-border); padding: 1rem 1.375rem; background: var(--vms-surface-2); }
.modal-body     { padding: 1.375rem; }
/* Icon fix inside modal titles */
.modal-title svg,
.modal-title i[data-feather] { width: 16px !important; height: 16px !important; vertical-align: middle; }

/* ─── Notification dropdown ──────────────────────────────────── */
.notification-dropdown { width: 340px; max-height: 480px; overflow-y: auto; padding: 0; border: 1px solid var(--vms-border); border-radius: var(--vms-radius-lg); box-shadow: var(--vms-shadow-lg); }
.notification-header { display: flex; align-items: center; justify-content: space-between; padding: .875rem 1rem; font-size: .875rem; font-weight: 600; color: var(--vms-text); background: var(--vms-surface-2); border-bottom: 1px solid var(--vms-border); position: sticky; top: 0; z-index: 2; }
.notification-mark-all { font-size: .775rem; color: var(--vms-accent); font-weight: 500; text-decoration: none; }
.notification-item { border-bottom: 1px solid var(--vms-border); }
.notification-item.unread { background: var(--vms-accent-soft); }
.notification-item a { padding: .75rem 1rem; display: flex; gap: .75rem; text-decoration: none; color: inherit; }
.notif-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--vms-surface-3); }
.notif-icon svg,
.notif-icon i[data-feather] { width: 15px !important; height: 15px !important; }
.notif-title { font-size: .8rem; font-weight: 500; color: var(--vms-text); line-height: 1.35; }
.notif-time  { font-size: .72rem; color: var(--vms-text-muted); margin-top: .2rem; }
.notification-footer { padding: .75rem 1rem; text-align: center; }
.notification-footer a { font-size: .82rem; color: var(--vms-accent); text-decoration: none; font-weight: 500; }
.notification-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--vms-danger); border: 2px solid var(--vms-surface); }

/* ─── Topbar user / icon buttons ────────────────────────────── */
.topbar-icon-btn { background: none; border: 1px solid var(--vms-border); border-radius: 9px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; color: var(--vms-text-muted); cursor: pointer; transition: all .15s ease; position: relative; }
.topbar-icon-btn:hover { background: var(--vms-accent-light); border-color: var(--vms-accent); color: var(--vms-accent); }
.topbar-icon-btn svg,
.topbar-icon-btn i[data-feather] { width: 17px !important; height: 17px !important; }

.user-dropdown { width: 230px; border: 1px solid var(--vms-border); border-radius: var(--vms-radius-lg); box-shadow: var(--vms-shadow-lg); padding: .5rem 0; }
.user-dropdown-header { display: flex; align-items: center; gap: .75rem; padding: .875rem 1rem .75rem; border-bottom: 1px solid var(--vms-border); margin-bottom: .25rem; }
.user-avatar-lg { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-dropdown .dropdown-item { font-size: .875rem; padding: .45rem 1rem; display: flex; align-items: center; gap: .5rem; color: var(--vms-text); }
.user-dropdown .dropdown-item:hover { background: var(--vms-accent-light); color: var(--vms-accent); }
.user-dropdown .dropdown-item svg,
.user-dropdown .dropdown-item i[data-feather] { width: 14px !important; height: 14px !important; }
.topbar-checkin-btn { font-size: .8125rem; padding: .375rem .875rem; border-radius: 8px; }

/* ─── Active visitor list ────────────────────────────────────── */
.active-visitor-item { display: flex; align-items: center; gap: .75rem; padding: .625rem 1.25rem; border-bottom: 1px solid var(--vms-border); transition: background .12s ease; }
.active-visitor-item:last-child { border-bottom: 0; }
.active-visitor-item:hover { background: var(--vms-accent-soft); }

/* ─── Empty state ────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3.5rem 1.5rem; color: var(--vms-text-muted); }
.empty-state svg,
.empty-state i[data-feather] { width: 52px !important; height: 52px !important; margin-bottom: 1rem; opacity: .2; display: block; margin-left: auto; margin-right: auto; }
.empty-state p { font-size: .9375rem; margin: 0; }

/* ─── Pagination ─────────────────────────────────────────────── */
.pagination .page-link { border-radius: 7px !important; font-size: .82rem; border-color: var(--vms-border); color: var(--vms-text-muted); margin: 0 2px; padding: .3rem .65rem; }
.pagination .page-item.active .page-link { background: var(--vms-accent); border-color: var(--vms-accent); }

/* ─── Feather icon global defaults ───────────────────────────── */
/* Ensure feather icons never blow up to unexpected sizes */
[data-feather] { display: inline-block; vertical-align: middle; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 1rem; }
}
@media (max-width: 575.98px) {
    .stat-value  { font-size: 1.5rem; }
    .page-title  { font-size: 1.125rem; }
    .stat-card   { padding: 1rem; min-height: 90px; }
    .stat-icon   { width: 40px; height: 40px; min-width: 40px; }
}

/* ─── Misc helpers ───────────────────────────────────────────── */
.ring-accent { outline: 2px solid var(--vms-accent); outline-offset: 2px; }
.text-accent { color: var(--vms-accent) !important; }
.opacity-60  { opacity: .6; }