/* ─────────────────────────────────────────────
   CMA Platform — assets/style.css
   ───────────────────────────────────────────── */
:root {
    --primary:    #1a3c5e;
    --accent:     #c8932a;
    --light-bg:   #f4f6f9;
    --card-bg:    #ffffff;
    --border:     #dee2e6;
    --text:       #212529;
    --muted:      #6c757d;
    --success:    #198754;
    --danger:     #dc3545;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--light-bg);
    color: var(--text);
    font-size: 0.91rem;
    margin: 0;
}

/* ── Navigation */
.app-nav {
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 60px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    position: sticky; top: 0; z-index: 1000;
}
.nav-brand { display: flex; align-items: center; gap: 0.75rem; }
.nav-brand-name { font-family: 'DM Serif Display', serif; font-size: 1.1rem; line-height: 1.1; }
.nav-brand-tag  { font-size: 0.65rem; opacity: 0.65; letter-spacing: 0.04em; }
.nav-links { display: flex; align-items: center; gap: 0.25rem; }
.nav-links a {
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    display: flex; align-items: center; gap: 5px;
}
.nav-links a:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav-user { position: relative; }
.nav-user > span {
    color: rgba(255,255,255,0.9);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    display: flex; align-items: center; gap: 5px;
}
.nav-user > span:hover { background: rgba(255,255,255,0.12); }

/* ── Main Layout */
.main-wrap {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem 4rem;
}
.main-wrap.wide { max-width: 1280px; }

/* ── Cards */
.card-form {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}
.section-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.25rem;
    color: var(--primary);
    margin-bottom: 0.2rem;
}
.section-sub { color: var(--muted); font-size: 0.8rem; margin-bottom: 1.25rem; }

/* ── Progress steps */
.progress-wrap {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    overflow-x: auto;
}
.step-track { display: flex; align-items: center; min-width: max-content; }
.step-item  { display: flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 500; color: #adb5bd; white-space: nowrap; }
.step-item.done   { color: var(--success); }
.step-item.active { color: var(--primary); font-weight: 700; }
.step-circle {
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid currentColor;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.65rem; font-weight: 700; flex-shrink: 0;
}
.step-item.done   .step-circle { background: var(--success); color: #fff; border-color: var(--success); }
.step-item.active .step-circle { background: var(--primary); color: #fff; }
.step-line { width: 24px; height: 2px; background: #dee2e6; flex-shrink: 0; }
.step-line.done { background: var(--success); }

/* ── Form controls */
.form-label  { font-weight: 500; font-size: 0.84rem; margin-bottom: 3px; }
.form-control, .form-select {
    border-radius: 6px; font-size: 0.86rem;
    border: 1px solid #ced4da; transition: border-color 0.15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,60,94,0.1);
}

/* ── Dynamic table inputs */
.input-table { width: 100%; border-collapse: collapse; }
.input-table th {
    background: var(--primary); color: #fff;
    font-size: 0.76rem; font-weight: 600;
    padding: 8px 10px; text-align: left; white-space: nowrap;
}
.input-table td {
    padding: 4px 5px; border-bottom: 1px solid #f0f0f0; vertical-align: middle;
}
.input-table tr:hover td { background: #fafbfc; }
.input-table .form-control { padding: 4px 7px; font-size: 0.82rem; border-radius: 4px; }
.sn-cell { width: 28px; text-align: center; color: var(--muted); font-size: 0.75rem; }
.del-cell { width: 32px; text-align: center; }
.btn-del-row {
    background: none; border: none; color: #e74c3c; cursor: pointer;
    font-size: 1rem; padding: 2px 4px; border-radius: 4px; line-height: 1;
}
.btn-del-row:hover { background: #fdecea; }
.btn-add-row {
    background: none; border: 1px dashed var(--primary); color: var(--primary);
    font-size: 0.78rem; font-weight: 600; padding: 5px 14px;
    border-radius: 6px; cursor: pointer; margin-top: 8px;
    display: inline-flex; align-items: center; gap: 4px;
    transition: all 0.15s;
}
.btn-add-row:hover { background: #eef3f8; }

/* ── Package cards */
.pkg-card {
    border: 2px solid var(--border); border-radius: 10px;
    padding: 1.2rem 1.4rem; cursor: pointer;
    transition: all 0.2s; position: relative; display: block;
}
.pkg-card:hover  { border-color: var(--primary); }
.pkg-card.selected { border-color: var(--accent); background: #fffbf3; }
.pkg-badge {
    position: absolute; top: -9px; right: 14px;
    background: var(--accent); color: #fff;
    font-size: 0.62rem; font-weight: 700; padding: 2px 9px;
    border-radius: 20px; letter-spacing: 0.06em; text-transform: uppercase;
}
.pkg-years { font-family: 'DM Serif Display', serif; font-size: 2rem; color: var(--primary); line-height: 1; }

/* ── Buttons */
.btn-primary-cma {
    background: var(--primary); color: #fff; border: none;
    border-radius: 7px; padding: 9px 22px; font-weight: 600;
    font-size: 0.86rem; cursor: pointer; transition: background 0.15s;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary-cma:hover { background: #142f4a; color: #fff; }
.btn-outline-cma {
    background: transparent; color: var(--primary);
    border: 2px solid var(--primary); border-radius: 7px;
    padding: 8px 18px; font-weight: 600; font-size: 0.86rem;
    cursor: pointer; transition: all 0.15s;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-outline-cma:hover { background: var(--primary); color: #fff; }
.btn-accent-cma {
    background: var(--accent); color: #fff; border: none;
    border-radius: 7px; padding: 9px 22px; font-weight: 600;
    font-size: 0.86rem; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
}

/* ── Dashboard report cards */
.report-card {
    background: #fff; border: 1px solid var(--border);
    border-radius: 10px; padding: 1.2rem 1.4rem;
    transition: box-shadow 0.2s, transform 0.15s;
    position: relative;
}
.report-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); transform: translateY(-1px); }
.report-card .rc-title { font-weight: 700; font-size: 0.95rem; color: var(--primary); margin-bottom: 4px; }
.report-card .rc-meta  { font-size: 0.75rem; color: var(--muted); }
.status-badge {
    display: inline-block; font-size: 0.68rem; font-weight: 700;
    padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.04em;
}
.status-complete { background: #d4edda; color: #155724; }
.status-draft    { background: #fff3cd; color: #856404; }

/* ── KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.kpi-card {
    background: #fff; border: 1px solid var(--border);
    border-radius: 10px; padding: 0.9rem 1.1rem;
    border-left: 4px solid var(--accent);
}
.kpi-card.green { border-left-color: var(--success); }
.kpi-card.red   { border-left-color: var(--danger); }
.kpi-label { font-size: 0.68rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-value { font-size: 1.2rem; font-weight: 700; color: var(--primary); font-family: 'DM Serif Display', serif; margin-top: 2px; }
.kpi-sub   { font-size: 0.68rem; color: var(--muted); margin-top: 1px; }

/* ── Report header */
.report-header {
    background: var(--primary); color: #fff;
    padding: 1.75rem 2rem; border-radius: 10px;
    margin-bottom: 1.5rem;
}
.report-header h2 { font-family: 'DM Serif Display', serif; margin: 0; font-size: 1.4rem; }
.report-meta { font-size: 0.78rem; opacity: 0.75; margin-top: 4px; }

/* ── Accordion */
.acc-item { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.65rem; overflow: hidden; }
.acc-header {
    background: #f7f9fb; padding: 0.85rem 1.2rem;
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; font-weight: 600; font-size: 0.88rem;
    color: var(--primary); border: none; width: 100%; text-align: left;
    transition: background 0.15s;
}
.acc-header:hover { background: #edf1f6; }
.acc-icon { transition: transform 0.2s; }
.acc-header.open .acc-icon { transform: rotate(180deg); }
.acc-body { display: none; padding: 1.2rem; border-top: 1px solid var(--border); overflow-x: auto; }
.acc-body.open { display: block; }

/* ── Report tables */
.report-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.report-table th {
    background: var(--primary); color: #fff;
    padding: 7px 10px; font-weight: 600;
    text-align: right; white-space: nowrap;
}
.report-table th:first-child { text-align: left; }
.report-table td { padding: 5px 10px; border-bottom: 1px solid #f0f0f0; text-align: right; }
.report-table td:first-child { text-align: left; }
.report-table tr:hover td { background: #fafbfc; }
.report-table .subtotal td { background: #eef2f7; font-weight: 600; }
.report-table .total-row td { background: var(--primary); color: #fff; font-weight: 700; }
.report-table .section-row td { background: #e8eef5; font-weight: 700; color: var(--primary); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Alert banners */
.alert-cma { border-radius: 8px; padding: 0.7rem 1rem; font-size: 0.82rem; display: flex; gap: 8px; align-items: flex-start; margin-bottom: 0.75rem; }
.alert-warn { background: #fff8e6; border: 1px solid #ffc107; color: #856404; }
.alert-good { background: #e9f7ef; border: 1px solid #4caf50; color: #155724; }
.alert-info { background: #e8f4fd; border: 1px solid #2196f3; color: #0d47a1; }

/* ── Admin tables */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.admin-table th { background: var(--primary); color: #fff; padding: 9px 12px; text-align: left; font-weight: 600; }
.admin-table td { padding: 8px 12px; border-bottom: 1px solid #eee; vertical-align: middle; }
.admin-table tr:hover td { background: #f8f9fa; }

/* ── Auth pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--primary); padding: 2rem; }
.auth-card { background: #fff; border-radius: 14px; padding: 2.5rem; width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo h1 { font-family: 'DM Serif Display', serif; color: var(--primary); font-size: 1.6rem; margin: 0.5rem 0 0; }
.auth-logo p  { color: var(--muted); font-size: 0.8rem; margin: 0; }

/* ── Quota bar */
.quota-bar { height: 6px; background: #dee2e6; border-radius: 3px; overflow: hidden; margin-top: 4px; }
.quota-fill { height: 100%; border-radius: 3px; background: var(--success); transition: width 0.4s; }
.quota-fill.warn   { background: #ffc107; }
.quota-fill.danger { background: var(--danger); }

/* ── Print styles */
@media print {
    .no-print, .app-nav, .progress-wrap, .btn-primary-cma, .btn-outline-cma, .btn-accent-cma { display: none !important; }
    .acc-body { display: block !important; }
    .acc-header { background: #eef2f7 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .report-table th, .report-table .total-row td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .report-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .acc-item { page-break-inside: avoid; page-break-after: always; border: none; margin-bottom: 0; }
    .acc-item:last-child { page-break-after: avoid; }
    .acc-body { border-top: none; padding: 0; }
    .kpi-grid { page-break-inside: avoid; }
    body { font-size: 0.78rem; }
    .main-wrap { margin: 0; padding: 0; max-width: 100%; }
}
