/* Premium layer — shared look for every screen (loads after app.css) */
:root {
    --at-font: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
    --at-line: #ECEEF5;
    --at-shadow-soft: 0 10px 28px rgba(18, 23, 43, .05);
    --at-tile: #F4F6FC;
}
body { font-family: var(--at-font); }

/* cards */
.content-card, .stat-card, .profile-hero, .pass-list-card, .child-card, .request-card {
    border-radius: 24px;
    border-color: #EEF0F6;
    box-shadow: var(--at-shadow-soft);
}
.content-card { padding: 20px; }
.section-head h3 { font-weight: 800; }

/* forms */
.form-label {
    font-size: .72rem;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #6B7690;
    font-weight: 700;
}
.form-control, .form-select {
    background-color: var(--at-tile);
    border: 1px solid transparent;
    border-radius: 16px;
    min-height: 54px;
    font-weight: 600;
    color: var(--at-ink);
}
.form-control::placeholder { color: #9AA4BA; font-weight: 500; }
.form-control:focus, .form-select:focus {
    background-color: #fff;
    border-color: var(--at-primary);
    box-shadow: 0 0 0 .22rem color-mix(in srgb, var(--at-primary) 14%, transparent);
}
textarea.form-control { min-height: 112px; }
.form-control-color { background-color: var(--at-tile); }
.setting-switch { border-radius: 18px; background: var(--at-tile); border-color: transparent; }
.brand-preview { border-radius: 18px; background: var(--at-tile); border-color: #DCE0EC; }
.hint-box { border-radius: 16px; }

/* buttons */
.btn-at { border-radius: 18px; min-height: 52px; font-weight: 800; }
.btn-at-danger { background: #FFF1F1; color: #C81E1E; border: 1px solid #F6CFCF; }
.btn-at-danger:hover, .btn-at-danger:focus { background: #FFE4E4; color: #A91515; border-color: #F1B8B8; }
.btn-at-danger:disabled { opacity: .5; }
form > .btn-at-danger:only-child { width: 100%; }
.filter-chips a, .filter-chips button { font-weight: 700; }

.hide-mobile { }
@media (max-width: 991.98px) { .hide-mobile { display: none !important; } }

/* big action buttons (shared by the Gate Pass screen and every inner page) */
.act-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 60px;
    border-radius: 20px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    padding: 0 14px;
    transition: transform .15s ease, filter .15s ease;
}
.act-btn:active { transform: scale(.98); }
.act-btn svg { width: 22px; height: 22px; flex-shrink: 0; }
.act-btn-primary { background: var(--at-primary); color: #fff; box-shadow: 0 12px 26px color-mix(in srgb, var(--at-primary) 35%, transparent); }
.act-btn-primary:hover { color: #fff; filter: brightness(1.05); }
.act-btn-success { background: #12A150; color: #fff; box-shadow: 0 12px 26px rgba(18, 161, 80, .3); }
.act-btn-success:hover { color: #fff; filter: brightness(1.05); }
.act-btn-light { background: #fff; color: var(--at-ink); border-color: #DCE0EC; }
.act-btn-light:hover { color: var(--at-ink); background: #fafbff; }
.act-btn-danger-text { color: #C81E1E; }
.act-btn-wide { grid-column: 1 / -1; }
.act-btn:disabled { opacity: .65; pointer-events: none; }

/* bottom action bar */
.page-actions-bar {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 12px;
}
.page-actions-bar > :only-child { grid-column: 1 / -1; }

.inner-head { display: none; }
.inner-back {
    width: 46px; height: 46px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 10px rgba(18, 23, 43, .08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--at-ink);
}
.inner-back svg { width: 22px; height: 22px; }

@media (max-width: 991.98px) {
    .page-actions-bar {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 1040;
        padding: 14px 20px calc(18px + env(safe-area-inset-bottom));
        background: linear-gradient(180deg, transparent, var(--at-surface) 38%);
    }
    body.pass-page .page-actions-bar { padding-left: 24px; padding-right: 24px; }

    body.inner-page .push-prompt,
    body.inner-page .pwa-install { display: none !important; }
    body.inner-page .mobile-header { display: flex !important; }
    body.inner-page .bottom-nav { display: grid !important; }
    body.inner-page .desktop-main::before { display: none; }
    body.inner-page .page-actions-bar {
        bottom: calc(80px + env(safe-area-inset-bottom));
    }
    body.inner-page .page-actions-bar .act-btn-light[data-go-back] { display: none; }
    body.inner-page .page-actions-bar { grid-template-columns: 1fr; }
    body.inner-page .desktop-main { position: relative; min-height: 100vh; }
    body.inner-page .mobile-main { position: relative; z-index: 1; padding: 16px 20px calc(var(--at-nav-h) + 24px); max-width: none; }
    .inner-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
    .inner-head h1 {
        margin: 0;
        font-size: clamp(22px, 6.4vw, 28px);
        font-weight: 800;
        letter-spacing: -.01em;
        line-height: 1.15;
    }
    .inner-head p { margin: 3px 0 0; color: var(--at-muted); font-size: .85rem; font-weight: 500; }
}

@media (max-width: 400px) {
    .act-btn { font-size: 16px; min-height: 56px; }
    .page-actions-bar { padding-left: 16px; padding-right: 16px; }
    body.pass-page .page-actions-bar { padding-left: 18px; padding-right: 18px; }
}

/* desktop: the bar is a normal form footer */
@media (min-width: 992px) {
    .desktop-content > .page-actions-bar {
        margin-top: 22px;
        grid-template-columns: repeat(2, minmax(150px, 210px));
        justify-content: start;
    }
    .desktop-content > .page-actions-bar .act-btn { min-height: 52px; font-size: 15px; border-radius: 16px; }
}

@media print { .page-actions-bar { display: none !important; } }

/* ===== Desktop (enterprise) layout polish ===== */
@media (min-width: 992px) {
    /* .mobile-main { padding:0 } used to win over .desktop-content, leaving content flush against the sidebar */
    .mobile-main.desktop-content { padding: 28px 32px 56px; max-width: 1360px; margin: 0; }
    .desktop-topbar { padding: 0 32px; }
    .greeting { font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; margin-bottom: 20px; }

    .admin-stats, .stats-row { gap: 18px; margin-bottom: 24px; }
    .stat-card, .admin-stats .stat-card { padding: 22px 24px; }
    .stat-card .value { font-size: 2rem; font-weight: 800; line-height: 1.1; }
    .stat-card .label { font-size: .85rem; font-weight: 600; margin-top: 6px; }

    .section-head { margin-bottom: 14px; }
    .section-head h3 { font-size: 1.15rem; font-weight: 800; }
    .section-head a { font-weight: 700; }

    .table-desktop.content-card { padding: 8px 14px; }
    .table thead th {
        font-size: .72rem;
        text-transform: uppercase;
        letter-spacing: .08em;
        color: #6B7690;
        font-weight: 700;
        border-bottom: 1px solid var(--at-line);
        padding: 16px;
    }
    .table td { padding: 14px 16px; border-color: #F0F2F8; vertical-align: middle; }
    .table tbody tr:hover { background: #FAFBFE; }
    .table td a { font-weight: 700; }

    .search-bar { max-width: 560px; }
    .filter-chips { margin-bottom: 18px; }
}

.search-bar .form-control { background-color: #fff; border-color: #E3E6F0; }
.filter-chips a:not(.active), .filter-chips button:not(.active) { background: #fff; }

@media (min-width: 992px) {
    .table-desktop .table td:first-child, .table-desktop .table td:last-child { white-space: nowrap; }
    .table td { padding: 14px 10px; }
    .table thead th { padding: 16px 10px; }
}

/* ===== Desktop: keep every module's container centered in the content area ===== */
@media (min-width: 992px) {
    .mobile-main.desktop-content { margin-left: auto; margin-right: auto; width: 100%; }

    /* inner pages (forms / details / settings) = one centered column */
    body.inner-page .mobile-main.desktop-content { max-width: 820px; }
    body.inner-page .content-card[style*="max-width"] { max-width: none !important; }
    body.inner-page .desktop-content > .page-actions-bar {
        grid-template-columns: 1fr 1.1fr;
        justify-content: stretch;
    }
    body.inner-page .desktop-content > .page-actions-bar > :only-child { grid-column: 1 / -1; }
    .search-bar { max-width: none; }
}

@media (min-width: 992px) { .page-actions-bar.bar-mobile-only { display: none !important; } }

/* ===== More menu ===== */
.more-title { margin: 4px 2px 18px; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; color: var(--at-ink); }
.more-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border-radius: 22px;
    padding: 14px 16px;
    margin-bottom: 16px;
    color: inherit;
    box-shadow: 0 8px 24px rgba(18, 23, 43, .04);
}
.more-profile strong { display: block; font-size: 1.02rem; font-weight: 800; color: var(--at-ink); }
.more-profile small { display: block; margin-top: 2px; color: #9AA3B5; font-size: .82rem; font-weight: 600; }
.more-avatar {
    width: 46px; height: 46px; flex: 0 0 46px;
    border-radius: 50%;
    background: var(--at-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: .95rem;
}
.more-list {
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(18, 23, 43, .04);
}
.more-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 15px 16px;
    border: 0;
    background: #fff;
    color: var(--at-ink);
    font-weight: 700;
    font-size: .98rem;
    text-align: left;
    border-top: 1px solid #F3F4F8;
}
.more-item:first-child { border-top: 0; }
.more-item:hover { color: var(--at-ink); }
.more-ico {
    width: 36px; height: 36px; flex: 0 0 36px;
    border-radius: 50%;
    background: #FDECEC;
    color: var(--at-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.more-ico svg { width: 18px; height: 18px; }
.more-chevron { width: 18px; height: 18px; margin-left: auto; color: #C5CAD6; flex: 0 0 18px; }
.more-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--at-primary);
    margin-left: auto;
    display: none;
    font-size: 0;
    overflow: hidden;
}
.more-dot.show { display: inline-block; }
.more-item .more-dot + .more-chevron { margin-left: 10px; }
.more-install-hint { margin: 0; border-radius: 0; }
.more-logout { margin-top: 16px; background: #fff; border-radius: 22px; overflow: hidden; box-shadow: 0 8px 24px rgba(18, 23, 43, .04); }
.more-item.is-danger { color: #C81E1E; width: 100%; border-top: 0; }
.more-item.is-danger .more-ico { background: #FFF1F1; color: #C81E1E; }
.more-item.is-danger:hover { color: #A91515; }

@media (min-width: 992px) {
    .more-logout { max-width: 560px; }
}

body.more-page .pwa-install { display: none !important; }

@media (min-width: 992px) {
    .more-title { font-size: 2rem; }
    .more-list, .more-profile { max-width: 560px; }
}

/* ===== Dashboard (mobile mockup) ===== */
.dash-hello { margin: 4px 2px 18px; }
.dash-hello span { display: block; color: #9AA3B5; font-size: .95rem; font-weight: 600; }
.dash-hello h1 { margin: 2px 0 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; color: var(--at-ink); }

.dash-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: #fff;
    border-radius: 22px;
    padding: 18px 8px 16px;
    margin-bottom: 22px;
    box-shadow: 0 8px 24px rgba(18, 23, 43, .04);
}
.dash-stats > div { text-align: center; }
.dash-stats strong { display: block; font-size: 1.85rem; font-weight: 800; line-height: 1.1; color: var(--at-ink); }
.dash-stats small { display: block; margin-top: 6px; color: #9AA3B5; font-size: .78rem; font-weight: 600; }

.dash-label { margin: 0 2px 12px; font-size: 1.05rem; font-weight: 800; color: var(--at-ink); }
.dash-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 26px;
}
.dash-action {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 0 14px;
    border-radius: 999px;
    background: #fff;
    color: var(--at-ink);
    font-weight: 700;
    font-size: .88rem;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(18, 23, 43, .04);
}
.dash-action svg { width: 20px; height: 20px; flex-shrink: 0; }
.dash-action:hover { color: var(--at-ink); }
.dash-action.is-primary {
    background: var(--at-primary);
    color: #fff;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--at-primary) 35%, transparent);
}
.dash-action.is-primary:hover { color: #fff; }

.section-head h3 { font-size: 1.05rem; font-weight: 800; }
.section-head a { color: var(--at-primary); font-weight: 700; }

.activity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fff;
    border-radius: 22px;
    padding: 16px 16px;
    margin-bottom: 10px;
    color: inherit;
    box-shadow: 0 8px 24px rgba(18, 23, 43, .04);
}
.activity-row strong { display: block; font-size: .98rem; font-weight: 800; color: var(--at-ink); }
.activity-row small { display: block; margin-top: 4px; color: #9AA3B5; font-size: .82rem; font-weight: 600; }
.activity-row .badge-status { flex-shrink: 0; background: #F1F3F8; color: #7A8499; border-radius: 999px; padding: 6px 12px; font-weight: 700; text-transform: capitalize; }

@media (min-width: 992px) {
    .dash-hello h1 { font-size: 2rem; }
    .dash-actions { max-width: 560px; }
}

/* ===== PWA first-visit install card ===== */
.pwa-install {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(var(--at-nav-h, 68px) + 16px);
    z-index: 1080;
    display: none;
    background: #fff;
    border: 1px solid #EEF0F6;
    border-radius: 24px;
    padding: 18px 16px 16px;
    box-shadow: 0 18px 40px rgba(18, 23, 43, .16);
}
.pwa-install.show { display: block; }
.pwa-install-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.pwa-install-head img {
    width: 52px; height: 52px; border-radius: 14px;
    object-fit: cover; background: #fff; flex-shrink: 0;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--at-primary) 22%, transparent);
}
.pwa-install-head h4 { margin: 0 0 4px; font-size: 1.05rem; font-weight: 800; color: var(--at-ink); }
.pwa-install-head p { margin: 0; color: var(--at-muted); font-size: .86rem; font-weight: 500; line-height: 1.4; }
.pwa-install-actions { display: grid; grid-template-columns: 1.4fr .8fr; gap: 10px; }
.pwa-install-actions .act-btn { min-height: 52px; font-size: 15px; }
.pwa-ios-hint {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 14px;
    background: #FFF6F6;
    color: var(--at-ink);
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.4;
}
body:not([data-auth]) .pwa-install { bottom: 20px; }
.pwa-install, .push-prompt { bottom: calc(var(--at-nav-h) + 8px); }
body.pwa-install-open .push-prompt { display: none !important; }
body.pwa-install-open .login-page { padding-bottom: 210px; }
body.pwa-install-open .mobile-main { padding-bottom: calc(var(--at-nav-h, 68px) + 200px); }
body.inner-page .pwa-install,
body.pass-page .pwa-install { display: none !important; }

@media (min-width: 992px) {
    body[data-auth] .pwa-install {
        left: auto; right: 28px; bottom: 28px; width: 380px;
    }
    body:not([data-auth]) .pwa-install {
        left: 50%; right: auto; width: 400px; transform: translateX(-50%);
    }
}

@media (max-width: 991.98px) {
    .toast-stack {
        top: calc(var(--at-header-h, 64px) + 10px);
        left: 16px;
        right: 16px;
        align-items: stretch;
    }
    body:not([data-auth]) .toast-stack { top: 16px; }
    .toast-at { min-width: 0; text-align: center; }
}
