/* ============================================================
   VISITOR MANAGEMENT SYSTEM — Global Stylesheet
   Single CSS file for the entire application.
   ============================================================ */

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
    --primary:        #2563eb;
    --primary-dark:   #1d4ed8;
    --primary-light:  #dbeafe;
    --secondary:      #64748b;
    --success:        #10b981;
    --danger:         #ef4444;
    --warning:        #f59e0b;
    --info:           #06b6d4;
    --dark:           #1e293b;
    --sidebar-bg:     #0f172a;
    --sidebar-hover:  #1e293b;
    --sidebar-text:   #94a3b8;
    --sidebar-active: #2563eb;
    --topbar-bg:      #ffffff;
    --topbar-height:  64px;
    --sidebar-width:  260px;
    --bg-main:        #f1f5f9;
    --card-bg:        #ffffff;
    --card-border:    #e2e8f0;
    --text-primary:   #1e293b;
    --text-secondary: #64748b;
    --text-muted:     #94a3b8;
    --border-radius:  10px;
    --border-radius-sm: 6px;
    --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:      0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg:      0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
    --font-family:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition:     all .2s ease;
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-main);
    -webkit-font-smoothing: antialiased;
}

/* ─── Always-visible scrollbars (macOS hides them by default) ─── */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: #eef2f7; }
::-webkit-scrollbar-thumb { background: #c3ccd9; border-radius: 8px; border: 3px solid #eef2f7; }
::-webkit-scrollbar-thumb:hover { background: #93a1b5; }
* { scrollbar-width: thin; scrollbar-color: #c3ccd9 #eef2f7; }

/* Meeting bookings: amenities shown under the room picker */
.bk-amen { display: flex; flex-wrap: wrap; gap: 7px; }
.bk-amen-label { flex-basis: 100%; font-size: 12px; color: #667085; font-weight: 600; margin-bottom: 2px; }
.bk-chip { background: #EAF3FF; color: #13315C; border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 600; }
.bk-chip-spec { background: #F4F7FB; color: #334155; border: 1px solid #ECF1F7; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
.fw-600 { font-weight: 600; }

/* ─── App Layout ────────────────────────────────────────────── */
.app-body { overflow-x: hidden; }

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
    z-index: 1000;
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .5px;
}

.sidebar-divider {
    border: 0;
    border-top: 1px solid rgba(255,255,255,.06);
    margin: 8px 0;
}

.sidebar-heading {
    padding: 8px 20px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--sidebar-text);
    opacity: .6;
}

.nav-item { list-style: none; }

.nav-item .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 0;
    transition: var(--transition);
    cursor: pointer;
}

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

.nav-item.active .nav-link,
.nav-item .nav-link.active {
    background: rgba(37, 99, 235, .15);
    color: #60a5fa;
    border-right: 3px solid var(--primary);
}

.nav-item .nav-link i {
    width: 20px;
    font-size: 14px;
    flex-shrink: 0;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
    padding: 8px 0;
    border-top: 1px solid rgba(255,255,255,.06);
}

.sidebar-footer .nav-link {
    color: #f87171;
}
.sidebar-footer .nav-link:hover { background: rgba(239,68,68,.1); color: #f87171; }

/* ─── Main Content ──────────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    /* Own scroll container so the scrollbar is always visible (not the hidden
       macOS window bar). The sticky topbar stays pinned inside it. */
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition);
}

/* ─── Topbar ────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.sidebar-toggle:hover { background: #f1f5f9; color: var(--primary); }

/* Hamburger is a mobile-only control — drawer logic only kicks in < 992px. */
@media (min-width: 992px) {
    .sidebar-toggle { display: none; }
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    padding: 6px 12px;
    border-radius: 8px;
    transition: var(--transition);
}
.user-dropdown:hover { background: #f8fafc; }

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
    flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; line-height: 1.3; }

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.dropdown-menu-custom {
    position: absolute;
    top: 48px;
    right: 0;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 6px 0;
    display: none;
    z-index: 999;
}
.user-dropdown:hover .dropdown-menu-custom { display: block; }

.dropdown-item-custom {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition);
}
.dropdown-item-custom:hover { background: #f8fafc; color: var(--danger); }

/* ─── Page Content ──────────────────────────────────────────── */
.page-content {
    flex: 1;
    padding: 24px;
}

/* ─── Content Cards ─────────────────────────────────────────── */
.content-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.content-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border);
    background: #fafafa;
}

.content-card-header h5 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

.content-card-header h5 i { color: var(--primary); }

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

/* ─── Stats Grid ────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-card-primary::before { background: var(--primary); }
.stat-card-success::before { background: var(--success); }
.stat-card-info::before    { background: var(--info); }
.stat-card-warning::before { background: var(--warning); }
.stat-card-secondary::before { background: var(--secondary); }
.stat-card-dark::before    { background: var(--dark); }

.stat-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-card-primary .stat-card-icon { background: #dbeafe; color: var(--primary); }
.stat-card-success .stat-card-icon { background: #d1fae5; color: var(--success); }
.stat-card-info .stat-card-icon    { background: #cffafe; color: var(--info); }
.stat-card-warning .stat-card-icon { background: #fef3c7; color: var(--warning); }
.stat-card-secondary .stat-card-icon { background: #f1f5f9; color: var(--secondary); }
.stat-card-dark .stat-card-icon    { background: #e2e8f0; color: var(--dark); }

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ─── Data Table ────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.data-table thead tr {
    background: #f8fafc;
    border-bottom: 2px solid var(--card-border);
}

.data-table th {
    padding: 11px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--text-secondary);
    white-space: nowrap;
}

.data-table td {
    padding: 13px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
    vertical-align: middle;
}

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

.data-table tbody tr:hover { background: #fafbfc; }

/* ─── Visitor Name Cell ─────────────────────────────────────── */
.visitor-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.visitor-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #dbeafe;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.visitor-avatar.avatar-inactive { background: #fee2e2; color: var(--danger); }
.visitor-avatar.avatar-active   { background: #d1fae5; color: var(--success); }

/* ─── Status Badges ─────────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
    text-transform: uppercase;
}

.status-pending      { background: #fef3c7; color: #92400e; }
.status-checked_in   { background: #d1fae5; color: #065f46; }
.status-checked_out  { background: #e0e7ff; color: #3730a3; }
.status-cancelled    { background: #fee2e2; color: #991b1b; }
.status-denied       { background: #fce7f3; color: #9d174d; }

/* ─── Role Badges ───────────────────────────────────────────── */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.role-super_admin   { background: #fae8ff; color: #7e22ce; }
.role-admin         { background: #dbeafe; color: #1d4ed8; }
.role-receptionist  { background: #d1fae5; color: #065f46; }
.role-security_guard{ background: #fef3c7; color: #92400e; }
.role-employee      { background: #f1f5f9; color: #475569; }

/* ─── Badge Number ──────────────────────────────────────────── */
.badge-number {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: 700;
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--text-secondary);
    border: 1px solid #e2e8f0;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn { border-radius: var(--border-radius-sm); font-size: 13px; font-weight: 500; }

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
}

/* ─── Form Styles ───────────────────────────────────────────── */
.form-group-custom { margin-bottom: 18px; }

.form-label-custom {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control-custom {
    border: 1.5px solid #e2e8f0;
    border-radius: var(--border-radius-sm);
    padding: 9px 14px;
    font-size: 13.5px;
    color: var(--text-primary);
    background: #fff;
    transition: var(--transition);
    width: 100%;
}

.form-control-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
    outline: none;
}

.form-select.form-control-custom { appearance: auto; }

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid var(--card-border);
    margin-top: 20px;
}

/* ─── Pagination ────────────────────────────────────────────── */
.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--card-border);
    background: #fafafa;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ─── Check-in page info box ────────────────────────────────── */
.checkin-info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--border-radius-sm);
    padding: 12px 16px;
    font-size: 13px;
    color: #1d4ed8;
    margin-top: 16px;
}

/* ─── Footer ────────────────────────────────────────────────── */
.app-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--card-border);
    padding: 14px 24px;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.footer-version {
    font-size: 11px;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 20px;
}

/* ─── Login Page ────────────────────────────────────────────── */
.login-body {
    background: var(--sidebar-bg);
    min-height: 100vh;
    display: flex;
}

.login-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.login-left {
    flex: 0 0 45%;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 50px;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: rgba(37,99,235,.1);
    border-radius: 50%;
    top: -100px; right: -100px;
}

.login-left::after {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    background: rgba(37,99,235,.07);
    border-radius: 50%;
    bottom: -80px; left: -80px;
}

.login-left-content { position: relative; z-index: 1; }

.login-logo {
    width: 72px; height: 72px;
    background: var(--primary);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #fff;
    margin-bottom: 28px;
    box-shadow: 0 8px 24px rgba(37,99,235,.4);
}

.login-left h1 {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
    line-height: 1.3;
}

.login-left p {
    font-size: 15px;
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 28px;
}

.login-features { list-style: none; padding: 0; }

.login-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 10px;
}

.login-features li i { color: var(--success); width: 16px; }

.login-right {
    flex: 1;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 40px 44px;
    width: 100%;
    max-width: 440px;
}

.login-card-header { margin-bottom: 28px; }

.login-card-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-card-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.login-form { margin-bottom: 24px; }

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

.input-group-password .form-control-custom { padding-right: 44px; }

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    transition: var(--transition);
}
.password-toggle:hover { color: var(--primary); }

.btn-login {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 4px;
}
.btn-login:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.login-footer-text { text-align: center; color: var(--text-muted); font-size: 12px; }

/* ─── Receipt / Badge ───────────────────────────────────────── */
.receipt-body { background: #e2e8f0; min-height: 100vh; }

.receipt-controls {
    background: #fff;
    border-bottom: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm);
}

.receipt-container {
    display: flex;
    justify-content: center;
    padding: 40px 20px 60px;
}

.badge-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 780px;
    overflow: hidden;
    border: 1px solid var(--card-border);
}

.badge-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    padding: 22px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.badge-company {
    display: flex;
    align-items: center;
    gap: 14px;
}

.badge-company-icon {
    font-size: 28px;
    color: #fff;
    background: rgba(255,255,255,.15);
    width: 50px; height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge-company-name {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.badge-company-sub {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.badge-number-display { text-align: right; }

.badge-num-label {
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #64748b;
}

.badge-num-value {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.badge-body {
    display: grid;
    grid-template-columns: 1fr 1.4fr auto;
    gap: 0;
}

.badge-visitor-section {
    padding: 24px;
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.badge-photo {
    width: 90px; height: 90px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #94a3b8;
    border: 3px solid var(--card-border);
    margin-bottom: 14px;
    flex-shrink: 0;
}

.badge-visitor-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.badge-visitor-company {
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
}

.badge-visitor-designation {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.badge-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.badge-info-row i { color: var(--primary); width: 14px; flex-shrink: 0; }

.badge-visit-details {
    padding: 24px;
    border-right: 1px solid var(--card-border);
}

.badge-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.badge-detail-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.badge-detail-value {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.badge-qr-section {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge-qr-wrapper { text-align: center; }

.badge-qr-image {
    width: 160px;
    height: 160px;
    border: 2px solid var(--card-border);
    border-radius: 8px;
    padding: 4px;
}

.badge-qr-placeholder {
    width: 160px;
    height: 160px;
    border: 2px dashed var(--card-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 8px;
    font-size: 12px;
}

.badge-qr-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.badge-footer {
    background: #f8fafc;
    border-top: 1px solid var(--card-border);
    padding: 12px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

/* ─── Error Pages ───────────────────────────────────────────── */
.error-body {
    background: var(--bg-main);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-container {
    text-align: center;
    padding: 60px 24px;
}

.error-icon { font-size: 64px; margin-bottom: 16px; }
.error-code { font-size: 80px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.error-title { font-size: 24px; font-weight: 700; margin: 16px 0 8px; }
.error-message { color: var(--text-muted); font-size: 15px; }

/* ─── Alerts ────────────────────────────────────────────────── */
.alert {
    border-radius: var(--border-radius-sm);
    font-size: 13.5px;
    margin-bottom: 20px;
}

/* ─── Sidebar Backdrop (mobile) ─────────────────────────────── */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
}
.sidebar-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
}
body.no-scroll { overflow: hidden; }

/* ─── Responsive — < 992px: drawer mode ─────────────────────── */
@media (max-width: 991.98px) {
    .sidebar-nav {
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: var(--shadow-lg);
    }
    .sidebar-nav.is-open { transform: translateX(0); }

    .main-content { margin-left: 0; width: 100%; }

    .topbar { padding: 0 14px; gap: 10px; }
    .topbar-title { font-size: 15px; }

    .page-content { padding: 16px; }

    /* Hide secondary text in topbar; keep avatar tappable. */
    .user-info { display: none; }
    .topbar-right .btn .btn-text { display: none; }

    .login-left { display: none; }
    .login-right { padding: 24px 16px; }

    .badge-body { grid-template-columns: 1fr; }
    .badge-visitor-section,
    .badge-visit-details {
        border-right: none;
        border-bottom: 1px solid var(--card-border);
    }

    /* Force tables to scroll horizontally inside their wrapper. */
    .table-responsive { -webkit-overflow-scrolling: touch; }
    .data-table { min-width: 640px; }

    .form-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    .form-actions .btn { flex: 1 1 auto; }
}

/* ─── Responsive — < 576px: phone tweaks ────────────────────── */
@media (max-width: 575.98px) {
    html { font-size: 13.5px; }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .stat-card { padding: 14px; gap: 12px; }
    .stat-card-icon { width: 44px; height: 44px; font-size: 17px; }
    .stat-card-value { font-size: 22px; }

    .content-card-header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 14px;
    }
    .content-card-header h5 { font-size: 14px; }
    .content-card-body { padding: 14px; }

    .page-content { padding: 12px; }

    .topbar { height: 56px; padding: 0 10px; }
    :root { --topbar-height: 56px; }

    /* Quick-action buttons compact on phones */
    .topbar-right .btn { padding: 6px 10px; font-size: 12.5px; }
}

/* ─── Responsive — between 576 and 768px: small tablets ─────── */
@media (min-width: 576px) and (max-width: 767.98px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ─── Print Styles (for visitor receipt/badge) ──────────────── */
@media print {
    .no-print,
    .receipt-controls,
    .topbar,
    .sidebar-nav,
    .app-footer,
    .btn {
        display: none !important;
    }

    .receipt-body { background: #fff; }

    .receipt-container {
        padding: 0;
    }

    .badge-card {
        box-shadow: none;
        border: 1px solid #ccc;
        max-width: 100%;
        border-radius: 0;
    }

    body { font-size: 12px; }

    .badge-visitor-name { font-size: 16px; }
    .badge-num-value { font-size: 18px; }
}

/* ─── Async / Animation Utilities ──────────────────────────────────────────── */
@keyframes stat-pulse-anim {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.08); color: var(--primary); }
    100% { transform: scale(1); }
}

.stat-pulse { animation: stat-pulse-anim 0.55s ease; }

/* ============================================================================
 * Glassmorphism dashboard widgets — residential dashboard top-line cards.
 * Each card has a soft pastel gradient + frosted overlay + colored accent.
 * ========================================================================= */
.glass-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}
.glass-card {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.65), rgba(255,255,255,0.35));
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,0.45);
    box-shadow:
        0 12px 28px -16px rgba(15, 23, 42, 0.25),
        inset 0 1px 0 rgba(255,255,255,0.6);
    transition: transform 180ms ease, box-shadow 180ms ease;
}
.glass-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--accent, #6366f1) 0%, transparent 65%);
    opacity: 0.12;
    pointer-events: none;
}
.glass-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 18px 36px -18px rgba(15, 23, 42, 0.35),
        inset 0 1px 0 rgba(255,255,255,0.6);
}
.glass-card-icon {
    flex: 0 0 56px;
    width: 56px; height: 56px;
    display: grid; place-items: center;
    border-radius: 16px;
    font-size: 22px;
    color: #fff;
    background: var(--accent, #6366f1);
    box-shadow: 0 8px 20px -10px var(--accent, #6366f1);
}
.glass-card-body { min-width: 0; }
.glass-card-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.05;
    color: #0f172a;
    letter-spacing: -0.02em;
}
.glass-card-label {
    margin-top: 4px;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
}

/* Color variants — each just swaps the --accent custom property. */
.glass-card-blue    { --accent: #3b82f6; }
.glass-card-green   { --accent: #22c55e; }
.glass-card-amber   { --accent: #f59e0b; }
.glass-card-emerald { --accent: #10b981; }
.glass-card-red     { --accent: #ef4444; }
.glass-card-slate   { --accent: #64748b; }

/* ============================================================================
 * Activity timeline
 * ========================================================================= */
.activity-timeline {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}
.activity-timeline::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: linear-gradient(180deg, #e2e8f0, transparent);
}
.activity-timeline li {
    position: relative;
    padding: 8px 0 14px 28px;
}
.activity-dot {
    position: absolute;
    left: 0;
    top: 12px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #cbd5e1;
    box-shadow: 0 0 0 4px #fff;
}
.activity-content { line-height: 1.4; }
.activity-title    { font-weight: 600; color: #0f172a; font-size: 14px; }
.activity-subtitle { margin-top: 2px; }
.activity-time     { margin-top: 4px; }

.activity-check_in           .activity-dot { background: #22c55e; }
.activity-check_out          .activity-dot { background: #06b6d4; }
.activity-approval_approved  .activity-dot { background: #10b981; }
.activity-approval_rejected  .activity-dot { background: #ef4444; }
.activity-alert              .activity-dot { background: #f59e0b; }

/* ============================================================================
 * Notification bell — topbar
 * ========================================================================= */
.notif-bell { position: relative; margin-right: 10px; }
.notif-bell-btn {
    appearance: none;
    border: none;
    background: rgba(99, 102, 241, 0.10);
    color: #4f46e5;
    width: 40px; height: 40px;
    border-radius: 12px;
    display: grid; place-items: center;
    cursor: pointer;
    font-size: 16px;
    transition: background 150ms ease, transform 150ms ease;
    position: relative;
}
.notif-bell-btn:hover { background: rgba(99, 102, 241, 0.18); }
.notif-bell-btn:active { transform: scale(0.96); }

.notif-badge {
    position: absolute;
    top: -2px; right: -2px;
    min-width: 20px; height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: grid; place-items: center;
    box-shadow: 0 0 0 2px #fff;
}

.notif-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 340px;
    max-height: 460px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 48px -16px rgba(15, 23, 42, 0.30);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    z-index: 1100;
    display: flex; flex-direction: column;
}
.notif-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    display: flex; justify-content: space-between; align-items: center;
}
.notif-mark-all {
    appearance: none;
    border: none;
    background: transparent;
    color: #4f46e5;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
}
.notif-mark-all:hover { background: rgba(99, 102, 241, 0.08); }

.notif-list {
    overflow-y: auto;
    max-height: 400px;
}
.notif-empty {
    padding: 28px 16px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f8fafc;
    transition: background 120ms ease;
}
.notif-item:hover { background: #f8fafc; }
.notif-item.is-read { opacity: 0.55; }
.notif-icon { font-size: 14px; padding-top: 3px; flex-shrink: 0; }
.notif-body { min-width: 0; }
.notif-title   { font-weight: 600; font-size: 13.5px; color: #0f172a; }
.notif-message { font-size: 12.5px; color: #475569; line-height: 1.4; margin-top: 2px; }
.notif-time    { font-size: 11px; color: #94a3b8; margin-top: 4px; }

/* Mobile — drop the dropdown to full width below the topbar. */
@media (max-width: 540px) {
    .notif-dropdown {
        right: -8px;
        width: calc(100vw - 16px);
    }
}

