:root {
    --primary: #0f5c4c;
    --primary-dark: #0b2d1f;
    --primary-mid: #0e3a28;
    --gold: #ac8a17;
    --gold-light: #caa64b;
    --gold-dark: #947614;
    --gold-gradient: linear-gradient(145deg, #e8c96a, #caa64b, #a8843d);
    --bg: #f7f5f0;
    --text: #3a3a3a;
    --text-dark: #1b1b1b;
    --muted: #6b6b6b;
    --white: #ffffff;
    --gray-100: #f3f4f2;
    --gray-200: #e8e8e4;
    --gray-400: #a0a0a0;
    --gray-600: #6b6b6b;
    --green: #0f5c4c;
    --green-bg: #ecf5f2;
    --red: #dc2626;
    --red-bg: #fef2f2;
    --footer-bg: #0b0f14;
    --shadow: 0 4px 24px rgba(15, 92, 76, 0.08);
    --shadow-lg: 0 12px 40px rgba(15, 92, 76, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --font-display: 'Montserrat', sans-serif;
    --font-body: 'Poppins', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

/* Navbar — matches saltanat.co.ke white header */
.navbar {
    background: var(--white);
    color: var(--text);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 72px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: var(--gold-gradient);
    color: var(--primary-dark);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.3rem;
}

.nav-brand strong {
    display: block;
    font-family: var(--font-display);
    font-size: .95rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: .5px;
}

.nav-brand span {
    font-family: var(--font-display);
    font-size: .72rem;
    color: var(--gold);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 600;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 8px;
}

.nav-links a {
    color: #333;
    text-decoration: none;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    transition: all .2s;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.nav-links a:hover {
    color: var(--gold);
}

.nav-links a.active {
    color: var(--primary);
    font-weight: 600;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 2px;
    height: 2px;
    background: var(--gold);
    border-radius: 2px;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px;
    flex: 1;
    width: 100%;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.page-subtitle {
    color: var(--muted);
    font-size: .9rem;
    margin-top: 4px;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all .2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gold);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--gold-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(172, 138, 23, .35);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border: 1.5px solid var(--gray-200);
}

.btn-secondary:hover {
    border-color: var(--gold);
    color: var(--gold-dark);
}

.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-sm { padding: 6px 14px; font-size: .8rem; }

.btn-checkout {
    background: var(--primary);
    color: var(--white);
}

.btn-checkout:hover {
    background: var(--primary-dark);
}

.btn-group { display: flex; gap: 8px; }

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: .9rem;
    font-weight: 500;
}

.alert-success {
    background: var(--green-bg);
    color: var(--primary);
    border: 1px solid rgba(15, 92, 76, 0.2);
}

.alert-error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid #fecaca;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    transition: transform .2s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-card.stat-gold {
    background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 55%, #083c32 100%);
    border: none;
}

.stat-card.stat-gold .stat-label { color: rgba(255,255,255,.7); }
.stat-card.stat-gold .stat-value { color: var(--gold-light); }

.stat-card.stat-active {
    border-color: var(--primary);
    background: var(--green-bg);
}

.stat-card.stat-active .stat-value { color: var(--primary); }

.stat-label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--gray-400);
    margin-bottom: 6px;
}

.stat-value {
    display: block;
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-header h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
}

.link {
    color: var(--gold);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
}

.link:hover { text-decoration: underline; color: var(--gold-dark); }

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card h3 {
    font-family: var(--font-display);
    font-size: .95rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--primary);
}

.chart-wide { grid-column: 1 / -1; }

/* Tables */
.table-wrap {
    overflow-x: auto;
    margin: 0 -24px;
    padding: 0 24px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.data-table th {
    background: var(--gray-100);
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--primary);
    white-space: nowrap;
    border-bottom: 2px solid var(--gray-200);
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
    color: var(--text);
}

.data-table tbody tr:hover {
    background: var(--gray-100);
}

.logbook-table { font-size: .82rem; }
.logbook-table th, .logbook-table td { padding: 10px 12px; }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-type {
    background: var(--gray-100);
    color: var(--muted);
}

.badge-in {
    background: var(--green-bg);
    color: var(--primary);
}

.badge-out {
    background: var(--gray-100);
    color: var(--gray-400);
}

/* Forms */
.form-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.form-section {
    padding: 28px 32px;
    border-bottom: 1px solid var(--gray-200);
}

.form-section:last-of-type { border-bottom: none; }

.reception-section {
    background: linear-gradient(to bottom, rgba(172, 138, 23, 0.04), var(--white));
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gold);
    display: inline-block;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 16px;
}

.form-row:last-child { margin-bottom: 0; }

.form-group-full { grid-column: 1 / -1; }

.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}

.req { color: var(--red); }

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-family: inherit;
    color: var(--text-dark);
    background: var(--white);
    transition: border-color .2s, box-shadow .2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(172, 138, 23, .15);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-actions {
    padding: 24px 32px;
    background: var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Filter */
.filter-card { padding: 20px 24px; }

.filter-form .filter-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
    gap: 14px;
    align-items: end;
}

.filter-actions .btn-group { display: flex; gap: 8px; }

.inline-form { display: inline; }

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--gray-400);
}

.empty-state a { color: var(--gold); }

.text-muted { color: var(--gray-400); }

.tooltip { cursor: help; margin-left: 4px; }

/* Footer — matches saltanat.co.ke dark footer */
.footer {
    background: var(--footer-bg);
    color: rgba(255,255,255,.7);
    text-align: center;
    padding: 24px;
    font-size: .85rem;
    margin-top: auto;
}

.footer strong { color: var(--gold-light); }

.footer-sub {
    font-size: .75rem;
    margin-top: 4px;
    color: rgba(255,255,255,.45);
}

/* Responsive */
@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
    .filter-form .filter-row,
    .filter-fields { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        height: auto;
        padding: 16px;
        gap: 12px;
    }

    .form-row { grid-template-columns: 1fr; }
    .filter-form .filter-row,
    .filter-fields { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .page-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 24px;
    }

    .page-hero-actions { width: 100%; }
    .page-hero-actions .btn { flex: 1; justify-content: center; }

    .logbook-v2 { min-width: 900px; }
}

/* ═══════════════════════════════════════
   PREMIUM PAGE HERO
   ═══════════════════════════════════════ */
.page-hero {
    background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 55%, #083c32 100%);
    border-radius: 16px;
    padding: 32px 36px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    color: var(--white);
    box-shadow: 0 8px 32px rgba(15, 92, 76, 0.25);
    position: relative;
    overflow: hidden;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(172, 138, 23, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.page-hero-content { position: relative; z-index: 1; }

.page-hero-tag {
    display: inline-block;
    background: rgba(172, 138, 23, 0.25);
    color: var(--gold-light);
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 10px;
    border: 1px solid rgba(202, 166, 75, 0.3);
}

.page-hero h1 {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 6px;
}

.page-hero p {
    color: rgba(255, 255, 255, 0.75);
    font-size: .9rem;
    max-width: 520px;
    line-height: 1.5;
}

.page-hero-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.page-hero .btn-primary {
    box-shadow: 0 4px 16px rgba(172, 138, 23, 0.4);
}

/* ═══════════════════════════════════════
   LOGBOOK SUMMARY PILLS
   ═══════════════════════════════════════ */
.logbook-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.summary-pill {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 10px 18px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    box-shadow: var(--shadow);
}

.summary-pill-green {
    border-color: rgba(15, 92, 76, 0.2);
    background: var(--green-bg);
}

.summary-num {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.summary-pill-green .summary-num { color: var(--primary); }

.summary-label {
    font-size: .78rem;
    color: var(--muted);
    font-weight: 500;
}

.summary-clear {
    margin-left: auto;
    font-size: .82rem;
    color: var(--gold);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 8px;
    transition: background .2s;
}

.summary-clear:hover {
    background: rgba(172, 138, 23, 0.1);
}

/* ═══════════════════════════════════════
   FILTER V2
   ═══════════════════════════════════════ */
.filter-card-v2 {
    padding: 20px 24px;
    margin-bottom: 20px;
}

.filter-form-v2 {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.search-box {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    font-size: .9rem;
    font-family: inherit;
    color: var(--text-dark);
    background: var(--gray-100);
    transition: all .2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--gold);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(172, 138, 23, .12);
}

.filter-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr 1.2fr auto;
    gap: 12px;
    align-items: end;
}

.filter-field label {
    display: block;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    margin-bottom: 5px;
}

.filter-field input,
.filter-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-size: .85rem;
    font-family: inherit;
    color: var(--text-dark);
    background: var(--white);
}

.filter-field input:focus,
.filter-field select:focus {
    outline: none;
    border-color: var(--gold);
}

.btn-filter { padding: 10px 22px; height: 40px; }

/* ═══════════════════════════════════════
   LOGBOOK TABLE V2
   ═══════════════════════════════════════ */
.table-card { padding: 0; overflow: hidden; }

.table-scroll {
    overflow-x: auto;
}

.logbook-v2 {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.logbook-v2 thead {
    background: linear-gradient(to bottom, var(--gray-100), #eeede8);
    position: sticky;
    top: 0;
    z-index: 2;
}

.logbook-v2 th {
    padding: 14px 16px;
    text-align: left;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--primary);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.logbook-v2 td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}

.logbook-v2 tbody tr {
    transition: background .15s;
}

.logbook-v2 tbody tr:hover {
    background: rgba(15, 92, 76, 0.03);
}

.logbook-v2 tbody tr:last-child td {
    border-bottom: none;
}

/* Visitor cell */
.visitor-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.visitor-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #0e3a28);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
}

.visitor-name {
    display: block;
    color: var(--text-dark);
    font-size: .9rem;
    line-height: 1.3;
}

.visitor-company {
    display: block;
    font-size: .78rem;
    color: var(--muted);
    margin-top: 1px;
}

.visitor-badge-no {
    display: inline-block;
    font-size: .68rem;
    color: var(--gold);
    background: rgba(172, 138, 23, 0.1);
    padding: 1px 7px;
    border-radius: 4px;
    margin-top: 3px;
    font-weight: 600;
}

/* Time cell */
.time-cell { min-width: 130px; }

.time-date {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    font-size: .85rem;
}

.time-range {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 3px;
    font-size: .78rem;
    color: var(--muted);
}

.time-in { color: var(--primary); font-weight: 500; }
.time-out { color: var(--muted); }
.time-arrow { color: var(--gray-400); font-size: .7rem; }
.time-pending { color: var(--gold); font-weight: 500; font-size: .75rem; }

/* Badges v2 */
.badge-type-v2 {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--primary);
    border: 1px solid rgba(15, 92, 76, 0.12);
    white-space: nowrap;
}

/* Contact */
.contact-cell { min-width: 120px; }

.contact-phone {
    display: block;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: .85rem;
}

.contact-phone:hover { color: var(--gold); text-decoration: underline; }

.contact-email {
    display: block;
    font-size: .75rem;
    color: var(--muted);
    margin-top: 2px;
    word-break: break-all;
}

.purpose-text {
    font-size: .82rem;
    color: var(--text);
    max-width: 160px;
    display: block;
}

/* Person cell */
.person-cell span:first-child {
    display: block;
    font-weight: 500;
    font-size: .85rem;
}

.dept-tag {
    display: inline-block;
    font-size: .68rem;
    color: var(--gold-dark);
    background: rgba(172, 138, 23, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 3px;
    font-weight: 600;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-in {
    background: rgba(15, 92, 76, 0.1);
    color: var(--primary);
}

.status-in .status-dot {
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
    animation: pulse 2s infinite;
}

.status-out {
    background: var(--gray-100);
    color: var(--muted);
}

.status-out .status-dot { background: var(--gray-400); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

/* Action buttons */
.actions-cell {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

.btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    padding: 0;
}

.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--green-bg);
}

.btn-checkout-v2:hover {
    border-color: var(--gold);
    color: var(--gold-dark);
    background: rgba(172, 138, 23, 0.08);
}

.btn-edit:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--green-bg);
}

.btn-delete:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-bg);
}

.btn-danger {
    background: var(--red);
    color: var(--white);
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.form-actions-split {
    justify-content: flex-end;
}

.form-actions-right {
    display: flex;
    gap: 12px;
}

.field-hint {
    display: block;
    font-size: .75rem;
    color: var(--muted);
    margin-top: 4px;
}

.danger-zone {
    background: var(--white);
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-top: 20px;
}

.danger-zone h3 {
    font-family: var(--font-display);
    font-size: .95rem;
    color: var(--red);
    margin-bottom: 6px;
}

.danger-zone p {
    font-size: .85rem;
    color: var(--muted);
    margin-bottom: 14px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

/* Empty state v2 */
.empty-state-v2 {
    text-align: center;
    padding: 60px 24px;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: .6;
}

.empty-state-v2 h3 {
    font-family: var(--font-display);
    color: var(--primary);
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.empty-state-v2 p {
    color: var(--muted);
    font-size: .9rem;
    margin-bottom: 20px;
}

/* ═══════════════════════════════════════
   MODAL
   ═══════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 45, 31, 0.55);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn .2s ease;
}

.modal-overlay[hidden] { display: none; }

.modal {
    background: var(--white);
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    animation: slideUp .25s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(to right, var(--green-bg), var(--white));
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-100);
    border-radius: 8px;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    transition: all .2s;
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--text-dark);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(85vh - 70px);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.detail-item label {
    display: block;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    margin-bottom: 4px;
}

.detail-item span,
.detail-item p {
    font-size: .9rem;
    color: var(--text-dark);
    font-weight: 500;
}

.detail-item.full { grid-column: 1 / -1; }

.detail-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.detail-hero .visitor-avatar {
    width: 56px;
    height: 56px;
    font-size: 1.1rem;
    border-radius: 14px;
}

.detail-hero h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--primary);
}

.detail-hero p {
    font-size: .85rem;
    color: var(--muted);
    margin-top: 2px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Stat card icons enhancement */
.stat-card {
    position: relative;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--gold);
    border-radius: 0 var(--radius) var(--radius) 0;
    opacity: 0;
    transition: opacity .2s;
}

.stat-card:hover::after { opacity: 1; }

.stat-card.stat-gold::after { display: none; }

/* Register page hero reuse */
.register-hero .page-hero { margin-bottom: 28px; }

/* Login page */
.login-page {
    background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 55%, #083c32 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-wrap {
    width: 100%;
    max-width: 420px;
}

.login-brand {
    text-align: center;
    color: var(--white);
    margin-bottom: 28px;
}

.brand-icon-lg {
    width: 64px;
    height: 64px;
    font-size: 1.8rem;
    margin: 0 auto 14px;
    border-radius: 14px;
}

.login-brand h1 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    letter-spacing: 2px;
}

.login-brand p {
    color: var(--gold-light);
    font-size: .85rem;
    margin-top: 4px;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
}

.login-card h2 {
    font-family: var(--font-display);
    color: var(--primary);
    font-size: 1.25rem;
    margin-bottom: 4px;
}

.login-sub {
    color: var(--muted);
    font-size: .85rem;
    margin-bottom: 20px;
}

.login-btn { width: 100%; margin-top: 8px; }

.login-footer-note {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: .75rem;
    margin-top: 16px;
}

/* Nav user */
.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-user-info {
    text-align: right;
    line-height: 1.3;
}

.nav-user-info strong {
    display: block;
    font-size: .82rem;
    color: var(--text-dark);
}

.nav-user-info .badge {
    font-size: .65rem;
    padding: 2px 8px;
}

.nav-logout { padding: 6px 14px; font-size: .78rem; }

.badge-role-super { background: #fef3c7; color: #92400e; }
.badge-role-admin { background: #dbeafe; color: #1e40af; }
.badge-role-user { background: var(--gray-100); color: var(--muted); }

/* Roles info */
.roles-info { margin-bottom: 24px; }
.roles-info h3 { font-family: var(--font-display); color: var(--primary); margin-bottom: 16px; }

.roles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.role-card {
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--gray-200);
}

.role-card strong {
    display: block;
    font-family: var(--font-display);
    margin-bottom: 8px;
    font-size: .9rem;
}

.role-card ul {
    list-style: none;
    font-size: .8rem;
    color: var(--muted);
}

.role-card li {
    padding: 3px 0;
    padding-left: 14px;
    position: relative;
}

.role-card li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--gold);
    font-size: .7rem;
}

.role-super { background: rgba(254, 243, 199, 0.3); border-color: #fde68a; }
.role-admin { background: rgba(219, 234, 254, 0.3); border-color: #bfdbfe; }
.role-user { background: var(--gray-100); }

.users-layout {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 24px;
    align-items: start;
}

.user-form { padding: 0 4px; }

.registrar-cell strong {
    display: block;
    font-size: .85rem;
}

.registrar-note {
    color: rgba(255, 255, 255, 0.8);
    font-size: .85rem;
    margin-top: 6px;
}

.pw-plain {
    font-size: .82rem;
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--text-dark);
}

@media (max-width: 1024px) {
    .users-layout { grid-template-columns: 1fr; }
    .roles-grid { grid-template-columns: 1fr; }
    .nav-user-info { display: none; }
}

@media (max-width: 768px) {
    .navbar { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 10px; }
    .nav-links { flex-wrap: wrap; justify-content: center; }
    .nav-user { width: 100%; justify-content: center; }
}
