/* ═══════════════════════════════════════════════════
   PFUND – Design System
   Inspired by Palantir Foundry · Stripe · Notion
   ═══════════════════════════════════════════════════ */

:root {
    /* Palette */
    --bg:          #f8fafc;
    --surface:     #ffffff;
    --surface-2:   #f1f5f9;
    --surface-3:   #e2e8f0;

    --border:      #e2e8f0;
    --border-2:    #cbd5e1;

    --text-1:      #0f172a;
    --text-2:      #475569;
    --text-3:      #94a3b8;

    --primary:     #4f46e5;
    --primary-h:   #4338ca;
    --primary-dim: #eef2ff;

    --accent:      #0ea5e9;
    --accent-dim:  #f0f9ff;

    --success:     #10b981;
    --success-dim: #ecfdf5;
    --warning:     #f59e0b;
    --warning-dim: #fffbeb;
    --danger:      #ef4444;
    --danger-dim:  #fef2f2;

    /* Nav */
    --nav-bg:      #0f172a;
    --nav-border:  #1e293b;
    --nav-text:    #94a3b8;
    --nav-text-h:  #f1f5f9;
    --nav-active:  #f1f5f9;

    /* Spacing & shape */
    --radius-sm:   4px;
    --radius:      6px;
    --radius-lg:   10px;
    --radius-xl:   14px;

    --shadow-sm:   0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow:      0 1px 4px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15,23,42,0.04);
    --shadow-md:   0 4px 12px rgba(15, 23, 42, 0.10), 0 0 0 1px rgba(15,23,42,0.04);
    --shadow-lg:   0 16px 40px rgba(15, 23, 42, 0.14);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

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

/* ── Accessibility ── */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

button, a, input[type="checkbox"], .multiselect-display {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* ════════════════════════════════
   TOP NAVIGATION (Palantir-style)
   ════════════════════════════════ */
.top-bar {
    display: flex;
    align-items: center;
    height: 52px;
    padding: 0 1.5rem;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 0;
}

.top-bar .brand {
    color: #f1f5f9;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
    white-space: nowrap;
    margin-right: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.top-bar .brand::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 5px;
    flex-shrink: 0;
}

.top-bar nav {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 0.15rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.top-bar nav::-webkit-scrollbar { display: none; }

.top-bar nav a {
    color: var(--nav-text);
    text-decoration: none;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
    letter-spacing: 0.01em;
}

.top-bar nav a:hover {
    color: var(--nav-text-h);
    background: rgba(241,245,249,0.08);
}

.top-bar nav a.active {
    color: var(--nav-active);
    background: rgba(241,245,249,0.12);
}

/* Primary CTA in nav */
.top-bar nav a.primary {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
    margin-left: 0.25rem;
}

.top-bar nav a.primary:hover {
    background: var(--primary-h);
    color: #ffffff;
}

/* Nav divider */
.nav-divider {
    width: 1px;
    height: 18px;
    background: var(--nav-border);
    margin: 0 0.35rem;
    flex-shrink: 0;
}

/* Nav group label */
.nav-group-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #334155;
    padding: 0 0.4rem;
    white-space: nowrap;
}

/* M&E Dashboard button (nav variant) */
.top-bar nav a.nav-dashboard-btn {
    background: rgba(14, 165, 233, 0.15);
    color: #7dd3fc;
    border: 1px solid rgba(14,165,233,0.25);
}
.top-bar nav a.nav-dashboard-btn:hover {
    background: rgba(14, 165, 233, 0.25);
    color: #bae6fd;
}

/* User section */
.top-bar .user-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    padding-left: 1rem;
    border-left: 1px solid var(--nav-border);
    flex-shrink: 0;
}

.top-bar .user-label {
    font-size: 0.75rem;
    color: var(--nav-text);
    white-space: nowrap;
}

.top-bar .user-label strong {
    color: #cbd5e1;
}

/* ════════════════════════
   LAYOUT
   ════════════════════════ */
.container {
    max-width: 100%;
    margin: 1.75rem auto 3rem;
    padding: 0 1.75rem;
}

/* ════════════════════════
   FLASH MESSAGES
   ════════════════════════ */
.flash-container { margin-bottom: 1.25rem; }

.flash {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border-radius: var(--radius);
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    border: 1px solid transparent;
}

.flash.success {
    background: var(--success-dim);
    color: #065f46;
    border-color: #a7f3d0;
}

.flash.error {
    background: var(--danger-dim);
    color: #991b1b;
    border-color: #fca5a5;
}

.flash.info {
    background: var(--primary-dim);
    color: #3730a3;
    border-color: #c7d2fe;
}

/* ════════════════════════
   TYPOGRAPHY
   ════════════════════════ */
h1 { font-size: 1.375rem; font-weight: 700; margin: 0 0 0.5rem; color: var(--text-1); letter-spacing: -0.02em; }
h2 { font-size: 1.0625rem; font-weight: 600; margin: 0 0 0.5rem; color: var(--text-1); letter-spacing: -0.01em; }
h3 { font-size: 0.875rem; font-weight: 600; margin: 0 0 0.75rem; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; }

.muted { color: var(--text-3); font-size: 0.8rem; }

/* ════════════════════════
   LABELS & INPUTS
   ════════════════════════ */
label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-2);
    margin-bottom: 0.3rem;
    display: block;
}

input, select, textarea {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border-2);
    padding: 0.45rem 0.65rem;
    font: inherit;
    font-size: 0.875rem;
    color: var(--text-1);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* ════════════════════════
   BUTTONS
   ════════════════════════ */
button {
    border-radius: var(--radius);
    border: none;
    background: var(--primary);
    color: #ffffff;
    padding: 0.45rem 0.875rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

button:hover { background: var(--primary-h); }

.button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    border-radius: var(--radius);
    border: none;
    background: var(--primary);
    color: #ffffff;
    padding: 0.45rem 0.875rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
}

.button:hover { background: var(--primary-h); color: #ffffff; }

.button.small { padding: 0.25rem 0.55rem; font-size: 0.8rem; }

.button.danger { background: var(--danger); color: #ffffff; }
.button.danger:hover { background: #dc2626; }

.button.secondary {
    background: var(--surface);
    color: var(--text-2);
    border: 1px solid var(--border-2);
}
.button.secondary:hover { background: var(--surface-2); color: var(--text-1); }

.danger-all { background: var(--danger); color: #ffffff; }

/* ════════════════════════
   FORM LAYOUT
   ════════════════════════ */
.field-group {
    display: flex;
    flex-direction: column;
    min-width: 180px;
    flex: 1;
}

.form-card {
    margin-top: 1.5rem;
    background: var(--surface);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.form-card h1 { margin-bottom: 1.25rem; }

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

.form-actions {
    display: flex;
    gap: 0.625rem;
    margin-top: 1.25rem;
}

.form-actions .primary {
    background: var(--primary);
    color: #ffffff;
    border-radius: var(--radius);
    padding: 0.5rem 1.25rem;
    border: none;
    font-weight: 500;
}

.form-actions .secondary {
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-2);
    color: var(--text-2);
    background: var(--surface);
}

/* ════════════════════════
   FILTERS SECTION
   ════════════════════════ */
.filters {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.filters form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    align-items: flex-end;
}

.filters .upload-form { margin-top: 0.25rem; }
.filters form + form { margin-top: 0.25rem; }

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-2);
    color: var(--text-2);
    padding: 0.45rem 0.875rem;
    background: var(--surface);
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.15s;
}
.download-btn:hover { background: var(--surface-2); }

/* ════════════════════════
   DASHBOARD LAYOUT
   ════════════════════════ */
.dashboard {
    margin-top: 0.75rem;
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr);
    gap: 1.25rem;
}

.hero-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    gap: 1rem;
}

.hero-header h1 { font-size: 1.25rem; }
.hero-header p { margin: 0.3rem 0 0; color: var(--text-2); font-size: 0.85rem; }

.hero-dashboard-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--primary);
    color: #ffffff;
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s;
    flex-shrink: 0;
}
.hero-dashboard-btn:hover { background: var(--primary-h); }

/* ════════════════════════
   STAT CARDS
   ════════════════════════ */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1rem 1.125rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.card-total  { border-top: 3px solid var(--accent); }
.card-budget { border-top: 3px solid var(--success); }
.card-used   { border-top: 3px solid var(--warning); }
.card-progress { border-top: 3px solid var(--primary); }

/* ════════════════════════
   STATUS SUMMARY WIDGET
   ════════════════════════ */
.status-summary {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1rem 1.125rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.status-summary h2 {
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
}

/* ════════════════════════
   TABLES
   ════════════════════════ */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    font-size: 0.85rem;
}

th, td {
    padding: 0.6rem 0.875rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    text-align: left;
}

th {
    background: var(--surface-2);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-2);
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
}

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

tbody tr:hover { background: #f8faff; }

.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.empty {
    text-align: center;
    color: var(--text-3);
    padding: 2.5rem 1rem;
    font-size: 0.85rem;
}

/* Table section wrapper */
.table-section {
    margin-top: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-header {
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.table-header h2 { margin: 0; font-size: 0.875rem; }
.table-hint { margin: 0; font-size: 0.78rem; color: var(--text-3); }

.table-wrapper { overflow-x: auto; }

.compact-table { width: 100%; min-width: 800px; }

.compact-table th {
    font-size: 0.7rem;
    padding: 0.6rem 0.75rem;
}

.compact-table td { padding: 0.65rem 0.75rem; }

/* Sortable */
.compact-table th.sortable { cursor: pointer; }
.compact-table .sort-link {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    color: inherit;
    text-decoration: none;
}
.compact-table .sort-link:hover { color: var(--primary); }
.compact-table .sort-arrow { font-size: 0.65em; opacity: 0.6; }

/* Activity row */
.activity-row {
    cursor: pointer;
    transition: background 0.15s;
}
.activity-row:hover { background: #f5f7ff !important; }
.activity-row:focus { outline: 2px solid var(--primary); outline-offset: -2px; }

.activity-link {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    color: inherit;
    text-decoration: none;
}
.activity-link:hover { color: var(--primary); }
.activity-link strong { color: inherit; }
.activity-link .activity-name { font-size: 0.82em; color: #555; }
.activity-link:hover .activity-name { color: var(--primary); }

.truncate-text {
    display: inline-block;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ════════════════════════
   STATUS PILLS
   ════════════════════════ */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.status-pill.status-planned    { background: #eff6ff; color: #1d4ed8; }
.status-pill.status-in-progress { background: #f0fdf4; color: #15803d; }
.status-pill.status-completed  { background: #ecfdf5; color: #065f46; }
.status-pill.status-on-hold    { background: #fffbeb; color: #92400e; }
.status-pill.status-cancelled  { background: #fef2f2; color: #991b1b; }
.status-pill.status-unknown    { background: var(--surface-2); color: var(--text-2); }

.status-row { transition: background 0.15s; }
.status-row:hover { background: var(--surface-2); }

/* ════════════════════════
   PROGRESS BAR
   ════════════════════════ */
.progress-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-bar {
    width: 80px;
    height: 5px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 999px;
}

.progress-container .progress-bar { width: 80px; }
.progress-label { font-size: 0.75rem; color: var(--text-2); min-width: 32px; font-variant-numeric: tabular-nums; }

.budget-used { font-weight: 600; color: var(--warning); }

/* ════════════════════════
   ICON ACTIONS
   ════════════════════════ */
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

.icon-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.2rem;
    align-items: center;
}

.icon-button {
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: transparent;
    color: var(--text-2);
    text-decoration: none;
    padding: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.icon-button svg { width: 13px; height: 13px; }

.icon-button-view {
    background: var(--primary-dim);
    color: var(--primary);
    border-color: #c7d2fe;
}
.icon-button-view:hover { background: var(--primary); color: #ffffff; border-color: var(--primary); }

.icon-button-edit:hover {
    background: var(--surface-2);
    border-color: var(--border-2);
}

.icon-button-delete {
    background: var(--danger-dim);
    color: var(--danger);
    border-color: #fca5a5;
}
.icon-button-delete:hover { background: var(--danger); color: #ffffff; }

/* ════════════════════════
   PAGINATION
   ════════════════════════ */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--border);
}

.pagination-info { font-size: 0.8rem; color: var(--text-3); }

.pagination-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

.pagination-prev, .pagination-next, .pagination-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.875rem;
    height: 1.875rem;
    padding: 0 0.5rem;
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    transition: background 0.15s;
}

.pagination-prev:hover, .pagination-next:hover, .pagination-page:hover {
    background: var(--surface-2);
}

.pagination-page.current {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    pointer-events: none;
    font-weight: 600;
}

.pagination-prev.disabled, .pagination-next.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-ellipsis { padding: 0 0.2rem; font-size: 0.8rem; color: var(--text-3); }

/* ════════════════════════
   MODAL
   ════════════════════════ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.18s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-xl);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: slideUp 0.22s ease;
}

@keyframes slideUp {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

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

.modal-header h2 { margin: 0; font-size: 1rem; color: var(--text-1); }

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text-3);
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
    padding: 0;
}
.modal-close:hover { background: var(--surface-2); color: var(--text-1); }

.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

/* Modal content helpers */
.btn-primary, .btn-secondary {
    padding: 0.5rem 1.125rem;
    border-radius: var(--radius);
    border: none;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: background 0.15s;
    font-family: inherit;
}

.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-h); color: #ffffff; }

.btn-secondary { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border-2); }
.btn-secondary:hover { background: var(--surface-3); }

/* ════════════════════════
   DETAIL MODAL GRID
   ════════════════════════ */
.detail-grid { display: grid; gap: 1rem; }

.detail-section {
    background: var(--surface-2);
    padding: 1rem 1.125rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.detail-section.full-width { grid-column: 1 / -1; }

.detail-section h3 {
    margin: 0 0 0.75rem;
    font-size: 0.7rem;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

.detail-item {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
    align-items: start;
}

.detail-item.full-width { grid-template-columns: 1fr; }
.detail-item:last-child { margin-bottom: 0; }

.detail-item label {
    font-weight: 600;
    color: var(--text-2);
    font-size: 0.78rem;
    text-transform: none;
    letter-spacing: 0;
    margin: 0;
}

.detail-item span { color: var(--text-1); word-break: break-word; font-size: 0.875rem; }

.detail-text {
    color: var(--text-1);
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.875rem;
}

.notes-content {
    background: var(--surface);
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    color: var(--text-1);
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 80px;
    font-size: 0.875rem;
}

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

.budget-item {
    background: var(--surface);
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.budget-item label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
    font-weight: 700;
}

.budget-item .num {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-1);
}

.budget-item.budget-total .num { color: var(--accent); }
.budget-item.budget-used   .num { color: var(--warning); }
.budget-item.budget-remaining .num { color: var(--success); }

/* ════════════════════════
   SECTION HEADER
   ════════════════════════ */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    gap: 1rem;
}

.action-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ════════════════════════
   INDICATORS PAGE
   ════════════════════════ */
.indicators-page { margin-top: 0.75rem; margin-bottom: 1.5rem; }

/* ════════════════════════
   MULTI-SELECT
   ════════════════════════ */
.multiselect-wrapper { position: relative; width: 100%; }

.multiselect-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--radius);
    border: 1px solid var(--border-2);
    padding: 0.45rem 0.65rem;
    background: var(--surface);
    cursor: pointer;
    min-height: 2.25rem;
    flex-wrap: wrap;
    gap: 0.25rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.multiselect-display:hover { border-color: var(--primary); }

.multiselect-display.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.multiselect-placeholder { color: var(--text-3); flex: 1; font-size: 0.875rem; }

.multiselect-tags { display: flex; flex-wrap: wrap; gap: 0.25rem; flex: 1; }

.multiselect-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: var(--primary-dim);
    color: var(--primary);
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
}

.multiselect-tag-remove { cursor: pointer; font-weight: bold; margin-left: 0.15rem; }
.multiselect-tag-remove:hover { opacity: 0.7; }

.multiselect-arrow { color: var(--text-3); font-size: 0.65rem; transition: transform 0.2s; margin-left: 0.4rem; }
.multiselect-display.active .multiselect-arrow { transform: rotate(180deg); }

.multiselect-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    max-height: 280px;
    overflow: hidden;
    flex-direction: column;
}

.multiselect-dropdown.active { display: flex; }

.multiselect-search {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    font-size: 0.85rem;
    background: var(--surface-2);
}

.multiselect-search:focus { outline: none; border-bottom-color: var(--primary); box-shadow: none; }

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

.multiselect-option {
    display: flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.1s;
}

.multiselect-option:hover { background: var(--primary-dim); }

.multiselect-option input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    cursor: pointer;
    accent-color: var(--primary);
}

.multiselect-option span { flex: 1; user-select: none; }
.multiselect-option.hidden { display: none; }

/* ════════════════════════
   RESPONSIVE
   ════════════════════════ */
@media (max-width: 768px) {
    .container { padding: 0 1rem; margin-top: 1.25rem; }
    .top-bar { padding: 0 1rem; }
    .top-bar .brand { margin-right: 1rem; }
    .dashboard { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .table-wrapper { -webkit-overflow-scrolling: touch; }
    .hero-header { flex-direction: column; align-items: flex-start; }
}
