/* ── Reset & tokens ──────────────────────────────────────────────────── */
/*
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
*/

:root {
    --navy: #1C3041;
    --navy-mid: #243f52;
    --teal: #34C1D0;
    --teal-light: #2aaebb;
    --brown: #95684D;
    --lt-teal: #DCF1F8;
    --amber: #FFF2CC;
    --amber-dark: #7F6000;
    --blue-in: #DDEEFF;
    --green-pos: #E2EFDA;
    --green-text: #375623;
    --red-neg: #FFE0E0;
    --red-text: #C00000;
    --gray-100: #F5F6F8;
    --gray-200: #E8EAED;
    --gray-400: #9AA0A6;
    --gray-700: #444D56;
    --white: #FFFFFF;
    --font: 'Quicksand', system-ui, sans-serif;
    --radius: 8px;
    --shadow: 0 2px 12px rgba(28, 48, 65, .10);
    --shadow-md: 0 4px 24px rgba(28, 48, 65, .16);
}

/*
html,
body {
    font-family: var(--font);
    background: var(--gray-100);
    color: var(--gray-700);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.55;
}
*/

/* ── Layout shell ────────────────────────────────────────────────────── */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Top brand bar ───────────────────────────────────────────────────── */
#brand-bar {
    background: var(--navy);
    color: var(--white);
    padding: 0 28px;
    height: 52px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

#brand-bar .toolkit-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--teal);
}

#brand-bar .wizard-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--white);
}

#brand-bar .sep {
    color: rgba(255, 255, 255, .3);
}

#brand-bar .autosave-note {
    margin-left: auto;
    font-size: 11px;
    color: rgba(255, 255, 255, .5);
    display: flex;
    align-items: center;
    gap: 5px;
}

#brand-bar .autosave-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--teal);
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: .4
    }

    50% {
        opacity: 1
    }
}

/* ── Nav rail (section progress) ────────────────────────────────────── */
#nav-rail {
    background: var(--white);
    border-bottom: 3px solid var(--teal);
    padding: 0 28px;
    display: flex;
    gap: 0;
    overflow-x: auto;
    flex-shrink: 0;
    box-shadow: var(--shadow);
}

.nav-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -3px;
    transition: all .2s;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-400);
    user-select: none;
}

.nav-section:hover {
    color: var(--navy);
}

.nav-section.active {
    color: var(--navy);
    border-bottom-color: var(--navy);
}

.nav-section.completed {
    color: var(--teal-light);
    cursor: pointer;
}

.nav-section.completed:hover {
    color: var(--navy);
}

.nav-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-400);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .2s;
}

.nav-section.active .nav-step-num {
    background: var(--navy);
    color: var(--white);
}

.nav-section.completed .nav-step-num {
    background: var(--teal);
    color: var(--white);
}

.nav-section.completed .nav-step-num::after {
    content: '✓';
    font-size: 11px;
}

.nav-section.completed .nav-step-num span {
    display: none;
}

/* ── Main content area ───────────────────────────────────────────────── */
#main {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 32px 20px 60px;
}

.screen-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 880px;
    overflow: hidden;
}

.screen-header {
    background: var(--navy);
    padding: 24px 32px 20px;
    color: var(--white);
}

.screen-header .screen-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 6px;
}

.screen-header h1 {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

.screen-header .screen-sub {
    margin-top: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, .7);
    font-weight: 500;
}

.screen-body {
    padding: 28px 32px 24px;
}

.screen-footer {
    padding: 16px 32px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-100);
}

.screen-footer .spacer {
    flex: 1;
}

/* ── Info box ────────────────────────────────────────────────────────── */
.info-box {
    background: var(--lt-teal);
    border-left: 4px solid var(--teal);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--navy);
    margin-bottom: 20px;
    line-height: 1.55;
}

.info-box strong {
    font-weight: 700;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 22px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 700;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all .18s;
    text-decoration: none;
}

.btn-primary {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
}

.btn-primary:hover {
    background: var(--navy-mid);
    border-color: var(--navy-mid);
}

.btn-secondary {
    background: var(--white);
    color: var(--navy);
    border-color: var(--gray-200);
}

.btn-secondary:hover {
    border-color: var(--navy);
}

.btn-teal {
    background: var(--teal);
    color: var(--white);
    border-color: var(--teal);
}

.btn-teal:hover {
    background: var(--teal-light);
    border-color: var(--teal-light);
}

.btn-lg {
    padding: 13px 28px;
    font-size: 15px;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* ── Form elements ───────────────────────────────────────────────────── */
.field-group {
    margin-bottom: 20px;
}

.field-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 6px;
}

.field-label .required {
    color: var(--red-text);
    font-size: 12px;
}

.field-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    color: var(--gray-700);
    background: var(--blue-in);
    transition: border-color .15s;
    outline: none;
}

.field-input:focus {
    border-color: var(--teal);
    background: #EAF7FB;
}

.field-input.error {
    border-color: var(--red-text);
    background: #FFF5F5;
}

.field-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231C3041' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.field-hint {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

.field-error {
    font-size: 12px;
    color: var(--red-text);
    font-weight: 600;
    margin-top: 4px;
    display: none;
}

.field-error.visible {
    display: block;
}

/* ── Month picker (cross-browser <input type="month"> replacement) ──── */
.month-picker-wrap {
    position: relative;
}

.month-picker-toggle {
    width: 100%;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.month-picker-toggle::after {
    content: '';
    width: 12px;
    height: 8px;
    flex-shrink: 0;
    margin-left: 8px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231C3041' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.month-picker-placeholder {
    color: var(--gray-400);
    font-weight: 500;
}

.month-picker-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 50;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 12px;
    width: 260px;
}

.month-picker-panel.open {
    display: block;
}

.month-picker-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.month-picker-nav-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: var(--gray-100);
    color: var(--navy);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font);
    transition: background .15s;
}

.month-picker-nav-btn:hover {
    background: var(--lt-teal);
}

.month-picker-year {
    font-size: 14px;
    font-weight: 700;
    color: var(--navy);
}

.month-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.month-picker-cell {
    padding: 8px 4px;
    border: none;
    border-radius: 6px;
    background: var(--gray-100);
    color: var(--navy);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}

.month-picker-cell:hover {
    background: var(--lt-teal);
}

.month-picker-cell.selected {
    background: var(--navy);
    color: var(--white);
}

/* ── Currency input wrapper ──────────────────────────────────────────── */
.currency-wrap {
    position: relative;
}

.currency-wrap .dollar-sign {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-weight: 700;
    font-size: 14px;
    pointer-events: none;
}

.currency-wrap .field-input {
    padding-left: 22px;
}

/* ── Tooltip ─────────────────────────────────────────────────────────── */
.tooltip-wrap {
    position: relative;
    display: inline-flex;
}

.tooltip-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--teal);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border: none;
    font-family: var(--font);
    transition: background .15s;
}

.tooltip-icon:hover {
    background: var(--teal-light);
}

.tooltip-panel {
    position: absolute;
    left: 24px;
    top: -4px;
    background: var(--navy);
    color: var(--white);
    font-size: 12px;
    line-height: 1.6;
    padding: 12px 14px;
    border-radius: var(--radius);
    width: 280px;
    z-index: 100;
    box-shadow: var(--shadow-md);
    display: none;
}

.tooltip-panel.visible {
    display: block;
}

.tooltip-panel::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 10px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid var(--navy);
}

/* ── Two-col layout for setup ────────────────────────────────────────── */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.two-col-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* ── Month grid ──────────────────────────────────────────────────────── */
.month-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.month-cell {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.month-cell .month-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: .03em;
}

.month-cell .currency-wrap .field-input {
    font-size: 13px;
    padding: 8px 8px 8px 20px;
}

.month-cell .currency-wrap .dollar-sign {
    font-size: 13px;
    left: 8px;
}

/* ── Section divider ─────────────────────────────────────────────────── */
.section-divider {
    margin: 24px 0 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-divider .divider-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--teal);
    white-space: nowrap;
}

.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

/* ── Summary table (S-07, S-14) ──────────────────────────────────────── */
.summary-table-wrap {
    overflow-x: auto;
    margin-top: 8px;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.summary-table th {
    background: var(--navy);
    color: var(--white);
    padding: 8px 10px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
    font-size: 11px;
}

.summary-table th:first-child {
    text-align: left;
}

.summary-table td {
    padding: 7px 10px;
    border: 1px solid var(--gray-200);
    text-align: right;
    font-variant-numeric: tabular-nums;
    background: var(--lt-teal);
}

.summary-table td:first-child {
    text-align: left;
    font-weight: 600;
    color: var(--navy);
    background: var(--gray-100);
}

.summary-table tr.total-row td {
    background: var(--amber);
    font-weight: 700;
    color: var(--navy);
}

.summary-table tr.total-row td:first-child {
    background: var(--amber);
}

/* ── Review dashboard (S-15) ─────────────────────────────────────────── */
.review-table-wrap {
    overflow-x: auto;
}

.review-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 720px;
}

.review-table th {
    background: var(--navy);
    color: var(--white);
    padding: 9px 8px;
    font-weight: 700;
    text-align: right;
    font-size: 11px;
    white-space: nowrap;
}

.review-table th:first-child {
    text-align: left;
    min-width: 160px;
}

.review-table td {
    padding: 7px 8px;
    border: 1px solid var(--gray-200);
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
}

.review-table td:first-child {
    text-align: left;
    font-weight: 600;
    color: var(--navy);
}

.review-table tr.rt-opening td {
    background: var(--lt-teal);
}

.review-table tr.rt-income td {
    background: #F0FFF4;
    color: var(--green-text);
}

.review-table tr.rt-expense td {
    background: #FFF8F5;
    color: var(--brown);
}

.review-table tr.rt-ncf td {
    background: var(--amber);
    font-weight: 700;
}

.review-table tr.rt-ncf td.positive {
    color: var(--green-text);
}

.review-table tr.rt-ncf td.negative {
    color: var(--red-text);
}

.review-table tr.rt-closing td {
    font-weight: 700;
}

.balance-healthy {
    background: var(--green-pos) !important;
    color: var(--green-text) !important;
}

.balance-caution {
    background: var(--amber) !important;
    color: var(--amber-dark) !important;
}

.balance-critical {
    background: var(--red-neg) !important;
    color: var(--red-text) !important;
}

/* ── Alert banners ───────────────────────────────────────────────────── */
.alert {
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 13px;
    margin-bottom: 14px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.alert-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-critical {
    background: var(--red-neg);
    border-left: 4px solid var(--red-text);
    color: var(--red-text);
}

.alert-caution {
    background: var(--amber);
    border-left: 4px solid var(--amber-dark);
    color: var(--amber-dark);
}

.alert-info {
    background: var(--lt-teal);
    border-left: 4px solid var(--teal);
    color: var(--navy);
}

.alert-success {
    background: var(--green-pos);
    border-left: 4px solid #70AD47;
    color: var(--green-text);
}

/* ── Welcome screen ──────────────────────────────────────────────────── */
.welcome-hero {
    text-align: center;
    padding: 16px 0 24px;
}

.welcome-hero .hero-icon {
    font-size: 52px;
    margin-bottom: 12px;
    display: block;
}

.welcome-hero h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 8px;
}

.welcome-hero p {
    font-size: 14px;
    color: var(--gray-700);
    max-width: 520px;
    margin: 0 auto 24px;
    line-height: 1.65;
}

.checklist {
    list-style: none;
    text-align: left;
    display: inline-block;
    margin: 0 auto;
}

.checklist li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    margin-bottom: 10px;
    color: var(--gray-700);
}

.checklist li .check-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--teal);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
    margin-top: 1px;
}

.time-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--lt-teal);
    border: 1px solid var(--teal);
    color: var(--navy);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 700;
    margin-top: 18px;
}

/* ── Program type cards ──────────────────────────────────────────────── */
.type-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 6px;
}

.type-card {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px 18px;
    cursor: pointer;
    transition: all .18s;
    text-align: left;
    background: var(--white);
    font-family: var(--font);
}

.type-card:hover {
    border-color: var(--teal);
    background: var(--lt-teal);
}

.type-card.selected {
    border-color: var(--navy);
    background: #EEF3F8;
}

.type-card .type-icon {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
}

.type-card .type-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--navy);
}

.type-card .type-desc {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

/* ── Completion / generate screen ────────────────────────────────────── */
.generate-card {
    text-align: center;
    padding: 20px 0;
}

.generate-card .gen-icon {
    font-size: 52px;
    margin-bottom: 12px;
    display: block;
}

.generate-card h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 8px;
}

.generate-card p {
    font-size: 14px;
    color: var(--gray-700);
    max-width: 480px;
    margin: 0 auto 20px;
}

.summary-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.summary-chip {
    background: var(--lt-teal);
    border: 1px solid var(--teal);
    color: var(--navy);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 700;
}

/* ── Progress indicator (within section) ────────────────────────────── */
.screen-progress {
    display: flex;
    gap: 4px;
    margin-top: 10px;
}

.progress-dot {
    height: 4px;
    flex: 1;
    border-radius: 2px;
    background: rgba(255, 255, 255, .25);
    transition: background .2s;
}

.progress-dot.done {
    background: var(--teal);
}

.progress-dot.active {
    background: var(--white);
}

/* ── Make Changes link ───────────────────────────────────────────────── */
.make-changes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.make-changes a {
    font-size: 12px;
    color: var(--teal-light);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border-bottom: 1px solid var(--teal);
    padding-bottom: 1px;
}

.make-changes a:hover {
    color: var(--navy);
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {

    .screen-header,
    .screen-body,
    .screen-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .month-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .two-col,
    .type-cards {
        grid-template-columns: 1fr;
    }

    #nav-rail {
        padding: 0 8px;
    }

    .nav-section {
        padding: 12px 10px;
        font-size: 12px;
    }
}

/* ── Print / download hint ───────────────────────────────────────────── */
.download-hint {
    background: var(--green-pos);
    border-left: 4px solid #70AD47;
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 14px 18px;
    color: var(--green-text);
    font-size: 14px;
    margin-top: 18px;
    display: none;
}

.download-hint.visible {
    display: block;
}

.download-hint strong {
    font-weight: 700;
}