[hidden] { display: none !important; }

:root {
    --accent:        #812b00;
    --accent-dark:   #632100;
    --accent-soft:   #f7e5d9;

    --text:          #1a1d23;
    --muted:         #5c6470;
    --border:        #e4e7ec;
    --border-strong: #cfd4dc;
    --surface:       #ffffff;
    --bg-soft:       #f6f7f9;

    --danger:        #c0262d;
    --danger-soft:   #fdeeee;
    --success:       #187a43;
    --success-soft:  #e7f6ed;

    --radius:        8px;
    --radius-lg:     12px;
    --shadow:        0 1px 2px rgba(16, 24, 40, .05), 0 2px 6px rgba(16, 24, 40, .06);
    --focus-ring:    0 0 0 3px rgba(129, 43, 0, .25);

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    background: var(--surface);
}

h1, h2, h3 { line-height: 1.2; }

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

:focus-visible { outline: 3px solid rgba(129, 43, 0, .45); outline-offset: 2px; }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.muted { color: var(--muted); }

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 100;
    padding: 8px 14px;
    border-radius: var(--radius);
    background: var(--text);
    color: #fff;
}
.skip-link:focus { top: 12px; color: #fff; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}

.btn-primary       { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }

.btn-ghost         { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover   { background: var(--bg-soft); color: var(--text); }

.btn:disabled,
.btn:disabled:hover { background: var(--bg-soft); color: var(--muted); border-color: var(--border-strong); cursor: not-allowed; }

.btn-lg    { height: 48px; padding: 0 22px; font-size: 1rem; }
.btn-block { width: 100%; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--border);
}

.header-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 64px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}
.brand:hover { color: var(--text); }

.brand-mark {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--accent), #b8581f);
}
.brand-mark::after {
    content: "";
    position: absolute;
    inset: 9px;
    border-radius: 2px;
    background: #fff;
}

.main-nav {
    display: flex;
    gap: 4px;
}
.main-nav a {
    padding: 8px 10px;
    border-radius: var(--radius);
    color: var(--muted);
    font-weight: 600;
    font-size: .95rem;
    text-decoration: none;
    white-space: nowrap;
}
.main-nav a:hover      { background: var(--bg-soft); color: var(--text); }
.main-nav a.is-current { background: var(--accent-soft); color: var(--accent); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}
.header-actions form { margin: 0; }

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: .95rem;
    white-space: nowrap;
}
.user-name {
    display: inline-block;
    max-width: 14ch;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}
.role-tag {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.site-main { flex: 1; }

.page       { padding-top: 32px; padding-bottom: 64px; }
.narrow     { max-width: 640px; }
.page-title { margin: 0 0 20px; font-size: 1.75rem; letter-spacing: -.01em; }

.card {
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.failure-detail {
    margin: 16px 0 0;
    padding: 14px;
    overflow: auto;
    border-radius: var(--radius);
    background: var(--text);
    color: #f6f7f9;
    font-size: .85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.site-footer {
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: .9rem;
}
.footer-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 24px;
    padding: 24px 20px;
}
.footer-bar strong { color: var(--text); }

.flash-stack {
    display: grid;
    gap: 10px;
    padding-top: 20px;
}
.flash {
    padding: 12px 16px;
    border: 1px solid;
    border-radius: var(--radius);
    font-size: .95rem;
}
.flash-success { background: var(--success-soft); border-color: #bfe5cd; color: #0f5530; }
.flash-error   { background: var(--danger-soft);  border-color: #f3c4c6; color: #8e1b21; }
.flash-info    { background: #f2f4f7;             border-color: #d8dde5; color: #3b4452; }

.form-card {
    max-width: 440px;
    margin: 48px auto;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.form-card h1   { margin: 0 0 4px; font-size: 1.5rem; }
.form-card .lead { margin: 0 0 24px; color: var(--muted); }
.form-alert      { margin-bottom: 20px; }

.field { margin-bottom: 18px; }
.field label {
    display: block;
    margin-bottom: 6px;
    font-size: .9rem;
    font-weight: 600;
}
.field input,
.field select,
.field textarea,
.range input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.range input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.field input:disabled,
.field select:disabled { background: var(--bg-soft); }
.field textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; }
.field.has-error input,
.field.has-error select,
.field.has-error textarea     { border-color: var(--danger); }
.field.has-error input:focus { box-shadow: 0 0 0 3px rgba(192, 38, 45, .18); }

.field-error {
    margin-top: 6px;
    color: var(--danger);
    font-size: .85rem;
}
.field-error:empty { display: none; }

.field-hint {
    margin-top: 6px;
    color: var(--muted);
    font-size: .85rem;
}

.form-foot {
    margin: 20px 0 0;
    text-align: center;
    color: var(--muted);
    font-size: .95rem;
}

.hero {
    background: linear-gradient(180deg, var(--accent-soft) 0%, var(--surface) 100%);
    border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 720px; padding: 80px 0 72px; }

.eyebrow {
    display: inline-block;
    margin-bottom: 14px;
    color: var(--accent);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.hero h1 {
    margin: 0 0 18px;
    font-size: clamp(2rem, 1.2rem + 3vw, 3.2rem);
    line-height: 1.1;
    letter-spacing: -.02em;
}
.hero p {
    max-width: 560px;
    margin: 0 0 30px;
    color: var(--muted);
    font-size: 1.15rem;
}

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 56px 0 8px;
}
.feature {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.feature-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
}
.feature-icon svg { width: 22px; height: 22px; }
.feature h2 { margin: 0 0 8px; font-size: 1.05rem; }
.feature p  { margin: 0; color: var(--muted); }

.checks {
    margin: 32px 0 72px;
    padding: 28px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.checks h2  { margin: 0 0 6px; font-size: 1.15rem; }
.checks > p { margin: 0 0 18px; color: var(--muted); }

.check-list {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.check-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-weight: 500;
}
.check-list li::before {
    content: "";
    flex: none;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    border-radius: 50%;
    background: var(--success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.6 6.3l2.2 2.2 4.6-4.9' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 13px no-repeat;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.btn-sm { height: 32px; padding: 0 12px; font-size: .85rem; }

.page-head { margin-bottom: 24px; }
.page-head .page-title { margin-bottom: 6px; }
.page-lead { max-width: 72ch; margin: 0; color: var(--muted); }
.page-head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.back-link { display: inline-block; margin-bottom: 14px; font-size: .9rem; text-decoration: none; }

.results-count { margin: 0; color: var(--muted); font-size: .9rem; }

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
}
.empty-state p { margin: 0 0 12px; }

.stock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}
.stock::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.stock-in  { background: var(--success-soft); color: var(--success); }
.stock-low { background: #fff3dd; color: #8a5300; }
.stock-out { background: var(--bg-soft); color: var(--muted); }

.catalogue {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    align-items: start;
    gap: 28px;
}

.filters {
    display: grid;
    gap: 18px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.filters .field { margin: 0; }

.filter-group { display: grid; gap: 2px; margin: 0; padding: 0; border: 0; min-width: 0; }
.filter-group legend { margin-bottom: 8px; padding: 0; font-size: .9rem; font-weight: 600; }

.check { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: .95rem; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.check-count { margin-left: auto; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }

.range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }

.results { display: grid; gap: 28px; min-width: 0; }

.cat-section { display: grid; gap: 12px; }
.cat-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.15rem; }
.cat-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
}
.cat-icon .icon { width: 22px; height: 22px; }
.cat-count {
    padding: 1px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-soft);
    color: var(--muted);
    font-size: .8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.parts { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.part {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.part-picture {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    overflow: hidden;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
}
.part-picture .icon { width: 30px; height: 30px; }
.part-picture img, .cell-picture img { width: 100%; height: 100%; object-fit: cover; }
.part-name  { margin: 0; font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; }
.part-brand { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.part-specs { margin: 4px 0 0; font-size: .85rem; }
.part-side  { display: grid; justify-items: end; gap: 6px; text-align: right; }
.part-price { margin: 0; font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.filter-bar .field { flex: 0 1 190px; margin: 0; }
.filter-bar .field-grow { flex: 1 1 220px; }
.filter-bar .btn { height: 44px; }

#component-list { display: grid; gap: 12px; }

.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data-table th {
    padding: 10px 14px;
    text-align: left;
    white-space: nowrap;
    color: var(--muted);
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.data-table td { padding: 10px 14px; vertical-align: middle; border-bottom: 1px solid var(--border); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table tr.is-inactive td { color: var(--muted); }
.data-table tr.is-inactive .cell-picture { opacity: .45; }

.cell-part { display: flex; align-items: center; gap: 12px; min-width: 230px; }
.cell-part strong { display: block; font-weight: 600; }
.cell-part .muted { font-size: .85rem; }
.cell-picture {
    display: grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    overflow: hidden;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
}
.cell-picture .icon { width: 22px; height: 22px; }

.stock-num.stock-low { color: #8a5300; font-weight: 700; }
.stock-num.stock-out { color: var(--muted); font-weight: 700; }

.status { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.status-on  { background: var(--success-soft); color: var(--success); }
.status-off { background: var(--bg-soft); color: var(--muted); border: 1px solid var(--border); }

.actions { text-align: right; white-space: nowrap; }
.actions form { display: inline; margin: 0 0 0 6px; }

.form-panel {
    max-width: 780px;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.btn-quiet-danger       { color: var(--danger); }
.btn-quiet-danger:hover { background: var(--danger-soft); border-color: #f3c4c6; color: var(--danger); }

.cell-rule { min-width: 220px; }
.cell-rule strong { display: block; font-weight: 600; }
.cell-rule .muted { display: block; font-size: .85rem; }
.status-broken { margin-left: 4px; background: var(--danger-soft); color: var(--danger); }

.section-title { margin: 0 0 6px; font-size: 1.3rem; }
.tester { margin-top: 44px; }
.tester > .page-lead { margin-bottom: 20px; }
.tester-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}
.tester-form { max-width: none; padding: 22px; }
.tester-slot { margin-bottom: 12px; }
.tester-pick { display: flex; gap: 8px; }
.tester-pick select:first-child { flex: 1 1 auto; min-width: 0; }
.tester-pick .tester-count      { flex: 0 0 76px; }
.tester-results {
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.tester-results[aria-busy="true"] { opacity: .6; }
.tester-empty { margin: 0; color: var(--muted); }

.verdict-summary {
    display: grid;
    gap: 4px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: var(--radius);
}
.verdict-summary.is-valid   { background: var(--success-soft); color: #0f5530; }
.verdict-summary.is-invalid { background: var(--bg-soft); border: 1px solid var(--border); }
.verdict-totals { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0 0 14px; }
.verdict-totals div { display: grid; }
.verdict-totals dt  { color: var(--muted); font-size: .8rem; }
.verdict-totals dd  { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.verdicts { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.verdict {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.verdict-badge {
    flex: none;
    min-width: 66px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    text-align: center;
}
.verdict-pass .verdict-badge  { background: var(--success-soft); color: var(--success); }
.verdict-fail                 { background: var(--danger-soft); border-color: #f3c4c6; }
.verdict-fail .verdict-badge  { background: var(--danger); color: #fff; }
.verdict-skip .verdict-badge  { background: var(--bg-soft); color: var(--muted); border: 1px solid var(--border); }
.verdict-error                { border-color: var(--danger); }
.verdict-error .verdict-badge { background: var(--surface); color: var(--danger); border: 1px solid var(--danger); }
.verdict-text    { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.verdict-name    { font-weight: 600; }
.verdict-message { color: #8e1b21; }
.verdict-detail  { color: var(--muted); font-size: .88rem; }

.form-errors { margin: 0; padding-left: 18px; color: var(--danger); }

.confirm-dialog {
    width: min(440px, calc(100vw - 32px));
    padding: 24px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(16, 24, 40, .25);
}
.confirm-dialog::backdrop { background: rgba(26, 29, 35, .45); }
.confirm-title   { margin: 0 0 8px; font-size: 1.15rem; }
.confirm-text    { margin: 0 0 20px; color: var(--muted); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 1199px) {
    .header-bar {
        flex-wrap: wrap;
        row-gap: 2px;
        padding-top: 10px;
        padding-bottom: 8px;
    }
    .main-nav {
        order: 3;
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (min-width: 1200px) {
    .filters        { position: sticky; top: 88px; }
    .tester-results { position: sticky; top: 88px; }
}

@media (max-width: 900px) {
    .catalogue   { grid-template-columns: minmax(0, 1fr); }
    .tester-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
    .features { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .container  { padding-left: 16px; padding-right: 16px; }
    .footer-bar { padding: 24px 16px; }
    .brand      { font-size: 1rem; }
    .user-chip  { display: none; }
    .header-actions .btn { height: 36px; padding: 0 12px; font-size: .9rem; }
    .main-nav a { padding: 6px 10px; font-size: .9rem; }

    .visitor-actions      { width: 100%; }
    .visitor-actions .btn { flex: 1; }

    .hero-inner { padding: 52px 0 44px; }
    .form-card  { margin: 24px auto; padding: 24px; }
    .checks     { padding: 22px; }

    .part         { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; padding: 12px 14px; }
    .part-picture { width: 44px; height: 44px; }
    .part-side    { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; text-align: left; }
    .form-panel   { padding: 20px; }
    .form-grid    { grid-template-columns: minmax(0, 1fr); }
    .filter-bar .field { flex: 1 1 100%; }
}

@media (max-width: 400px) {
    .brand { font-size: .95rem; }
}

.notice { margin-bottom: 16px; }
.notice .form-errors { padding-left: 18px; }
.notice-text { margin: 0; }
.notice-link { display: inline-block; margin-top: 6px; font-weight: 600; color: inherit; }
.notice-link + .notice-link { margin-left: 18px; }

.configurator-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
    gap: 24px;
    align-items: start;
}
.slots { display: grid; gap: 10px; }

.slot-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.slot-head {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    list-style: none;
}
.slot-head::-webkit-details-marker { display: none; }
.slot-head::after { content: "▾"; grid-column: 3; justify-self: end; grid-row: 1; color: var(--muted); }
.slot-box[open] > .slot-head::after { content: "▴"; }
.slot-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
}
.slot-icon .icon { width: 22px; height: 22px; }
.slot-title { display: grid; }
.slot-name  { font-weight: 700; }
.slot-tag   { color: var(--muted); font-size: .78rem; }
.slot-choice {
    grid-column: 3;
    grid-row: 1;
    padding-right: 24px;
    overflow-wrap: anywhere;
    text-align: right;
    font-size: .92rem;
}
.slot.is-filled .slot-icon { background: var(--accent); color: #fff; }
.slot.is-locked .slot-box   { background: var(--bg-soft); }
.slot.is-locked .slot-head  { color: var(--muted); }
.slot.is-locked .slot-icon  { background: var(--border); color: var(--muted); }
.slot.is-clash .slot-box     { border-color: var(--danger); }
.slot.is-clash .slot-choice  { color: var(--danger); font-weight: 600; }

.slot-body  { padding: 0 18px 16px; }
.slot-empty { margin: 0; }
.options    { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.option-label {
    display: grid;
    grid-template-columns: auto 40px minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}
.option-label:hover { border-color: var(--border-strong); }
.option-label input { width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--accent); }
.option-picture {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    overflow: hidden;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
}
.option-picture .icon { width: 24px; height: 24px; }
.option-picture img { width: 100%; height: 100%; object-fit: cover; }
.option-picture.is-empty { background: none; border: 1.5px dashed var(--border-strong); }
.option-main   { display: grid; gap: 1px; min-width: 0; }
.option-name   { font-weight: 600; overflow-wrap: anywhere; }
.option-meta   { color: var(--muted); font-size: .84rem; overflow-wrap: anywhere; }
.option-meta > span { display: inline-block; max-width: 100%; }
.option-reason { color: var(--muted); font-size: .84rem; font-style: italic; }
.option-price  { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.option.is-chosen .option-label { border-color: var(--accent); background: var(--accent-soft); }
.option.is-chosen .option-picture { background: var(--surface); }

.option.is-unfit .option-label { background: var(--bg-soft); cursor: not-allowed; }
.option.is-unfit .option-name,
.option.is-unfit .option-meta,
.option.is-unfit .option-price { color: #9aa1ab; }
.option.is-unfit .option-picture { background: var(--border); color: #9aa1ab; }
.option.is-clash .option-label  { border-color: var(--danger); background: var(--danger-soft); }
.option.is-clash .option-reason { color: #8e1b21; font-style: normal; }
.option.is-clash .option-picture { background: var(--surface); }

.slot-quantity { max-width: 460px; margin: 12px 0 0; }

.build-summary {
    display: grid;
    gap: 16px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.summary-title  { margin: 0; font-size: 1.15rem; }
.summary-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0; }
.summary-totals div { display: grid; }
.summary-totals dt  { color: var(--muted); font-size: .8rem; }
.summary-totals dd  { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary-verdicts[aria-busy="true"] { opacity: .6; }
.summary-save .field { margin-bottom: 12px; }
.summary-save .form-actions { margin-top: 0; }

@media (min-width: 1200px) {
    .build-summary { position: sticky; top: 88px; max-height: calc(100vh - 104px); overflow-y: auto; }
}

@media (max-width: 900px) {
    .configurator-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
    .slot-head   { grid-template-columns: auto minmax(0, 1fr); padding: 12px 14px; }
    .slot-choice { grid-column: 1 / -1; grid-row: 2; padding-right: 0; text-align: left; }
    .slot-head::after { grid-column: 2; }
    .slot-body   { padding: 0 14px 14px; }
    .option-label { grid-template-columns: auto 40px minmax(0, 1fr); }
    .option-price { grid-column: 3; }
    .summary-totals { grid-template-columns: minmax(0, 1fr); }
}

.cell-build { min-width: 200px; }
.cell-build a { color: var(--text); text-decoration: none; }
.cell-build a:hover { color: var(--accent); }
.cell-build strong { font-weight: 600; }
.cell-last-order { white-space: nowrap; }
.cell-last-order a { margin-right: 6px; color: var(--text); font-weight: 600; text-decoration: none; }
.cell-last-order a:hover { color: var(--accent); }

.rename { display: inline-block; position: relative; }
.rename > summary { list-style: none; }
.rename > summary::-webkit-details-marker { display: none; }
.rename .rename-form {
    position: absolute;
    right: 0;
    z-index: 5;
    display: grid;
    gap: 8px;
    width: 280px;
    margin-top: 6px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.rename-form .field { margin: 0; }

@media (max-width: 760px) {
    .rename .rename-form { position: static; width: auto; margin-top: 8px; }
}

.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--border); }
.tabs a {
    margin-bottom: -1px;
    padding: 8px 14px;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
}
.tabs a:hover { color: var(--text); }
.tabs a.is-current { border-bottom-color: var(--accent); color: var(--accent); }

.status-pending   { background: #fff3dd; color: #8a5300; }
.status-approved  { background: var(--success-soft); color: var(--success); }
.status-rejected  { background: var(--danger-soft); color: var(--danger); }
.status-cancelled { background: var(--bg-soft); color: var(--muted); border: 1px solid var(--border); }

.order-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.order-title .status { font-size: .85rem; letter-spacing: 0; }

.order-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 24px;
    margin: 0 0 20px;
}
.order-facts div { display: grid; align-content: start; min-width: 0; }
.order-facts dt  { color: var(--muted); font-size: .8rem; }
.order-facts dd  { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.order-facts dd .muted { display: block; font-weight: 400; font-size: .88rem; }

.remark {
    margin: 0 0 20px;
    padding: 14px 16px;
    background: #f2f4f7;
    border: 1px solid #d8dde5;
    border-left: 4px solid #8a93a3;
    border-radius: var(--radius);
}
.remark p { margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.remark p.muted { white-space: normal; font-size: .9rem; }

.order-lines tfoot th,
.order-lines tfoot td { padding: 12px 14px; border-top: 1px solid var(--border-strong); font-size: 1rem; font-weight: 700; }
.order-lines tfoot th { text-align: right; color: var(--text); background: none; text-transform: none; letter-spacing: 0; }
.order-lines tr.is-short td { background: var(--danger-soft); }
.short-note { color: var(--danger); font-weight: 600; white-space: nowrap; }
.table-note { margin: 10px 0 0; font-size: .88rem; }

.order-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 24px; }
.order-actions form { margin: 0; }

.cell-order a { color: var(--text); text-decoration: none; }
.cell-order a:hover { color: var(--accent); }
.cell-customer .muted { display: block; font-size: .8rem; }
#order-list tr.has-remark td,
#request-list tr.has-remark td { border-bottom: 0; }
#order-list .remark-row td,
#request-list .remark-row td { padding-top: 0; color: var(--muted); font-size: .88rem; white-space: pre-line; overflow-wrap: anywhere; }

.decisions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 20px; margin-top: 28px; }
.decision  { max-width: none; }
.decision .section-title { margin-bottom: 4px; }
.decision > p { margin: 0 0 14px; }
.decision form { margin: 0; }
.decision-block { padding: 10px 12px; background: var(--danger-soft); border-radius: var(--radius); color: #8e1b21; }

.nowrap { white-space: nowrap; }
.line-extra-label { display: none; }

@media (max-width: 900px) {
    .decisions { grid-template-columns: minmax(0, 1fr); }
}

.status-new      { background: #fff3dd; color: #8a5300; }
.status-answered { background: var(--success-soft); color: var(--success); }
.status-closed   { background: var(--bg-soft); color: var(--muted); border: 1px solid var(--border); }

.consult {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    margin-top: 32px;
    padding: 18px 22px;
    background: var(--accent-soft);
    border: 1px solid #ecd2c1;
    border-radius: var(--radius-lg);
}
.consult-text { display: grid; gap: 2px; flex: 1 1 280px; min-width: 0; }
.consult-text strong { font-size: 1.05rem; }
.consult-text span { color: var(--muted); font-size: .92rem; }
.consult .btn { flex: 0 0 auto; }

.consult-form .field select { max-width: 100%; }
.consult-call { margin: 14px 0 0; font-size: .92rem; }

.request-list { display: grid; gap: 16px; }
.request-card {
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    min-width: 0;
}
.request-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.request-ref { font-size: 1.05rem; }
.request-when { margin-left: auto; font-size: .88rem; }
.request-about { margin: 8px 0 0; font-size: .92rem; overflow-wrap: anywhere; }
.request-text { margin: 12px 0 0; padding: 12px 14px; background: var(--bg-soft); border-radius: var(--radius); }
.request-text p { margin: 4px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.request-label { color: var(--muted); font-size: .8rem; font-weight: 600; }
.request-reply { background: var(--success-soft); }
.request-message { margin: 0 0 24px; }
.request-waiting { margin: 12px 0 0; font-size: .92rem; }
.request-actions { margin: 12px 0 0; text-align: right; }

.figures {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 0 0 28px;
}
.figure {
    display: grid;
    gap: 2px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
    min-width: 0;
}
.figure-link:hover { border-color: var(--accent); color: var(--text); }
.figure-number { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.figure-label  { color: var(--muted); font-size: .9rem; }

.dashboard-panels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.panel {
    min-width: 0;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.panel .section-title { margin-bottom: 12px; font-size: 1.1rem; }
.panel > p { margin: 0; }

.consistency { margin-top: 20px; }
.consistency-ok  { color: var(--success); font-weight: 600; }
.consistency-bad { color: var(--danger); font-weight: 600; }
.consistency-fault { border-color: #f3c4c6; background: var(--danger-soft); }
.consistency-fault .table-wrap { margin-top: 12px; background: var(--surface); }

@media (max-width: 900px) {
    .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .order-lines, .order-lines tbody, .order-lines tfoot { display: block; }
    .order-lines thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .order-lines tbody tr {
        display: grid;
        grid-template-columns: auto auto minmax(0, 1fr) auto;
        align-items: baseline;
        gap: 6px 10px;
        padding: 12px 14px;
        border-bottom: 1px solid var(--border);
    }
    .order-lines tbody tr:last-child { border-bottom: 0; }
    .order-lines tbody td { display: block; padding: 0; border: 0; text-align: left; }
    .order-lines .line-part   { grid-column: 1 / -1; }
    .order-lines .line-part .cell-part { min-width: 0; }
    .order-lines .line-qty    { grid-column: 1; }
    .order-lines .line-unit   { grid-column: 2; color: var(--muted); }
    .order-lines .line-unit::after { content: " each"; }
    .order-lines .line-amount { grid-column: 4; font-weight: 700; }
    .order-lines .line-extra  { grid-column: 1 / -1; }
    .line-extra-label { display: inline; color: var(--muted); }
    .order-lines tfoot tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        padding: 12px 14px;
        border-top: 1px solid var(--border-strong);
    }
    .order-lines tfoot th, .order-lines tfoot td { display: block; padding: 0; border: 0; }
    .order-lines tfoot th { text-align: left; }
    .order-lines tfoot td:empty { display: none; }
}
