/* ============================================================
   OBED.STORE HUB — дизайн-система
   Шрифты: IBM Plex Sans / IBM Plex Mono
   ============================================================ */
:root {
    /* база */
    --ink: #17171A;
    --ink-soft: #45443F;
    --paper: #F2F1EC;
    --card: #FFFFFF;
    --line: #E5E3DC;
    --line-strong: #CBC8BF;
    --muted: #85827A;

    /* акценты */
    --red: #E03A2A;
    --red-dark: #BC2E20;
    --green: #35803F;
    --yellow: #E8A312;

    /* совместимость со старыми именами (используются из JS) */
    --brand-black: var(--ink);
    --brand-red: var(--red);
    --brand-green: var(--green);
    --brand-yellow: var(--yellow);
    --text-muted: var(--muted);

    --radius: 10px;
    --sidebar-w: 240px;
    --mono: 'IBM Plex Mono', 'SF Mono', Consolas, monospace;

    /* палитра карточек точек (приглушённая, тёплая) */
    --point-1: #EDE5D3;
    --point-2: #DFE6DA;
    --point-3: #DAE3E7;
    --point-4: #EADDDA;
    --point-5: #E6E0EC;
    --point-6: #E9E9D8;
    --point-7: #D8E5E0;
    --point-8: #ECDFCB;
    --point-9: #DFE1E8;
    --point-10: #E5DDD2;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
    font-family: 'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
}

a { color: var(--ink); }
a:hover { color: var(--red); }

::selection { background: var(--red); color: #fff; }

/* ============================================================
   Типографика
   ============================================================ */
h1 {
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.15;
}

h2 { font-weight: 700; letter-spacing: -0.015em; }

.subtitle {
    color: var(--muted);
    font-size: 1rem;
    margin-top: 6px;
    max-width: 56ch;
    text-wrap: pretty;
}

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

/* моно-подпись — фирменная деталь */
.eyebrow {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
}

/* ============================================================
   Каркас: сайдбар + контент
   ============================================================ */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: #161619;
    color: #B7B4AC;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 26px 0 0;
    z-index: 200;
}

.side-logo {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 22px;
    margin-bottom: 30px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.02rem;
    letter-spacing: -0.02em;
}
.side-logo:hover { color: #fff; }
.side-logo img { width: 30px; height: 30px; border-radius: 8px; display: block; }
.side-logo b { font-weight: 700; }
.side-logo b span { color: var(--red); }
.side-logo small {
    display: block;
    font-family: var(--mono);
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #6F6D66;
    margin-top: 1px;
}

.side-caption {
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #6F6D66;
    padding: 0 22px;
    margin: 22px 0 8px;
}

.side-link {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 22px 10px 20px;
    border-left: 2px solid transparent;
    color: #B7B4AC;
    text-decoration: none;
    font-size: 0.93rem;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
}
.side-link .side-num {
    font-family: var(--mono);
    font-size: 0.66rem;
    color: #6F6D66;
    transition: color 0.15s;
}
.side-link:hover { color: #fff; }
.side-link:hover .side-num { color: var(--red); }
.side-link.active {
    color: #fff;
    background: #1F1F23;
    border-left-color: var(--red);
}
.side-link.active .side-num { color: var(--red); }

.side-user {
    margin-top: auto;
    border-top: 1px solid #26262B;
    padding: 16px 22px 18px;
}
.side-user-name { color: #fff; font-size: 0.88rem; font-weight: 600; line-height: 1.3; }
.side-user-role {
    font-family: var(--mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #6F6D66;
    margin-top: 2px;
}
.side-logout {
    margin-top: 12px;
    background: none;
    border: none;
    padding: 0;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: #85827A;
    cursor: pointer;
    transition: color 0.15s;
}
.side-logout:hover { color: var(--red); }
.side-logout::before { content: '→ '; color: var(--red); }

/* мобильная шапка */
.topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 210;
    background: #161619;
    color: #fff;
    align-items: center;
    gap: 14px;
    padding: 0 16px;
    height: 54px;
    width: 100%;
}
.topbar-burger {
    background: none;
    border: 1px solid #33333A;
    border-radius: 7px;
    color: #fff;
    width: 34px;
    height: 34px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}
.topbar-logo { color: #fff; text-decoration: none; font-weight: 700; font-size: 0.95rem; letter-spacing: -0.02em; }
.topbar-logo span { color: var(--red); }
.side-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 22, 0.5);
    z-index: 195;
}

.container {
    flex: 1;
    min-width: 0;
    padding: 44px 44px 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-header { margin-bottom: 30px; }
.page-header .eyebrow { display: block; margin-bottom: 10px; }

footer {
    margin-top: auto;
    padding: 56px 0 28px;
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    color: var(--muted);
}

/* ============================================================
   Карточки-панели
   ============================================================ */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px;
}

.card-title-small {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    padding-bottom: 14px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

/* ---- карточки сервисов на хабе ---- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 14px;
}

.hub-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px 24px 20px;
    min-height: 216px;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--ink);
    position: relative;
    transition: border-color 0.15s;
}
.hub-card .hub-num {
    align-self: flex-start;
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 26px;
    transition: color 0.15s;
}
.hub-card .card-title {
    font-size: 1.16rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin-bottom: 6px;
}
.hub-card .card-desc {
    font-size: 0.86rem;
    color: var(--muted);
    line-height: 1.5;
    text-wrap: pretty;
}
.hub-card .hub-arrow {
    position: absolute;
    top: 20px;
    right: 22px;
    font-size: 1.05rem;
    color: var(--line-strong);
    transition: color 0.15s, transform 0.15s;
}
a.hub-card:hover { border-color: var(--ink); color: var(--ink); }
a.hub-card:hover .hub-num { color: var(--red); }
a.hub-card:hover .hub-arrow { color: var(--red); transform: translateX(3px); }

.hub-card.hub-soon { background: transparent; border-style: dashed; }
.hub-card.hub-soon .card-title { color: var(--ink-soft); }

.status-badge {
    margin-top: auto;
    padding-top: 18px;
    font-family: var(--mono);
    font-size: 0.64rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    display: flex;
    align-items: center;
    gap: 7px;
}
.status-badge::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}
.status-active { color: var(--green); }
.status-dev { color: var(--yellow); }
.status-soon { color: var(--muted); }
.status-soon::before { background: transparent; border: 1.5px solid currentColor; }

/* ============================================================
   Панель управления (тулбар над таблицей)
   ============================================================ */
.controls-panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px 24px;
}

.input-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.date-control-wrapper { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.control-label {
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.status-text {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--green);
    min-width: 0;
}

/* ============================================================
   Кнопки, инпуты, чипы
   ============================================================ */
.btn {
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--red); }
.btn-primary:disabled { background: var(--line-strong); cursor: wait; }
.btn-secondary { background: transparent; border-color: var(--line-strong); color: var(--ink-soft); }
.btn-secondary:hover { border-color: var(--ink); color: var(--ink); }
.btn:not(.btn-primary):not(.btn-secondary) {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--ink-soft);
}
.btn:not(.btn-primary):not(.btn-secondary):hover { border-color: var(--ink); color: var(--ink); }

.styled-date-input, .styled-text-input, select.styled-text-input {
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 9px 13px;
    transition: border-color 0.15s;
}
.styled-date-input { font-family: var(--mono); font-size: 0.84rem; cursor: pointer; }
.styled-text-input { min-width: 210px; }
.styled-date-input:focus, .styled-text-input:focus {
    outline: none;
    border-color: var(--ink);
}
.styled-text-input::placeholder { color: var(--muted); }

.date-input-container { position: relative; display: flex; align-items: center; }
.calendar-icon { display: none; }

.quick-dates { display: flex; gap: 6px; }
.chip {
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-soft);
    background: transparent;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip:active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ============================================================
   Алерты
   ============================================================ */
.alert-danger {
    background: #FBEBE8;
    border: 1px solid #EFC7C0;
    border-left: 3px solid var(--red);
    color: #8C2317;
    border-radius: 8px;
    padding: 13px 18px;
    font-size: 0.88rem;
    margin-bottom: 18px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.alert-danger:hover { border-color: var(--red); }

/* ============================================================
   Таблица номенклатуры
   ============================================================ */
.table-wrapper {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

thead { border-bottom: 2px solid var(--ink); }

th {
    text-align: left;
    padding: 13px 22px;
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--muted);
    user-select: none;
    background: var(--card);
}
th.sortable { cursor: pointer; transition: color 0.15s; }
th.sortable:hover { color: var(--ink); }
.sort-indicator { margin-left: 6px; display: inline-block; width: 12px; color: var(--red); }

td {
    padding: 13px 22px;
    border-bottom: 1px solid var(--line);
    font-size: 0.92rem;
    vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAF9F6; }

thead th:nth-child(1), tbody td:nth-child(1) { width: 78%; }
thead th:nth-child(2), tbody td:nth-child(2) { width: 22%; text-align: center; }

.qty-cell {
    font-family: var(--mono);
    font-size: 0.88rem;
    font-weight: 600;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 3px 12px;
    display: inline-block;
    min-width: 52px;
}

.cat-tag {
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 2px 7px;
    margin-right: 4px;
    display: inline-block;
}
.cat-tag-warn { color: var(--red); border-color: #EFC7C0; background: #FBEBE8; }

.composition-toggle {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--red);
    cursor: pointer;
    margin-left: 8px;
    user-select: none;
}
.composition-toggle:hover { color: var(--red-dark); }

.composition-text {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    font-size: 0.8rem;
    color: var(--muted);
    padding-left: 12px;
    border-left: 2px solid var(--line-strong);
    transition: all 0.25s ease-in-out;
}
.composition-text.visible {
    max-height: 500px;
    opacity: 1;
    margin-top: 7px;
    padding-top: 2px;
    padding-bottom: 2px;
}

/* ============================================================
   Заказы по точкам
   ============================================================ */
.orders-grid { display: flex; flex-direction: column; gap: 16px; width: 100%; }

.order-card {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.order-header {
    padding: 13px 18px;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    border-bottom: 1px solid var(--line);
}

/* блюда точки раскладываются сеткой по ширине экрана */
.order-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    column-gap: 36px;
    padding: 4px 18px 10px;
}

.order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.item-name-details { display: flex; flex-direction: column; }
.item-main-name { font-size: 0.87rem; font-weight: 500; }
.item-composition { font-size: 0.72rem; color: var(--muted); }
.item-qty {
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 2px 9px;
    flex-shrink: 0;
}

.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--muted);
    column-span: all;
}
.empty-state h3 { font-weight: 600; font-size: 1rem; }

/* ============================================================
   Управление
   ============================================================ */
.management-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.management-section { margin-top: 44px; }

.form-layout { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 7px; }

.category-tree ul {
    list-style: none;
    padding-left: 20px;
    border-left: 1px solid var(--line);
    margin-left: 10px;
}
.category-tree > ul { border-left: none; margin-left: 0; padding-left: 0; }
.category-tree li { padding: 1px 0; font-weight: 500; font-size: 0.9rem; }

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 7px;
    transition: background 0.15s;
}
.category-item:hover { background: var(--paper); }
.category-item:hover .category-actions { opacity: 1; }

.category-actions { opacity: 0; transition: opacity 0.15s; display: flex; gap: 10px; }

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0;
}
.action-btn.btn-add-child, .action-btn.btn-edit-user { color: var(--green); }
.action-btn.btn-delete-category, .action-btn.btn-delete-user { color: var(--red); }
.action-btn:hover { text-decoration: underline; }
.action-btn:disabled { color: var(--line-strong); cursor: not-allowed; text-decoration: none; }

.product-list-container {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.product-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--line);
}
.product-row:last-child { border-bottom: none; }
.product-row:hover { background: #FAF9F6; }

.product-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.product-name { font-weight: 600; font-size: 0.88rem; }
.product-composition { font-size: 0.74rem; color: var(--muted); }

.product-tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.tag {
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 500;
    color: var(--ink-soft);
    background: var(--paper);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 3px 10px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.tag-remove { cursor: pointer; color: var(--red); font-weight: 700; }
.tag-remove:hover { color: var(--red-dark); }

.tag-add {
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 500;
    background: transparent;
    border: 1px dashed var(--line-strong);
    border-radius: 999px;
    color: var(--muted);
    padding: 3px 10px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.tag-add:hover { color: var(--ink); border-color: var(--ink); }

/* контекстное меню */
.context-menu {
    position: fixed;
    background: var(--card);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    box-shadow: 0 12px 32px -8px rgba(23, 23, 26, 0.18);
    z-index: 2000;
    max-height: 300px;
    overflow-y: auto;
    min-width: 230px;
    padding: 6px 0;
}
.menu-item { padding: 8px 15px; font-size: 0.85rem; font-weight: 500; cursor: pointer; }
.menu-item:hover { background: var(--paper); }

/* ============================================================
   Модальное окно
   ============================================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(23, 23, 26, 0.45);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    padding: 20px;
}
.modal.open { display: flex; }

.modal-content {
    background: var(--card);
    border: 1px solid var(--line);
    padding: 28px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    box-shadow: 0 24px 60px -12px rgba(23, 23, 26, 0.3);
}

.filter-item { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 0; font-size: 0.9rem; }
.filter-item input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--red); }

/* ============================================================
   Админ-панель
   ============================================================ */
.service-email {
    display: block;
    font-family: var(--mono);
    font-size: 0.72rem;
    background: var(--paper);
    border: 1px dashed var(--line-strong);
    border-radius: 7px;
    padding: 9px 12px;
    margin-top: 8px;
    cursor: pointer;
    text-align: center;
    word-break: break-all;
    transition: border-color 0.15s;
}
.service-email:hover { border-color: var(--ink); }

.alert-info {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 0.84rem;
    margin-bottom: 20px;
}

.form-subhead { font-size: 0.95rem; font-weight: 700; margin-bottom: 12px; }
.form-divider { border: none; border-top: 1px dashed var(--line-strong); margin: 22px 0; }

/* ============================================================
   Страница входа
   ============================================================ */
body.login-page {
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.login-card {
    width: 100%;
    max-width: 384px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 40px 36px 36px;
    animation: loginIn 0.4s ease-out;
}
@keyframes loginIn {
    from { transform: translateY(14px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.login-logo img { width: 42px; height: 42px; border-radius: 11px; }
.login-logo .brand-word { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.02em; line-height: 1.2; }
.login-logo .brand-word span { color: var(--red); }
.login-logo .brand-sub {
    font-family: var(--mono);
    font-size: 0.6rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--muted);
}
.login-header h2 { font-size: 1.3rem; margin-bottom: 2px; }
.login-header p { font-size: 0.86rem; }
.login-header { margin-bottom: 22px; }
.error-msg {
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--red);
    min-height: 1.3em;
    margin-bottom: 10px;
}

/* ============================================================
   Учёт рабочего времени
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.stat-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stat-label {
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}
.stat-value {
    font-family: var(--mono);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.stat-red { color: var(--red); }

.ts-upload-status {
    background: #EDF3EA;
    border: 1px solid #C9DCC4;
    border-left: 3px solid var(--green);
    color: #24522C;
    border-radius: 8px;
    padding: 12px 18px;
    font-size: 0.86rem;
    margin-bottom: 18px;
}
.ts-upload-status.ts-upload-error {
    background: #FBEBE8;
    border-color: #EFC7C0;
    border-left-color: var(--red);
    color: #8C2317;
}

/* таблица отчёта: переопределяем ширины базовой таблицы */
.ts-table { overflow-x: auto; }
.ts-table table { min-width: 900px; }
.ts-table thead th, .ts-table tbody td { width: auto !important; text-align: left !important; }
.ts-table th, .ts-table td { padding: 11px 14px; }
.ts-table td { font-size: 0.86rem; }

.ts-row { cursor: pointer; }
.ts-name { font-weight: 600; font-size: 0.88rem; }
.ts-position { font-size: 0.72rem; color: var(--muted); }
.ts-num { font-family: var(--mono); font-size: 0.82rem; white-space: nowrap; }
.ts-total { font-weight: 600; }
.ts-warn { color: var(--red); }
.ts-viol { font-size: 0.74rem; color: var(--ink-soft); white-space: nowrap; }
.ts-rate-type { color: var(--muted); font-size: 0.68rem; }
.ts-archived .ts-name, .ts-archived .ts-num { color: var(--muted); }
.ts-archived .ts-name::after {
    content: 'архив';
    font-family: var(--mono);
    font-size: 0.6rem;
    color: var(--muted);
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 8px;
    vertical-align: 1px;
}
.ts-actions { text-align: right !important; }

.ts-row td { transition: background 0.12s; }
.ts-row.ts-open td { background: #FAF9F6; border-bottom-color: transparent; }

.ts-detail-row td.ts-detail-cell {
    background: #FAF9F6;
    padding: 4px 22px 20px;
    border-bottom: 1px solid var(--line);
}
.ts-detail-inner {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
.ts-detail-table { width: 100%; border-collapse: collapse; }
.ts-detail-table th {
    background: var(--paper);
    padding: 8px 14px;
    font-size: 0.6rem;
    border-bottom: 1px solid var(--line);
}
.ts-detail-table td {
    padding: 7px 14px;
    font-family: var(--mono);
    font-size: 0.76rem;
    border-bottom: 1px solid var(--line);
    background: transparent !important;
    vertical-align: middle;
}
.ts-detail-table tr:last-child td { border-bottom: none; }
.ts-detail-table tr.ts-absence td { color: var(--red); background: #FDF4F2 !important; }
.ts-detail-table td:first-child { font-weight: 600; }

.modal-content.ts-modal { max-width: 560px; }
.ts-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ts-modal .styled-text-input { width: 100%; min-width: 0; }
.ts-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
    .ts-form-row { grid-template-columns: 1fr; }
}

/* ============================================================
   Адаптивность
   ============================================================ */
@media (max-width: 900px) {
    body { flex-direction: column; }
    .topbar { display: flex; }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 24px 0 60px rgba(0,0,0,0.25);
    }
    body.side-open .sidebar { transform: translateX(0); }
    body.side-open .side-overlay { display: block; }
    .container { padding: 26px 18px 0; }
    .management-grid { grid-template-columns: 1fr; }
    .controls-panel { flex-direction: column; align-items: stretch; }
    .input-group { width: 100%; }
    .styled-text-input { min-width: 0; flex: 1; }
    thead th:nth-child(1), tbody td:nth-child(1) { width: 70%; }
    thead th:nth-child(2), tbody td:nth-child(2) { width: 30%; }
    th, td { padding: 11px 14px; }
    .btn { padding: 11px 18px; }
    .chip { padding: 8px 15px; }
}
