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

.sdc-calculator {
    --sdc-bg: #ffffff;
    --sdc-panel: #f8fafc;
    --sdc-text: #111827;
    --sdc-muted: #667085;
    --sdc-border: #d6dce4;
    --sdc-soft-border: #edf0f4;
    --sdc-primary: #111827;
    --sdc-primary-text: #ffffff;
    --sdc-good: #137a41;
    --sdc-button-bg: #ffffff;
    --sdc-error: #b91c1c;
    --sdc-focus: #2563eb;

    width: 100%;
    max-width: 900px;
    margin: 18px auto;
    padding: clamp(14px, 4vw, 28px);
    color: var(--sdc-text);
    background: var(--sdc-bg);
    border: 1px solid var(--sdc-soft-border);
    border-radius: 20px;
    box-shadow: 0 12px 36px rgba(17, 24, 39, 0.07);
    font-family: inherit;
    overflow-wrap: anywhere;
}

.sdc-calculator.sdc-dark {
    --sdc-bg: #111827;
    --sdc-panel: #1f2937;
    --sdc-text: #f9fafb;
    --sdc-muted: #cbd5e1;
    --sdc-border: #4b5563;
    --sdc-soft-border: #374151;
    --sdc-primary: #f9fafb;
    --sdc-primary-text: #111827;
    --sdc-good: #86efac;
    --sdc-button-bg: #111827;
    --sdc-error: #fca5a5;
    --sdc-focus: #93c5fd;
}

.sdc-header {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 22px;
}

.sdc-eyebrow {
    margin: 0 0 6px;
    color: var(--sdc-muted);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sdc-header h2,
.sdc-result h3,
.sdc-result h4 {
    margin: 0;
    color: var(--sdc-text);
    line-height: 1.2;
}

.sdc-header h2 {
    font-size: clamp(1.6rem, 5vw, 2.35rem);
}

.sdc-result h3 {
    font-size: clamp(1.35rem, 5vw, 1.9rem);
    margin-top: 14px;
}

.sdc-result h4 {
    font-size: clamp(1.18rem, 4.5vw, 1.55rem);
    margin: 16px 0 12px;
}

.sdc-intro {
    max-width: 70ch;
    margin: 10px 0 0;
    color: var(--sdc-muted);
    font-size: clamp(0.95rem, 2.5vw, 1.05rem);
    line-height: 1.6;
}

.sdc-theme-toggle,
.sdc-button {
    width: 100%;
    min-height: 46px;
    padding: 12px 16px;
    border: 1px solid var(--sdc-border);
    border-radius: 12px;
    color: var(--sdc-text);
    background: var(--sdc-button-bg);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    line-height: 1.2;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

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

.sdc-button-primary {
    color: var(--sdc-primary-text);
    background: var(--sdc-primary);
    border-color: var(--sdc-primary);
}

.sdc-button-light {
    background: var(--sdc-panel);
}

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

.sdc-field,
.sdc-field-full {
    min-width: 0;
}

.sdc-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--sdc-text);
    font-weight: 800;
}

.sdc-field input,
.sdc-field select,
.sdc-field textarea {
    width: 100%;
    max-width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--sdc-border);
    border-radius: 12px;
    color: var(--sdc-text);
    background: var(--sdc-bg);
    font: inherit;
    line-height: 1.35;
    outline: none;
}

.sdc-field textarea {
    min-height: 106px;
    resize: vertical;
}

.sdc-field input:focus,
.sdc-field select:focus,
.sdc-field textarea:focus,
.sdc-button:focus,
.sdc-theme-toggle:focus {
    border-color: var(--sdc-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.sdc-help {
    display: block;
    margin-top: 7px;
    color: var(--sdc-muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.sdc-optional {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--sdc-soft-border);
    border-radius: 14px;
    background: var(--sdc-panel);
}

.sdc-optional summary {
    color: var(--sdc-text);
    cursor: pointer;
    font-weight: 800;
}

.sdc-optional .sdc-field {
    margin-top: 14px;
}

.sdc-errors {
    min-height: 22px;
    color: var(--sdc-error);
    font-weight: 800;
    line-height: 1.5;
}

.sdc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}


/* Keep the result area clean: remove any old helper/intro paragraph above the result rows. */
.sdc-result > p:not(.sdc-disclaimer),
.sdc-result > .sdc-result-note,
.sdc-result > .sdc-result-helper,
.sdc-result > .sdc-mobile-note,
.sdc-result > .sdc-output-note {
    display: none !important;
}

/* Flat report-style output: no boxed result card, no sidebar, no cramped mobile cards. */
.sdc-result {
    width: 100%;
    max-width: 100%;
    margin-top: 26px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
}

.sdc-result-line,
.sdc-section-divider {
    width: 100%;
    border-top: 4px solid var(--sdc-primary);
}

.sdc-section-divider {
    margin-top: 20px;
}

.sdc-metric {
    width: 100%;
    padding: 16px 0;
    border-bottom: 1px solid var(--sdc-border);
}

.sdc-metric span,
.sdc-row span {
    display: block;
    color: var(--sdc-muted);
    font-size: clamp(1rem, 3.8vw, 1.15rem);
    font-weight: 800;
    line-height: 1.35;
}

.sdc-metric strong {
    display: block;
    margin-top: 6px;
    color: var(--sdc-text);
    font-size: clamp(1.35rem, 6vw, 2rem);
    font-weight: 900;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.sdc-metric-main strong,
.sdc-status-good {
    color: var(--sdc-good);
}

.sdc-report {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    min-width: 0;
}

.sdc-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    width: 100%;
    min-width: 0;
    padding: 14px 0;
    border-bottom: 1px solid var(--sdc-border);
}

.sdc-row strong {
    color: var(--sdc-text);
    font-size: clamp(1rem, 4vw, 1.15rem);
    font-weight: 900;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.sdc-explanation {
    margin-top: 16px;
    color: var(--sdc-text);
    font-size: clamp(0.95rem, 3.6vw, 1.05rem);
    line-height: 1.65;
}

.sdc-disclaimer {
    margin: 16px 0 0;
    color: var(--sdc-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

@media (min-width: 640px) {
    .sdc-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }

    .sdc-theme-toggle {
        width: auto;
        white-space: nowrap;
    }

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

    .sdc-optional,
    .sdc-errors,
    .sdc-actions {
        grid-column: 1 / -1;
    }

    .sdc-button {
        width: auto;
        flex: 1 1 150px;
    }

    .sdc-row {
        grid-template-columns: minmax(0, 1fr) minmax(150px, 0.55fr);
        align-items: start;
        gap: 18px;
    }

    .sdc-row strong {
        text-align: right;
    }
}

@media (max-width: 420px) {
    .sdc-calculator {
        margin: 10px auto;
        padding: 14px;
        border-radius: 14px;
    }

    .sdc-actions {
        gap: 8px;
    }
}

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

    .sdc-calculator,
    .sdc-calculator * {
        visibility: visible;
    }

    .sdc-calculator {
        margin: 0;
        padding: 0;
        box-shadow: none;
        border: 0;
    }

    .sdc-form,
    .sdc-theme-toggle,
    .sdc-actions {
        display: none;
    }
}
