:root {
    --ccdc-bg: #f7f8fa;
    --ccdc-panel: #ffffff;
    --ccdc-text: #111827;
    --ccdc-muted: #667085;
    --ccdc-line: #d9dee7;
    --ccdc-primary: #2f4054;
    --ccdc-primary-strong: #1f2d3d;
    --ccdc-success: #147a44;
    --ccdc-warning: #9a5b00;
    --ccdc-danger: #b42318;
    --ccdc-shadow: 0 16px 40px rgba(17, 24, 39, 0.10);
    --ccdc-radius: 28px;
}

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

.ccdc-calculator {
    width: 100%;
    max-width: 100%;
    color: var(--ccdc-text);
    font-family: inherit;
    background: transparent;
    overflow-x: hidden;
}

.ccdc-shell {
    width: min(100%, 920px);
    margin: 0 auto;
    padding: clamp(16px, 4vw, 34px);
    background: var(--ccdc-panel);
    border: 1px solid var(--ccdc-line);
    border-radius: var(--ccdc-radius);
    box-shadow: var(--ccdc-shadow);
    overflow: hidden;
}

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

.ccdc-kicker {
    margin: 0 0 8px;
    color: var(--ccdc-muted);
    font-size: clamp(0.82rem, 2.7vw, 0.95rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ccdc-header h2 {
    margin: 0;
    color: var(--ccdc-text);
    font-size: clamp(1.75rem, 7vw, 3rem);
    line-height: 1.05;
    font-weight: 850;
}

.ccdc-intro {
    margin: 12px 0 0;
    color: var(--ccdc-muted);
    font-size: clamp(1rem, 3.5vw, 1.12rem);
    line-height: 1.55;
    max-width: 760px;
}

.ccdc-theme-toggle,
.ccdc-button {
    appearance: none;
    border: 0;
    cursor: pointer;
    width: 100%;
    min-height: 54px;
    padding: 15px 18px;
    border-radius: 18px;
    font: inherit;
    font-weight: 800;
    line-height: 1.15;
    transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.ccdc-theme-toggle {
    background: #f8fafc;
    color: var(--ccdc-primary);
    border: 1px solid var(--ccdc-line);
}

.ccdc-button {
    background: var(--ccdc-primary);
    color: #fff;
    box-shadow: 0 10px 22px rgba(47, 64, 84, 0.20);
}

.ccdc-button-primary {
    background: var(--ccdc-primary-strong);
}

.ccdc-button-muted {
    background: #5d6b7d;
}

.ccdc-theme-toggle:hover,
.ccdc-button:hover {
    transform: translateY(-1px);
}

.ccdc-theme-toggle:focus-visible,
.ccdc-button:focus-visible,
.ccdc-field input:focus-visible,
.ccdc-field select:focus-visible {
    outline: 3px solid rgba(47, 64, 84, 0.35);
    outline-offset: 3px;
}

.ccdc-form {
    display: grid;
    gap: 18px;
    width: 100%;
    max-width: 100%;
}

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

.ccdc-field {
    min-width: 0;
}

.ccdc-field label {
    display: block;
    margin: 0 0 8px;
    color: var(--ccdc-text);
    font-size: clamp(1rem, 3.5vw, 1.08rem);
    font-weight: 800;
}

.ccdc-field input,
.ccdc-field select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 56px;
    padding: 14px 16px;
    border: 1px solid var(--ccdc-line);
    border-radius: 16px;
    background: #fff;
    color: var(--ccdc-text);
    font: inherit;
    font-size: 1rem;
}

.ccdc-help,
.ccdc-error,
.ccdc-disclaimer {
    margin: 8px 0 0;
    font-size: clamp(0.88rem, 3vw, 0.98rem);
    line-height: 1.55;
}

.ccdc-help {
    color: var(--ccdc-muted);
}

.ccdc-error {
    color: var(--ccdc-danger);
    font-weight: 700;
    min-height: 1.2em;
}

.ccdc-manual {
    width: 100%;
    border: 1px solid var(--ccdc-line);
    border-radius: 18px;
    padding: 14px;
    background: #fbfcfe;
}

.ccdc-manual summary {
    cursor: pointer;
    color: var(--ccdc-text);
    font-weight: 850;
    margin-bottom: 12px;
}

.ccdc-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 6px;
    width: 100%;
}

/* Flat full-width output. It is intentionally outside the form box. */
.ccdc-result {
    width: min(100%, 920px);
    max-width: 100%;
    min-width: 0;
    margin: clamp(30px, 7vw, 48px) auto 0;
    padding: 0 clamp(16px, 4vw, 34px);
    color: var(--ccdc-text);
    overflow-wrap: anywhere;
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
}

.ccdc-report-title {
    width: 100%;
    border-top: 4px solid var(--ccdc-primary-strong);
    padding-top: 18px;
    margin-bottom: 0;
    color: var(--ccdc-text);
    font-size: clamp(1.7rem, 6vw, 2.45rem);
    font-weight: 900;
    line-height: 1.12;
}

.ccdc-result-line {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    min-width: 0;
    width: 100%;
    padding: 22px 0;
    border-bottom: 1px solid var(--ccdc-line);
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.ccdc-main-line {
    border-top: 1px solid var(--ccdc-line);
    padding-top: 26px;
    padding-bottom: 26px;
}

.ccdc-result-line span {
    color: var(--ccdc-muted);
    font-size: clamp(1.12rem, 4vw, 1.45rem);
    font-weight: 850;
    line-height: 1.25;
}

.ccdc-result-line strong {
    color: var(--ccdc-text);
    font-size: clamp(1.28rem, 5vw, 1.85rem);
    font-weight: 900;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.ccdc-main-line strong {
    font-size: clamp(1.85rem, 8vw, 3.4rem);
    line-height: 1.08;
}

.ccdc-status-good {
    color: var(--ccdc-success) !important;
}

.ccdc-status-warning {
    color: var(--ccdc-warning) !important;
}

.ccdc-status-danger {
    color: var(--ccdc-danger) !important;
}

.ccdc-disclaimer {
    margin-top: 18px;
    color: var(--ccdc-muted);
}

/* Dark mode */
.ccdc-calculator.ccdc-dark {
    --ccdc-bg: #111827;
    --ccdc-panel: #1f2937;
    --ccdc-text: #f9fafb;
    --ccdc-muted: #cbd5e1;
    --ccdc-line: #374151;
    --ccdc-primary: #4b5f78;
    --ccdc-primary-strong: #5f7896;
    --ccdc-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
}

.ccdc-calculator.ccdc-dark .ccdc-field input,
.ccdc-calculator.ccdc-dark .ccdc-field select,
.ccdc-calculator.ccdc-dark .ccdc-theme-toggle,
.ccdc-calculator.ccdc-dark .ccdc-manual {
    background: #111827;
    color: var(--ccdc-text);
}

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

    .ccdc-theme-toggle {
        width: auto;
        min-width: 150px;
    }

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

    .ccdc-actions {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .ccdc-result-line {
        grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
        align-items: baseline;
    }

    .ccdc-result-line strong {
        text-align: right;
    }
}

@media print {
    .ccdc-theme-toggle,
    .ccdc-actions {
        display: none !important;
    }

    .ccdc-shell {
        box-shadow: none;
        border: 0;
    }

    .ccdc-result {
        padding: 0;
    }
}
