.pgp-calc {
    --pgp-ink: #080b10;
    --pgp-surface: #0e1219;
    --pgp-panel: #131923;
    --pgp-panel-2: #181f2b;
    --pgp-line: #303846;
    --pgp-line-soft: #242b36;
    --pgp-text: #edf0eb;
    --pgp-muted: #949ca8;
    --pgp-faint: #68717e;
    --pgp-teal: #68c1cf;
    --pgp-teal-dark: #3f93a4;
    --pgp-orange: #d97706;
    --pgp-orange-hover: #f08a18;
    --pgp-green: #44b875;
    --pgp-red: #e05a54;
    max-width: 1480px;
    margin: 0 auto;
    padding: 34px 28px 28px;
    color: var(--pgp-text);
    background: var(--pgp-surface);
    border: 1px solid var(--pgp-line);
    border-top: 4px solid var(--pgp-orange);
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

/* The calculator carries its own title and introduction. */
body:has(#kyt-goal-projection) .entry-header {
    display: none;
}

.pgp-calc,
.pgp-calc * {
    box-sizing: border-box;
}

.pgp-header {
    max-width: 850px;
    margin-bottom: 30px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--pgp-line);
}

.pgp-eyebrow,
.pgp-panel-title,
.pgp-metric-label,
.pgp-observation-number,
.pgp-table th {
    font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.pgp-eyebrow {
    display: block;
    margin-bottom: 10px;
    color: var(--pgp-orange);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.16em;
}

.pgp-header h2 {
    margin: 0 0 10px;
    color: var(--pgp-text);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 4vw, 3.45rem);
    font-weight: 600;
    line-height: 1.04;
    letter-spacing: -0.04em;
}

.pgp-header p {
    max-width: 760px;
    margin: 0;
    color: #aab7cb;
    font-size: 1rem;
    line-height: 1.65;
}

.pgp-grid {
    display: grid;
    grid-template-columns: minmax(350px, 0.72fr) minmax(0, 1.38fr);
    border: 1px solid var(--pgp-line);
}

.pgp-panel {
    min-width: 0;
    padding: 28px;
}

.pgp-input-panel {
    background: var(--pgp-panel);
    border-right: 1px solid var(--pgp-line);
}

.pgp-results-panel {
    background: var(--pgp-surface);
}

.pgp-panel-title {
    margin: 0 0 25px;
    padding-bottom: 15px;
    color: var(--pgp-text);
    border-bottom: 1px solid var(--pgp-line);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.pgp-panel-title span {
    color: var(--pgp-orange);
}

.pgp-field,
.pgp-field-row {
    min-width: 0;
}

.pgp-field-row.is-single {
    grid-template-columns: 1fr;
}

.pgp-field {
    margin-bottom: 21px;
}

.pgp-field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.pgp-field-row .pgp-field {
    margin-bottom: 21px;
}

.pgp-field > label {
    display: block;
    margin-bottom: 8px;
    color: var(--pgp-text);
    font-size: 0.79rem;
    font-weight: 700;
}

.pgp-input-wrap {
    position: relative;
}

.pgp-calc input,
.pgp-calc select {
    width: 100%;
    height: 52px;
    margin: 0;
    color: var(--pgp-text);
    background: var(--pgp-ink);
    border: 1px solid var(--pgp-line);
    border-radius: 0;
    box-shadow: none;
    font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums lining-nums;
}

.pgp-calc input {
    padding: 12px 14px;
}

.pgp-calc select {
    padding: 10px 36px 10px 13px;
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    font-size: 0.9rem;
}

.pgp-calc input:hover,
.pgp-calc select:hover {
    border-color: #435064;
}

.pgp-calc input:focus,
.pgp-calc select:focus,
.pgp-calc button:focus-visible,
.pgp-calc summary:focus-visible {
    outline: 2px solid var(--pgp-teal);
    outline-offset: 2px;
}

.pgp-calc input.pgp-has-prefix {
    padding-left: 40px;
}

.pgp-calc input.pgp-has-suffix {
    padding-right: 64px;
}

.pgp-prefix,
.pgp-suffix {
    position: absolute;
    top: 50%;
    z-index: 1;
    color: #6f87a4;
    font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.9rem;
    transform: translateY(-50%);
    pointer-events: none;
}

.pgp-prefix {
    left: 15px;
}

.pgp-suffix {
    right: 14px;
}

.pgp-hint {
    margin: 7px 0 0;
    color: var(--pgp-faint);
    font-size: 0.74rem;
    line-height: 1.5;
}

.pgp-starting-summary {
    margin: -10px 0 24px;
    color: var(--pgp-faint);
    font-size: 0.74rem;
    line-height: 1.5;
}

.pgp-starting-summary strong {
    color: var(--pgp-teal);
    font-weight: 700;
}

.pgp-divider {
    height: 1px;
    margin: 4px 0 24px;
    background: var(--pgp-line);
}

.pgp-help,
.pgp-advanced {
    color: var(--pgp-muted);
}

.pgp-help {
    margin-top: 8px;
    font-size: 0.72rem;
}

.pgp-help summary,
.pgp-advanced summary {
    color: var(--pgp-teal);
    cursor: pointer;
}

.pgp-help > div {
    margin-top: 8px;
    padding: 11px 12px;
    color: var(--pgp-muted);
    background: var(--pgp-ink);
    border-left: 2px solid var(--pgp-teal-dark);
    line-height: 1.65;
}

.pgp-help strong {
    color: var(--pgp-text);
}

.pgp-advanced {
    margin: 3px 0 24px;
    padding-top: 16px;
    border-top: 1px solid var(--pgp-line);
    font-size: 0.78rem;
}

.pgp-advanced[open] summary {
    margin-bottom: 17px;
}

.pgp-advanced .pgp-field {
    margin-bottom: 0;
}

.pgp-run {
    width: 100%;
    min-height: 50px;
    padding: 13px 18px;
    color: var(--pgp-ink);
    background: var(--pgp-orange);
    border: 1px solid var(--pgp-orange);
    border-radius: 0;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}

.pgp-run:hover {
    background: var(--pgp-orange-hover);
    border-color: var(--pgp-orange-hover);
}

.pgp-run:disabled {
    color: var(--pgp-faint);
    background: var(--pgp-panel-2);
    border-color: var(--pgp-line);
    cursor: wait;
}

.pgp-error {
    margin-bottom: 14px;
    padding: 11px 13px;
    color: #ffd0cc;
    background: rgba(224, 90, 84, 0.09);
    border-left: 3px solid var(--pgp-red);
    font-size: 0.78rem;
    line-height: 1.5;
}

.pgp-method-note {
    margin-top: 17px;
    padding: 13px 14px;
    color: var(--pgp-muted);
    background: var(--pgp-ink);
    border-left: 3px solid var(--pgp-teal-dark);
    font-size: 0.76rem;
    line-height: 1.55;
}

.pgp-method-note strong {
    color: var(--pgp-text);
}

.pgp-placeholder {
    padding: 52px 0;
}

.pgp-placeholder h3 {
    margin: 0 0 9px;
    color: var(--pgp-text);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.35rem;
    font-weight: 600;
}

.pgp-placeholder p {
    max-width: 520px;
    margin: 0;
    color: var(--pgp-faint);
    line-height: 1.65;
}

.pgp-result-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.pgp-run-history {
    display: grid;
    grid-template-columns: auto auto auto;
    align-items: stretch;
    flex: 0 0 auto;
    border: 1px solid var(--pgp-line);
}

.pgp-run-history button,
.pgp-run-history span {
    min-height: 34px;
    padding: 7px 10px;
    border: 0;
    border-right: 1px solid var(--pgp-line);
    background: var(--pgp-ink);
    color: var(--pgp-muted);
    font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.66rem;
    line-height: 1.4;
    white-space: nowrap;
}

.pgp-run-history button {
    cursor: pointer;
}

.pgp-run-history button:hover:not(:disabled) {
    color: var(--pgp-teal);
}

.pgp-run-history button:disabled {
    color: #505866;
    cursor: default;
}

.pgp-run-history span {
    display: flex;
    align-items: center;
    color: var(--pgp-text);
}

.pgp-run-history > :last-child {
    border-right: 0;
}

.pgp-path-browser {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
    max-width: 520px;
    margin: 14px 0 0;
    border: 1px solid var(--pgp-line);
}

.pgp-path-browser button,
.pgp-path-browser span {
    min-height: 38px;
    padding: 8px 12px;
    border: 0;
    border-right: 1px solid var(--pgp-line);
    background: var(--pgp-panel);
    color: var(--pgp-muted);
    font-family: "Courier New", Courier, monospace;
    font-size: 0.68rem;
    line-height: 1.35;
}

.pgp-path-browser button {
    cursor: pointer;
}

.pgp-path-browser button:hover:not(:disabled) {
    color: var(--pgp-teal);
}

.pgp-path-browser button:disabled {
    color: #505866;
    cursor: default;
}

.pgp-path-browser span {
    display: flex;
    align-items: center;
    color: var(--pgp-text);
    white-space: nowrap;
}

.pgp-path-browser > :last-child {
    border-right: 0;
}

.pgp-path-browser button:last-child {
    text-align: right;
}

.pgp-path-note {
    margin: 8px 0 0;
    color: var(--pgp-faint);
    font-size: 0.7rem;
    line-height: 1.5;
}

.pgp-result-head h3 {
    margin: 0 0 5px;
    color: var(--pgp-text);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.45rem;
    font-weight: 600;
}

.pgp-result-head p {
    margin: 0;
    color: var(--pgp-muted);
    font-size: 0.76rem;
    line-height: 1.45;
}

.pgp-view-toggle {
    display: flex;
    flex: 0 0 auto;
    border: 1px solid var(--pgp-line);
}

.pgp-view-toggle button {
    min-height: 34px;
    padding: 7px 10px;
    color: var(--pgp-muted);
    background: var(--pgp-ink);
    border: 0;
    border-right: 1px solid var(--pgp-line);
    font-size: 0.68rem;
    cursor: pointer;
}

.pgp-view-toggle button:last-child {
    border-right: 0;
}

.pgp-view-toggle button.is-active {
    color: var(--pgp-ink);
    background: var(--pgp-teal);
}

.pgp-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
    border: 1px solid var(--pgp-line);
    background: var(--pgp-ink);
}

.pgp-metric {
    min-width: 0;
    padding: 16px;
    border-right: 1px solid var(--pgp-line);
}

.pgp-metric:last-child {
    border-right: 0;
}

.pgp-metric-label {
    display: block;
    min-height: 2.4em;
    margin-bottom: 8px;
    color: var(--pgp-faint);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.pgp-metric strong {
    display: block;
    overflow: hidden;
    color: var(--pgp-text);
    font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: clamp(1rem, 2vw, 1.45rem);
    font-variant-numeric: tabular-nums lining-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pgp-metric strong.pgp-range-value {
    overflow: visible;
    font-size: clamp(0.9rem, 1.45vw, 1.15rem);
    line-height: 1.35;
    text-overflow: clip;
    white-space: normal;
}

.pgp-range-value span {
    display: block;
    white-space: nowrap;
}

.pgp-goal-note,
.pgp-buying-power-note {
    margin: -4px 0 14px;
    padding: 10px 12px;
    color: var(--pgp-muted);
    background: var(--pgp-panel);
    border-left: 3px solid var(--pgp-teal-dark);
    font-size: 0.74rem;
    line-height: 1.55;
}

.pgp-buying-power-note {
    margin: -4px 0 18px;
    border-left-color: var(--pgp-orange);
}

.pgp-metric.is-primary {
    border-top: 3px solid var(--pgp-teal);
}

.pgp-metric.is-target strong {
    color: var(--pgp-teal);
}

.pgp-chart-panel,
.pgp-observations,
.pgp-table-panel {
    margin-top: 18px;
    padding: 18px;
    background: var(--pgp-ink);
    border: 1px solid var(--pgp-line);
}

.pgp-chart-heading,
.pgp-section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.pgp-chart-heading h4,
.pgp-section-heading h4 {
    margin: 0;
    color: var(--pgp-text);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.08rem;
    font-weight: 600;
}

.pgp-chart-heading p,
.pgp-section-heading p {
    margin: 4px 0 0;
    color: var(--pgp-faint);
    font-size: 0.7rem;
    line-height: 1.45;
}

.pgp-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 11px;
    color: var(--pgp-muted);
    font-size: 0.65rem;
}

.pgp-chart-legend span::before {
    content: "";
    display: inline-block;
    width: 13px;
    height: 3px;
    margin-right: 5px;
    background: var(--pgp-teal);
    vertical-align: middle;
}

.pgp-chart-legend .pgp-range-legend::before {
    height: 7px;
    background: rgba(104, 193, 207, 0.22);
    border: 1px solid rgba(104, 193, 207, 0.45);
}

.pgp-chart-legend .pgp-sample-legend::before {
    background: #f0c66c;
}

.pgp-chart-legend .pgp-cash-legend::before {
    height: 0;
    background: transparent;
    border-top: 2px dotted #8091aa;
}

.pgp-chart-legend .pgp-contribution-legend::before {
    height: 0;
    background: transparent;
    border-top: 2px dashed var(--pgp-orange);
}

.pgp-chart-wrap {
    position: relative;
    height: 360px;
}

.pgp-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.pgp-observation-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.pgp-observation-list li {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 14px;
    padding: 13px 0;
    color: var(--pgp-muted);
    border-top: 1px solid var(--pgp-line-soft);
    font-size: 0.78rem;
    line-height: 1.55;
}

.pgp-observation-list li:first-child {
    border-top: 0;
}

.pgp-observation-number {
    color: var(--pgp-orange);
    font-size: 0.68rem;
    font-weight: 700;
}

.pgp-observation-list strong {
    color: var(--pgp-text);
}

.pgp-table-wrap {
    max-height: 500px;
    overflow: auto;
    border: 1px solid var(--pgp-line-soft);
}

.pgp-table {
    width: 100%;
    min-width: 560px;
    margin: 0;
    border-collapse: collapse;
    color: var(--pgp-text);
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums lining-nums;
}

.pgp-table th,
.pgp-table td {
    padding: 10px 7px;
    border: 0;
    border-bottom: 1px solid var(--pgp-line-soft);
    text-align: right;
    white-space: nowrap;
}

.pgp-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--pgp-muted);
    background: var(--pgp-panel);
    font-size: 0.62rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.pgp-table th:first-child,
.pgp-table td:first-child {
    text-align: left;
}

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

.pgp-method-footnote {
    margin: 14px 0 0;
    color: var(--pgp-faint);
    font-size: 0.69rem;
    line-height: 1.55;
}

@media (max-width: 1050px) {
    .pgp-grid {
        grid-template-columns: 390px minmax(0, 1fr);
    }

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

    .pgp-metric:nth-child(2) {
        border-right: 0;
    }

    .pgp-metric:nth-child(-n+2) {
        border-bottom: 1px solid var(--pgp-line);
    }
}

@media (max-width: 820px) {
    .pgp-grid {
        grid-template-columns: 1fr;
    }

    .pgp-input-panel {
        border-right: 0;
        border-bottom: 1px solid var(--pgp-line);
    }
}

@media (max-width: 600px) {
    .pgp-calc {
        padding: 24px 14px 18px;
        border-right: 0;
        border-left: 0;
    }

    .pgp-header {
        margin-bottom: 22px;
        padding-bottom: 18px;
    }

    .pgp-header h2 {
        font-size: 2.1rem;
    }

    .pgp-panel {
        padding: 20px 15px;
    }

    .pgp-field-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .pgp-result-head,
    .pgp-chart-heading,
    .pgp-section-heading {
        display: block;
    }

    .pgp-run-history {
        grid-template-columns: 1fr auto 1fr;
        width: 100%;
        margin-top: 12px;
    }

    .pgp-path-browser {
        grid-template-columns: 1fr 1fr;
        width: 100%;
        max-width: none;
    }

    .pgp-path-browser span {
        grid-column: 1 / -1;
        grid-row: 1;
        justify-content: center;
        border-right: 0;
        border-bottom: 1px solid var(--pgp-line);
    }

    .pgp-path-browser button:first-child {
        grid-column: 1;
        grid-row: 2;
    }

    .pgp-path-browser button:last-child {
        grid-column: 2;
        grid-row: 2;
    }

    .pgp-run-history button:last-child {
        text-align: right;
    }

    .pgp-view-toggle,
    .pgp-chart-legend {
        margin-top: 12px;
    }

    .pgp-metrics {
        grid-template-columns: 1fr;
    }

    .pgp-metric,
    .pgp-metric:nth-child(2) {
        border-right: 0;
        border-bottom: 1px solid var(--pgp-line);
    }

    .pgp-metric:last-child {
        border-bottom: 0;
    }

    .pgp-metric-label {
        min-height: 0;
    }

    .pgp-chart-panel,
    .pgp-observations,
    .pgp-table-panel {
        padding: 14px;
    }

    .pgp-chart-wrap {
        height: 310px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pgp-calc * {
        scroll-behavior: auto;
        transition-duration: 0.01ms !important;
    }
}
