/* Цвет ошибок — тем же механизмом, что и темы в legal.css: media-запрос + явный data-theme. */
:root { --kbzhu-danger: #ff3b30; }
@media (prefers-color-scheme: dark) { :root { --kbzhu-danger: #ff6b61; } }
[data-theme="light"] { --kbzhu-danger: #ff3b30; }
[data-theme="dark"] { --kbzhu-danger: #ff6b61; }
.kbzhu-calc { margin-block: 24px 32px; padding: 20px; border: 1px solid var(--color-border); border-radius: var(--radius-xl); background: var(--color-surface); }
.kbzhu-calc h2 { margin-top: 0; }
.kbzhu-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.kbzhu-col-name { width: 30%; }
.kbzhu-col-remove { width: 52px; }
.kbzhu-table th { font-size: 13px; font-weight: 600; color: var(--color-text-muted); text-align: left; padding: 0 6px 8px; }
.kbzhu-table td { padding: 4px 6px; vertical-align: bottom; }
.kbzhu-table label.kbzhu-cell-label { display: none; }
.kbzhu-calc input { width: 100%; min-height: 44px; box-sizing: border-box; padding: 8px 10px; font: inherit; font-size: 16px; color: var(--color-text); background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.kbzhu-calc input[aria-invalid="true"] { border-color: var(--kbzhu-danger); box-shadow: 0 0 0 1px var(--kbzhu-danger); }
.kbzhu-calc input[inputmode] { padding-inline: 6px; }
.kbzhu-calc button { min-height: 44px; min-width: 44px; font: inherit; cursor: pointer; border-radius: var(--radius-md); border: 1px solid var(--color-border); background: transparent; color: var(--color-text); }
.kbzhu-calc button:disabled { opacity: .4; cursor: not-allowed; }
.kbzhu-add { margin-top: 8px; padding: 8px 16px; }
.kbzhu-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(12em, 1fr)); gap: 12px 24px; margin-top: 20px; }
.kbzhu-totals label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.kbzhu-hint { font-size: 13px; color: var(--color-text-muted); margin: 6px 0 0; min-height: 1.2em; }
.kbzhu-error { color: var(--kbzhu-danger); font-size: 12px; }
.kbzhu-summary { margin: 12px 0 0; min-height: 1.2em; }
.kbzhu-calc .legal-action { margin-top: 20px; }
.kbzhu-result { margin-top: 24px; }
.kbzhu-result table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.kbzhu-result th, .kbzhu-result td { padding: 8px 6px; border-bottom: 1px solid var(--color-border); text-align: right; }
.kbzhu-result th:first-child, .kbzhu-result td:first-child { text-align: left; }
.kbzhu-result tbody tr.kbzhu-row-per100 td { font-weight: 700; }
@media (max-width: 640px) {
    .kbzhu-table thead { display: none; }
    .kbzhu-table { table-layout: auto; }
    .kbzhu-table colgroup { display: none; }
    .kbzhu-table tr { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--color-border); }
    .kbzhu-table td { padding: 0; }
    .kbzhu-table td.kbzhu-name { grid-column: 1 / 6; grid-row: 1; }
    .kbzhu-table td:last-child { grid-column: 6 / 7; grid-row: 1; align-self: end; }
    .kbzhu-table td:nth-child(2), .kbzhu-table td:nth-child(3) { grid-column: span 3; }
    .kbzhu-table td:nth-child(4), .kbzhu-table td:nth-child(5), .kbzhu-table td:nth-child(6) { grid-column: span 2; }
    .kbzhu-table td:last-child button { width: 100%; min-width: 0; }
    .kbzhu-table label.kbzhu-cell-label { display: block; font-size: 13px; color: var(--color-text-muted); margin-bottom: 4px; }
    .kbzhu-result { overflow-x: auto; }
}

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