/* Layout and components for the single-page calculator view (docs/spec.md §3). Additive to
   site.css / bootstrap — kept in its own file so it's obvious what slice F added. */

.page-intro {
    margin-bottom: 1.25rem;
}

.page-intro h1 {
    margin: 0;
    color: #10233d;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 750;
    letter-spacing: -0.035em;
}

.page-intro .lead {
    margin: 0.45rem 0 0;
    color: #52657d;
    font-size: 1.05rem;
}

.eyebrow {
    margin: 0 0 0.4rem;
    color: #236bc4;
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.disclaimer {
    background: #fff9e9;
    border: 1px solid #ead38d;
    border-left: 4px solid #d7a900;
    border-radius: 0.6rem;
    padding: 0.9rem 1.1rem;
    margin: 0 0 1rem;
    color: #594915;
}

.disclaimer strong {
    display: block;
    margin-bottom: 0.25rem;
}

.rule-meta {
    font-size: 0.82rem;
    color: #607086;
    margin-bottom: 1.5rem;
}

.rule-meta a {
    margin-right: 0.75rem;
}

.calculator-layout {
    display: grid;
    grid-template-columns: minmax(440px, 0.9fr) minmax(500px, 1.1fr);
    gap: clamp(1.5rem, 3vw, 2.5rem);
    align-items: start;
}

.calculator-layout-gated {
    grid-template-columns: minmax(320px, 620px);
}

@media (max-width: 1100px) {
    .calculator-layout {
        grid-template-columns: 1fr;
    }
}

.input-column, .result-column {
    min-width: 0;
}

.input-group {
    display: block;
    width: 100%;
    border: 1px solid #d7e0eb;
    border-radius: 0.85rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: #fff;
    box-shadow: 0 3px 12px rgba(31, 50, 76, 0.045);
}

.input-group h3 {
    margin: 0;
    color: #172d49;
    font-size: 1.08rem;
    font-weight: 700;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.15rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid #e8edf3;
}

.section-heading p {
    margin: 0.2rem 0 0;
    color: #6b7d92;
    font-size: 0.84rem;
}

.section-icon {
    display: grid;
    place-items: center;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    background: #eaf3ff;
    color: #236bc4;
    font-size: 0.72rem;
    font-weight: 800;
}

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

.field-wide {
    grid-column: span 1;
}

.field + .field {
    margin-top: 0.95rem;
}

.field-grid .field + .field,
.cost-row .field + .field {
    margin-top: 0;
}

.field label {
    display: block;
    margin-bottom: 0.38rem;
    color: #263c57;
    font-size: 0.88rem;
    font-weight: 650;
}

.field label span {
    color: #708096;
    font-weight: 450;
}

.input-group .form-control,
.input-group .form-select,
.scenario-panel .form-control {
    min-height: 2.8rem;
    border: 1px solid #aebdce;
    border-radius: 0.55rem !important;
    background-color: #fbfdff;
    color: #152a44;
    font-size: 1rem;
    font-weight: 500;
}

.input-group .form-control:hover,
.input-group .form-select:hover {
    border-color: #8398af;
}

.input-group .form-control:focus,
.input-group .form-select:focus,
.scenario-panel .form-control:focus {
    border-color: #2f80ed;
    background: #fff;
    box-shadow: 0 0 0 0.2rem rgba(47, 128, 237, 0.16);
}

.input-with-suffix {
    position: relative;
}

.input-with-suffix .form-control {
    padding-right: 5.25rem;
}

.input-with-suffix > span {
    position: absolute;
    top: 50%;
    right: 0.85rem;
    transform: translateY(-50%);
    color: #687b92;
    font-size: 0.82rem;
    pointer-events: none;
}

.input-group .field-hint {
    margin-top: 0.4rem;
    color: #66788e;
    font-size: 0.82rem;
    line-height: 1.4;
}

.membership-check {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 2.8rem;
    margin-top: 1rem;
    padding: 0.65rem 0.8rem 0.65rem 2.4rem;
    border-radius: 0.55rem;
    background: #f3f7fc;
}

.membership-check label {
    margin: 0;
    color: #2e435e;
    font-weight: 550;
}

.cost-row {
    display: grid;
    position: relative;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    gap: 0.8rem;
    align-items: end;
    margin-bottom: 0.85rem;
    padding: 1rem 2.8rem 1rem 1rem;
    border: 1px solid #dce4ee;
    border-radius: 0.7rem;
    background: #f8fafc;
}

.cost-row label {
    font-size: 0.78rem;
}

.vat-check {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0.1rem 0 0;
    padding-left: 1.5rem;
    color: #52657c;
    font-size: 0.82rem;
}

.btn-remove-cost {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #a43d49;
    font-size: 1.35rem;
    line-height: 1;
}

.btn-remove-cost:hover {
    background: #fae9ec;
}

.btn-add-cost {
    width: 100%;
    min-height: 2.7rem;
    border: 1px dashed #8ba6c3;
    background: #f7fbff;
    color: #2366b1;
    font-weight: 650;
}

.btn-add-cost:hover {
    border-color: #2f80ed;
    background: #eaf3ff;
    color: #174f8d;
}

.calculate-panel {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.25rem 0 1.75rem;
}

.btn-calculate {
    min-height: 3rem;
    padding: 0.65rem 1.3rem;
    border-radius: 0.6rem;
    font-weight: 700;
}

.calculate-panel span {
    color: #66788e;
    font-size: 0.82rem;
}

/* Section cards (right column, one per docs/spec.md §3.2 result section) */
.result-section {
    border: 1px solid #d7e0eb;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 3px 12px rgba(31, 50, 76, 0.04);
}

.result-section > .calc-line > .calc-line-row {
    background: #f1f3f5;
    font-weight: 600;
}

/* Recursive drill-down tree (docs/spec.md §16) */
.calc-line-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font: inherit;
}

.calc-line-row:disabled {
    cursor: default;
}

.calc-line-row:hover:not(:disabled) {
    background: #eef2f6;
}

.calc-line-caret {
    width: 1rem;
    flex: 0 0 auto;
    color: #6c757d;
}

.calc-line-label {
    flex: 1 1 auto;
}

.calc-line-value {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.calc-line-detail {
    padding: 0.5rem 1rem 0.75rem 2.25rem;
    background: #fbfbfc;
    font-size: 0.9rem;
    border-top: 1px dashed #dee2e6;
}

.calc-line-detail-block {
    margin-bottom: 0.5rem;
}

.calc-line-detail-heading {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #495057;
    margin-bottom: 0.15rem;
}

.calc-line-detail ul {
    margin: 0;
    padding-left: 1.1rem;
}

.calc-line-detail-empty {
    color: #6c757d;
    font-style: italic;
}

.calc-line-children {
    margin-left: 1.5rem;
    border-left: 1px solid #e9ecef;
}

.calc-line.depth-0 > .calc-line-row {
    font-size: 1.02rem;
}

/* Charts (docs/spec.md §17) */
.chart {
    margin: 0.75rem 0 1.25rem 0;
}

.chart-stack {
    display: flex;
    height: 1.75rem;
    width: 100%;
    border-radius: 0.3rem;
    overflow: hidden;
    border: 1px solid #dee2e6;
}

.chart-stack-segment {
    min-width: 2px;
}

.chart-legend {
    list-style: none;
    padding: 0;
    margin: 0.6rem 0 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.25rem 1rem;
    font-size: 0.85rem;
}

.chart-legend-swatch {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 2px;
    margin-right: 0.4rem;
    vertical-align: middle;
}

.chart-bars .chart-row {
    display: grid;
    grid-template-columns: minmax(160px, 220px) 1fr auto;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.chart-group {
    margin-bottom: 1.2rem;
    padding: 0.9rem 1rem 0.65rem;
    border: 1px solid #dce4ee;
    border-radius: 0.7rem;
    background: #fff;
}

.chart-group-title {
    margin: 0 0 0.75rem;
    color: #344a64;
    font-size: 0.84rem;
    font-weight: 700;
}

.chart-row-track {
    background: #eef1f4;
    border-radius: 0.2rem;
    overflow: hidden;
    height: 1rem;
}

.chart-row-bar {
    height: 100%;
}

.chart-row-value {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.chart-color-0 { background: #1b6ec2; }
.chart-color-1 { background: #e07b39; }
.chart-color-2 { background: #4c9a2a; }
.chart-color-3 { background: #a239ca; }
.chart-color-4 { background: #c2185b; }
.chart-color-5 { background: #009688; }
.chart-color-6 { background: #f4b400; }
.chart-color-7 { background: #607d8b; }
.chart-color-8 { background: #795548; }
.chart-color-9 { background: #d32f2f; }

/* Save / share (docs/spec.md §18) */
.scenario-panel {
    border: 1px solid #d7e0eb;
    border-radius: 0.75rem;
    padding: 1.1rem;
    margin-bottom: 0.9rem;
    background: #fff;
}

.scenario-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
}

.scenario-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid #f1f3f5;
}

.share-url-box {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.share-url-box input {
    flex: 1 1 auto;
    font-size: 0.8rem;
}

.status-message {
    font-size: 0.85rem;
    color: #1b6ec2;
    margin-top: 0.4rem;
}

@media (max-width: 700px) {
    .field-grid,
    .cost-row {
        grid-template-columns: 1fr;
    }

    .cost-row {
        padding-right: 2.8rem;
    }

    .vat-check {
        grid-column: auto;
    }

    .calculate-panel {
        align-items: flex-start;
        flex-direction: column;
    }
}
