.af-cagr-calculator {
    --af-cagr-accent: #004F2D;
    --af-cagr-radius: 10px;
    --af-cagr-border: rgba(0, 0, 0, 0.1);
    --af-cagr-muted: rgba(0, 0, 0, 0.64);
    --af-cagr-soft: rgba(0, 79, 45, 0.07);
    background: #ffffff;
    border: 1px solid var(--af-cagr-border);
    border-radius: calc(var(--af-cagr-radius) + 6px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    margin: 2rem 0;
    max-width: 980px;
    padding: 2rem;
}

.af-cagr-title {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.af-cagr-intro {
    margin-bottom: 1.5rem;
}

.af-cagr-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 1.25rem;
}

.af-cagr-field {
    display: flex;
    flex-direction: column;
    font-weight: 600;
    gap: 0.4rem;
}

.af-cagr-field > span {
    align-items: flex-end;
    display: flex;
    line-height: 1.35;
    min-height: 2.7em;
}

.af-cagr-field input,
.af-cagr-interval-control select {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.16);
    border-radius: var(--af-cagr-radius);
    box-shadow: none;
    font-size: 1rem;
    min-height: 46px;
    padding: 0.65rem 0.8rem;
    width: 100%;
}

.af-cagr-field input:focus,
.af-cagr-interval-control select:focus {
    border-color: var(--af-cagr-accent);
    box-shadow: 0 0 0 3px rgba(0, 79, 45, 0.12);
    outline: none;
}

.af-cagr-input-wrap {
    align-items: center;
    display: flex;
    position: relative;
}

.af-cagr-input-wrap input {
    padding-left: 2rem;
}

.af-cagr-prefix {
    left: 0.8rem;
    opacity: 0.7;
    pointer-events: none;
    position: absolute;
    z-index: 1;
}

.af-cagr-button.button,
.af-cagr-button.button.primary {
    background-color: var(--af-cagr-accent);
    border-color: var(--af-cagr-accent);
    border-radius: var(--af-cagr-radius);
    color: #ffffff;
    font-weight: 700;
    min-height: 44px;
    padding: 0 1.25rem;
}

.af-cagr-button.button:hover,
.af-cagr-button.button.primary:hover {
    filter: brightness(1.08);
}

.af-cagr-result {
    background: var(--af-cagr-soft);
    border-left: 4px solid var(--af-cagr-accent);
    border-radius: var(--af-cagr-radius);
    margin-top: 1.25rem;
    padding: 1rem;
}

.af-cagr-result-label {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    opacity: 0.8;
}

.af-cagr-result-value {
    color: var(--af-cagr-accent);
    display: block;
    font-size: clamp(1.5rem, 3vw, 2.4rem);
    line-height: 1.1;
}

.af-cagr-error {
    color: #b00020;
    font-weight: 600;
    margin-top: 1rem;
}

.af-cagr-charts {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
    margin-top: 1.5rem;
}

.af-cagr-chart-card,
.af-cagr-table-section {
    border: 1px solid var(--af-cagr-border);
    border-radius: calc(var(--af-cagr-radius) + 2px);
    padding: 1.25rem;
}

.af-cagr-chart-card h3,
.af-cagr-table-section h3 {
    font-size: 1.1rem;
    margin: 0 0 1rem;
}

.af-cagr-line-chart,
.af-cagr-pie-chart {
    display: block;
    width: 100%;
}

.af-cagr-line-chart {
    height: 280px;
}

.af-cagr-pie-layout {
    align-items: center;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(150px, 1fr);
}

.af-cagr-pie-chart {
    height: 220px;
    max-width: 280px;
    margin: 0 auto;
}

.af-cagr-pie-legend {
    display: grid;
    gap: 0.55rem;
}

.af-cagr-legend-row {
    align-items: center;
    display: grid;
    gap: 0.55rem;
    grid-template-columns: 12px 1fr auto;
    font-size: 0.92rem;
}

.af-cagr-legend-color {
    border-radius: 2px;
    display: inline-block;
    height: 12px;
    width: 12px;
}

.af-cagr-legend-value {
    font-weight: 700;
}

.af-cagr-table-section {
    margin-top: 1.5rem;
}

.af-cagr-section-header {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.af-cagr-section-header h3 {
    margin-bottom: 0;
}

.af-cagr-interval-control {
    align-items: center;
    color: var(--af-cagr-muted);
    display: flex;
    font-size: 0.9rem;
    gap: 0.5rem;
    white-space: nowrap;
}

.af-cagr-interval-control select {
    min-height: 38px;
    padding: 0.35rem 0.65rem;
    width: auto;
}

.af-cagr-table-wrap {
    max-height: 420px;
    overflow: auto;
}

.af-cagr-growth-table {
    border-collapse: collapse;
    margin: 0;
    width: 100%;
}

.af-cagr-growth-table th,
.af-cagr-growth-table td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0.75rem;
    text-align: left;
}

.af-cagr-growth-table th {
    background: #ffffff;
    color: var(--af-cagr-muted);
    font-size: 0.85rem;
    position: sticky;
    text-transform: uppercase;
    top: 0;
    z-index: 1;
}

.af-cagr-growth-table td:last-child,
.af-cagr-growth-table th:last-child {
    text-align: right;
}

.af-cagr-formula,
.af-cagr-disclaimer {
    font-size: 0.9rem;
    margin-bottom: 0;
    opacity: 0.72;
}

.af-cagr-formula {
    margin-top: 1.25rem;
}

.af-cagr-disclaimer {
    margin-top: 0.75rem;
}

@media (max-width: 900px) {
    .af-cagr-charts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .af-cagr-calculator {
        padding: 1.25rem;
    }

    .af-cagr-field > span {
        min-height: 0;
    }

    .af-cagr-grid {
        grid-template-columns: 1fr;
    }

    .af-cagr-section-header {
        align-items: stretch;
        flex-direction: column;
    }

    .af-cagr-interval-control {
        align-items: stretch;
        flex-direction: column;
        white-space: normal;
    }

    .af-cagr-interval-control select {
        width: 100%;
    }
}
