:root { --fg: #111; --muted: #6b6b6b; --line: #e3e3e3; --bg: #fff; --ok: #1f7a3a; --bad: #b3261e; --accent: #111; }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--fg); background: var(--bg); }
a { color: inherit; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.brand { font-weight: 600; text-decoration: none; }
main { padding: 16px; max-width: 1280px; margin: 0 auto; }
h1 { font-size: 22px; margin: 4px 0 16px; } h2 { font-size: 17px; margin: 20px 0 8px; }
.muted { color: var(--muted); font-weight: normal; } .small { font-size: 13px; }
.note { padding: 8px 12px; border-radius: 6px; border: 1px solid var(--line); }
.note.ok { border-color: var(--ok); color: var(--ok); } .note.bad { border-color: var(--bad); color: var(--bad); }
button { font: inherit; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; min-height: 40px; }
button.secondary { background: #fff; color: var(--accent); }
button.link { background: none; border: none; color: var(--muted); text-decoration: underline; padding: 8px 4px; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #c8c8c8; border-radius: 6px; min-height: 40px; width: 100%; }
.login { max-width: 320px; margin: 60px auto; display: grid; gap: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.docs { width: 100%; border-collapse: collapse; margin: 0 0 16px; }
.docs th, .docs td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.docs th { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.docs th a { text-decoration: none; } .docs th a:hover, .docs th[aria-sort] a { color: var(--fg); }
.docs tbody tr:hover { background: #fafafa; }
.docs .pick { width: 1%; padding-right: 0; } .pick input { width: 20px; min-height: 20px; }
.docs .scan { width: 1%; padding-top: 6px; padding-bottom: 6px; }
.docs .title a { font-weight: 600; text-decoration: none; } .docs .title a:hover { text-decoration: underline; }
.docs .date, .docs .when, .docs .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.docs .num { text-align: right; }
.docs .sub { display: block; font-size: 13px; color: var(--muted); }
.thumb { display: block; width: 44px; height: 56px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: #f4f4f4; }
.preview { position: fixed; z-index: 10; top: 50%; right: max(16px, calc((100vw - 1280px) / 2 + 16px)); transform: translateY(-50%);
           padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
           box-shadow: 0 12px 40px rgba(0, 0, 0, .18); pointer-events: none; }
.preview[hidden] { display: none; }
.preview img { display: block; max-height: calc(100vh - 48px); max-width: min(720px, calc(100vw - 360px)); }
@media (hover: none) { .hover-hint { display: none; } }
.doc-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px; }
@media (min-width: 801px) { .sheets { position: sticky; top: 60px; align-self: start; max-height: calc(100vh - 76px); overflow-y: auto; } }
.sheets figure { margin: 0 0 16px; } .sheets img { width: 100%; border: 1px solid var(--line); border-radius: 4px; }
figcaption { color: var(--muted); font-size: 13px; margin-top: 4px; }
.row { display: flex; gap: 8px; } .row select { flex: 1; }
.fields { display: grid; gap: 0; }
.field { display: grid; grid-template-columns: 150px 1fr 1fr; gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 64px; }
.field .label { font-weight: 600; } .field .model { word-break: break-word; }
.field .actions { grid-column: 2 / -1; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.field .actions input, .field .actions textarea { flex: 1 1 200px; width: auto; }
.state.accepted, .state.human { color: var(--ok); }
@media (max-width: 800px) {
  .doc-grid { grid-template-columns: 1fr; }
  .field { grid-template-columns: 1fr; } .field .actions { grid-column: 1; }
}
/* телефон: строка таблицы — карточка, заголовки — строка ссылок сортировки */
@media (max-width: 700px) {
  .docs, .docs thead, .docs tbody { display: block; }
  .docs thead tr { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0 0 10px; border-bottom: 1px solid var(--line); }
  .docs thead th { padding: 0; border: 0; } .docs thead .pick, .docs thead .scan { display: none; }
  .docs tbody tr { display: grid; grid-template-columns: 28px 52px auto minmax(0, 1fr); column-gap: 8px; padding: 10px 0;
                   grid-template-areas: "pick scan title title" "pick scan date date" "pick scan when num" "pick scan check check";
                   border-bottom: 1px solid var(--line); }
  .docs tbody td { display: block; padding: 0; border: 0; white-space: normal; text-align: left; }
  .docs td.pick { grid-area: pick; width: auto; } .docs td.scan { grid-area: scan; width: auto; } .docs td.title { grid-area: title; }
  .docs td.date { grid-area: date; } .docs td.when { grid-area: when; } .docs td.check { grid-area: check; }
  .docs td.num { grid-area: num; text-align: left; padding-left: 8px; }
  .docs td.date.none { display: none; }
  .docs td[data-label]::before { content: attr(data-label) " "; color: var(--muted); }
  .docs .sub { display: inline; } .docs .sub::before { content: " · "; }
}
