﻿:root {
    --bg: #f3f5f9;
    --card: #ffffff;
    --text: #16233b;
    --muted: #5f6b7f;
    --line: #d8dfeb;
    --accent: #2f6fb2;
    --danger: #c62828;
    --ok: #2d8a57;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: linear-gradient(180deg, #eef3fb 0%, var(--bg) 220px);
    color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    background: #091933;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
}
.topbar .brand a { color: #fff; font-weight: 700; font-size: 20px; display: inline-flex; align-items: center; }
.brand-logo { height: 38px; width: auto; display: block; }
.topnav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.topnav-link,
.nav-group-trigger,
.nav-group-menu a { color: #d1d5db; }
.topnav-link { padding: 8px 10px; border-radius: 10px; }
.topnav-link:hover { background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.nav-group { position: relative; }
.nav-group::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 10px;
}
.nav-group-trigger {
    background: transparent;
    color: #d1d5db;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    min-width: 0;
}
.nav-group-trigger:hover,
.nav-group:focus-within .nav-group-trigger,
.nav-group:hover .nav-group-trigger {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.22);
}
.nav-group-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    display: none;
    background: #102445;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 12px 30px rgba(2, 8, 23, 0.35);
    z-index: 40;
}
.nav-group-menu-right { right: 0; left: auto; }
.nav-group:hover .nav-group-menu,
.nav-group:focus-within .nav-group-menu { display: grid; gap: 4px; }
.nav-group-menu a {
    display: block;
    padding: 9px 10px;
    border-radius: 8px;
}
.nav-group-menu a:hover { background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.topbar .user { color: #9ca3af; padding: 0 4px; }

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 16px 20px;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
}

.instruction {
    background: linear-gradient(180deg, #fbfdff 0%, #f3f7fb 100%);
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 4px 12px rgba(15, 23, 42, 0.04);
}

.instruction-highlight {
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #93c5fd;
}

.instruction strong {
    display: block;
    margin-bottom: 8px;
    color: #5f6b7f;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.instruction div {
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
    word-break: break-word;
}

.auth-card { max-width: 420px; margin: 40px auto; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.stack { display: grid; gap: 10px; }
.compact { margin-bottom: 14px; }

input, select, textarea, button {
    font: inherit;
    border-radius: 8px;
    border: 1px solid var(--line);
    padding: 9px 10px;
}

button {
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
}
button:hover { filter: brightness(1.05); }

.btn-save {
    background: var(--ok);
    color: #fff;
}
a.btn-save {
    color: #fff;
    text-decoration: none;
}

.btn-delete,
button[formaction*="delete"],
form[action*="/delete"] button {
    background: var(--danger);
}

textarea { min-height: 80px; resize: vertical; }

table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}
th, td {
    border-bottom: 1px solid #eceff4;
    text-align: left;
    padding: 8px;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
th { color: var(--muted); font-weight: 600; }

/* Ячейки с кнопками/формами — не обрезать содержимое */
td:has(> button),
td:has(> form),
td:has(> .inline-actions) {
    overflow: visible;
    text-overflow: clip;
}

/* Ячейки с превью/изображениями — уменьшить padding, не обрезать */
td:has(> img),
td.td-thumb {
    overflow: visible;
    padding: 4px;
    vertical-align: middle;
}

.thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: block;
}

.thumb-fallback {
    width: 72px;
    height: 72px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #9ca3af;
    color: #6b7280;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: #f9fafb;
}

.flash {
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}
.flash.error { background: #fee2e2; color: var(--danger); }
.flash.ok { background: #dcfce7; color: var(--ok); }

.hint { color: var(--muted); }

@media (max-width: 980px) {
    .grid.two,
    .grid.three,
    .grid.four,
    .grid.five { grid-template-columns: 1fr; }

    .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
    .topnav { width: 100%; align-items: stretch; }
    .nav-group { width: 100%; }
    .nav-group-trigger, .topnav-link { width: 100%; text-align: left; }
    .nav-group-menu, .nav-group-menu-right { position: static; display: grid; margin-top: 6px; min-width: 0; width: 100%; box-shadow: none; }
    .topbar .user { width: 100%; padding: 8px 10px 0; }
}

.logo-large {
    width: 180px;
    height: 180px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.logo-fallback {
    width: 180px;
    height: 180px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #9ca3af;
    color: #6b7280;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    background: #f9fafb;
}

.gantt-wrap { display: grid; gap: 10px; }
.gantt-row { display: grid; gap: 6px; }
.gantt-meta { display: grid; gap: 2px; font-size: 13px; }
.gantt-meta span { color: var(--muted); }
.gantt-track {
    position: relative;
    height: 24px;
    border-radius: 6px;
    background: #eef2f7;
    border: 1px solid #dbe2ea;
    overflow: hidden;
}
.gantt-bar {
    position: absolute;
    top: 2px;
    height: 18px;
    border-radius: 5px;
    min-width: 8px;
}
.gantt-bar.development { background: #0284c7; }
.gantt-bar.testing { background: #7c3aed; }
.gantt-bar.done { opacity: 0.55; }
.gantt-bar.blocked { background: var(--danger); }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab-btn { background: #e5e7eb; color: #111827; }
.tab-btn.active { background: var(--accent); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.gantt-controls { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.zoom-btn { background: #e5e7eb; color: #111827; }
.zoom-btn.active { background: #0f766e; color: #fff; }
.gantt-shell {
    overflow-x: auto;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 12px;
}
.gantt-header { display: flex; min-width: calc(var(--total-days) * var(--day-width)); }
.head-cell {
    border-right: 1px solid #dbe2ea;
    border-bottom: 1px solid #dbe2ea;
    padding: 4px 6px;
    font-size: 12px;
    color: #374151;
    white-space: nowrap;
}
.gantt-header.days .day-cell,
.weekend-overlay .day-cell {
    width: var(--day-width);
    min-width: var(--day-width);
    border-right: 1px solid #edf2f7;
    text-align: center;
    font-size: 11px;
}
.gantt-header.days .day-cell { padding: 3px 0; color: #6b7280; }
.day-cell.weekend { background: #fef3c7; }
.gantt-grid { position: relative; min-width: calc(var(--total-days) * var(--day-width)); }
.weekend-overlay {
    display: flex;
    height: 100%;
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.35;
}
.gantt-row-2 { display: grid; gap: 5px; margin-top: 8px; position: relative; }
.gantt-label { display: grid; gap: 2px; font-size: 13px; }
.gantt-label span { color: var(--muted); }
.gantt-track-2 {
    position: relative;
    height: 22px;
    border: 1px solid #dbe2ea;
    background: #f8fafc;
    border-radius: 6px;
}
.gantt-bar-2 {
    position: absolute;
    top: 2px;
    height: 16px;
    border-radius: 4px;
    min-width: 8px;
}
.gantt-bar-2.development { background: #0284c7; }
.gantt-bar-2.testing { background: #8b5cf6; }
.gantt-bar-2.done { opacity: 0.55; }
.gantt-bar-2.blocked { background: var(--danger); }
.toggle-gap { margin-bottom: 12px; }
.hidden { display: none; }
.dash-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

/* ── Dashboard KPI strip ── */
.dash-kpi-strip {
    display: flex;
    flex-wrap: wrap;
}
.dash-kpi-item {
    flex: 1;
    min-width: 110px;
    padding: 18px 20px;
    text-align: center;
    border-right: 1px solid var(--line);
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}
.dash-kpi-item:last-child { border-right: none; }
.dash-kpi-item:hover { background: #f8fafc; }
.dash-kpi-value {
    font-size: 30px;
    font-weight: 700;
    color: #1e40af;
    line-height: 1;
}
.dash-kpi-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

/* ── Dashboard change feed ── */
.dash-changes-list {
    display: grid;
    gap: 0;
}
.dash-change-row {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.dash-change-row:last-child { border-bottom: none; }
.dash-change-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    background: #f1f5f9;
    color: #475569;
    margin-top: 1px;
}
.dash-change-icon.product_create,
.dash-change-icon.create        { background: #dcfce7; color: #166534; }
.dash-change-icon.bom_add,
.dash-change-icon.bom_bulk_add  { background: #dbeafe; color: #1e40af; }
.dash-change-icon.bom_delete    { background: #fee2e2; color: #991b1b; }
.dash-change-icon.product_update,
.dash-change-icon.bom_update    { background: #fef3c7; color: #92400e; }
.dash-change-icon.route_create,
.dash-change-icon.route_update,
.dash-change-icon.route_delete  { background: #ede9fe; color: #6d28d9; }
.dash-change-body { min-width: 0; }
.dash-change-type {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    white-space: nowrap;
}
.dash-change-meta {
    text-align: right;
    flex-shrink: 0;
    min-width: 80px;
}
@media (max-width: 640px) {
    .dash-kpi-strip { flex-direction: column; }
    .dash-kpi-item { border-right: none; border-bottom: 1px solid var(--line); }
    .dash-kpi-item:last-child { border-bottom: none; }
    .dash-change-row { grid-template-columns: 28px 1fr; }
    .dash-change-meta { display: none; }
}
.product-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.product-card {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
    background: #fff;
    text-decoration: none;
    color: inherit;
}
.product-card:hover { box-shadow: 0 8px 24px rgba(2, 6, 23, 0.08); }
.product-thumb-wrap { width: 88px; height: 88px; }
.product-thumb {
    width: 88px;
    height: 88px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
}
.product-thumb-fallback {
    width: 88px;
    height: 88px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #9ca3af;
    border-radius: 10px;
    font-size: 11px;
    color: #6b7280;
    background: #f8fafc;
}
.product-body { display: grid; gap: 6px; }
.product-title { font-weight: 700; color: #111827; }
.product-owner { font-size: 13px; color: #6b7280; }
.status-pill {
    width: fit-content;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
}
.status-pill.in_dev,
.status-pill.in_progress { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.status-pill.testing,
.status-pill.planned { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
.status-pill.approved,
.status-pill.released,
.status-pill.done { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.status-pill.blocked { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.status-pill.empty { background: #f3f4f6; color: #374151; border-color: #e5e7eb; }
.auth-card label { display: grid; gap: 6px; }
.auth-card input { width: 100%; }
.export-form {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    background: #f8fafc;
}
.export-form label { display: grid; gap: 6px; }
.export-options { align-items: start; }
.option-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1.25;
}
.option-line input[type="checkbox"],
.option-line input[type="radio"] {
    margin: 0;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}
.option-line span { display: inline-block; }
.export-all { margin: 2px 0 6px; }
.export-form select[multiple] { min-height: 170px; }
.spec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.spec-table-wrap { width: 100%; }
.spec-table { display: table; table-layout: fixed; width: 100%; }
.spec-table th,
.spec-table td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    vertical-align: top;
}
.card.spec-expanded {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    margin-left: calc(50% - 50vw + 16px);
}
.spec-table-wrap.expanded .spec-table th,
.spec-table-wrap.expanded .spec-table td {
    font-size: 13px;
    padding: 7px 6px;
}
.product-hero {
    display: grid;
    grid-template-columns: minmax(220px, 28vw) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    margin-bottom: 14px;
}
.product-hero-media {
    width: 100%;
    max-width: 380px;
}
.product-hero-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 10px;
    display: block;
    background: #fff;
}
.product-hero-fallback {
    width: 100%;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #9ca3af;
    color: #6b7280;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 700;
    background: #f9fafb;
}
.product-hero-info h1 { margin: 0 0 8px; }
.product-hero-info p { margin: 0; }
@media (max-width: 980px) {
    .product-hero { grid-template-columns: 1fr; }
}
.status-pill.archived { background: #e5e7eb; color: #374151; border-color: #d1d5db; }
.spec-table td.status-col {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    min-width: 140px;
}
.export-form label.option-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
/* ── BOM tree lines ── */
/* height:1px — трюк для работы height:100% у дочерних div в table-cell */
.spec-table td.bom-td { height: 1px; padding: 0 0 0 8px; }
.bom-tree-cell {
    display: flex;
    align-items: flex-start;
    height: 100%;
}
.bom-tree-guide {
    flex-shrink: 0;
    width: 16px;
    align-self: stretch;
    position: relative;
}
.bom-tree-guide.bar::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #cbd5e1;
    border-radius: 1px;
}
.bom-tree-conn {
    flex-shrink: 0;
    width: 16px;
    align-self: stretch;
    position: relative;
}
/* Вертикальная часть коннектора */
.bom-tree-conn.tee::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #cbd5e1;
}
.bom-tree-conn.corner::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 50%;
    width: 2px;
    background: #cbd5e1;
}
/* Горизонтальная часть коннектора */
.bom-tree-conn::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 50%;
    width: 9px;
    height: 2px;
    background: #cbd5e1;
    transform: translateY(-1px);
}
.bom-tree-label {
    flex: 1;
    min-width: 0;
    padding: 8px 0 8px 3px;  /* вертикальный отступ вместо td padding */
}
.spec-actions { white-space: nowrap; width: 130px; }
.spec-edit-toggle,
.spec-cancel-toggle { background: #e5e7eb; color: #111827; }
.spec-edit-row td { background: #f8fafc; padding: 12px; }
.spec-edit-form { display: grid; gap: 12px; }
.spec-edit-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.spec-edit-grid label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}
.spec-edit-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
@media (max-width: 980px) {
    .spec-edit-grid { grid-template-columns: 1fr; }
    .spec-edit-actions { justify-content: stretch; flex-direction: column; }
}
.super-spec-overview-grid { align-items: start; }
.inset-card { background: #f8fafc; border: 1px solid #dbe3ef; }
.manual-component-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.manual-component-card {
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
}
.manual-component-card input {
    width: 18px;
    height: 18px;
    margin: 0;
}
.manual-component-main { font-weight: 700; color: #102a56; }
.manual-component-meta { color: var(--muted); font-size: 0.92rem; }
.priority-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid transparent;
}
.priority-pill.low {
    background: #f3f4f6;
    color: #374151;
    border-color: #e5e7eb;
}
.priority-pill.normal {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #bfdbfe;
}
.priority-pill.high {
    background: #fef3c7;
    color: #b45309;
    border-color: #fde68a;
}
.priority-pill.urgent {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}
.priority-pill.critical {
    background: #b91c1c;
    color: #fff;
    border-color: #991b1b;
}
.priority-critical-row {
    background: #fff1f2;
}
.priority-critical-card {
    border-color: #ef4444;
    box-shadow: 0 8px 28px rgba(185, 28, 28, 0.12);
}
@media (max-width: 900px) {
    .manual-component-list { grid-template-columns: 1fr; }
}

.preferred-offer-row { background: #f0fdf4; }
.preferred-offer-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
    font-size: 12px;
    font-weight: 700;
}


.filter-card { padding-top: 10px; }
.filter-details summary {
    cursor: pointer;
    list-style: none;
}
.filter-details summary::-webkit-details-marker { display: none; }
.filter-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}
.filter-form-body {
    margin-top: 14px;
}
.filter-actions-top {
    display: flex;
    justify-content: flex-end;
}
.components-filters-card {
    padding: 14px 16px;
    background: linear-gradient(180deg, #fbfdff 0%, #f4f8fd 100%);
    border-color: #d7e2f0;
    box-shadow: 0 10px 28px rgba(9, 25, 51, 0.05);
}
.components-filters-form {
    display: grid;
    gap: 10px;
}
.components-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.components-filters-search {
    flex: 1 1 340px;
    min-width: 260px;
}
.components-filters-search input {
    width: 100%;
    background: #fff;
    border: 1px solid #c8d7ea;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.components-filters-field {
    flex: 0 1 200px;
    min-width: 180px;
}
.components-filters-field select {
    width: 100%;
    background: #fff;
    border: 1px solid #c8d7ea;
}
.components-filters-per-page {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 4px;
    font-size: 13px;
    color: #4b5f7d;
    white-space: nowrap;
}
.components-filters-per-page select {
    width: 84px;
    background: #fff;
    border: 1px solid #c8d7ea;
}
.components-filters-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}
.components-filters-reset {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 2px;
    font-size: 13px;
    color: #46637f;
    text-decoration: none;
}
.components-filters-reset:hover {
    text-decoration: underline;
}
.components-filters-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #5c6d84;
}
.table-wrap {
    width: 100%;
    overflow-x: auto;
}
.component-list-table {
    width: 100%;
    border-collapse: collapse;
    display: table;
    table-layout: fixed;
}
.component-list-table th,
.component-list-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}
.component-list-table th {
    font-size: 13px;
    color: var(--muted);
    font-weight: 700;
    background: #f8fafc;
}
.component-list-table tbody tr:hover {
    background: #f8fafc;
}
.component-list-table .code-cell {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
}
.component-list-wrap {
    margin-top: 6px;
}
.products-list-card {
    background: linear-gradient(180deg, #fbfdff 0%, #f4f8fd 100%);
    border-color: #d7e2f0;
    box-shadow: 0 10px 28px rgba(9, 25, 51, 0.05);
}
.products-list-card .dash-head {
    margin-bottom: 14px;
}
.products-list-card .dash-head h2 {
    color: #102445;
}
.products-list-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
}
.products-list-toolbar input {
    background: #ffffff;
    border: 1px solid #c8d7ea;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.products-search-count {
    font-size: 13px;
    color: #4b5f7d;
    font-weight: 600;
}
.products-list-wrap {
    margin-top: 10px;
    border: 1px solid #d7e2f0;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(9, 25, 51, 0.05);
}
.products-list-table th {
    background: linear-gradient(180deg, #eaf2fb 0%, #dde8f6 100%);
    border-bottom: 1px solid #c9d8eb;
    color: #35506f;
    letter-spacing: 0.01em;
}
.products-list-table td {
    border-bottom-color: #e5edf7;
}
.products-list-table tbody tr {
    background: #ffffff;
    transition: background-color 0.16s ease, box-shadow 0.16s ease;
}
.products-list-table tbody tr:nth-child(even) {
    background: #fbfdff;
}
.products-list-table tbody tr.product-table-row:hover {
    background: #eef5ff;
}
.products-list-table tbody tr.product-table-row:hover .products-code-link {
    color: #1e5e9d;
}
.products-code-link {
    font-weight: 700;
    color: #102445;
    text-decoration: none;
}
.products-name {
    font-weight: 600;
    font-size: 14px;
    color: #132947;
}
.products-description {
    font-size: 12px;
    color: #61718a;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.products-owner-cell {
    font-size: 13px;
    color: #4d617e;
    font-weight: 500;
}
.products-bom-cell {
    text-align: center;
}
.products-bom-badge {
    display: inline-flex;
    min-width: 34px;
    justify-content: center;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: #edf4ff;
    border: 1px solid #c8daf2;
    color: #2d588d;
    font-size: 12px;
    font-weight: 700;
}
.products-empty-cell {
    text-align: center;
    color: #6a7890;
    padding: 32px;
    background: linear-gradient(180deg, #fbfdff 0%, #f5f8fc 100%);
}
.inline-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.pager {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.pager-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
}
a.pager-link:hover {
    background: #eef4fb;
    text-decoration: none;
}
button.pager-link:hover {
    background: #eef4fb;
}
.pager-link.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.pager-gap {
    color: var(--muted);
    font-size: 14px;
    padding: 0 2px;
}
.pager-summary {
    color: var(--muted);
    font-size: 13px;
    margin-left: 4px;
}
.btn-danger {
    background: var(--danger);
}
@media (max-width: 900px) {
    .filter-summary {
        align-items: flex-start;
        flex-direction: column;
    }
    .components-filters-search,
    .components-filters-field,
    .components-filters-actions,
    .components-filters-per-page {
        flex: 1 1 100%;
        min-width: 0;
    }
    .components-filters-actions {
        margin-left: 0;
        justify-content: space-between;
    }
    .components-filters-meta {
        flex-direction: column;
        align-items: flex-start;
    }
    .component-list-table {
        min-width: 860px;
    }
}


.collapse-card {
    padding-top: 10px;
}

.collapse-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    list-style: none;
    font-weight: 700;
}

.collapse-summary::-webkit-details-marker {
    display: none;
}

.collapse-title {
    font-size: 18px;
    line-height: 1.2;
    color: var(--text);
}

.collapse-meta {
    font-size: 15px;
    color: #41526e;
    font-weight: 600;
    text-align: right;
}

.collapse-content {
    margin-top: 14px;
}

.embedded-details {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    background: #fafcff;
}

.embedded-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
}


.bulk-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #d8e2f0;
    border-radius: 14px;
    background: #f6f9fc;
}

.bulk-toolbar.static {
    margin-top: 12px;
}

.bulk-toolbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.bulk-selected-row {
    background: #f5fbff;
}

.bulk-ok-row {
    background: #f6fcf8;
}

.bulk-blocked-row {
    background: #fff7f7;
}

.bulk-preview-card .instruction-value {
    font-size: 24px;
}


.production-header-status {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.production-status-grid {
    align-items: end;
}

.status-flow-line {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 6px;
}

.status-flow-step {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: #eff5fb;
    color: #214261;
    border: 1px solid #d4e1ef;
    font-size: 13px;
    font-weight: 700;
}

.status-flow-step::after {
    content: "→";
    margin-left: 4px;
    color: #6c8099;
}

.status-flow-step:last-child::after {
    content: "";
    margin-left: 0;
}

.status-flow-step.muted {
    background: #f7f7f8;
    color: #5d6675;
    border-color: #e5e7eb;
}

.status-flow-step.status-flow-done {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.status-flow-step.status-flow-active {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
    font-weight: 800;
    box-shadow: 0 0 0 2px #bfdbfe;
}

/* ── Вкладки страницы запроса (pr-tabs) ── */
.pr-tabs {
    display: flex;
    gap: 4px;
    padding: 0 2px 0;
    border-bottom: 2px solid var(--line);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.pr-tab {
    background: transparent;
    color: var(--muted);
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    white-space: nowrap;
}

.pr-tab:hover { color: var(--text); background: #f3f6fb; filter: none; }
.pr-tab.pr-tab-active { color: var(--accent); border-bottom-color: var(--accent); background: transparent; }
.pr-tab.pr-tab-active:hover { background: transparent; }

/* ── Бейдж дней до срока ── */
.days-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.days-badge-ok     { background: #dcfce7; color: #166534; }
.days-badge-warn   { background: #fef3c7; color: #92400e; }
.days-badge-overdue{ background: #fee2e2; color: #991b1b; }
.days-badge-none   { background: #f3f4f6; color: #6b7280; }

/* Индикатор разрыва между дедлайном и обещанным сроком */
.date-gap-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
    white-space: nowrap;
}
.date-gap-pill.warn { background: #fee2e2; color: #991b1b; }
.date-gap-pill.ok   { background: #dcfce7; color: #166534; }

.date-gap-warn {
    color: #c62828;
    font-size: 12px;
    font-weight: 600;
    margin: 4px 0 0;
}
.date-gap-ok {
    color: #2d8a57;
    font-size: 12px;
    font-weight: 600;
    margin: 4px 0 0;
}

.instruction-copy {
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
}

@media (max-width: 980px) {
    .production-header-status {
        grid-template-columns: 1fr;
    }
}

.grid-span-3 {
    grid-column: 1 / -1;
}

.inline-actions form {
    margin: 0;
}

.inline-edit-details {
    padding: 6px 0;
}

.inline-edit-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--accent);
    font-weight: 600;
    list-style: none;
}

.inline-edit-toggle::-webkit-details-marker {
    display: none;
}

.inline-edit-details[open] .inline-edit-toggle {
    margin-bottom: 12px;
}

.bulk-selection-meta {
    justify-content: space-between;
    align-items: center;
    margin: 8px 0 4px;
}

.linkish-button {
    border: 0;
    background: transparent;
    color: var(--accent, #2f6db5);
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.linkish-button:hover {
    text-decoration: underline;
}

.active-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #e8f1fb;
    color: #17406b;
    border: 1px solid #c9daee;
    font-weight: 700;
}

.cost-baseline-form {
    min-width: 160px;
}

.cost-table td {
    vertical-align: top;
}

.cost-table .linkish-button {
    padding-left: 0;
}

/* ── Прогресс-бар покрытия ── */
.cost-coverage-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
}
.cost-coverage-track {
    flex: 1;
    height: 10px;
    background: #e5e9f0;
    border-radius: 999px;
    overflow: hidden;
}
.cost-coverage-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}
.coverage-ok    { background: var(--ok); }
.coverage-warn  { background: #f59e0b; }
.coverage-danger { background: var(--danger); }

.cost-coverage-label {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}
.coverage-text-ok    { color: var(--ok); }
.coverage-text-warn  { color: #b45309; }
.coverage-text-danger { color: var(--danger); }

/* ── Структурная полоска ── */
.cost-structure-bar {
    display: flex;
    height: 30px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--line);
}
.cost-bar-mfg {
    background: #3b82f6;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    white-space: nowrap;
    padding: 0 8px;
    min-width: 0;
}
.cost-bar-pur {
    background: #10b981;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    white-space: nowrap;
    padding: 0 8px;
    min-width: 0;
}

/* ── Бейджи свежести ── */
.freshness-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.freshness-ok    { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.freshness-warn  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.freshness-stale { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.freshness-none  { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }

/* ── Секция "Требуют внимания" ── */
.cost-attention-card {
    border-color: #fcd34d;
    background: #fffbeb;
}
.cost-attention-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
    color: #92400e;
    margin-bottom: 10px;
}
.cost-attention-list {
    display: grid;
    gap: 6px;
}
.cost-attention-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #fde68a;
    flex-wrap: wrap;
}
.cost-attention-reason {
    color: #92400e;
    font-size: 13px;
    flex: 1;
    min-width: 120px;
}
.cost-attention-action {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Раскрывающиеся шаги цепочки ── */
.chain-steps-summary {
    color: var(--accent);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    list-style: none;
    user-select: none;
}
.chain-steps-summary::-webkit-details-marker { display: none; }
.chain-steps-body {
    margin-top: 6px;
    padding: 8px 10px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid var(--line);
}
.chain-step-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: baseline;
    padding: 4px 0;
    border-bottom: 1px solid #eff2f6;
    font-size: 12px;
}
.chain-step-row:last-of-type { border-bottom: none; }
.chain-step-name   { color: var(--text); font-weight: 500; }
.chain-step-partner { color: var(--muted); font-size: 11px; }
.chain-step-cost   { font-weight: 700; white-space: nowrap; color: var(--text); }

/* ── Цвет строк BOM по статусу ── */
.cost-row-missing  { background: #fff7f7; }
.cost-row-baseline { background: #f5fbff; }
.cost-row-stale    { background: #fffbeb; }

/* ── Строки запросов без цены ── */
tr.item-no-price { background: #fffbf0; }
tr.item-no-price td:first-child { border-left: 3px solid #f59e0b; }

/* ── Баннер ожидающих ответа запросов ── */
.open-requests-alert {
    background: #fffbf0;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.open-requests-alert strong { color: #92400e; }
.open-requests-alert .alert-links { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Кнопка редактирования в строке таблицы ── */
.btn-row-edit {
    background: none;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 13px;
    cursor: pointer;
    color: var(--muted);
    line-height: 1.4;
    white-space: nowrap;
}
.btn-row-edit:hover {
    background: #f0f4ff;
    color: var(--accent);
    border-color: #93c5fd;
    filter: none;
}
.btn-row-edit.active {
    background: #dbeafe;
    color: var(--accent);
    border-color: #93c5fd;
}

/* ── Горизонтальная inline-форма редактирования ── */
.inline-edit-row-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 6px 8px;
    background: #f8fafc;
    border-radius: 6px;
}

/* ══════════════════════════════════════════
   ВКЛАДКИ СТРАНИЦЫ ИЗДЕЛИЯ (pdt-tabs)
   ══════════════════════════════════════════ */
.pdt-tabs {
    display: flex;
    gap: 4px;
    padding: 0 2px 0;
    margin-bottom: 4px;
    border-bottom: 2px solid var(--line);
}

.pdt-tab {
    background: transparent;
    color: var(--muted);
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 8px 8px 0 0;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.pdt-tab:hover {
    color: var(--text);
    background: #f3f6fb;
    filter: none;
}

.pdt-tab-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: transparent;
}

.pdt-tab-active:hover {
    background: transparent;
}

.pdt-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: #e8edf5;
    color: #4a5568;
}

.pdt-tab-active .pdt-tab-count {
    background: #dbeafe;
    color: #1d4ed8;
}

/* ══════════════════════════════════════════
   ПАНЕЛЬ ДЕЙСТВИЙ СПЕЦИФИКАЦИИ (bom-actions-bar)
   ══════════════════════════════════════════ */
.bom-actions-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.bom-actions-bar button,
.bom-actions-bar a {
    font-size: 13px;
    padding: 7px 12px;
}

/* ══════════════════════════════════════════
   ИКОНКИ ФАЙЛОВ В BOM (file-icons)
   ══════════════════════════════════════════ */
.file-icons {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
    line-height: 1.4;
}

.file-icon:hover {
    text-decoration: none;
    filter: brightness(0.92);
}

.file-icon-model {
    background: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}

.file-icon-src {
    background: #ede9fe;
    color: #5b21b6;
    border-color: #ddd6fe;
}

.file-icon-pdf {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}

.file-icon-none {
    background: transparent;
    color: #9ca3af;
    border-color: transparent;
    cursor: default;
    font-weight: 400;
}

/* ══════════════════════════════════════════
   ЖУРНАЛ ИЗМЕНЕНИЙ (changelog)
   ══════════════════════════════════════════ */
.changelog-list {
    display: grid;
    gap: 0;
    position: relative;
    padding-left: 24px;
}

.changelog-list::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--line);
    border-radius: 1px;
}

.changelog-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 0;
    position: relative;
}

.changelog-row:not(:last-child) {
    border-bottom: 1px solid #f0f3f8;
}

.changelog-dot {
    position: absolute;
    left: -20px;
    top: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--line);
    flex-shrink: 0;
}

.changelog-body {
    flex: 1;
    min-width: 0;
}

/* ── Кликабельные строки таблицы деталей ── */
.component-list-table tbody tr.component-row {
    cursor: pointer;
    transition: background 0.1s;
}
.component-list-table tbody tr.component-row:hover {
    background: #eef3fb;
}
.component-list-table tbody tr.component-row.bulk-selected-row {
    background: #f5fbff;
}
.component-list-table tbody tr.component-row.bulk-selected-row:hover {
    background: #e8f4ff;
}

/* ── Миниатюра в строке таблицы деталей ── */
.component-thumb-cell {
    width: 52px;
    padding: 6px 8px;
}

/* ── Статусы производственных запросов ── */
.status-pill.draft       { background: #f3f4f6; color: #374151; border-color: #d1d5db; }
.status-pill.sent        { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.status-pill.accepted    { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.status-pill.in_production { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.status-pill.ready       { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.status-pill.received    { background: #e0f2fe; color: #0c4a6e; border-color: #bae6fd; }
.status-pill.cancelled   { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* ── Статусы ответов производства ── */
.status-pill.pending          { background: #fef9c3; color: #854d0e; border-color: #fef08a; }
.status-pill.quoted           { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.status-pill.need_clarification { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.status-pill.declined         { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* ── Кнопки быстрого выбора (расходы) ── */
.expense-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.btn-preset {
    background: #f1f5fd;
    border: 1px solid #c7d5ed;
    color: #1e3a6e;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-preset:hover { background: #dbeafe; border-color: #93c5fd; }

/* ── Таблица ввода цен ── */
.price-entry-table td { vertical-align: middle; }
.price-entry-table input[type="number"] { padding: 4px 6px; }

