:root {
    --bg-deep: #1a2418;
    --bg-forest: #2d3f2a;
    --wood-dark: #5c4033;
    --wood: #8b6914;
    --wood-light: #c4a35a;
    --cream: #f5f0e6;
    --cream-dark: #e8dfd0;
    --sage: #6b8f71;
    --sage-light: #a8c5a0;
    --text: #2a2f28;
    --text-muted: #5a6358;
    --white: #ffffff;
    --shadow: 0 18px 50px rgba(26, 36, 24, 0.18);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", system-ui, sans-serif;
    color: var(--text);
    background: linear-gradient(160deg, #e8e2d4 0%, #d4cfc0 40%, #c8d4c0 100%);
    line-height: 1.5;
}

.page-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 50% at 90% 10%, rgba(107, 143, 113, 0.25), transparent),
        radial-gradient(ellipse 60% 40% at 10% 90%, rgba(139, 105, 20, 0.15), transparent),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%238b6914' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    z-index: -1;
}

.header {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 1rem;
    text-align: center;
}

.header__badge {
    display: inline-block;
    padding: 0.35rem 1rem;
    border-radius: 999px;
    background: rgba(45, 63, 42, 0.12);
    color: var(--bg-forest);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.header__title {
    margin: 0;
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(2rem, 5vw, 2.8rem);
    color: var(--bg-deep);
    font-weight: 700;
}

.header__subtitle {
    max-width: 640px;
    margin: 0.75rem auto 0;
    color: var(--text-muted);
    font-size: 1.05rem;
}

.layout {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem 1.5rem 3rem;
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
        "controls summary"
        "table table";
}

.card {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(139, 105, 20, 0.15);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.card--controls { grid-area: controls; }
.card--summary { grid-area: summary; }
.card--table { grid-area: table; }

.card__head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.card__head h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--bg-forest);
}

.card__icon {
    font-size: 1.4rem;
}

.control {
    margin-bottom: 1.4rem;
}

.control__top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.control label {
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
}

.control__value {
    font-weight: 700;
    color: var(--wood-dark);
    font-size: 0.95rem;
    white-space: nowrap;
}

.control input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(90deg, var(--sage-light), var(--wood-light));
    border-radius: 999px;
    outline: none;
    cursor: pointer;
}

.control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--wood-dark);
    border: 3px solid var(--cream);
    box-shadow: 0 2px 8px rgba(92, 64, 51, 0.35);
    cursor: grab;
}

.control input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--wood-dark);
    border: 3px solid var(--cream);
    box-shadow: 0 2px 8px rgba(92, 64, 51, 0.35);
    cursor: grab;
}

.control__range-labels,
.control__hint {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.control__hint {
    justify-content: flex-end;
    font-weight: 500;
    color: var(--sage);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.9rem 1.25rem;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn--primary {
    background: linear-gradient(135deg, var(--bg-forest), var(--sage));
    color: var(--white);
    box-shadow: 0 8px 24px rgba(45, 63, 42, 0.3);
    margin-top: 0.5rem;
}

.btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(45, 63, 42, 0.35);
}

.btn--primary:active {
    transform: translateY(0);
}

.summary-hero {
    text-align: center;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    border-radius: 14px;
    background: linear-gradient(145deg, var(--bg-forest), #3d5538);
    color: var(--cream);
}

.summary-hero__label {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.85;
}

.summary-hero__amount {
    margin: 0.25rem 0 0;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    font-weight: 700;
    font-family: "Playfair Display", Georgia, serif;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

.summary-item {
    padding: 0.85rem;
    border-radius: 12px;
    background: var(--cream);
    border: 1px solid var(--cream-dark);
}

.summary-item__label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.summary-item strong {
    font-size: 1rem;
    color: var(--wood-dark);
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 64px;
    margin-top: 1.25rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--cream-dark);
}

.chart-bars__bar {
    flex: 1;
    min-width: 2px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(180deg, var(--wood-light), var(--sage));
    opacity: 0.75;
    transition: height 0.3s ease;
}

.table-wrap {
    overflow-x: auto;
    max-height: 420px;
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid var(--cream-dark);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

th {
    background: var(--bg-forest);
    color: var(--cream);
    padding: 0.75rem 0.6rem;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

th:first-child {
    text-align: center;
}

td {
    padding: 0.55rem 0.6rem;
    text-align: right;
    border-bottom: 1px solid var(--cream-dark);
}

td:first-child {
    text-align: center;
    color: var(--text-muted);
    font-weight: 500;
}

tbody tr:nth-child(even) {
    background: rgba(245, 240, 230, 0.5);
}

tbody tr:hover {
    background: rgba(168, 197, 160, 0.2);
}

.table-placeholder {
    text-align: center !important;
    color: var(--text-muted);
    padding: 2rem !important;
}

.footer {
    text-align: center;
    padding: 1rem 1.5rem 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

@media (max-width: 860px) {
    .layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "controls"
            "summary"
            "table";
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }
}
