:root {
    --ink: #17211b;
    --muted: #69746d;
    --line: #dce2dd;
    --paper: #fffefb;
    --canvas: #f1f3ee;
    --green: #184d3b;
    --green-soft: #e3eee8;
    --lime: #c8e34a;
    --red: #c33c34;
    --red-soft: #fff0ed;
    --shadow: 0 22px 60px rgba(31, 48, 39, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    background:
        linear-gradient(rgba(24, 77, 59, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(24, 77, 59, 0.035) 1px, transparent 1px),
        var(--canvas);
    background-size: 28px 28px;
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

button,
input {
    font: inherit;
}

.page-shell {
    width: min(1240px, calc(100% - 48px));
    margin: 0 auto;
    padding: 62px 0 34px;
}

.page-header,
.section-heading,
.page-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
}

.eyebrow,
.section-kicker {
    margin: 0 0 10px;
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.16em;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 12px;
    font-family: Georgia, "Songti SC", serif;
    font-size: clamp(42px, 6vw, 72px);
    font-weight: 500;
    letter-spacing: -0.045em;
    line-height: 0.98;
}

.subtitle {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 16px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    padding: 10px 14px;
    color: var(--green);
    background: var(--green-soft);
    border: 1px solid #cbdcd2;
    border-radius: 4px 4px 12px 4px;
    font-size: 12px;
    font-weight: 750;
    text-decoration: none;
    transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.back-link:hover {
    color: white;
    background: var(--green);
    border-color: var(--green);
}

.back-link span {
    font-size: 17px;
    line-height: 1;
}

.company-name-field {
    display: grid;
    grid-template-columns: auto minmax(220px, 380px);
    align-items: center;
    gap: 14px;
    width: fit-content;
    margin-top: 24px;
    color: var(--green);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.06em;
}

.company-name-field > span small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: normal;
}

.company-name-field input {
    width: 100%;
    padding: 11px 13px;
    color: var(--ink);
    background: rgba(255, 254, 251, 0.78);
    border: 1px solid #cfd7d1;
    border-radius: 4px;
    outline: none;
    letter-spacing: normal;
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.company-name-field input[readonly] {
    color: var(--green);
    background: var(--green-soft);
    cursor: default;
}

.company-name-field input::placeholder {
    color: #a7b0aa;
    font-size: 12px;
}

.company-name-field input:focus {
    background: var(--paper);
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(24, 77, 59, 0.1);
}

.model-save-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.auto-save-dot {
    width: 7px;
    height: 7px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(24, 77, 59, 0.1);
}

.save-model-status {
    color: var(--muted);
    font-size: 11px;
}

.save-model-status.is-dirty {
    color: #a36a17;
}

.save-model-status.is-saved {
    color: var(--green);
}

.save-model-status.is-error {
    color: var(--red);
}

.model-card {
    margin-top: 46px;
    overflow: hidden;
    background: var(--paper);
    border: 1px solid rgba(23, 33, 27, 0.08);
    border-radius: 6px 6px 26px 6px;
    box-shadow: var(--shadow);
}

.section-heading {
    padding: 30px 34px 25px;
    border-bottom: 1px solid var(--line);
}

.section-heading h2 {
    margin-bottom: 0;
    font-family: Georgia, "Songti SC", serif;
    font-size: 28px;
    font-weight: 500;
}

.section-note {
    max-width: 500px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
    text-align: right;
}

.table-scroll {
    overflow-x: auto;
}

.forecast-table {
    width: 100%;
    min-width: 930px;
    border-collapse: collapse;
    table-layout: fixed;
}

.forecast-table th,
.forecast-table td {
    height: 92px;
    padding: 17px 14px;
    text-align: center;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.forecast-table tr > :last-child {
    border-right: 0;
}

.forecast-table tbody tr:last-child > * {
    border-bottom: 0;
}

.forecast-table thead th {
    height: 82px;
    color: white;
    background: var(--green);
}

.forecast-table .row-title,
.forecast-table tbody th {
    width: 205px;
    padding-left: 28px;
    text-align: left;
}

.forecast-table thead .row-title {
    color: rgba(255, 255, 255, 0.58);
    font-size: 12px;
    letter-spacing: 0.12em;
}

.year-label {
    display: block;
    margin-bottom: 4px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.year-input {
    width: 84px;
    padding: 4px;
    color: white;
    background: transparent;
    border: 0;
    border-bottom: 2px solid var(--lime);
    border-radius: 0;
    outline: 0;
    font-family: Georgia, serif;
    font-size: 24px;
    text-align: center;
    appearance: textfield;
}

.year-input::-webkit-inner-spin-button {
    appearance: none;
}

.year-input:focus {
    background: rgba(255, 255, 255, 0.08);
}

.year-input.is-invalid {
    border-bottom-color: #ff8d82;
}

.year-error {
    display: block;
    margin-top: 4px;
    color: #ffaca4;
    font-size: 9px;
    font-weight: 600;
    white-space: nowrap;
}

.year-error[hidden] {
    display: none;
}

.year-value {
    font-family: Georgia, serif;
    font-size: 24px;
}

.label-primary,
.label-secondary {
    display: block;
}

.label-primary {
    font-size: 15px;
    font-weight: 750;
}

.label-secondary {
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
}

.data-input {
    width: 100%;
    min-width: 0;
    padding: 12px 8px;
    color: var(--ink);
    background: #f8faf7;
    border: 1px solid #d8ded9;
    border-radius: 4px;
    outline: none;
    text-align: center;
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.data-input::placeholder {
    color: #aeb6b0;
    font-size: 12px;
}

.data-input:focus {
    background: white;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(24, 77, 59, 0.1);
}

.percent-field {
    position: relative;
}

.percent-field .data-input {
    padding-right: 30px;
}

.percent-field span {
    position: absolute;
    top: 50%;
    right: 10px;
    color: var(--muted);
    font-size: 12px;
    transform: translateY(-50%);
    pointer-events: none;
}

.weight-row {
    background: #f6f8f3;
}

.calculated-row {
    background: #fbfcf8;
}

.calculated-value {
    display: block;
    min-height: 24px;
    color: var(--green);
    font-family: Georgia, "Songti SC", serif;
    font-size: 18px;
    font-weight: 700;
    line-height: 24px;
}

.calculated-value[data-empty="true"] {
    color: transparent;
}

.unavailable-value {
    color: #a2aca5;
    font-size: 11px;
}

.weight-row td {
    height: 74px;
}

.weight-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    padding: 8px 12px;
    color: var(--green);
    background: var(--green-soft);
    border: 1px solid #ccddd3;
    border-radius: 999px;
    font-family: Georgia, serif;
    font-size: 16px;
    font-weight: 700;
}

.quarterly-table {
    min-width: 820px;
}

.quarterly-table .row-title,
.quarterly-table tbody th {
    width: 245px;
}

.table-year {
    display: block;
    margin-top: 5px;
    color: var(--lime);
    font-family: Georgia, serif;
    font-size: 24px;
    font-weight: 500;
}

.period-divider > th,
.period-divider > td {
    height: 62px;
    color: white;
    background: #24634c;
    border-color: rgba(255, 255, 255, 0.12);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.period-divider > th {
    font-size: 11px;
    letter-spacing: 0.12em;
}

.period-divider .table-year {
    display: inline;
    margin-left: 7px;
    font-size: 18px;
}

.scenario-panel {
    padding: 30px 34px 34px;
    background: #f5f7f2;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.scenario-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.scenario-heading h3 {
    margin-bottom: 0;
    font-family: Georgia, "Songti SC", serif;
    font-size: 24px;
    font-weight: 500;
}

.scenario-heading > p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 12px;
}

.scenario-correction-scroll {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 4px 4px 14px 4px;
}

.scenario-correction-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: collapse;
    table-layout: fixed;
    background: var(--paper);
}

.scenario-correction-table th,
.scenario-correction-table td {
    padding: 16px 18px;
    text-align: center;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.scenario-correction-table tr > :last-child {
    border-right: 0;
}

.scenario-correction-table tbody tr:last-child > * {
    border-bottom: 0;
}

.scenario-correction-table thead th {
    color: #617068;
    background: #edf1eb;
    font-size: 11px;
    font-weight: 750;
}

.scenario-correction-table thead th:first-child,
.scenario-correction-table tbody th {
    width: 260px;
}

.scenario-correction-table tbody th {
    border-left: 4px solid #779184;
}

.scenario-correction-table tbody tr.neutral th {
    border-left-color: var(--green);
}

.scenario-correction-table tbody tr.optimistic th {
    border-left-color: #91ad24;
}

.scenario-correction-table label {
    display: block;
    margin-bottom: 9px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 750;
}

.scenario-percent-field {
    display: block;
    position: relative;
}

.scenario-percent-field input {
    padding-right: 28px;
}

.scenario-percent-field i {
    position: absolute;
    top: 50%;
    right: 10px;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    font-weight: 500;
    transform: translateY(-50%);
    pointer-events: none;
}

.adjusted-growth-output {
    display: block;
    min-height: 28px;
    color: var(--green);
    font-family: Georgia, "Songti SC", serif;
    font-size: 21px;
    font-weight: 700;
    line-height: 28px;
}

.adjusted-growth-output[data-empty="true"] {
    color: transparent;
}

.adjusted-growth-output.raised-weight {
    color: var(--red);
}

.correction-weight-label {
    display: block;
    margin-top: 5px;
    color: #89948d;
    font-size: 10px;
    line-height: 1.6;
    text-align: left;
}

.correction-weight-label:empty {
    display: none;
}

.correction-weight-label.raised-weight {
    color: var(--red);
    font-weight: 700;
}

.prediction-table thead th {
    background: #203b31;
}

.prediction-row th {
    border-left: 4px solid #779184;
}

.prediction-row.neutral th {
    border-left-color: var(--green);
}

.prediction-row.optimistic th {
    border-left-color: #91ad24;
}

.dynamic-prediction-row > th,
.dynamic-prediction-row > td {
    background: #f4f8f4;
}

.dynamic-prediction-row th .label-primary {
    color: var(--green);
}

.forecast-output {
    display: block;
    min-height: 28px;
    color: var(--green);
    font-family: Georgia, "Songti SC", serif;
    font-size: clamp(18px, 2vw, 24px);
    font-weight: 700;
    line-height: 28px;
    word-break: break-word;
}

.forecast-output[data-empty="true"] {
    color: transparent;
}

.forecast-output.super-growth-result {
    color: var(--red);
}

.super-growth-alerts {
    padding: 16px 34px 24px;
    background: #fffaf8;
    border-top: 1px solid #f1d6d1;
}

.super-growth-alerts[hidden] {
    display: none;
}

.super-growth-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 0;
    padding: 12px 14px;
    color: var(--red);
    background: var(--red-soft);
    border-left: 3px solid var(--red);
    border-radius: 2px 4px 4px 2px;
    font-size: 12px;
}

.super-growth-alert:first-child {
    margin-top: 0;
}

.super-growth-alert[hidden] {
    display: none;
}

.super-growth-alert span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    color: white;
    background: var(--red);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 900;
}

.future-forecast-panel {
    padding: 30px 34px 34px;
    background: #eef3ed;
    border-top: 1px solid var(--line);
}

.future-forecast-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.future-forecast-heading h3 {
    margin-bottom: 0;
    font-family: Georgia, "Songti SC", serif;
    font-size: 24px;
    font-weight: 500;
}

.future-forecast-heading > p {
    max-width: 480px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
    text-align: right;
}

.future-forecast-panel .table-scroll {
    border: 1px solid #ccd7cf;
    border-radius: 4px 4px 16px 4px;
}

.future-forecast-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    table-layout: fixed;
    background: var(--paper);
}

.future-forecast-table th,
.future-forecast-table td {
    padding: 18px 14px;
    text-align: center;
    border-right: 1px solid var(--line);
}

.future-forecast-table tr > :last-child {
    border-right: 0;
}

.future-forecast-table thead th {
    height: 62px;
    color: white;
    background: #203b31;
    font-size: 13px;
}

.future-forecast-table tbody td {
    height: 126px;
    vertical-align: top;
}

.future-forecast-input {
    margin-bottom: 9px;
}

.future-forecast-output {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 43px;
    color: var(--green);
    font-family: Georgia, "Songti SC", serif;
    font-size: clamp(18px, 2vw, 24px);
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word;
}

.future-forecast-output[data-empty="true"] {
    color: transparent;
}

.future-formula-note {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.profit-forecast-table {
    width: 100%;
    min-width: 1020px;
    border-collapse: collapse;
    table-layout: fixed;
}

.profit-forecast-table th,
.profit-forecast-table td {
    height: 88px;
    padding: 16px 13px;
    text-align: center;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.profit-forecast-table tr > :last-child {
    border-right: 0;
}

.profit-forecast-table tbody tr:last-child > * {
    border-bottom: 0;
}

.profit-forecast-table thead th {
    height: 70px;
    color: white;
    background: var(--green);
    font-family: Georgia, "Songti SC", serif;
    font-size: 21px;
    font-weight: 500;
}

.profit-forecast-table .row-title,
.profit-forecast-table tbody th {
    width: 210px;
    padding-left: 28px;
    text-align: left;
}

.profit-forecast-table thead .row-title {
    color: rgba(255, 255, 255, 0.58);
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.12em;
}

.profit-forecast-table thead th:nth-child(n + 5) {
    color: var(--lime);
    background: #203b31;
}

.profit-forecast-table tbody td:nth-child(n + 5) {
    background: #f4f8f4;
}

.profit-forecast-table tbody td.forecast-profit-cell {
    background: #f4f8f4;
}

.profit-cagr-row > th,
.profit-cagr-row > td {
    background: #f6f8f3;
}

.profit-cagr-row > td:last-child {
    background: #f4f8f4;
}

.profit-cagr-empty {
    color: #95a099;
    font-size: 11px;
    letter-spacing: 0.06em;
}

.profit-history-empty {
    color: #a2aca5;
    background: #fbfcf8;
    font-size: 11px;
}

.profit-calculated-output {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 43px;
    color: var(--green);
    font-family: Georgia, "Songti SC", serif;
    font-size: clamp(18px, 2vw, 23px);
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word;
}

.profit-calculated-output[data-empty="true"] {
    color: transparent;
}

.peg-panel {
    padding: 30px 34px 34px;
    background: #eef3ed;
    border-top: 1px solid var(--line);
}

.peg-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.peg-heading h3 {
    margin-bottom: 0;
    font-family: Georgia, "Songti SC", serif;
    font-size: 24px;
    font-weight: 500;
}

.peg-heading > p {
    max-width: 580px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
    text-align: right;
}

.peg-panel .table-scroll {
    border: 1px solid #ccd7cf;
    border-radius: 4px 4px 16px 4px;
}

.peg-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    table-layout: fixed;
    background: var(--paper);
}

.peg-table th,
.peg-table td {
    padding: 17px 16px;
    text-align: center;
    border-right: 1px solid var(--line);
}

.peg-table tr > :last-child {
    border-right: 0;
}

.peg-table thead th {
    height: 58px;
    color: white;
    background: #203b31;
    font-size: 13px;
}

.peg-table tbody td {
    height: 120px;
    vertical-align: top;
}

.peg-input {
    margin-bottom: 8px;
}

.peg-calculated-output {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 43px;
    color: var(--green);
    font-family: Georgia, "Songti SC", serif;
    font-size: clamp(20px, 2.2vw, 26px);
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word;
}

.peg-calculated-output[data-empty="true"] {
    color: transparent;
}

.peg-result.peg-high {
    color: var(--red);
}

.peg-formula-note {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.scenario-result-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    overflow: hidden;
    margin-bottom: 22px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 4px 4px 16px 4px;
}

.scenario-result-card {
    min-width: 0;
    min-height: 132px;
    padding: 20px 22px;
    background: var(--paper);
}

.scenario-result-card p {
    margin-bottom: 16px;
    color: #617068;
    font-size: 12px;
    font-weight: 700;
}

.scenario-result-card strong {
    display: block;
    min-height: 38px;
    margin-bottom: 8px;
    color: var(--green);
    font-family: Georgia, "Songti SC", serif;
    font-size: clamp(24px, 2.5vw, 32px);
    font-weight: 500;
    word-break: break-word;
}

.scenario-result-card strong[data-empty="true"] {
    color: #aeb8b1;
}

.scenario-result-card > span {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.alerts {
    margin-top: 16px;
}

.scenario-result-alerts {
    margin: -6px 0 22px;
}

.scenario-result-alerts .alert-message {
    color: #b5372f;
    background: #fff0ed;
}

.alert-message {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 0;
    padding: 12px 14px;
    color: #ff8d82;
    background: rgba(195, 60, 52, 0.12);
    border-left: 3px solid #e15a50;
    border-radius: 2px 4px 4px 2px;
    font-size: 12px;
}

.alert-message[hidden] {
    display: none;
}

.alert-message span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    color: var(--ink);
    background: #ff8d82;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 900;
}

.page-footer {
    align-items: center;
    padding: 20px 4px 0;
    color: #7c8780;
    font-size: 10px;
    letter-spacing: 0.08em;
}

@media (max-width: 900px) {
    .scenario-result-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-note {
        text-align: left;
    }

    .scenario-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .future-forecast-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .future-forecast-heading > p {
        text-align: left;
    }

    .peg-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .peg-heading > p {
        text-align: left;
    }

}

@media (max-width: 600px) {
    .page-shell {
        width: min(100% - 24px, 1240px);
        padding-top: 30px;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .company-name-field {
        grid-template-columns: 1fr;
        width: 100%;
        gap: 8px;
    }

    .section-heading,
    .scenario-panel,
    .super-growth-alerts,
    .future-forecast-panel,
    .peg-panel {
        padding: 24px 20px;
    }

    .scenario-result-grid {
        grid-template-columns: 1fr;
    }

    .scenario-result-card {
        min-height: 124px;
    }

    .page-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
