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

.ddct-calculator {
    --ddct-bg: #f5f7fb;
    --ddct-panel: #ffffff;
    --ddct-text: #101827;
    --ddct-muted: #667085;
    --ddct-line: #d7dce4;
    --ddct-strong-line: #111827;
    --ddct-input: #ffffff;
    --ddct-focus: #2563eb;
    --ddct-success: #137333;
    --ddct-button: #111827;
    --ddct-button-text: #ffffff;
    max-width: 100%;
    color: var(--ddct-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.ddct-calculator.ddct-dark {
    --ddct-bg: #101318;
    --ddct-panel: #171b22;
    --ddct-text: #f5f7fb;
    --ddct-muted: #a6adbb;
    --ddct-line: #303744;
    --ddct-strong-line: #f5f7fb;
    --ddct-input: #11151d;
    --ddct-focus: #7aa2ff;
    --ddct-success: #72d391;
    --ddct-button: #f5f7fb;
    --ddct-button-text: #101318;
}

.ddct-shell {
    width: min(100%, 780px);
    margin: 0 auto;
    padding: clamp(16px, 4vw, 28px);
    background: var(--ddct-panel);
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(16, 24, 39, 0.10);
    overflow: hidden;
}

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

.ddct-kicker {
    margin: 0 0 6px;
    color: var(--ddct-muted);
    font-size: clamp(0.86rem, 2.6vw, 0.95rem);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.ddct-header h2 {
    margin: 0;
    color: var(--ddct-text);
    font-size: clamp(1.45rem, 6vw, 2.2rem);
    line-height: 1.12;
}

.ddct-theme-toggle,
.ddct-tools button,
.ddct-buttons button {
    appearance: none;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    min-height: 44px;
    padding: 12px 16px;
    font: inherit;
    font-weight: 800;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

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

.ddct-theme-toggle:focus-visible,
.ddct-tools button:focus-visible,
.ddct-buttons button:focus-visible,
.ddct-calculator input:focus-visible,
.ddct-calculator select:focus-visible {
    outline: 3px solid var(--ddct-focus);
    outline-offset: 2px;
}

.ddct-theme-toggle {
    align-self: flex-start;
    background: var(--ddct-bg);
    color: var(--ddct-text);
    border: 1px solid var(--ddct-line);
}

.ddct-form {
    display: block;
    width: 100%;
    margin: 0;
}

.ddct-field,
.ddct-checkrow {
    width: 100%;
    min-width: 0;
    margin-bottom: 16px;
}

.ddct-field label,
.ddct-checkrow label {
    display: block;
    margin: 0 0 7px;
    color: var(--ddct-text);
    font-size: clamp(0.95rem, 3.4vw, 1.03rem);
    font-weight: 800;
}

.ddct-calculator input,
.ddct-calculator select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 12px 13px;
    border: 1px solid var(--ddct-line);
    border-radius: 12px;
    background: var(--ddct-input);
    color: var(--ddct-text);
    font-size: 1rem;
    line-height: 1.2;
}

.ddct-help {
    margin: 7px 0 0;
    color: var(--ddct-muted);
    font-size: clamp(0.82rem, 3vw, 0.92rem);
    line-height: 1.45;
}

.ddct-checkrow {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 0;
}

.ddct-checkrow input {
    width: 20px;
    min-width: 20px;
    height: 20px;
    min-height: 20px;
    margin: 1px 0 0;
}

.ddct-checkrow label {
    margin: 0;
    line-height: 1.35;
}

.ddct-error {
    min-height: 22px;
    margin: 4px 0 14px;
    color: #b42318;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.ddct-buttons,
.ddct-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}

.ddct-buttons button,
.ddct-tools button {
    flex: 1 1 100%;
}

.ddct-primary {
    background: var(--ddct-button);
    color: var(--ddct-button-text);
    box-shadow: 0 8px 18px rgba(16, 24, 39, 0.16);
}

.ddct-secondary,
.ddct-tools button {
    background: var(--ddct-bg);
    color: var(--ddct-text);
    border: 1px solid var(--ddct-line);
}

.ddct-output {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-top: clamp(26px, 6vw, 38px);
    padding-top: 4px;
    overflow-wrap: anywhere;
}

.ddct-output-empty {
    padding: 18px 0;
    border-top: 1px solid var(--ddct-line);
    border-bottom: 1px solid var(--ddct-line);
    color: var(--ddct-muted);
    font-weight: 700;
}

.ddct-report-title {
    margin: 0 0 12px;
    padding-top: 18px;
    border-top: 4px solid var(--ddct-strong-line);
    color: var(--ddct-text);
    font-size: clamp(1.45rem, 6vw, 2rem);
    line-height: 1.15;
}


.ddct-section-title {
    margin: 28px 0 8px;
    padding-top: 16px;
    border-top: 4px solid var(--ddct-strong-line);
    font-size: clamp(1.28rem, 5vw, 1.65rem);
    line-height: 1.2;
    color: var(--ddct-text);
}

.ddct-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 16px 0;
    border-bottom: 1px solid var(--ddct-line);
    min-width: 0;
}

.ddct-row-label {
    color: var(--ddct-muted);
    font-weight: 900;
    font-size: clamp(1rem, 4vw, 1.15rem);
    line-height: 1.22;
}

.ddct-row-value {
    color: var(--ddct-text);
    font-weight: 900;
    font-size: clamp(1.15rem, 5vw, 1.45rem);
    line-height: 1.22;
    overflow-wrap: anywhere;
}

.ddct-row-value.ddct-main-value {
    color: var(--ddct-success);
    font-size: clamp(1.55rem, 7vw, 2.25rem);
    white-space: normal;
}

.ddct-note {
    margin: 18px 0 0;
    color: var(--ddct-muted);
    font-size: clamp(0.88rem, 3vw, 0.96rem);
    line-height: 1.55;
}

.ddct-tools {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--ddct-line);
}

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

    .ddct-theme-toggle {
        flex: 0 0 auto;
    }

    .ddct-buttons button,
    .ddct-tools button {
        flex: 1 1 calc(50% - 10px);
    }

    .ddct-row {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
        align-items: end;
        gap: 18px;
    }

    .ddct-row-value {
        text-align: right;
    }
}

@media (min-width: 860px) {
    .ddct-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 0 16px;
    }

    .ddct-checkrow,
    .ddct-error,
    .ddct-buttons {
        grid-column: 1 / -1;
    }

    .ddct-buttons button,
    .ddct-tools button {
        flex: 0 1 auto;
    }
}

@media print {
    body * {
        visibility: hidden !important;
    }
    .ddct-calculator,
    .ddct-calculator * {
        visibility: visible !important;
    }
    .ddct-calculator {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    .ddct-form,
    .ddct-header,
    .ddct-tools,
    .ddct-output-empty {
        display: none !important;
    }
    .ddct-shell {
        box-shadow: none;
        border-radius: 0;
        padding: 0;
    }
}
