/* ============================================================================
   HYGROMETER PORTAL — app.css (Bootstrap edition)
   Bootstrap handles: grid, flexbox utilities, buttons, forms, badges, spacing
   This file handles: brand variables, sidebar, auth page, and bespoke
   components that Bootstrap doesn't cover.
   Load ORDER: Bootstrap first, then this file.
   ============================================================================ */

/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
    /* Brand */
    --brand:            #043D10;
    --brand-dark:       #032d0c;
    --brand-mid:        #0a5c18;
    --brand-light:      #e8f0e9;
    --brand-xlight:     #f4f8f4;

    /* Stone */
    --stone:            #D4C9AB;
    --stone-dark:       #b8ac8e;
    --stone-light:      #ede8da;

    /* Surfaces */
    --bg:               #f5f3ee;
    --surface:          #ffffff;
    --border:           #e5e0d4;
    --border2:          #ccc7b8;

    /* Text */
    --text:             #1a1f1a;
    --text2:            #3d4a3e;
    --text3:            #6b7b6c;
    --text4:            #8fa090;

    /* Semantic */
    --critical:         #c8281e;
    --critical-bg:      rgba(200, 40, 30, 0.07);
    --critical-border:  rgba(200, 40, 30, 0.25);
    --warning:          #c47a00;
    --warning-bg:       rgba(196, 122, 0, 0.08);
    --warning-border:   rgba(196, 122, 0, 0.28);
    --normal:           #1a7a3a;
    --normal-bg:        rgba(26, 122, 58, 0.08);
    --normal-border:    rgba(26, 122, 58, 0.25);
    --tamper:           #7c3fa8;
    --tamper-bg:        rgba(124, 63, 168, 0.07);
    --tamper-border:    rgba(124, 63, 168, 0.25);
    --info:             #1565a8;
    --info-bg:          rgba(21, 101, 168, 0.07);
    --info-border:      rgba(21, 101, 168, 0.25);

    /* Layout */
    --sidebar-width:    252px;
    --topbar-height:    60px;

    /* Typography */
    --font-ui:          'DM Sans', system-ui, sans-serif;
    --font-mono:        'DM Mono', 'Courier New', monospace;

    /* Override Bootstrap's default font */
    --bs-body-font-family: var(--font-ui);
    --bs-body-color:       var(--text);
    --bs-body-bg:          var(--bg);

    /* Override Bootstrap's primary colour */
    --bs-primary:          var(--brand);
    --bs-primary-rgb:      4, 61, 16;
    --bs-link-color:       var(--brand);
    --bs-link-hover-color: var(--brand-mid);
}

/* ── Base ───────────────────────────────────────────────────────────────── */
body { font-family: var(--font-ui); background: var(--bg); color: var(--text); }
a    { color: var(--brand); }
a:hover { color: var(--brand-mid); }

/* ── Bootstrap form overrides ───────────────────────────────────────────── */
.form-control,
.form-select {
    background-color: var(--bg);
    border-color: var(--border);
    color: var(--text);
    font-family: var(--font-ui);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg);
    border-color: var(--brand);
    box-shadow: 0 0 0 0.2rem rgba(4, 61, 16, 0.15);
    color: var(--text);
}

.form-control::placeholder { color: var(--text4); }
.form-label { font-size: 12px; font-weight: 600; color: var(--text2); letter-spacing: 0.02em; }

/* Bootstrap's invalid state — keep visible */
.form-control.is-invalid { border-color: var(--critical); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 0.2rem var(--critical-bg); }
.invalid-feedback { color: var(--critical); font-size: 12px; }

/* Bootstrap btn-primary → brand green */
.btn-primary {
    background-color: var(--brand);
    border-color: var(--brand);
    font-weight: 600;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.btn-primary:not(:disabled):not(.disabled):active {
    background-color: var(--brand-mid);
    border-color: var(--brand-mid);
}
.btn-primary:focus {
    box-shadow: 0 0 0 0.2rem rgba(4, 61, 16, 0.35);
}

/* btn-outline-primary */
.btn-outline-primary {
    color: var(--brand);
    border-color: rgba(4, 61, 16, 0.3);
}
.btn-outline-primary:hover {
    background-color: var(--brand-xlight);
    border-color: var(--brand);
    color: var(--brand);
}

/* Bootstrap form-check */
.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}
.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(4, 61, 16, 0.2);
}

/* ── Bootstrap card override ────────────────────────────────────────────── */
.card {
    background-color: #ffffff;
    border-color: var(--border);
    box-shadow: 0 1px 3px rgba(4, 61, 16, 0.05);
}

.card-title { font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.1em; }

/* ── Bootstrap alert overrides ──────────────────────────────────────────── */
.alert { border-radius: 8px; font-size: 13px; }

/* ============================================================================
   PORTAL SHELL
   ============================================================================ */

.portal-body { background: var(--bg); font-family: var(--font-ui); }

.portal-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.portal-sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--brand);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    overflow: hidden;
}

.portal-sb-header {
    padding: 22px 18px 18px;
    border-bottom: 1px solid rgba(212, 201, 171, 0.18);
    flex-shrink: 0;
}

.portal-sb-logo-wrap { min-height: 44px; display: flex; align-items: center; }

.portal-client-logo {
    display: block;
    width: 180px; height: auto; max-height: 52px;
    object-fit: contain; object-position: left center;
    filter: brightness(0) invert(1);
}

.portal-client-logo-fallback {
    width: 36px; height: 36px; border-radius: 9px;
    background: rgba(255,255,255,0.15);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 800; color: #fff;
}

.portal-client-logo-text { font-size: 14px; font-weight: 700; color: #fff; }

.portal-user-widget { display: flex; flex-direction: column; gap: 8px; }

.portal-user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--stone); color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800; letter-spacing: -0.5px;
    border: 2px solid rgba(212, 201, 171, 0.3);
}

.portal-user-name { font-size: 13px; font-weight: 700; color: #fff; line-height: 1.3; }
.portal-user-role { font-size: 10px; color: rgba(212, 201, 171, 0.65); }

.portal-logout-btn {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 7px 10px; border-radius: 8px;
    border: 1px solid rgba(212, 201, 171, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(212, 201, 171, 0.65);
    font-size: 11px; font-weight: 600; font-family: var(--font-ui);
    transition: all 0.15s;
}

.portal-logout-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-color: rgba(212,201,171,0.4);
}

.portal-sb-nav { padding: 16px 10px; flex: 1; overflow-y: auto; }
.portal-sb-nav::-webkit-scrollbar { width: 3px; }
.portal-sb-nav::-webkit-scrollbar-thumb { background: rgba(212,201,171,0.2); border-radius: 3px; }

.portal-nav-group-label {
    font-size: 9px; font-weight: 700;
    color: rgba(212, 201, 171, 0.4);
    letter-spacing: 0.14em; text-transform: uppercase;
    padding: 4px 12px 10px;
}

.portal-nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    color: rgba(212, 201, 171, 0.72);
    font-size: 13px; font-weight: 500;
    margin-bottom: 2px; border: 1px solid transparent;
    transition: all 0.15s; text-decoration: none;
}

.portal-nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    text-decoration: none;
}

.portal-nav-item.active {
    background: rgba(255,255,255,0.14);
    color: #fff;
    border-color: rgba(212,201,171,0.28);
    font-weight: 600;
}

.portal-nav-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }

.portal-nav-badge {
    margin-left: auto;
    background: var(--critical);
    color: #fff;
    font-size: 9px; font-weight: 700;
    padding: 2px 6px; border-radius: 20px;
    min-width: 18px; text-align: center;
}

.portal-sb-footer {
    padding: 16px 18px 20px;
    border-top: 1px solid rgba(212,201,171,0.15);
    flex-shrink: 0;
}

.portal-sb-status {
    display: flex; align-items: center; gap: 7px;
    font-size: 11px; color: rgba(212,201,171,0.5);
}

.portal-pulse-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--stone); flex-shrink: 0;
    animation: portal-pulse 2.4s ease-in-out infinite;
}

@keyframes portal-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.35; transform: scale(0.85); }
}

.portal-dev-logo {
    display: block;
    max-width: 140px;
    width: auto;
    object-fit: contain;
    object-position: left center;
    opacity: 0.5;
}

.portal-dev-logo-fallback {
    font-size: 9px; font-weight: 700;
    color: rgba(212,201,171,0.38);
    text-transform: uppercase; letter-spacing: 0.1em;
}

/* ── Main area ───────────────────────────────────────────────────────────── */
.portal-main { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }

.portal-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: var(--topbar-height);
    padding: 0 28px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 1px 4px rgba(4,61,16,0.06);
    flex-shrink: 0;
}

.portal-breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text3); flex-wrap: wrap;
}

.portal-breadcrumb a { color: var(--text3); transition: color 0.15s; text-decoration: none; }
.portal-breadcrumb a:hover { color: var(--brand); }
.portal-crumb-current { color: var(--text); font-weight: 600; }
.portal-crumb-sep { color: var(--border2); }

.portal-scope-chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--brand-xlight);
    border: 1px solid rgba(4,61,16,0.18);
    color: var(--brand);
    padding: 5px 12px; border-radius: 20px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
}

.portal-alert-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--critical-bg);
    border: 1px solid var(--critical-border);
    color: var(--critical);
    padding: 5px 12px; border-radius: 20px;
    font-size: 11px; font-weight: 700;
    text-decoration: none; white-space: nowrap; transition: background 0.15s;
}

.portal-alert-badge:hover { background: rgba(200,40,30,0.13); color: var(--critical); text-decoration: none; }

.portal-flash { font-size: 13px; font-weight: 500; }
.portal-flash--success { background: var(--normal-bg); color: var(--normal); }
.portal-flash--error   { background: var(--critical-bg); color: var(--critical); }

.portal-content { padding: 28px 32px; flex: 1; }

/* ── Headings & labels ──────────────────────────────────────────────────── */
.portal-page-title  { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 4px; letter-spacing: -0.3px; }
.portal-page-sub    { font-size: 13px; color: var(--text3); margin-bottom: 24px; }
.portal-section-label { font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 10px; }
.portal-card-action { font-size: 12px; color: var(--brand); font-weight: 600; text-decoration: none; }
.portal-card-action:hover { color: var(--brand-mid); }

/* ── Status pills (Bootstrap badge base + brand overrides) ──────────────── */
.portal-pill {
    display: inline-flex; align-items: center;
    padding: 3px 9px; border-radius: 20px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
}

.portal-pill--critical { background: var(--critical-bg); color: var(--critical); border: 1px solid var(--critical-border); }
.portal-pill--warning  { background: var(--warning-bg);  color: var(--warning);  border: 1px solid var(--warning-border); }
.portal-pill--normal   { background: var(--normal-bg);   color: var(--normal);   border: 1px solid var(--normal-border); }
.portal-pill--tamper   { background: var(--tamper-bg);   color: var(--tamper);   border: 1px solid var(--tamper-border); }
.portal-pill--offline  { background: rgba(148,163,184,0.1); color: var(--text3); border: 1px solid rgba(148,163,184,0.25); }

/* ── Stat cards ─────────────────────────────────────────────────────────── */
.portal-stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 18px;
    box-shadow: 0 1px 3px rgba(4,61,16,0.04);
    transition: border-color 0.2s, box-shadow 0.2s; height: 100%;
}
.portal-stat-card:hover { border-color: var(--stone-dark); box-shadow: 0 2px 8px rgba(4,61,16,0.08); }
.portal-stat-label { font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
.portal-stat-value { font-size: 32px; font-weight: 700; font-family: var(--font-mono); color: var(--text); line-height: 1; margin-bottom: 4px; }
.portal-stat-sub   { font-size: 11px; color: var(--text3); }

/* Value colour modifiers */
.portal-val--critical { color: var(--critical); }
.portal-val--warning  { color: var(--warning); }
.portal-val--normal   { color: var(--normal); }
.portal-val--muted    { color: var(--text3); }
.portal-val--mono     { font-family: var(--font-mono); }

/* ── Item cards (areas / portfolios) ────────────────────────────────────── */
.portal-item-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 22px; display: block;
    color: var(--text); text-decoration: none;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(4,61,16,0.04); height: 100%;
}
.portal-item-card:hover {
    border-color: var(--brand); transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(4,61,16,0.12);
    color: var(--text); text-decoration: none;
}
.portal-item-tag   { font-size: 9px; font-weight: 700; color: var(--text4); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 5px; }
.portal-item-name  { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.3; }
.portal-item-link  { font-size: 11px; color: var(--brand); font-weight: 600; }
.portal-item-meta-val   { font-size: 22px; font-weight: 700; font-family: var(--font-mono); color: var(--text); line-height: 1; }
.portal-item-meta-label { font-size: 10px; color: var(--text3); margin-top: 3px; }
.portal-manager-avatar {
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--brand); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 8px; font-weight: 800; flex-shrink: 0;
}

/* ── Property list rows ─────────────────────────────────────────────────── */
.portal-prop-row {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 14px 20px;
    display: flex; align-items: center; gap: 14px;
    transition: border-color 0.15s, background 0.15s;
    box-shadow: 0 1px 2px rgba(4,61,16,0.04);
    color: var(--text); text-decoration: none;
}
.portal-prop-row:hover { border-color: var(--brand); background: var(--brand-xlight); color: var(--text); text-decoration: none; }
.portal-prop-addr  { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3; }
.portal-prop-sub   { font-size: 11px; color: var(--text3); margin-top: 2px; }
.portal-prop-meta-val   { font-size: 14px; font-weight: 600; font-family: var(--font-mono); line-height: 1; }
.portal-prop-meta-label { font-size: 10px; color: var(--text4); margin-top: 2px; text-align: right; }
.portal-chevron { color: var(--text4); font-size: 18px; }

/* ── Property detail ────────────────────────────────────────────────────── */
.portal-prop-detail-addr { font-size: 19px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.portal-prop-detail-meta { font-size: 12px; color: var(--text3); }
.portal-summary-val   { font-size: 28px; font-weight: 700; font-family: var(--font-mono); line-height: 1; color: var(--text); }
.portal-summary-label { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* ── Room cards ─────────────────────────────────────────────────────────── */
.portal-room-card { border-radius: 10px; padding: 18px; transition: transform 0.15s; }
.portal-room-card:hover { transform: translateY(-2px); }
.portal-room-card--normal   { background: var(--normal-bg);   border: 1px solid var(--normal-border); }
.portal-room-card--warning  { background: var(--warning-bg);  border: 1px solid var(--warning-border); }
.portal-room-card--critical { background: var(--critical-bg); border: 1px solid var(--critical-border); }
.portal-room-name { font-size: 15px; font-weight: 700; color: var(--text); }
.portal-room-uid  { font-size: 10px; font-family: var(--font-mono); color: var(--text4); margin-top: 3px; }
.portal-reading-val   { font-size: 28px; font-weight: 700; font-family: var(--font-mono); line-height: 1; }
.portal-reading-label { font-size: 10px; color: var(--text3); margin-top: 3px; }
.portal-device-dot   { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.portal-device-dot--online  { background: var(--normal); }
.portal-device-dot--offline { background: var(--critical); }
.portal-device-text--online  { color: var(--normal); font-weight: 600; font-size: 11px; }
.portal-device-text--offline { color: var(--critical); font-weight: 600; font-size: 11px; }
.portal-battery-label { font-size: 10px; color: var(--text3); }
.portal-battery-bar  { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.portal-battery-fill { height: 100%; border-radius: 2px; }
.portal-install-label { font-size: 9px; font-weight: 700; color: var(--text4); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 4px; }
.portal-install-val   { font-size: 10px; color: var(--text3); }
.portal-install-date  { font-size: 10px; color: var(--text4); margin-top: 2px; }
.portal-install-post  { font-size: 10px; color: var(--info); margin-top: 3px; }
.portal-room-action-toggle {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 11px; font-weight: 600; color: var(--brand);
    background: none; border: none; border-top: 1px solid rgba(0,0,0,0.08);
    padding: 10px 0 0; margin-top: 12px; width: 100%; text-align: left;
    font-family: var(--font-ui); cursor: pointer;
}
.portal-room-action-toggle:hover { color: var(--brand-mid); }

/* ── Alert rows ─────────────────────────────────────────────────────────── */
.portal-filter-btn {
    padding: 5px 14px; border-radius: 20px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text3); font-size: 12px; font-weight: 600;
    font-family: var(--font-ui); cursor: pointer; transition: all 0.15s;
}
.portal-filter-btn:hover { border-color: var(--stone-dark); color: var(--text2); }
.portal-filter-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.portal-alert-addr   { font-size: 13px; font-weight: 600; color: var(--text); }
.portal-alert-addr a { color: var(--text); }
.portal-alert-addr a:hover { color: var(--brand); }
.portal-alert-room   { font-size: 11px; color: var(--text3); }
.portal-alert-issue  { font-size: 12px; color: var(--text2); margin-top: 3px; }
.portal-alert-uid    { font-size: 10px; color: var(--text4); font-family: var(--font-mono); margin-top: 2px; }
.portal-alert-time   { font-size: 10px; color: var(--text4); font-family: var(--font-mono); }

/* ── Dashboard cards ────────────────────────────────────────────────────── */
.portal-worst-card {
    background: linear-gradient(135deg, rgba(200,40,30,0.06), rgba(200,40,30,0.03));
    border: 1px solid rgba(200,40,30,0.2); border-radius: 12px; padding: 22px;
}
.portal-risk-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.portal-risk-row:last-child { border-bottom: none; }
.portal-risk-row:hover .portal-risk-addr { color: var(--brand); }
.portal-risk-addr { flex: 1; font-size: 12px; font-weight: 500; color: var(--text2); line-height: 1.3; }
.portal-risk-hum  { font-family: var(--font-mono); font-size: 13px; font-weight: 700; }
.portal-activity-dot  { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.portal-activity-text { font-size: 12px; color: var(--text2); line-height: 1.4; }
.portal-activity-time { font-size: 10px; color: var(--text4); font-family: var(--font-mono); margin-top: 2px; }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.portal-back { display: inline-flex; align-items: center; gap: 7px; color: var(--text3); font-size: 12px; font-weight: 600; margin-bottom: 18px; padding: 5px 0; transition: color 0.15s; text-decoration: none; }
.portal-back:hover { color: var(--brand); }
.portal-no-items   { text-align: center; padding: 44px 20px; color: var(--text4); font-size: 13px; }
.portal-legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text3); }
.portal-legend-swatch { width: 10px; height: 10px; border-radius: 3px; }
.portal-preview-stat { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.portal-preview-stat:last-child { border-bottom: none; }
.portal-preview-stat-label { color: var(--text3); }
.portal-preview-stat-val   { font-weight: 700; color: var(--text); font-family: var(--font-mono); }
.portal-report-title { font-size: 13px; font-weight: 600; color: var(--text); }
.portal-report-date  { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ── Action plan ────────────────────────────────────────────────────────── */
.portal-ap-label { font-size: 11px; font-weight: 600; color: var(--text3); letter-spacing: 0.03em; }
.portal-ap-history-dot  { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-top: 5px; flex-shrink: 0; }
.portal-ap-history-text { font-size: 12px; color: var(--text2); flex: 1; }
.portal-ap-history-date { font-size: 10px; color: var(--text4); font-family: var(--font-mono); }

/* ============================================================================
   AUTH LAYOUT
   ============================================================================ */

.auth-body { min-height: 100vh; background: var(--brand); font-family: var(--font-ui); position: relative; overflow: hidden; }

.auth-bg { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.auth-bg__gradient {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 110% 70% at 50% 110%, rgba(212,201,171,0.16) 0%, transparent 65%),
        radial-gradient(ellipse 60% 50% at 15% 20%, rgba(255,255,255,0.04) 0%, transparent 55%);
}
.auth-bg__grid {
    position: absolute; inset: 0;
    background-image: linear-gradient(rgba(212,201,171,0.1) 1px, transparent 1px), linear-gradient(90deg, rgba(212,201,171,0.1) 1px, transparent 1px);
    background-size: 52px 52px;
}
.auth-bg__glow { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.25; }
.auth-bg__glow--top    { width: 600px; height: 600px; background: rgba(10,92,24,0.6); top: -200px; left: 50%; transform: translateX(-50%); }
.auth-bg__glow--bottom { width: 400px; height: 300px; background: rgba(212,201,171,0.3); bottom: -100px; right: 10%; }

.auth-wrap { position: relative; z-index: 1; max-width: 440px; margin: 0 auto; }

.auth-card {
    background: #fff; border: 1px solid var(--stone-light);
    border-radius: 20px; padding: 44px 40px;
    box-shadow: 0 40px 100px rgba(4,61,16,0.35), 0 0 0 1px rgba(212,201,171,0.25);
}

.auth-client-img { height: 44px; width: auto; max-width: 200px; object-fit: contain; object-position: left center; display: block; }
.auth-client-monogram { width: 44px; height: 44px; border-radius: 12px; background: var(--brand); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; font-weight: 800; }
.auth-logos-divider { width: 1px; height: 40px; background: var(--border); flex-shrink: 0; }
.auth-powered-by { font-size: 9px; font-weight: 600; color: var(--text4); text-transform: uppercase; letter-spacing: 0.1em; }
.auth-dev-img  { height: 44px; width: auto; max-width: 200px; object-fit: contain; object-position: right; opacity: 0.75; display: block; }
.auth-dev-name { font-size: 11px; font-weight: 700; color: var(--brand-mid); }

.auth-title    { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 5px; letter-spacing: -0.3px; }
.auth-subtitle { font-size: 13px; color: var(--text3); }

.auth-input {
    background-color: var(--bg) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    font-size: 14px; border-radius: 9px;
}
.auth-input:focus {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 0.2rem rgba(4,61,16,0.12) !important;
}
.auth-input::placeholder { color: var(--text4); }
.auth-input.is-invalid { border-color: var(--critical) !important; }

.auth-label { font-size: 12px; font-weight: 600; color: var(--text2); letter-spacing: 0.02em; }
.auth-forgot { font-size: 12px; color: var(--brand); font-weight: 600; text-decoration: none; }
.auth-forgot:hover { color: var(--brand-mid); }

/* Bootstrap form-check inside auth */
.auth-check .form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

.auth-error-box  { background: var(--critical-bg); border: 1px solid var(--critical-border); color: var(--critical); padding: 11px 14px; border-radius: 9px; font-size: 13px; }
.auth-status-box { background: var(--normal-bg); border: 1px solid var(--normal-border); color: var(--normal); padding: 11px 14px; border-radius: 9px; font-size: 13px; }

.auth-submit-btn {
    background: var(--brand); border-color: var(--brand);
    color: #fff; font-size: 15px; font-weight: 700;
    border-radius: 10px; padding: 12px 20px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: 0 4px 16px rgba(4,61,16,0.3); transition: all 0.15s;
}
.auth-submit-btn:hover { background: var(--brand-mid); border-color: var(--brand-mid); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(4,61,16,0.35); }
.auth-submit-btn:active { transform: translateY(0); }

.auth-footer { font-size: 11px; color: rgba(212,201,171,0.45); text-align: center; letter-spacing: 0.03em; }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 991.98px) {
    :root { --sidebar-width: 0px; }
    .portal-sidebar { transform: translateX(-252px); transition: transform 0.25s ease; }
    .portal-sidebar.open { transform: translateX(0); width: 252px; }
    .portal-main { margin-left: 0; }
    .portal-content { padding: 20px 16px; }
}

@media (max-width: 575.98px) {
    .auth-card { padding: 32px 24px; }
    .portal-topbar { padding: 0 16px; }
}

/* ============================================================================
   MOBILE NAVIGATION — append to app.css
   ============================================================================ */

/* Hamburger button in topbar */
.portal-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text2);
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    padding: 0;
}

.portal-hamburger:hover {
    background: var(--brand-xlight);
    border-color: var(--brand);
    color: var(--brand);
}

/* Replace with this */
#portal-mobile-nav {
    --bs-offcanvas-width: 252px;
    --bs-offcanvas-bg: var(--brand);
    background-color: var(--brand) !important;
    border-right: none !important;
}

/* Bootstrap's offcanvas backdrop — darken behind the panel */
.offcanvas-backdrop {
    background-color: rgba(4, 61, 16, 0.5);
}

/* Close button inside offcanvas header */
.portal-offcanvas-close {
    background: none;
    border: 1px solid rgba(212, 201, 171, 0.2);
    border-radius: 7px;
    color: rgba(212, 201, 171, 0.65);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
    padding: 0;
}

.portal-offcanvas-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(212, 201, 171, 0.4);
}

/* Desktop: restore sidebar display flex (overrides d-none d-lg-flex gap) */
@media (min-width: 992px) {
    .portal-main {
        margin-left: var(--sidebar-width);
    }
}

/* Mobile: no left margin — sidebar is offcanvas overlay */
@media (max-width: 991.98px) {
    .portal-main {
        margin-left: 0;
    }

    /* Scope chip — hide on xs, show from sm upward */
    .portal-scope-chip {
        display: none;
    }
}

@media (min-width: 576px) {
    .portal-scope-chip {
        display: inline-flex;
    }
}

/* Force offcanvas background — belt and braces */
.offcanvas.portal-offcanvas,
.offcanvas.portal-offcanvas .offcanvas-body {
    background-color: var(--brand) !important;
}

/* Remove Bootstrap's default offcanvas body padding
   so the sidebar's own padding/flex layout takes over */
.portal-offcanvas .offcanvas-body {
    padding: 0;
    overflow-y: auto;
}

/* Ensure nav items are visible against the green background */
.portal-offcanvas .portal-nav-item {
    color: rgba(212, 201, 171, 0.72);
}

.portal-offcanvas .portal-nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.portal-offcanvas .portal-nav-item.active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-color: rgba(212, 201, 171, 0.28);
}

/* Nav group label visibility */
.portal-offcanvas .portal-nav-group-label {
    color: rgba(212, 201, 171, 0.4);
}

.portal-alert-row--hidden {
    display: none !important;
}