/* =============================================================================
   SENTINEL-ZERO: Main Stylesheet
   Navy #1B2A4A | Gold #D4A843 | White #FFFFFF | Light-grey #F5F6F8
   ============================================================================= */

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

:root {
    --navy:      #1B2A4A;
    --navy-light:#2C3E6A;
    --gold:      #D4A843;
    --green:     #2E7D32;
    --red:       #C62828;
    --grey-bg:   #F5F6F8;
    --grey-mid:  #DEE1E6;
    --grey-text: #6B7280;
    --white:     #FFFFFF;
    --font:      'Segoe UI', system-ui, sans-serif;
    --radius:    6px;
    --shadow:    0 2px 8px rgba(0,0,0,.10);
}

body { font-family: var(--font); background: var(--grey-bg); color: #1a1a2e; font-size: 14px; line-height: 1.55; }

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

.sidebar {
    width: 230px; flex-shrink: 0;
    background: var(--navy); color: var(--white);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-logo { padding: 24px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-logo h2 { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.sidebar-logo h2 span { color: var(--gold); }
.sidebar-logo p { font-size: 10px; color: rgba(255,255,255,.5); margin-top: 2px; text-transform: uppercase; letter-spacing: 1px; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; color: rgba(255,255,255,.75);
    text-decoration: none; font-size: 13px; transition: all .15s;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,.08);
    color: var(--white);
    border-left-color: var(--gold);
}
.sidebar-nav .nav-section {
    font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
    color: rgba(255,255,255,.35); padding: 16px 20px 4px;
}
.sidebar-footer { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; color: rgba(255,255,255,.5); }
.sidebar-footer strong { color: var(--white); display: block; margin-bottom: 2px; }
.sidebar-footer a { color: var(--gold); text-decoration: none; }

.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
    background: var(--white); border-bottom: 1px solid var(--grey-mid);
    padding: 12px 28px; display: flex; align-items: center; justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.topbar h1 { font-size: 17px; font-weight: 600; color: var(--navy); }
.topbar .topbar-actions { display: flex; gap: 8px; align-items: center; }

.page-body { padding: 28px; flex: 1; overflow-y: auto; }

/* ── CARDS ────────────────────────────────────────────────────────────────── */
.card {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 20px;
}
.card-header {
    padding: 14px 20px; border-bottom: 1px solid var(--grey-mid);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 14px; font-weight: 600; color: var(--navy); }
.card-header .badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--grey-bg); color: var(--grey-text); }
.card-body { padding: 20px; }

/* ── FORMS ────────────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--navy); text-transform: uppercase; letter-spacing: .4px; }
.form-group input,
.form-group select,
.form-group textarea {
    border: 1px solid var(--grey-mid); border-radius: var(--radius);
    padding: 8px 10px; font-size: 13px; font-family: var(--font);
    transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus { outline: none; border-color: var(--navy); }
.form-group .hint { font-size: 11px; color: var(--grey-text); }

/* ── SCOPE TABLE ──────────────────────────────────────────────────────────── */
.scope-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.scope-table thead th {
    background: var(--navy); color: var(--white);
    padding: 9px 12px; text-align: left; font-size: 11px;
    text-transform: uppercase; letter-spacing: .5px;
}
.scope-table tbody tr { border-bottom: 1px solid var(--grey-mid); transition: background .1s; }
.scope-table tbody tr:hover { background: #f0f4ff; }
.scope-table td { padding: 7px 12px; vertical-align: middle; }
.scope-table tr.chapter-row td { background: #EEF1F7; font-weight: 700; color: var(--navy); font-size: 12px; text-transform: uppercase; }
.scope-table tr.included td:first-child { border-left: 3px solid var(--green); }
.scope-table tr.excluded td:first-child { border-left: 3px solid var(--red); }
.scope-table tr.excluded td.desc-cell { color: var(--grey-text); text-decoration: line-through; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 38px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0; background: #ccc; border-radius: 22px;
    cursor: pointer; transition: .2s;
}
.toggle-slider:before {
    content: ''; position: absolute;
    width: 16px; height: 16px; left: 3px; bottom: 3px;
    background: white; border-radius: 50%; transition: .2s;
}
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider:before { transform: translateX(16px); }

/* ── BUTTONS ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius);
    font-size: 13px; font-weight: 600; cursor: pointer;
    border: none; text-decoration: none; transition: all .15s;
}
.btn-primary   { background: var(--navy);  color: var(--white); }
.btn-primary:hover { background: var(--navy-light); }
.btn-gold      { background: var(--gold);  color: var(--white); }
.btn-gold:hover { opacity: .9; }
.btn-danger    { background: var(--red);   color: var(--white); }
.btn-outline   { background: transparent; border: 1px solid var(--grey-mid); color: var(--navy); }
.btn-outline:hover { border-color: var(--navy); }
.btn-block     { width: 100%; justify-content: center; }
.btn-sm        { padding: 5px 10px; font-size: 12px; }

/* ── ALERTS ───────────────────────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; }
.alert-danger  { background: #fde8e8; color: var(--red); border: 1px solid #f5c6c6; }
.alert-success { background: #e8f5e9; color: var(--green); border: 1px solid #c8e6c9; }
.alert-warning { background: #fff8e1; color: #7c5c00; border: 1px solid #ffe082; }

/* ── STATS ROW ────────────────────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }
.stat-card .stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--grey-text); margin-bottom: 6px; }
.stat-card .stat-value { font-size: 22px; font-weight: 700; color: var(--navy); }
.stat-card .stat-sub   { font-size: 11px; color: var(--grey-text); margin-top: 3px; }

/* ── TABLES (lists) ───────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { background: var(--grey-bg); color: var(--navy); padding: 9px 14px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 2px solid var(--grey-mid); }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--grey-mid); }
.data-table tbody tr:hover { background: #f7f9ff; }

/* ── STATUS BADGES ────────────────────────────────────────────────────────── */
.status { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.status-draft     { background: #e8eaf6; color: #3949ab; }
.status-generated { background: #e3f2fd; color: #1565c0; }
.status-approved  { background: #e8f5e9; color: var(--green); }
.status-archived  { background: var(--grey-bg); color: var(--grey-text); }

/* ── LOGIN PAGE ───────────────────────────────────────────────────────────── */
body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--navy); }
.login-card { background: var(--white); border-radius: 10px; padding: 40px 36px; width: 360px; box-shadow: 0 8px 32px rgba(0,0,0,.25); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-mark { font-size: 38px; color: var(--gold); display: block; margin-bottom: 4px; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--navy); }
.login-logo h1 span { color: var(--gold); }
.login-logo p { font-size: 11px; color: var(--grey-text); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }

/* ── FINANCIAL SUMMARY BAR ────────────────────────────────────────────────── */
.fin-summary {
    background: var(--navy); color: var(--white);
    border-radius: var(--radius); padding: 18px 24px;
    display: flex; flex-wrap: wrap; gap: 24px; align-items: center;
    margin-bottom: 20px;
}
.fin-item .fin-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: rgba(255,255,255,.55); }
.fin-item .fin-value { font-size: 18px; font-weight: 700; }
.fin-item.highlight .fin-value { color: var(--gold); font-size: 22px; }
.fin-divider { width: 1px; background: rgba(255,255,255,.15); align-self: stretch; }

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .page-body { padding: 16px; }
}
