.fddc-calculator,
.fddc-calculator * {
    box-sizing: border-box;
}

.fddc-calculator {
    --fddc-bg: #f5f7fb;
    --fddc-panel: #ffffff;
    --fddc-text: #111827;
    --fddc-muted: #667085;
    --fddc-border: #d8dde6;
    --fddc-strong-border: #111827;
    --fddc-input: #ffffff;
    --fddc-accent: #1f6f43;
    --fddc-accent-dark: #185536;
    --fddc-danger: #b42318;
    --fddc-focus: #2563eb;
    --fddc-shadow: 0 18px 45px rgba(17, 24, 39, 0.09);
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    padding: clamp(16px, 4vw, 34px);
    color: var(--fddc-text);
    background: var(--fddc-bg);
    border-radius: 24px;
    overflow-x: hidden;
    font-family: inherit;
}

.fddc-calculator[data-theme="dark"] {
    --fddc-bg: #111827;
    --fddc-panel: #172033;
    --fddc-text: #f8fafc;
    --fddc-muted: #cbd5e1;
    --fddc-border: #334155;
    --fddc-strong-border: #e5e7eb;
    --fddc-input: #0f172a;
    --fddc-accent: #4ade80;
    --fddc-accent-dark: #22c55e;
    --fddc-danger: #fca5a5;
    --fddc-focus: #93c5fd;
    --fddc-shadow: 0 18px 45px rgba(0, 0, 0, 0.32);
}

.fddc-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: start;
    margin-bottom: 20px;
}

.fddc-kicker {
    margin: 0 0 8px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fddc-accent);
}

.fddc-header h2 {
    margin: 0;
    font-size: clamp(1.55rem, 5vw, 2.3rem);
    line-height: 1.15;
    color: var(--fddc-text);
}

.fddc-header p:not(.fddc-kicker) {
    margin: 10px 0 0;
    color: var(--fddc-muted);
    font-size: clamp(0.96rem, 3vw, 1.04rem);
    line-height: 1.6;
}

.fddc-theme-toggle,
.fddc-button {
    appearance: none;
    border: 1px solid var(--fddc-border);
    border-radius: 999px;
    padding: 12px 16px;
    min-height: 46px;
    max-width: 100%;
    color: var(--fddc-text);
    background: var(--fddc-panel);
    font: inherit;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.fddc-theme-toggle:hover,
.fddc-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.12);
}

.fddc-theme-toggle:focus-visible,
.fddc-button:focus-visible,
.fddc-field input:focus-visible,
.fddc-field select:focus-visible,
.fddc-field textarea:focus-visible,
.fddc-choice:focus-within,
.fddc-check-card:focus-within,
.fddc-advanced summary:focus-visible {
    outline: 3px solid var(--fddc-focus);
    outline-offset: 3px;
}

.fddc-form {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: clamp(16px, 4vw, 26px);
    background: var(--fddc-panel);
    border: 1px solid var(--fddc-border);
    border-radius: 22px;
    box-shadow: var(--fddc-shadow);
}

.fddc-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    min-width: 0;
}

.fddc-field,
.fddc-fieldset {
    min-width: 0;
    max-width: 100%;
}

.fddc-field label,
.fddc-fieldset legend {
    display: block;
    margin: 0 0 8px;
    color: var(--fddc-text);
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1.35;
}

.fddc-field label span {
    color: var(--fddc-muted);
    font-size: 0.84em;
    font-weight: 700;
}

.fddc-field input[type="text"],
.fddc-field input[type="date"],
.fddc-field input[type="number"],
.fddc-field select,
.fddc-field textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--fddc-border);
    border-radius: 14px;
    color: var(--fddc-text);
    background: var(--fddc-input);
    font: inherit;
    font-size: 1rem;
    line-height: 1.35;
}

.fddc-field textarea {
    resize: vertical;
    min-height: 112px;
}

.fddc-field small,
.fddc-check-card small {
    display: block;
    margin-top: 7px;
    color: var(--fddc-muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.fddc-fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

.fddc-choice-wrap {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.fddc-choice,
.fddc-check-card,
.fddc-checkbox-line label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--fddc-border);
    border-radius: 14px;
    background: var(--fddc-input);
    cursor: pointer;
}

.fddc-choice input,
.fddc-check-card input,
.fddc-checkbox-line input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: var(--fddc-accent);
}

.fddc-choice span,
.fddc-checkbox-line span,
.fddc-check-card span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.fddc-advanced {
    margin-top: 18px;
    border-top: 1px solid var(--fddc-border);
    padding-top: 18px;
}

.fddc-advanced summary {
    width: fit-content;
    max-width: 100%;
    cursor: pointer;
    color: var(--fddc-text);
    font-weight: 900;
    line-height: 1.5;
}

.fddc-advanced-inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 16px;
    min-width: 0;
}

.fddc-error {
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px solid rgba(180, 35, 24, 0.32);
    border-radius: 14px;
    color: var(--fddc-danger);
    background: rgba(180, 35, 24, 0.08);
    font-weight: 800;
    line-height: 1.5;
}

.fddc-form-actions,
.fddc-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.fddc-form-actions .fddc-button,
.fddc-result-actions .fddc-button {
    flex: 1 1 150px;
}

.fddc-button {
    background: var(--fddc-text);
    border-color: var(--fddc-text);
    color: var(--fddc-panel);
}

.fddc-button--ghost,
.fddc-theme-toggle {
    background: transparent;
    border-color: var(--fddc-border);
    color: var(--fddc-text);
}

.fddc-output {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-top: clamp(22px, 5vw, 36px);
    padding: 0 clamp(2px, 1vw, 4px);
    color: var(--fddc-text);
    overflow-x: hidden;
}

.fddc-report-title-line {
    border-top: 4px solid var(--fddc-strong-border);
    border-bottom: 1px solid var(--fddc-border);
    padding: 14px 0 12px;
}

.fddc-report-title-line h3 {
    margin: 0;
    font-size: clamp(1.4rem, 5vw, 2rem);
    line-height: 1.2;
    color: var(--fddc-text);
}

.fddc-report-rows {
    width: 100%;
    min-width: 0;
}

.fddc-report-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 17px 0;
    border-bottom: 1px solid var(--fddc-border);
}

.fddc-report-row > span {
    flex: 1 1 190px;
    min-width: 0;
    color: var(--fddc-muted);
    font-size: clamp(1.02rem, 4vw, 1.35rem);
    font-weight: 900;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.fddc-report-row > strong {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    color: var(--fddc-text);
    font-size: clamp(1.02rem, 4.4vw, 1.45rem);
    font-weight: 950;
    line-height: 1.25;
    text-align: right;
    overflow-wrap: anywhere;
}

.fddc-report-row--main > span,
.fddc-report-row--main > strong {
    color: var(--fddc-text);
    font-size: clamp(1.18rem, 5vw, 1.72rem);
}

.fddc-report-row--main > strong {
    color: var(--fddc-accent);
}

.fddc-report-row--text {
    display: block;
}

.fddc-report-row--text > span {
    display: block;
    margin-bottom: 8px;
}

.fddc-report-row--text p {
    margin: 0;
    color: var(--fddc-text);
    font-size: clamp(0.96rem, 3.4vw, 1.06rem);
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.fddc-action-note {
    min-height: 22px;
    margin: 10px 0 0;
    color: var(--fddc-muted);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.5;
}

@media (min-width: 720px) {
    .fddc-header {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }

    .fddc-theme-toggle {
        justify-self: end;
    }

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

    .fddc-field--wide {
        grid-column: 1 / -1;
    }

    .fddc-choice-wrap,
    .fddc-advanced-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fddc-advanced-inner .fddc-field--wide {
        grid-column: 1 / -1;
    }

    .fddc-form-actions .fddc-button,
    .fddc-result-actions .fddc-button {
        flex: 0 1 auto;
    }
}

@media (max-width: 380px) {
    .fddc-calculator {
        padding: 12px;
        border-radius: 18px;
    }

    .fddc-form {
        padding: 14px;
        border-radius: 18px;
    }

    .fddc-report-row > strong {
        text-align: left;
    }
}

@media print {
    body * {
        visibility: hidden;
    }

    .fddc-output,
    .fddc-output * {
        visibility: visible;
    }

    .fddc-output {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        color: #000000;
        background: #ffffff;
    }

    .fddc-result-actions,
    .fddc-action-note {
        display: none !important;
    }
}

/* Remove old helper text from earlier builds if a cached page still contains it. */
.fddc-output-help,
.fddc-output-intro,
.fddc-mobile-note {
    display: none !important;
}
