:root {
    --ink: #0f172a;
    --muted: #64748b;
    --line: #5b2cff;
    --soft: rgba(91, 44, 255, .18);
    --bg: #ffffff;
    --card: #ffffff;
    --shadow: 0 14px 30px rgba(0, 0, 0, .10);
    --radius: 18px;

    --danger: #b10000;
    --green: #16a34a;
    --yellow: #fde047;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans";
    background: var(--bg);
    color: var(--ink);
}

.page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 22px;
}

.card {
    width: min(1120px, 100%);
    border: 3px solid rgba(91, 44, 255, .55);
    border-radius: 22px;
    background: var(--card);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.head {
    padding: 18px 18px 12px;
    border-bottom: 1px solid var(--gray-200);
    text-align: center;
}

.head-title {
    font-weight: 900;
    letter-spacing: .3px;
}

.head-sub {
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
}

.controls {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr auto;
    gap: 14px;
    padding: 16px 18px 10px;
}

.panel {
    border: 2px solid rgba(91, 44, 255, .55);
    border-radius: var(--radius);
    padding: 12px;
    background: #fff;
}

.panel-title {
    text-align: center;
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 10px;
}

.toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.toggle-btn {
    border: 2px solid rgba(91, 44, 255, .55);
    background: var(--yellow);
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 900;
    cursor: pointer;
}

.toggle-btn.is-active {
    outline: 3px solid var(--soft);
}

.field {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid rgba(91, 44, 255, .55);
    border-radius: 12px;
    padding: 10px 12px;
}

.prefix {
    font-weight: 900;
}

.field input,
.field select {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 15px;
    font-weight: 800;
}

.hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

.action {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 10px;
}

.btn {
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: var(--danger);
    color: #fff;
    font-weight: 900;
    letter-spacing: .3px;
    cursor: pointer;
    box-shadow: 0 10px 18px rgba(177, 0, 0, .22);
}

.btn:active {
    transform: translateY(1px);
}

.msg {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.result {
    padding: 14px 18px 18px;
}

.result-top {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.badge {
    background: #0f172a;
    color: #fff;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 900;
}

.badge-2 {
    background: var(--line);
}

.kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.kpi {
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    padding: 12px;
    background: #fff;
}

.kpi-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 800;
}

.kpi-value {
    margin-top: 6px;
    font-size: 18px;
    font-weight: 900;
}

.kpi-green {
    color: var(--green);
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--gray-200);
    border-radius: 14px;
}

.tbl {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.tbl th,
.tbl td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-200);
    text-align: left;
    font-weight: 800;
}

.tbl th {
    background: var(--gray-100);
    font-size: 12px;
    font-weight: 900;
}

.tbl tr:last-child td {
    border-bottom: 0;
}

.note {
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

.bar {
    margin-top: 14px;
    background: #22c55e;
    color: #052e16;
    border-radius: 16px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.bar-label {
    font-weight: 900;
    letter-spacing: .3px;
}

.bar-value {
    font-weight: 900;
    font-size: 22px;
}

@media (max-width: 980px) {
    .controls {
        grid-template-columns: 1fr;
    }

    .kpis {
        grid-template-columns: 1fr 1fr;
    }

    .btn {
        width: 100%;
    }
}