:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-subtle: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --ink: #0f172a;
    --text: #0f172a;
    --text-secondary: #475569;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff6ff;
    --success: #059669;
    --success-soft: #ecfdf5;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --radius: 10px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
}

:root[data-theme="dark"] {
    --bg: #0b1120;
    --surface: #111827;
    --surface-subtle: #1e293b;
    --border: #1f2937;
    --border-strong: #334155;
    --ink: #f1f5f9;
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-soft: rgba(59, 130, 246, 0.16);
    --success: #34d399;
    --success-soft: rgba(16, 185, 129, 0.16);
    --warning: #fbbf24;
    --warning-soft: rgba(245, 158, 11, 0.16);
    --danger: #f87171;
    --danger-soft: rgba(239, 68, 68, 0.16);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.3);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
    background: var(--surface-subtle);
    color: var(--text);
    border-color: var(--border-strong);
}

:root[data-theme="dark"] button.ss-option:hover,
:root[data-theme="dark"] button.ss-option.is-selected {
    background: var(--surface-subtle);
    color: var(--text);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Plus Jakarta Sans", "Cairo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

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

/* Sidebar — Executive Light */
.app-sidebar {
    width: 248px;
    background: var(--surface);
    border-inline-end: 1px solid var(--border);
    padding: 1.15rem 0.85rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0.45rem 1rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
}

.sidebar-brand {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.sidebar-sub {
    font-size: 0.74rem;
    color: var(--muted);
}

.app-sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.app-sidebar .nav-group {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    margin: 1.15rem 0.6rem 0.35rem;
}

.app-sidebar a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.48rem 0.65rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background 0.12s ease, color 0.12s ease;
}

.app-sidebar a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.75;
}

.app-sidebar a:hover {
    background: var(--surface-subtle);
    color: var(--text);
}

.app-sidebar a.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.app-sidebar a.active svg {
    opacity: 1;
}

/* Main & Topbar */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.7rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.year-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.year-switcher select {
    border: none;
    background: transparent;
    font-weight: 700;
    color: var(--text);
    padding: 0.15rem 0.2rem;
    margin: 0;
    width: auto;
    cursor: pointer;
}

.year-switcher select:focus {
    outline: none;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.84rem;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
}

.topbar-user a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.topbar-user a:hover {
    color: var(--primary);
}

.role-pill {
    display: inline-block;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.app-content {
    padding: 1.75rem 2rem;
    max-width: 1380px;
    width: 100%;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.85rem;
}

.breadcrumb a,
.breadcrumb .bc-btn {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    background: transparent;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.breadcrumb a:hover,
.breadcrumb .bc-btn:hover {
    color: var(--primary);
    text-decoration: underline;
}

.breadcrumb .bc-sep {
    opacity: 0.5;
}

.breadcrumb .bc-current {
    color: var(--text);
    font-weight: 600;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-subtitle {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

/* Cards & Stats */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-xs);
}

.card h2, .card h3 {
    margin-top: 0;
    font-size: 1rem;
    font-weight: 600;
}

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

.kpi-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-xs);
}

.kpi-stat .label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
}

.kpi-stat .value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 0.25rem;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.kpi-stat.success .value { color: var(--success); }
.kpi-stat.danger  .value { color: var(--danger); }

/* Perspective Gauges */
.gauge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.gauge-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow-xs);
}

.gauge-card .gauge-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.35rem;
    color: var(--text);
}

.gauge-card .gauge-meta {
    font-size: 0.75rem;
    color: var(--muted);
}

/* Filter Pills */
.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.pill-btn {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.32rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
}

.pill-btn:hover {
    background: var(--surface-subtle);
    color: var(--text);
}

.pill-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Badges & Progress */
.badge {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--surface-subtle);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 0.35rem;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
}

/* Tables & Search */
.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.table-search {
    max-width: 300px;
    margin-bottom: 0;
}

.table-size-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.table-size-wrap select {
    width: auto;
    margin-bottom: 0;
    padding: 0.35rem 0.55rem;
    font-size: 0.82rem;
}

.table-pager {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.pager-buttons {
    display: inline-flex;
    gap: 0.3rem;
}

.pager-btn {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.pager-btn:hover:not(:disabled) {
    background: var(--surface-subtle);
    color: var(--text);
}

.pager-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pager-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

/* Drill-down expanders & sub-tables */
.expand-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 6px;
    background: var(--surface-subtle);
    color: var(--text);
    border: 1px solid var(--border-strong);
    font-weight: 700;
    font-size: 0.9rem;
}

.expand-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary);
}

.drilldown-row > td {
    background: var(--surface-subtle);
    padding: 0.9rem 1.25rem;
}

.drilldown-panel h4 {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.sub-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.sub-table th, .sub-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
    text-align: start;
}

.sub-table th {
    background: var(--surface-subtle);
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

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

.data-table th, .data-table td {
    padding: 0.72rem 0.95rem;
    border-bottom: 1px solid var(--border);
    text-align: start;
    font-size: 0.85rem;
}

.data-table th {
    background: var(--bg);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    color: var(--muted);
    white-space: nowrap;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table th.sortable:hover {
    color: var(--text);
}

.data-table th.sortable::after {
    content: " ↕";
    opacity: 0.35;
    font-size: 0.7rem;
}

.data-table th.sortable[data-sort-dir="asc"]::after {
    content: " ↑";
    opacity: 1;
    color: var(--primary);
}

.data-table th.sortable[data-sort-dir="desc"]::after {
    content: " ↓";
    opacity: 1;
    color: var(--primary);
}

.data-table tbody tr:hover {
    background: var(--surface-subtle);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Buttons & Forms */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.48rem 0.95rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s ease;
}

button:hover, .btn:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-subtle); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; }

input, select, textarea {
    width: 100%;
    padding: 0.52rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font: inherit;
    font-size: 0.875rem;
    margin-bottom: 0.85rem;
    background: var(--surface);
    color: var(--text);
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(37, 99, 235, 0.2);
    border-color: var(--primary);
}

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
}
.alert-error { background: var(--danger-soft); color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: var(--success-soft); color: #166534; border: 1px solid #bbf7d0; }

/* Split-Screen Login */
.login-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

.login-hero {
    background: linear-gradient(155deg, #0b192c 0%, #1e3a8a 100%);
    color: #fff;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.login-hero img {
    width: 84px;
    height: 84px;
    object-fit: contain;
    background: #fff;
    border-radius: 16px;
    padding: 8px;
    margin-bottom: 1.5rem;
}

.login-hero h2 {
    margin: 0 0 0.65rem;
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-hero p {
    margin: 0;
    max-width: 400px;
    color: #cbd5e1;
    font-size: 0.95rem;
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--surface);
}

.login-form-box {
    width: 100%;
    max-width: 360px;
}

.login-form-box h1 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.login-form-box .sub {
    margin: 0 0 1.5rem;
    color: var(--muted);
    font-size: 0.875rem;
}

.login-form-box button[type="submit"] {
    width: 100%;
    padding: 0.65rem 1rem;
    font-size: 0.92rem;
}

.roadmap-img {
    width: 100%;
    max-height: 540px;
    object-fit: contain;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.strategy-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.segmented {
    display: inline-flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
}

.segmented a {
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
}

.segmented a.active {
    background: var(--primary);
    color: #fff;
}

.strategy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.15rem;
    margin-bottom: 1.25rem;
}

.strategy-card {
    margin-bottom: 0;
}

.strategy-card-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.strategy-card-head h3 {
    margin: 0;
    font-size: 0.98rem;
}

.strategy-obj-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.strategy-obj-list li {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.obj-code {
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--primary);
    background: var(--primary-soft);
    padding: 0.1rem 0.45rem;
    border-radius: 5px;
    flex-shrink: 0;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 100;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
}

.modal-dialog h3 {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--ink);
}

.modal-close {
    background: transparent;
    color: var(--muted);
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.modal-close:hover {
    background: var(--bg);
    color: var(--ink);
}

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

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

.modal-dialog textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    background: var(--surface);
    color: var(--ink);
    resize: vertical;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1.25rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border);
}

/* Searchable & Text-Wrapping Select */
.ss-wrap {
    position: relative;
    width: 100%;
}

.ss-native-hidden {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    height: 0;
    width: 0;
}

button.ss-trigger,
.ss-trigger {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.35;
    text-align: start;
    cursor: pointer;
}

button.ss-trigger:hover,
button.ss-trigger:focus,
.ss-trigger:hover {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--primary);
    outline: none;
}

.ss-trigger-text {
    flex: 1;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.ss-caret {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 0.75rem;
    margin-top: 0.2rem;
}

.ss-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
    z-index: 150;
    overflow: hidden;
}

.ss-menu[hidden] {
    display: none;
}

.ss-search-box {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.ss-search {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
    font-size: 0.82rem;
    background: var(--surface);
    color: var(--ink);
}

.ss-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 0.25rem 0;
}

button.ss-option,
.ss-option {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 400;
    line-height: 1.35;
    text-align: start;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    cursor: pointer;
    border-radius: 0;
}

button.ss-option:hover,
button.ss-option.is-selected {
    background: #f1f5f9;
    color: var(--ink);
    font-weight: 500;
}

.ss-empty {
    padding: 0.65rem 0.75rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.data-table tbody tr.clickable-row {
    cursor: pointer;
}

.data-table tbody tr.clickable-row:hover td {
    background: rgba(37, 99, 235, 0.04);
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem 0 0.75rem;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}

.remember-row input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Measures 10-Year Gauge Dashboard */
.gauge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.gauge-grid-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 0;
}

.gauge-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-subtle);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.gauge-card:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.gauge-card.is-active {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.gauge-fy {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.gauge-svg {
    width: 96px;
    height: 58px;
}

.gauge-val {
    font-size: 13px;
    font-weight: 700;
    fill: var(--text);
}

.gauge-meta {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 0.15rem;
}

@media (max-width: 1024px) {
    .gauge-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
    .gauge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

button.theme-toggle,
button.mobile-nav-btn {
    background: var(--surface-subtle);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.35rem 0.6rem;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
}

button.theme-toggle:hover,
button.mobile-nav-btn:hover {
    background: var(--border);
    color: var(--text);
}

button.mobile-nav-btn {
    display: none;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 110;
}

.sidebar-backdrop[hidden] {
    display: none;
}

@media (max-width: 860px) {
    button.mobile-nav-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .app-sidebar {
        position: fixed;
        inset-block: 0;
        inset-inline-start: 0;
        z-index: 120;
        width: 260px;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 0 12px 32px rgba(15, 23, 42, 0.25);
    }
    [dir="rtl"] .app-sidebar {
        transform: translateX(100%);
    }
    .app-sidebar.is-open {
        transform: translateX(0);
    }
    .app-topbar {
        padding: 0.65rem 1rem;
        flex-wrap: wrap;
        gap: 0.6rem;
    }
    .topbar-user {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .app-content {
        padding: 1rem;
    }
    .login-split { grid-template-columns: 1fr; }
    .login-hero { display: none; }
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .modal-dialog {
        padding: 1rem;
        max-height: 92vh;
    }
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .table-search {
        max-width: 100%;
    }
}

@media print {
    .app-sidebar, .app-topbar, .no-print, .table-toolbar, .table-pager, .filter-pills { display: none !important; }
    .data-table tbody tr { display: table-row !important; }
    .app-content { padding: 0; }
    .card, .table-wrap { box-shadow: none; }
}
