/* ========================================
   COMPLETE RESPONSIVE DESIGN v2.0
   Mobile-First | Light/Dark Mode
   Production Ready
   ======================================== */

/* ========================================
   CSS VARIABLES - THEME SYSTEM
   ======================================== */

:root {
    /* Colors - Light Mode */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    
    /* Brand Colors */
    --primary: #0F5132;
    --primary-dark: #084827;
    --primary-light: #1b7d4a;
    --accent: #D4AF37;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --extra-info-color: #7a0018;
    --extra-info-soft-bg: #fff1f4;
    --extra-info-border: #c73b5b;
    --extra-info-focus-ring: 0 0 0 3px rgba(199, 59, 91, 0.18);
    --info: #3B82F6;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Layout */
    --navbar-height: 70px;
    --sidebar-width: 260px;
    --border-radius: 8px;
    --transition: all 0.3s ease;
    --font-sans: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Media Queries Breakpoints */
    --mobile: 640px;
    --tablet: 768px;
    --desktop: 1024px;
    --wide: 1280px;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #404040;
    --extra-info-color: #ff6f8a;
    --extra-info-soft-bg: rgba(255, 111, 138, 0.12);
    --extra-info-border: #ff6f8a;
    --extra-info-focus-ring: 0 0 0 3px rgba(255, 111, 138, 0.28);
    --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* ========================================
   RESET & BASE STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

body.app-screen {
    background:
        radial-gradient(circle at 8% 12%, rgba(15, 81, 50, 0.12), transparent 40%),
        radial-gradient(circle at 92% 18%, rgba(212, 175, 55, 0.14), transparent 38%),
        var(--bg-secondary);
}

[data-theme="dark"] body.app-screen {
    background:
        radial-gradient(circle at 8% 12%, rgba(34, 197, 94, 0.16), transparent 40%),
        radial-gradient(circle at 92% 18%, rgba(245, 158, 11, 0.12), transparent 38%),
        var(--bg-secondary);
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ========================================
   NAVBAR
   ======================================== */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    gap: var(--spacing-lg);
}

.navbar.navbar-dark {
    background: #1a1a1a;
    border-bottom-color: #404040;
}

/* Navbar Brand */
.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
}

.nav-brand span {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-brand i {
    font-size: 1.5rem;
}

.nav-brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    background: #fff;
    padding: 2px;
}

/* Sidebar Toggle */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--bg-secondary);
}

/* Header Test Links */
.nav-test-links {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.nav-test-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: var(--transition);
}

.nav-test-link:hover {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    margin-left: auto;
    flex-wrap: wrap;
}

.user-menu span {
    color: var(--text-primary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.org-context-badge {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem !important;
    font-weight: 600;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.user-chip img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    object-fit: cover;
    background: #fff;
}

.notif-menu {
    position: relative;
}

.notif-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.notif-btn:hover {
    background: var(--bg-secondary);
}

.notif-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 0.6rem);
    right: 0;
    width: min(360px, 90vw);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    padding: 0.7rem;
    display: none;
    z-index: 1200;
}

.notif-dropdown span {
    display: inline;
    align-items: initial;
    gap: 0;
}

.notif-menu.open .notif-dropdown {
    display: block;
}

.notif-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.notif-head a {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.notif-head a:hover {
    color: var(--primary);
}

.notif-empty {
    padding: 0.9rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.notif-list {
    display: grid;
    gap: 0.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.notif-item {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.6rem;
    display: grid;
    gap: 0.35rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    text-decoration: none;
}

.notif-item.unread {
    border-color: rgba(14, 165, 233, 0.45);
    background: rgba(14, 165, 233, 0.08);
}

.notif-item strong {
    font-size: 0.85rem;
}

.notif-item p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.notif-item small {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.notif-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    width: fit-content;
}

.notif-info {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.15);
}

.notif-success {
    color: #059669;
    background: rgba(16, 185, 129, 0.15);
}

.notif-warning {
    color: #b45309;
    background: rgba(245, 158, 11, 0.2);
}

.notif-danger {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.18);
}

.notif-update {
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.18);
}

.notif-event {
    color: #0f766e;
    background: rgba(13, 148, 136, 0.18);
}

.maintenance-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.18);
    border: 1px solid rgba(245, 158, 11, 0.5);
    color: #d97706;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    flex-wrap: wrap;
}

[data-theme="dark"] .maintenance-chip {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.6);
    color: #fbbf24;
}

.maintenance-chip .maintenance-end {
    font-size: 0.68rem;
    font-weight: 600;
    opacity: 0.85;
}

.btn-theme-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.btn-theme-toggle:hover {
    background: var(--bg-secondary);
}

.btn-logout {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 1.2rem;
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ========================================
   SIDEBAR
   ======================================== */

.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 900;
    transition: var(--transition);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.sidebar-health {
    margin: 0.4rem 0.75rem 1rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(15, 81, 50, 0.08), var(--bg-primary));
    box-shadow: var(--shadow-light);
    display: grid;
    gap: 0.5rem;
}

.sidebar-health-head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sidebar-health-head i {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(15, 81, 50, 0.14);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.sidebar-health-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sidebar-health-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
}

.sidebar-health .health-mini-item {
    padding: 0.22rem 0.4rem;
    font-size: 0.6rem;
    border-radius: 10px;
    gap: 0.3rem;
}

.sidebar-health .health-mini-item span {
    font-size: 0.58rem;
}

.sidebar-health .health-mini-item strong {
    font-size: 0.64rem;
}

.sidebar-health .health-note {
    font-size: 0.6rem;
}

/* System Health Page */
.system-health-page {
    gap: 1rem;
}

.system-health-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    border-left: 4px solid var(--primary);
}

.system-health-sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.system-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.75rem;
}

.system-health-item {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem;
    background: var(--bg-secondary);
    display: grid;
    gap: 0.3rem;
}

.system-health-item span {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.system-health-item strong {
    font-size: 1rem;
}

.system-health-item small {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* Notifications Page */
.notifications-page {
    display: grid;
    gap: 1rem;
}

.notifications-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.85rem 1rem;
    border-left: 4px solid var(--primary);
}

.notifications-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.notifications-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.notif-counter {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.notification-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.notification-form-grid .form-group.full {
    grid-column: 1 / -1;
}

.notification-form-grid .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}

.notification-form-grid .form-actions.full {
    grid-column: 1 / -1;
}

.notification-list {
    display: grid;
    gap: 0.8rem;
}

.notif-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.7rem;
    margin-bottom: 1rem;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
}

.notif-filters .filter-group label {
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.notif-filters .filter-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    border: none;
    padding: 0;
    margin: 0;
}

.notification-table-wrap {
    overflow-x: auto;
}

.notification-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}

.notification-table th {
    text-align: left;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0 0.6rem;
}

.notification-table td {
    padding: 0.75rem 0.6rem;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.notification-table tr td:first-child {
    border-left: 1px solid var(--border-color);
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    width: 60px;
}

.notification-table tr td:last-child {
    border-right: 1px solid var(--border-color);
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.notif-row {
    cursor: pointer;
    transition: var(--transition);
}

.notif-row:hover td {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.05);
}

.notif-row.unread td {
    border-color: rgba(14, 165, 233, 0.45);
    background: rgba(14, 165, 233, 0.08);
}

.notif-title-cell {
    display: grid;
    gap: 0.35rem;
}

.notif-title-cell strong {
    font-size: 0.9rem;
}

.notif-preview {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.notif-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.notif-pill.unread {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.12);
}

.notif-pill.read {
    color: #059669;
    background: rgba(16, 185, 129, 0.12);
}

.notif-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 1400;
}

.notif-modal.active {
    display: flex;
}

.notif-modal-card {
    width: min(720px, 95vw);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    padding: 1.2rem;
    display: grid;
    gap: 0.9rem;
}

.notif-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.notif-modal-head h3 {
    margin: 0;
    font-size: 1.1rem;
}

.notif-modal-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.notif-modal-body {
    font-size: 0.92rem;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    background: var(--bg-secondary);
    padding: 0.9rem;
    border-radius: 12px;
}

.notif-modal-close {
    border: none;
    background: var(--bg-secondary);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-primary);
}

.notif-modal-close:hover {
    background: rgba(59, 130, 246, 0.15);
}

.notification-item {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 0.9rem;
    background: var(--bg-primary);
    box-shadow: var(--shadow-light);
    display: grid;
    gap: 0.5rem;
}

.notification-item.unread {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.06);
}

.notification-item.archived {
    opacity: 0.78;
}

.notification-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.notification-item p {
    margin: 0;
    color: var(--text-secondary);
}

.notification-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.notif-meta-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.notif-action {
    position: relative;
    z-index: 2;
}

.notif-mark {
    font-weight: 600;
    color: var(--primary);
}

.notif-read {
    color: var(--text-secondary);
}

.notif-edit {
    font-weight: 600;
    color: var(--primary);
}

.notif-delete-form {
    display: inline;
}

.notif-delete {
    background: none;
    border: none;
    color: #dc2626;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.notif-delete:hover {
    text-decoration: underline;
}

.notif-live {
    color: #059669;
    background: rgba(16, 185, 129, 0.16);
}

.notif-expired {
    color: #b45309;
    background: rgba(245, 158, 11, 0.18);
}

.notif-archived {
    color: #64748b;
    background: rgba(148, 163, 184, 0.2);
}

/* Menu Items */
.menu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
    margin: var(--spacing-xs) 0;
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.menu-item:hover {
    background: var(--bg-secondary);
    color: var(--primary);
    border-left-color: var(--primary);
}

.menu-item.active {
    background: var(--bg-secondary);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

/* ========================================
   MAIN CONTENT
   ======================================== */

body {
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    margin-top: var(--navbar-height);
    margin-left: var(--sidebar-width);
    padding: var(--spacing-xl);
    min-height: calc(100vh - var(--navbar-height));
    background: var(--bg-secondary);
    transition: var(--transition);
}

.sidebar-overlay {
    position: fixed;
    inset: var(--navbar-height) 0 0 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 850;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

/* ========================================
   CARDS & CONTAINERS
   ======================================== */

.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-light);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

/* FILTER COMPONENT HELPERS */
.filter-section {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 0.9rem 1rem;
    align-items: end;
    margin-bottom: 1.35rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(15, 81, 50, 0.05), var(--bg-primary));
    box-shadow: var(--shadow-light);
}

[data-theme="dark"] .filter-section {
    background: linear-gradient(180deg, rgba(15, 81, 50, 0.2), var(--bg-primary));
}

.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 0.9rem 1rem;
    align-items: end;
    width: 100%;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
    min-width: 0;
}

.filter-group label {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 0.95;
}

.filter-group .form-control,
.filter-group select,
.filter-group input {
    min-height: 42px;
    padding: 0.58rem 0.72rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
}

.filter-group .form-control:focus,
.filter-group select:focus,
.filter-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 81, 50, 0.12);
}

.filter-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.1rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color);
}

.filter-actions .btn {
    min-height: 40px;
    min-width: 118px;
}

.filter-actions.inline-actions {
    grid-column: auto;
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
    justify-content: flex-end;
}

.filter-actions.inline-actions .btn {
    min-width: 0;
}

.filter-section > .btn,
.filter-section > a.btn {
    min-height: 42px;
    align-self: end;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ========================================
   GRID & LAYOUT
   ======================================== */

.grid {
    display: grid;
    gap: var(--spacing-lg);
}

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

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

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

/* ========================================
   TABLES
   ======================================== */

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
}

table thead {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
}

table th {
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}

table td {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

table tbody tr:hover {
    background: var(--bg-secondary);
}

/* ========================================
   FORMS
   ======================================== */

.form-group {
    margin-bottom: var(--spacing-lg);
}

label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="tel"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 81, 50, 0.1);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--btn-radius, var(--border-radius));
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--text-primary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-info:hover {
    background: #2563eb;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.85rem;
}

.btn-lg {
    padding: var(--spacing-lg) var(--spacing-xl);
    font-size: 1.1rem;
}

/* ========================================
   BADGES & STATUS
   ======================================== */

.badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #059669;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #d97706;
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #2563eb;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.72rem;
    line-height: 1;
    white-space: nowrap;
}

.badge-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-studying {
    background: rgba(33, 150, 243, 0.2);
    color: #1976d2;
}

.status-studying::before {
    background: #2196f3;
}

.status-queue {
    background: rgba(255, 152, 0, 0.2);
    color: #f57c00;
}

.status-queue::before {
    background: #ff9800;
}

.status-completed {
    background: rgba(76, 175, 80, 0.2);
    color: #388e3c;
}

.status-completed::before {
    background: #4caf50;
}

/* Muzlatilgan - Kulrang */
.status-frozen {
    background: rgba(108, 117, 125, 0.2);
    color: #6c757d;
}

.status-frozen::before {
    background: #6c757d;
}

.surface-title-link {
    color: inherit;
    text-decoration: none;
}

.surface-title-link:hover {
    color: var(--primary);
}

/* ========================================
   ALERTS
   ======================================== */

.alert {
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    border-left: 4px solid;
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-left-color: var(--success);
    color: #059669;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: var(--danger);
    color: #dc2626;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: var(--warning);
    color: #d97706;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: var(--info);
    color: #2563eb;
}

/* ========================================
   MODALS
   ======================================== */

.modal-content {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.modal-content h3,
.modal-content p {
    color: var(--text-primary);
}

.modal-close:hover {
    color: var(--danger);
}

/* ========================================
   FOOTER
   ======================================== */

.site-footer {
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    background:
        radial-gradient(circle at 10% 20%, rgba(15, 81, 50, 0.14), transparent 45%),
        radial-gradient(circle at 90% 10%, rgba(212, 175, 55, 0.18), transparent 40%),
        var(--bg-primary);
}

.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1rem 1.25rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.footer-col h4 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.footer-col p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.65;
}

.footer-links,
.footer-contact {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.55rem;
}

.footer-links a,
.footer-contact li {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-contact i {
    width: 16px;
    margin-right: 0.45rem;
}

.footer-badges {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--border-color);
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.footer-bottom p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.footer-top-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
}

.footer-top-btn:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
    color: var(--primary);
}

.footer-inner-minimal {
    padding: 0.95rem 1rem;
}

.footer-minimal-line {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-minimal-line a {
    color: var(--primary);
    font-weight: 700;
}

.footer-minimal-line a:hover {
    color: var(--primary-dark);
}

.footer-separator {
    opacity: 0.55;
}

/* ========================================
   LANDING PAGE (index.php)
   ======================================== */

.landing-body {
    display: block;
    min-height: 100vh;
    background:
        radial-gradient(circle at 0% 0%, rgba(15, 81, 50, 0.22), transparent 38%),
        radial-gradient(circle at 100% 10%, rgba(212, 175, 55, 0.18), transparent 30%),
        linear-gradient(180deg, var(--bg-secondary), var(--bg-primary));
}

.landing-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1rem 2.5rem;
}

.landing-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.landing-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
    font-weight: 700;
}

.landing-hero {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 1.2rem;
}

.landing-chip {
    display: inline-block;
    margin-bottom: 0.75rem;
    padding: 0.32rem 0.72rem;
    border-radius: 999px;
    background: rgba(15, 81, 50, 0.14);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.landing-hero h1 {
    margin-bottom: 0.75rem;
    font-size: clamp(1.5rem, 3vw, 2.4rem);
}

.landing-hero p {
    margin: 0;
    color: var(--text-secondary);
    max-width: 65ch;
}

.landing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 1rem;
}

.landing-hero-stat {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.landing-score {
    border-radius: 14px;
    padding: 1.2rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.landing-score.ok {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.12);
}

.landing-score.warn {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.12);
}

.landing-score-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.landing-score-label {
    margin-top: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.landing-meta {
    display: grid;
    gap: 0.55rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.landing-meta i {
    margin-right: 0.35rem;
}

.landing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.75rem;
}

.landing-check {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.9rem;
}

.landing-check h3 {
    margin: 0 0 0.2rem;
    font-size: 0.95rem;
}

.landing-check p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.landing-check-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.landing-check.ok .landing-check-icon {
    color: #047857;
    background: rgba(16, 185, 129, 0.16);
}

.landing-check.fail .landing-check-icon {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.16);
}

.landing-footer-note {
    margin-top: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ========================================
   UTILITIES
   ======================================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.extra-info-text {
    color: var(--extra-info-color);
    font-weight: 700;
    line-height: 1.35;
}

.info-value.extra-info-text {
    color: var(--extra-info-color);
    font-weight: 700;
}

.extra-info-label {
    color: var(--extra-info-color) !important;
    font-weight: 700;
}

.extra-info-field {
    color: var(--extra-info-color);
    border: 1px solid var(--extra-info-border);
    background: var(--extra-info-soft-bg);
}

.extra-info-field::placeholder {
    color: var(--extra-info-color);
    opacity: 0.75;
}

.extra-info-field:focus {
    border-color: var(--extra-info-border);
    box-shadow: var(--extra-info-focus-ring);
    background: var(--bg-primary);
}

.mt { margin-top: var(--spacing-lg); }
.mb { margin-bottom: var(--spacing-lg); }
.pt { padding-top: var(--spacing-lg); }
.pb { padding-bottom: var(--spacing-lg); }

.d-flex { display: flex; align-items: center; }
.d-flex.gap-1 { gap: var(--spacing-sm); }
.d-flex.gap-2 { gap: var(--spacing-md); }
.d-flex.gap-3 { gap: var(--spacing-lg); }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.align-start { align-items: flex-start; }
.w-100 { width: 100%; }

.form-control {
    width: 100%;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.table-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    background: #fff;
}

.table-avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    background: #fff;
}

.org-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 260px;
}

.org-cell-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.btn-group {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.empty-state {
    text-align: center;
    padding: 2.2rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 2.4rem;
    margin-bottom: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.9;
}

.empty-state p {
    margin: 0;
}

.payment-info {
    font-size: 0.9rem;
    line-height: 1.55;
    display: grid;
    gap: 0.25rem;
}

.payment-info div {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.badge-navbatta {
    background: rgba(59, 130, 246, 0.2);
    color: #2563eb;
}

.badge-oqiyapti {
    background: rgba(16, 185, 129, 0.2);
    color: #059669;
}

.badge-tamomlagan {
    background: rgba(34, 197, 94, 0.18);
    color: #15803d;
}

.filter-section-premium .filter-form {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
}

[data-theme="dark"] .filter-section-premium .filter-form {
    background: transparent;
}

.filter-section-premium .form-control {
    border-radius: 10px;
}

.filter-section-premium .filter-actions .btn {
    min-width: 120px;
}

.hidden { display: none !important; }
.visible { display: block !important; }

/* ========================================
   RESPONSIVE - TABLET (768px - 1024px)
   ======================================== */

@media (max-width: 1024px) {
    :root {
        --navbar-height: 70px;
        --sidebar-width: 0;
    }

    .navbar {
        padding: 0 var(--spacing-md);
    }

    .sidebar-toggle {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        width: 260px;
        max-width: 75%;
        height: calc(100vh - var(--navbar-height));
        box-shadow: var(--shadow-lg);
        z-index: 900;
    }

    .sidebar.active {
        left: 0;
    }

    .landing-hero {
        grid-template-columns: 1fr;
    }

    .content-wrapper {
        margin-left: 0;
        padding: var(--spacing-lg);
    }

    .nav-test-links {
        display: none;
    }

    .filter-section,
    .filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-actions {
        justify-content: flex-start;
    }

    .org-context-badge {
        display: none !important;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}

/* ========================================
   RESPONSIVE - MOBILE (< 640px)
   ======================================== */

@media (max-width: 640px) {
    :root {
        --navbar-height: 60px;
        --spacing-xl: 1rem;
        --spacing-lg: 0.75rem;
    }

    html {
        font-size: 14px;
    }

    .navbar {
        height: 60px;
        padding: 0 var(--spacing-sm);
        gap: var(--spacing-sm);
    }

    .nav-brand {
        font-size: 1rem;
    }

    .nav-brand span {
        max-width: 140px;
    }

    .nav-brand i {
        font-size: 1.25rem;
    }

    .sidebar-toggle {
        font-size: 1.3rem;
        padding: var(--spacing-xs);
    }

    .user-menu {
        gap: var(--spacing-sm);
    }

    .user-menu span {
        display: none;
    }

    .user-menu i {
        font-size: 1.2rem;
    }

    .content-wrapper {
        margin-left: 0;
        padding: var(--spacing-md);
        min-height: calc(100vh - 60px);
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }
    h4 { font-size: 1rem; }
    h5 { font-size: 0.95rem; }
    h6 { font-size: 0.9rem; }

    .card {
        padding: var(--spacing-lg);
        margin-bottom: var(--spacing-lg);
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
    }

    .menu-item {
        padding: var(--spacing-md) var(--spacing-lg);
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        padding: 12px var(--spacing-md);
        font-size: 16px;
    }

    .btn {
        padding: var(--spacing-md) var(--spacing-lg);
        font-size: 0.95rem;
    }

    .btn-block {
        width: 100%;
    }

    table th,
    table td {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.85rem;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-container table {
        min-width: 500px;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .filter-section,
    .filter-form {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 0.85rem;
    }

    .filter-actions {
        border-top: 0;
        padding-top: 0.2rem;
        margin-top: 0;
        width: 100%;
    }

    .filter-actions.inline-actions {
        grid-column: 1 / -1;
        justify-content: stretch;
    }

    .filter-actions .btn,
    .filter-section > .btn,
    .filter-section > a.btn {
        width: 100%;
        justify-content: center;
    }

    .alert {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-minimal-line {
        justify-content: flex-start;
        font-size: 0.82rem;
        gap: 0.35rem;
    }

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

    .landing-grid {
        grid-template-columns: 1fr;
    }

    form {
        width: 100%;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .navbar,
    .sidebar,
    .sidebar-toggle,
    .btn-theme-toggle,
    .btn-logout {
        display: none !important;
    }

    .content-wrapper {
        margin-left: 0;
        margin-top: 0;
    }

    body {
        background: white;
    }
}

/* ========================================
   FOOTER V2
   ======================================== */

.site-footer {
    margin-top: 2.2rem;
    border-top: 1px solid var(--border-color);
    background:
        radial-gradient(circle at 12% 14%, rgba(15, 81, 50, 0.2), transparent 42%),
        radial-gradient(circle at 96% 0%, rgba(212, 175, 55, 0.2), transparent 35%),
        linear-gradient(160deg, var(--bg-primary), var(--bg-secondary));
}

.app-screen .site-footer {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
}

.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1rem 1.2rem;
}

.footer-ribbon {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.footer-ribbon span {
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 999px;
    font-size: 0.78rem;
    padding: 0.3rem 0.65rem;
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
}

.footer-brand h4 {
    font-size: 1.1rem;
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    margin-top: 0.4rem;
    padding-top: 0.9rem;
}

.footer-meta {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.footer-route,
.footer-user {
    font-size: 0.79rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 999px;
    padding: 0.23rem 0.6rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* ========================================
   HOME PAGE V2
   ======================================== */

.home-body {
    display: block;
    min-height: 100vh;
    background:
        radial-gradient(circle at 0% 0%, rgba(15, 81, 50, 0.28), transparent 35%),
        radial-gradient(circle at 100% 5%, rgba(212, 175, 55, 0.22), transparent 30%),
        linear-gradient(180deg, var(--bg-secondary), var(--bg-primary));
}

.home-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1rem 2.2rem;
}

.home-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.home-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
    font-weight: 700;
    text-decoration: none;
}

.home-brand i {
    font-size: 1.3rem;
    color: var(--primary);
}

.home-top-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.home-hero {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    padding: 1.4rem;
    margin-bottom: 1rem;
    overflow: hidden;
    position: relative;
}

.home-hero::after {
    content: '';
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(15, 81, 50, 0.16), transparent 70%);
    right: -80px;
    bottom: -140px;
    pointer-events: none;
}

.home-chip {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(15, 81, 50, 0.12);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.65rem;
}

.home-hero h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.45rem, 3vw, 2.3rem);
    line-height: 1.2;
}

.home-hero p {
    margin: 0;
    max-width: 62ch;
    color: var(--text-secondary);
}

.home-actions {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.home-hero-card {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-secondary);
    padding: 1rem;
}

.health-ring {
    --health: 0%;
    width: 160px;
    height: 160px;
    margin: 0 auto 0.8rem;
    border-radius: 50%;
    background: conic-gradient(var(--primary) var(--health), rgba(148, 163, 184, 0.25) 0);
    display: grid;
    place-items: center;
}

.health-ring-inner {
    width: 124px;
    height: 124px;
    border-radius: 50%;
    background: var(--bg-primary);
    display: grid;
    place-items: center;
    text-align: center;
    border: 1px solid var(--border-color);
}

.health-ring-inner strong {
    font-size: 1.5rem;
    line-height: 1;
}

.health-ring-inner span {
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.home-health-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.45rem;
}

.home-health-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.4rem;
    font-size: 0.84rem;
    color: var(--text-secondary);
}

.home-health-list b {
    color: var(--text-primary);
    font-weight: 600;
}

.home-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.home-action-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.home-action-card i {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: rgba(15, 81, 50, 0.12);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.7rem;
}

.home-action-card h3 {
    font-size: 1rem;
    margin: 0 0 0.35rem;
}

.home-action-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.home-action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.home-checks {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-light);
    padding: 1rem;
}

.home-republic-stats,
.home-org-board {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-light);
    padding: 1rem;
    margin-bottom: 1rem;
}

.home-republic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.65rem;
}

.home-republic-card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    padding: 0.8rem;
    display: grid;
    gap: 0.2rem;
}

.home-republic-card span {
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.home-republic-card strong {
    font-size: 1.08rem;
    line-height: 1.25;
}

.home-republic-card small {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.home-republic-card.danger strong {
    color: var(--danger);
}

.home-org-board-wrap {
    overflow-x: auto;
}

.home-org-table {
    width: 100%;
    border-collapse: collapse;
}

.home-org-table th,
.home-org-table td {
    padding: 0.68rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
}

.home-org-table th {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.section-head h2 {
    margin: 0;
    font-size: 1.12rem;
}

.section-head span {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.home-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.65rem;
}

.home-check-card {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    padding: 0.8rem;
    display: grid;
    grid-template-columns: 38px 1fr auto;
    align-items: center;
    gap: 0.7rem;
}

.home-check-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 81, 50, 0.12);
    color: var(--primary);
}

.home-check-card h3 {
    margin: 0;
    font-size: 0.88rem;
}

.home-check-card p {
    margin: 0.2rem 0 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.home-check-state {
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
}

.home-check-card.ok .home-check-state {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}

.home-check-card.fail .home-check-state {
    background: rgba(239, 68, 68, 0.14);
    color: #b91c1c;
}

.home-footer-note {
    margin-top: 0.9rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.84rem;
}

/* ========================================
   DASHBOARD V3
   ======================================== */

.dashboard-v3 {
    display: grid;
    gap: 1rem;
}

.dashboard-scope-card {
    margin-bottom: 0.4rem;
    padding: 0.85rem 1rem;
    border-left: 4px solid var(--primary);
    display: grid;
    gap: 0.6rem;
}

.scope-row strong {
    font-size: 0.95rem;
}

.dashboard-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 0.75rem;
    align-items: flex-end;
    padding: 0.65rem 0.85rem;
}

.dashboard-scope-card .dashboard-filter {
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.dashboard-filter .filter-group {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 240px;
}

.dashboard-filter .filter-group label {
    margin: 0;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
    flex: 0 0 auto;
}

.dashboard-filter .filter-group .form-control,
.dashboard-filter .filter-group select {
    min-height: 36px;
    padding: 0.4rem 0.6rem;
    flex: 1 1 auto;
}

.dashboard-filter .filter-actions {
    margin-left: auto;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    gap: 0.4rem;
}

.dashboard-filter .filter-actions .btn {
    min-height: 36px;
    min-width: 0;
    padding: 0.38rem 0.7rem;
}

.dashboard-v3-hero {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background:
        radial-gradient(circle at 95% 0%, rgba(212, 175, 55, 0.2), transparent 30%),
        linear-gradient(135deg, rgba(15, 81, 50, 0.95), rgba(10, 63, 39, 0.96));
    color: #f6fbf9;
    padding: 1.2rem;
}

.dashboard-v3-chip {
    display: inline-block;
    font-size: 0.76rem;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    margin-bottom: 0.6rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-weight: 700;
}

.dashboard-v3-hero h1 {
    margin: 0 0 0.55rem;
    font-size: clamp(1.4rem, 3vw, 2rem);
    color: #fff;
}

.dashboard-v3-hero p {
    margin: 0;
    color: rgba(244, 251, 247, 0.9);
    max-width: 62ch;
}

.dashboard-v3-actions {
    margin-top: 0.95rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.dashboard-v3-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.dashboard-v3-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.32);
}

.dashboard-v3-actions .btn-info {
    background: rgba(10, 21, 31, 0.28);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.dashboard-v3-hero-meta {
    display: grid;
    gap: 0.6rem;
}

.hero-meta-box {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 11px;
    padding: 0.72rem;
}

.meta-label {
    display: block;
    font-size: 0.74rem;
    opacity: 0.85;
    margin-bottom: 0.2rem;
}

.hero-meta-box strong {
    font-size: 1rem;
}

.dashboard-v3-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.8rem;
}

.kpi-card {
    border: 1px solid var(--border-color);
    border-radius: 13px;
    background: var(--bg-primary);
    padding: 0.9rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.83rem;
    margin-bottom: 0.55rem;
}

.kpi-head i {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: rgba(15, 81, 50, 0.1);
    color: var(--primary);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 0.78rem;
}

.kpi-value {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.08;
    margin-bottom: 0.2rem;
}

.kpi-sub {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.kpi-progress {
    margin-top: 0.6rem;
    height: 7px;
    border-radius: 999px;
    background: var(--bg-secondary);
    overflow: hidden;
}

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

.kpi-card.queue { border-left: 4px solid var(--warning); }
.kpi-card.studying { border-left: 4px solid var(--success); }
.kpi-card.completed { border-left: 4px solid var(--info); }
.kpi-card.total { border-left: 4px solid var(--primary); }
.kpi-card.orgs { border-left: 4px solid #0ea5e9; }
.kpi-card.miniadmins { border-left: 4px solid #6366f1; }
.kpi-card.org-active { border-left: 4px solid #10b981; }
.kpi-card.org-inactive { border-left: 4px solid #ef4444; }
.kpi-card.health-summary { border-left: 4px solid #f59e0b; }
.kpi-card.maintenance-card { border-left: 4px solid #f97316; }
.kpi-card.maintenance-card.is-on { border-left-color: #ef4444; }
.kpi-card.maintenance-card.is-off { border-left-color: #22c55e; }
.kpi-card.maintenance-card.is-on { background: rgba(239, 68, 68, 0.06); }
.kpi-card.maintenance-card.is-off { background: rgba(16, 185, 129, 0.06); }
.kpi-card.server-status { border-left: 4px solid #22c55e; }
.kpi-card.top-org { border-left: 4px solid #a855f7; }
.kpi-card.health-summary {
    padding: 0.75rem;
}

.kpi-card.health-summary .kpi-head {
    font-size: 0.74rem;
    margin-bottom: 0.45rem;
}

.kpi-card.health-summary .kpi-head i {
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
}

.health-summary-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.66rem;
    color: var(--text-secondary);
}

.health-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.14rem 0.48rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.health-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.health-note {
    font-size: 0.64rem;
    color: var(--text-secondary);
}

.dashboard-v3-panels {
    display: grid;
    grid-template-columns: 2.1fr 0.8fr;
    gap: 0.8rem;
}

.surface-card {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-light);
    padding: 1rem;
}

.surface-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.surface-head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.surface-head a,
.surface-note {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.finance-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.6rem;
}

.finance-item {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.7rem;
    background: var(--bg-secondary);
}

.finance-item span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.78rem;
    margin-bottom: 0.2rem;
}

.finance-item strong {
    font-size: 1rem;
}

.finance-item.debt strong { color: var(--danger); }
.finance-item.overpaid strong { color: var(--warning); }

.finance-bars {
    margin-top: 0.7rem;
    display: grid;
    gap: 0.5rem;
}

.line-head {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    font-size: 0.8rem;
    margin-bottom: 0.18rem;
    color: var(--text-secondary);
}

.line-head b {
    color: var(--text-primary);
}

.line-track {
    height: 7px;
    border-radius: 999px;
    background: var(--bg-secondary);
    overflow: hidden;
}

.line-fill {
    display: block;
    height: 100%;
}

.line-fill.paid { background: linear-gradient(90deg, #10b981, #059669); }
.line-fill.debt { background: linear-gradient(90deg, #f97316, #dc2626); }
.line-fill.overpaid { background: linear-gradient(90deg, #eab308, #f59e0b); }

.finance-foot-grid {
    margin-top: 0.8rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.5rem;
}

.finance-pill {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.35rem 0.6rem;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: inherit;
    background: var(--bg-secondary);
}

.finance-pill.success { color: #047857; }
.finance-pill.warning { color: #b45309; }
.finance-pill.danger { color: #b91c1c; }
.finance-pill.neutral { color: var(--text-secondary); }

.gender-grid {
    display: grid;
    gap: 0.6rem;
}

.gender-item {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    padding: 0.8rem;
}

.gender-title {
    font-size: 0.86rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.gender-value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.05;
}

.gender-sub {
    font-size: 0.83rem;
    color: var(--text-secondary);
}

.gender-item.male .gender-value { color: var(--primary); }
.gender-item.female .gender-value { color: var(--info); }

.dashboard-v3-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.system-health {
    margin-bottom: 1rem;
}

.health-mini-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(90px, 1fr));
    gap: 0.2rem 0.4rem;
}

.health-mini-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    font-size: 0.64rem;
    color: var(--text-secondary);
    padding: 0.22rem 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-wrap: wrap;
}

.health-mini-item span {
    font-size: 0.62rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.health-mini-item strong {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-primary);
}

.health-mini-item small {
    font-size: 0.58rem;
    color: var(--text-secondary);
    margin-left: 0.3rem;
}

.health-mini-item.ok {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.08);
}

.health-mini-item.warn {
    border-color: rgba(217, 119, 6, 0.35);
    background: rgba(217, 119, 6, 0.08);
}

.health-mini-item.bad {
    border-color: rgba(220, 38, 38, 0.35);
    background: rgba(220, 38, 38, 0.08);
}

.health-item span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.health-item strong {
    font-size: 1rem;
    color: var(--text-primary);
}

.health-item small {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.health-ok { color: #059669; }
.health-warn { color: #d97706; }
.health-bad { color: #dc2626; }

.activity-list-v2 {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.5rem;
}

.activity-list-v2 li {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    padding: 0.65rem;
    display: grid;
    gap: 0.34rem;
}

.row-main {
    display: flex;
    justify-content: space-between;
    gap: 0.45rem;
    align-items: center;
}

.row-main a {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
}

.row-main a:hover {
    color: var(--primary);
}

.row-sub {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.row-sub i {
    margin-right: 0.2rem;
}

.certificate-ref {
    font-size: 0.72rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.16rem 0.5rem;
    color: var(--text-secondary);
    background: var(--bg-primary);
}

.debt-amount {
    color: var(--danger);
    font-weight: 700;
    font-size: 0.8rem;
}

.empty-note {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ========================================
   INDEX V4
   ======================================== */

.idxv2-body {
    display: block;
    min-height: 100vh;
    background:
        radial-gradient(circle at 0% 0%, rgba(15, 81, 50, 0.26), transparent 36%),
        radial-gradient(circle at 100% 12%, rgba(212, 175, 55, 0.2), transparent 30%),
        linear-gradient(180deg, var(--bg-secondary), var(--bg-primary));
}

.idxv2-shell {
    max-width: 1300px;
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
}

.idxv2-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.idxv2-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
    font-weight: 700;
    text-decoration: none;
}

.idxv2-brand i {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(15, 81, 50, 0.12);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.idxv2-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.idxv2-hero {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    padding: 1.3rem;
    margin-bottom: 1rem;
}

.idxv2-chip {
    display: inline-block;
    border-radius: 999px;
    padding: 0.28rem 0.7rem;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
    background: rgba(15, 81, 50, 0.12);
    margin-bottom: 0.7rem;
}

.idxv2-hero-main h1 {
    margin: 0 0 0.7rem;
    font-size: clamp(1.45rem, 3vw, 2.45rem);
    line-height: 1.15;
}

.idxv2-hero-main p {
    margin: 0;
    color: var(--text-secondary);
    max-width: 68ch;
}

.idxv2-hero-meta {
    margin-top: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.idxv2-hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.36rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 0.3rem 0.62rem;
}

.idxv2-hero-side {
    display: grid;
    gap: 0.58rem;
}

.idxv2-side-item {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    padding: 0.7rem;
}

.idxv2-side-item span {
    display: block;
    font-size: 0.76rem;
    color: var(--text-secondary);
    margin-bottom: 0.18rem;
}

.idxv2-side-item strong {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.idxv2-panel {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-light);
    padding: 1rem;
    margin-bottom: 1rem;
}

.idxv2-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    margin-bottom: 0.85rem;
}

.idxv2-panel-head h2 {
    margin: 0;
    font-size: 1.1rem;
}

.idxv2-panel-head span {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.idxv2-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.7rem;
}

.idxv2-stat-card {
    border: 1px solid var(--border-color);
    border-radius: 11px;
    background: var(--bg-secondary);
    padding: 0.78rem;
    display: grid;
    gap: 0.2rem;
}

.idxv2-stat-card span {
    font-size: 0.76rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.idxv2-stat-card strong {
    font-size: 1.3rem;
    line-height: 1.2;
}

.idxv2-stat-card small {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.idxv2-grid-two {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 0.8rem;
}

.idxv2-trend-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(70px, 1fr));
    gap: 0.55rem;
}

.idxv2-trend-col {
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    padding: 0.45rem 0.35rem;
}

.idxv2-trend-bars {
    height: 96px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 7px;
    margin-bottom: 0.4rem;
}

.idxv2-trend-bars .bar-new,
.idxv2-trend-bars .bar-done {
    width: 11px;
    border-radius: 6px 6px 2px 2px;
    min-height: 3px;
}

.idxv2-trend-bars .bar-new {
    background: linear-gradient(180deg, #38bdf8, #0ea5e9);
}

.idxv2-trend-bars .bar-done {
    background: linear-gradient(180deg, #34d399, #059669);
}

.idxv2-trend-label {
    font-size: 0.79rem;
    font-weight: 700;
    color: var(--text-primary);
}

.idxv2-trend-col small {
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.idxv2-legend {
    margin-top: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.idxv2-legend .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.25rem;
}

.idxv2-legend .dot-new { background: #0ea5e9; }
.idxv2-legend .dot-done { background: #059669; }

.idxv2-actions {
    display: grid;
    gap: 0.6rem;
}

.idxv2-action-card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    padding: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.idxv2-action-card i {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(15, 81, 50, 0.12);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.idxv2-action-card strong {
    display: block;
    font-size: 0.92rem;
}

.idxv2-action-card p {
    margin: 0.12rem 0 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.idxv2-action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.idxv2-table-wrap {
    overflow-x: auto;
}

.idxv2-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
    flex-wrap: wrap;
}

.idxv2-filter-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.idxv2-filter-control {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    padding: 0.38rem 0.55rem;
}

.idxv2-filter-control i {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.idxv2-filter-input,
.idxv2-filter-select {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.84rem;
    padding: 0.38rem 0.55rem;
    min-height: 34px;
}

.idxv2-filter-input {
    min-width: 220px;
}

.idxv2-filter-select {
    min-width: 160px;
}

.idxv2-filter-input:focus,
.idxv2-filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 81, 50, 0.15);
}

.idxv2-filter-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.idxv2-filter-meta #orgVisibleCount,
.idxv2-filter-meta #geoVisibleCount {
    font-weight: 700;
    color: var(--text-primary);
}

.idxv2-geo-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
    flex-wrap: wrap;
}

.idxv2-geo-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.65rem;
}

.idxv2-geo-chip {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: var(--transition);
}

.idxv2-geo-chip span {
    background: rgba(15, 81, 50, 0.12);
    color: var(--primary);
    border-radius: 999px;
    padding: 0.12rem 0.45rem;
    font-size: 0.72rem;
    line-height: 1.1;
}

.idxv2-geo-chip:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
}

.idxv2-geo-chip.is-active {
    border-color: var(--primary);
    background: rgba(15, 81, 50, 0.12);
}

.idxv2-geo-overview {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.idxv2-geo-metric {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    padding: 0.62rem 0.7rem;
    display: grid;
    gap: 0.2rem;
}

.idxv2-geo-metric span {
    color: var(--text-secondary);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.idxv2-geo-metric strong {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.25;
}

.idxv2-table {
    width: 100%;
    border-collapse: collapse;
}

.idxv2-table th,
.idxv2-table td {
    border-bottom: 1px solid var(--border-color);
    padding: 0.62rem;
    text-align: left;
    white-space: nowrap;
}

.idxv2-table th {
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.idxv2-table tbody tr:hover {
    background: rgba(15, 81, 50, 0.05);
}

.idxv2-org {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.idxv2-org img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    background: #fff;
}

.idxv2-empty-row {
    text-align: center;
    color: var(--text-secondary);
}

.idxv2-org-profile {
    display: grid;
    gap: 0.8rem;
}

.idxv2-org-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.idxv2-org-main img {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    object-fit: cover;
    background: #fff;
}

.idxv2-org-main h3 {
    margin: 0;
    font-size: 1.05rem;
}

.idxv2-org-main p {
    margin: 0.25rem 0 0;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.idxv2-org-facts {
    display: grid;
    gap: 0.45rem;
}

.idxv2-org-facts span {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.idxv2-org-facts i {
    margin-right: 0.38rem;
}

.idxv2-footer {
    margin-top: 0.6rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.84rem;
}

@media (max-width: 1024px) {
    .idxv2-hero,
    .idxv2-grid-two {
        grid-template-columns: 1fr;
    }

    .idxv2-geo-overview {
        grid-template-columns: repeat(2, minmax(150px, 1fr));
    }
}

@media (max-width: 640px) {
    .idxv2-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .idxv2-topbar-actions {
        width: 100%;
    }

    .idxv2-topbar-actions .btn {
        width: 100%;
    }

    .idxv2-shell {
        padding: 0.8rem 0.8rem 1.4rem;
    }

    .idxv2-trend-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .idxv2-panel-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .idxv2-table-toolbar {
        align-items: stretch;
    }

    .idxv2-filter-row,
    .idxv2-filter-control {
        width: 100%;
    }

    .idxv2-filter-input,
    .idxv2-filter-select {
        width: 100%;
        min-width: 0;
    }

    .idxv2-filter-meta {
        width: 100%;
        justify-content: flex-start;
    }

    .idxv2-geo-toolbar {
        align-items: stretch;
    }

    .idxv2-geo-overview {
        grid-template-columns: 1fr;
    }

    .idxv2-geo-chip {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 1024px) {
    .home-hero,
    .dashboard-v3-hero,
    .dashboard-v3-panels {
        grid-template-columns: 1fr;
    }

    .dashboard-v3-columns {
        grid-template-columns: 1fr;
    }

    .health-mini-grid {
        grid-template-columns: repeat(3, minmax(90px, 1fr));
    }

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

    .app-screen .site-footer {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .home-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .home-actions,
    .home-top-actions,
    .dashboard-v3-actions {
        width: 100%;
    }

    .home-actions .btn,
    .home-top-actions .btn,
    .dashboard-v3-actions .btn {
        width: 100%;
    }

    .health-ring {
        width: 130px;
        height: 130px;
    }

    .health-ring-inner {
        width: 100px;
        height: 100px;
    }

    .dashboard-filter {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-filter .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-filter .filter-actions {
        margin-left: 0;
        width: 100%;
        justify-content: stretch;
    }

    .dashboard-filter .filter-actions .btn {
        width: 100%;
    }

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

    .notifications-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .notification-form-grid {
        grid-template-columns: 1fr;
    }

    .notif-filters {
        grid-template-columns: 1fr;
    }

    .notif-modal-card {
        padding: 1rem;
    }

    .notif-dropdown {
        right: auto;
        left: 0;
        width: min(92vw, 360px);
    }

    .system-health-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .system-health-grid {
        grid-template-columns: 1fr;
    }

    .footer-meta {
        width: 100%;
    }
}

@media (max-width: 460px) {
    .health-mini-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== INLINE PAGE ALERTS — hidden when footer modal is active ===== */
/* Pages still show inline alerts in forms; when footer modal exists, hide them to avoid duplication */

/* Hide inline alert banners since footer.php modal handles them globally */
body .page-inline-alert { display: none !important; }
