/* assets/css/frontend.css — Mobile-First Responsive Design */

/* ══════════════════════════════════════════════
   1. CSS Variables & Reset
══════════════════════════════════════════════ */
:root {
    /* Core brand palette */
    --charcoal-black:          #2d3a42;
    --charcoal-dark:           #1f282e;
    --light-grey:              #f4f5f7;
    --vibrant-red:             #e63946;
    --red-hover:               #d62828;
    --success:                 #28a745;
    --warning:                 #f0a500;

    /* Neutrals & typography */
    --text-main:               #333333;
    --text-muted:              #888888;
    --text-heading:            #2d3a42;
    --white:                   #ffffff;

    /* Borders & surfaces */
    --border:                  #e8e8e8;
    --border-faint:            #f0f0f0;
    --bg-subtle:               #f8f9fa;
    --bg-hover:                #fafbfc;

    /* Layout tokens */
    --sidebar-width:           260px;
    --sidebar-collapsed-width: 60px;
    --topbar-height:           60px;

    /* Fluid spacing scale — adapts from mobile to desktop */
    --space-xs:                clamp(4px, 0.5vw, 8px);
    --space-sm:                clamp(8px, 1vw, 14px);
    --space-md:                clamp(14px, 2vw, 24px);
    --space-lg:                clamp(20px, 3vw, 36px);
    --space-xl:                clamp(28px, 4vw, 48px);

    /* Fluid font sizes */
    --fs-xs:                   clamp(11px, 1.2vw, 12px);
    --fs-sm:                   clamp(12px, 1.4vw, 13px);
    --fs-base:                 clamp(13px, 1.6vw, 14px);
    --fs-md:                   clamp(14px, 1.8vw, 16px);
    --fs-lg:                   clamp(16px, 2.2vw, 20px);
    --fs-xl:                   clamp(18px, 2.5vw, 24px);
    --fs-2xl:                  clamp(22px, 3vw, 28px);

    /* Radius scale */
    --radius-sm:               6px;
    --radius-md:               10px;
    --radius-lg:               16px;
    --radius:                  var(--radius-md);

    /* Shadows */
    --shadow-sm:               0 2px 8px rgba(0,0,0,0.06);
    --shadow-md:               0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg:               0 18px 45px rgba(15,20,25,0.25);

    /* Transitions */
    --transition:              0.25s cubic-bezier(0.4,0,0.2,1);

    /* Typography */
    --font-sans:               'IBM Plex Sans Arabic', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

/* ══════════════════════════════════════════════
   2. Base Layout
══════════════════════════════════════════════ */
body.ittihad-admin-app {
    margin: 0;
    font-family: var(--font-sans);
    background-color: var(--light-grey);
    color: var(--text-main);
    direction: rtl;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════════════
   3. Mobile Top Bar (hamburger bar)
══════════════════════════════════════════════ */
.app-topbar {
    display: none;
    position: fixed;
    top: 0; right: 0; left: 0;
    height: var(--topbar-height);
    background: var(--charcoal-black);
    z-index: 1000;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.app-topbar .topbar-brand {
    color: var(--white);
    font-size: 17px;
    font-weight: bold;
}
.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-radius: 6px;
    transition: background var(--transition);
}
.hamburger-btn:hover { background: rgba(255,255,255,0.1); }
.hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ══════════════════════════════════════════════
   4. Sidebar Overlay (mobile backdrop)
══════════════════════════════════════════════ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease;
}
.sidebar-overlay.active { display: block; }

/* ══════════════════════════════════════════════
   5. Sidebar
══════════════════════════════════════════════ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(160deg, var(--charcoal-black) 0%, var(--charcoal-dark) 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; right: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 999;
    box-shadow: -3px 0 15px rgba(0,0,0,0.2);
    transition: transform var(--transition);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-geometry { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.sidebar-square {
    position: absolute;
    border: 2px solid rgba(255,255,255,0.03);
    transform: rotate(45deg);
    border-radius: 4px;
}
.sq-1 { width: 180px; height: 180px; top: -60px; right: -60px; background: rgba(255,255,255,0.015); }
.sq-2 { width: 280px; height: 280px; bottom: 5%; left: -120px; border-color: rgba(230,57,70,0.12); }
.sq-3 { width: 100px; height: 100px; top: 40%; right: 20px; border-color: rgba(255,255,255,0.02); }

.app-brand {
    padding: var(--space-md) var(--space-md) var(--space-md);
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    position: relative;
    z-index: 1;
}
.app-brand h1 {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--white);
}
.app-brand span { font-size: 11px; color: #a0aab2; letter-spacing: 0.3px; }

.app-nav { flex-grow: 1; padding: var(--space-sm) 0; position: relative; z-index: 1; }
.app-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: #b0bec5;
    text-decoration: none;
    font-size: 14px;
    transition: all var(--transition);
    border-right: 3px solid transparent;
    border-radius: 0 0 0 0;
    margin: 1px 0;
    position: relative;
}
.app-nav a:hover {
    background: rgba(255,255,255,0.06);
    color: var(--white);
    border-right-color: rgba(230,57,70,0.5);
}
.app-nav a.active {
    background: rgba(230,57,70,0.12);
    color: var(--white);
    border-right-color: var(--vibrant-red);
    font-weight: 600;
}
.app-nav a.active::before {
    content: '';
    position: absolute;
    right: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--vibrant-red);
    border-radius: 0 3px 3px 0;
}
.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}

.app-icon,
.mob-icon-svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    fill: currentColor;
}

/* Mobile close button — hidden on desktop */
.sidebar-close-mobile { display: none; }

.app-logout {
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid rgba(255,255,255,0.07);
    position: relative;
    z-index: 1;
}
.app-logout a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #90a4ae;
    text-decoration: none;
    font-size: 13px;
    transition: color var(--transition);
    padding: 8px 10px;
    border-radius: 6px;
    transition: all var(--transition);
}
.app-logout a:hover { color: var(--vibrant-red); background: rgba(230,57,70,0.08); }

/* PWA Install Button */
.pwa-install-btn {
    display: none;
    align-items: center;
    gap: 8px;
    width: calc(100% - 44px);
    margin: 0 22px 16px;
    padding: 9px 14px;
    background: rgba(230,57,70,0.15);
    border: 1px solid rgba(230,57,70,0.35);
    border-radius: 8px;
    color: #ffb3b8;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    z-index: 1;
}
.pwa-install-btn:hover {
    background: rgba(230,57,70,0.3);
    border-color: var(--vibrant-red);
    color: #fff;
}

/* ══════════════════════════════════════════════
   6. Main Content
══════════════════════════════════════════════ */
.app-content {
    flex-grow: 1;
    padding: var(--space-lg) var(--space-md);
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    overflow-x: hidden;
    animation: pageSlideIn 0.3s ease;
}

@keyframes pageSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════
   7. Content Header
══════════════════════════════════════════════ */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--border);
}
.content-header h2 {
    margin: 0;
    font-size: var(--fs-xl);
    font-weight: 700;
    color: var(--text-heading);
}
.content-header span {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    background: var(--white);
    padding: var(--space-xs) var(--space-sm);
    border-radius: 20px;
    border: 1px solid var(--border);
}

/* ══════════════════════════════════════════════
   8. Stats Grid
══════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.stat-card {
    background: var(--white);
    padding: var(--space-md) var(--space-md);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border-bottom: 4px solid var(--charcoal-black);
    transition: transform var(--transition), box-shadow var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: -20px; left: -20px;
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(45,58,66,0.04);
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.stat-card.accent-red { border-bottom-color: var(--vibrant-red); }
.stat-card.accent-red::after { background: rgba(230,57,70,0.05); }
.stat-card.accent-green { border-bottom-color: var(--success); }
.stat-card h3 { margin: 0 0 var(--space-xs); font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.stat-card .value { font-size: var(--fs-2xl); font-weight: 700; color: var(--charcoal-black); margin: 0; line-height: 1.2; }

/* Generic utility accents for stat cards */
.stat-accent-success {
    border-top: 4px solid var(--success);
}
.stat-accent-danger {
    border-top: 4px solid var(--vibrant-red);
}
.stat-accent-dynamic-success {
    border-top: 4px solid var(--success);
}
.stat-accent-dynamic-danger {
    border-top: 4px solid var(--vibrant-red);
}

/* Utility colors */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--vibrant-red); }
.text-accent { color: var(--charcoal-black); }

/* Tabs */
.tabs-row {
    display: flex;
    gap: 0;
    margin-bottom: var(--space-md);
    border-bottom: 2px solid var(--border);
}
.tab-link {
    padding: var(--space-sm) var(--space-md);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}
.tab-link--active-main {
    border-bottom-color: var(--charcoal-black);
    color: var(--charcoal-black);
}
.tab-link--active-danger {
    border-bottom-color: var(--vibrant-red);
    color: var(--vibrant-red);
}
.tab-count-pill {
    background: var(--vibrant-red);
    color: #fff;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 12px;
}

/* Filter bar / inline form */
.filter-card {
    margin-bottom: var(--space-md);
    padding: var(--space-sm) var(--space-md);
}
.filter-row {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-end;
}
.filter-row .form-group {
    margin: 0;
    flex-grow: 1;
}

/* Highlight summary strip */
.summary-strip-danger {
    background: #fff8f8;
    border: 1px solid #f5c6cb;
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
}
.summary-strip {
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
}
.summary-label {
    font-size: 13px;
    color: var(--text-muted);
}
.summary-value-danger {
    font-size: 24px;
    font-weight: 700;
    color: var(--vibrant-red);
}

/* Residents / forms layout */
.flex-row-lg {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
    flex-wrap: wrap;
}
.form-card-lg {
    flex: 1;
    min-width: min(320px, 100%);
    margin-bottom: var(--space-md);
}
.form-row-2 {
    display: flex;
    gap: var(--space-sm);
}
.form-row-2 > div {
    flex: 1;
}
.section-separator {
    margin: var(--space-md) 0;
    border: 0;
    border-top: 1px dashed #ccc;
}
.section-subtitle {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--charcoal-black);
}
.section-note {
    font-size: 12px;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
}

/* Layout utilities */
.flex-row {
    display: flex;
    flex-wrap: wrap;
}
.flex-1 {
    flex: 1;
}
.gap-20 {
    gap: var(--space-md);
}
.mt-20 {
    margin-top: var(--space-md);
}
.minw-280 {
    min-width: 280px;
}

/* Compact card header */
.card-title-sm {
    margin: 0 0 10px;
    font-size: 15px;
}

/* ══════════════════════════════════════════════
   9. Tables
══════════════════════════════════════════════ */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 20px; }
.corp-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    min-width: 500px;
}
.corp-table th {
    background: var(--charcoal-black);
    color: var(--white);
    padding: var(--space-sm);
    text-align: right;
    font-weight: 500;
    font-size: var(--fs-sm);
    white-space: nowrap;
}
.corp-table th:first-child { border-radius: 0 var(--radius) 0 0; }
.corp-table th:last-child  { border-radius: var(--radius) 0 0 0; }
.corp-table td {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--border-faint);
    font-size: var(--fs-base);
    color: var(--text-main);
    vertical-align: middle;
}
.corp-table tbody tr { transition: background var(--transition); }
.corp-table tbody tr:hover { background: var(--bg-hover); }
.corp-table tbody tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════════
   10. Buttons
══════════════════════════════════════════════ */
.btn-primary, .btn-secondary, .btn-success {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--fs-base);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
.btn-primary  { background: var(--vibrant-red); color: var(--white); }
.btn-primary:hover  { background: var(--red-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(230,57,70,0.35); }
.btn-secondary { background: var(--charcoal-black); color: var(--white); }
.btn-secondary:hover { background: var(--charcoal-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(45,58,66,0.3); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #218838; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(40,167,69,0.35); }
.btn-primary:active, .btn-secondary:active, .btn-success:active { transform: translateY(0); box-shadow: none; }

.btn-danger {
    color: var(--vibrant-red);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition);
}
.btn-danger:hover { background: rgba(230,57,70,0.08); text-decoration: none; }

/* Ripple effect */
.btn-primary::after, .btn-secondary::after, .btn-success::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    width: 0; height: 0;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%,-50%);
    transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
    opacity: 0;
}
.btn-primary:active::after, .btn-secondary:active::after, .btn-success:active::after {
    width: 200px; height: 200px;
    left: 50%; top: 50%;
    opacity: 0;
}

/* ══════════════════════════════════════════════
   11. Form Cards
══════════════════════════════════════════════ */
.form-card {
    background: var(--white);
    padding: var(--space-md);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-md);
    max-width: 620px;
    border: 1px solid rgba(0,0,0,0.04);
}
.form-card h3 { margin: 0 0 var(--space-md); font-size: var(--fs-md); color: var(--text-heading); font-weight: 600; }

.form-group { margin-bottom: var(--space-sm); }
.form-group label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: #444;
}
.form-control {
    width: 100%;
    padding: var(--space-sm);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--fs-base);
    box-sizing: border-box;
    background: var(--white);
    color: var(--text-main);
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
}
.form-control:focus {
    outline: none;
    border-color: var(--charcoal-black);
    box-shadow: 0 0 0 3px rgba(45,58,66,0.08);
}
.form-control:hover:not(:focus) { border-color: #bbb; }

select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ══════════════════════════════════════════════
   12. Checkbox Grid
══════════════════════════════════════════════ */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
}
.checkbox-grid label {
    font-weight: 500;
    font-size: var(--fs-sm);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    border-radius: 5px;
    transition: background var(--transition);
    color: var(--text-main);
}
.checkbox-grid label:hover { background: rgba(45,58,66,0.05); }
.checkbox-grid input[type="checkbox"] { accent-color: var(--vibrant-red); width: 15px; height: 15px; }

/* ══════════════════════════════════════════════
   13. Toast Notification System
══════════════════════════════════════════════ */
#ittihad-toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.ittihad-toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    font-size: var(--fs-base);
    font-weight: 500;
    color: var(--white);
    min-width: 260px;
    max-width: 360px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    pointer-events: all;
    animation: toastIn 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
.ittihad-toast.hide { animation: toastOut 0.25s ease forwards; }
.ittihad-toast.success { background: linear-gradient(135deg, #28a745, #1e7e34); }
.ittihad-toast.error   { background: linear-gradient(135deg, #e63946, #c0392b); }
.ittihad-toast.warning { background: linear-gradient(135deg, #f0a500, #d68910); }
.ittihad-toast .toast-icon { font-size: 18px; flex-shrink: 0; }
.ittihad-toast .toast-msg  { flex-grow: 1; line-height: 1.4; }
.ittihad-toast .toast-close {
    background: none; border: none; color: rgba(255,255,255,0.7);
    cursor: pointer; font-size: 16px; padding: 0 2px; flex-shrink: 0;
    line-height: 1; transition: color var(--transition);
}
.ittihad-toast .toast-close:hover { color: var(--white); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-30px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0)    scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-20px); }
}

/* ══════════════════════════════════════════════
   14. Loading Spinner
══════════════════════════════════════════════ */
.ittihad-spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════
   15. Status Badges
══════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-green   { background: #e8f5e9; color: #2e7d32; }
.badge-grey    { background: #f0f0f0; color: #555; }
.badge-red     { background: #fdecea; color: #c62828; }
.badge-yellow  { background: #fff8e1; color: #856404; }
.badge-blue    { background: #e3f2fd; color: #1565c0; }

/* ══════════════════════════════════════════════
   16. Animations — general
══════════════════════════════════════════════ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════
   17. Alert / Message Boxes
══════════════════════════════════════════════ */
.alert {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
    font-size: var(--fs-base);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    animation: slideDown 0.3s ease;
}
.alert-success { background: #e8f5e9; color: #1b5e20; border-right: 4px solid var(--success); }
.alert-error   { background: #fdecea; color: #b71c1c; border-right: 4px solid var(--vibrant-red); }
.alert-warning { background: #fff8e1; color: #6d4c00; border-right: 4px solid var(--warning); }

/* ══════════════════════════════════════════════
   18. TABLET — 768px to 1024px
══════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .stats-grid  { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════
   19. MOBILE — under 768px
══════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* Show topbar on mobile */
    .app-topbar { display: flex; }

    /* Sidebar handled in section 23 (mobile drawer) */

    .app-content {
        margin-right: 0;
        padding: var(--space-sm);
        padding-top: calc(var(--topbar-height) + var(--space-sm));
    }

    /* Stats: 2-col on tablet */
    .stats-grid { grid-template-columns: 1fr 1fr; }

    /* Content header compact */
    .content-header { flex-wrap: wrap; gap: var(--space-xs); }

    /* Full-width form cards */
    .form-card { max-width: 100%; }

    /* ─── FORCE ALL INLINE FLEX LAYOUTS TO STACK (content area only) ─── */
    .app-content div[style*="display: flex"],
    .app-content div[style*="display:flex"] {
        flex-direction: column !important;
        gap: 12px !important;
    }
    /* Override all min-width on flex children inside content */
    .app-content div[style*="min-width"],
    .app-content div[style*="min-width:"] {
        min-width: 0 !important;
        width: 100% !important;
    }
    /* Fix flex ratios — give everything full width inside content */
    .app-content div[style*="flex:1"],
    .app-content div[style*="flex: 1"],
    .app-content div[style*="flex:2"],
    .app-content div[style*="flex: 2"] {
        flex: 1 1 100% !important;
    }

    /* ─── FILTER FORMS — keep inline but allow wrap ─── */
    form[style*="display:flex"],
    form[style*="display: flex"] {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    form[style*="display:flex"] > div,
    form[style*="display: flex"] > div {
        min-width: 0 !important;
        flex: 1 1 calc(50% - 4px) !important;
    }
    form[style*="display:flex"] > button,
    form[style*="display: flex"] > button {
        flex: 1 1 100% !important;
    }

    /* ─── TABLES: card-based mobile layout ─── */
    .corp-table {
        min-width: 0;
        border: none;
        background: none;
        box-shadow: none;
    }
    .corp-table thead {
        display: none; /* hide header row — cards are self-describing */
    }
    .corp-table tbody {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    .corp-table tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px 12px;
        background: var(--white);
        border: 1px solid var(--border-faint);
        border-radius: var(--radius);
        padding: 14px;
        box-shadow: var(--shadow-sm);
    }
    .corp-table td {
        display: flex;
        align-items: center;
        padding: 0;
        border: none;
        font-size: 13px;
        line-height: 1.5;
        background: none !important;
        word-break: break-word;
    }
    /* Data-label: shows column header before each cell value */
    .corp-table td[data-label]::before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: var(--text-muted);
        font-size: 11px;
        min-width: 70px;
        margin-left: 6px;
        flex-shrink: 0;
    }
    .corp-table td:first-child[data-label]::before {
        display: none; /* First cell is already prominent */
    }
    /* First cell = main identifier, spans full row */
    .corp-table td:first-child {
        grid-column: 1 / -1;
        font-weight: 600;
        font-size: 14px;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--border-faint);
    }
    /* 2-column rows (key-value): don't span, keep side by side */
    .corp-table td:first-child:nth-last-child(2) {
        grid-column: 1;
        border-bottom: none;
        padding-bottom: 0;
    }
    .corp-table td:first-child:nth-last-child(2) + td {
        grid-column: 2;
        text-align: left;
    }
    /* Last cell spans full row when 5+ columns (action buttons row) */
    .corp-table td:nth-child(n+5):last-child {
        grid-column: 1 / -1;
        padding-top: 6px;
        border-top: 1px solid var(--border-faint);
        gap: 8px;
    }
    /* Small text / secondary info */
    .corp-table td small {
        display: block;
        color: var(--text-muted);
        font-size: 11px;
    }
    /* Badge/pill sizing in cards */
    .corp-table td .badge,
    .corp-table td span[style*="padding"] {
        font-size: 11px !important;
    }
    /* Buttons inside cards */
    .corp-table td .btn-danger,
    .corp-table td .btn-secondary {
        padding: 6px 12px !important;
        font-size: 12px !important;
    }
    /* Override inline nowrap for card layout */
    .corp-table td[style*="white-space"] {
        white-space: normal !important;
        flex-wrap: wrap;
    }
    /* Inline font-size overrides for cards */
    .corp-table td[style*="font-size: 16px"],
    .corp-table td[style*="font-size:16px"],
    .corp-table td[style*="font-size: 18px"],
    .corp-table td[style*="font-size:18px"],
    .corp-table td[style*="font-size: 20px"],
    .corp-table td[style*="font-size:20px"] {
        font-size: 14px !important;
    }
    /* Scroll container — not needed with cards */
    .table-wrapper {
        overflow-x: visible;
    }
    /* Dashboard small tables — keep compact */
    .form-card .corp-table tr {
        padding: 10px 12px;
        gap: 4px 10px;
    }
    .form-card .corp-table td:first-child {
        border-bottom: none;
        padding-bottom: 0;
        font-size: 13px;
    }
    .form-card .corp-table td:last-child {
        border-top: none;
        padding-top: 0;
    }

    /* ─── BUTTONS: full-width inside forms ─── */
    .form-card .btn-primary,
    .form-card .btn-success,
    .form-card .btn-secondary {
        width: 100%;
        justify-content: center;
        padding: 14px;
        font-size: var(--fs-md);
    }
    /* Inline action buttons — bigger touch targets */
    .btn-danger,
    td .btn-secondary {
        padding: 8px 12px !important;
        font-size: 13px !important;
    }

    /* ─── FORM ROWS: stack side-by-side inputs ─── */
    .form-row-2,
    div[style*="display: flex"][style*="gap: 15px"],
    div[style*="display:flex"][style*="gap:15px"],
    div[style*="display: flex"][style*="gap: 10px"],
    div[style*="display:flex"][style*="gap:10px"] {
        flex-direction: column !important;
        gap: 8px !important;
    }
    .form-row-2 > div,
    div[style*="display: flex"][style*="gap: 15px"] > div,
    div[style*="display:flex"][style*="gap:15px"] > div {
        flex: 1 1 100% !important;
    }

    /* ─── FORM CONTROLS: bigger touch targets ─── */
    .form-control {
        padding: 12px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    select.form-control {
        font-size: 16px;
        min-height: 48px;
    }

    /* ─── INLINE FONT-SIZE NORMALIZATION ─── */
    /* Make all inline font-size:16px+ reasonable on mobile */
    td[style*="font-size: 20px"],
    td[style*="font-size:20px"] { font-size: 16px !important; }
    td[style*="font-size: 18px"],
    td[style*="font-size:18px"] { font-size: 15px !important; }
    td[style*="font-size: 16px"],
    td[style*="font-size:16px"] { font-size: 14px !important; }
    td[style*="font-size: 15px"],
    td[style*="font-size:15px"] { font-size: 13px !important; }

    /* ─── DASHBOARD TABLE max-width fix ─── */
    table[style*="max-width"] { max-width: 100% !important; }

    /* ─── BADGES & PILLS: ensure readability ─── */
    span[style*="padding:3px"],
    span[style*="padding: 3px"] { padding: 4px 8px !important; font-size: 11px !important; }

    /* ─── SETTINGS PAGE TABS ─── */
    div[style*="border-bottom:2px solid"] {
        gap: 0 !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
    }
    div[style*="border-bottom:2px solid"] > a {
        flex: 1 1 auto;
        text-align: center;
        padding: 10px 8px !important;
        font-size: 12px !important;
    }

    /* ─── GENERAL: prevent horizontal overflow ─── */
    .app-content * { max-width: 100%; box-sizing: border-box; }
    .app-content img { max-width: 100%; }
    /* Tables use card layout — no max-width needed */
    .app-content .corp-table { max-width: none; }

    /* ─── TOAST on mobile ─── */
    #ittihad-toast-container { left: 8px; right: 8px; bottom: 12px; }
    .ittihad-toast { min-width: unset; max-width: 100%; }
}

/* ══════════════════════════════════════════════
   19b. SMALL PHONES — under 480px
══════════════════════════════════════════════ */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }

    /* Tighter spacing on very small screens */
    .app-content {
        padding: 8px;
        padding-top: calc(var(--topbar-height) + 8px);
    }

    .content-header h2 { font-size: 16px; }

    /* Stack filter form fully */
    form[style*="display:flex"] > div,
    form[style*="display: flex"] > div {
        flex: 1 1 100% !important;
    }

    /* Compact table cards */
    .corp-table tr { padding: 10px 12px; gap: 4px 10px; }
    .corp-table td { font-size: 12px; }
    .corp-table td:first-child { font-size: 13px; }
}

/* ══════════════════════════════════════════════
   WordPress Admin Bar Compatibility (fallback)
   Admin bar is hidden via show_admin_bar(false) but this is a safety net.
══════════════════════════════════════════════ */
body.admin-bar .app-sidebar { top: 0; height: 100vh; }
body.admin-bar .app-topbar { top: 0; }

/* ══════════════════════════════════════════════
   20. DARK MODE
══════════════════════════════════════════════ */
[data-theme="dark"] {
    --light-grey:    #0f1419;
    --white:         #1a2332;
    --text-main:     #e6edf3;
    --text-muted:    #8b949e;
    --text-heading:  #c9d1d9;
    --border:        #30363d;
    --border-faint:  #21262d;
    --bg-subtle:     #21262d;
    --bg-hover:      #252d3a;
    --shadow-sm:     0 2px 8px rgba(0,0,0,0.4);
    --shadow-md:     0 4px 20px rgba(0,0,0,0.5);
}

/* Smooth theme transition — applied only during toggle via JS class */
.theme-changing,
.theme-changing * {
    transition-property: background-color, border-color, color, box-shadow !important;
    transition-duration: 0.3s !important;
    transition-timing-function: ease !important;
}
/* Prevent transition interference on transforms during theme change */
.theme-changing .app-sidebar,
.theme-changing .hamburger-btn span,
.theme-changing .app-content {
    transition-property: background-color, border-color, color, box-shadow,
                         margin-right, width, transform !important;
    transition-duration: 0.3s !important;
}

[data-theme="dark"] body.ittihad-admin-app { background-color: var(--light-grey); }

[data-theme="dark"] .form-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .corp-table,
[data-theme="dark"] .table-wrapper,
[data-theme="dark"] .content-header span {
    background: var(--white);
    border-color: var(--border);
}

[data-theme="dark"] .corp-table th { background: #1f2937; }
[data-theme="dark"] .corp-table td { color: var(--text-main); }
[data-theme="dark"] .stat-card h3 { color: var(--text-muted); }
[data-theme="dark"] .stat-card .value { color: var(--text-main); }

[data-theme="dark"] .form-control {
    background: #21262d;
    color: var(--text-main);
    border-color: var(--border);
}
[data-theme="dark"] .form-control:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}
[data-theme="dark"] .form-group label { color: var(--text-muted); }
[data-theme="dark"] .checkbox-grid label { color: var(--text-main); }
[data-theme="dark"] .checkbox-grid label:hover { background: rgba(255,255,255,0.05); }

[data-theme="dark"] .badge-green  { background: #1a3328; color: #56d364; }
[data-theme="dark"] .badge-grey   { background: #21262d; color: #8b949e; }
[data-theme="dark"] .badge-red    { background: #3d1c1f; color: #f85149; }
[data-theme="dark"] .badge-yellow { background: #2d2208; color: #d29922; }
[data-theme="dark"] .badge-blue   { background: #0d2035; color: #58a6ff; }

[data-theme="dark"] .alert-success { background: #1a3328; color: #56d364; }
[data-theme="dark"] .alert-error   { background: #3d1c1f; color: #f85149; }
[data-theme="dark"] .alert-warning { background: #2d2208; color: #d29922; }

/* Edit modal dark */
/* Edit modal */
#ittihad-edit-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.ittihad-modal-panel {
    background: #fff;
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    width: min(90%, 500px);
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    direction: rtl;
    box-shadow: var(--shadow-lg);
}

.ittihad-modal-close {
    position: absolute;
    top: 12px;
    left: 12px;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
}

.ittihad-modal-close:hover {
    color: var(--vibrant-red);
}

#ittihad-modal-title {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--text-heading);
}

[data-theme="dark"] .ittihad-modal-panel {
    background: #1a2332;
    color: var(--text-main);
}
[data-theme="dark"] #ittihad-modal-title { color: var(--text-heading); }

/* Theme toggle button */
.theme-toggle-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: #b0bec5;
    cursor: pointer;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}
.theme-toggle-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--white);
    border-color: rgba(255,255,255,0.3);
}
/* In topbar (mobile) */
.app-topbar .theme-toggle-btn {
    border-color: rgba(255,255,255,0.2);
    padding: 6px 10px;
}
/* In sidebar footer */
.sidebar-theme-row {
    padding: var(--space-xs) var(--space-md) var(--space-sm);
    position: relative;
    z-index: 1;
}

/* ══════════════════════════════════════════════
   21. SKELETON LOADING
══════════════════════════════════════════════ */
.skeleton-row td { padding: 12px 16px; }
.skeleton-cell {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e8e8e8 25%, #f0f0f0 50%, #e8e8e8 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
[data-theme="dark"] .skeleton-cell {
    background: linear-gradient(90deg, #21262d 25%, #30363d 50%, #21262d 75%);
    background-size: 200% 100%;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-stat {
    height: 32px;
    border-radius: 6px;
    margin: 4px 0;
    background: linear-gradient(90deg, #e8e8e8 25%, #f0f0f0 50%, #e8e8e8 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
[data-theme="dark"] .skeleton-stat {
    background: linear-gradient(90deg, #21262d 25%, #30363d 50%, #21262d 75%);
    background-size: 200% 100%;
}

/* ══════════════════════════════════════════════
   22. COLLAPSIBLE SIDEBAR
══════════════════════════════════════════════ */
.app-sidebar {
    transition: width 0.3s cubic-bezier(0.4,0,0.2,1),
                transform var(--transition);
}
.app-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    overflow: visible;
}
.app-content {
    transition: margin-right 0.3s cubic-bezier(0.4,0,0.2,1),
                padding var(--transition);
}
.app-content.sidebar-collapsed { margin-right: var(--sidebar-collapsed-width); }

/* Hide text labels when collapsed */
.app-sidebar.collapsed .nav-label,
.app-sidebar.collapsed .app-brand-text,
.app-sidebar.collapsed .app-logout a span:last-child,
.app-sidebar.collapsed .pwa-install-btn,
.app-sidebar.collapsed .sidebar-theme-row .theme-label,
.app-sidebar.collapsed .app-brand > span {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    display: inline-block;
    transition: opacity 0.2s ease, width 0.3s ease;
}
.nav-label,
.app-brand-text,
.sidebar-theme-row .theme-label {
    transition: opacity 0.2s ease, width 0.3s ease;
    display: inline;
}

/* Center icons when collapsed */
.app-sidebar.collapsed .app-nav a {
    justify-content: center;
    padding: 14px 0;
}
.app-sidebar.collapsed .app-brand {
    padding: 20px 0;
    display: flex;
    justify-content: center;
}
.app-sidebar.collapsed .app-logout {
    padding: 12px 0;
    display: flex;
    justify-content: center;
}
.app-sidebar.collapsed .app-logout a {
    padding: 8px 0;
    justify-content: center;
}
.app-sidebar.collapsed .sidebar-geometry { display: none; }

/* Tooltip for collapsed nav items */
.app-sidebar.collapsed .app-nav a {
    position: relative;
    overflow: visible;
}
.app-sidebar.collapsed .app-nav a::after {
    content: attr(data-label);
    position: absolute;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: #1f282e;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 2000;
}
.app-sidebar.collapsed .app-nav a:hover::after { opacity: 1; }

/* Sidebar collapse toggle button */
.sidebar-collapse-btn {
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: var(--charcoal-black);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    z-index: 1001;
    transition: all var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.sidebar-collapse-btn:hover {
    background: var(--vibrant-red);
    border-color: var(--vibrant-red);
    color: #fff;
}
/* Only show on desktop */
@media (max-width: 768px) {
    .sidebar-collapse-btn { display: none !important; }
    .app-sidebar.collapsed { width: 100% !important; max-width: 320px; }
    .app-content,
    .app-content.sidebar-collapsed { margin-right: 0 !important; }
}

/* ══════════════════════════════════════════════
   23. MOBILE BOTTOM NAVIGATION + SIDEBAR DRAWER
   Modern phone-friendly navigation system
══════════════════════════════════════════════ */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    /* ─── TOP BAR ─── */
    .app-topbar .topbar-brand { font-size: 15px; }
    .app-topbar { z-index: 1000; }

    /* ─── BOTTOM NAV BAR ─── */
    .app-content {
        padding-bottom: calc(var(--bottom-nav-height, 62px) + 14px) !important;
    }

    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 62px;
        background: var(--charcoal-black);
        border-top: 1px solid rgba(255,255,255,0.08);
        z-index: 997;
        align-items: stretch;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.25);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    [data-theme="dark"] .mobile-bottom-nav {
        background: #0d1117;
        border-top-color: #30363d;
    }

    .mob-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        text-decoration: none;
        color: rgba(255,255,255,0.45);
        font-size: 10px;
        font-weight: 500;
        padding: 6px 2px;
        border: none;
        transition: color var(--transition);
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
        background: none;
        font-family: inherit;
        min-width: 0;
        position: relative;
    }
    .mob-nav-item .mob-icon {
        width: 22px;
        height: 22px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .mob-nav-item .mob-icon-svg {
        width: 20px;
        height: 20px;
    }
    .mob-nav-item .mob-label {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
        font-size: 9px;
        line-height: 1.2;
    }
    .mob-nav-item:active { transform: scale(0.92); }
    .mob-nav-item.active {
        color: var(--vibrant-red);
    }
    .mob-nav-item.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 25%;
        right: 25%;
        height: 2.5px;
        background: var(--vibrant-red);
        border-radius: 0 0 3px 3px;
    }

    /* ─── SIDEBAR AS FULL-SCREEN DRAWER ─── */
    .app-sidebar {
        display: flex !important;
        position: fixed;
        top: 0;
        right: 0;
        width: 100% !important;
        max-width: 320px;
        height: 100vh;
        height: 100dvh;
        z-index: 1100;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .app-sidebar.open {
        transform: translateX(0);
        box-shadow: -8px 0 30px rgba(0,0,0,0.3);
    }

    /* Sidebar overlay behind drawer */
    .sidebar-overlay {
        z-index: 1099;
    }

    /* ─── SIDEBAR INNER STYLING FOR MOBILE ─── */
    .app-sidebar .app-brand {
        padding: 24px 20px 18px;
        text-align: right;
    }
    .app-sidebar .app-brand h1 {
        font-size: 18px;
    }

    .app-sidebar .app-nav {
        padding: 8px 0;
        flex-grow: 1;
    }
    .app-sidebar .app-nav a {
        padding: 14px 20px;
        gap: 12px;
        font-size: 15px;
        border-right: none;
        border-radius: 0;
        margin: 0;
    }
    .app-sidebar .app-nav a .nav-icon {
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .app-sidebar .app-nav a .app-icon {
        width: 20px;
        height: 20px;
    }
    .app-sidebar .app-nav a:hover,
    .app-sidebar .app-nav a:active {
        background: rgba(255,255,255,0.08);
    }
    .app-sidebar .app-nav a.active {
        background: rgba(230,57,70,0.12);
        color: #fff;
        border-right: none;
        border-left: 3px solid var(--vibrant-red);
    }

    /* Close button inside drawer */
    .sidebar-close-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        position: absolute;
        top: 16px;
        left: 16px;
        background: rgba(255,255,255,0.1);
        border: none;
        border-radius: 50%;
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        z-index: 5;
        transition: background var(--transition);
    }
    .sidebar-close-mobile:active { background: rgba(255,255,255,0.2); }

    /* Hide collapse button on mobile */
    .sidebar-collapse-btn { display: none !important; }

    /* Logout at bottom */
    .app-sidebar .app-logout {
        padding: 12px 20px;
        margin-top: auto;
    }
    .app-sidebar .app-logout a {
        font-size: 15px;
        gap: 12px;
    }

    /* Theme row */
    .app-sidebar .sidebar-theme-row {
        padding: 8px 20px 14px;
    }

    /* PWA install */
    .app-sidebar .pwa-install-btn {
        padding: 12px 20px;
        font-size: 14px;
    }

    /* When sidebar is open */
    body.sidebar-open .mobile-bottom-nav { opacity: 0; pointer-events: none; }
    body.sidebar-open { overflow: hidden; }
}

/* ══════════════════════════════════════════════
   CONSISTENCY UTILITIES — View panels, pagination
══════════════════════════════════════════════ */

/* ─── Two-Panel Layout (form col + table col) ─── */
.view-panels {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-top: 0;
}
.view-panel-form {
    flex: 1;
    min-width: min(300px, 100%);
    margin-bottom: 0;
}
.view-table-col {
    flex: 2;
    min-width: 0;
    overflow-x: auto;
}

/* ─── Pagination ─── */
.pagination-wrap {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 16px;
    justify-content: center;
    align-items: center;
}
.page-link {
    display: inline-block;
    padding: 6px 13px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    background: var(--light-grey);
    color: var(--charcoal-black);
    border: 1px solid #d1d5db;
    transition: background 0.15s, color 0.15s;
    line-height: 1.4;
}
.page-link:hover {
    background: var(--charcoal-black);
    color: #fff;
    text-decoration: none;
}
.page-link.active {
    background: var(--charcoal-black);
    color: #fff;
    border-color: var(--charcoal-black);
    cursor: default;
}

/* ─── Page count info ─── */
.page-count {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 10px;
}

/* ─── Accounting note ─── */
.accounting-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
}

/* ─── Monthly summary box inside form card ─── */
.monthly-total-box {
    margin-top: 25px;
    padding-top: 18px;
    border-top: 1px dashed #ccc;
    text-align: center;
}
.monthly-total-box .monthly-label {
    font-size: 13px;
    color: var(--text-muted);
}
.monthly-total-box .monthly-value {
    margin: 5px 0 0;
    color: var(--vibrant-red);
    font-size: 22px;
    font-weight: 700;
    direction: ltr;
}

/* ─── Dark mode for new elements ─── */
[data-theme="dark"] .page-link {
    background: var(--sidebar-bg);
    color: var(--text-main);
    border-color: var(--border-color);
}
[data-theme="dark"] .page-link:hover,
[data-theme="dark"] .page-link.active {
    background: var(--vibrant-red);
    color: #fff;
    border-color: var(--vibrant-red);
}
[data-theme="dark"] .monthly-total-box {
    border-top-color: var(--border-color);
}
[data-theme="dark"] .summary-strip-danger {
    background: #2d1a1a;
    border-color: #5a2d2d;
}

/* ─── Poll cards ─── */
.poll-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}
.poll-card-header .poll-actions {
    white-space: nowrap;
    flex-shrink: 0;
}
.poll-option-wrap {
    margin-bottom: 8px;
}
.poll-option-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 3px;
    gap: 8px;
}
.poll-bar-track {
    background: #e9ecef;
    border-radius: 6px;
    height: 20px;
    overflow: hidden;
}
.poll-bar-fill {
    background: var(--vibrant-red);
    height: 100%;
    border-radius: 6px;
    transition: width .3s;
}
[data-theme="dark"] .poll-bar-track {
    background: var(--border-color);
}

/* ─── Dashboard mini-tables ─── */
.table-sm { font-size: 13px; }
.table-sm td { padding: 6px 8px; }
.text-ltr { text-align: left; direction: ltr; }
.view-link-sm {
    display: block;
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    color: var(--vibrant-red);
    text-decoration: none;
}
.view-link-sm:hover { text-decoration: underline; }

/* ─── Mobile responsive for new layouts ─── */
@media (max-width: 768px) {
    .view-panels {
        flex-direction: column;
        gap: 16px;
    }
    .view-panel-form,
    .view-table-col {
        width: 100%;
        min-width: 0;
    }
    .filter-row {
        flex-wrap: wrap;
    }
    .filter-row > div,
    .filter-row > .form-group {
        min-width: 140px;
    }
    .pagination-wrap {
        gap: 4px;
    }
    .page-link {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* ══════════════════════════════════════════════
   Dashboard — Modern Redesign
══════════════════════════════════════════════ */

/* Header bar with month badge */
.dash-content-header { flex-wrap: wrap; gap: 6px 16px; align-items: baseline; }
.dash-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dash-month-badge {
    background: var(--charcoal-black);
    color: #fff;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ── Stat grid: 3-col desktop, 2-col tablet, 2-col phone ── */
.dash-stats-grid {
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: var(--space-sm);
}
/* Flex layout inside each card: icon + text body */
.dash-stats-grid .stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: none;
    border-right: 4px solid var(--charcoal-black);
    padding: 18px var(--space-md);
}
/* Hide old h3 that is replaced by .sc-label */
.dash-stats-grid .stat-card > h3 { display: none; }
.sc-icon {
    font-size: 30px;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.65;
    user-select: none;
    transition: opacity var(--transition);
}
.dash-stats-grid .stat-card:hover .sc-icon { opacity: 1; }
.sc-body { flex: 1; min-width: 0; }
.sc-label {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 4px;
    line-height: 1.3;
}
.sc-value {
    font-size: clamp(20px, 2.6vw, 28px);
    font-weight: 700;
    margin: 0 0 3px;
    line-height: 1.1;
    color: var(--charcoal-black);
}
.sc-sub { font-size: 12px; margin: 0; line-height: 1.4; }

/* Accent border-right colors per card type */
.sc-blue   { border-right-color: #3b82f6 !important; }
.sc-purple { border-right-color: #8b5cf6 !important; }
.sc-green  { border-right-color: var(--success) !important; }
.sc-red    { border-right-color: var(--vibrant-red) !important; }
/* Fix old classes that added border-top (conflicted with base border-bottom) */
.dash-stats-grid .stat-accent-success {
    border-top: none;
    border-right-color: var(--success) !important;
}
.dash-stats-grid .stat-accent-danger {
    border-top: none;
    border-right-color: var(--vibrant-red) !important;
}

/* ── Collection rate progress bar ── */
.collect-bar-wrap {
    background: var(--white);
    border-radius: var(--radius);
    padding: var(--space-sm) var(--space-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-md);
}
.collect-bar-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--fs-sm);
    margin-bottom: 8px;
}
.collect-bar-track {
    background: #e9ecef;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}
.collect-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(to left, #34d399, var(--success));
    transition: width .8s cubic-bezier(.4, 0, .2, 1);
    min-width: 4px;
}
.collect-bar-fill.bar-danger {
    background: linear-gradient(to left, #f87171, var(--vibrant-red));
}
.collect-bar-sub {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ── Bottom panels: 2-col grid, equal height ── */
.dash-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}
.dash-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--border-faint);
}
.dash-panel-icon { font-size: 18px; line-height: 1; }
.dash-panel-title { font-size: 14px; font-weight: 700; margin: 0; }

/* ── Quick-action shortcuts row ── */
.dash-shortcuts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.dash-shortcut {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px var(--space-xs);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
    text-align: center;
    border: 1px solid var(--border);
}
.dash-shortcut:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    background: var(--charcoal-black);
    color: #fff;
    border-color: var(--charcoal-black);
}
.dash-shortcut .sc-shortcut-icon { font-size: 24px; line-height: 1; }

/* ── Dark mode ── */
[data-theme="dark"] .collect-bar-wrap,
[data-theme="dark"] .dash-shortcut     { background: var(--sidebar-bg); border-color: var(--border); }
[data-theme="dark"] .collect-bar-track { background: rgba(255,255,255,0.10); }
[data-theme="dark"] .dash-panel-header { border-bottom-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .dash-month-badge  { background: var(--charcoal-dark); }
[data-theme="dark"] .sc-value          { color: var(--text-main); }
[data-theme="dark"] .dash-shortcut:hover { background: var(--charcoal-black); border-color: var(--charcoal-black); }

/* ── Responsive ── */
@media (max-width: 1024px) {
    .dash-stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 680px) {
    .dash-stats-grid  { grid-template-columns: repeat(2, 1fr); }
    .dash-panels      { grid-template-columns: 1fr; }
    .dash-shortcuts   { grid-template-columns: repeat(2, 1fr); }
    .sc-icon          { font-size: 24px; }
    .sc-value         { font-size: 20px !important; }
    .dash-stats-grid .stat-card { padding: 14px 12px; gap: 10px; }
}
@media (max-width: 360px) {
    .dash-stats-grid  { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════
   Buildings View — Card Grid
══════════════════════════════════════════════ */
.buildings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-md);
}
.building-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform var(--transition), box-shadow var(--transition);
    border-top: 3px solid var(--charcoal-black);
}
.building-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.building-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.building-avatar {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    background: var(--charcoal-black);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: -1px;
}
.building-info { flex: 1; min-width: 0; }
.building-name {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 3px;
    color: var(--text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.building-address {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.building-stats {
    display: flex;
    gap: 0;
    border-top: 1px solid var(--border-faint);
    border-bottom: 1px solid var(--border-faint);
    padding: 10px 0;
}
.bld-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    border-left: 1px solid var(--border-faint);
}
.bld-stat:last-child { border-left: none; }
.bld-stat-num {
    font-size: 20px;
    font-weight: 700;
    color: var(--charcoal-black);
    line-height: 1;
}
.bld-stat-lbl {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    font-weight: 500;
}
.building-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: auto;
}
.building-actions {
    display: flex;
    gap: 8px;
}
.building-actions .btn-secondary,
.building-actions .btn-danger {
    flex: 1;
    text-align: center;
    justify-content: center;
    font-size: 13px;
    padding: 8px 6px;
}

/* Empty state */
.buildings-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px var(--space-md);
    color: var(--text-muted);
}
.buildings-empty .empty-icon { font-size: 48px; display: block; margin-bottom: 10px; }
.buildings-empty p { margin: 4px 0 0; font-size: 14px; }

/* Dark mode */
[data-theme="dark"] .building-card {
    background: var(--sidebar-bg);
    border-top-color: var(--vibrant-red);
}
[data-theme="dark"] .building-avatar { background: var(--charcoal-dark); }
[data-theme="dark"] .bld-stat-num    { color: var(--text-main); }

/* Responsive */
@media (max-width: 680px) {
    .buildings-grid { grid-template-columns: 1fr; }
}

/* ==============================================
   SERVICES & PRICING TAB
   ============================================== */

/* Building switcher pills */
.building-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: var(--space-md);
}
.building-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border-radius: 20px;
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: 1.5px solid var(--border-faint);
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    white-space: nowrap;
}
.building-pill:hover {
    background: var(--charcoal-black);
    color: #fff;
    border-color: var(--charcoal-black);
}
.building-pill.active {
    background: var(--charcoal-black);
    color: #fff;
    border-color: var(--charcoal-black);
}

/* Services card grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-md);
}
.service-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform var(--transition), box-shadow var(--transition);
    border-right: 3px solid var(--success);
}
.service-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.service-card-top   { display: flex; align-items: center; gap: 10px; }
.service-icon {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: #e8f5e9;
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.service-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.4;
    margin: 0;
    flex: 1;
}
.service-amount-wrap {
    text-align: center;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    padding: 10px;
}
.service-amount-num {
    font-size: 26px;
    font-weight: 800;
    color: var(--success);
    line-height: 1;
}
.service-amount-lbl {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}
.service-actions { display: flex; gap: 8px; }
.service-actions .btn-secondary,
.service-actions .btn-danger {
    flex: 1;
    text-align: center;
    justify-content: center;
    font-size: 13px;
    padding: 8px 6px;
}
.services-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px var(--space-md);
    color: var(--text-muted);
}
.services-empty .empty-icon { font-size: 48px; display: block; margin-bottom: 10px; }

/* Dark mode – services */
[data-theme="dark"] .service-card        { background: var(--sidebar-bg); }
[data-theme="dark"] .service-icon        { background: rgba(76,175,80,0.15); }
[data-theme="dark"] .service-amount-wrap { background: var(--charcoal-dark); }
[data-theme="dark"] .building-pill.active,
[data-theme="dark"] .building-pill:hover {
    background: var(--charcoal-dark);
    border-color: var(--text-muted);
    color: var(--text-main);
}

/* Responsive – services */
@media (max-width: 680px) {
    .services-grid  { grid-template-columns: 1fr; }
    .building-pills { gap: 6px; }
}

/* ==============================================
   UNITS TAB
   ============================================== */

/* Units card grid */
.units-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-md);
}

/* Status-tinted left border */
.unit-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform var(--transition), box-shadow var(--transition);
    border-right: 3px solid var(--border-faint);
}
.unit-card:hover                { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.unit-card.status-occupied      { border-right-color: var(--success); }
.unit-card.status-closed        { border-right-color: #9e9e9e; }
.unit-card.status-exempted      { border-right-color: #f59e0b; }

/* Top row: badge + info */
.unit-card-top { display: flex; align-items: flex-start; gap: 12px; }
.unit-num-badge {
    min-width: 48px;
    padding: 0 6px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--charcoal-black);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}
.unit-info         { flex: 1; min-width: 0; }
.unit-info-name    { font-size: 14px; font-weight: 700; color: var(--text-heading); margin: 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-info-sub     { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Monthly fee block */
.unit-fee-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
}
.unit-fee-num { font-size: 22px; font-weight: 800; color: var(--charcoal-black); line-height: 1; }
.unit-fee-lbl { font-size: 11px; color: var(--text-muted); }

/* Cards meta line */
.unit-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 8px; flex-wrap: wrap; }
.unit-meta span { display: flex; align-items: center; gap: 3px; }

/* Action row */
.unit-actions { display: flex; gap: 8px; margin-top: auto; }
.unit-actions .btn-secondary,
.unit-actions .btn-danger {
    flex: 1;
    text-align: center;
    justify-content: center;
    font-size: 13px;
    padding: 8px 6px;
}

/* Empty state */
.units-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px var(--space-md);
    color: var(--text-muted);
}
.units-empty .empty-icon { font-size: 48px; display: block; margin-bottom: 10px; }

/* Dark mode – units */
[data-theme="dark"] .unit-card      { background: var(--sidebar-bg); }
[data-theme="dark"] .unit-num-badge { background: var(--charcoal-dark); }
[data-theme="dark"] .unit-fee-row   { background: var(--charcoal-dark); }
[data-theme="dark"] .unit-fee-num   { color: var(--text-main); }

/* Responsive – units */
@media (max-width: 680px) {
    .units-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
    .units-grid { grid-template-columns: 1fr; }
}

/* ==============================================
   RESIDENTS TAB
   ============================================== */

.residents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-md);
}

.resident-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform var(--transition), box-shadow var(--transition);
    border-top: 3px solid var(--charcoal-black);
}
.resident-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.resident-card.role-owner  { border-top-color: var(--charcoal-black); }
.resident-card.role-tenant { border-top-color: #2196f3; }

/* Avatar + name row */
.resident-card-top { display: flex; align-items: center; gap: 12px; }
.resident-avatar {
    width: 46px; height: 46px;
    border-radius: 50%;
    background: var(--charcoal-black);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}
.resident-card.role-tenant .resident-avatar { background: #2196f3; }
.resident-info         { flex: 1; min-width: 0; }
.resident-name         { font-size: 15px; font-weight: 700; color: var(--text-heading); margin: 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resident-role-badge   { /* uses existing .badge classes */ }

/* Unit location row */
.resident-unit-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 13px;
    color: var(--text-main);
    font-weight: 600;
}
.resident-unit-row .unit-icon { font-size: 16px; flex-shrink: 0; }

/* Meta rows */
.resident-meta { display: flex; flex-direction: column; gap: 4px; }
.resident-meta-row { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.resident-meta-row a { color: var(--text-muted); text-decoration: none; }
.resident-meta-row a:hover { color: var(--charcoal-black); }

/* Actions */
.resident-actions { display: flex; gap: 8px; margin-top: auto; }
.resident-actions .btn-secondary,
.resident-actions .btn-danger {
    flex: 1;
    text-align: center;
    justify-content: center;
    font-size: 13px;
    padding: 8px 6px;
}

/* Empty state */
.residents-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px var(--space-md);
    color: var(--text-muted);
}
.residents-empty .empty-icon { font-size: 48px; display: block; margin-bottom: 10px; }

/* Dark mode – residents */
[data-theme="dark"] .resident-card         { background: var(--sidebar-bg); }
[data-theme="dark"] .resident-card.role-owner .resident-avatar  { background: var(--charcoal-dark); }
[data-theme="dark"] .resident-unit-row      { background: var(--charcoal-dark); }

/* Responsive – residents */
@media (max-width: 680px) {
    .residents-grid { grid-template-columns: 1fr; }
}

/* ==============================================
   PAYMENTS (COLLECTIONS) TAB
   ============================================== */

/* Payment item list */
.payments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.payment-item {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px var(--space-md);
    transition: box-shadow var(--transition);
    border-right: 3px solid var(--success);
}
.payment-item.is-reversal {
    border-right-color: #f59e0b;
    background: #fffbeb;
}
.payment-item:hover { box-shadow: var(--shadow-md); }

/* Amount blob */
.py-amount {
    min-width: 90px;
    text-align: center;
    flex-shrink: 0;
}
.py-amount-num {
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    color: var(--success);
}
.payment-item.is-reversal .py-amount-num { color: #d97706; }
.py-amount-lbl {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* Divider line */
.py-divider {
    width: 1px;
    height: 40px;
    background: var(--border-faint);
    flex-shrink: 0;
}

/* Unit info section */
.py-unit-info { flex: 1; min-width: 0; }
.py-unit-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 3px;
}
.py-unit-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}
.py-unit-meta .badge { font-size: 11px; }

/* Right side: method + action */
.py-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

/* Filter bar inside right col */
.payments-filter {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}
.payments-filter .filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}
.payments-filter .form-group { flex: 1; min-width: 130px; margin-bottom: 0; }
.payments-filter .filter-actions { display: flex; gap: 6px; align-items: flex-end; }

/* Summary bar */
.payments-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-muted);
}
.payments-summary strong { color: var(--text-heading); }

/* Empty */
.payments-empty {
    text-align: center;
    padding: 40px var(--space-md);
    color: var(--text-muted);
}
.payments-empty .empty-icon { font-size: 48px; display: block; margin-bottom: 10px; }

/* Dark mode – payments */
[data-theme="dark"] .payment-item           { background: var(--sidebar-bg); }
[data-theme="dark"] .payment-item.is-reversal { background: rgba(245,158,11,0.08); }
[data-theme="dark"] .payments-filter        { background: var(--sidebar-bg); }

/* Responsive – payments */
@media (max-width: 680px) {
    .payment-item      { flex-wrap: wrap; gap: 10px; }
    .py-divider        { display: none; }
    .py-amount         { min-width: 70px; }
    .py-right          { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
    .payments-filter .form-group { min-width: calc(50% - 5px); }
}

/* ==============================================
   EXPENSES TAB
   ============================================== */

/* Expense list (same pattern as payments-list) */
.expenses-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.expense-item {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px var(--space-md);
    transition: box-shadow var(--transition);
    border-right: 3px solid var(--vibrant-red);
}
.expense-item:hover { box-shadow: var(--shadow-md); }

/* Amount blob */
.ex-amount {
    min-width: 90px;
    text-align: center;
    flex-shrink: 0;
}
.ex-amount-num {
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    color: var(--vibrant-red);
}
.ex-amount-lbl {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* Divider */
.ex-divider {
    width: 1px;
    height: 40px;
    background: var(--border-faint);
    flex-shrink: 0;
}

/* Info section */
.ex-info     { flex: 1; min-width: 0; }
.ex-category {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ex-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Right: building badge + delete */
.ex-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

/* Filter bar – reuses payments-filter, no extra class needed */

/* Monthly total box upgrade: already exists via .monthly-total-box */

/* Category badge colours */
.badge-salary   { background: #e8f5e9; color: #2e7d32; }
.badge-maint    { background: #e3f2fd; color: #1565c0; }
.badge-utility  { background: #fff8e1; color: #856404; }
.badge-clean    { background: #f3e5f5; color: #6a1b9a; }
.badge-repair   { background: #fce4ec; color: #ad1457; }
.badge-misc     { background: #f0f0f0; color: #555; }

/* Expenses summary */
.expenses-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-muted);
}
.expenses-summary strong { color: var(--text-heading); }

/* Empty */
.expenses-empty {
    text-align: center;
    padding: 40px var(--space-md);
    color: var(--text-muted);
}
.expenses-empty .empty-icon { font-size: 48px; display: block; margin-bottom: 10px; }

/* Dark mode – expenses */
[data-theme="dark"] .expense-item   { background: var(--sidebar-bg); }
[data-theme="dark"] .badge-salary   { background: #1a3328; color: #56d364; }
[data-theme="dark"] .badge-maint    { background: #0d2035; color: #58a6ff; }
[data-theme="dark"] .badge-utility  { background: #2d2208; color: #d29922; }
[data-theme="dark"] .badge-clean    { background: #2d1b35; color: #ce93d8; }
[data-theme="dark"] .badge-repair   { background: #3d1020; color: #f48fb1; }
[data-theme="dark"] .badge-misc     { background: #21262d; color: #8b949e; }

/* Responsive – expenses */
@media (max-width: 680px) {
    .expense-item { flex-wrap: wrap; gap: 10px; }
    .ex-divider   { display: none; }
    .ex-amount    { min-width: 70px; }
    .ex-right     { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
}

/* ==============================================
   ADJUSTMENTS TAB
   ============================================== */

/* Adjustment list (card-based, same pattern as payments-list) */
.adjustments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.adjustment-item {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px var(--space-md);
    transition: box-shadow var(--transition), opacity 0.3s, transform 0.3s;
}
.adjustment-item:hover { box-shadow: var(--shadow-md); }
.adjustment-item.is-credit  { border-right: 3px solid var(--success); }
.adjustment-item.is-debit   { border-right: 3px solid var(--vibrant-red); }

/* Amount blob */
.adj-amount {
    min-width: 90px;
    text-align: center;
    flex-shrink: 0;
}
.adj-amount-num {
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
}
.adjustment-item.is-credit .adj-amount-num { color: var(--success); }
.adjustment-item.is-debit  .adj-amount-num { color: var(--vibrant-red); }
.adj-amount-lbl {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* Divider line */
.adj-divider {
    width: 1px;
    height: 48px;
    background: var(--border-faint);
    flex-shrink: 0;
}

/* Info section */
.adj-info { flex: 1; min-width: 0; }
.adj-resident-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.adj-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.adj-reason {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Right side: badge + delete */
.adj-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}
.adj-delete-btn {
    font-size: 11px !important;
    padding: 5px 10px !important;
}

/* Dark mode – adjustments */
[data-theme="dark"] .adjustment-item { background: var(--sidebar-bg); }
[data-theme="dark"] .adj-reason { color: #8b949e; }

/* Responsive – adjustments */
@media (max-width: 680px) {
    .adjustment-item { flex-wrap: wrap; gap: 10px; }
    .adj-divider     { display: none; }
    .adj-amount      { min-width: 70px; }
    .adj-right       { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
}

/* ==============================================
   REPORTS TAB
   ============================================== */

/* Month picker bar */
.report-filter {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 14px var(--space-md);
    margin-bottom: var(--space-md);
}
.report-filter .form-group { margin-bottom: 0; }

/* P&L stat cards grid */
.pnl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}
.pnl-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 3px solid var(--border-faint);
}
.pnl-card.pnl-expected  { border-top-color: #2196f3; }
.pnl-card.pnl-collected { border-top-color: var(--success); }
.pnl-card.pnl-expenses  { border-top-color: var(--vibrant-red); }
.pnl-card.pnl-net       { border-top-color: var(--charcoal-black); }
.pnl-icon {
    font-size: 22px;
    line-height: 1;
}
.pnl-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.pnl-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    color: var(--text-heading);
}
.pnl-card.pnl-collected .pnl-value { color: var(--success); }
.pnl-card.pnl-expenses  .pnl-value { color: var(--vibrant-red); }
.pnl-card.pnl-net       .pnl-value.positive  { color: var(--success); }
.pnl-card.pnl-net       .pnl-value.negative  { color: var(--vibrant-red); }
.pnl-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Collection rate bar */
.pnl-rate-wrap {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}
.pnl-rate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-heading);
}
.pnl-rate-track {
    height: 12px;
    background: var(--border-faint);
    border-radius: 6px;
    overflow: hidden;
}
.pnl-rate-fill {
    height: 100%;
    border-radius: 6px;
    background: var(--success);
    transition: width 0.6s ease;
}
.pnl-rate-fill.danger { background: var(--vibrant-red); }

/* Debtor cards list */
.debtor-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.debtor-item {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px var(--space-md);
    border-right: 3px solid var(--vibrant-red);
    transition: box-shadow var(--transition);
}
.debtor-item:hover { box-shadow: var(--shadow-md); }

.dbt-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fdecea;
    color: var(--vibrant-red);
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dbt-info     { flex: 1; min-width: 0; }
.dbt-unit     { font-size: 14px; font-weight: 700; color: var(--text-heading); margin: 0 0 3px; }
.dbt-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    align-items: center;
}
.dbt-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}
.dbt-amount {
    font-size: 18px;
    font-weight: 800;
    color: var(--vibrant-red);
    line-height: 1;
}
.dbt-amount-lbl { font-size: 10px; color: var(--text-muted); }

/* Debtors summary stats */
.debtors-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}
.debtors-stat-card {
    background: #fdecea;
    border-radius: var(--radius);
    padding: var(--space-md);
    text-align: center;
}
.debtors-stat-num   { font-size: 28px; font-weight: 800; color: var(--vibrant-red); line-height: 1; }
.debtors-stat-lbl   { font-size: 12px; color: #b71c1c; margin-top: 4px; font-weight: 600; }

/* No debtors state */
.debtors-clear {
    text-align: center;
    padding: 40px var(--space-md);
    color: var(--success);
}
.debtors-clear .clear-icon { font-size: 48px; display: block; margin-bottom: 10px; }

/* Dark mode – reports */
[data-theme="dark"] .pnl-card          { background: var(--sidebar-bg); }
[data-theme="dark"] .pnl-rate-wrap     { background: var(--sidebar-bg); }
[data-theme="dark"] .debtor-item       { background: var(--sidebar-bg); }
[data-theme="dark"] .dbt-rank          { background: rgba(211,47,47,0.2); }
[data-theme="dark"] .debtors-stat-card { background: rgba(211,47,47,0.15); }
[data-theme="dark"] .debtors-stat-num  { color: #f48fb1; }
[data-theme="dark"] .debtors-stat-lbl  { color: #ef9a9a; }
[data-theme="dark"] .report-filter     { background: var(--sidebar-bg); }

/* Responsive – reports */
@media (max-width: 680px) {
    .pnl-grid       { grid-template-columns: 1fr 1fr; }
    .debtors-stats  { grid-template-columns: 1fr 1fr; }
    .debtor-item    { flex-wrap: wrap; gap: 10px; }
    .dbt-right      { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
}
@media (max-width: 420px) {
    .pnl-grid       { grid-template-columns: 1fr; }
}

/* ==============================================
   COMPLAINTS & SUGGESTIONS TAB
   ============================================== */

/* Complaint card list */
.complaints-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.complaint-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow var(--transition);
    border-right: 3px solid var(--border-faint);
}
.complaint-card:hover { box-shadow: var(--shadow-md); }
.complaint-card.type-complaint  { border-right-color: var(--vibrant-red); }
.complaint-card.type-suggestion { border-right-color: #2196f3; }

/* Card header row */
.cmp-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}
.cmp-header-info { flex: 1; min-width: 0; }
.cmp-subject {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0 0 4px;
}
.cmp-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    align-items: center;
}
.cmp-header-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-items: flex-start;
}

/* Message body */
.cmp-message {
    font-size: 13px;
    color: var(--text-main);
    line-height: 1.6;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

/* Admin reply bubble */
.cmp-reply {
    font-size: 12px;
    background: #e8f5e9;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: #2e7d32;
    border-right: 3px solid var(--success);
}
.cmp-reply strong { display: block; margin-bottom: 3px; font-size: 11px; }

/* Inline reply form */
.cmp-reply-form {
    display: none;
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-faint);
}
.cmp-reply-form.open { display: flex; }
.cmp-reply-form .form-control { font-size: 13px; }

/* Card actions */
.cmp-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.cmp-actions .btn-secondary,
.cmp-actions .btn-danger {
    font-size: 12px;
    padding: 6px 12px;
}

/* Filter bar */
.complaints-filter {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 14px var(--space-md);
    margin-bottom: var(--space-md);
}
.complaints-filter .filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}
.complaints-filter .form-group { flex: 1; min-width: 130px; margin-bottom: 0; }

/* Count summary */
.complaints-summary {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Empty state */
.complaints-empty {
    text-align: center;
    padding: 40px var(--space-md);
    color: var(--text-muted);
}
.complaints-empty .empty-icon { font-size: 48px; display: block; margin-bottom: 10px; }

/* Dark mode – complaints */
[data-theme="dark"] .complaint-card   { background: var(--sidebar-bg); }
[data-theme="dark"] .cmp-message      { background: var(--charcoal-dark); }
[data-theme="dark"] .cmp-reply        { background: rgba(46,125,50,0.15); color: #56d364; border-right-color: #56d364; }
[data-theme="dark"] .complaints-filter { background: var(--sidebar-bg); }

/* Responsive – complaints */
@media (max-width: 680px) {
    .cmp-header   { flex-direction: column; }
    .cmp-header-badges { align-self: flex-start; }
}

/* ==============================================
   RULES & TERMS TAB
   ============================================== */

/* Category group header */
.rules-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: var(--space-md) 0 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--charcoal-black);
}
.rules-category-label {
    font-size: 14px;
    font-weight: 800;
    color: var(--charcoal-black);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.rules-category-count {
    font-size: 12px;
    background: var(--charcoal-black);
    color: #fff;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

/* Rules stack */
.rules-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 6px;
}

.rule-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 14px var(--space-md);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: box-shadow var(--transition);
    border-right: 3px solid var(--charcoal-black);
}
.rule-card.inactive  { border-right-color: #9e9e9e; opacity: 0.7; }
.rule-card:hover     { box-shadow: var(--shadow-md); }

/* Sort order badge */
.rule-order {
    min-width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Body */
.rule-body   { flex: 1; min-width: 0; }
.rule-title  { font-size: 14px; font-weight: 700; color: var(--text-heading); margin: 0 0 4px; }
.rule-content {
    font-size: 13px;
    color: var(--text-main);
    line-height: 1.7;
    margin: 0;
    white-space: pre-wrap;
}

/* Actions */
.rule-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.rule-actions .btn-secondary,
.rule-actions .btn-danger {
    font-size: 12px;
    padding: 5px 10px;
    white-space: nowrap;
}

/* Empty state */
.rules-empty {
    text-align: center;
    padding: 40px var(--space-md);
    color: var(--text-muted);
}
.rules-empty .empty-icon { font-size: 48px; display: block; margin-bottom: 10px; }

/* Dark mode – rules */
[data-theme="dark"] .rule-card              { background: var(--sidebar-bg); }
[data-theme="dark"] .rule-order             { background: var(--charcoal-dark); }
[data-theme="dark"] .rules-category-header  { border-bottom-color: var(--text-muted); }
[data-theme="dark"] .rules-category-label   { color: var(--text-main); }
[data-theme="dark"] .rules-category-count   { background: var(--charcoal-dark); color: var(--text-main); }

/* Responsive – rules */
@media (max-width: 680px) {
    .rule-card    { flex-wrap: wrap; }
    .rule-actions { flex-direction: row; width: 100%; justify-content: flex-start; }
}

/* ==============================================
   POLLS TAB
   ============================================== */

.polls-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Main poll card */
.poll-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition);
}
.poll-card:hover { box-shadow: var(--shadow-md); }
.poll-card.poll-closed { opacity: 0.75; }

/* Header strip */
.poll-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px var(--space-md);
    border-bottom: 1px solid var(--border-faint);
}
.poll-card-info   { flex: 1; min-width: 0; }
.poll-card-title  { font-size: 15px; font-weight: 700; color: var(--text-heading); margin: 0 0 4px; }
.poll-card-desc   { font-size: 13px; color: var(--text-muted); margin: 0 0 6px; }
.poll-card-meta   { font-size: 12px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Actions cluster */
.poll-card-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.poll-card-actions a {
    font-size: 12px;
    padding: 5px 12px;
    white-space: nowrap;
}

/* Total votes chip */
.poll-votes-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-main);
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
}

/* Options / results */
.poll-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px var(--space-md);
}

.poll-opt {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.poll-opt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-main);
}
.poll-opt-label  { font-weight: 600; }
.poll-opt-stat   { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* Progress bar */
.poll-bar-track {
    height: 6px;
    background: var(--bg-main);
    border-radius: 99px;
    overflow: hidden;
}
.poll-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--vibrant-red), #e05c6a);
    border-radius: 99px;
    transition: width 0.5s ease;
    min-width: 2px;
}
.poll-card.poll-closed .poll-bar-fill { background: linear-gradient(90deg, #9e9e9e, #bdbdbd); }

/* Winning option highlight */
.poll-opt.poll-winner .poll-opt-label  { color: var(--vibrant-red); }
.poll-opt.poll-winner .poll-bar-fill   { background: linear-gradient(90deg, #1a8a4a, #24b862); }
.poll-card.poll-closed .poll-opt.poll-winner .poll-bar-fill { background: linear-gradient(90deg, #1a8a4a, #24b862); }

/* Empty state */
.polls-empty {
    text-align: center;
    padding: 48px var(--space-md);
    color: var(--text-muted);
}
.polls-empty .empty-icon { font-size: 52px; display: block; margin-bottom: 10px; }

/* Dark mode – polls */
[data-theme="dark"] .poll-card        { background: var(--sidebar-bg); }
[data-theme="dark"] .poll-votes-chip  { background: var(--charcoal-dark); }
[data-theme="dark"] .poll-bar-track   { background: var(--charcoal-dark); }

/* Responsive – polls */
@media (max-width: 680px) {
    .poll-card-head    { flex-wrap: wrap; }
    .poll-card-actions { flex-direction: row; width: 100%; justify-content: flex-start; }
}

/* ==============================================
   SETTINGS TAB
   ============================================== */

/* Scrollable sub-tabs on mobile */
.settings-tabs-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: var(--space-md);
}
.settings-tabs-wrap::-webkit-scrollbar { display: none; }
.settings-tabs-wrap .tabs-row {
    min-width: max-content;
    margin-bottom: 0;
}

/* Subscription — stat cards */
.sub-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin: 16px 0;
}
.sub-stat-card {
    background: var(--bg-main);
    border-radius: var(--radius);
    padding: 14px 12px;
    text-align: center;
}
.sub-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 5px;
}
.sub-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.3;
}

/* Subscription — usage cards */
.sub-usage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
}
.sub-usage-card {
    background: var(--bg-main);
    border-radius: var(--radius);
    padding: 14px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.sub-usage-icon  { font-size: 22px; }
.sub-usage-count { font-size: 22px; font-weight: 700; color: var(--text-heading); }
.sub-usage-label { font-size: 12px; color: var(--text-muted); }

/* License key display */
.license-key-display {
    margin-top: 14px;
    padding: 12px;
    background: var(--bg-main);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.license-key-display code {
    letter-spacing: 1px;
    color: var(--text-heading);
    font-family: monospace;
}

/* Pricing cards */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.pricing-card {
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 24px 20px;
    text-align: center;
    position: relative;
    background: var(--white);
    transition: box-shadow var(--transition);
}
.pricing-card:hover             { box-shadow: var(--shadow-md); }
.pricing-card--yearly {
    border-color: #7c3aed;
    background: linear-gradient(180deg, #faf5ff 0%, var(--white) 100%);
    box-shadow: 0 4px 20px rgba(124,58,237,0.10);
}
.pricing-card--first {
    border-color: #059669;
    background: linear-gradient(180deg, #ecfdf5 0%, var(--white) 100%);
    box-shadow: 0 4px 20px rgba(5,150,105,0.10);
}
.pricing-badge {
    position: absolute;
    top: -13px;
    right: 50%;
    transform: translateX(50%);
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}
.pricing-badge--yearly { background: #7c3aed; }
.pricing-badge--first  { background: linear-gradient(135deg, #059669, #10b981); }
.pricing-icon   { font-size: 28px; margin-bottom: 8px; display: block; }
.pricing-title  { font-size: 16px; font-weight: 700; color: var(--text-heading); margin: 0 0 4px; }
.pricing-amount {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    margin: 12px 0 4px;
}
.pricing-amount--monthly { color: #2563eb; }
.pricing-amount--yearly  { color: #7c3aed; }
.pricing-amount--first   { color: #059669; }
.pricing-period          { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.pricing-sub             { font-size: 13px; margin: 0 0 4px; }
.pricing-sub--save       { color: #059669; font-weight: 600; }
.pricing-sub--muted      { color: var(--text-muted); font-size: 12px; }
.pricing-sub--danger     { color: var(--vibrant-red); font-weight: 600; }
.pricing-features {
    text-align: right;
    list-style: none;
    padding: 0;
    margin: 14px 0;
    font-size: 13px;
    color: var(--text-main);
}
.pricing-features li {
    padding: 7px 0;
    border-bottom: 1px solid var(--border-faint);
}
.pricing-features li:last-child { border-bottom: none; }

/* Settings form stack */
.settings-form-wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.settings-form-wrap .form-card { margin-top: 0 !important; }

/* Save bar */
.settings-save-bar {
    padding-top: 4px;
    display: flex;
    justify-content: flex-end;
}

/* Dark mode – settings */
[data-theme="dark"] .sub-stat-card        { background: var(--charcoal-dark); }
[data-theme="dark"] .sub-usage-card       { background: var(--charcoal-dark); }
[data-theme="dark"] .license-key-display  { background: var(--charcoal-dark); }
[data-theme="dark"] .pricing-card         { background: var(--sidebar-bg); }
[data-theme="dark"] .pricing-card--yearly { background: #1a0f30; border-color: #7c3aed; }
[data-theme="dark"] .pricing-card--first  { background: #061510; border-color: #059669; }

/* Responsive – settings */
@media (max-width: 680px) {
    .pricing-grid                   { grid-template-columns: 1fr; }
    .settings-save-bar              { justify-content: stretch; }
    .settings-save-bar .btn-primary { width: 100%; text-align: center; }
}

/* ==============================================
   BOARD MEMBERS (ADMIN)
   ============================================== */

.board-members-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.board-member-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e8e8e8);
    border-radius: 10px;
    padding: 14px 16px;
    transition: box-shadow 0.2s;
}
.board-member-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.board-member-card.inactive {
    opacity: 0.55;
}

.board-member-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2d3a42, #3d4f5f);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.board-member-info {
    flex: 1;
    min-width: 0;
}

.board-member-name {
    margin: 0 0 4px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text, #2d3a42);
    display: flex;
    align-items: center;
    gap: 6px;
}

.board-member-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted, #888);
    align-items: center;
}

.board-member-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.board-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted, #888);
}
.board-empty .empty-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 10px;
}

@media (max-width: 600px) {
    .board-member-card {
        flex-wrap: wrap;
        gap: 10px;
    }
    .board-member-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ==============================================
   BOARD MEMBERS (RESIDENT PORTAL)
   ============================================== */

.portal-board-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.portal-board-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    background: #fafafa;
    transition: 0.15s;
}
.portal-board-item:hover {
    background: #f0f0f0;
}

.portal-board-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2d3a42, #3d4f5f);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}

.portal-board-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.portal-board-name {
    font-weight: 600;
    font-size: 14px;
    color: #2d3a42;
}

.portal-board-role {
    font-size: 12px;
    color: #888;
}

/* ══════════════════════════════════════════════
   Treasury Page (الخزنة)
══════════════════════════════════════════════ */

/* KPI row — reuses dash-stats-grid pattern */
.trs-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.trs-kpi-grid .stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: none;
    border-right: 4px solid var(--charcoal-black);
    padding: 18px var(--space-md);
}
.trs-kpi-balance.trs-kpi-pos { border-right-color: var(--success) !important; }
.trs-kpi-balance.trs-kpi-neg { border-right-color: var(--vibrant-red) !important; }
.trs-kpi-in  { border-right-color: var(--success) !important; }
.trs-kpi-out { border-right-color: var(--vibrant-red) !important; }
.trs-kpi-grid .sc-value small {
    font-size: 14px;
    font-weight: 600;
    opacity: 0.7;
}

/* Filter bar */
.trs-filter-bar {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
    border: 1px solid var(--border-faint);
}
.trs-filter-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}
.trs-filter-form .form-group {
    flex: 1 1 160px;
    margin: 0;
    min-width: 120px;
}
.trs-filter-btns {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding-bottom: 1px;
}

/* Two-column layout */
.trs-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    align-items: start;
}

/* Each column card */
.trs-col {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border-faint);
}

/* Sticky column header */
.trs-col-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px var(--space-md);
    background: var(--white);
    border-bottom: 1px solid var(--border-faint);
    position: sticky;
    top: 0;
    z-index: 2;
}
.trs-col-in  .trs-col-head { border-top: 3px solid var(--success); }
.trs-col-out .trs-col-head { border-top: 3px solid var(--vibrant-red); }

.trs-col-head-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.trs-dot-in  { background: var(--success); }
.trs-dot-out { background: var(--vibrant-red); }

.trs-col-head-title {
    flex: 1;
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--text-heading);
}
.trs-col-head-count {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
}
.trs-col-head-total {
    font-size: var(--fs-md);
    font-weight: 800;
    white-space: nowrap;
}

/* Scrollable item list */
.trs-list {
    max-height: 520px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.trs-list::-webkit-scrollbar { width: 4px; }
.trs-list::-webkit-scrollbar-track { background: transparent; }
.trs-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Individual item row */
.trs-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 13px var(--space-md);
    border-bottom: 1px solid var(--border-faint);
    transition: background var(--transition);
}
.trs-item:last-child { border-bottom: none; }
.trs-item:hover { background: var(--bg-hover); }

/* Left accent stripe */
.trs-item-in  { border-right: 3px solid #d1fae5; }
.trs-item-out { border-right: 3px solid #fecaca; }
.trs-item-in:hover  { background: #f0fdf4; border-right-color: var(--success); }
.trs-item-out:hover { background: #fef2f2; border-right-color: var(--vibrant-red); }

/* Amount side */
.trs-item-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 70px;
    flex-shrink: 0;
    padding-top: 1px;
}
.trs-item-amount {
    font-size: clamp(15px, 1.8vw, 17px);
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
}
.trs-item-in  .trs-item-amount { color: var(--success); }
.trs-item-out .trs-item-amount { color: var(--vibrant-red); }
.trs-item-cur {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.6;
    margin-top: 2px;
}

/* Body side */
.trs-item-body {
    flex: 1;
    min-width: 0;
}
.trs-item-title {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.trs-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 4px;
}
.trs-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-subtle);
    color: var(--text-muted);
    border: 1px solid var(--border-faint);
    white-space: nowrap;
}
.trs-tag-date {
    background: #f0f4ff;
    color: #1e40af;
    border-color: #bfdbfe;
}
.trs-tag-ref {
    background: #fdf4ff;
    color: #7c3aed;
    border-color: #e9d5ff;
}
.trs-item-note {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Empty state */
.trs-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: var(--space-xl) var(--space-md);
    color: var(--text-muted);
    font-size: var(--fs-sm);
}
.trs-empty-icon { font-size: 36px; opacity: 0.4; }

/* ── Responsive ────────────────────────────── */
@media (max-width: 1024px) {
    .trs-kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .trs-kpi-grid {
        grid-template-columns: 1fr 1fr;
    }
    .trs-kpi-grid .stat-card:first-child {
        grid-column: 1 / -1;  /* رصيد الخزنة يأخذ الصف الأول كامل */
    }
    .trs-columns {
        grid-template-columns: 1fr;
    }
    .trs-filter-form {
        flex-direction: column;
        gap: 10px;
    }
    .trs-filter-form .form-group { flex: 1 1 100%; }
    .trs-filter-btns { width: 100%; }
    .trs-filter-btns .btn-primary,
    .trs-filter-btns .btn-secondary { flex: 1; }
    .trs-list { max-height: 400px; }
    .trs-item { gap: 10px; padding: 11px 12px; }
    .trs-item-side { min-width: 60px; }
}
@media (max-width: 480px) {
    .trs-kpi-grid {
        grid-template-columns: 1fr;
    }
    .trs-kpi-grid .stat-card:first-child {
        grid-column: auto;
    }
}

/* ── Dark mode ─────────────────────────────── */
[data-theme="dark"] .trs-filter-bar,
[data-theme="dark"] .trs-col { border-color: rgba(255,255,255,0.06); }

[data-theme="dark"] .trs-col-head { background: var(--charcoal-dark); }

[data-theme="dark"] .trs-item-in:hover  { background: rgba(40,167,69,0.07); }
[data-theme="dark"] .trs-item-out:hover { background: rgba(230,57,70,0.07); }

[data-theme="dark"] .trs-tag        { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); color: #aaa; }
[data-theme="dark"] .trs-tag-date   { background: rgba(59,130,246,0.15); color: #93c5fd; border-color: rgba(59,130,246,0.25); }
[data-theme="dark"] .trs-tag-ref    { background: rgba(124,58,237,0.15); color: #c4b5fd; border-color: rgba(124,58,237,0.25); }

[data-theme="dark"] .trs-col-head-count { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); }

.portal-board-phone {
    font-size: 13px;
    color: #2d3a42;
    text-decoration: none;
    background: #e9ecef;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    transition: 0.2s;
    flex-shrink: 0;
}
.portal-board-phone:hover {
    background: #dee2e6;
}

@media (max-width: 480px) {
    .portal-board-item {
        flex-wrap: wrap;
    }
    .portal-board-phone {
        width: 100%;
        text-align: center;
        margin-top: 4px;
    }
}

/* ==============================
   BOARD DASHBOARD (RESIDENT PORTAL)
   ============================== */
.portal-board-badge {
    display: inline-block;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 6px;
    vertical-align: middle;
}
.portal-board-dashboard .portal-section-header {
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
    color: #fff;
}
.board-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.board-stat-card {
    background: #f8fafc;
    border-radius: 10px;
    padding: 14px 12px;
    text-align: center;
    border: 1px solid #e2e8f0;
}
.board-stat-card.stat-green { border-right: 4px solid #22c55e; }
.board-stat-card.stat-red   { border-right: 4px solid #ef4444; }
.board-stat-card.stat-orange{ border-right: 4px solid #f97316; }
.board-stat-card.stat-blue  { border-right: 4px solid #3b82f6; }
.board-stat-card.stat-yellow{ border-right: 4px solid #eab308; }
.board-stat-value {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
    direction: ltr;
    line-height: 1.2;
}
.board-stat-label {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
}
.board-complaints-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.board-complaint-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    gap: 10px;
}
.board-complaint-info {
    flex: 1;
    min-width: 0;
}
.board-complaint-info strong {
    display: block;
    font-size: 13px;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.board-complaint-info small {
    color: #94a3b8;
    font-size: 11px;
}
@media (max-width: 480px) {
    .board-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .board-stat-value {
        font-size: 16px;
    }
    .board-complaint-item {
        flex-wrap: wrap;
    }
}

/* ==============================
   BOARD DETAIL SECTIONS (EXPANDABLE)
   ============================== */
.board-detail-section {
    margin-top: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}
.board-detail-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
    background: #f1f5f9;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    user-select: none;
    list-style: none;
}
.board-detail-toggle::-webkit-details-marker { display: none; }
.board-detail-toggle::before {
    content: '▸';
    transition: transform .2s;
    font-size: 12px;
}
details[open] > .board-detail-toggle::before {
    transform: rotate(90deg);
}
.board-detail-content {
    padding: 10px 12px;
}
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.portal-table th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    padding: 8px 10px;
    text-align: right;
    white-space: nowrap;
    border-bottom: 2px solid #e2e8f0;
}
.portal-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}
.portal-table tr:hover td {
    background: #f8fafc;
}

/* ==============================
   BOARD COMPLAINT FULL ITEMS
   ============================== */
.board-complaint-item-full {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
}
.board-complaint-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.board-complaint-header .board-complaint-info strong {
    display: block;
    font-size: 14px;
    color: #1e293b;
}
.board-complaint-header .board-complaint-info small {
    color: #94a3b8;
    font-size: 11px;
}
.board-complaint-body {
    font-size: 13px;
    color: #475569;
    line-height: 1.6;
    margin: 6px 0 8px;
    padding: 8px 10px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}
.board-complaint-existing-reply {
    font-size: 12px;
    color: #059669;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
}

/* ==============================
   BOARD REPLY FORM
   ============================== */
.board-reply-toggle {
    margin-top: 6px;
}
.board-reply-toggle > summary {
    font-size: 12px;
    color: #2563eb;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
}
.board-reply-form {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.board-reply-form textarea {
    min-height: 60px;
    resize: vertical;
}

/* ==============================
   BOARD POLL RESULTS
   ============================== */
.board-poll-result {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}
.board-poll-result:last-child {
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .portal-table th,
    .portal-table td {
        font-size: 11px;
        padding: 6px 8px;
    }
    .board-complaint-header {
        flex-direction: column;
    }
}