:root {
    --at-primary: #E31E24;
    --at-primary-dark: #C4181E;
    --at-primary-soft: #FDECEC;
    --at-ink: #111111;
    --at-muted: #5B6B7C;
    --at-line: #E8EBEF;
    --at-surface: #F7F8FA;
    --at-card: #ffffff;
    --at-success: #0f9d6c;
    --at-warning: #d97706;
    --at-danger: #E31E24;
    --at-info: #0ea5a8;
    --at-radius: 18px;
    --at-radius-sm: 12px;
    --at-shadow: 0 10px 30px rgba(17, 17, 17, 0.06);
    --at-shadow-soft: 0 4px 14px rgba(17, 17, 17, 0.04);
    --at-font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --at-header-h: 64px;
    --at-nav-h: 88px;
    --at-sidebar-w: 260px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--at-font);
    color: var(--at-ink);
    background: var(--at-surface);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--at-primary); text-decoration: none; }
a:hover { color: var(--at-primary-dark); }

.app-shell { min-height: 100vh; }
.desktop-sidebar { display: none; }
.desktop-topbar { display: none; }
@media (max-width: 991.98px) {
    .desktop-main { padding-top: var(--at-header-h); }
    body.pass-page .desktop-main { padding-top: 0; }
}
.mobile-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1030;
    height: var(--at-header-h);
    flex-shrink: 0;
    background: var(--at-surface);
    backdrop-filter: none;
    border-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
}
.mobile-header .brand {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    max-width: 62%;
    color: var(--at-ink);
    font-weight: 700;
}
.mobile-header .brand img {
    height: 34px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
    flex-shrink: 0;
}
.mobile-header .bell-btn { flex: 0 0 42px; }
.mobile-main {
    padding: 16px 16px calc(var(--at-nav-h) + 24px);
    max-width: 720px;
    margin: 0 auto;
}
.bottom-nav {
    position: fixed;
    left: 14px; right: 14px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    height: 68px;
    background: #fff;
    border: 0;
    border-radius: 28px;
    display: grid;
    grid-template-columns: 1fr 1fr 64px 1fr 1fr;
    align-items: center;
    z-index: 1030;
    box-shadow: 0 12px 36px rgba(18, 23, 43, .14);
    padding: 0 6px;
}
.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #9AA3B5;
    font-size: 11px;
    font-weight: 700;
    min-height: 52px;
}
.bottom-nav a.active, .bottom-nav a:hover { color: var(--at-primary); }
.bottom-nav a.active:not(.nav-fab) {
    background: #FDECEC;
    border-radius: 16px;
    margin: 8px 4px;
}
.bottom-nav svg { width: 22px; height: 22px; }
.bottom-nav .nav-fab {
    width: 56px;
    height: 56px;
    min-height: 56px;
    margin: -28px auto 0;
    border-radius: 50%;
    background: var(--at-primary);
    color: #fff !important;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--at-primary) 42%, transparent);
    gap: 0;
}
.bottom-nav .nav-fab svg { width: 24px; height: 24px; }
.bottom-nav .nav-fab.active { filter: brightness(1.05); }

.page-title {
    font-size: 1.45rem;
    font-weight: 750;
    color: var(--at-ink);
    margin: 0 0 4px;
}
.page-subtitle { color: var(--at-muted); margin-bottom: 18px; font-size: .95rem; }

.greeting {
    font-size: 1.5rem;
    font-weight: 750;
    color: var(--at-ink);
    margin-bottom: 16px;
}

.profile-hero, .stat-card, .content-card, .pass-list-card, .child-card, .request-card {
    background: var(--at-card);
    border: 1px solid var(--at-line);
    border-radius: var(--at-radius);
    box-shadow: var(--at-shadow-soft);
}

.profile-hero {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 16px;
    margin-bottom: 16px;
}
.avatar, .avatar-lg, .avatar-sm {
    border-radius: 50%;
    object-fit: cover;
    background: #f1f3f5;
    flex-shrink: 0;
}
.avatar { width: 56px; height: 56px; }
.avatar-lg { width: 88px; height: 88px; }
.avatar-sm { width: 42px; height: 42px; }
.profile-hero h2 { margin: 0; font-size: 1.1rem; }
.profile-hero p { margin: 2px 0 0; color: var(--at-muted); font-size: .9rem; }

.cta-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--at-primary), var(--at-primary-dark));
    color: #fff !important;
    font-weight: 700;
    margin-bottom: 16px;
    box-shadow: 0 10px 24px rgba(227,30,36,.22);
}
.cta-primary:hover { filter: brightness(1.05); color: #fff !important; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}
.stat-card { padding: 14px 12px; text-align: center; }
.stat-card .value { font-size: 1.35rem; font-weight: 750; color: var(--at-ink); }
.stat-card .label { font-size: .75rem; color: var(--at-muted); margin-top: 2px; }

.content-card { padding: 16px; margin-bottom: 14px; }
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.section-head h3 { margin: 0; font-size: 1rem; font-weight: 700; color: var(--at-ink); }

.pass-list-card, .child-card, .request-card {
    padding: 14px;
    margin-bottom: 10px;
    display: block;
    color: inherit;
}
.pass-list-card:hover, .child-card:hover { border-color: #f0c4c6; }
.pass-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.pass-meta strong { color: var(--at-ink); }
.pass-reason {
    color: var(--at-muted);
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.badge-pending { background: #fff7e8; color: #b45309; }
.badge-approved, .badge-active { background: #e8f8f1; color: #0f9d6c; }
.badge-rejected { background: var(--at-primary-soft); color: var(--at-primary); }
.badge-expired, .badge-cancelled, .badge-muted { background: #eef2f6; color: #64748b; }
.badge-parent { background: #fff1f1; color: var(--at-primary); }
.badge-child { background: #f3f4f6; color: #374151; }
.badge-admin { background: #111111; color: #fff; }

.empty-state {
    text-align: center;
    padding: 36px 18px;
    color: var(--at-muted);
}
.empty-state h4 { color: var(--at-ink); margin-bottom: 6px; }

.btn-at {
    border: 0;
    border-radius: 12px;
    min-height: 44px;
    padding: 10px 16px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-at-primary { background: var(--at-primary); color: #fff; }
.btn-at-primary:hover { background: var(--at-primary-dark); color: #fff; }
.btn-at-success { background: var(--at-success); color: #fff; }
.btn-at-danger { background: var(--at-danger); color: #fff; }
.btn-at-ghost {
    background: #fff;
    border: 1px solid var(--at-line);
    color: var(--at-ink);
}
.btn-at:disabled { opacity: .65; pointer-events: none; }

.form-label { font-weight: 600; color: var(--at-ink); font-size: .9rem; }
.form-control, .form-select {
    min-height: 48px;
    border-radius: 12px;
    border-color: #d9dee5;
}
.form-control:focus, .form-select:focus {
    border-color: var(--at-primary);
    box-shadow: 0 0 0 .2rem rgba(227,30,36,.12);
}
.form-control-color {
    min-height: 48px;
    padding: 6px;
}
.hint-box {
    background: var(--at-primary-soft);
    border: 1px solid #f5c2c4;
    color: #8f1519;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: .9rem;
    margin-top: 8px;
}
.setting-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--at-line);
    border-radius: 12px;
    background: #fff;
    font-weight: 600;
    color: var(--at-ink);
    min-height: 52px;
}
.setting-switch input { width: 18px; height: 18px; accent-color: var(--at-primary); }
.brand-preview {
    background: #fff;
    border: 1px dashed var(--at-line);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 84px;
}

/* Digital Gate Pass */
.digital-pass {
    max-width: 420px;
    margin: 0 auto;
    background:
        radial-gradient(circle at top right, rgba(227,30,36,.08), transparent 42%),
        linear-gradient(180deg, #ffffff 0%, #fff9f9 100%);
    border: 1px solid #f0d0d2;
    border-radius: 24px;
    box-shadow: 0 18px 40px rgba(17,17,17,.08);
    overflow: hidden;
    position: relative;
}
.digital-pass::before {
    content: "";
    position: absolute;
    inset: 10px;
    border: 1px dashed rgba(227,30,36,.28);
    border-radius: 18px;
    pointer-events: none;
}
.digital-pass-inner { padding: 28px 22px 24px; position: relative; z-index: 1; }
.pass-brand {
    text-align: center;
    margin-bottom: 18px;
}
.pass-brand img { height: 48px; margin-bottom: 8px; object-fit: contain; }
.pass-brand .pass-title {
    letter-spacing: .28em;
    font-size: .78rem;
    font-weight: 800;
    color: var(--at-ink);
}
.pass-company-meta {
    text-align: center;
    color: var(--at-muted);
    font-size: .78rem;
    margin: -8px 0 16px;
    line-height: 1.4;
}
.pass-photo-wrap { text-align: center; margin-bottom: 14px; }
.pass-photo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 8px 20px rgba(17,17,17,.12);
}
.pass-identity { text-align: center; margin-bottom: 22px; }
.pass-identity h1 {
    font-size: 1.35rem;
    margin: 0 0 4px;
    color: var(--at-ink);
    font-weight: 800;
}
.pass-identity p { margin: 0; color: var(--at-muted); font-size: .92rem; }
.pass-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}
.pass-field label {
    display: block;
    font-size: .68rem;
    letter-spacing: .08em;
    font-weight: 800;
    color: #7b8a9a;
    margin-bottom: 4px;
}
.pass-field strong {
    display: block;
    color: var(--at-ink);
    font-size: 1rem;
    font-weight: 750;
}
.pass-field.full { grid-column: 1 / -1; }
.pass-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #f0d0d2, transparent);
    margin: 16px 0;
}
.pass-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.pass-status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: currentColor; display: inline-block;
}
.pass-note {
    margin-top: 14px;
    font-size: .78rem;
    color: var(--at-muted);
    text-align: center;
    line-height: 1.45;
}
.expired-banner {
    background: var(--at-primary-soft);
    color: #8f1519;
    border-radius: 14px;
    padding: 14px;
    text-align: center;
    font-weight: 700;
    margin-bottom: 14px;
}

/* Login — light theme */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 12% 18%, rgba(227,30,36,.10), transparent 34%),
        radial-gradient(circle at 88% 82%, rgba(17,17,17,.04), transparent 40%),
        linear-gradient(180deg, #ffffff 0%, #F7F8FA 100%);
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--at-line);
    border-radius: 24px;
    padding: 32px 28px;
    box-shadow: 0 18px 40px rgba(17,17,17,.08);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand img { height: 56px; margin-bottom: 12px; object-fit: contain; }
.login-brand h1 { font-size: 1.25rem; margin: 0; color: var(--at-ink); }
.login-brand p { margin: 6px 0 0; color: var(--at-muted); font-size: .92rem; }
.password-wrap { position: relative; }
.password-wrap .toggle-password {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    border: 0; background: transparent;
    color: var(--at-muted);
    font-size: .85rem;
    font-weight: 600;
}

.bell-btn {
    position: relative;
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 1px solid var(--at-line);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.bell-count {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    border-radius: 999px;
    background: var(--at-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.bell-count.show { display: inline-flex; }

.notification-item {
    display: block;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--at-line);
    background: #fff;
    margin-bottom: 10px;
    color: inherit;
}
.notification-item.unread {
    background: #fff7f7;
    border-color: #f5c2c4;
}
.notification-item h4 { margin: 0 0 4px; font-size: .95rem; color: var(--at-ink); }
.notification-item p { margin: 0; color: var(--at-muted); font-size: .88rem; }
.notification-item .time { margin-top: 6px; font-size: .75rem; color: #8a97a6; }

.push-prompt {
    position: fixed;
    left: 16px; right: 16px; bottom: calc(var(--at-nav-h) + 16px);
    background: #fff;
    border: 1px solid var(--at-line);
    border-radius: 18px;
    box-shadow: var(--at-shadow);
    padding: 16px;
    z-index: 1040;
    display: none;
}
.push-prompt.show { display: block; }
.push-prompt h4 { margin: 0 0 4px; color: var(--at-ink); }
.push-prompt p { margin: 0 0 12px; color: var(--at-muted); font-size: .9rem; }

.toast-stack {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast-at {
    background: var(--at-ink);
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: var(--at-shadow);
    min-width: 240px;
    animation: slideIn .25s ease;
}
.toast-at.error { background: var(--at-primary); }
.toast-at.success { background: var(--at-success); }
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 12px;
}
.filter-chips a, .filter-chips button {
    white-space: nowrap;
    border: 1px solid var(--at-line);
    background: #fff;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--at-muted);
}
.filter-chips a.active, .filter-chips button.active {
    background: var(--at-primary);
    border-color: var(--at-primary);
    color: #fff;
}

.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}
.search-bar .form-control { flex: 1; }

.table-desktop { display: none; }
.admin-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}
.admin-stats .stat-card { text-align: left; padding: 16px; }
.admin-stats .stat-card .label { margin-top: 4px; }

.request-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

.desktop-only { display: none; }
.mobile-only { display: block; }

@media (min-width: 992px) {
    .mobile-header, .bottom-nav, .mobile-only { display: none !important; }
    .desktop-only { display: block; }
    .app-shell {
        display: grid;
        grid-template-columns: var(--at-sidebar-w) 1fr;
        min-height: 100vh;
    }
    .desktop-sidebar {
        display: flex;
        flex-direction: column;
        background: #ffffff;
        color: var(--at-ink);
        border-right: 1px solid var(--at-line);
        padding: 22px 16px;
        position: sticky;
        top: 0;
        height: 100vh;
    }
    .desktop-sidebar .brand {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 8px 10px 20px;
        border-bottom: 1px solid var(--at-line);
        margin-bottom: 18px;
    }
    .desktop-sidebar .brand img { height: 42px; max-width: 100%; object-fit: contain; }
    .side-nav a {
        display: flex;
        align-items: center;
        gap: 10px;
        color: var(--at-muted);
        padding: 12px 14px;
        border-radius: 12px;
        margin-bottom: 4px;
        font-weight: 600;
    }
    .side-nav a:hover, .side-nav a.active {
        background: var(--at-primary-soft);
        color: var(--at-primary);
    }
    .desktop-main { min-width: 0; }
    .desktop-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 72px;
        padding: 0 28px;
        background: rgba(255,255,255,.96);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--at-line);
        position: sticky;
        top: 0;
        z-index: 20;
    }
    .desktop-content {
        padding: 28px;
        max-width: 1280px;
    }
    .mobile-main {
        padding: 0;
        max-width: none;
        margin: 0;
    }
    .stats-row { grid-template-columns: repeat(4, 1fr); gap: 14px; }
    .admin-stats { grid-template-columns: repeat(4, 1fr); gap: 14px; }
    .table-desktop { display: block; }
    .cards-mobile { display: none; }
    .push-prompt {
        left: auto;
        right: 28px;
        bottom: 28px;
        width: 360px;
    }
    .digital-pass { max-width: 460px; }
}

@media (max-width: 380px) {
    .stats-row { grid-template-columns: 1fr 1fr 1fr; }
    .pass-grid { gap: 10px; }
    .pass-identity h1 { font-size: 1.2rem; }
}
