:root {
    --bg: #f6f8fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --accent: #2563eb;
    --accent-soft: #eff6ff;
    --ok: #065f46;
    --ok-bg: #ecfdf5;
    --warn: #92400e;
    --warn-bg: #fffbeb;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #f8fbff 0%, #f6f8fb 100%);
    line-height: 1.6;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.hero {
    margin-bottom: 20px;

    & h1 {
        margin: 0 0 8px;
        font-size: clamp(24px, 4vw, 34px);
        line-height: 1.2;
    }

    & p {
        margin: 0;
        color: var(--muted);
    }
}

.layout {
    grid-template-columns: 360px 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 1em;

    & h2 {
        margin: 0 0 14px;
        font-size: 18px;
    }
}

.field {
    margin-bottom: 14px;

    & label {
        display: block;
        margin-bottom: 6px;
        font-size: 13px;
        font-weight: 700;
    }

    & .help {
        margin-top: 6px;
        color: var(--muted);
        font-size: 12px;
    }
}

select,
input[type="number"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    font-size: 14px;
    color: var(--text);

    &:focus {
        outline: 2px solid rgba(37, 99, 235, 0.15);
        border-color: rgba(37, 99, 235, 0.35);
    }
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 560px) {
    .row {
        grid-template-columns: 1fr;
    }
}

.buttons {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

button {
    appearance: none;
    border: 0;
    cursor: pointer;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 14px;
    transition: 0.15s ease;

    &:hover {
        transform: translateY(-1px);
    }
}

.btn-primary {
    flex: 1;
    color: #fff;
    background: var(--accent);
}

.btn-secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.summary-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

@media (max-width: 760px) {
    .kpis {
        grid-template-columns: 1fr;
    }
}

.kpi {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    background: #fff;

    & .label {
        color: var(--muted);
        font-size: 12px;
        margin-bottom: 6px;
    }

    & .value {
        font-size: 28px;
        font-weight: 800;
        line-height: 1.1;
    }

    & .sub {
        margin-top: 6px;
        color: var(--muted);
        font-size: 12px;
    }
}

.section-title {
    margin: 18px 0 10px;
    font-size: 15px;
    font-weight: 800;
}

.set-composition {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    font-size: 13px;
    font-weight: 700;
}

table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;

    & th,
    & td {
        padding: 12px 14px;
        border-bottom: 1px solid var(--line);
        text-align: left;
        vertical-align: top;
        font-size: 14px;
    }

    & th {
        background: #f9fafb;
        font-size: 12px;
        color: var(--muted);
    }

    & tr:last-child td {
        border-bottom: 0;
    }
}

.wysiwyg .bags-table {
    table-layout: auto;

    & tr th,
    & tr td {
        width: auto;
        writing-mode: horizontal-tb;
    }

    & th {
        white-space: nowrap;
    }

    & th:last-child,
    & td:last-child {
        min-width: 7em;
    }
}

.note-list,
.info-list {
    display: grid;
    gap: 10px;
}

.note,
.info {
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 14px;
}

.info {
    background: var(--ok-bg);
    color: var(--ok);
    border: 1px solid #bbf7d0;
}

.note {
    background: var(--warn-bg);
    color: var(--warn);
    border: 1px solid #fde68a;
}

.price-box {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    background: #fff;
}

.price-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);

    & .total {
        font-size: 30px;
        font-weight: 800;
    }
}

.small {
    font-size: 12px;
    color: var(--muted);
}

.link-btn,
.link-btn:link,
.link-btn:visited,
.link-btn:hover,
.link-btn:active,
.link-btn:focus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 14px;
    padding: 12px 16px;
    padding-bottom: 12px;
    border-radius: 12px;
    border-bottom: 0;
    text-decoration: none;
    font-weight: 800;
    line-height: 1.2;
    vertical-align: middle;
    background: var(--accent);
    color: #fff;
}

details {
    margin-top: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    background: #fff;
}

summary {
    cursor: pointer;
    font-weight: 700;
}

pre {
    margin: 12px 0 0;
    white-space: pre-wrap;
    word-break: break-word;
    background: #111827;
    color: #e5e7eb;
    padding: 14px;
    border-radius: 12px;
    font-size: 12px;
    overflow: auto;
}
