:root {
    --bg: #0f1419;
    --surface: #1a2332;
    --border: #2d3a4f;
    --text: #e7edf5;
    --muted: #8b9cb3;
    --accent: #3d8fd1;
    --accent-hover: #5aa3e0;
    --danger: #e05555;
    --ok: #3dad6c;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1rem 0;
    flex-shrink: 0;
}

.sidebar .brand {
    padding: 0 1rem 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

.sidebar nav a {
    display: block;
    padding: 0.55rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.92rem;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: rgba(61, 143, 209, 0.15);
    text-decoration: none;
}

.sidebar .role {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.main {
    flex: 1;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
}

h1 {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0 0 1rem;
}

h2 {
    font-size: 1.1rem;
    margin: 1.25rem 0 0.5rem;
}

.card > h2:first-child {
    margin-top: 0;
}

.card > p:last-child {
    margin-bottom: 0;
}

.btn {
    display: inline-block;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 0.9rem;
}

.btn:hover {
    border-color: var(--accent);
}

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

.btn-primary:hover {
    background: var(--accent-hover);
}

.badge {
    display: inline-block;
    min-width: 1.35em;
    padding: 0.12em 0.45em;
    margin-left: 0.35rem;
    font-size: 0.8em;
    font-weight: 600;
    line-height: 1.25;
    vertical-align: middle;
    text-align: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.28);
    color: inherit;
}

.btn-primary .badge {
    color: #fff;
}

.payment-badge {
    display: inline-block;
    padding: 0.2em 0.55em;
    font-size: 0.82em;
    font-weight: 600;
    line-height: 1.25;
    border-radius: 4px;
    white-space: nowrap;
}

.payment-badge--unpaid {
    background: rgba(139, 156, 179, 0.35);
    color: var(--text);
}

.payment-badge--partial {
    background: rgba(212, 168, 75, 0.28);
    color: #e8c86a;
}

.payment-badge--paid {
    background: rgba(61, 173, 108, 0.28);
    color: #8ee0af;
}

.payment-badge--overpaid {
    background: rgba(224, 85, 85, 0.3);
    color: #f0a0a0;
}

.payment-badge--unknown {
    background: rgba(139, 156, 179, 0.2);
    color: var(--muted);
}

.payment-badge--large {
    font-size: 1.05rem;
    padding: 0.4em 0.85em;
}

.orders-payment-cell {
    white-space: nowrap;
    vertical-align: middle;
}

.order-payment-lines {
    margin: 0.5rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.95rem;
}

.order-payment-lines li {
    margin: 0.25rem 0;
}

.order-payment-tx-heading {
    font-size: 1rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem;
}

.order-payment-badge-line {
    margin: 0 0 0.35rem;
}

.order-payment-actions {
    margin: 0.75rem 0 0;
}

.btn-danger {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-danger-soft {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-size: 0.9rem;
    width: 100%;
    max-width: 100%;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    max-width: none;
}

/* В grid иначе min-width: auto — селект с длинным текстом растягивает колонку за пределы блока */
.grid-2 > .form-row {
    min-width: 0;
}

label {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.2rem;
}

.form-row {
    margin-bottom: 0.75rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.client-mode-radios label.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-right: 1.25rem;
    cursor: pointer;
    color: var(--text);
    font-size: 0.9rem;
}

.order-client-search-panel {
    margin-bottom: 0.75rem;
}

.order-delivery-address-panel {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.order-delivery-address-panel textarea {
    min-height: 4rem;
    resize: vertical;
}

.client-search-wrap {
    position: relative;
    max-width: 100%;
}

.finance-order-search-row {
    position: relative;
}

.finance-toolbar {
    margin: 0.75rem 0;
}

.finance-summary-card {
    margin-bottom: 1rem;
}

.finance-summary-line {
    margin: 0.35rem 0;
}

.finance-summary-note {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
}

.finance-table-wrap {
    overflow-x: auto;
    margin-bottom: 0.75rem;
}

.finance-table .finance-amount {
    white-space: nowrap;
    text-align: right;
}

.finance-status-active {
    color: var(--text);
}

.finance-status-cancelled {
    color: var(--muted);
}

.finance-row-cancelled {
    opacity: 0.88;
}

/* Select2 «ID заказа» (Финансы): как input и .client-search-dd на «Заказы» */
.finance-filter-order-wrap .select2-container {
    font-size: 0.9rem;
}

.finance-filter-order-wrap .select2-container--default .select2-selection--single {
    min-height: 0;
    height: auto;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.finance-filter-order-wrap .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text);
    line-height: 1.45;
    padding: 0.4rem 0.6rem;
    padding-right: 1.85rem;
}

.finance-filter-order-wrap .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--muted);
}

.finance-filter-order-wrap .select2-container--default .select2-selection--single .select2-selection__arrow {
    display: none;
}

.finance-filter-order-wrap .select2-container--default .select2-selection--single .select2-selection__clear {
    margin-right: 0.15rem;
    color: var(--muted);
}

.finance-filter-order-wrap .select2-container--default.select2-container--focus .select2-selection--single,
.finance-filter-order-wrap .select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--border);
}

.finance-filter-order-wrap .select2-dropdown {
    margin: 0.2rem 0 0;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    color: var(--text);
}

.finance-filter-order-wrap .select2-container--default .select2-results > .select2-results__options {
    max-height: 260px;
}

.finance-filter-order-wrap .select2-container--default .select2-results__option {
    padding: 0.5rem 0.65rem;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
}

.finance-filter-order-wrap .select2-container--default .select2-results__option:last-child {
    border-bottom: none;
}

.finance-filter-order-wrap .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: rgba(61, 143, 209, 0.12);
    color: var(--text);
}

.finance-filter-order-wrap .select2-container--default .select2-search--dropdown {
    padding: 0.35rem 0.35rem 0.35rem;
}

.finance-filter-order-wrap .select2-container--default .select2-search--dropdown .select2-search__field {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.finance-filter-order-wrap .select2-container--default .select2-search--dropdown .select2-search__field::placeholder {
    color: var(--muted);
}

.finance-filter-order-wrap .select2-container--default .select2-results__option--loading-results,
.finance-filter-order-wrap .select2-container--default .select2-results__message {
    color: var(--muted);
    font-size: 0.88rem;
    padding: 0.55rem 0.65rem;
}

.finance-filter-inc {
    align-self: end;
}

.finance-cb-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.finance-dialog {
    max-width: 32rem;
    width: calc(100vw - 2rem);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0;
    background: var(--surface);
    color: var(--text);
}

.finance-dialog::backdrop {
    background: rgba(0, 0, 0, 0.45);
}

.finance-dialog-inner {
    position: relative;
    padding: 1rem 1.25rem 1.25rem;
}

.finance-dialog-inner.card {
    margin-bottom: 0;
}

.finance-dialog-close {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    line-height: 1;
    min-width: 2rem;
    min-height: 2rem;
    padding: 0;
    font-size: 1.35rem;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.finance-dialog-close:hover {
    color: var(--text);
}

.finance-pagination {
    margin-top: 0.75rem;
}

.client-search-dd {
    list-style: none;
    margin: 0.2rem 0 0;
    padding: 0;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 40;
    max-height: 260px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.client-search-dd .client-search-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.5rem 0.65rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}

.client-search-dd .client-search-item:last-child {
    border-bottom: none;
}

.client-search-dd .client-search-item:hover {
    background: rgba(61, 143, 209, 0.12);
}

.client-search-dd .client-search-name {
    font-weight: 500;
}

.client-search-dd .client-search-phone {
    flex-shrink: 0;
    font-size: 0.82rem;
}

.client-search-dd .client-search-empty {
    padding: 0.55rem 0.65rem;
    cursor: default;
    color: var(--muted);
    font-size: 0.88rem;
}

input.field-readonly {
    background: rgba(0, 0, 0, 0.25);
    cursor: default;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

table.data th,
table.data td {
    border: 1px solid var(--border);
    padding: 0.45rem 0.55rem;
    text-align: left;
}

table.data th {
    background: var(--surface);
    color: var(--muted);
    font-weight: 500;
}

table.data tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

table.data .price-summary-row td {
    background: rgba(255, 255, 255, 0.03);
    font-weight: 500;
}

table.data .price-history-panel-row > td {
    padding: 0;
    background: rgba(255, 255, 255, 0.015);
}

.price-summary-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.price-history-toggle {
    flex: 0 0 auto;
}

.price-history-table {
    width: 100%;
    border-collapse: collapse;
}

.price-history-table td {
    padding: 0.7rem 0.85rem;
    border-top: 1px solid var(--border);
}

table.data .price-version-history td,
.price-history-table .price-version-history td {
    color: var(--muted);
}

.price-actions-cell {
    text-align: right;
    white-space: nowrap;
}

/* Карточка заказа: таблицы «параметр — значение» (аналог dl.kv у проёмов) */
table.data.order-detail-kv td:first-child {
    color: var(--muted);
    width: 38%;
    font-weight: 500;
    vertical-align: top;
}

.login-box {
    max-width: 360px;
    margin: 4rem auto;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 1.25rem;
}

.pagination {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.orders-filter-card h2,
.clients-filter-card h2 {
    margin-top: 0;
    font-size: 1.05rem;
}

.orders-filters-grid .grid-2 {
    margin-bottom: 0;
}

.orders-filter-actions {
    margin: 0.75rem 0 0;
}

.orders-pagination {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.client-info-card .client-info-line {
    margin: 0.35rem 0;
}

.client-info-card .client-info-label {
    color: var(--muted);
    font-weight: 500;
    margin-right: 0.35rem;
}

.client-detail-actions {
    margin: 0.75rem 0 1rem;
}

.client-merge-toggle-wrap {
    margin: 0.75rem 0;
}

.client-merge-dup-list {
    margin: 0.5rem 0 1rem;
    padding-left: 0;
    list-style: none;
}

.client-merge-dup-label {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.5rem;
    margin: 0.35rem 0;
    cursor: pointer;
}

.client-merge-dup-label input[type="checkbox"] {
    flex-shrink: 0;
}

.client-merge-dup-link {
    font-weight: 500;
}

.req-form-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.req-form-h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

.req-date-field {
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
    max-width: 22rem;
}

.req-date-field .req-date-input {
    flex: 1;
    min-width: 0;
}

.req-date-field .req-date-open {
    flex-shrink: 0;
    padding: 0.35rem 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.req-date-icon {
    display: block;
    vertical-align: middle;
}

.req-date-picker-pop {
    position: fixed;
    z-index: 10050;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 0.5rem;
    min-width: 280px;
}

.req-date-picker-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.req-date-sel {
    font: inherit;
    padding: 0.4rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: inherit;
    max-width: 100%;
}

.req-date-sel-month {
    flex: 1;
    min-width: 8.5rem;
}

.req-date-sel-year {
    width: 5.75rem;
    flex-shrink: 0;
}

.req-date-nav {
    min-width: 2rem;
    padding: 0.25rem 0.4rem;
    flex-shrink: 0;
}

.req-date-picker-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.req-date-picker-table th {
    font-weight: 500;
    color: var(--muted);
    padding: 0.2rem;
    text-align: center;
}

.req-date-picker-table td {
    padding: 0.1rem;
    text-align: center;
    vertical-align: middle;
}

.req-date-day {
    width: 100%;
    min-height: 2rem;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.req-date-day:hover {
    background: rgba(0, 0, 0, 0.06);
}

.req-date-day-selected {
    background: var(--primary, #2563eb);
    color: #fff;
}

.req-date-day-selected:hover {
    filter: brightness(1.05);
}

.constants-value-cell input[type="number"] {
    max-width: 10rem;
    vertical-align: middle;
}

.constant-save-btn {
    vertical-align: middle;
}

table.data a.clients-orders-count {
    font-weight: 600;
    display: inline-block;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.openings-readonly {
    margin-bottom: 1rem;
}

.opening-item {
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    background: rgba(0, 0, 0, 0.12);
}

.opening-item:last-child {
    margin-bottom: 0;
}

.opening-item summary {
    cursor: pointer;
    padding: 0.55rem 0.65rem;
    font-weight: 500;
    font-size: 0.9rem;
    list-style: none;
}

.opening-item summary::-webkit-details-marker {
    display: none;
}

.opening-item summary::before {
    content: '';
    display: inline-block;
    width: 0.35rem;
    height: 0.35rem;
    margin-right: 0.45rem;
    border: solid var(--muted);
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(-45deg);
    vertical-align: 0.15em;
    opacity: 0.8;
}

.opening-item[open] summary::before {
    transform: rotate(45deg);
    vertical-align: 0.08em;
}

.opening-item[open] summary {
    border-bottom: 1px solid var(--border);
}

.opening-item .kv {
    margin: 0;
    padding: 0.65rem 0.75rem;
    display: grid;
    grid-template-columns: minmax(7.5rem, auto) 1fr;
    gap: 0.35rem 1rem;
    font-size: 0.86rem;
}

.opening-item .kv dt {
    color: var(--muted);
    margin: 0;
    font-weight: 500;
}

.opening-item .kv dd {
    margin: 0;
}

/* Как у .opening-item .kv — отступ от краёв карточки проёма */
.opening-item .opening-edit-sub {
    margin-top: 0;
    border-top: 1px solid var(--border);
    padding: 0.65rem 0.75rem;
}

.opening-edit-sub > summary {
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--accent);
    list-style: none;
    margin-bottom: 0.35rem;
}

.opening-edit-sub > summary::-webkit-details-marker {
    display: none;
}

.opening-item .opening-edit-fields {
    margin: 0;
}

.opening-item .opening-edit-fields .form-row:last-child {
    margin-bottom: 0;
}

.muted {
    color: var(--muted);
    font-size: 0.85rem;
}

.err {
    color: var(--danger);
    font-size: 0.88rem;
    margin-top: 0.5rem;
    white-space: pre-line;
}

.toast {
    position: fixed;
    bottom: 1.2rem;
    right: 1.2rem;
    padding: 0.65rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    z-index: 1000;
    max-width: 360px;
}

.toast.ok {
    border-color: var(--ok);
}

.toast.err {
    border-color: var(--danger);
    white-space: pre-line;
}

.toast .toast-inline-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
}

.btn-contract-pending {
    opacity: 0.55;
    cursor: not-allowed;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.settings-grid a.card {
    display: block;
    color: inherit;
    text-decoration: none;
}

.settings-grid a.card:hover {
    border-color: var(--accent);
}

.user-dealer-extra {
    display: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.user-dealer-extra.is-visible {
    display: block;
}

.hidden {
    display: none !important;
}

/* Список заказов: стоимость + стрелка, детализация в той же ячейке */
.orders-cost-cell {
    vertical-align: top;
    white-space: normal;
    min-width: 8rem;
}

.orders-cost-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
}

.orders-cost-amount {
    flex: 1;
    min-width: 0;
}

.orders-cost-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.65rem;
    height: 1.65rem;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: 4px;
}

.orders-cost-toggle:hover {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.06);
}

.orders-cost-chevron {
    display: block;
    transition: transform 0.15s ease;
}

.orders-cost-toggle[aria-expanded="true"] .orders-cost-chevron {
    transform: rotate(180deg);
}

.orders-cost-detail {
    margin-top: 0.6rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border);
    font-size: 0.88rem;
    line-height: 1.35;
}

.orders-cost-pos {
    margin-bottom: 0.65rem;
}

.orders-cost-pos:last-child {
    margin-bottom: 0;
}

.orders-cost-pos-label {
    color: var(--muted);
}

.orders-cost-pos-value {
    margin-top: 0.15rem;
}

.orders-cost-breakdown-empty {
    margin: 0;
    font-size: 0.88rem;
}

tr.orders-row-main {
    cursor: pointer;
}

/* Справочники: неактивная позиция (видна админу с include_inactive) */
tr.ref-row-inactive td {
    color: var(--muted);
}

/* Створки: фиксация и пересчёт ширин */
.opening-width-field-wrap .opening-width-recalc-wrap,
.sash-width-input-wrap .sash-row-recalc-wrap {
    margin-top: 0.4rem;
}

.btn.btn-small {
    font-size: 0.82rem;
    padding: 0.25rem 0.55rem;
}

.sash-width-table .sash-fixed-th {
    width: 9.5rem;
    white-space: nowrap;
}

.sash-fixed-cell {
    vertical-align: middle;
}

.sash-fixed-btn.is-active,
.sash-fixed-btn[aria-pressed="true"] {
    background: rgba(61, 143, 209, 0.25);
    border-color: var(--accent);
    color: var(--text);
}

/* === Фурнитура по створкам (редактор) === */
.sash-hw-th {
    min-width: 16rem;
}

.sash-hw-cell {
    vertical-align: middle;
}

.hw-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.15rem 0;
    flex-wrap: wrap;
}

.hw-group .hw-label,
.hw-group .hw-check {
    font-size: 0.85rem;
    color: var(--muted);
    min-width: 4.4rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.hw-check {
    cursor: pointer;
}

/* Резерв под глифы (ручка — 2, защёлка/замок — 1), чтобы колонка Л/П выровнялась */
.hw-glyphs {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 4.3rem;
}

/* Глиф-тоггл грани ручки: чип «стекла», явный контраст выбран/не выбран */
.face-toggle {
    position: relative;
    width: 30px;
    height: 30px;
    padding: 2px;
    border: 2px solid var(--border);
    border-radius: 7px;
    background: #c8e0ee;
    cursor: pointer;
    opacity: 0.4;
    filter: grayscale(0.6);
    transition: opacity 0.12s, box-shadow 0.12s, border-color 0.12s, filter 0.12s;
    line-height: 0;
}

.face-toggle .face-glyph,
.face-toggle .face-glyph svg {
    width: 100%;
    height: 100%;
    display: block;
}

.face-toggle .face-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--ok);
    color: #fff;
    font-size: 10px;
    line-height: 15px;
    text-align: center;
    display: none;
}

.face-toggle.is-on {
    opacity: 1;
    filter: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(61, 143, 209, 0.35), 0 0 8px rgba(61, 143, 209, 0.5);
}

.face-toggle.is-on .face-badge {
    display: block;
}

.side-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.side-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 0.15rem 0.45rem;
    font-size: 0.8rem;
    cursor: pointer;
}

.side-btn + .side-btn {
    border-left: 1px solid var(--border);
}

.side-btn[aria-pressed="true"] {
    background: rgba(61, 143, 209, 0.25);
    color: var(--text);
}

/* Сторона Л/П неактивна, пока соответствующего элемента фурнитуры нет */
.side-toggle.is-disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* Тост-предупреждение (мягкое, не блокирующее) — напр. по числу рельсов */
.toast.warn {
    background: #5c4a12;
    border: 1px solid #b8902a;
    color: #ffe9b0;
}

/* Inline-предупреждение под полем (внутри ячейки, не ломает grid): рельсы, чётность створок */
.track-warn,
.sash-warn {
    margin-top: 0.35rem;
    padding: 0.3rem 0.45rem;
    background: #5c4a12;
    border: 1px solid #b8902a;
    color: #ffe9b0;
    border-radius: 5px;
    font-size: 0.76rem;
    line-height: 1.25;
}

/* Карточка заказа: форма добавления проёма по кнопке */
.add-opening-section {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.add-opening-section h2 {
    margin-top: 0;
}

.add-opening-panel {
    margin-top: 0.75rem;
}

/* Клиенты: дубли по телефону / e-mail */
.clients-dup-flag {
    margin-left: 0.2em;
    white-space: nowrap;
}

.clients-duplicates-toolbar {
    margin-bottom: 0.75rem;
}

.clients-dup-toggle-btn .badge {
    background: rgba(61, 143, 209, 0.35);
    color: var(--text);
}

.clients-duplicates-panel {
    margin-bottom: 1rem;
}

.clients-dup-summary-table {
    margin-top: 0.75rem;
}

.clients-dup-others-cell {
    line-height: 1.5;
    vertical-align: top;
}

.clients-dup-others-list {
    margin: 0;
    padding-left: 1.25rem;
    list-style: disc;
}

.clients-dup-others-list li {
    margin: 0.15em 0;
}

#us-clients-table tbody tr.clients-row-dup {
    box-shadow: inset 4px 0 0 rgba(240, 173, 78, 0.95);
    background: rgba(240, 173, 78, 0.07);
}
