/* ================================================================
   SIGPRO — UNDP Institutional Design System
   PNUD Honduras / Registro Nacional de las Personas
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
    /* UNDP Institutional Palette */
    --undp-blue: #0468B1;
    --undp-dark: #033F73;
    --undp-deep: #021E3A;
    --undp-teal: #00A19A;
    --undp-gold: #FBC412;
    --undp-red: #EE402D;

    /* Extended palette */
    --undp-blue-light: #0680D7;
    --undp-teal-light: #00C4BC;
    --undp-teal-muted: rgba(0, 161, 154, 0.08);
    --undp-gold-light: #FDDA5C;
    --undp-gold-muted: rgba(251, 196, 18, 0.12);

    /* Surfaces */
    --surface-bg: #F0F4F8;
    --surface-card: #FFFFFF;
    --surface-elevated: #FFFFFF;
    --surface-subtle: #F7F9FB;

    /* Borders */
    --border-default: #E1E7EF;
    --border-light: #EDF1F7;
    --border-accent: var(--undp-teal);

    /* Text */
    --text-primary: #0A1628;
    --text-secondary: #4A5568;
    --text-muted: #8896AB;
    --text-inverse: #FFFFFF;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(2, 30, 58, 0.04);
    --shadow-sm: 0 1px 3px rgba(2, 30, 58, 0.06), 0 1px 2px rgba(2, 30, 58, 0.04);
    --shadow-md: 0 4px 12px rgba(2, 30, 58, 0.08), 0 2px 4px rgba(2, 30, 58, 0.04);
    --shadow-lg: 0 8px 24px rgba(2, 30, 58, 0.10), 0 4px 8px rgba(2, 30, 58, 0.06);
    --shadow-xl: 0 16px 48px rgba(2, 30, 58, 0.12);

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Transitions */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 0px;
    --topbar-height: 60px;

    /* Gantt / Report */
    --label-width: 340px;
    --cell-min: 38px;
    --phase-spec: #EE402D;
    --phase-pnud: #FBC412;
    --phase-exec: #00A19A;
    --phase-progress: #0468B1;
}

/* ── Base Reset & Typography ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Source Sans 3', system-ui, -apple-system, sans-serif;
    background: var(--surface-bg);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    overflow-x: hidden;
}

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(195deg, var(--undp-deep) 0%, var(--undp-dark) 60%, #04507D 100%);
    color: var(--text-inverse);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform var(--duration-slow) var(--ease-out);
    box-shadow: 4px 0 24px rgba(2, 30, 58, 0.15);
}

.sidebar .brand {
    padding: 22px 24px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.12);
}

.sidebar .brand::before {
    content: '';
    width: 32px;
    height: 32px;
    background: var(--undp-gold);
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23021E3A' width='18' height='18'%3E%3Cpath d='M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6zm-1 2l5 5h-5V4zM6 20V4h5v7h7v9H6z'/%3E%3Crect x='8' y='13' width='8' height='1.5' rx='.75'/%3E%3Crect x='8' y='16' width='5' height='1.5' rx='.75'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px;
}

.sidebar .nav-section {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.35);
    padding: 24px 24px 8px;
    font-weight: 600;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.65);
    padding: 10px 24px 10px 24px;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--duration-fast) ease;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    position: relative;
}

.sidebar .nav-link:hover {
    color: var(--text-inverse);
    background: rgba(255, 255, 255, 0.07);
    border-left-color: rgba(255, 255, 255, 0.2);
}

.sidebar .nav-link.active {
    color: var(--text-inverse);
    background: rgba(0, 161, 154, 0.15);
    border-left-color: var(--undp-teal);
    font-weight: 600;
}

.sidebar .nav-link svg,
.sidebar .nav-link .nav-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}

.sidebar .nav-link:hover svg,
.sidebar .nav-link:hover .nav-icon {
    opacity: 1;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
}

/* ── Mobile hamburger ──────────────────────────────────────────── */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1060;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--undp-deep);
    color: var(--text-inverse);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: background var(--duration-fast) ease;
}

.sidebar-toggle:hover { background: var(--undp-dark); }

.sidebar-toggle svg { width: 20px; height: 20px; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 30, 58, 0.5);
    z-index: 1040;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity var(--duration-normal) ease;
}

.sidebar-overlay.active {
    opacity: 1;
}

/* ── Main Content ──────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--surface-bg);
    transition: margin-left var(--duration-slow) var(--ease-out);
}

.top-bar {
    background: var(--surface-card);
    border-bottom: 1px solid var(--border-default);
    padding: 0 28px;
    height: var(--topbar-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-xs);
}

.top-bar .page-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--undp-deep);
    letter-spacing: -0.3px;
}

.top-bar .user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.top-bar .user-badge::before {
    content: '';
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--undp-teal), var(--undp-blue));
    flex-shrink: 0;
}

.content-area {
    padding: 28px;
    max-width: 1800px;
}

/* ── Cards (Global) ────────────────────────────────────────────── */
.card {
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm) !important;
    overflow: hidden;
    transition: box-shadow var(--duration-normal) var(--ease-out);
}

.card:hover {
    box-shadow: var(--shadow-md) !important;
}

.card-header {
    background: var(--surface-card) !important;
    border-bottom: 1px solid var(--border-default) !important;
    padding: 16px 24px !important;
    font-weight: 600;
    color: var(--undp-deep);
}

.card-body { padding: 24px !important; }

/* ── Stat Cards ────────────────────────────────────────────────── */
.stat-card,
.report-stat,
.proj-stat {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    padding: 22px 26px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-default);
    border-left: 4px solid var(--undp-teal);
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.stat-card:hover,
.report-stat:hover,
.proj-stat:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-left-color: var(--undp-blue);
}

.stat-card .value,
.report-stat .val,
.proj-stat .val {
    font-size: 28px;
    font-weight: 800;
    color: var(--undp-deep);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.stat-card .label,
.report-stat .lbl,
.proj-stat .lbl {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn-primary,
.btn-primary:focus {
    background: var(--undp-blue) !important;
    border-color: var(--undp-blue) !important;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-size: 14px;
    transition: all var(--duration-fast) ease;
    box-shadow: 0 2px 4px rgba(4, 104, 177, 0.25);
}

.btn-primary:hover {
    background: var(--undp-dark) !important;
    border-color: var(--undp-dark) !important;
    box-shadow: 0 4px 12px rgba(4, 104, 177, 0.3);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--undp-blue) !important;
    border-color: var(--undp-blue) !important;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.btn-outline-primary:hover {
    background: var(--undp-blue) !important;
    border-color: var(--undp-blue) !important;
    color: white !important;
}

.btn-outline-secondary {
    color: var(--text-secondary) !important;
    border-color: var(--border-default) !important;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.btn-outline-secondary:hover {
    background: var(--surface-subtle) !important;
    color: var(--text-primary) !important;
}

.btn-outline-danger {
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.btn-gold {
    background: var(--undp-gold) !important;
    border-color: var(--undp-gold) !important;
    color: var(--undp-deep) !important;
    font-weight: 700;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 8px rgba(251, 196, 18, 0.3);
}

.btn-gold:hover {
    background: var(--undp-gold-light) !important;
    box-shadow: 0 4px 16px rgba(251, 196, 18, 0.4);
    transform: translateY(-1px);
}

/* ── Tables ────────────────────────────────────────────────────── */
.table {
    font-size: 13.5px;
}

.table thead th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-default);
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.table-hover tbody tr:hover {
    background-color: var(--undp-teal-muted) !important;
}

.table-light {
    --bs-table-bg: var(--surface-subtle) !important;
}

/* ── Badges ────────────────────────────────────────────────────── */
.badge.bg-primary {
    background-color: var(--undp-blue) !important;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 11px;
}

.badge.bg-danger {
    background-color: var(--undp-red) !important;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 11px;
}

/* ── Forms ─────────────────────────────────────────────────────── */
.form-control, .form-select {
    border: 1.5px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    transition: all var(--duration-fast) ease;
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--undp-blue);
    box-shadow: 0 0 0 3px rgba(4, 104, 177, 0.12);
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
}

.form-check-input:checked {
    background-color: var(--undp-blue);
    border-color: var(--undp-blue);
}

/* ── Alerts ────────────────────────────────────────────────────── */
.alert {
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    border: none;
    padding: 14px 18px;
}

.alert-danger {
    background: rgba(238, 64, 45, 0.08);
    color: #B91C1C;
    border-left: 4px solid var(--undp-red);
}

.alert-success {
    background: rgba(0, 161, 154, 0.08);
    color: #065F5B;
    border-left: 4px solid var(--undp-teal);
}

/* ── Tabs (Report View) ───────────────────────────────────────── */
.nav-tabs {
    border-bottom: 2px solid var(--border-default);
    gap: 4px;
}

.nav-tabs .nav-link {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    padding: 12px 20px;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    transition: all var(--duration-fast) ease;
    margin-bottom: -2px;
}

.nav-tabs .nav-link:hover {
    color: var(--undp-blue);
    border-bottom-color: rgba(4, 104, 177, 0.3);
    background: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--undp-blue) !important;
    border-bottom-color: var(--undp-blue) !important;
    background: transparent !important;
    font-weight: 700;
}

/* ── Report Stats Grid ─────────────────────────────────────────── */
.report-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

/* ── Gantt Chart ───────────────────────────────────────────────── */
.gantt-wrapper {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-default);
    overflow: hidden;
}

.gantt-head {
    background: var(--surface-subtle);
    border-bottom: 2px solid var(--border-default);
}

.gantt-head-label {
    background: var(--surface-subtle) !important;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.year-cell {
    color: var(--undp-deep);
    font-weight: 700;
}

.month-cell {
    color: var(--text-muted);
    font-weight: 600;
}

.category-header {
    background: linear-gradient(90deg, var(--surface-subtle) 0%, var(--surface-card) 100%) !important;
    border-bottom: 1px solid var(--border-default) !important;
    transition: background var(--duration-fast) ease;
}

.category-header:hover {
    background: linear-gradient(90deg, var(--undp-teal-muted) 0%, var(--surface-subtle) 100%) !important;
}

.cat-name {
    color: var(--undp-deep) !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px;
}

.cat-count {
    color: var(--text-muted) !important;
}

.gantt-label {
    background: var(--surface-card) !important;
    border-right: 2px solid var(--border-default) !important;
}

.gantt-row:hover {
    background-color: var(--undp-teal-muted) !important;
}

.gantt-row:hover .gantt-label {
    background-color: var(--undp-teal-muted) !important;
}

.cell.phase-spec { background: var(--phase-spec) !important; }
.cell.phase-pnud { background: var(--phase-pnud) !important; }
.cell.phase-exec { background: var(--phase-exec) !important; }
.cell.phase-progress { background: var(--phase-progress) !important; }

.label-cost {
    color: var(--undp-teal) !important;
    font-weight: 600;
}

/* ── Analysis Cards ────────────────────────────────────────────── */
.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.analysis-card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    padding: 22px 26px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-default);
}

.analysis-card.full-width { grid-column: 1 / -1; }

.analysis-card h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--undp-deep);
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.findings-list li {
    background: var(--surface-subtle);
    border-left: 3px solid var(--undp-blue);
    border-radius: var(--radius-sm);
}

.finding-value {
    color: var(--undp-blue) !important;
    font-weight: 700;
}

/* Analysis bars */
.bar-fill {
    background: var(--undp-blue) !important;
}

.vbar-bar {
    width: 100%;
    max-width: 32px;
    min-height: 2px;
    background: var(--undp-blue) !important;
    border-radius: 3px 3px 0 0;
    transition: height 0.5s var(--ease-out);
}

.vbar-bar:hover {
    background: var(--undp-dark) !important;
}

.phase-dot { border-radius: 4px !important; }

.top-rank {
    color: var(--undp-blue) !important;
    font-weight: 800;
}

.top-cost {
    color: var(--undp-deep) !important;
}

/* ── Projection ────────────────────────────────────────────────── */
.proj-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.proj-card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    padding: 22px 26px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-default);
    margin-bottom: 24px;
}

.proj-card h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--undp-deep);
    margin-bottom: 18px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.proj-table th {
    color: var(--text-muted) !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.proj-bar {
    width: 100%;
    max-width: 36px;
    min-height: 2px;
    background: var(--undp-teal) !important;
    border-radius: 3px 3px 0 0;
}

.proj-cum-container svg {
    width: 100%;
    height: 100%;
}

.proj-bar:hover {
    filter: brightness(1.12);
}

.proj-note {
    color: var(--text-muted);
}

.proj-month-row:hover {
    background: var(--undp-teal-muted) !important;
}

.proj-month-row.expanded {
    background: var(--surface-subtle);
}

.proj-detail-row {
    background: var(--surface-subtle) !important;
}

.row-total {
    background: var(--surface-subtle) !important;
    font-weight: 700;
}

/* ── Upload / Drag-drop zone ───────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    text-align: center;
    transition: all var(--duration-normal) var(--ease-out);
    cursor: pointer;
    background: var(--surface-subtle);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--undp-teal);
    background: var(--undp-teal-muted);
}

.upload-zone .upload-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: var(--undp-teal-muted);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Empty State ───────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: var(--surface-subtle);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Utility Classes ───────────────────────────────────────────── */

/* Button: teal variant (POA accent) */
.btn-teal {
    background: var(--undp-teal);
    border-color: var(--undp-teal);
    color: white;
    font-weight: 600;
    border-radius: var(--radius-sm);
}
.btn-teal:hover {
    background: var(--undp-teal-light);
    border-color: var(--undp-teal-light);
    color: white;
}
.btn-outline-teal {
    border: 1.5px solid var(--undp-teal);
    color: var(--undp-teal);
    background: transparent;
    font-weight: 600;
    border-radius: var(--radius-sm);
}
.btn-outline-teal:hover {
    background: var(--undp-teal);
    color: white;
}

/* Table cell utilities */
.cell-primary { font-weight: 600; color: var(--text-primary); }
.cell-code { font-weight: 600; color: var(--undp-blue); white-space: nowrap; }
.cell-bold { font-weight: 600; }
.cell-muted { font-size: 12px; color: var(--text-muted); }
.cell-nowrap { white-space: nowrap; }
.cell-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cell-number { font-variant-numeric: tabular-nums; text-align: right; }

/* Row highlights */
.row-critical { background: #FFF5F5 !important; border-left: 3px solid var(--undp-red); }
.row-product { background: var(--undp-dark); color: white; font-weight: 700; }
.row-product td { padding: 10px 16px !important; background: var(--undp-dark); color: white; font-weight: 700; }
.row-activity { background: #E8F0FA; color: var(--undp-dark); font-weight: 600; }
.row-activity td { padding: 8px 16px 8px 28px !important; font-size: 12px; background: #E8F0FA; color: var(--undp-dark); font-weight: 600; }
.row-subprocess { background: var(--surface-subtle); font-style: italic; color: var(--text-muted); }
.row-subprocess td { padding: 6px 16px 6px 42px !important; font-size: 12px; }

/* Phase dot indicator */
.phase-dot-inline {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 4px;
}

/* Card variants */
.card-body-dense { padding: 16px !important; }
.card-body-spacious { padding: 36px !important; }

/* Module accent cards */
.card-accent-blue { border-left: 3px solid var(--undp-blue) !important; }
.card-accent-teal { border-left: 3px solid var(--undp-teal) !important; }
.card-accent-gold { border-left: 3px solid var(--undp-gold) !important; }
.card-accent-red { border-left: 3px solid var(--undp-red) !important; }

/* Upload page icon */
.upload-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.upload-icon-blue { background: rgba(4, 104, 177, 0.08); color: var(--undp-blue); }
.upload-icon-teal { background: var(--undp-teal-muted); color: var(--undp-teal); }

/* Section header with indicator dot */
.section-title {
    font-weight: 700;
    color: var(--undp-deep);
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}
.section-title-blue::before { background: var(--undp-blue); }
.section-title-teal::before { background: var(--undp-teal); }

/* Quick action card (home page) */
.quick-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
}
.quick-action-title { font-size: 14px; font-weight: 700; color: var(--undp-deep); margin-bottom: 4px; }
.quick-action-desc { font-size: 12px; color: var(--text-muted); margin: 0; }

/* Sticky toolbar (shared by PAC/POA editors) */
.sticky-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface-card);
    border-bottom: 1px solid var(--border-light);
    padding: 10px 16px;
    margin: 0 -12px 16px;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Gantt CPM bar chart */
.gantt-cpm-container {
    min-width: 700px;
    padding: 16px;
}
.gantt-cpm-row {
    display: flex;
    align-items: center;
    margin-bottom: 3px;
    min-height: 26px;
}
.gantt-cpm-label {
    width: 240px;
    min-width: 240px;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 10px;
}
.gantt-cpm-track {
    flex: 1;
    position: relative;
    height: 22px;
    background: var(--surface-subtle);
    border-radius: 4px;
}
.gantt-cpm-bar {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: white;
    min-width: 18px;
    transition: filter var(--duration-fast);
}
.gantt-cpm-bar:hover { filter: brightness(1.15); }
.gantt-cpm-bar-normal { background: var(--undp-blue); }
.gantt-cpm-bar-critical { background: var(--undp-red); }

/* Back-to-top FAB */
.back-to-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 200;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--undp-blue);
    color: white;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity var(--duration-normal), transform var(--duration-normal);
}
.back-to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover { background: var(--undp-dark); }

/* Save toast */
.save-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 300;
    background: var(--undp-teal);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-normal), transform var(--duration-normal);
}
.save-toast.visible { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }

/* Form label compact */
.form-label-sm { font-size: 12px; font-weight: 600; color: var(--undp-deep); margin-bottom: 2px; }

/* Responsive tables — reduce font on mobile */
@media (max-width: 768px) {
    .table { font-size: 12px; }
    .cell-truncate { max-width: 120px; }
    .gantt-cpm-label { width: 160px; min-width: 160px; }
    .quick-action { flex-direction: column; align-items: flex-start; }
}

/* ── Login Page ────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--undp-deep);
    position: relative;
    overflow: hidden;
    padding: 40px;
}

.login-inner {
    display: flex;
    align-items: center;
    gap: 60px;
    max-width: 1060px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -10%;
    width: 60%;
    height: 120%;
    background: radial-gradient(ellipse, rgba(4, 104, 177, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -10%;
    width: 50%;
    height: 80%;
    background: radial-gradient(ellipse, rgba(0, 161, 154, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: var(--text-inverse);
}

.login-left h2 {
    font-size: 40px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1px;
    margin-bottom: 16px;
}

.login-left p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
    max-width: 400px;
    line-height: 1.7;
}

.login-left .undp-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--undp-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 24px;
}

.login-left .undp-tag::before {
    content: '';
    width: 24px;
    height: 2px;
    background: var(--undp-gold);
}

.login-features {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 420px;
}

.login-feature {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.2s;
}

.login-feature:hover {
    background: rgba(255, 255, 255, 0.1);
}

.login-feature-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(0, 161, 154, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--undp-teal);
}

.login-feature strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2px;
}

.login-feature span {
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.4;
}

.login-feature.coming-soon {
    opacity: 0.6;
    border-style: dashed;
}

.login-feature.coming-soon .login-feature-icon {
    background: rgba(251, 196, 18, 0.12);
    color: var(--undp-gold);
}

.badge-soon {
    display: inline-block;
    font-size: 10px !important;
    font-weight: 700;
    color: var(--undp-gold) !important;
    background: rgba(251, 196, 18, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.login-right {
    width: 420px;
    flex-shrink: 0;
}

.login-card {
    background: var(--surface-card);
    border-radius: var(--radius-xl);
    padding: 44px 40px;
    width: 100%;
    box-shadow: var(--shadow-xl);
}

.login-card h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--undp-deep);
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.login-card .subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 36px;
    font-weight: 500;
}

.login-card .form-control {
    padding: 12px 16px;
    font-size: 15px;
}

.login-card .btn-primary {
    padding: 13px 20px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .top-bar {
        padding-left: 64px !important;
    }

    .content-area {
        padding: 20px 16px;
    }

    /* Login */
    .login-page { padding: 24px; }
    .login-inner { flex-direction: column; gap: 32px; }
    .login-left { text-align: center; }
    .login-left h2 { font-size: 28px; }
    .login-left p { margin: 0 auto; }
    .login-left .undp-tag { justify-content: center; }
    .login-features { margin: 20px auto 0; }
    .login-feature { text-align: left; }
    .login-right { width: 100%; }
    .login-card { padding: 32px 24px; }
}

@media (max-width: 768px) {
    .analysis-grid { grid-template-columns: 1fr; }

    .report-stats {
        grid-template-columns: 1fr 1fr;
    }

    .proj-summary {
        grid-template-columns: 1fr 1fr;
    }

    .bar-label {
        width: 120px;
        min-width: 120px;
    }

    .table-responsive-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    :root {
        --label-width: 200px;
        --cell-min: 28px;
    }

    .nav-tabs .nav-link {
        font-size: 12px;
        padding: 10px 12px;
    }

    .stat-card .value,
    .report-stat .val {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .report-stats,
    .proj-summary {
        grid-template-columns: 1fr;
    }

    .login-left h2 { font-size: 24px; }
}

/* ── Print ─────────────────────────────────────────────────────── */
@media print {
    .sidebar,
    .sidebar-toggle,
    .top-bar { display: none !important; }

    .main-content { margin-left: 0 !important; }

    body { background: white; }

    .content-area { padding: 0; }

    .card { box-shadow: none !important; border: 1px solid #ddd !important; }

    .tab-content > .tab-pane { display: block !important; opacity: 1 !important; }

    .nav-tabs { display: none; }

    .gantt-label,
    .gantt-head-label { position: static !important; }

    :root { --cell-min: 24px; --label-width: 260px; }
}

/* ── Animations ────────────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-in {
    animation: fadeUp var(--duration-slow) var(--ease-out) both;
}

.animate-in:nth-child(1) { animation-delay: 0ms; }
.animate-in:nth-child(2) { animation-delay: 60ms; }
.animate-in:nth-child(3) { animation-delay: 120ms; }
.animate-in:nth-child(4) { animation-delay: 180ms; }
