/* OnlyHoa — site.css */

/* ================================================================
   THEME VARIABLES
   community — full HOA branding (sidebar + accent from SystemAdmin)
   classic   — always OnlyHoa navy, never overridden, safe fallback
   light     — white content, community sidebar colors applied
   dark      — dark content, community sidebar colors applied
   accessible — black/white only, no color anywhere, WCAG AAA
   ================================================================ */

/* ── COMMUNITY — full brand mode, all colors from SystemAdmin branding ── */
.theme-community {
    --sidebar-bg: #1e3a5f;
    --sidebar-text: rgba(255,255,255,.82);
    --sidebar-border: rgba(255,255,255,.07);
    --accent: #2563eb;
    --accent2: #3b82f6;
    --btn-primary-bg: #2563eb;
    --cta-bg: #2563eb;
    --page-bg: #f8fafc;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --topbar-bg: #ffffff;
    --topbar-border: #e2e8f0;
    --topbar-text: #1e293b;
    --text: #1e293b;
    --text2: #475569;
    --text3: #94a3b8;
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --th-bg: #f7fafc;
    --tr-hover: #fafbfe;
    --row-border: #f0f4f8;
    --auth-bg: #1e3a5f;
    --btn-bg: #1e3a5f;
    --btn-fg: #ffffff;
}

/* ── CLASSIC — OnlyHoa navy always, branding never applied, reliable fallback ── */
.theme-classic {
    --sidebar-bg: #0f1f3d;
    --sidebar-text: rgba(255,255,255,.85);
    --sidebar-border: rgba(255,255,255,.08);
    --accent: #2563eb;
    --accent2: #3b82f6;
    --btn-primary-bg: #2563eb;
    --cta-bg: #2563eb;
    --page-bg: #f8fafc;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --topbar-bg: #ffffff;
    --topbar-border: #e2e8f0;
    --topbar-text: #1e293b;
    --text: #1e293b;
    --text2: #475569;
    --text3: #94a3b8;
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --th-bg: #f7fafc;
    --tr-hover: #fafbfe;
    --row-border: #f0f4f8;
    --auth-bg: #0f1f3d;
    --btn-bg: #0f1f3d;
    --btn-fg: #ffffff;
}

/* ── LIGHT — white content, sidebar+accent from community branding ── */
.theme-light {
    --sidebar-bg: #1e3a5f;
    --sidebar-text: rgba(255,255,255,.8);
    --sidebar-border: rgba(255,255,255,.07);
    --accent: #2563eb;
    --accent2: #3b82f6;
    --btn-primary-bg: #2563eb;
    --cta-bg: #2563eb;
    --page-bg: #f8fafc;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --topbar-bg: #ffffff;
    --topbar-border: #e2e8f0;
    --topbar-text: #1e293b;
    --text: #1e293b;
    --text2: #475569;
    --text3: #94a3b8;
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --th-bg: #f7fafc;
    --tr-hover: #fafbfe;
    --row-border: #f0f4f8;
    --auth-bg: #1e3a5f;
    --btn-bg: #1e3a5f;
    --btn-fg: #ffffff;
}

/* ── DARK — dark content, sidebar+accent from community branding ── */
.theme-dark {
    --sidebar-bg: #1e2433;
    --sidebar-text: rgba(255,255,255,.9);
    --sidebar-border: rgba(255,255,255,.09);
    --accent: #7c8cf8;
    --accent2: #a5b4fc;
    --btn-primary-bg: #5a67d8;
    --cta-bg: #5a67d8;
    --page-bg: #161b27;
    --card-bg: #1e2433;
    --card-border: #2e374d;
    --topbar-bg: #1e2433;
    --topbar-border: #2e374d;
    --topbar-text: #d1d9e6;
    --text: #d1d9e6;
    --text2: #8b98b0;
    --text3: #5a6480;
    --input-bg: #161b27;
    --input-border: #2e374d;
    --th-bg: #161b27;
    --tr-hover: #252d40;
    --row-border: #2e374d;
    --auth-bg: #1e2433;
    --btn-bg: #5a67d8;
    --btn-fg: #ffffff;
}

/* ── ACCESSIBLE — pure black/white, no color, WCAG AAA, branding never applied ── */
/* All text is #000 on #fff or #fff on #000 — minimum 7:1 contrast ratio        */
.theme-accessible {
    --sidebar-bg: #111111;
    --sidebar-text: #ffffff;
    --sidebar-border: rgba(255,255,255,.25);
    --accent: #000000;
    --accent2: #333333;
    --btn-primary-bg: #111111;
    --cta-bg: #111111;
    --page-bg: #ffffff;
    --card-bg: #ffffff;
    --card-border: #000000;
    --topbar-bg: #111111;
    --topbar-border: #000000;
    --topbar-text: #ffffff;
    --text: #000000;
    --text2: #111111;
    --text3: #444444;
    --input-bg: #ffffff;
    --input-border: #000000;
    --th-bg: #f0f0f0;
    --tr-hover: #e8e8e8;
    --row-border: #000000;
    --auth-bg: #111111;
    --btn-bg: #111111;
    --btn-fg: #ffffff;
}

/* ================================================================ RESET */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%
}

body {
    font-family: 'Segoe UI',system-ui,-apple-system,sans-serif;
    background: var(--page-bg,#f7f8fc);
    color: var(--text,#1a202c);
    font-size: 14px;
    line-height: 1.5
}

* {
    -webkit-tap-highlight-color: transparent
}

/* ================================================================ SIDEBAR */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg,#1e3a5f);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform .25s;
    overflow-y: auto
}

.sidebar-brand-bar {
    background: var(--sidebar-bg,#1e3a5f);
    padding: 12px 16px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    justify-content: center
}

    .sidebar-brand-bar img {
        display: block;
        height: 52px;
        width: auto
    }

.sidebar-logo {
    padding: 10px 16px 10px;
    border-bottom: 1px solid var(--sidebar-border,rgba(255,255,255,.07));
    flex-shrink: 0
}

.logo-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    padding: 4px 0 6px
}

    .logo-link img {
        display: block
    }

.sidebar-nav {
    flex: 1;
    padding: 8px 0 100px;
    overflow-y: auto;
    min-height: 0
}

.nav-group {
    margin-bottom: 4px
}

.nav-group-label {
    padding: 8px 20px 4px;
    font-size: 10px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    font-weight: 500
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--sidebar-text,rgba(255,255,255,.75));
    font-size: 13px;
    text-decoration: none;
    border-left: 3px solid transparent;
    min-height: 44px;
    transition: all .15s
}

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

    .nav-item.active {
        color: #fff;
        background: rgba(255,255,255,.12);
        border-left-color: var(--accent2,#3b82f6);
        font-weight: 500
    }

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

.nav-badge {
    margin-left: auto;
    background: var(--accent2,#3b82f6);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center
}

    .nav-badge.red {
        background: #e53e3e
    }

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--sidebar-border,rgba(255,255,255,.07))
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent2,#3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0
}

.user-name {
    color: #fff;
    font-size: 13px;
    font-weight: 500
}

.user-role {
    color: rgba(255,255,255,.45);
    font-size: 11px
}

.user-info {
    min-width: 0;
    overflow: hidden
}

.logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: rgba(255,255,255,.4);
    font-size: 16px;
    margin-left: auto
}

    .logout-btn:hover {
        color: #fff
    }

/* ================================================================ MAIN + TOPBAR */
.main-wrapper {
    margin-left: 240px;
    min-height: 100vh;
    display: flex;
    flex-direction: column
}

.topbar {
    height: 60px;
    background: var(--topbar-bg,#fff);
    border-bottom: 1px solid var(--topbar-border,#e2e8f0);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50
}

.community-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--topbar-text,#1e293b);
    white-space: nowrap
}

    .community-selector img {
        height: 26px;
        width: auto
    }

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #48bb78;
    flex-shrink: 0
}

.topbar-search {
    flex: 1;
    max-width: 340px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--page-bg,#f7f8fc);
    border: 1px solid var(--card-border,#e2e8f0);
    border-radius: 8px;
    padding: 8px 12px
}

    .topbar-search input {
        border: none;
        background: transparent;
        outline: none;
        font-size: 13px;
        color: var(--text,#1e293b);
        width: 100%;
        font-family: inherit
    }

.topbar-actions {
    margin-left: auto;
    display: flex;
    gap: 8px
}

.tb-icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--card-border,#e2e8f0);
    background: var(--topbar-bg,#fff);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
    color: var(--topbar-text,#1e293b)
}

    .tb-icon-btn:hover {
        background: var(--page-bg,#f7f8fc)
    }

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    font-size: 22px;
    color: var(--topbar-text,#4a5568)
}

.page-content {
    padding: 28px;
    flex: 1;
    background: var(--page-bg,#f7f8fc)
}

/* ================================================================ PAGE HEADER */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text,#1a202c);
    letter-spacing: -.3px
}

.page-sub {
    font-size: 13px;
    color: var(--text3,#718096);
    margin-top: 3px
}

/* ================================================================ BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all .15s;
    font-family: inherit;
    min-height: 44px
}

.btn-primary {
    background: var(--btn-primary-bg,#2563eb);
    color: #fff;
    border: 1px solid var(--btn-primary-bg,#2563eb)
}

    .btn-primary:hover {
        filter: brightness(.92)
    }

.btn-outline {
    background: transparent;
    color: var(--accent,#2563eb);
    border: 1px solid var(--accent,#2563eb)
}

    .btn-outline:hover {
        background: var(--accent-tint10,rgba(37,99,235,.10))
    }

.btn-danger {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #fed7d7
}

    .btn-danger:hover {
        background: #fed7d7
    }

.btn-white {
    background: #fff;
    color: #4a5568;
    border: 1px solid #e2e8f0
}

    .btn-white:hover {
        background: #f7f8fc
    }

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    min-height: 36px
}

/* ================================================================ STAT CARDS */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 16px;
    margin-bottom: 24px
}

.stat-card {
    background: var(--card-bg,#fff);
    border: 1px solid var(--card-border,#e2e8f0);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden
}

    .stat-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px
    }

    .stat-card.accent-navy::before {
        background: var(--btn-bg,#1e3a5f)
    }

    .stat-card.accent-gold::before {
        background: var(--accent2,#3b82f6)
    }

    .stat-card.accent-danger::before {
        background: #e53e3e
    }

    .stat-card.accent-success::before {
        background: #48bb78
    }

.stat-label {
    font-size: 11px;
    color: var(--text3,#718096);
    font-weight: 600;
    letter-spacing: .4px;
    text-transform: uppercase;
    margin-bottom: 8px
}

.stat-val {
    font-size: 26px;
    font-weight: 600;
    color: var(--text,#1a202c);
    letter-spacing: -.5px;
    margin-bottom: 4px
}

.stat-delta {
    font-size: 12px
}

    .stat-delta.up {
        color: #2d7a4f
    }

    .stat-delta.down {
        color: #c53030
    }

.stat-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 22px;
    opacity: .12
}

/* ================================================================ CARDS */
.card {
    background: var(--card-bg,#fff);
    border: 1px solid var(--card-border,#e2e8f0);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border,#edf2f7);
    display: flex;
    align-items: center;
    justify-content: space-between
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text,#2d3748)
}

.card-body {
    padding: 20px
}

    .card-body.p-0 {
        padding: 0
    }

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px
}

.three-col {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 16px
}

/* ================================================================ TABLE */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px
}

th {
    background: var(--th-bg,#f7fafc);
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text3,#718096);
    letter-spacing: .5px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--card-border,#edf2f7)
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--row-border,#f0f4f8);
    color: var(--text,#2d3748)
}

tr:last-child td {
    border-bottom: none
}

tr:hover td {
    background: var(--tr-hover,#fafbfe)
}

/* ================================================================ CHIPS */
.chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600
}

.chip-green {
    background: #f0fff4;
    color: #276749
}

.chip-red {
    background: #fff5f5;
    color: #c53030
}

.chip-yellow {
    background: #fffbeb;
    color: #744210
}

.chip-blue {
    background: #ebf8ff;
    color: #2c5282
}

.chip-gray {
    background: #f7fafc;
    color: #4a5568
}

.chip-purple {
    background: #faf5ff;
    color: #553c9a
}

/* ================================================================ FORMS */
.form-group {
    margin-bottom: 16px
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text2,#4a5568);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .4px
}

.form-control {
    width: 100%;
    border: 1px solid var(--input-border,#e2e8f0);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    background: var(--input-bg,#fff);
    color: var(--text,#2d3748);
    min-height: 44px;
    transition: border-color .15s
}

    .form-control:focus {
        border-color: var(--accent,#2563eb);
        box-shadow: 0 0 0 3px rgba(37,99,235,.08)
    }

textarea.form-control {
    min-height: 80px;
    resize: vertical
}

select.form-control {
    cursor: pointer
}

/* ================================================================ ALERTS */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px
}

.alert-success {
    background: #f0fff4;
    color: #276749;
    border: 1px solid #c6f6d5
}

.alert-danger {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #fed7d7
}

.alert-info {
    background: #ebf8ff;
    color: #2c5282;
    border: 1px solid #bee3f8
}

.theme-dark .alert-success {
    background: #052e16;
    border-color: #166534;
    color: #86efac
}

.theme-dark .alert-danger {
    background: #450a0a;
    border-color: #991b1b;
    color: #fca5a5
}

.theme-dark .alert-info {
    background: #0c1a2e;
    border-color: #1e3a5f;
    color: #93c5fd
}

.theme-accessible .alert-success {
    background: #fff;
    border: 2px solid #000;
    color: #000
}

.theme-accessible .alert-danger {
    background: #fff;
    border: 2px solid #000;
    color: #000
}

.theme-accessible .alert-info {
    background: #fff;
    border: 2px solid #000;
    color: #000
}

/* ================================================================ TOGGLE */
.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px
}

    .toggle input {
        opacity: 0;
        width: 0;
        height: 0
    }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e0;
    border-radius: 11px;
    cursor: pointer;
    transition: .2s
}

    .toggle-slider:before {
        content: '';
        position: absolute;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: #fff;
        left: 3px;
        top: 3px;
        transition: .2s
    }

.toggle input:checked + .toggle-slider {
    background: var(--accent,#2563eb)
}

    .toggle input:checked + .toggle-slider:before {
        transform: translateX(18px)
    }

/* ================================================================ PROGRESS */
.progress {
    height: 6px;
    background: var(--card-border,#edf2f7);
    border-radius: 3px;
    overflow: hidden
}

.progress-bar {
    height: 100%;
    background: var(--accent,#2563eb);
    border-radius: 3px
}

/* ================================================================ AUTH */
.auth-wrapper-outer {
    min-height: 100vh;
    background: var(--auth-bg,#1e3a5f);
    position: relative
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25)
}

.auth-logo {
    text-align: center;
    margin-bottom: 24px
}

    .auth-logo img {
        display: block;
        margin: 0 auto 8px;
        max-width: 200px;
        height: auto
    }

.auth-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1a202c
}

/* ================================================================ ERROR PAGES */
.error-page-wrapper {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--card-bg,#fff)
}

.error-page-card {
    text-align: center;
    max-width: 480px;
    width: 100%
}

.error-logo {
    width: 160px;
    height: auto;
    display: block;
    margin: 0 auto 24px
}

.error-code-display {
    font-size: 80px;
    font-weight: 700;
    color: #e2e8f0;
    line-height: 1;
    margin-bottom: 8px
}

.error-heading {
    font-size: 24px;
    font-weight: 600;
    color: var(--text,#1a202c);
    margin-bottom: 10px
}

.error-body {
    font-size: 14px;
    color: var(--text2,#718096);
    margin-bottom: 28px;
    line-height: 1.6
}

.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap
}

.error-footnote {
    margin-top: 24px;
    font-size: 12px;
    color: var(--text3,#a0aec0)
}

/* ================================================================ AUTH THEME DOTS */
.auth-theme-picker {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 200;
    align-items: center
}

    .auth-theme-picker::before {
        content: 'Theme';
        font-size: 10px;
        color: rgba(255,255,255,.5);
        margin-right: 4px;
        letter-spacing: .5px;
        text-transform: uppercase
    }

.theme-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2.5px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: all .2s;
    opacity: .65
}

    .theme-dot:hover {
        opacity: 1;
        transform: scale(1.15)
    }

.theme-dot-active {
    border-color: #fff !important;
    opacity: 1;
    transform: scale(1.15)
}

/* ================================================================ THEME PICKER CARDS */
.theme-preview-card {
    border: 2px solid var(--card-border,#e2e8f0);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all .2s
}

    .theme-preview-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0,0,0,.1)
    }

    .theme-preview-card.selected {
        box-shadow: 0 0 0 3px rgba(37,99,235,.25)
    }

.theme-preview-frame {
    display: flex;
    height: 72px;
    overflow: hidden
}

.tp-sidebar {
    width: 28%;
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    gap: 3px
}

.tp-main {
    flex: 1;
    display: flex;
    flex-direction: column
}

.tp-label {
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #edf2f7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px
}

    .tp-label > span:first-child {
        font-size: 13px;
        font-weight: 600;
        color: #1a202c
    }

.tp-sub {
    font-size: 11px;
    color: #718096;
    width: 100%;
    order: 2
}

.tp-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    transition: all .2s
}

/* ================================================================ MOBILE */
@media(max-width:768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px
    }

        .sidebar.open {
            transform: translateX(0);
            box-shadow: 4px 0 24px rgba(0,0,0,.3)
        }

    #sidebarBottomBar {
        display: none
    }

    .main-wrapper {
        margin-left: 0
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 99
    }

        .sidebar-overlay.active {
            display: block
        }

    .mobile-menu-toggle {
        display: flex !important;
        align-items: center
    }

    .topbar {
        padding: 0 16px;
        gap: 10px
    }

    .topbar-search {
        display: none
    }

        .topbar-search.open {
            display: flex;
            position: fixed;
            top: 60px;
            left: 0;
            right: 0;
            background: var(--topbar-bg,#fff);
            border-bottom: 1px solid var(--topbar-border,#e2e8f0);
            padding: 10px 16px;
            z-index: 60;
            max-width: 100%
        }

    .page-content {
        padding: 16px
    }

    .stat-grid {
        grid-template-columns: repeat(2,1fr);
        gap: 12px
    }

    .dashboard-grid, .two-col {
        grid-template-columns: 1fr
    }

    .three-col {
        grid-template-columns: 1fr
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start
    }

    .page-title {
        font-size: 18px
    }

    .auth-card {
        padding: 28px 20px;
        margin: 8px
    }

    table {
        min-width: 500px
    }

    .error-logo {
        width: 120px
    }

    .error-code-display {
        font-size: 60px
    }

    .error-actions {
        flex-direction: column;
        align-items: center
    }

        .error-actions .btn {
            width: 100%;
            max-width: 280px;
            justify-content: center
        }

    #mobileSearchBtn {
        display: flex !important
    }
}

@media(max-width:480px) {
    .stat-grid {
        grid-template-columns: 1fr
    }

    .topbar {
        height: 52px
    }

    .page-content {
        padding: 12px
    }
}

@supports(padding-bottom:env(safe-area-inset-bottom)) {
    .sidebar-footer {
        padding-bottom: calc(16px + env(safe-area-inset-bottom))
    }

    .page-content {
        padding-bottom: calc(28px + env(safe-area-inset-bottom))
    }
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px
}
@keyframes op-pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: .85;
    }
}
/* ── DARK THEME REFINEMENTS ──────────────────────────────── */
.theme-dark .auth-card {
    background: #1e2433;
    border: 1px solid #2e374d;
}

    .theme-dark .auth-card h2 {
        color: #d1d9e6;
    }

    .theme-dark .auth-card p {
        color: #8b98b0;
    }

    .theme-dark .auth-card .form-label {
        color: #8b98b0;
    }

    .theme-dark .auth-card .form-control {
        background: #161b27;
        border-color: #2e374d;
        color: #d1d9e6;
    }

        .theme-dark .auth-card .form-control::placeholder {
            color: #3d4a62;
        }

    .theme-dark .auth-card .btn-primary {
        background: var(--btn-primary-bg, #5a67d8);
    }

    .theme-dark .auth-card p[style*="color:rgba(0,0,0"] {
        color: rgba(255,255,255,.35) !important;
    }

    .theme-dark .auth-card a[style*="color:rgba(0,0,0"] {
        color: rgba(255,255,255,.6) !important;
    }

.theme-dark .error-code-display {
    color: #2e374d;
}

.theme-accessible .auth-card {
    background: #fff;
    border: 2px solid #000;
}

    .theme-accessible .auth-card .form-control {
        background: #fff;
        border: 2px solid #000;
        color: #000;
    }

    .theme-accessible .auth-card .btn-primary {
        background: #111;
        color: #fff;
    }

/* ── GOLD THEME AUTH ──────────────────────────────────────── */


/* ── NAV ICONS ────────────────────────────────────────────── */
.nav-icon {
    font-size: 14px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ================================================================ INTERNAL NOTES */
.internal-notes-field {
    position: relative
}

    .internal-notes-field textarea,
    .internal-notes-field input {
        background: #fffbeb !important;
        border: 1.5px solid #f59e0b !important;
        border-left: 4px solid #d97706 !important;
        color: #78350f !important;
    }

        .internal-notes-field textarea::placeholder {
            color: #b45309 !important;
            opacity: .7
        }

.internal-notes-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 6px;
    letter-spacing: .2px
}

/* ── Internal Notes — global standard highlight ── */
.internal-notes-section {
    background: #fffbeb;
    border: 1.5px solid #f59e0b;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
    position: relative;
}

    .internal-notes-section::before {
        content: "🔒 Staff-Only Internal Notes";
        display: block;
        font-size: 11px;
        font-weight: 700;
        color: #92400e;
        text-transform: uppercase;
        letter-spacing: .5px;
        margin-bottom: 8px;
    }

    .internal-notes-section .internal-notes-sublabel {
        font-size: 11px;
        color: #b45309;
        margin-bottom: 8px;
        line-height: 1.5;
    }

    .internal-notes-section textarea,
    .internal-notes-section input {
        background: #fffef7 !important;
        border-color: #f59e0b !important;
    }

        .internal-notes-section textarea:focus,
        .internal-notes-section input:focus {
            border-color: #d97706 !important;
            box-shadow: 0 0 0 3px rgba(245,158,11,.15) !important;
        }
/* Phone input — standardize display pattern */
input[data-phone], .phone-input {
    letter-spacing: .02em;
}
/* ── CommunityIQ Operational Card Styles ─────────────────────────────────────
   These styles render the structured live-data cards returned by
   OperationalQueryEngine inside the CommunityIQ chat interface.
   ────────────────────────────────────────────────────────────────────────── */

/* CSS custom props reused by the engine's inline color refs */
:root {
    --status-open: #f59e0b;
    --status-inprog: #3b82f6;
    --status-pending: #9ca3af;
    --status-ok: #22c55e;
    --status-alert: #ef4444;
}

/* ── Card wrapper ──────────────────────────────────────────────────────────── */
.op-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
    font-size: 12px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* ── Card header ───────────────────────────────────────────────────────────── */
.op-card-hdr {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    background: var(--th-bg);
    border-bottom: 1px solid var(--card-border);
}

.op-card-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.op-card-titles {
    flex: 1;
    min-width: 0;
}

.op-card-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.op-card-sub {
    font-size: 10px;
    color: var(--text3);
    margin-top: 1px;
}

.op-card-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--sidebar-bg);
    text-decoration: none;
    padding: 4px 8px;
    border: 1px solid var(--sidebar-bg);
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .12s, color .12s;
}

    .op-card-link:hover {
        background: var(--sidebar-bg);
        color: #fff;
    }

/* ── Card body ─────────────────────────────────────────────────────────────── */
.op-card-body {
    padding: 10px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ── Stat grid ─────────────────────────────────────────────────────────────── */
.op-stat-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 4px;
}

.op-stat-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px;
    border-radius: 7px;
    background: var(--th-bg);
}

.op-stat-label {
    flex: 1;
    color: var(--text2);
    font-size: 11px;
}

.op-stat-count {
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
    min-width: 24px;
    text-align: right;
}

/* ── Alert chips ───────────────────────────────────────────────────────────── */
.op-alert-row {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.op-alert-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}

.op-chip-blue {
    background: #dbeafe;
    color: #1e40af;
}

.op-chip-red {
    background: #fee2e2;
    color: #991b1b;
}

.op-chip-orange {
    background: #fff7ed;
    color: #c2410c;
}

.op-chip-green {
    background: #dcfce7;
    color: #166534;
}

/* ── Lists ─────────────────────────────────────────────────────────────────── */
.op-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.op-list-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 7px;
    background: var(--th-bg);
    transition: background .1s;
}

    .op-list-row:hover {
        background: var(--tr-hover, #fafbfe);
    }

    .op-list-row.op-overdue {
        background: #fff5f5;
        border: 1px solid #fecaca;
    }

    .op-list-row.op-pinned-row {
        background: #fffbeb;
    }

.op-list-main {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.op-list-title {
    font-weight: 600;
    color: var(--text);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.op-list-meta {
    font-size: 10px;
    color: var(--text3);
}

.op-list-note {
    font-size: 10px;
    color: var(--text2);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.op-list-amount {
    font-weight: 700;
    font-size: 12px;
    color: var(--text);
    flex-shrink: 0;
    margin-left: 4px;
}

.op-ticket-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* ── Section labels ────────────────────────────────────────────────────────── */
.op-section-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text3);
    padding: 4px 0 2px;
}

/* ── Footer notes ──────────────────────────────────────────────────────────── */
.op-footer-note {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: var(--text3);
    padding: 4px 2px 0;
}

.op-staff-note {
    color: var(--text2);
    font-style: italic;
}

/* ── Balance heroes ────────────────────────────────────────────────────────── */
.op-balance-hero {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 9px;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
}

.op-balance-ok {
    background: #dcfce7;
    color: #166534;
}

.op-balance-due {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Badges ────────────────────────────────────────────────────────────────── */
.op-badge {
    display: inline-block;
    font-size: 8px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
}

.op-badge-blue {
    background: #dbeafe;
    color: #1e40af;
}

/* ── Empty state ───────────────────────────────────────────────────────────── */
.op-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 18px 14px;
    color: var(--text3);
    font-size: 11px;
    text-align: center;
}
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .4;
        transform: scale(.8);
    }
}