@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Source+Sans+3:wght@300;400;600;700&display=swap');

:root {
    --green-dark:   #1a3d2b;
    --green-mid:    #2a6041;
    --green-light:  #3d8a5a;
    --green-pale:   #e8f5ee;
    --gold:         #c9a84c;
    --gold-light:   #f0d98a;
    --teal:         #1a5f6e;
    --teal-light:   #e8f4f7;
    --white:        #ffffff;
    --gray-50:      #f9fafb;
    --gray-100:     #f3f4f6;
    --gray-200:     #e5e7eb;
    --gray-400:     #9ca3af;
    --gray-600:     #4b5563;
    --gray-800:     #1f2937;
    --red:          #c0392b;
    --red-light:    #fdecea;
    --orange:       #e67e22;
    --orange-light: #fef3e2;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
    --shadow-md:    0 4px 12px rgba(0,0,0,.1);
    --shadow-lg:    0 8px 24px rgba(0,0,0,.12);
    --radius:       10px;
    --radius-sm:    6px;
}

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

html { font-size: 15px; }

body {
    font-family: 'Source Sans 3', sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    min-height: 100vh;
}

/* ── LAYOUT ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(160deg, var(--green-dark) 0%, var(--green-mid) 60%, var(--teal) 100%);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    box-shadow: 3px 0 20px rgba(0,0,0,.2);
}

.sidebar-logo {
    padding: 28px 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-logo .badge {
    width: 48px; height: 48px;
    background: var(--gold);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem; font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.sidebar-logo h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1rem; font-weight: 700;
    color: var(--white); line-height: 1.3;
}
.sidebar-logo p {
    font-size: .72rem; color: rgba(255,255,255,.65);
    margin-top: 3px; line-height: 1.4;
}

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-section-label {
    font-size: .68rem; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.45);
    padding: 12px 22px 6px;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 22px;
    color: rgba(255,255,255,.82);
    text-decoration: none;
    font-size: .88rem; font-weight: 400;
    transition: all .18s;
    border-left: 3px solid transparent;
}
.nav-item:hover {
    background: rgba(255,255,255,.08);
    color: var(--white);
    border-left-color: var(--gold-light);
}
.nav-item.active {
    background: rgba(255,255,255,.13);
    color: var(--white);
    font-weight: 600;
    border-left-color: var(--gold);
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; }

.sidebar-footer {
    padding: 16px 22px;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: .72rem;
    color: rgba(255,255,255,.4);
    line-height: 1.5;
}

.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 32px;
    height: 60px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
    box-shadow: var(--shadow-sm);
}
.topbar-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.05rem; font-weight: 600;
    color: var(--green-dark);
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-date { font-size: .8rem; color: var(--gray-400); }

.page-body { padding: 28px 32px; flex: 1; }

/* ── CARDS ── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}
.card-header {
    background: var(--green-dark);
    color: var(--white);
    padding: 14px 22px;
    display: flex; align-items: center; gap: 10px;
}
.card-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: .95rem; font-weight: 600;
}
.card-header .section-number {
    width: 28px; height: 28px;
    background: var(--gold);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 700;
    color: var(--green-dark);
    flex-shrink: 0;
}
.card-body { padding: 22px; }

/* ── DASHBOARD STATS ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex; flex-direction: column; gap: 6px;
    position: relative; overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.green::before { background: var(--green-light); }
.stat-card.gold::before  { background: var(--gold); }
.stat-card.teal::before  { background: var(--teal); }
.stat-card.red::before   { background: var(--red); }
.stat-card .stat-label { font-size: .78rem; color: var(--gray-600); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-value { font-family: 'Playfair Display', serif; font-size: 2rem; font-weight: 700; color: var(--green-dark); line-height: 1; }
.stat-card .stat-sub   { font-size: .75rem; color: var(--gray-400); }

/* ── FORMS ── */
.form-section {
    margin-bottom: 24px;
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
    font-size: .82rem; font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase; letter-spacing: .04em;
}
.form-group input,
.form-group select,
.form-group textarea {
    padding: 9px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit; font-size: .88rem;
    color: var(--gray-800);
    background: var(--white);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--green-light);
    box-shadow: 0 0 0 3px rgba(61,138,90,.12);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* ── SCORE GRID ── */
.score-grid {
    display: grid;
    gap: 0;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.score-row {
    display: grid;
    grid-template-columns: 1fr 200px 1fr;
    gap: 0;
    border-bottom: 1px solid var(--gray-200);
}
.score-row:last-child { border-bottom: none; }
.score-row:nth-child(even) { background: var(--gray-50); }
.score-area {
    padding: 10px 14px;
    font-size: .84rem; font-weight: 600;
    color: var(--green-dark);
    display: flex; align-items: center;
    border-right: 1px solid var(--gray-200);
}
.score-select-cell {
    padding: 8px 10px;
    display: flex; align-items: center;
    border-right: 1px solid var(--gray-200);
}
.score-select-cell select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: .84rem;
    background: var(--white);
}
.score-comment-cell { padding: 8px 10px; display: flex; align-items: center; }
.score-comment-cell input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: .82rem;
}
.score-header {
    background: var(--green-mid);
    color: var(--white);
    font-size: .78rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
    padding: 8px 14px;
}

/* ── RISK GRID ── */
.risk-grid {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.risk-row {
    display: grid;
    grid-template-columns: 1fr 160px 1fr;
    border-bottom: 1px solid var(--gray-200);
}
.risk-row:last-child { border-bottom: none; }
.risk-row:nth-child(even) { background: var(--gray-50); }
.risk-label { padding: 10px 14px; font-size: .84rem; font-weight: 600; color: var(--gray-800); border-right: 1px solid var(--gray-200); display: flex; align-items: center; }
.risk-level-cell { padding: 8px 10px; border-right: 1px solid var(--gray-200); display: flex; align-items: center; }
.risk-level-cell select { width: 100%; padding: 6px 8px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); font-size: .84rem; }
.risk-comment-cell { padding: 8px 10px; display: flex; align-items: center; }
.risk-comment-cell input { width: 100%; padding: 6px 8px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); font-size: .82rem; }

/* ── BUDGET CHECKLIST ── */
.budget-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.check-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s;
}
.check-item:hover { background: var(--green-pale); border-color: var(--green-light); }
.check-item input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--green-mid); }
.check-item label { font-size: .84rem; cursor: pointer; line-height: 1.3; }

/* ── TABLES ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
}
.data-table th {
    background: var(--green-dark);
    color: var(--white);
    padding: 10px 12px;
    text-align: left;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
}
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }
.data-table .table-wrapper { overflow-x: auto; }

/* ── BADGES ── */
.badge-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: .72rem; font-weight: 700;
    letter-spacing: .03em;
}
.score-high  { background: #dcf5e7; color: #1a6e3a; }
.score-mid   { background: #fff8e1; color: #7d5900; }
.score-low   { background: #fde8e7; color: #8b1a16; }
.risk-high   { background: #fde8e7; color: #8b1a16; }
.risk-medium { background: #fff8e1; color: #7d5900; }
.risk-low    { background: #dcf5e7; color: #1a6e3a; }
.cls-excellent  { background: #dcf5e7; color: #1a6e3a; }
.cls-good       { background: #e8f4f7; color: #0f4e5e; }
.cls-acceptable { background: #fff8e1; color: #7d5900; }
.cls-weak       { background: #ffe8cc; color: #7d3800; }
.cls-critical   { background: #fde8e7; color: #8b1a16; }
.status-done      { background: #dcf5e7; color: #1a6e3a; }
.status-ongoing   { background: #e8f4f7; color: #0f4e5e; }
.status-prep      { background: #ede8fd; color: #4a2c8a; }
.status-delayed   { background: #fde8e7; color: #8b1a16; }
.status-suspended { background: #fff8e1; color: #7d5900; }
.status-cancelled { background: #f3f4f6; color: #6b7280; }
.status-notstarted{ background: #f3f4f6; color: #6b7280; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-family: inherit; font-size: .86rem; font-weight: 600;
    cursor: pointer; border: none; text-decoration: none;
    transition: all .18s;
}
.btn-primary {
    background: var(--green-mid);
    color: var(--white);
}
.btn-primary:hover { background: var(--green-dark); box-shadow: 0 3px 10px rgba(42,96,65,.3); }
.btn-secondary {
    background: var(--white);
    color: var(--green-mid);
    border: 1.5px solid var(--green-mid);
}
.btn-secondary:hover { background: var(--green-pale); }
.btn-gold {
    background: var(--gold);
    color: var(--green-dark);
}
.btn-gold:hover { background: #b8943e; box-shadow: 0 3px 10px rgba(201,168,76,.3); }
.btn-danger {
    background: var(--red-light);
    color: var(--red);
    border: 1.5px solid #f5c6c3;
}
.btn-danger:hover { background: var(--red); color: var(--white); }
.btn-sm { padding: 5px 12px; font-size: .78rem; }

.btn-group { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ── PAGE HEADER ── */
.page-header {
    background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 70%, var(--teal) 100%);
    border-radius: var(--radius);
    padding: 28px 30px;
    margin-bottom: 24px;
    color: var(--white);
    position: relative;
    overflow: hidden;
}
.page-header::before {
    content: '';
    position: absolute; top: -30px; right: -30px;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,.05);
}
.page-header::after {
    content: '';
    position: absolute; bottom: -20px; right: 60px;
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(201,168,76,.15);
}
.page-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem; font-weight: 700;
    margin-bottom: 4px;
}
.page-header p {
    font-size: .85rem;
    opacity: .78;
}

/* ── TABS ── */
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 24px; gap: 0; }
.tab-btn {
    padding: 10px 22px;
    background: none; border: none; cursor: pointer;
    font-family: inherit; font-size: .88rem; font-weight: 600;
    color: var(--gray-400);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .18s;
}
.tab-btn.active { color: var(--green-mid); border-bottom-color: var(--green-mid); }
.tab-btn:hover { color: var(--green-dark); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── ALERTS ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: .86rem;
    margin-bottom: 16px;
    border-left: 4px solid;
}
.alert-success { background: #dcf5e7; color: #1a6e3a; border-color: #2a9a52; }
.alert-error   { background: var(--red-light); color: var(--red); border-color: var(--red); }
.alert-warning { background: var(--orange-light); color: #7d3800; border-color: var(--orange); }
.alert-info    { background: var(--teal-light); color: var(--teal); border-color: var(--teal); }

/* ── RED FLAGS ── */
.flag-card {
    border-left: 4px solid var(--red);
    background: var(--red-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 12px 16px;
    margin-bottom: 10px;
}
.flag-card .flag-title { font-weight: 700; color: var(--red); font-size: .86rem; }
.flag-card .flag-detail { font-size: .82rem; color: var(--gray-600); margin-top: 2px; }

/* ── SCORE SUMMARY ── */
.score-summary-bar {
    background: var(--gray-200);
    border-radius: 50px;
    height: 12px;
    overflow: hidden;
    margin-top: 6px;
}
.score-bar-fill {
    height: 100%;
    border-radius: 50px;
    background: linear-gradient(90deg, var(--green-light), var(--gold));
    transition: width .6s ease;
}

/* ── MISC ── */
.section-divider {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 24px 0;
}
.text-muted { color: var(--gray-400); font-size: .82rem; }
.text-gold { color: var(--gold); }
.fw-bold { font-weight: 700; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.full-width { width: 100%; }

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-400);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: .9rem; }

/* Progress bar in tables */
.mini-bar { height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; width: 80px; }
.mini-bar-fill { height: 100%; background: var(--green-light); border-radius: 3px; }

@media (max-width: 900px) {
    .sidebar { width: 220px; }
    .main-content { margin-left: 220px; }
    .page-body { padding: 20px; }
    .score-row { grid-template-columns: 1fr; }
    .score-comment-cell { display: none; }
    .grid-2 { grid-template-columns: 1fr; }
}
