/* ============================================================
   Safegate Estate Gatepass – Main Stylesheet
   Theme: Honeyed Gold (Pantone 141C) + Navy + White
   ============================================================ */

/* Inter font is loaded via a <link> tag (includes/header.php, index.php, and the other
   standalone pages), not @import here — self-hosted under assets/vendor/fonts/inter/,
   and a <link> loads in parallel instead of blocking on this file first. */

:root {
    --sg-gold:        #EDAB18;   /* Pantone 141C — brand primary */
    --sg-gold-dark:   #C6900F;   /* hover / pressed state */
    --sg-gold-darker: #A9790C;   /* active / strong emphasis */
    --sg-gold-light:  #FBEBC7;   /* tint for subtle surfaces */
    --sg-gold-ink:    #4A3707;   /* AA-safe dark text on gold tints */

    --sg-green:       #1a7a4a;   /* success / approved / resolved */
    --sg-green-dark:  #145f39;
    --sg-green-light: #e8f5ee;

    --sg-red:         #d62828;   /* danger / emergency / cancelled */

    --sg-dark:        #00164f;   /* navy — sidebar / headings / brand */
    --sg-dark-2:      #0d2a63;   /* lighter navy — hover surfaces */
    --sg-gray:        #f7f6f3;   /* warm neutral page background */

    /* Surface tokens — light chrome (navbar/footer/cards) sitting on the navy sidebar */
    --sg-surface-lowest:      #ffffff;
    --sg-surface-low:         #f3f4f5;
    --sg-outline-variant:     #e1e3e4;
    --sg-on-surface-variant:  #5f6368;

    --sidebar-w:      260px;
}

/* ── Base ─────────────────────────────────────────────────── */
* { -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--sg-gray);
    color: #2d2a24;
    font-size: 15px;
}

/* ── Typography Scale ─────────────────────────────────────── */
/* A single consistent hierarchy for every page — this project grew organically across many
   pages with ad-hoc heading sizes; these overrides make h1–h6 mean the same thing everywhere. */
h1 { font-size: 2rem;    font-weight: 800; }
h2 { font-size: 1.75rem; font-weight: 700; }
h3 { font-size: 1.5rem;  font-weight: 700; }
h4 { font-size: 1.25rem; font-weight: 700; }
h5 { font-size: 1.1rem;  font-weight: 700; }
h6 { font-size: 1rem;    font-weight: 700; }
small, .small { font-size: .8125rem; }

a { color: var(--sg-gold-darker); }
a:hover { color: var(--sg-gold-dark); }

::selection { background: var(--sg-gold-light); color: var(--sg-gold-ink); }

/* ── App Shell ────────────────────────────────────────────── */
/* body.app-shell (set in includes/header.php) makes the navbar and footer static and
   confines scrolling to .main-content alone: navbar/footer are flex items sized to their
   own content, .wrapper fills whatever's left between them, and only .main-content
   scrolls inside that leftover space. */
body.app-shell {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
body.app-shell > .navbar { flex: 0 0 auto; }
body.app-shell > .app-footer { flex: 0 0 auto; }
body.app-shell > .emergency-alarm-banner { flex: 0 0 auto; }

/* ── Emergency Alarm Banner ───────────────────────────────── */
.emergency-alarm-banner {
    background: var(--sg-red);
    color: #fff;
    animation: alarmFlash 1s infinite;
}
.emergency-alarm-banner .btn-outline-light:hover { color: var(--sg-red); }
@keyframes alarmFlash {
    0%, 100% { background: var(--sg-red); }
    50%      { background: #8f0000; }
}

/* ── Navbar (light top app bar over the navy sidebar) ────── */
.bg-safegate {
    background: var(--sg-surface-lowest) !important;
    border-bottom: 1px solid var(--sg-outline-variant);
    box-shadow: 0 1px 3px rgba(0,22,79,.04);
}
.navbar-brand { color: var(--sg-dark) !important; }
.navbar-brand i { color: var(--sg-gold-darker); }
@media (max-width: 576px) {
    /* Keeps the toggle button, brand, and bell/profile icons on one fixed-height row
       instead of wrapping — a wrap here used to push the whole page down on mobile. */
    .navbar-brand {
        max-width: 42vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
.badge-notify {
    position: absolute;
    top: 4px; right: 4px;
    font-size: 9px;
    padding: 2px 5px;
    background: var(--sg-gold) !important;
    color: var(--sg-dark) !important;
}

/* ── Wrapper & Layout ─────────────────────────────────────── */
.wrapper {
    flex: 1 1 auto;
    min-height: 0; /* let flexbox shrink this instead of growing past the viewport */
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
/* A flex row (.wrapper) stretches its children to fill its height by default, so the
   sidebar naturally matches whatever space .wrapper has — no fixed height math needed.
   overflow-y keeps the nav list scrollable on its own if it's ever too long to fit. */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    overflow-y: auto;
    background: var(--sg-dark) !important;
    display: flex;
    flex-direction: column;
    transition: width .25s ease;
}

.sidebar-header { background: rgba(255,255,255,.04); }
.sidebar-role-label { color: var(--sg-gold) !important; letter-spacing: .06em; }
.sidebar-estate-name { color: #ffffff !important; }

/* Rounded pill nav items — active tab is a solid gold pill, hover is a soft overlay */
.sidebar-link {
    color: rgba(255,255,255,.75) !important;
    padding: .65rem 1rem;
    margin: .1rem .6rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: .65rem;
    transition: background .15s, color .15s, transform .15s;
}
.sidebar-link:hover {
    background: rgba(255,255,255,.08) !important;
    color: #fff !important;
}
.sidebar-link.active {
    background: var(--sg-gold) !important;
    color: var(--sg-dark) !important;
    font-weight: 700;
}
.sidebar-icon { width: 18px; text-align: center; }

.main-content {
    padding: 1.5rem;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1 1 auto;
    min-width: 0; /* let flexbox shrink this instead of overflowing the row */
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
    border: 1px solid var(--sg-outline-variant);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,22,79,.05);
    transition: box-shadow .2s;
}
.card:hover {
    box-shadow: 0 8px 24px rgba(0,22,79,.10);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--sg-outline-variant);
    font-weight: 600;
    border-radius: 16px 16px 0 0 !important;
}

/* ── Stat Cards ───────────────────────────────────────────── */
.stat-card {
    border-radius: 16px;
    padding: 1.25rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 14px rgba(0,22,79,.12);
    transition: transform .15s, box-shadow .15s;
    cursor: default;
}
.stat-card:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0,22,79,.2);
}
.stat-card .stat-icon {
    font-size: 2rem;
    opacity: .85;
    flex-shrink: 0; /* icon keeps its size — the number/label column is what shrinks to fit */
}
/* The wrapper around .stat-num/.stat-label — constrained so a growing number has somewhere
   to actually overflow, which assets/js/main.js measures and auto-shrinks to fit. */
.stat-card > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}
.stat-card .stat-num {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.stat-card .stat-label {
    font-size: .72rem;
    opacity: .85;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Brand-primary stat card uses gold — needs dark text/icon for contrast */
.stat-green  { background: var(--sg-gold); color: var(--sg-dark); }
.stat-green .stat-label { opacity: .75; }
.stat-blue   { background: #2563eb; }
.stat-orange { background: #ea6c00; }
.stat-red    { background: var(--sg-red); }
.stat-purple { background: #7c3aed; }
.stat-teal   { background: #0d9488; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-safegate {
    background: var(--sg-gold);
    color: var(--sg-dark);
    border: none;
    font-weight: 700;
    border-radius: 10px;
    transition: background .15s, box-shadow .15s, transform .1s;
}
.btn-safegate:hover {
    background: var(--sg-gold-dark);
    color: var(--sg-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(237,171,24,.35);
}
.btn-safegate:active { transform: translateY(0); }
.btn-safegate:focus { box-shadow: 0 0 0 .2rem rgba(237,171,24,.35); }

.btn-emergency {
    background: var(--sg-red);
    color: #fff;
    font-size: 1.1rem;
    padding: .75rem 2rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
}
.btn-emergency:hover { background: #b91c1c; color: #fff; }

/* Accessible focus ring on all interactive elements */
.btn:focus, .form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 .2rem rgba(237,171,24,.25);
    border-color: var(--sg-gold);
}

/* ── Badges / Statuses ────────────────────────────────────── */
/* Pill shape + tight tracking app-wide, on top of Bootstrap's own bg-* modifiers */
.badge { border-radius: 999px !important; letter-spacing: .03em; font-weight: 600; }

/* Gold doubles as the "needs attention" semantic (pending / expiring) */
.badge-pending   { background: var(--sg-gold); color: var(--sg-dark); }
.badge-checked   { background: #0d6efd; color: #fff; }
.badge-approved  { background: var(--sg-green); color: #fff; }
.badge-used      { background: #6b7280; color: #fff; }
.badge-cancelled { background: var(--sg-red); color: #fff; }
.badge-expired   { background: #4b5563; color: #fff; }
.badge-active    { background: #2563eb; color: #fff; }
.badge-responding{ background: #d97706; color: #fff; }
.badge-resolved  { background: #16a34a; color: #fff; }

/* ── Tables ───────────────────────────────────────────────── */
.table th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: var(--sg-surface-low);
    color: var(--sg-on-surface-variant);
    border-bottom: 2px solid var(--sg-outline-variant);
    padding: .85rem 1rem;
}
.table td { vertical-align: middle; font-size: .9rem; padding: .85rem 1rem; }

/* ── Page Title ───────────────────────────────────────────── */
.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--sg-dark);
    margin-bottom: 1.25rem;
    padding-bottom: .5rem;
    border-bottom: 3px solid var(--sg-gold);
    display: inline-block;
}

/* ── Login Page ───────────────────────────────────────────── */
.login-body {
    background: linear-gradient(135deg, var(--sg-gold) 0%, var(--sg-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.login-card {
    max-width: 420px;
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo {
    width: 64px; height: 64px;
    background: var(--sg-gold);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.8rem; color: var(--sg-dark);
}

/* ── Emergency alert ──────────────────────────────────────── */
.alert-emergency {
    border-left: 5px solid var(--sg-red);
    background: #fff5f5;
    animation: alertPulse 2s infinite;
}
@keyframes alertPulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(214,40,40,.3); }
    50%      { box-shadow: 0 0 0 8px rgba(214,40,40,0); }
}

/* ── Pass code display ────────────────────────────────────── */
.pass-code {
    font-family: 'Courier New', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: .15em;
    background: var(--sg-gold-light);
    color: var(--sg-gold-ink);
    padding: .5rem 1rem;
    border-radius: 8px;
    border: 2px dashed var(--sg-gold-dark);
    display: inline-block;
}

/* ── Estate ID Card (residence / dependant badge) ─────────────────────── */
/* Wave-header badge template — brand gold/navy in place of the reference's orange,
   fixed 240px width (not aspect-ratio) so html2canvas captures consistently; height is
   auto since the residence card and the shorter dependant card carry different row counts. */
.id-card {
    width: 240px;
    margin: 0 auto;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,.16);
    border: 1px solid #e4e4e4;
    text-align: center;
}
.id-card-header {
    position: relative;
    height: 90px;
    background: linear-gradient(135deg, var(--sg-gold) 0%, var(--sg-gold-dark) 100%);
}
/* The oversized white ellipse overlapping the bottom edge is what cuts the "wave" silhouette
   into the gradient — classic CSS wave trick, no SVG/clip-path needed (keeps html2canvas happy). */
.id-card-header::after {
    content: '';
    position: absolute;
    left: -15%;
    right: -15%;
    bottom: -38px;
    height: 70px;
    background: #fff;
    border-radius: 50%;
}
.id-card-estate-name {
    position: absolute;
    top: .4rem;
    left: 0;
    right: 0;
    font-weight: 700;
    font-size: .68rem;
    letter-spacing: .04em;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 .6rem;
}
.id-card-photo-wrap {
    position: relative;
    z-index: 2;
    width: 72px;
    height: 72px;
    margin: -46px auto 0;
    border-radius: 50%;
    background: #fff;
    padding: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.id-card-photo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: var(--sg-gold-light);
    color: var(--sg-gold-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.6rem;
}
.id-card-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.id-card-name {
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--sg-dark);
    line-height: 1.25;
    margin-top: .5rem;
    padding: 0 .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.id-card-title {
    font-size: .68rem;
    font-weight: 600;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--sg-gold-darker);
    margin-top: .1rem;
}
.id-card-details {
    padding: .65rem 1.1rem 0;
    text-align: left;
}
.id-card-detail-row {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    font-size: .7rem;
    padding: .2rem 0;
    border-bottom: 1px dotted #e6e6e6;
}
.id-card-detail-row:last-child { border-bottom: none; }
.id-card-label { font-weight: 700; color: var(--sg-dark); flex-shrink: 0; }
.id-card-value {
    color: #666;
    text-align: right;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.id-card-barcode-box {
    margin: .7rem .9rem .9rem;
    padding: .5rem;
    border: 1px solid var(--sg-gold-light);
    border-radius: 8px;
    background: #fffdf6;
}
.id-card-barcode-box svg { max-width: 100%; height: 34px; }
.id-card-code {
    font-family: 'Courier New', monospace;
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--sg-dark);
    margin-top: .2rem;
}

/* ── Subscription bar ─────────────────────────────────────── */
/* Green = healthy · Gold = expiring soon (brand doubles as caution) · Red = expired */
.sub-bar {
    height: 8px; border-radius: 4px;
    background: #e5e7eb;
    overflow: hidden;
}
.sub-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--sg-green);
    transition: width .4s;
}
.sub-bar-fill.expiring { background: var(--sg-gold); }
.sub-bar-fill.expired  { background: var(--sg-red); }

/* ── Site Footer (dark navy — bookends the dark sidebar around the light content) ── */
.app-footer {
    background: var(--sg-dark);
    color: rgba(255,255,255,.7);
    font-size: .8rem;
    padding: .7rem 1.5rem;
}
.app-footer a {
    color: rgba(255,255,255,.9);
    text-decoration: none;
}
.app-footer a:hover { color: var(--sg-gold); }
.app-footer .footer-powered a { color: var(--sg-gold); font-weight: 600; }

/* ── Login Page: floating card over a full-bleed grey stage ── */
/* body.login-page stacks the login area above the footer and pins the footer to the
   bottom of the viewport, and .login-stage never scrolls (overflow: hidden) — sizing
   below is deliberately tight so real content always fits without needing to. */
body.login-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
body.login-page { font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

.login-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    /* A faint dot grid plus a soft diagonal tonal shift, layered under the grey base —
       gives the flat grey some quiet texture without competing with the login card. */
    background-color: #e7e9ec;
    background-image:
        radial-gradient(circle, rgba(0,22,79,.05) 1px, transparent 1px),
        linear-gradient(160deg, #eef0f3 0%, #e7e9ec 45%, #e0e3e7 100%);
    background-size: 24px 24px, 100% 100%;
    background-position: 0 0, 0 0;
    color: var(--sg-dark);
    display: flex;
    flex-direction: column;
    padding: 1.25rem clamp(1.25rem, 5vw, 4rem);
}
/* Soft blurred color fields, not hard shapes — matches the reference's "tonal layering" background */
.login-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(110px);
    opacity: .1;
    pointer-events: none;
}
.login-blob.b1 { width: 520px; height: 520px; top: -160px; right: -140px; background: var(--sg-gold); }
.login-blob.b2 { width: 460px; height: 460px; bottom: -180px; left: -140px; background: var(--sg-gold-dark); opacity: .07; }
.login-blob.b3 { width: 420px; height: 420px; top: 40%; left: 45%; background: var(--sg-dark); opacity: .05; }

/* Logo, heading+copy, and the card are one visual group — centered together as a unit
   instead of the logo sitting pinned to the top edge with a big gap before the rest. */
.login-focus-group {
    position: relative;
    z-index: 1;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
    max-width: 1080px;
    width: 100%;
    margin: 0 auto;
}
.login-brand { display: flex; align-items: center; gap: .85rem; }
.login-brand-icon {
    width: 80px; height: 80px;
    border-radius: 16px;
    background: var(--sg-gold);
    color: var(--sg-dark);
    display: flex; align-items: center; justify-content: center;
    font-size: 2.1rem;
    flex-shrink: 0;
}
.login-brand-name { font-weight: 700; font-size: 1.5rem; color: var(--sg-dark); }
.login-brand-logo-img { height: 96px; width: auto; }

.login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3.5rem;
    flex-wrap: wrap;
}
.login-copy { max-width: 420px; }
.login-badge-pill {
    display: inline-flex;
    align-items: center;
    padding: .4rem 1rem;
    border-radius: 999px;
    background: rgba(237,171,24,.12);
    border: 1px solid rgba(237,171,24,.35);
    color: var(--sg-gold-darker);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}
.login-copy h1 {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.01em;
    margin-bottom: .75rem;
    color: var(--sg-dark);
}
.login-copy h1 .accent { color: var(--sg-gold-darker); }
.login-copy-lead { color: #55575e; font-size: .95rem; line-height: 1.55; }

/* ── Card: filled inputs, uppercase micro-labels ──────────── */
.login-card-float {
    background: #fff;
    color: var(--sg-dark);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,22,79,.1);
    border: 1px solid #dcdfe3;
    padding: 2rem;
    width: 100%;
    max-width: 440px;
    flex-shrink: 0;
}
.login-card-float h2 { font-size: 1.5rem; font-weight: 700; color: var(--sg-dark); margin-bottom: .25rem; }
.login-card-float .login-card-sub { color: #6b7280; font-size: .875rem; }

.login-field-label {
    display: block;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--sg-dark);
    margin-bottom: .45rem;
}
.login-input-wrap { position: relative; display: flex; align-items: center; }
.login-input-wrap i.login-input-icon {
    position: absolute;
    left: 1rem;
    color: #9497a3;
    font-size: .9rem;
    pointer-events: none;
}
.login-input {
    width: 100%;
    padding: .85rem 1rem .85rem 2.75rem;
    background: #f3f4f6;
    border: 1px solid #d8dae0;
    border-radius: .85rem;
    font-size: .9rem;
    color: var(--sg-dark);
    transition: box-shadow .15s, border-color .15s, background-color .15s;
}
.login-input:focus {
    outline: none;
    background: #fff;
    border-color: var(--sg-gold);
    box-shadow: 0 0 0 3px rgba(237,171,24,.25);
}
.login-input.has-toggle { padding-right: 2.75rem; }
.login-input-toggle {
    position: absolute;
    right: .85rem;
    background: none;
    border: none;
    color: #9497a3;
    padding: 0;
}
.login-input-toggle:hover { color: var(--sg-dark); }

/* Icon + label pill, e.g. "Install App" — auto-width so the description text has room
   to sit right beside the icon instead of the icon standing alone. */
.login-install-btn {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem 1rem;
    border-radius: 999px;
    background: #f3f4f6;
    color: var(--sg-dark);
    border: none;
    font-size: .82rem;
    font-weight: 600;
    transition: background-color .2s, color .2s;
}
.login-install-btn:hover { background: var(--sg-dark); color: #fff; }
.login-install-caption {
    font-size: .72rem;
    color: #7a7d85;
    margin-top: .4rem;
}

.login-stage-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    font-size: .75rem;
    color: #7a7d85;
    padding-top: .75rem;
    flex-shrink: 0;
}

@media (max-width: 991.98px) {
    .login-stage { padding: 1rem clamp(1rem, 4vw, 2rem); }
    .login-focus-group { gap: 1.25rem; }
    .login-main { flex-direction: column; align-items: stretch; text-align: center; gap: 1.25rem; padding: .5rem 0; }
    .login-copy { max-width: 100%; }
    .login-brand { justify-content: center; }
    .login-brand-icon { width: 56px; height: 56px; font-size: 1.5rem; border-radius: 12px; }
    .login-brand-name { font-size: 1.15rem; }
    .login-brand-logo-img { height: 60px; }
    .login-copy h1 { font-size: 1.6rem; }
    .login-copy-lead { font-size: .85rem; }
    .login-badge-pill { margin-left: auto; margin-right: auto; }
    .login-card-float { max-width: 100%; margin: 0 auto; padding: 1.5rem; }
}

/* Phones: this much content (logo, tagline, heading, copy, socials, and the whole form)
   can genuinely be taller than a small phone's viewport. Trim what's non-essential (the
   marketing lead paragraph and trust line) — assets/js/main.js then measures what's left
   against the real available height and shrinks font-size/spacing further, in real steps
   (not a cosmetic transform), until it actually fits. No scroll, ever, at this width. */
@media (max-width: 576px) {
    .login-stage { overflow: hidden; padding: .75rem 1rem; }
    .login-focus-group { gap: .75rem; margin: auto 0; }
    .login-main { gap: .85rem; padding: 0; }
    .login-brand { padding-bottom: .75rem; margin-bottom: 0 !important; }
    .login-brand-icon { width: 66px; height: 66px; font-size: 1.6rem; border-radius: 14px; }
    .login-brand-name { font-size: 1.2rem; }
    .login-brand-logo-img { height: 66px; }
    .login-badge-pill { font-size: .62rem; padding: .3rem .75rem; margin-bottom: .5rem; }
    .login-copy h1 { font-size: 1.3rem; margin-bottom: 0; }
    .login-copy-lead { display: none; }
    .login-install-row { margin-top: .5rem !important; }
    .login-install-btn { padding: .4rem .8rem; font-size: .75rem; }
    .login-install-caption { font-size: .65rem; margin-top: .3rem; }
    .login-card-float { padding: 1.1rem; border-radius: 16px; }
    .login-card-float h2 { font-size: 1.2rem; }
    .login-card-float .mb-4 { margin-bottom: .85rem !important; }
    .login-input { padding: .65rem 1rem .65rem 2.5rem; font-size: .85rem; }
    .login-input-wrap { margin-top: 0 !important; }
    .login-card-float .mb-3 { margin-bottom: .65rem !important; }
    .login-stage-footer { display: none; }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 1050;
        top: 56px; left: -100%;
        height: calc(100vh - 56px);
        transition: left .3s ease;
    }
    .sidebar.show { left: 0; }
    .sidebar-overlay {
        display: none;
        position: fixed; inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 1040;
    }
    .sidebar-overlay.show { display: block; }
    .main-content { padding: 1rem; }

    /* Larger touch targets on small screens */
    .sidebar-link { padding: .85rem 1.25rem; }
    .btn { min-height: 44px; }
    .btn-emergency { width: 100%; }

    /* Tighter type scale so dashboard content doesn't feel oversized on a phone */
    body { font-size: 14px; }
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.45rem; }
    h3 { font-size: 1.3rem; }
    h4 { font-size: 1.15rem; }
    h5 { font-size: 1.05rem; }
    .page-title { font-size: 1.2rem; }
    .stat-card .stat-num { font-size: 1.5rem; }
    .stat-card .stat-icon { font-size: 1.6rem; }
    .table th, .table td { padding: .6rem .75rem; font-size: .85rem; }
}
