/* Утверждённый светлый интерфейс: холодная боковая панель и синие действия. */
:root {
  color-scheme: light;
  --bg: #fff; --ink: #172438; --muted: #5d6b80; --line: #dce3ed;
  --field-line: #8b9db7; --blue: #315fea; --blue-soft: #e8efff; --side: #f3f6fc;
  --bad: #bc2732; --bad-soft: #fff0f1; --ok: #246549; --ok-soft: #eaf5ef; --r: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 "Segoe UI", Arial, sans-serif; }
body.signed-in { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
main { min-width: 0; width: 100%; max-width: 1520px; margin: 0 auto; padding: 28px; }
h1, h2, h3 { margin: 0; line-height: 1.2; overflow-wrap: anywhere; }
h1 { font-size: 36px; font-weight: 700; letter-spacing: -.7px; margin: 0 0 12px; }
h2 { font-size: 23px; font-weight: 650; }
h3 { font-size: 17px; font-weight: 650; }
p { margin: 8px 0; overflow-wrap: anywhere; }
a { color: #244fcb; text-underline-offset: 3px; overflow-wrap: anywhere; }
small { display: block; color: var(--muted); font-size: 13px; }
button, a, input, select, summary { touch-action: manipulation; }
.top { min-width: 0; padding: 28px 16px; background: var(--side); border-right: 1px solid var(--line); }
.brand { font-size: 23px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.brand small { margin-top: 8px; font-size: 14px; font-weight: 400; }
.nav { display: grid; gap: 6px; margin-top: 30px; }
.nav a, .nav .link { display: flex; justify-content: flex-start; align-items: center; min-height: 48px; width: 100%; padding: 10px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-weight: 550; text-decoration: none; }
.nav a[aria-current="page"] { background: #dce7ff; color: #244fcb; font-weight: 700; }
.nav a:hover, .nav .link:hover { background: #e3eaf7; }
.logout { margin: 18px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
button, .btn { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; max-width: 100%; padding: 10px 16px; border: 1px solid var(--blue); border-radius: 8px; background: var(--blue); color: #fff; font: inherit; font-weight: 600; font-size: 15px; text-align: center; text-decoration: none; white-space: normal; overflow-wrap: anywhere; cursor: pointer; }
button:hover, .btn:hover { background: #244cc9; }
button.quiet, .btn.quiet { border-color: #aab9d1; color: #244fcb; background: #fff; }
button.quiet:hover, .btn.quiet:hover { background: #f1f5ff; }
button:disabled { opacity: .6; cursor: not-allowed; }
:focus-visible { outline: 3px solid #244fcb; outline-offset: 3px; }
input, select { min-width: 0; min-height: 44px; max-width: 100%; width: 100%; padding: 9px 12px; border: 1px solid var(--field-line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
input[type="number"] { width: 9rem; }
input[type="file"] { padding: 9px 6px; }
input::placeholder { color: var(--muted); }
label { display: block; min-width: 0; }
.stack { display: grid; gap: 14px; }
.stack label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.stack label small { font-weight: 400; }
.stack input[type="datetime-local"] { width: 100%; }
.narrow { max-width: 30rem; }
.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.grow { flex: 1 1 12rem; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.note { padding: 12px 16px; border-radius: 8px; border-left: 4px solid var(--blue); background: #f3f6fc; overflow-wrap: anywhere; }
.note.bad { border-left-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.note.ok { border-left-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.demo { background: var(--blue-soft); color: #254b9e; font-weight: 600; }
.banners { margin-bottom: 24px; }
.banners .note { margin: 6px 0; font-size: 14px; }
.heading { margin-bottom: 22px; }
.heading p, .muted, .hint { color: var(--muted); }
.hint { font-size: 13px; }
.empty { margin: 0; padding: 20px; color: var(--muted); font-size: 14px; }
.filterbar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.filterbar label:first-child { flex-grow: 2; }
.chips, .tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chips a, .tabs a { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; max-width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 14px; }
.chips a[aria-current="true"], .tabs a[aria-current="page"] { color: #244fcb; background: var(--blue-soft); border-color: #9db4ed; }
.chips b, .num { font-variant-numeric: tabular-nums; }
.listbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sort { display: inline-flex; align-items: center; min-height: 44px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.sections { display: grid; min-width: 0; gap: 18px; }
.panel { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.panel-head { padding: 20px 20px 12px; }
.panel-head p { color: var(--muted); font-size: 14px; }
.table-wrap { padding: 0 12px 12px; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
th, td { padding: 13px 8px; border-bottom: 1px solid #e9edf4; text-align: left; vertical-align: middle; overflow-wrap: anywhere; }
th { color: var(--muted); font-size: 12px; font-weight: 600; }
th:first-child { width: 43%; }
tr:last-child td { border-bottom: 0; }
.selected td { background: var(--blue-soft); }
.num { text-align: center; }
.neg { color: var(--bad); font-weight: 700; }
.name { font-weight: 650; }
a.name { display: inline-flex; align-items: center; min-height: 44px; }
.grp { display: inline-block; max-width: 100%; padding: 4px 7px; border-radius: 6px; font-size: 12px; background: #eef2f8; color: #465a75; }
.g-search, .g-minus { background: var(--bad-soft); color: var(--bad); }
.g-reorder, .g-offset, .g-digital { background: var(--blue-soft); color: #254b9e; }
.g-nosales { background: #f6f8fc; color: var(--muted); }
.detail { padding: 22px; scroll-margin-top: 18px; }
.detail h2 { font-size: 32px; }
.shortage { font-size: 29px; font-weight: 700; line-height: 1.25; padding-top: 20px; margin-top: 18px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.print-plan { font-size: 22px; font-weight: 650; margin-top: 16px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.facts dd { margin: 3px 0 0; font-size: 23px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.acts-body { display: grid; gap: 12px; }
.print-form { padding: 16px; background: #f5f8ff; border-radius: 8px; }
.print-form button { width: 100%; }
.operation { border-top: 1px solid var(--line); }
.operation summary { min-height: 44px; padding: 10px 0; cursor: pointer; color: #244fcb; }
.operation .stack { padding: 10px 0 16px; }
.planning { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 20px; color: var(--muted); font-size: 14px; }
.return-strip { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px; padding: 22px; margin-top: 24px; }
.return-strip > div { flex: 1 1 20rem; min-width: 0; }
.returns-list { display: grid; gap: 18px; margin-top: 20px; }
.return-item { padding: 22px; }
.return-item .stack { margin-top: 20px; }
/* Общие страницы пересчёта, заказов, истории и настроек. */
.list { border-top: 1px solid var(--line); margin: 18px 0; }
.row { padding: 12px 4px; border-bottom: 1px solid var(--line); }
.row > * { min-width: 0; overflow-wrap: anywhere; }
.row.head { color: var(--muted); font-size: 12px; font-weight: 600; }
.simple .row { display: grid; align-items: center; gap: 6px 12px; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.simple .row .num { text-align: left; }
.simple + h2 { margin-top: 30px; }
@media (max-width: 1199px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .detail { max-width: 100%; }
}
@media (max-width: 800px) {
  body.signed-in { display: block; }
  .top { border-right: 0; border-bottom: 1px solid var(--line); padding: 18px; }
  .nav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
  .nav a, .nav .link { min-height: 44px; width: auto; padding: 8px 12px; font-size: 14px; }
  .logout { margin: 0; padding: 0; border: 0; }
  main { padding: 20px 18px; }
  h1 { font-size: 32px; }
  .simple .row { display: grid; grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
  .simple .row.head { display: none; }
  .simple .row > [data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
  .simple .row > .name { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  main { padding: 18px 14px; }
  .top { padding: 18px 14px; }
  .brand { font-size: 22px; }
  .filterbar { gap: 8px; }
  .filterbar label { flex-basis: 100%; }
  .filterbar button { width: 100%; }
  .workspace, .sections { gap: 14px; }
  .panel-head, .detail, .return-item, .return-strip { padding: 18px 14px; }
  .panel-head { padding-bottom: 10px; }
  h2 { font-size: 21px; }
  .detail h2 { font-size: 29px; }
  .shortage { font-size: 26px; }
  .print-plan { font-size: 20px; }
  .table-wrap { padding: 0 14px 8px; }
  .cards-table, .cards-table tbody, .cards-table tr, .cards-table td { display: block; width: 100%; }
  .cards-table thead { display: none; }
  .cards-table tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
  .cards-table tr:last-child { border-bottom: 0; }
  .cards-table td { border: 0; padding: 5px 6px; text-align: left; }
  .cards-table td[data-label] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; }
  .cards-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
  .return-strip .btn { width: 100%; }
  .acts-body .inline > form { flex: 1 1 100%; }
  .acts-body .inline button, .acts-body .inline > .btn { width: 100%; }
  .simple .row { grid-template-columns: minmax(0, 1fr); }
  .simple .row > .name { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
