[hidden] { display: none !important; }  /* атрибут hidden должен скрывать и элементы с display: flex/grid */
/* Стиль близкий к Google Таблицам: светлый фон, тонкие сетки, зелёный акцент */
:root {
  --bg: #f8f9fa; --surface: #fff; --text: #202124; --muted: #5f6368; --border: #dadce0;
  --grid: #e2e3e3; --header: #f1f3f4; --accent: #188038; --accent-dark: #137333; --accent-soft: #e6f4ea;
  --danger: #c5221f; --danger-soft: #fce8e6; --select: #e8f0fe;
  --fs: 1;  /* масштаб шрифтов, выбирается в шапке (Шрифт: A− A A+) */
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: calc(14px * var(--fs))/1.45 "Roboto", "Segoe UI", Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: #1a73e8; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: calc(20px * var(--fs)); font-weight: 500; margin: 0; }
h2 { font-size: calc(16px * var(--fs)); font-weight: 500; margin: 0 0 12px; }
code { background: var(--header); padding: 1px 5px; border-radius: 4px; }

.logo { display: inline-grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700;
  font-size: calc(12px * var(--fs)); width: 36px; height: 28px; border-radius: 6px; margin-right: 8px; }

.topbar { height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; color: var(--text); font-size: calc(17px * var(--fs)); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-right form { margin: 0; }
.new-requests { color: #c5221f; font-weight: 700; margin-right: auto; margin-left: 12px; white-space: nowrap; }
.user { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.layout { display: flex; min-height: calc(100vh - 52px); }
.sidebar { width: 240px; flex-shrink: 0; padding: 12px 8px; background: var(--surface); border-right: 1px solid var(--border); }
.sidebar a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; margin-bottom: 2px; border-radius: 0 20px 20px 0;
  color: var(--text); }
.sidebar a:hover { background: var(--header); text-decoration: none; }
.sidebar a.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 500; }
.content { flex: 1; min-width: 0; padding: 16px 24px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--border);
  border-radius: 4px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.btn:hover { background: var(--header); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { border-color: transparent; }
.btn-block { width: 100%; justify-content: center; padding: 10px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 20px; margin-bottom: 16px; }
.form-card { max-width: 520px; }
.hint { color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; font-weight: 500; }
.field input, .field select { font: inherit; font-weight: 400; padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; background: #fff; }
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.field-check { flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; }
.field .help { color: var(--muted); font-weight: 400; }
.field .help ul { margin: 4px 0; padding-left: 18px; }
.field .error { color: var(--danger); font-weight: 400; }

.messages { margin-bottom: 12px; }
.msg { padding: 10px 14px; border-radius: 4px; margin-bottom: 8px; background: var(--accent-soft); color: var(--accent-dark); }
.msg-error { background: var(--danger-soft); color: var(--danger); }

/* Таблица в стиле Google Sheets */
.sheet-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); }
.sheet { border-collapse: collapse; width: 100%; font-size: calc(13px * var(--fs)); }
.sheet th, .sheet td { border: 1px solid var(--grid); padding: 6px 10px; text-align: left; white-space: nowrap; }
.sheet thead th { background: var(--header); color: var(--muted); font-weight: 500; position: sticky; top: 0; }
.sheet .rownum { background: var(--header); color: var(--muted); text-align: center; width: 40px; }
.sheet tbody tr:hover td:not(.rownum) { background: var(--select); }
.sheet tr.muted td { color: var(--muted); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: calc(12px * var(--fs)); background: var(--header); }
.tag-admin { background: #fce8e6; color: #a50e0e; }
.tag-manager { background: #e8f0fe; color: #174ea6; }
.tag-accountant { background: #fef7e0; color: #8a5a00; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); }
.tile:hover { border-color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.08); text-decoration: none; }
.tile-icon { font-size: calc(28px * var(--fs)); }
.tile-title { font-size: calc(16px * var(--fs)); font-weight: 500; }
.tile-sub { color: var(--muted); font-size: calc(12px * var(--fs)); }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; }
.login-head { display: flex; align-items: center; margin-bottom: 20px; }
.login-head h1 { font-size: calc(20px * var(--fs)); }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: auto; display: flex; overflow-x: auto; padding: 6px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar a { border-radius: 16px; white-space: nowrap; }
  .content { padding: 16px; }
  .user { display: none; }
}

/* ---- Сертификаты и разрешения ---- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters input[type=search], .filters select { font: inherit; padding: 7px 10px; border: 1px solid var(--border); border-radius: 4px; background: #fff; }
.filters input[type=search] { flex: 1 1 260px; min-width: 0; }
.sheet tr.clickable { cursor: pointer; }
.sheet td.wrap { white-space: normal; min-width: 140px; }
.sheet td.desc { min-width: 260px; max-width: 380px; color: var(--muted); }
.mono { font-family: "Roboto Mono", Consolas, monospace; font-size: calc(12.5px * var(--fs)); }
.need { color: #b06000; }
.status { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: calc(12px * var(--fs)); white-space: nowrap; }
.status-valid { background: var(--accent-soft); color: var(--accent-dark); }
.status-expiring { background: #fef7e0; color: #8a5a00; }
.status-expired { background: var(--danger-soft); color: var(--danger); }
.status-future { background: #e8f0fe; color: #174ea6; }
.empty { text-align: center; padding: 40px 20px; }
.small { font-size: calc(12px * var(--fs)); }
.msg-warning { background: #fef7e0; color: #8a5a00; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a50e0e; }

.split { display: grid; grid-template-columns: minmax(320px, 460px) 1fr; gap: 16px; align-items: start; }
.split-even { grid-template-columns: 1fr 1fr; }
.split-preview { position: sticky; top: 68px; }
.split-preview iframe { width: 100%; height: calc(100vh - 150px); min-height: 420px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.field textarea { font: inherit; font-weight: 400; padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; resize: vertical; }
.field.is-auto input, .field.is-auto select, .field.is-auto textarea { background: #f1f8f3; border-color: #81c995; }
.field.is-need input, .field.is-need select { background: #fffbeb; border-color: #f9c74f; }
.chip { display: inline-block; font-size: calc(11px * var(--fs)); font-weight: 400; padding: 0 6px; border-radius: 8px; margin-left: 4px; vertical-align: middle; }
.chip-auto { background: #e6f4ea; color: var(--accent-dark); }
.chip-need { background: #fff3cd; color: #8a5a00; }
.legend { font-size: calc(12px * var(--fs)); color: var(--muted); margin-bottom: 14px; }
.small-link { font-size: calc(12px * var(--fs)); font-weight: 400; margin-left: 6px; }
.form-actions { display: flex; gap: 8px; }
.props { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; margin: 0; }
.props dt { color: var(--muted); }
.props dd { margin: 0; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 16px; margin: 12px 0 16px;
  border: 2px dashed var(--border); border-radius: 8px; text-align: center; cursor: pointer; color: var(--muted); }
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-icon { font-size: calc(32px * var(--fs)); }
.dropzone input { max-width: 100%; }
.scroll-y { max-height: 420px; overflow-y: auto; }
.danger-zone { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.field-check { display: flex; gap: 6px; align-items: center; }

@media (max-width: 1000px) {
  .split, .split-even { grid-template-columns: 1fr; }
  .split-preview { position: static; }
  .split-preview iframe { height: 70vh; }
}
.status-revoked { background: #e8eaed; color: #3c4043; text-decoration: line-through; }
.req { color: var(--danger); margin-left: 2px; }
.btn-small { padding: 3px 10px; font-size: calc(12px * var(--fs)); }
.btn-danger-ghost { color: var(--danger); border-color: transparent; background: transparent; }
.btn-danger-ghost:hover { background: var(--danger-soft); }

/* ---- Контейнеры: таблица ---- */
.grid { background: #fff; border: 1px solid var(--border); font-size: calc(13px * var(--fs)); }
.grid.tabulator { border-radius: 0; }
.grid .tabulator-header { background: var(--header); }
.grid .tabulator-header .tabulator-col { background: var(--header); }
.grid .tabulator-col-title { white-space: normal !important; color: var(--muted); font-weight: 500; font-size: calc(12px * var(--fs)); line-height: 1.25; }
.grid .tabulator-row .tabulator-cell { border-right: 1px solid var(--grid); padding: 6px 8px; }
.grid .tabulator-row { border-bottom: 1px solid var(--grid); }
.grid .tabulator-row.tabulator-row-even { background: #fff; }
.grid .tabulator-row:hover { background: var(--select) !important; }
.grid .tabulator-cell.wrap-cell { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; height: auto; line-height: 1.3; }
.grid .tabulator-cell.tabulator-editing { outline: 2px solid var(--accent); outline-offset: -2px; background: #fff; }
.grid .rownum-cell { background: var(--header) !important; color: var(--muted); }
.grid .calc-cell { background: #f8f9fa; color: var(--muted); }
.grid .has-note { color: #8a5a00; font-style: italic; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #323232; color: #fff;
  padding: 10px 18px; border-radius: 6px; z-index: 50; font-size: calc(13px * var(--fs)); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.toast-error { background: var(--danger); }

/* ---- Платежи ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.kpi-main { border-color: #81c995; background: #f6fbf7; }
.kpi-label { color: var(--muted); font-size: calc(13px * var(--fs)); }
.kpi-value { font-size: calc(26px * var(--fs)); font-weight: 500; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--muted); font-size: calc(12px * var(--fs)); }
.block { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.block-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.block-head h2 { margin: 0; }
.block-head input[type=search] { font: inherit; padding: 7px 10px; border: 1px solid var(--border); border-radius: 4px; min-width: 260px; }
.add-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px; margin-bottom: 12px; background: var(--header); border-radius: 6px; }
.add-form label { display: flex; flex-direction: column; gap: 4px; font-size: calc(12px * var(--fs)); color: var(--muted); }
.add-form label.grow { flex: 1 1 200px; }
.add-form input { font: inherit; font-size: calc(14px * var(--fs)); padding: 7px 10px; border: 1px solid var(--border); border-radius: 4px; background: #fff; color: var(--text); }
.fts-col { width: 25%; min-width: 360px; max-width: 100%; }
.kpis-stack { grid-template-columns: 1fr; gap: 8px; margin-bottom: 12px; }
.kpis-stack .kpi { display: grid; grid-template-columns: 1fr auto; align-items: baseline; column-gap: 12px; row-gap: 2px; padding: 10px 14px; }
.kpis-stack .kpi-value { font-size: calc(18px * var(--fs)); white-space: nowrap; text-align: right; }
.kpis-stack .kpi-sub { grid-column: 1 / -1; }
.block-compact { padding: 12px; }
.block-compact .block-head { margin-bottom: 8px; }
.block-compact .block-head h2 { font-size: calc(16px * var(--fs)); }
.block-compact .block-head input[type=search] { min-width: 0; width: 100%; }
.block-compact .add-form { padding: 8px; gap: 8px; margin-bottom: 8px; flex-wrap: nowrap; }
.block-compact .add-form label.grow { flex: 1 1 0; min-width: 0; }
.block-compact .add-form .btn { white-space: nowrap; }
.block-compact .add-form input { width: 100%; box-sizing: border-box; }
@media (max-width: 480px) { .fts-col { min-width: 0; width: 100%; } }
/* карточка контейнера: параметры расчета и товары */
.props-inline { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 14px; font-size: calc(13px * var(--fs)); }
.props-inline dt { color: var(--muted); }
.props-inline dd { margin: 0 14px 0 0; font-weight: 500; }
.calc-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; margin-bottom: 12px; }
.params { display: grid; grid-template-columns: repeat(2, minmax(150px, 190px)); gap: 8px 12px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.param { display: flex; flex-direction: column; gap: 3px; font-size: calc(12px * var(--fs)); color: var(--muted); }
.param input { font: inherit; font-size: calc(15px * var(--fs)); padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; text-align: right; color: var(--text); background: #fff; }
.param input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.param-value { font-size: calc(15px * var(--fs)); color: var(--text); }
.sheet.summary { width: auto; background: var(--surface); font-variant-numeric: tabular-nums; }
.sheet.summary td { text-align: right; min-width: 120px; }
.sheet.summary th { background: var(--header); }
.sheet.summary td.neg { color: var(--danger); }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: calc(12px * var(--fs)); color: var(--muted); }
.sw { display: inline-block; width: 14px; height: 14px; border: 1px solid var(--border); border-radius: 2px; margin-left: 6px; }
.sw-in { background: #fff; }
.sw-calc, .items-grid .f-cell { background: #dbe7fb !important; }
.items-grid .tabulator-cell { background: #fff; }
.items-grid .tabulator-footer .tabulator-cell, .items-grid .tabulator-calcs-bottom .tabulator-cell { background: var(--header); font-weight: 500; }
.contacts-table input { font: inherit; padding: 5px 8px; border: 1px solid var(--border); border-radius: 4px; width: 100%; box-sizing: border-box; min-width: 140px; }
.sheet td.center { text-align: center; }
@media (max-width: 600px) { .params { grid-template-columns: 1fr 1fr; width: 100%; box-sizing: border-box; } }
.ov-col { width: 33%; min-width: 420px; }
.import-form { flex-wrap: wrap !important; }
.import-form input[type=file] { padding: 4px; }
.add-form label.check { flex-direction: row; align-items: center; gap: 6px; font-size: calc(12px * var(--fs)); }
.add-form label.check input { width: auto; }
@media (max-width: 480px) { .ov-col { min-width: 0; width: 100%; } }
.param-wide { grid-column: 1 / -1; }
.sw-red { background: #f9d6d5; }
.sw-yellow { background: #fff3c4; }
.sw-orange { background: #ffd9b3; }
.sw-green { background: #d4f0d9; }
.items-grid .tabulator-row.row-red .tabulator-cell { background: #fce4e2; }
.items-grid .tabulator-row.row-red .tabulator-cell.f-cell { background: #f3d2d6 !important; }
.items-grid .tabulator-row.row-orange .tabulator-cell { background: #ffe3c7; }
.items-grid .tabulator-row.row-orange .tabulator-cell.f-cell { background: #f5d5b8 !important; }
.items-grid .tabulator-row.row-yellow .tabulator-cell { background: #fff6d1; }
.items-grid .tabulator-row.row-yellow .tabulator-cell.f-cell { background: #e9e6c8 !important; }
/* строка «Итого» над заголовками, как строка 8 в Excel */
.items-grid .tabulator-header-contents { display: flex; flex-direction: column; }
.items-grid .tabulator-header, .items-grid .tabulator-header-contents { height: auto !important; min-height: 0 !important; }
.items-grid .tabulator-header-contents .tabulator-calcs-holder { order: -1; border-top: 0 !important; border-bottom: 1px solid var(--border); }
.items-grid .tabulator-calcs-top .tabulator-cell { background: #eef3e8 !important; font-weight: 600; }
.items-grid .tabulator-header-contents > br { display: none; }
.block-compact .import-form label.grow { flex: 1 1 100%; }
.block-compact .import-form input[type=file] { width: 100%; background: #fff; }
.storage-block { margin-bottom: 12px; }
.storage-block p { margin: 6px 0 0; }
.lock-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); font-size: calc(13px * var(--fs)); color: var(--muted); }
.lock-bar.locked { background: #e8f0fe; border-color: #aecbfa; color: var(--text); }
.lock-bar form { margin: 0; }
/* справочник «Данные о товарах» */
.products-top { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.products-top > .block { flex: 1 1 360px; max-width: 640px; margin: 0; }
.products-grid .tabulator-row { min-height: 40px; }
.products-grid .thumb { height: 32px; max-width: 48px; object-fit: contain; vertical-align: middle; margin-right: 4px; }
.products-grid .tabulator-cell.cell-missing, .tech-table td.missing { background: #fce4e2 !important; }
.products-grid .row-no-amount .tabulator-cell[tabulator-field=amount] { background: #fce4e2; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: calc(13px * var(--fs)); color: var(--muted); }
.product-card { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; max-width: 1100px; }
.product-card .photo-box { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px; text-align: center; }
.product-card .photo-box img { max-width: 100%; max-height: 260px; object-fit: contain; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .field-wide { grid-column: 1 / -1; }
@media (max-width: 800px) { .product-card, .form-grid { grid-template-columns: 1fr; } }
.missing-block { padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: calc(13px * var(--fs)); min-width: 260px; }
.missing-title { font-weight: 600; margin-bottom: 6px; }
.missing-line { color: #188038; margin: 3px 0; }
.missing-line.has { color: var(--danger); }
.items-grid .tabulator-cell a { color: var(--accent); }
.tech-todo { margin-bottom: 12px; }
.tech-todo .sheet td.wrap { max-width: 420px; }
.tech-table th { white-space: normal; min-width: 70px; max-width: 160px; vertical-align: bottom; }
.tech-table td.desc { white-space: normal; }
.tech-table .clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tech-table .thumb { height: 48px; max-width: 80px; object-fit: contain; }
.error { color: var(--danger); }
/* документы контейнера */
.broker-block { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.broker-block .msg { flex: 1 1 100%; margin: 0; }
.broker-block .msg ul { margin: 6px 0 0; padding-left: 20px; }
.broker-block.ready { border-color: #81c995; background: #f6fbf7; }
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.docs-grid .block-head h2 { font-size: calc(16px * var(--fs)); }
.docs-grid .block-head .btn { margin-left: 4px; }
.doc-list { margin: 0; padding-left: 18px; line-height: 1.6; }
.docs-permits { grid-column: 1 / -1; }
.ok { color: #188038; }
.docs-btn { white-space: nowrap; }
.calc-head .sheet.summary td { min-width: 96px; }
.calc-head .missing-block { min-width: 0; }
/* инструкция */
.help-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; max-width: 1200px; }
.help-toc { position: sticky; top: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; font-size: calc(14px * var(--fs)); }
.help-toc ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.8; }
.help-body .card { line-height: 1.55; scroll-margin-top: 12px; }
.help-body h2 { margin-top: 0; }
.help-body h3 { font-size: calc(15px * var(--fs)); margin: 16px 0 6px; }
.help-body li { margin: 3px 0; }
.help-table td, .help-table th { white-space: normal; }
.faq dt { font-weight: 600; margin-top: 10px; }
.faq dd { margin: 4px 0 0 0; color: var(--muted); }
@media (max-width: 800px) { .help-layout { grid-template-columns: 1fr; } .help-toc { position: static; } }
.grid .gtd-cell { cursor: pointer; }
.grid .gtd-cell:hover { background: var(--accent-soft); }
.payments-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.gtd-col { flex: 1 1 420px; max-width: 760px; }
.gtd-wrap { max-height: calc(100vh - 200px); overflow-y: auto; }
.sheet td.num, .sheet th.num { text-align: right; font-variant-numeric: tabular-nums; }
.kpi-table { width: 100%; margin: 0; }
.kpi-table td { padding: 4px 14px; }
/* Платежи банк */
.bank-block { margin-bottom: 12px; }
.block-head input.bank-search { flex: 0 0 220px; min-width: 0; max-width: 220px; font: inherit; font-size: calc(13px * var(--fs)); padding: 4px 8px; border: 1px solid var(--border);
  border-radius: 4px; width: 220px; margin-left: auto; margin-right: 8px; }
.tabulator-cell.rest-open { color: #b45309; font-weight: 500; }
.status-paid { color: #15803d; font-weight: 500; }
.status-plan { color: var(--muted); }

/* Размер шрифта интерфейса */
/* body повышает специфичность: tabulator.css подключается позже и задает 14px */
body .tabulator, body .tabulator-popup-container, body .tabulator-edit-list { font-size: calc(14px * var(--fs)); }
body .tabulator-tooltip { font-size: calc(12px * var(--fs)); }
.font-size { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: calc(12px * var(--fs)); }
.font-size button { font: inherit; border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 4px;
  padding: 1px 6px; cursor: pointer; min-width: 26px; }
.font-size button.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }
@media (max-width: 700px) { .font-size { display: none; } }
.inline-form { display: inline; margin: 0; }
.paste-hint { margin: 0 0 6px; }
.grid .tabulator-cell.cell-anchor { outline: 2px solid #1a73e8; outline-offset: -2px; }

.items-grid .duty-refresh { margin-top: 4px; padding: 2px 6px; font-size: calc(11px * var(--fs)); white-space: normal; line-height: 1.2; text-align: left; }

.grid .tabulator-row.st-arrived, .grid .tabulator-row.st-arrived .tabulator-cell { background: #e3f5e6; }
.grid .tabulator-row.st-arrived .calc-cell { background: #d4ebd8; }
.grid .tabulator-row.st-transit, .grid .tabulator-row.st-transit .tabulator-cell { background: #fff6d1; }
.grid .tabulator-row.st-transit .calc-cell { background: #f1e8c2; }

/* Счета от перевозчиков и брокеров: слева список, справа загрузка */
.bills-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.bills-side { position: sticky; top: 68px; }
.bills-side .card h2 { margin-top: 0; }
.bills-side select, .bills-side input[type=search], .bills-side input[type=file] { width: 100%; box-sizing: border-box; }
.bills-side .container-filter, .split-form .container-filter { margin-bottom: 4px; }
.bills-table tr.bill-paid td { background: #eef8ee; color: var(--muted); }
.bills-table .pay-amount { width: 100px; text-align: right; }
.bills-table td, .bills-table th { padding-left: 8px; padding-right: 8px; }
.bills-table tfoot th { text-align: left; }
.bills-table tfoot th.num { text-align: right; }
@media (max-width: 1100px) { .bills-layout { grid-template-columns: 1fr; } .bills-side { position: static; order: -1; } }
.bills-debts { margin-top: 24px; }
.bills-debts h2 { margin-bottom: 4px; }
.filter-dates { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); font-size: calc(13px * var(--fs)); }

/* Запросы на документы */
.req-wrap { background: var(--surface); border: 1px solid var(--border); }
.req-table { table-layout: fixed; width: 100%; }
.req-table th, .req-table td, .req-table td.wrap { white-space: normal; overflow-wrap: break-word; min-width: 0; padding: 5px 6px; }
.req-table th { vertical-align: bottom; hyphens: auto; }
.req-table .req-date { margin-top: 4px; font-size: calc(12px * var(--fs)); }
.req-table td { vertical-align: top; }
.req-table .req-text { min-width: 0; max-width: none; }
.req-table .req-comment { resize: vertical; font: inherit; font-size: calc(12px * var(--fs)); padding: 3px 4px; background: rgba(255,255,255,.6); }
.req-table select, .req-table input, .req-table textarea { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
.req-table tr.req-work td { background: #fff3c4; }
.req-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
.req-photo-big { max-width: 100%; max-height: 360px; border-radius: 8px; border: 1px solid var(--border); }
.req-table tr.req-done td { background: #d4f0d9; }
.req-table .req-cost { text-align: right; }
.req { color: #c5221f; }
.form-section { margin: 16px 0 4px; font-size: calc(14px * var(--fs)); color: var(--muted); }
.nowrap { white-space: nowrap; }
