.hcf-calc-wrapper {
    --hcf-color-primary: #1e1e1e;
    --hcf-color-accent: #c4a24a;
    --hcf-color-accent-hover: #ad8d3f;
    --hcf-color-bg-white: #ffffff;
    --hcf-color-bg-cream: #f0e8d4;
    --hcf-color-text: #2e2e2e;
    --hcf-color-bg-neutral: #f5f5f5;
    --hcf-color-border: #d9cfb6;
    --hcf-color-muted: #666666;
    --hcf-color-error: #b3261e;
    --hcf-color-focus: #8e6f22;
    --hcf-shadow-soft: 0 18px 40px rgba(30, 30, 30, 0.08);
    --hcf-shadow-card: 0 10px 24px rgba(30, 30, 30, 0.06);
    --hcf-radius-lg: 24px;
    --hcf-radius-md: 16px;
    --hcf-radius-sm: 10px;
    --hcf-font-family: 'Montserrat', sans-serif;
    background: var(--hcf-color-bg-neutral);
    color: var(--hcf-color-text);
    font-family: var(--hcf-font-family);
    line-height: 1.5;
    width: 100%;
}

.hcf-calc-wrapper,
.hcf-calc-wrapper *,
.hcf-calc-wrapper *::before,
.hcf-calc-wrapper *::after {
    box-sizing: border-box;
}

.hcf-calc-wrapper * {
    font-family: inherit;
}

.hcf-calc-shell {
    width: min(100%, 1120px);
    margin: 0 auto;
    padding: 40px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, var(--hcf-color-bg-neutral) 100%);
    border: 1px solid rgba(30, 30, 30, 0.08);
    border-radius: var(--hcf-radius-lg);
    box-shadow: var(--hcf-shadow-soft);
}

.hcf-calc-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.hcf-calc-title {
    margin: 0;
    color: var(--hcf-color-primary);
    font-size: clamp(2rem, 3vw, 2.75rem);
    font-weight: 700;
    line-height: 1.1;
}

.hcf-calc-description {
    margin: 0;
    max-width: 680px;
    color: var(--hcf-color-muted);
    font-size: 1rem;
}

.hcf-calc-form {
    margin: 0;
}

.hcf-calc-fieldset {
    margin: 0;
    padding: 32px;
    background: var(--hcf-color-bg-white);
    border: 1px solid rgba(30, 30, 30, 0.08);
    border-radius: var(--hcf-radius-md);
    box-shadow: var(--hcf-shadow-card);
}

.hcf-calc-legend {
    padding: 0 12px;
    color: var(--hcf-color-primary);
    font-size: 1.125rem;
    font-weight: 700;
}

.hcf-calc-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.hcf-calc-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.hcf-calc-label {
    color: var(--hcf-color-text);
    font-size: 0.95rem;
    font-weight: 600;
}

.hcf-calc-input-group {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.hcf-calc-input,
.hcf-calc-select,
.hcf-calc-button {
    min-height: 52px;
    border-radius: var(--hcf-radius-sm);
}

.hcf-calc-input,
.hcf-calc-select {
    width: 100%;
    margin: 0;
    padding: 0 16px;
    border: 1px solid rgba(30, 30, 30, 0.14);
    background: var(--hcf-color-bg-white);
    color: var(--hcf-color-text);
    font-size: 1rem;
    font-weight: 400;
    transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.hcf-calc-input::placeholder {
    color: #777777;
}

.hcf-calc-select {
    flex: 0 0 160px;
    padding-right: 44px;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--hcf-color-primary) 50%), linear-gradient(135deg, var(--hcf-color-primary) 50%, transparent 50%);
    background-position: calc(100% - 22px) calc(50% - 3px), calc(100% - 16px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.hcf-calc-input:hover,
.hcf-calc-select:hover {
    border-color: rgba(30, 30, 30, 0.24);
}

.hcf-calc-input:focus,
.hcf-calc-select:focus {
    outline: none;
}

.hcf-calc-input:focus-visible,
.hcf-calc-select:focus-visible,
.hcf-calc-button:focus-visible,
.hcf-calc-table-toggle:focus-visible {
    outline: 3px solid rgba(142, 111, 34, 0.28);
    outline-offset: 2px;
    box-shadow: 0 0 0 1px var(--hcf-color-focus);
}

.hcf-calc-error {
    min-height: 1.25rem;
    color: var(--hcf-color-error);
    font-size: 0.85rem;
    font-weight: 600;
}

.hcf-calc-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 28px;
}

.hcf-calc-button {
    min-width: 220px;
    padding: 0 28px;
    border: 0;
    background: var(--hcf-color-accent);
    color: var(--hcf-color-primary);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
    box-shadow: 0 10px 24px rgba(196, 162, 74, 0.28);
}

.hcf-calc-button:hover {
    background: var(--hcf-color-accent-hover);
    transform: translateY(-1px);
}

.hcf-calc-button:active {
    transform: translateY(0);
}

.hcf-calc-output {
    display: grid;
    gap: 24px;
    margin-top: 32px;
    scroll-margin-top: 24px;
}

.hcf-calc-results {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.hcf-calc-result-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px;
    background: var(--hcf-color-bg-cream);
    border: 1px solid var(--hcf-color-border);
    border-radius: var(--hcf-radius-md);
    box-shadow: var(--hcf-shadow-card);
}

.hcf-calc-result-card--featured {
    background: linear-gradient(135deg, #f4ecd9 0%, #e8d8ae 100%);
}

.hcf-calc-result-label {
    color: var(--hcf-color-text);
    font-size: 0.95rem;
    font-weight: 600;
}

.hcf-calc-result-value {
    color: var(--hcf-color-primary);
    font-size: clamp(1.75rem, 2.5vw, 2.3rem);
    font-weight: 700;
    line-height: 1.1;
}

.hcf-calc-chart-container,
.hcf-calc-table-container {
    padding: 24px;
    background: var(--hcf-color-bg-white);
    border: 1px solid rgba(30, 30, 30, 0.08);
    border-radius: var(--hcf-radius-md);
    box-shadow: var(--hcf-shadow-card);
}

.hcf-calc-chart-container {
    position: relative;
    min-height: 360px;
}

.hcf-calc-chart-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-height: 312px;
}

.hcf-calc-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.hcf-calc-table-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.hcf-calc-table-toggle {
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid rgba(30, 30, 30, 0.14);
    border-radius: var(--hcf-radius-sm);
    background: var(--hcf-color-bg-cream);
    color: var(--hcf-color-primary);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.hcf-calc-table-toggle:hover {
    background: #e8dcc0;
    border-color: rgba(30, 30, 30, 0.24);
    transform: translateY(-1px);
}

.hcf-calc-table-toggle:active {
    transform: translateY(0);
}

.hcf-calc-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    color: var(--hcf-color-text);
    background: var(--hcf-color-bg-white);
}

.hcf-calc-table-caption {
    margin-bottom: 16px;
    color: var(--hcf-color-primary);
    font-size: 1rem;
    font-weight: 700;
    text-align: left;
    caption-side: top;
}

.hcf-calc-table thead {
    background: var(--hcf-color-primary);
    color: var(--hcf-color-bg-white);
}

.hcf-calc-table th,
.hcf-calc-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(30, 30, 30, 0.08);
    text-align: left;
    vertical-align: middle;
}

.hcf-calc-table th {
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
}

.hcf-calc-table td {
    font-size: 0.95rem;
    font-weight: 400;
}

.hcf-calc-table tbody tr:nth-child(odd) {
    background: var(--hcf-color-bg-neutral);
}

.hcf-calc-table tbody tr:nth-child(even) {
    background: var(--hcf-color-bg-white);
}

.hcf-calc-table tbody tr:hover {
    background: #ece3cc;
}

@media (max-width: 1024px) {
    .hcf-calc-shell {
        padding: 32px 24px;
    }

    .hcf-calc-fieldset,
    .hcf-calc-chart-container,
    .hcf-calc-table-container {
        padding: 24px;
    }

    .hcf-calc-fields {
        gap: 20px;
    }

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

@media (max-width: 767px) {
    .hcf-calc-shell {
        padding: 24px 16px;
        border-radius: 20px;
    }

    .hcf-calc-header {
        margin-bottom: 24px;
    }

    .hcf-calc-fieldset,
    .hcf-calc-chart-container,
    .hcf-calc-table-container {
        padding: 20px;
    }

    .hcf-calc-fields,
    .hcf-calc-results {
        grid-template-columns: minmax(0, 1fr);
    }

    .hcf-calc-input-group {
        flex-direction: column;
    }

    .hcf-calc-select {
        flex-basis: auto;
    }

    .hcf-calc-actions {
        justify-content: stretch;
    }

    .hcf-calc-button {
        width: 100%;
        min-width: 0;
    }

    .hcf-calc-table-controls {
        justify-content: stretch;
    }

    .hcf-calc-table-toggle {
        width: 100%;
    }

    .hcf-calc-chart-container {
        min-height: 300px;
    }

    .hcf-calc-chart-container canvas {
        min-height: 260px;
    }

    .hcf-calc-table th,
    .hcf-calc-table td {
        padding: 12px 14px;
        font-size: 0.9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hcf-calc-wrapper *,
    .hcf-calc-wrapper *::before,
    .hcf-calc-wrapper *::after {
        scroll-behavior: auto;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
