:root {
    --navy-950: #071428;
    --navy-900: #0b1f3a;
    --navy-800: #153254;
    --blue-700: #1f5fae;
    --blue-600: #2878cf;
    --blue-100: #e8f2ff;
    --cyan-500: #17a8b8;
    --green-700: #16734f;
    --green-100: #def7ec;
    --amber-700: #a55408;
    --amber-100: #fff2cc;
    --red-700: #b42318;
    --red-100: #fee4e2;
    --slate-900: #182230;
    --slate-700: #344054;
    --slate-600: #475467;
    --slate-500: #667085;
    --slate-300: #d0d5dd;
    --slate-200: #e4e7ec;
    --slate-100: #f2f4f7;
    --slate-50: #f8fafc;
    --white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(7, 20, 40, 0.08);
    --shadow-md: 0 12px 30px rgba(7, 20, 40, 0.09);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--slate-50);
}

body {
    margin: 0;
    color: var(--slate-900);
    background:
        radial-gradient(circle at 85% 0%, rgba(40, 120, 207, 0.09), transparent 28rem),
        var(--slate-50);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
}

.container {
    width: min(1440px, calc(100% - 40px));
    margin-inline: auto;
}

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--white);
    background: rgba(7, 20, 40, 0.97);
    backdrop-filter: blur(16px);
}

.topbar-inner {
    display: flex;
    min-height: 74px;
    align-items: center;
    gap: 34px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--white);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 12px;
    color: var(--navy-950);
    background: linear-gradient(135deg, #64dbea, #6ea8ff);
    font-weight: 900;
    letter-spacing: -0.04em;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 0.98rem;
    letter-spacing: 0.01em;
}

.brand small {
    margin-top: 1px;
    color: #9fb2ca;
    font-size: 0.72rem;
}

.main-nav {
    display: flex;
    align-self: stretch;
    gap: 8px;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    padding: 0 15px;
    border-bottom: 3px solid transparent;
    color: #aebcd0;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
}

.main-nav a:hover,
.main-nav a.active {
    border-bottom-color: #63d4e3;
    color: var(--white);
}

.storage-pill {
    margin-left: auto;
    padding: 7px 11px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    color: #b7c6d8;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.72rem;
    font-weight: 700;
}

.page {
    min-height: calc(100vh - 140px);
    padding-block: 34px 54px;
}

.hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 24px;
    padding: 28px 30px;
    border: 1px solid #dce5ef;
    border-radius: var(--radius);
    color: var(--white);
    background:
        linear-gradient(120deg, rgba(7, 20, 40, 0.98), rgba(21, 50, 84, 0.96)),
        var(--navy-900);
    box-shadow: var(--shadow-md);
}

.hero h1 {
    max-width: 750px;
    margin: 5px 0 9px;
    font-size: clamp(1.8rem, 3vw, 3rem);
    line-height: 1.12;
    letter-spacing: -0.04em;
}

.hero p {
    max-width: 760px;
    margin: 0;
    color: #bed0e3;
}

.eyebrow {
    color: var(--blue-600);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.13em;
}

.hero .eyebrow {
    color: #66d5e3;
}

.hero-actions {
    display: flex;
    min-width: max-content;
    align-items: center;
    gap: 9px;
}

.hero-actions form {
    margin: 0;
}

.btn {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 7px 18px rgba(5, 20, 40, 0.15);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.btn span {
    padding-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    opacity: 0.85;
    font-size: 0.72rem;
}

.btn-primary {
    color: var(--white);
    background: var(--blue-600);
}

.btn-secondary {
    border-color: #6f859f;
    color: var(--white);
    background: rgba(255, 255, 255, 0.08);
}

.btn-ghost {
    border-color: #526a85;
    color: #c7d5e4;
    background: transparent;
}

.btn-small {
    min-height: 36px;
    padding: 8px 11px;
    font-size: 0.76rem;
}

.alert {
    margin-bottom: 20px;
    padding: 13px 16px;
    border: 1px solid;
    border-radius: 12px;
    font-size: 0.9rem;
}

.alert-success {
    border-color: #a7e5cd;
    color: #0e5c3e;
    background: var(--green-100);
}

.alert-error {
    border-color: #f5aaa5;
    color: var(--red-700);
    background: var(--red-100);
}

.alert-info {
    border-color: #b5d4f6;
    color: #154d85;
    background: var(--blue-100);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    padding: 18px 20px;
    border: 1px solid var(--slate-200);
    border-radius: 14px;
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.stat-card > span {
    display: block;
    margin-bottom: 6px;
    color: var(--slate-500);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.stat-card > strong {
    display: block;
    overflow: hidden;
    margin-bottom: 2px;
    color: var(--navy-900);
    font-size: 1.8rem;
    line-height: 1.2;
    text-overflow: ellipsis;
}

.stat-card .stat-text {
    font-size: 1.16rem;
}

.stat-card .stat-currency {
    font-size: clamp(1rem, 1.5vw, 1.35rem);
}

.stat-card small {
    color: var(--slate-500);
    font-size: 0.76rem;
}

.panel {
    margin-bottom: 20px;
    padding: 22px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.panel-header h2 {
    margin: 3px 0 0;
    color: var(--navy-900);
    font-size: 1.18rem;
    letter-spacing: -0.02em;
}

.progress-meta {
    color: var(--blue-700);
    font-size: 1.5rem;
    font-weight: 900;
}

.progress-track {
    overflow: hidden;
    height: 8px;
    margin-bottom: 22px;
    border-radius: 999px;
    background: var(--slate-100);
}

.progress-value {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue-600), var(--cyan-500));
    transition: width 0.4s ease;
}

.step-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 13px;
}

.step-card {
    display: flex;
    min-height: 294px;
    flex-direction: column;
    padding: 16px;
    border: 1px solid var(--slate-200);
    border-radius: 14px;
    background: var(--slate-50);
}

.step-card.is-completed {
    border-color: #bfe8d7;
    background: #f4fcf8;
}

.step-card.is-next {
    border: 2px solid var(--blue-600);
    background: #f5f9ff;
    box-shadow: 0 10px 24px rgba(40, 120, 207, 0.12);
}

.step-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.step-number {
    color: var(--slate-300);
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.is-completed .step-number {
    color: #7bc8a7;
}

.is-next .step-number {
    color: var(--blue-600);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    width: max-content;
    padding: 5px 8px;
    border-radius: 999px;
    color: var(--slate-600);
    background: var(--slate-100);
    font-size: 0.66rem;
    font-style: normal;
    font-weight: 900;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.status-complete {
    color: var(--green-700);
    background: var(--green-100);
}

.status-next {
    color: var(--amber-700);
    background: var(--amber-100);
}

.step-module {
    color: var(--blue-600);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.step-card h3 {
    margin: 4px 0 8px;
    color: var(--navy-900);
    font-size: 1rem;
}

.step-card p {
    margin: 0 0 12px;
    color: var(--slate-600);
    font-size: 0.81rem;
}

.financial-effect {
    display: block;
    margin-bottom: 12px;
    padding: 9px 10px;
    border-left: 3px solid #b6c5d8;
    color: var(--slate-600);
    background: rgba(255, 255, 255, 0.68);
    font-size: 0.73rem;
}

.step-footer {
    margin-top: auto;
}

.completed-label,
.locked-label {
    color: var(--slate-500);
    font-size: 0.7rem;
}

.completed-label {
    color: var(--green-700);
    font-weight: 700;
}

.content-grid,
.report-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(310px, 0.85fr);
    gap: 20px;
}

.report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.document-list {
    border-top: 1px solid var(--slate-200);
}

.document-row {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr) minmax(150px, auto);
    gap: 18px;
    padding: 13px 2px;
    border-bottom: 1px solid var(--slate-200);
    align-items: center;
}

.document-row > span {
    color: var(--slate-500);
    font-size: 0.78rem;
    font-weight: 800;
}

.document-row strong {
    overflow-wrap: anywhere;
    color: var(--navy-900);
    font-size: 0.84rem;
}

.document-row em {
    color: var(--slate-600);
    font-size: 0.77rem;
    font-style: normal;
    text-align: right;
}

.muted {
    color: var(--slate-500) !important;
    font-weight: 500 !important;
}

.policy-list {
    margin: 0;
}

.policy-list > div {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 11px 0;
    border-bottom: 1px solid var(--slate-200);
}

.policy-list dt {
    color: var(--slate-500);
    font-size: 0.76rem;
    font-weight: 700;
}

.policy-list dd {
    margin: 0;
    color: var(--navy-900);
    font-size: 0.76rem;
    font-weight: 800;
    text-align: right;
}

.callout {
    margin-top: 18px;
    padding: 14px;
    border: 1px solid #bfdaf6;
    border-radius: 12px;
    color: #174d82;
    background: var(--blue-100);
    font-size: 0.8rem;
}

.callout p {
    margin: 5px 0 0;
}

.text-link {
    color: var(--blue-700);
    font-size: 0.8rem;
    font-weight: 800;
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--slate-200);
    border-radius: 12px;
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 13px;
    border-bottom: 1px solid var(--slate-200);
    text-align: left;
    vertical-align: middle;
}

thead th {
    color: var(--slate-600);
    background: var(--slate-50);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

tbody td {
    color: var(--slate-700);
    font-size: 0.78rem;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tfoot th {
    color: var(--navy-900);
    background: var(--blue-100);
    font-size: 0.76rem;
}

.text-right {
    text-align: right;
    white-space: nowrap;
}

.empty-state {
    padding: 40px 20px;
    border: 1px dashed var(--slate-300);
    border-radius: 12px;
    color: var(--slate-500);
    text-align: center;
}

.empty-state p {
    margin: 4px 0 0;
}

.empty-cell {
    padding: 28px;
    color: var(--slate-500);
    text-align: center;
}

.timeline {
    display: grid;
    gap: 0;
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 10px;
}

.timeline-item:not(:last-child)::before {
    position: absolute;
    top: 16px;
    bottom: -2px;
    left: 6px;
    width: 2px;
    background: var(--slate-200);
    content: "";
}

.timeline-dot {
    position: relative;
    z-index: 1;
    width: 14px;
    height: 14px;
    margin-top: 4px;
    border: 3px solid var(--white);
    border-radius: 50%;
    background: var(--blue-600);
    box-shadow: 0 0 0 2px #acd1f7;
}

.timeline-item > div {
    padding-bottom: 18px;
}

.timeline-item strong {
    color: var(--navy-900);
    font-size: 0.8rem;
}

.timeline-item p {
    margin: 2px 0;
    color: var(--slate-700);
    font-size: 0.82rem;
}

.timeline-item small {
    color: var(--slate-500);
    font-size: 0.7rem;
}

.report-hero {
    align-items: center;
}

.report-status {
    display: flex;
    min-width: 190px;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.report-status strong {
    font-size: 1.05rem;
}

.report-status small {
    color: #aec0d5;
}

.statement h3 {
    margin: 18px 0 7px;
    color: var(--slate-500);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.statement h3:first-child {
    margin-top: 0;
}

.statement-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 9px 2px;
    border-bottom: 1px solid var(--slate-200);
    color: var(--slate-700);
    font-size: 0.79rem;
}

.statement-line strong {
    min-width: max-content;
    color: var(--navy-900);
}

.statement-line.subtotal {
    border-bottom: 2px solid var(--slate-300);
    font-weight: 800;
}

.statement-line.grand-total {
    margin-top: 10px;
    padding: 13px 12px;
    border: 0;
    border-radius: 10px;
    color: var(--white);
    background: var(--navy-900);
    font-size: 0.86rem;
    font-weight: 900;
}

.statement-line.grand-total strong {
    color: var(--white);
}

.balance-indicator {
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.balance-indicator.ok {
    color: var(--green-700);
    background: var(--green-100);
}

.balance-indicator.warning {
    color: var(--red-700);
    background: var(--red-100);
}

.report-note {
    margin: 15px 0 0;
    color: var(--slate-500);
    font-size: 0.75rem;
}

.margin-visual {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.margin-visual > div {
    padding: 14px;
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    background: var(--slate-50);
}

.margin-visual span,
.margin-visual strong,
.margin-visual em {
    display: block;
}

.margin-visual span {
    margin-bottom: 4px;
    color: var(--slate-500);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.margin-visual strong {
    color: var(--navy-900);
    font-size: 0.92rem;
}

.margin-visual em {
    margin-top: 3px;
    color: var(--green-700);
    font-size: 0.75rem;
    font-style: normal;
    font-weight: 900;
}

.margin-visual .margin-highlight {
    border-color: #addfca;
    background: var(--green-100);
}

.margin-bar {
    overflow: hidden;
    height: 9px;
    margin-top: 14px;
    border-radius: 999px;
    background: var(--slate-100);
}

.margin-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #169464, #48c995);
}

.journal-card {
    overflow: hidden;
    margin-bottom: 14px;
    padding: 16px;
    border: 1px solid var(--slate-200);
    border-radius: 13px;
    background: var(--slate-50);
}

.journal-card:last-child {
    margin-bottom: 0;
}

.journal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.journal-head > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.journal-head strong {
    color: var(--navy-900);
    font-size: 0.86rem;
}

.journal-head span {
    color: var(--slate-500);
    font-size: 0.72rem;
}

.journal-card > p {
    margin: 8px 0 13px;
    color: var(--slate-600);
    font-size: 0.78rem;
}

.compact-table {
    min-width: 680px;
}

.compact-table th,
.compact-table td {
    padding: 9px 10px;
}

.footer {
    padding: 22px 0 30px;
    border-top: 1px solid var(--slate-200);
    color: var(--slate-500);
    background: var(--white);
    font-size: 0.72rem;
    text-align: center;
}

@media (max-width: 1180px) {
    .hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .step-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .topbar-inner {
        min-height: auto;
        flex-wrap: wrap;
        gap: 10px 20px;
        padding-block: 12px;
    }

    .main-nav {
        order: 3;
        width: 100%;
        min-height: 40px;
    }

    .main-nav a {
        padding-inline: 4px;
        margin-right: 16px;
    }

    .storage-pill {
        margin-left: auto;
    }

    .step-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .content-grid,
    .report-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 620px) {
    .container {
        width: min(100% - 24px, 1440px);
    }

    .page {
        padding-block: 20px 38px;
    }

    .storage-pill {
        display: none;
    }

    .hero,
    .panel {
        padding: 18px;
        border-radius: 13px;
    }

    .hero-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .hero-actions form,
    .hero-actions .btn {
        width: 100%;
    }

    .stats-grid,
    .step-grid,
    .margin-visual {
        grid-template-columns: minmax(0, 1fr);
    }

    .step-card {
        min-height: auto;
    }

    .document-row {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .document-row em {
        text-align: left;
    }

    .panel-header {
        align-items: flex-start;
    }

    .report-status {
        align-items: flex-start;
    }

    .journal-head,
    .journal-head > div {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
}
