/* ===================== Базовые стили ===================== */
:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-600: #1d4ed8;
    --green: #16a34a;
    --green-600: #15803d;
    --red: #dc2626;
    --sidebar: #0f172a;
    --sidebar-2: #1e293b;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 8px 24px rgba(15, 23, 42, .06);
    --radius: 14px;
    --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ===================== Кнопки ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text);
    transition: .15s;
}
.btn:hover { filter: brightness(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: var(--green-600); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-danger { background: #fef2f2; color: var(--red); border-color: #fecaca; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ===================== Поля ===================== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: #fff;
    color: var(--text);
    transition: .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; min-height: 74px; }

/* ===================== Экран входа ===================== */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(1200px 600px at 20% -10%, #dbeafe 0%, transparent 60%),
                radial-gradient(1000px 600px at 100% 100%, #e0e7ff 0%, transparent 55%),
                #eef2f7;
}
.auth-card {
    width: 400px;
    max-width: 92vw;
    background: var(--surface);
    border-radius: 20px;
    padding: 40px 34px;
    box-shadow: var(--shadow);
}
.auth-logo { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; margin-bottom: 26px; }
.auth-title { margin: 0 0 6px; font-size: 22px; }
.auth-sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.auth-form { margin-top: 8px; }
.auth-error {
    background: #fef2f2; color: var(--red);
    border: 1px solid #fecaca; border-radius: var(--radius-sm);
    padding: 10px 14px; font-size: 14px; margin-bottom: 18px;
}

/* ===================== Логотип ===================== */
.logo-text { font-weight: 800; font-size: 28px; letter-spacing: .3px; }
.logo-text span { color: var(--primary); }
.brand-domain { font-size: 11px; font-weight: 600; letter-spacing: .5px; color: var(--muted); }

/* ===================== Каркас приложения ===================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 264px;
    flex-shrink: 0;
    background: var(--sidebar);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 4px 8px 22px; }
.brand .logo-text { color: #fff; }
.brand .brand-domain { color: rgba(255, 255, 255, .55); }

.menu { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.menu-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-size: 14.5px; font-weight: 500;
    transition: .15s;
}
.menu-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.menu-item:hover { background: var(--sidebar-2); color: #fff; }
.menu-item.active { background: var(--primary); color: #fff; }
.sidebar-foot { color: #64748b; font-size: 12px; padding: 12px 10px 0; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: 68px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
}
.page-title { font-size: 20px; margin: 0; font-weight: 700; }

/* Левая часть шапки: кнопка-меню + заголовок */
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-left .page-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-toggle {
    display: none; /* видна только на мобильных */
    width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
    border: 1px solid var(--border); background: #fff; color: var(--text);
    place-items: center;
}
.nav-toggle:hover { background: var(--surface-2); }
.nav-toggle svg { width: 22px; height: 22px; }
.sidebar-backdrop { display: none; }

/* Пользовательское меню */
.user-menu { position: relative; }
.user-btn {
    display: flex; align-items: center; gap: 10px;
    background: transparent; border: 1px solid transparent;
    padding: 6px 10px 6px 6px; border-radius: 999px;
    transition: .15s;
}
.user-btn:hover { background: var(--surface-2); border-color: var(--border); }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #6366f1, #2563eb);
    color: #fff; font-weight: 700; font-size: 14px;
}
.user-name { font-weight: 600; font-size: 14px; }
.chevron { width: 16px; height: 16px; color: var(--muted); }

.dropdown {
    position: absolute; right: 0; top: calc(100% + 8px);
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 6px; width: 190px; z-index: 40;
}
.dropdown[hidden] { display: none; }
.dropdown-item {
    display: block; width: 100%; text-align: left;
    padding: 10px 12px; border: none; background: transparent;
    border-radius: 8px; font-size: 14px; color: var(--text);
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger { color: var(--red); }
.dropdown-sep { height: 1px; background: var(--border); margin: 5px 4px; }

/* ===================== Контент ===================== */
.content { flex: 1; padding: 28px; }
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.head-actions { display: flex; align-items: center; gap: 12px; }
.head-filter {
    padding: 10px 40px 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    /* своя стрелка, сдвинутая от края (14px), чтобы не прилегала к краю */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    min-width: 210px;
    cursor: pointer;
}
.head-filter:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.head-search {
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat left 12px center;
    font-size: 14px;
    color: var(--text);
    min-width: 240px;
}
.head-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.cal-resp-filter { min-width: 200px; padding: 8px 40px 8px 12px; margin-left: 8px; }
.empty {
    text-align: center; color: var(--muted);
    padding: 48px 20px; font-size: 15px;
}

/* ===================== Фоны рабочего пространства ===================== */
.app .content { background: transparent; }
.bg-default .main { background: var(--bg); }
.bg-ocean .main   { background: linear-gradient(135deg, #e0f2fe, #eff6ff 45%, #f0f9ff); }
.bg-sunset .main  { background: linear-gradient(135deg, #fff1f2, #ffe4e6 40%, #fff7ed); }
.bg-forest .main  { background: linear-gradient(135deg, #ecfdf5, #f0fdf4 45%, #f7fee7); }
.bg-graphite .main{ background: linear-gradient(135deg, #eef2f7, #e2e8f0 60%, #edf1f6); }
.bg-lavender .main{ background: linear-gradient(135deg, #f5f3ff, #ede9fe 45%, #faf5ff); }
.bg-coral .main   { background: linear-gradient(135deg, #fff7ed, #ffedd5 45%, #fef2f2); }

/* ===================== Календарь ===================== */
.cal-toolbar { display: flex; align-items: center; gap: 12px; }
.cal-title { font-size: 17px; font-weight: 700; min-width: 190px; text-align: center; text-transform: capitalize; }
.cal-nav {
    width: 38px; height: 38px; border-radius: 10px;
    border: 1px solid var(--border); background: #fff;
    display: grid; place-items: center; font-size: 18px; color: var(--text);
}
.cal-nav:hover { background: var(--surface-2); }

.calendar { width: 100%; border-collapse: separate; border-spacing: 0; }
.calendar th {
    padding: 10px 8px; font-size: 12px; text-transform: uppercase;
    letter-spacing: .5px; color: var(--muted); text-align: left; font-weight: 700;
}
.calendar td {
    vertical-align: top;
    width: 14.28%;
    height: 132px;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 6px;
    position: relative;
}
.calendar td.other-month { background: var(--surface-2); }
.calendar td.today { box-shadow: inset 0 0 0 2px var(--primary); }
.cell-day {
    position: absolute; top: 4px; left: 6px; z-index: 3;
    font-size: 13px; font-weight: 700; color: var(--muted);
    background: var(--surface); padding: 1px 5px; border-radius: 5px;
}
.calendar td.today .cell-day { color: var(--primary); }

.cell-add {
    position: absolute; top: 5px; right: 6px; z-index: 3;
    width: 24px; height: 24px; border-radius: 50%;
    border: none; color: #fff; font-size: 18px; line-height: 1;
    display: grid; place-items: center;
    opacity: 0; transition: .15s; box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.calendar td:hover .cell-add { opacity: 1; }
/* На сенсорных экранах нет наведения — кнопку «＋» показываем всегда */
@media (hover: none) {
    .cell-add { opacity: 1; }
}
.cell-add.blue { background: var(--primary); }
.cell-add.blue:hover { background: var(--primary-600); }
.cell-add.green { background: var(--green); }
.cell-add.green:hover { background: var(--green-600); }

/* Данные занимают всю высоту ячейки; дата и «＋» лежат поверх них */
.cell-body {
    position: absolute; inset: 5px;
    display: flex; flex-direction: column; gap: 4px;
    overflow-y: auto; overflow-x: hidden;
    padding-top: 24px;    /* строка с датой/＋ сверху */
    padding-bottom: 22px; /* плашка «Итого» снизу */
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.cell-body::-webkit-scrollbar { width: 6px; }
.cell-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.cell-body::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.cell-body::-webkit-scrollbar-track { background: transparent; }
.cell-body .chip { flex-shrink: 0; }
.chip {
    font-size: 11.5px; line-height: 1.25;
    padding: 4px 7px; border-radius: 7px;
    background: #eff6ff; color: #1e3a8a;
    display: flex; justify-content: space-between; gap: 6px;
    cursor: default;
}
.chip.op-chip { cursor: pointer; }
.chip.op-chip:hover { filter: brightness(.97); }
.modal-foot.icons .icon-btn.danger:hover { color: var(--red); border-color: #fecaca; background: #fef2f2; }
.chip.pay { background: #ecfdf5; color: #14532d; }
.chip.pay.overdue { background: #fef2f2; color: #991b1b; }
.chip .chip-cp { color: var(--muted); white-space: nowrap; }
.chip-del {
    border: none; background: transparent; color: inherit;
    opacity: .45; font-size: 13px; padding: 0 0 0 4px; line-height: 1;
}
.chip-del:hover { opacity: 1; color: var(--red); }
.cell-total {
    position: absolute; left: 6px; right: 6px; bottom: 5px; z-index: 2;
    font-size: 11px; font-weight: 700; color: var(--text);
    border-top: 1px dashed var(--border); padding-top: 4px;
    display: flex; justify-content: space-between; gap: 6px;
    background: var(--surface); /* непрозрачный фон, чтобы прокрученные операции не просвечивали */
}
.cell-total .t-sum { color: var(--primary); }
.cell-total.pay .t-sum { color: var(--green); }

/* ===================== Контрагенты ===================== */
.cp-list { display: flex; flex-direction: column; gap: 10px; }
/* overflow: visible — чтобы меню «три точки» не обрезалось на свёрнутой карточке */
.cp-item { overflow: visible; }
.cp-row {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 18px;
}
.cp-name { font-weight: 700; font-size: 15px; flex: 1; min-width: 0; }
.cp-name .cp-inn { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.cp-name .cp-resp { font-weight: 400; color: var(--muted); }
.cp-debt { text-align: right; }
.cp-debt .debt-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.cp-debt .debt-val { font-weight: 800; font-size: 15px; }
.debt-pos { color: var(--red); }
.debt-zero { color: var(--muted); }
.debt-neg { color: var(--green); }

.icon-btn {
    width: 34px; height: 34px; border-radius: 9px;
    border: 1px solid var(--border); background: #fff;
    display: grid; place-items: center; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.cp-caret svg { transition: transform .2s; }
.cp-item.open .cp-caret svg { transform: rotate(180deg); }

.cp-details {
    display: none;
    padding: 0 18px 18px;
    border-top: 1px solid var(--border);
}
.cp-item.open .cp-details { display: block; }
.cp-details-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 12px 28px; padding-top: 16px;
}
.detail { font-size: 14px; }
.detail .d-label { color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.detail .d-val { font-weight: 600; }
.detail.full { grid-column: 1 / -1; }
.lpr-line { font-size: 13px; padding: 3px 0; }
.lpr-line b { font-weight: 600; }

/* меню три точки */
.dots-menu { position: relative; }
.dots-pop {
    position: absolute; right: 0; top: calc(100% + 6px);
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 6px; width: 180px; z-index: 20;
}
.dots-pop[hidden] { display: none; }
.dots-pop button {
    display: block; width: 100%; text-align: left;
    padding: 9px 12px; border: none; background: transparent;
    border-radius: 8px; font-size: 14px;
}
.dots-pop button:hover { background: var(--surface-2); }
.dots-pop button.danger { color: var(--red); }

/* ===================== Модальные окна ===================== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .5);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 48px 16px; z-index: 100; overflow-y: auto;
}
.modal {
    background: #fff; border-radius: 18px;
    width: 520px; max-width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: pop .18s ease;
}
.modal.wide { width: 820px; }
@keyframes pop { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 22px 24px; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 16px 24px; border-top: 1px solid var(--border);
}
.form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.form-col h4 { margin: 0 0 14px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
/* Поле ИНН с кнопкой автозаполнения */
.inn-row { display: flex; gap: 8px; align-items: stretch; }
.inn-row input { flex: 1; min-width: 0; }
.inn-row .btn { white-space: nowrap; flex-shrink: 0; }

.repeater-item {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px; margin-bottom: 10px; position: relative;
    background: var(--surface-2);
}
.repeater-item .rm {
    position: absolute; top: 8px; right: 8px;
    border: none; background: transparent; color: var(--muted);
    font-size: 16px; line-height: 1;
}
.repeater-item .rm:hover { color: var(--red); }

/* ===================== Настройки ===================== */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab {
    padding: 12px 18px; border: none; background: transparent;
    font-size: 14.5px; font-weight: 600; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--primary); border-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.settings-grid { max-width: 560px; }

/* Поле пароля с кнопкой показать/скрыть */
.pw-field { position: relative; }
.pw-field input { padding-right: 44px; }
.pw-toggle {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    width: 32px; height: 32px; border: none; background: transparent;
    display: grid; place-items: center; color: var(--muted); border-radius: 8px;
}
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.pw-toggle svg { width: 18px; height: 18px; }
.section-title { font-size: 15px; font-weight: 700; margin: 26px 0 14px; }

/* Выбор фона */
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.bg-option {
    border: 2px solid var(--border); border-radius: var(--radius);
    padding: 0; overflow: hidden; text-align: left; background: #fff;
}
.bg-option.active { border-color: var(--primary); }
.bg-swatch { height: 62px; }
.bg-option span { display: block; padding: 8px 10px; font-size: 13px; font-weight: 600; }
.sw-default { background: linear-gradient(135deg, #f1f5f9, #e2e8f0); }
.sw-ocean   { background: linear-gradient(135deg, #e0f2fe, #bae6fd); }
.sw-sunset  { background: linear-gradient(135deg, #ffe4e6, #fed7aa); }
.sw-forest  { background: linear-gradient(135deg, #dcfce7, #d9f99d); }
.sw-graphite{ background: linear-gradient(135deg, #e2e8f0, #cbd5e1); }
.sw-lavender{ background: linear-gradient(135deg, #ede9fe, #ddd6fe); }
.sw-coral   { background: linear-gradient(135deg, #ffedd5, #fecaca); }

/* ===================== Лента / таблицы ===================== */
.feed-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.feed-item:last-child { border-bottom: none; }
.feed-badge {
    width: 40px; height: 40px; border-radius: 10px;
    display: grid; place-items: center; flex-shrink: 0; font-size: 18px;
}
.feed-badge.sale { background: #eff6ff; color: var(--primary); }
.feed-badge.pay { background: #ecfdf5; color: var(--green); }
.feed-main { flex: 1; min-width: 0; }
.feed-title { font-weight: 600; font-size: 14px; }
.feed-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.feed-amt { font-weight: 800; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 13px 18px; text-align: left; font-size: 14px; }
.data-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border); }
.data-table tbody tr { border-bottom: 1px solid var(--border); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table th.num, .data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td.green { color: var(--green); font-weight: 600; }
.data-table td.red { color: var(--red); font-weight: 600; }
.data-table td.muted { color: var(--muted); }
.data-table td.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.st-table tfoot td { font-weight: 800; border-top: 2px solid var(--border); }

/* ===================== Реестр задолженностей ===================== */
.debt-table td { vertical-align: top; }
.debt-table .debt-col { min-width: 190px; }
.debt-name { font-weight: 700; color: var(--text); }
.debt-resp { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.debt-sum { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.debt-sum.red { color: var(--red); }
.debt-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.debt-days { color: var(--red); font-weight: 600; white-space: nowrap; }
.debt-none { color: var(--muted); }
.debt-schedule { display: flex; flex-direction: column; gap: 6px; }
.debt-pay { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.debt-pay:not(:last-child) { padding-bottom: 6px; border-bottom: 1px dashed var(--border); }
.debt-pay-sum { font-weight: 700; font-variant-numeric: tabular-nums; }
.debt-pay-date { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* ===================== Тосты ===================== */
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: #0f172a; color: #fff;
    padding: 12px 18px; border-radius: 10px; font-size: 14px;
    box-shadow: var(--shadow); animation: pop .18s ease;
    min-width: 220px;
}
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.badge.admin { background: #eef2ff; color: #4338ca; }

/* ===================== Лента: две колонки ===================== */
.feed-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) 1fr; gap: 20px; align-items: start; }
.col-title { margin: 0; font-size: 18px; font-weight: 700; }
.feed-col-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 88px; }

/* Новости */
.news-list { display: flex; flex-direction: column; gap: 14px; }
.news-pager { display: none; }
.news-card { padding: 18px; }
.news-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.news-head { min-width: 0; }
.news-title { font-weight: 700; font-size: 16px; line-height: 1.3; word-break: break-word; }
/* описание на 2px меньше названия, обычным шрифтом */
.news-desc { font-size: 14px; font-weight: 400; color: var(--text); margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.news-del { flex-shrink: 0; }
.news-del:hover { color: var(--red); border-color: #fecaca; background: #fef2f2; }

.news-files { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.news-file {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 10px; border: 1px solid var(--border);
    border-radius: 10px; background: var(--surface-2);
}
.news-file-thumb {
    width: 44px; height: 44px; border-radius: 8px; flex-shrink: 0;
    background-size: cover; background-position: center; border: 1px solid var(--border);
    display: block;
}
.news-file-ic {
    width: 44px; height: 44px; border-radius: 8px; flex-shrink: 0;
    display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff;
    letter-spacing: .5px;
}
.ic-pdf { background: #dc2626; }
.ic-word { background: #2563eb; }
.ic-excel { background: #16a34a; }
.ic-file, .ic-image { background: #64748b; }
.news-file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.news-file-name {
    font-weight: 600; font-size: 13.5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
a.news-file-name:hover { color: var(--primary); text-decoration: underline; }
.news-file-size { font-size: 12px; color: var(--muted); }
.file-dl {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    border: 1px solid var(--border); background: #fff;
    display: grid; place-items: center; color: var(--muted);
}
.file-dl:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.file-dl svg { width: 16px; height: 16px; }
.news-foot { margin-top: 14px; font-size: 12px; color: var(--muted); }

/* Редактирование прикреплённых файлов */
.edit-files { display: flex; flex-direction: column; gap: 6px; }
.edit-file {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface-2); font-size: 13.5px;
}
.edit-file .ef-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-file.removed { opacity: .55; text-decoration: line-through; }
.ef-rm { border: none; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; flex-shrink: 0; }
.ef-rm:hover, .edit-file.removed .ef-rm { color: var(--red); }

/* Список пользователей (чекбоксы) */
.check-list {
    display: flex; flex-direction: column; gap: 8px;
    max-height: 200px; overflow-y: auto;
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px;
}
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* Проекты (Настройки → Проект) */
.proj-list { display: flex; flex-direction: column; gap: 12px; }
.proj-card {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 14px 16px; background: #fff;
}
.proj-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.proj-name { font-weight: 700; font-size: 15px; }
.proj-actions { display: flex; gap: 4px; }
.proj-members { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.proj-chip {
    background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
    padding: 4px 12px; font-size: 13px; font-weight: 500;
}
.proj-empty { color: var(--muted); font-size: 13px; }
.proj-units { font-weight: 500; font-size: 12.5px; color: var(--muted); }

/* Единицы плана в форме проекта — в строку */
.check-inline { flex-direction: row; flex-wrap: wrap; gap: 8px 18px; max-height: none; }

/* Два поля в ряд (форма отгрузки) */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* Матрица прав доступа (Настройки → Доступ) */
.ac-hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.access-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.access-table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.access-table th, .access-table td { border-bottom: 1px solid var(--border); padding: 9px 14px; text-align: center; }
.access-table thead th { position: sticky; top: 0; z-index: 1; background: var(--bg); font-weight: 700; vertical-align: bottom; }
.access-table .ac-fn { text-align: left; white-space: nowrap; position: sticky; left: 0; background: #fff; }
.access-table thead .ac-fn { z-index: 2; background: var(--bg); padding-bottom: 12px; }
.access-table .ac-func { padding-left: 26px !important; font-weight: 500; }
.access-table .ac-sec .ac-fn { font-weight: 700; }
.access-table .ac-sec td { background: var(--bg); }
.access-table thead th.ac-user { min-width: 40px; width: 46px; padding: 10px 4px 8px; }
.access-table tbody td:not(.ac-fn) { padding: 9px 6px; }
.ac-user-cell { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.ac-name {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
    line-height: 1.15;
    font: inherit;
    font-weight: 700;
    color: inherit;
    background: none;
    border: 0;
    padding: 2px 0;
    margin: 0;
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}
.ac-name:hover { color: var(--primary); }
.ac-badge { display: block; font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .2px; }
.ac-cb { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
.ac-cb:disabled { cursor: default; opacity: .6; }
.ac-cb.ac-danger { accent-color: var(--red); }
.access-table tr.ac-block .ac-fn { color: var(--red); font-weight: 700; }

/* Доступ к данным (Настройки → Доступ к данным) */
.vis-controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.vis-controls .field { min-width: 240px; }
.vis-check-title { font-weight: 700; font-size: 13.5px; margin: 18px 0 10px; }
.vis-checks { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.vis-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.vis-check input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
.vis-summary { display: flex; flex-direction: column; gap: 12px; }
.vis-sum-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.vis-sum-viewer { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.vis-sum-row { font-size: 13.5px; color: var(--text); padding: 2px 0; }
.vis-sum-proj { font-weight: 600; color: var(--primary); }

/* Блоки План/Факт */
.pf-card { padding: 16px; }
.pf-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.pf-title { font-weight: 700; font-size: 14.5px; }
.pf-period { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.pf-refresh { width: 30px; height: 30px; }
.pf-refresh svg { width: 15px; height: 15px; }
.pf-bars { display: flex; flex-direction: column; gap: 12px; }
.pf-row { display: flex; align-items: center; gap: 10px; }
.pf-tag { width: 38px; font-size: 12px; color: var(--muted); font-weight: 600; flex-shrink: 0; }
.pf-track {
    flex: 1; height: 24px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border); overflow: hidden;
}
.pf-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.pf-fill.blue { background: var(--primary); }
.pf-fill.green { background: var(--green); display: flex; align-items: center; justify-content: center; }
.pf-fill.green.has-pct { min-width: 3.4em; }
.pf-pct {
    color: #fff; font-size: 12px; font-weight: 800; line-height: 1;
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pf-num { min-width: 92px; text-align: right; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Мини-статистика (Поступления / Задолженность) */
.side-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.side-stats.top { align-items: start; }
.dash-debt { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stat-card { padding: 16px; }
.stat-proj { font-size: 11.5px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

/* Заголовок секции проекта на дашборде */
.dash-proj {
    display: flex; align-items: center; gap: 8px;
    font-weight: 800; font-size: 15px; color: var(--text);
    margin: 8px 2px 2px; padding-top: 6px;
}
.dash-proj:first-child { margin-top: 0; padding-top: 0; }
.dash-proj-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.stat-val { font-size: 18px; font-weight: 800; margin-top: 8px; word-break: break-word; }
.stat-val.green { color: var(--green); }
.stat-val.red { color: var(--red); }
.stat-val.muted { color: var(--muted); }
.stat-sub { font-size: 14px; font-weight: 700; margin-top: 4px; }
.stat-sub.green { color: var(--green); }
.stat-sub.red { color: var(--red); }
.stat-sub.muted { color: var(--muted); }

/* ===================== Сети ===================== */
.net-tools {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    width: 100%;
    flex: 1 1 100%;
    min-width: 0;
}
.net-tools .head-search,
.net-tools .head-filter {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: 42px;
}
/* На широком экране лишняя ширина уходит поиску и территории */
.net-tools #netFo,
.net-tools #netManager { max-width: 360px; }
.net-tools .btn {
    flex: 0 0 auto;
    margin-left: 0;
    height: 42px;
    white-space: nowrap;
}
.net-scroll { overflow-x: auto; }
.net-table { min-width: 1240px; }
.net-table th, .net-table td { padding: 10px 12px; white-space: nowrap; vertical-align: middle; }
.net-table th.net-identity, .net-table td.net-identity { white-space: normal; min-width: 200px; max-width: 280px; vertical-align: top; }
.net-th-stack, .net-id-stack { display: flex; flex-direction: column; gap: 2px; line-height: 1.35; }
.net-table th.net-akb, .net-table td.net-akb { white-space: normal; vertical-align: top; }
.net-akb .net-th-stack, .net-akb .net-id-stack { align-items: flex-end; }
.net-id-meta { color: var(--muted); font-size: 12px; font-weight: 600; }
.net-table td.net-clip { white-space: normal; min-width: 140px; max-width: 220px; }
.net-actions { display: inline-flex; gap: 4px; }
.net-prod-toggle {
    border: 1px solid var(--border); background: #fff; border-radius: 8px;
    padding: 6px 10px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text);
}
.net-prod-toggle.open { border-color: var(--primary); color: var(--primary); }
.net-prod-sum { font-weight: 500; color: var(--muted); margin-left: 4px; }
.net-prod-row td { white-space: normal; background: var(--surface-2); }
.net-prods { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 20px; }
.net-prod { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-size: 13px; }
.net-st { font-weight: 700; white-space: nowrap; }
.net-prod.listed { color: var(--green); }
.net-prod.talks { color: #d97706; }
.net-prod.none { color: var(--red); }
.net-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.net-type-hint { margin: 0; font-size: 12px; line-height: 1.45; font-weight: 500; color: var(--muted); }
.net-fo-drop { position: relative; }
.net-fo-btn {
    width: 100%; text-align: left; cursor: pointer;
    padding: 10px 36px 10px 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
    font-size: 14px; font-weight: 500; color: var(--text);
}
.net-fo-btn.is-empty { color: var(--muted); }
.net-fo-menu {
    position: absolute; z-index: 6; left: 0; right: 0; top: calc(100% - 8px);
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: 0 12px 32px rgba(15, 23, 42, .12);
    padding: 8px 12px; display: flex; flex-direction: column; gap: 6px;
}
.net-fo-menu[hidden] { display: none; }
.net-form-prods {
    display: flex; flex-direction: column; gap: 8px;
    max-height: 420px; overflow: auto; padding: 4px 2px;
}
.net-form-prod { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.net-form-prod > span { white-space: nowrap; }
.net-form-prod select { width: 200px; flex: 0 0 200px; margin-left: auto; }

@media (max-width: 1100px) {
    .feed-layout { grid-template-columns: 1fr; }
    .feed-col-side { position: static; }
}

/* ===================== Мобильные устройства ===================== */
@media (max-width: 900px) {
    /* Заголовки/отступы компактнее */
    .content { padding: 16px; }
    .topbar { height: 60px; padding: 0 12px; }
    .page-title { font-size: 17px; }

    /* Кнопка-гамбургер */
    .nav-toggle { display: grid; }

    /* Боковое меню становится выдвижной панелью */
    .sidebar {
        position: fixed; top: 0; left: 0;
        width: 264px; height: 100vh; z-index: 70;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
    }
    #app.nav-open .sidebar { transform: none; }

    /* Затемнение под открытым меню */
    #app.nav-open .sidebar-backdrop {
        display: block; position: fixed; inset: 0;
        background: rgba(15, 23, 42, .5); z-index: 65;
    }

    /* Сетки — в один столбец */
    .form-cols, .side-stats, .cp-details-grid, .grid-2 { grid-template-columns: 1fr; }
    .user-name { display: none; }

    /* Поиск и фильтры — на всю ширину, чтобы не переполняли строку */
    .head-actions { width: 100%; flex-wrap: wrap; }
    .head-actions > .btn,
    .head-search, .head-filter, .cal-resp-filter { width: 100%; min-width: 0; margin-left: 0; }

    /* Вкладки настроек — горизонтальная прокрутка */
    .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .tab { white-space: nowrap; }

    /* Панель управления календарём переносится и растягивается */
    .cal-toolbar { flex-wrap: wrap; gap: 8px; }
    .cal-title { min-width: 0; flex: 1; }

    /* Календарь: дни месяца столбиком, «5, Пн.» */
    .cal-list { display: flex; flex-direction: column; gap: 8px; }
    .cal-day {
        border: 1px solid var(--border); border-radius: 12px;
        background: var(--surface); padding: 10px 12px;
    }
    .cal-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
    .cal-day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
    .cal-day .cell-day { position: static; background: transparent; padding: 0; font-size: 15px; }
    .cal-day.today .cell-day { color: var(--primary); }
    .cal-day .cell-add { position: static; opacity: 1; flex-shrink: 0; }
    .cal-day .cell-body {
        position: static; inset: auto; margin-top: 8px; padding: 0;
        overflow: visible; max-height: none;
    }
    .cal-day .cell-total { position: static; left: auto; right: auto; bottom: auto; margin-top: 8px; }

    /* Модальные окна почти на весь экран */
    .modal-overlay { padding: 14px 8px; }
    .modal, .modal.wide { width: 100%; }
    .modal-body { padding: 18px 16px; }
    .modal-head, .modal-foot { padding-left: 16px; padding-right: 16px; }

    /* Экран входа компактнее */
    .auth-card { padding: 30px 22px; }

    /* Список контрагентов: имя и сумма друг под другом, без наложения */
    .cp-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: center;
        padding: 14px;
        gap: 8px 10px;
    }
    .cp-name {
        grid-column: 1;
        grid-row: 1;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .cp-debt {
        grid-column: 1;
        grid-row: 2;
        text-align: left;
        min-width: 0;
    }
    .cp-debt .debt-label { white-space: normal; overflow-wrap: anywhere; }
    .cp-caret { grid-column: 2; grid-row: 1 / span 2; }
    .cp-row > .dots-menu { grid-column: 3; grid-row: 1 / span 2; }

    /* Лента: одна новость на экране, листается свайпом */
    .feed-col-main { min-width: 0; }
    .news-list {
        flex-direction: row;
        align-items: flex-start;
        gap: 0;
        width: 100%;
        min-width: 0;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .news-list::-webkit-scrollbar { display: none; }
    .news-list > .news-card,
    .news-list > .empty {
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }
    .news-pager {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 14px;
        margin-top: 12px;
    }
    .news-pager[hidden] { display: none; }
    .news-nav {
        width: 38px; height: 38px; border-radius: 10px;
        border: 1px solid var(--border); background: #fff;
        display: grid; place-items: center; font-size: 20px; color: var(--text);
    }
    .news-nav:disabled { opacity: .35; }
    .news-pager-label {
        min-width: 52px; text-align: center;
        font-size: 13px; font-weight: 700; color: var(--muted);
        font-variant-numeric: tabular-nums;
    }

    /* Взаиморасчёты: контрагент и долг столбиком */
    .card:has(.st-table) { background: transparent; border: none; box-shadow: none; }
    .st-table thead { display: none; }
    .st-table .st-ship, .st-table .st-pay { display: none; }
    .st-table tbody tr,
    .st-table tfoot tr {
        display: block;
        margin: 0 0 10px;
        padding: 10px 12px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--surface);
        box-shadow: var(--shadow);
    }
    .st-table td,
    .st-table tfoot td {
        display: block;
        padding: 4px 0;
        border: none;
        text-align: left;
    }
    .st-table td.st-name { font-weight: 800; font-size: 16px; }
    .st-table td.st-debt {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
        font-weight: 700;
    }
    .st-table td.st-debt::before {
        content: 'Долг';
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
    }
    .st-table td.st-debt.green::before,
    .st-table td.st-debt.red::before,
    .st-table td.st-debt.muted::before { color: var(--muted); font-weight: 700; }

    /* План/факт: карточка столбиком */
    .card:has(.plan-table) {
        background: transparent; border: none; box-shadow: none;
    }
    .plan-table thead { display: none; }
    .plan-table tbody tr,
    .plan-table tbody tr:last-child {
        display: block;
        position: relative;
        margin: 0 0 10px;
        padding: 10px 12px 6px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--surface);
        box-shadow: var(--shadow);
    }
    .plan-table td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
        padding: 7px 0;
        border: none;
        text-align: right;
    }
    .plan-table td[data-label]::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
        text-align: left;
        flex-shrink: 0;
    }
    .plan-table td.green::before,
    .plan-table td.red::before,
    .plan-table td.muted::before { color: var(--muted); font-weight: 700; }
    .plan-table td.plan-person {
        display: block;
        font-weight: 800;
        font-size: 16px;
        text-align: left;
        padding: 2px 76px 4px 0;
    }
    .plan-table td.row-actions {
        position: absolute;
        top: 8px;
        right: 8px;
        width: auto;
        padding: 0;
    }

    /* Задолженность: карточка столбиком */
    .card:has(.debt-table) { background: transparent; border: none; box-shadow: none; }
    .debt-table thead { display: none; }
    .debt-table tbody tr,
    .debt-table tbody tr:last-child {
        display: block;
        margin: 0 0 10px;
        padding: 12px 14px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--surface);
        box-shadow: var(--shadow);
    }
    .debt-table td {
        display: block;
        min-width: 0;
        padding: 0;
        border: none;
    }
    .debt-table .debt-col { min-width: 0; }
    .debt-table .debt-name { font-size: 16px; }
    .debt-table .debt-resp { margin-bottom: 8px; }
    .debt-table td.debt-dz,
    .debt-table td.debt-pdz,
    .debt-table td.debt-next {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        padding: 6px 0;
    }
    .debt-table td.debt-dz::before,
    .debt-table td.debt-pdz::before,
    .debt-table td.debt-next::before {
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
        flex-shrink: 0;
    }
    .debt-table td.debt-dz::before { content: 'ДЗ'; }
    .debt-table td.debt-pdz::before { content: 'ПДЗ'; }
    .debt-table td.debt-next::before { content: 'Ближайшая оплата'; }
    .debt-table .debt-sub { display: none; }
    .debt-table .debt-schedule { align-items: flex-end; }
    .debt-table .debt-pay { flex-direction: row-reverse; justify-content: flex-end; gap: 0; }
    .debt-table .debt-pay-date::after { content: ', '; }

    .net-tools { flex-direction: column; align-items: stretch; }
    .net-tools .head-search,
    .net-tools .head-filter,
    .net-tools #netFo,
    .net-tools #netManager,
    .net-tools .btn { width: 100%; max-width: none; flex: none; height: 42px; }
    .net-scroll { overflow: visible; }
    .net-table { min-width: 0; }
    .net-table thead { display: none; }
    .net-table, .net-table tbody { display: block; }
    .net-table tr.net-main {
        display: block;
        margin: 0 0 12px;
        padding: 12px 14px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: #fff;
    }
    .net-table tr.net-prod-row { display: block; margin: -12px 0 12px; }
    .net-table tr.net-prod-row[hidden] { display: none; }
    .net-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        white-space: normal;
        padding: 5px 0;
        border: none;
        max-width: none;
        min-width: 0;
    }
    .net-table td[data-label=""]::before { content: none; }
    .net-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
        flex-shrink: 0;
    }
    .net-table td.net-identity { min-width: 0; max-width: none; }
    .net-id-stack { align-items: flex-end; text-align: right; }
    .net-table td.num { text-align: right; }
    .net-table tr.net-prod-row td { display: block; padding: 10px 14px 14px; }
    .net-table tr.net-prod-row td::before { content: none; }
    .net-prods { grid-template-columns: 1fr; }
    .net-form-grid, .net-form-prods { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .content { padding: 12px; }
    .news-card, .pf-card, .stat-card, .cp-row { padding: 14px; }
    .data-table th, .data-table td { padding: 11px 12px; }
    .modal-head h3 { font-size: 16px; }
    /* Кнопки в подвале модалки — на всю ширину, друг под другом */
    .modal-foot { flex-direction: column-reverse; }
    .modal-foot .btn { width: 100%; }
    .modal-foot.icons { flex-direction: row; justify-content: flex-end; }
    .modal-foot.icons .icon-btn { width: 38px; }
}
