/* ============================================================
   108 Greens Society Portal — Premium Corporate Theme
   ============================================================ */

:root {
    --green-primary: #2E7D32;
    --green-dark: #1B5E20;
    --green-light: #4CAF50;
    --green-soft: #E8F5E9;
    --blue-accent: #1565C0;
    --blue-soft: #E3F2FD;
    --bg-white: #FFFFFF;
    --bg-light-gray: #F4F6F8;
    --card-gray: #F9FAFB;
    --text-dark: #1A2027;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);
    --radius-md: 12px;
    --radius-lg: 16px;
    --sidebar-width: 260px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-light-gray);
    color: var(--text-dark);
    font-size: 14.5px;
}

a { text-decoration: none; }

.text-green { color: var(--green-primary) !important; }
.text-purple { color: #7B1FA2 !important; }
.bg-purple-subtle { background: #F3E5F5 !important; }
.bg-green { background: var(--green-primary) !important; }
.bg-green-soft { background: var(--green-soft); }
.bg-blue-soft { background: var(--blue-soft); }
.bg-red-soft { background: #FFEBEE; }

/* ============ AUTH PAGES ============ */
.auth-body {
    background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 50%, #43A047 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-container { width: 100%; max-width: 440px; }
.auth-card, .error-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
}
.error-card { max-width: 440px; }
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-logo {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--green-primary), var(--green-light));
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    font-size: 30px; color: white;
}
.error-icon { font-size: 56px; margin-bottom: 8px; }
.error-code { font-size: 56px; font-weight: 800; color: var(--text-dark); margin-bottom: 4px; }
.auth-title { font-weight: 700; color: var(--text-dark); margin-bottom: 4px; }
.auth-subtitle { color: var(--text-muted); font-size: 14px; }
.auth-footer { text-align: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-color); }
.password-rules ul li { font-size: 13px; padding: 2px 0; }

.btn-green {
    background: var(--green-primary);
    border-color: var(--green-primary);
    color: white;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-green:hover { background: var(--green-dark); border-color: var(--green-dark); color: white; transform: translateY(-1px); }
.btn-outline-green { border-color: var(--green-primary); color: var(--green-primary); border-radius: 10px; font-weight: 600; }
.btn-outline-green:hover { background: var(--green-primary); color: white; }

.form-control, .form-select {
    border-radius: 10px;
    border-color: var(--border-color);
    padding: 10px 14px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--green-primary);
    box-shadow: 0 0 0 3px rgba(46,125,50,0.12);
}
.input-group-text { background: var(--card-gray); border-color: var(--border-color); border-radius: 10px 0 0 10px; }
.form-label.required::after { content: " *"; color: #DC2626; }
.section-label { color: var(--green-primary); font-weight: 700; padding-bottom: 8px; border-bottom: 2px solid var(--green-soft); margin-bottom: 4px; }

/* ============ LAYOUT ============ */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1B5E20 0%, #1A2E1B 100%);
    position: fixed; top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
    color: white;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.brand-logo { width: 42px; height: 42px; background: rgba(255,255,255,0.15); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-weight: 700; font-size: 17px; }
.brand-sub { font-size: 11px; color: rgba(255,255,255,0.6); }

.sidebar-user { padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); display: flex; align-items: center; gap: 12px; }
.user-avatar, .user-avatar-placeholder { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.user-avatar-placeholder { background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.user-info { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.user-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.user-role.badge { font-size: 10px; width: fit-content; }
.bg-success-soft { background: rgba(76,175,80,0.25); color: #C8E6C9; }
.user-flat { font-size: 11.5px; color: rgba(255,255,255,0.65); }

.sidebar-nav { padding: 14px 12px; }
.nav-section-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.6px; color: rgba(255,255,255,0.4); padding: 14px 12px 6px; font-weight: 700; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    color: rgba(255,255,255,0.8);
    padding: 10px 14px; border-radius: 10px;
    font-size: 13.8px; font-weight: 500;
    margin-bottom: 2px;
    transition: all 0.15s;
}
.nav-link i { font-size: 16px; width: 18px; text-align: center; }
.nav-link:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-link.active { background: var(--green-light); color: white; font-weight: 600; box-shadow: 0 2px 8px rgba(76,175,80,0.4); }
.nav-link-danger:hover { background: rgba(220,38,38,0.2); color: #FCA5A5; }

.main-wrapper { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }

.top-navbar {
    background: white; height: 64px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
    position: sticky; top: 0; z-index: 900;
}
.navbar-left { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle { background: none; border: none; font-size: 22px; color: var(--text-dark); display: none; }
.page-title { font-weight: 700; margin: 0; color: var(--text-dark); }
.navbar-right { display: flex; align-items: center; gap: 16px; }

.search-box { position: relative; }
.search-box input { width: 240px; border-radius: 20px; padding-left: 16px; }
.search-dropdown { position: absolute; top: 110%; left: 0; right: 0; background: white; border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 400px; overflow-y: auto; z-index: 1100; display: none; }

.nav-icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; background: var(--card-gray); display: flex; align-items: center; justify-content: center; color: var(--text-dark); cursor: pointer; }
.notif-badge { position: absolute; top: -4px; right: -4px; background: #DC2626; color: white; font-size: 10px; width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

.user-menu-btn { background: none; border: none; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; color: var(--text-dark); }
.top-avatar, .top-avatar-placeholder { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.top-avatar-placeholder { background: var(--green-soft); color: var(--green-primary); display: flex; align-items: center; justify-content: center; }

.page-content { flex: 1; padding: 24px; }
.page-footer { text-align: center; padding: 18px; color: var(--text-muted); font-size: 12.5px; border-top: 1px solid var(--border-color); }

/* ============ COMPONENTS ============ */
.page-header-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }

.content-card { background: white; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-header-custom { padding: 18px 20px; border-bottom: 1px solid var(--border-color); }
.card-title-custom { font-weight: 700; margin: 0; font-size: 15.5px; }

.stat-card {
    background: white; border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-sm);
    display: flex; align-items: center; gap: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid transparent;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-value { font-size: 24px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

.stat-green { border-left-color: var(--green-primary); } .stat-green .stat-icon { background: var(--green-soft); color: var(--green-primary); }
.stat-blue { border-left-color: var(--blue-accent); } .stat-blue .stat-icon { background: var(--blue-soft); color: var(--blue-accent); }
.stat-orange { border-left-color: #F57C00; } .stat-orange .stat-icon { background: #FFF3E0; color: #F57C00; }
.stat-purple { border-left-color: #7B1FA2; } .stat-purple .stat-icon { background: #F3E5F5; color: #7B1FA2; }
.stat-teal { border-left-color: #00796B; } .stat-teal .stat-icon { background: #E0F2F1; color: #00796B; }
.stat-red { border-left-color: #C62828; } .stat-red .stat-icon { background: #FFEBEE; color: #C62828; }
.stat-indigo { border-left-color: #3949AB; } .stat-indigo .stat-icon { background: #E8EAF6; color: #3949AB; }
.stat-pink { border-left-color: #AD1457; } .stat-pink .stat-icon { background: #FCE4EC; color: #AD1457; }

.quick-actions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; padding: 18px; }
.quick-action-btn {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 16px 8px; border-radius: 12px; background: var(--card-gray);
    color: var(--text-dark); font-size: 12px; font-weight: 600; text-align: center;
    transition: all 0.2s;
}
.quick-action-btn i { font-size: 22px; color: var(--green-primary); }
.quick-action-btn:hover { background: var(--green-soft); transform: translateY(-2px); color: var(--text-dark); }

.list-item-row { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border-color); }
.list-item-row:last-child { border-bottom: none; }
.list-item-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-weight: 600; font-size: 13.8px; }
.list-item-meta { font-size: 11.5px; color: var(--text-muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }

.empty-state, .empty-state-sm { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state-sm { padding: 30px 20px; }
.empty-state-sm i { font-size: 32px; opacity: 0.4; }
.empty-state-sm p { margin-top: 8px; margin-bottom: 0; font-size: 13px; }

.btn-xs { padding: 4px 9px; font-size: 12px; border-radius: 7px; }

.table-avatar-placeholder { width: 34px; height: 34px; border-radius: 50%; background: var(--green-soft); color: var(--green-primary); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }

.permissions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.perm-card { border: 2px solid var(--border-color); border-radius: 12px; padding: 14px 16px; transition: all 0.2s; }
.perm-card.active { border-color: var(--green-primary); background: var(--green-soft); }
.perm-card.active.danger { border-color: #DC2626; background: #FEF2F2; }

.notice-card { background: white; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); height: 100%; display: flex; flex-direction: column; transition: all 0.2s; }
.notice-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.notice-card-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 18px 0; }
.notice-meta { display: flex; flex-direction: column; gap: 6px; }
.notice-date { font-size: 11.5px; color: var(--text-muted); }
.notice-card-body { padding: 12px 18px; flex: 1; }
.notice-title { font-weight: 700; margin-bottom: 8px; }
.notice-desc { font-size: 13px; color: var(--text-muted); margin: 0; }
.notice-card-footer { padding: 14px 18px; border-top: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }

.doc-card { background: white; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; height: 100%; overflow: hidden; transition: all 0.2s; }
.doc-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.doc-card-icon { background: #FFEBEE; color: #C62828; font-size: 30px; padding: 24px; text-align: center; }
.doc-card-body { padding: 16px 18px; flex: 1; }
.doc-title { font-weight: 700; margin-bottom: 8px; }
.doc-desc { font-size: 12.5px; color: var(--text-muted); margin-bottom: 8px; }
.doc-card-footer { padding: 12px 18px; border-top: 1px solid var(--border-color); display: flex; gap: 8px; }

.flat-info-banner { background: var(--green-soft); border-radius: 10px; padding: 14px 18px; color: var(--green-dark); font-size: 14px; }

.file-drop-zone { position: relative; border: 2px dashed var(--border-color); border-radius: 12px; padding: 30px; text-align: center; cursor: pointer; transition: all 0.2s; background: var(--card-gray); }
.file-drop-zone:hover, .file-drop-zone.drag-over { border-color: var(--green-primary); background: var(--green-soft); }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.current-file-preview { background: var(--card-gray); padding: 10px 14px; border-radius: 8px; font-size: 13.5px; }

.profile-avatar-lg, .profile-photo-wrap { position: relative; }
.avatar-placeholder-lg { width: 80px; height: 80px; border-radius: 50%; background: var(--green-soft); color: var(--green-primary); display: flex; align-items: center; justify-content: center; font-size: 32px; margin: 0 auto; }
.profile-photo-wrap { width: 110px; }
.profile-photo, .profile-photo-placeholder { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 4px solid var(--green-soft); }
.profile-photo-placeholder { background: var(--green-soft); color: var(--green-primary); display: flex; align-items: center; justify-content: center; font-size: 42px; }
.photo-edit-btn { position: absolute; bottom: 0; right: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--green-primary); color: white; border: 3px solid white; display: flex; align-items: center; justify-content: center; font-size: 13px; }

.pagination .page-link { color: var(--green-primary); border-radius: 8px; margin: 0 2px; border: 1px solid var(--border-color); }
.pagination .page-item.active .page-link { background: var(--green-primary); border-color: var(--green-primary); }

.password-strength { font-size: 12px; }

/* Responsive */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.show { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .search-box { display: none !important; }
}

@media (max-width: 575px) {
    .page-content { padding: 16px; }
    .stat-value { font-size: 20px; }
    .auth-card { padding: 28px 22px; }
}

/* ============================================================
   NOTIFICATION STYLES
   ============================================================ */
.notification-wrap {
    position: relative;
}

.notification-wrap .nav-icon-btn {
    border: 0;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(380px, calc(100vw - 32px));
    max-height: 520px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(26,32,39,0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
    overflow: hidden;
    z-index: 1200;
}

.notification-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    background: #fbfcfd;
}

.notification-dropdown-header strong,
.notification-dropdown-header span {
    display: block;
}

.notification-dropdown-header strong {
    font-size: 14px;
}

.notification-dropdown-header span {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
}

.notification-dropdown-body {
    max-height: 440px;
    overflow-y: auto;
}

.notification-item {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    background: white;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 40px 1fr 8px;
    gap: 12px;
    text-align: left;
    transition: background 0.2s;
}

.notification-item:last-child {
    border-bottom: 0;
}

.notification-item:hover,
.notification-item.unread {
    background: #f7fbf7;
}

.notif-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--green-soft);
    color: var(--green-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 17px;
}

.notification-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.notification-title {
    color: var(--text-dark);
    font-weight: 700;
    font-size: 13.5px;
}

.notification-message {
    color: var(--text-muted);
    font-size: 12.5px;
    line-height: 1.4;
}

.notification-time {
    color: var(--text-muted);
    font-size: 11.5px;
    margin-top: 2px;
}

.notification-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc3545;
    align-self: start;
    margin-top: 7px;
}

.notification-empty {
    min-height: 180px;
    padding: 36px 20px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.notification-empty i {
    font-size: 30px;
    opacity: 0.55;
}

.notification-empty p {
    margin: 0;
    font-size: 13px;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545;
    color: #fff;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@media (max-width: 575px) {
    .notification-wrap {
        position: static;
    }

    .notification-dropdown {
        top: 58px;
        right: 16px;
        left: 16px;
        width: auto;
    }
}

/* Search Styles */
.search-result-item {
    transition: background 0.2s;
}

.search-result-item:hover {
    background: #f8f9fa !important;
}

.search-result-item .bi {
    font-size: 1.2rem;
}

/* ============================================================
   DASHBOARD REFRESH
   ============================================================ */
.dashboard-shell {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dashboard-hero {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.94), rgba(255,255,255,0.86)),
        radial-gradient(circle at top right, rgba(46,125,50,0.16), transparent 36%),
        linear-gradient(135deg, #f7faf9, #eef5f1);
    border: 1px solid rgba(46,125,50,0.12);
    border-radius: 8px;
    padding: 26px;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 22px;
    box-shadow: 0 10px 30px rgba(26,32,39,0.07);
}

.dashboard-kicker {
    display: inline-flex;
    align-items: center;
    color: var(--green-primary);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.dashboard-hero h2 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 800;
    color: var(--text-dark);
}

.dashboard-hero p {
    margin: 0;
    max-width: 660px;
    color: var(--text-muted);
    line-height: 1.6;
}

.dashboard-hero-metrics {
    min-width: 360px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.dashboard-hero-metrics > div {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.dashboard-hero-metrics span {
    font-size: 24px;
    line-height: 1;
    font-weight: 800;
    color: var(--green-dark);
}

.dashboard-hero-metrics small,
.dashboard-muted {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.dashboard-grid {
    display: grid;
    gap: 16px;
}

.dashboard-grid-primary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
    position: relative;
    overflow: hidden;
    min-height: 136px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 18px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.metric-card::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    background: var(--metric-color);
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(26,32,39,0.10);
    border-color: rgba(26,32,39,0.12);
}

.metric-icon {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: var(--green-soft);
    background: color-mix(in srgb, var(--metric-color) 12%, white);
    color: var(--metric-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    flex: 0 0 auto;
}

.metric-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.metric-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-content strong {
    color: var(--text-dark);
    font-size: 30px;
    line-height: 1;
    font-weight: 850;
}

.metric-content small {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.metric-green { --metric-color: #2E7D32; }
.metric-blue { --metric-color: #1565C0; }
.metric-teal { --metric-color: #00796B; }
.metric-orange { --metric-color: #EF6C00; }
.metric-indigo { --metric-color: #3949AB; }
.metric-red { --metric-color: #C62828; }
.metric-purple { --metric-color: #7B1FA2; }

.dashboard-panel {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(26,32,39,0.06);
}

.dashboard-panel .card-header-custom {
    background: #fbfcfd;
}

.occupancy-wrap {
    padding: 22px;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: center;
}

.occupancy-ring {
    --value: 0;
    width: 190px;
    aspect-ratio: 1;
    border-radius: 50%;
    background:
        radial-gradient(circle closest-side, white 70%, transparent 72% 100%),
        conic-gradient(var(--green-primary) calc(var(--value) * 1%), #e8edf0 0);
    display: grid;
    place-items: center;
    justify-self: center;
    box-shadow: inset 0 0 0 1px rgba(26,32,39,0.05);
}

.occupancy-ring div {
    text-align: center;
}

.occupancy-ring strong {
    display: block;
    font-size: 34px;
    line-height: 1;
    font-weight: 850;
    color: var(--green-dark);
}

.occupancy-ring span {
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.flat-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.flat-breakdown-item {
    min-height: 84px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-gray);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.flat-breakdown-item i {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--green-primary);
    background: var(--green-soft);
    flex: 0 0 auto;
}

.flat-breakdown-item strong,
.resource-row strong {
    display: block;
    color: var(--text-dark);
    font-size: 21px;
    line-height: 1;
    font-weight: 850;
}

.flat-breakdown-item span,
.resource-row small {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 650;
}

.resource-list {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.resource-row {
    color: inherit;
    min-height: 70px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 13px;
    display: grid;
    grid-template-columns: 42px 1fr 24px;
    align-items: center;
    gap: 12px;
    background: white;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.resource-row:hover {
    color: inherit;
    transform: translateX(3px);
    border-color: rgba(46,125,50,0.24);
    border-color: color-mix(in srgb, var(--resource-color) 36%, var(--border-color));
    background: #fbfcfd;
    background: color-mix(in srgb, var(--resource-color) 5%, white);
}

.resource-row > span {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    color: var(--resource-color);
    background: var(--green-soft);
    background: color-mix(in srgb, var(--resource-color) 12%, white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
}

.resource-row > .bi {
    color: var(--text-muted);
    font-size: 22px;
}

.resource-indigo { --resource-color: #3949AB; }
.resource-teal { --resource-color: #00796B; }
.resource-red { --resource-color: #C62828; }
.resource-purple { --resource-color: #7B1FA2; }

.wing-grid {
    padding: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.wing-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    padding: 15px;
}

.wing-card-top,
.wing-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.wing-card-top strong {
    font-size: 15px;
    color: var(--text-dark);
}

.wing-card-top span {
    color: var(--green-dark);
    font-weight: 850;
}

.wing-progress {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8edf0;
    margin: 14px 0 12px;
}

.wing-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green-primary), var(--green-light));
}

.wing-card-meta {
    color: var(--text-muted);
    font-size: 12px;
}

.wing-card-meta b {
    color: var(--text-dark);
}

.quick-actions-modern {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.quick-actions-modern .quick-action-btn {
    min-height: 92px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
}

.quick-actions-modern .quick-action-btn:hover {
    border-color: rgba(46,125,50,0.24);
    box-shadow: var(--shadow-md);
}

.dashboard-list-row {
    min-height: 72px;
}

.dashboard-table thead th {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #fbfcfd;
    border-bottom-color: var(--border-color);
}

@media (max-width: 1199px) {
    .dashboard-hero {
        flex-direction: column;
    }

    .dashboard-hero-metrics {
        min-width: 0;
    }

    .dashboard-grid-primary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .dashboard-shell {
        gap: 18px;
    }

    .dashboard-hero {
        padding: 20px;
    }

    .dashboard-hero h2 {
        font-size: 23px;
    }

    .dashboard-hero-metrics,
    .dashboard-grid-primary,
    .occupancy-wrap,
    .flat-breakdown-grid {
        grid-template-columns: 1fr;
    }

    .occupancy-wrap {
        padding: 18px;
    }

    .dashboard-hero-metrics > div,
    .metric-card,
    .flat-breakdown-item,
    .resource-row,
    .wing-card {
        border-radius: 8px;
    }
}

/* ============================================================
   FORM AND MANAGEMENT PAGE REFRESH
   ============================================================ */
.form-workspace,
.management-workspace {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-page-hero {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 22px 24px;
    box-shadow: 0 8px 24px rgba(26,32,39,0.06);
}

.form-page-hero h5 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 6px !important;
}

.form-page-hero p {
    font-size: 14px;
    line-height: 1.5;
}

.form-card,
.filter-panel,
.table-panel {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(26,32,39,0.06);
}

.form-card {
    overflow: visible;
}

.form-card #alertBox {
    margin: 20px 22px 0;
}

.form-card form {
    padding: 22px;
}

.form-section {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 18px;
    background: #fbfcfd;
}

.form-section + .form-section {
    margin-top: 18px;
}

.form-section .section-label {
    border: 0;
    margin: -18px -18px 14px;
    padding: 13px 18px;
    background: white;
    border-bottom: 1px solid #dcefe1;
    border-radius: 8px 8px 0 0;
    font-size: 15px;
}

.form-card .form-control,
.form-card .form-select,
.filter-panel .form-control,
.filter-panel .form-select,
.form-modal .form-control,
.form-modal .form-select {
    min-height: 46px;
    border-radius: 8px;
    background-color: white;
}

.form-card textarea.form-control,
.form-modal textarea.form-control {
    min-height: 128px;
}

.form-card .input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.form-card .input-group .btn {
    min-width: 48px;
    border-radius: 0 8px 8px 0;
}

.form-actions {
    margin: 22px -22px -22px;
    padding: 18px 22px;
    border-top: 1px solid var(--border-color);
    background: #fbfcfd;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-radius: 0 0 8px 8px;
}

.permissions-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.perm-card {
    background: white;
    border-radius: 8px;
}

.perm-card .form-check-input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.modern-file-drop {
    border-radius: 8px;
    min-height: 178px;
    background: white;
    display: grid;
    place-items: center;
}

.modern-file-drop .file-input {
    z-index: 1;
}

.modern-file-drop .file-drop-content,
.modern-file-drop .file-preview {
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.modern-file-drop .file-preview button {
    pointer-events: auto;
}

.modern-file-drop.has-file .file-input {
    pointer-events: none;
}

.modern-file-drop.drag-over {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(46,125,50,0.12);
}

.filter-panel {
    padding: 18px;
    background: white;
}

.table-panel {
    overflow: hidden;
}

.table-panel .table {
    font-size: 13.5px;
}

.table-panel thead th {
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #fbfcfd;
    border-bottom-color: var(--border-color);
    white-space: nowrap;
}

.table-panel tbody td {
    padding-top: 14px;
    padding-bottom: 14px;
}

.compact-stat-grid .stat-card {
    min-height: 112px;
    border-radius: 8px;
}

.form-modal {
    border: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(26,32,39,0.22);
}

.form-modal .modal-header {
    background: #fbfcfd;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
}

.form-modal .modal-title {
    font-weight: 800;
}

.form-modal .modal-body {
    padding: 22px;
}

.form-modal .modal-footer {
    background: #fbfcfd;
    border-top: 1px solid var(--border-color);
}

.notice-popup-list {
    display: grid;
    gap: 12px;
}

.notice-popup-item {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fbfcfd;
}

.notice-popup-icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--green-soft);
    color: var(--green-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.notice-popup-body h6 {
    font-weight: 800;
    margin-bottom: 6px;
}

.notice-popup-body p {
    color: var(--text-muted);
    margin-bottom: 8px;
    line-height: 1.5;
}

@media (max-width: 767px) {
    .form-page-hero {
        padding: 18px;
        align-items: flex-start;
    }

    .form-page-hero h5 {
        font-size: 21px;
    }

    .form-card form,
    .filter-panel {
        padding: 16px;
    }

    .form-section {
        padding: 14px;
    }

    .form-section .section-label {
        margin: -14px -14px 14px;
        padding: 12px 14px;
    }

    .form-actions {
        margin: 18px -16px -16px;
        padding: 16px;
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }
}
