/* Сайт заказчика в стиле «Бетон» (wl#80, макет — холст вариантов дизайна, артборд
   Concrete.dc.html): тёплый серый фон, белые карточки, шрифт Golos Text, зелёный акцент.
   Цвета — только переменные ниже. Статус этапа — класс (web.py, STATUS_CLASS): ahead
   «впереди», going «идёт», waiting «ждём», passed «пройден», developing «в разработке».
   Тёмной темы нет: выбран светлый «Бетон», «Бетон, ночь» — другой вариант холста. */
:root {
  color-scheme: light;
  --page: #ECEAE6; --plate: #DEDBD5; --panel: #fff; --sunk: #F5F5F4;
  --text: #1C1917; --soft: #57534E; --quiet: #44403C; --rule: #E7E5E4; --edge: #A8A29E;
  --link: #14532D; --link-hover: #052E16;
  --accent: #15803D; --on-accent: #fff;
  --night: #1C1917; --night-text: #F5F5F4; --night-soft: #D6D3D1; --night-edge: #57534E;
  --night-track: #44403C; --night-link: #86EFAC;
  --s-passed: #14532D; --s-passed-bg: #DCFCE7; --s-passed-ring: #15803D;
  --s-going: #1E3A8A; --s-going-bg: #DBEAFE; --s-going-ring: #2563EB;
  --s-waiting: #78350F; --s-waiting-bg: #FEF3C7; --s-waiting-ring: #D97706;
  --s-ahead: #44403C; --s-ahead-bg: #E7E5E4; --s-ahead-ring: #A8A29E;
  --s-developing: #57534E; --s-developing-bg: #F5F5F4; --s-developing-ring: #D6D3D1;
  --alarm: #9A3412; --alarm-bg: #FFEDD5; --alarm-ring: #C2410C;
  --r-card: 20px; --r-row: 16px; --r-control: 12px; --r-chip: 10px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--page); font-family: "Golos Text", system-ui,
  -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; line-height: 1.5; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
main { max-width: 1240px; margin: 0 auto; padding: 4px 24px 48px; }
h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; margin: 6px 0 16px; }
h2 { font-size: 18px; font-weight: 700; margin: 26px 4px 10px; }
h3 { font-size: 16px; font-weight: 700; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center; }
small, .muted, .crumbs { color: var(--soft); font-weight: 400; }
h1 small { display: block; margin-top: 4px; font-size: 15px; letter-spacing: 0; }
h2 small { font-size: 14px; margin-left: 4px; }
.crumbs { margin: 0 0 4px; font-size: 14px; }
.crumbs a { text-decoration: none; font-weight: 500; }
.num { text-align: right; }
.num, .date { font-variant-numeric: tabular-nums; }
.date { white-space: nowrap; }
.bad { color: var(--alarm); font-weight: 700; }

/* Шапка: знак «W», переключатель разделов в плашке, «на дату», кто вошёл */
.bar { max-width: 1240px; margin: 0 auto; padding: 20px 24px; display: flex; flex-wrap: wrap;
  align-items: center; gap: 12px 16px; }
.mark { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none;
  font-weight: 800; font-size: 19px; }
.mark b { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-control);
  background: var(--night); color: var(--page); }
.sections { display: flex; gap: 6px; padding: 4px; border-radius: var(--r-control); background: var(--plate); }
.sections a { padding: 8px 16px; border-radius: 9px; color: var(--quiet); text-decoration: none;
  font-weight: 500; }
.sections a.on { color: var(--text); background: var(--panel); font-weight: 700; }
.at { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; color: var(--quiet); }
.at label { display: flex; gap: 6px; align-items: center; }
.exit { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 15px; color: var(--quiet); }
.exit b { font-weight: 500; }

input, button { font: inherit; color: var(--text); }
input { padding: 8px 10px; border: 1px solid var(--edge); border-radius: 10px; background: var(--panel); }
input[type="checkbox"] { width: 18px; height: 18px; padding: 0; accent-color: var(--accent);
  vertical-align: -3px; }
button { padding: 9px 16px; border: 1px solid var(--edge); border-radius: var(--r-control);
  background: var(--panel); font-weight: 600; cursor: pointer; }
button:hover { border-color: var(--text); }
button.primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent);
  font-weight: 700; }
button.primary:hover { filter: brightness(.92); }
button.plain { border-color: transparent; background: transparent; color: var(--soft); padding: 6px 8px; }
button.plain:hover { color: var(--text); }
button[disabled] { opacity: .5; cursor: default; filter: none; }

/* Карточки и таблицы */
.box { background: var(--panel); border-radius: var(--r-card); padding: 18px 22px; }
.wide { padding: 6px 0; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 12px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--rule); }
th { font-size: 13px; font-weight: 600; color: var(--soft); white-space: nowrap; }
tr:last-child > td { border-bottom: none; }
td > a:only-child { font-weight: 600; }
.plainlist { list-style: none; margin: 0; }
.plainlist > li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.plainlist > li:last-child { border-bottom: none; }

.signin { max-width: 400px; margin: 48px auto; padding: 28px; display: grid; gap: 14px; }
.signin h1 { margin: 0 0 4px; font-size: 26px; }
.signin label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; color: var(--quiet); }
.signin input { padding: 12px 14px; font-size: 16px; }
.signin .primary { padding: 13px; font-size: 16px; margin-top: 4px; }
.error { margin: 0 0 12px; padding: 12px 14px; border-radius: var(--r-control); color: var(--alarm);
  background: var(--alarm-bg); box-shadow: inset 0 0 0 1px var(--alarm-ring); font-weight: 500; }

.tabs { display: inline-flex; gap: 6px; margin-bottom: 16px; padding: 4px; border-radius: var(--r-control);
  background: var(--plate); }
.tabs a, .filters a { text-decoration: none; }
.tabs a { padding: 8px 18px; border-radius: 9px; color: var(--quiet); font-weight: 500; }
.tabs a.on { color: var(--text); background: var(--panel); font-weight: 700; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.filters a { padding: 7px 14px; font-size: 14px; font-weight: 500; color: var(--text);
  background: var(--panel); border-radius: var(--r-chip); }
.filters a.on { color: var(--night-text); background: var(--night); font-weight: 700; }

/* Статусы — цветные плашки */
.chip { display: inline-block; padding: 5px 10px; border-radius: var(--r-chip); font-size: 13px;
  font-weight: 700; line-height: 1.3; white-space: nowrap; }
.chip.passed { color: var(--s-passed); background: var(--s-passed-bg); }
.chip.going { color: var(--s-going); background: var(--s-going-bg); }
.chip.waiting { color: var(--s-waiting); background: var(--s-waiting-bg); }
.chip.ahead { color: var(--s-ahead); background: var(--s-ahead-bg); }
.chip.developing { color: var(--s-developing); background: var(--s-developing-bg);
  box-shadow: inset 0 0 0 1px var(--s-developing-ring); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
td a:has(.chip) { text-decoration: none; }
td a:has(.chip):hover .chip { box-shadow: inset 0 0 0 2px currentColor; }

/* Граф заказа — цепочка кружков; этап рейса — двойное кольцо, в разработке — пунктир */
.graph { list-style: none; margin: 0 0 8px; padding: 22px 16px 18px; display: flex; overflow-x: auto;
  background: var(--panel); border-radius: var(--r-card); }
.stage { --dot: var(--s-developing-bg); --dot-text: var(--s-developing); --ring: var(--s-developing-ring);
  --ring-style: dashed; --ring-width: 2px;
  position: relative; flex: 1 0 88px; min-width: 88px; display: flex; flex-direction: column;
  align-items: center; gap: 4px; text-align: center; }
.stage:not(:last-child)::after { content: ""; position: absolute; top: 19px; left: calc(50% + 24px);
  width: calc(100% - 48px); height: 2px; background: var(--s-developing-ring); }
.stage a { display: flex; flex-direction: column; align-items: center; gap: 4px; color: inherit;
  text-decoration: none; }
.stage .n { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 4px;
  border-radius: 50%; background: var(--dot); color: var(--dot-text);
  border: var(--ring-width) var(--ring-style) var(--ring); font-weight: 800; font-size: 15px; }
.stage a:hover .n { box-shadow: 0 0 0 3px var(--plate); }
.stage .title { padding: 0 2px; font-size: 11.5px; line-height: 1.25; color: var(--quiet); }
.stage .status { font-size: 12px; font-weight: 700; color: var(--dot-text); }
.stage.developing .status { font-weight: 500; }
.stage.passed { --dot: var(--s-passed-bg); --dot-text: var(--s-passed); --ring: var(--s-passed-ring);
  --ring-style: solid; --ring-width: 3px; }
.stage.going { --dot: var(--s-going-bg); --dot-text: var(--s-going); --ring: var(--s-going-ring);
  --ring-style: solid; --ring-width: 3px; }
.stage.waiting { --dot: var(--s-waiting-bg); --dot-text: var(--s-waiting); --ring: var(--s-waiting-ring);
  --ring-style: solid; --ring-width: 3px; }
.stage.ahead { --dot: var(--s-ahead-bg); --dot-text: var(--s-ahead); --ring: var(--s-ahead-ring);
  --ring-style: solid; --ring-width: 2px; }
.stage.trip:not(.developing) { --ring-style: double; --ring-width: 5px; }
.graph.mini { margin: 0; padding: 0; gap: 4px; background: none; border-radius: 0; overflow: visible; }
.mini .stage { flex: 0 0 auto; min-width: 0; }
.mini .stage::after { display: none; }
.mini .stage .n { width: 24px; height: 24px; margin: 0; font-size: 11px; --ring-width: 1px; }
.mini .stage.passed .n, .mini .stage.going .n, .mini .stage.waiting .n { border-width: 2px; }
.mini .stage.trip:not(.developing) .n { border-width: 3px; }

.facts, .fields { display: flex; flex-wrap: wrap; gap: 10px 32px; margin: 0 0 16px; }
.facts dt, .fields dt { font-size: 13px; color: var(--soft); }
.facts dd, .fields dd { margin: 0; font-weight: 500; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.fields dd .muted { font-weight: 400; font-size: 13px; }
.warnings { box-shadow: inset 0 0 0 2px var(--alarm-ring); }
.warnings h2 { margin: 0 0 8px; color: var(--alarm); }
.warnings ul { margin: 0; padding-left: 18px; }
.warnings li { padding: 3px 0; }
.stage-cards { display: grid; gap: 14px; align-items: start; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.stage-card h3 .chip { font-size: 12px; }
.conditions, .documents { margin: 0; padding-left: 20px; }
.conditions li { padding: 2px 0; }
.conditions .met::marker { content: "✓  "; color: var(--accent); font-weight: 700; }
.conditions .unmet::marker { content: "✗  "; color: var(--alarm); font-weight: 700; }
.conditions .unmet { color: var(--alarm); }
.documents { margin-top: 10px; }
/* Письмо как в почте (wl#82): заголовки, текст, вложения строками с просмотром по нажатию */
.letter { padding: 24px 28px; }
.letter h1 { font-size: 26px; }
.headers { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px;
  margin: 0 0 16px; }
.headers div { display: contents; }
.headers dt { font-size: 14px; color: var(--soft); }
.headers dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.letter .text, .file .doc-text { margin: 16px 0 0; padding: 16px; overflow-x: auto; white-space: pre-wrap;
  border-radius: 14px; background: var(--sunk); font: 14px/1.55 ui-monospace, monospace; }
.notice, .file .unavailable { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--r-control); color: var(--s-waiting);
  background: var(--s-waiting-bg); font-weight: 500; }
.files h2 small { font-size: 13px; }
.file { margin-bottom: 10px; border-radius: var(--r-row); background: var(--panel); }
.file > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px;
  padding: 14px 18px; cursor: pointer; overflow-wrap: anywhere; }
.file > summary::marker { color: var(--accent); }
.file[open] > summary { border-bottom: 1px solid var(--rule); }
.file > :not(summary) { margin-left: 18px; margin-right: 18px; }
.file[open] { padding-bottom: 18px; }
.file-name { font-weight: 600; }
.file-meta { color: var(--soft); font-size: 14px; white-space: nowrap; }
.file-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; margin-bottom: 12px;
  font-size: 14px; font-weight: 600; }
.doc-frame { display: block; width: calc(100% - 36px); height: 70vh; min-height: 360px; border: 0;
  border-radius: 14px; background: var(--sunk); }
.doc-frame[sandbox] { height: 45vh; }
.image-box { padding: 12px; border-radius: 14px; background: var(--sunk); text-align: center; }
.image-box a { cursor: zoom-in; }
.image-box img { max-width: 100%; max-height: 70vh; image-rendering: auto; }
.sheet { margin-bottom: 8px; }
.sheet > summary { display: inline-block; padding: 6px 14px; border-radius: var(--r-chip); cursor: pointer;
  background: var(--sunk); font-size: 14px; font-weight: 600; }
.sheet[open] > summary { color: var(--night-text); background: var(--night); }
.sheet .scroll { margin-top: 8px; max-height: 60vh; overflow: auto; border: 1px solid var(--rule);
  border-radius: var(--r-control); }
.sheet .scroll td { padding: 6px 10px; font-size: 13px; white-space: nowrap; border-right: 1px solid var(--rule); }
.sheet .scroll tr:first-child td { font-weight: 600; background: var(--sunk); }
.file .archive { margin-top: 4px; padding-left: 20px; }
.file-lines { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; }
.file-lines li { padding: 1px 0; overflow-wrap: anywhere; }
.file-lines .file-name { font-weight: 500; }
.file-lines .file-meta { font-size: 13px; }

/* Бэк-тест и прогон (wl#77): плашка прогона, действия карточками, письма сбоку */
.in-run { font-size: 14px; font-weight: 500; padding: 8px 14px; border-radius: var(--r-control);
  color: var(--night-text); background: var(--night); text-decoration: none; }
.in-run:hover { color: var(--night-text); background: var(--quiet); }
.buttons, .run-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.buttons button { padding: 7px 12px; font-size: 14px; }
.run-order { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: flex-end; }
.run-order label { display: flex; gap: 6px; align-items: center; font-size: 14px; }

.run-head { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 28px; padding: 24px 28px;
  border-radius: var(--r-card); color: var(--night-text); background: var(--night); }
.run-head a { color: var(--night-link); }
.run-head .crumbs { color: var(--night-soft); }
.run-title { flex: 1 1 320px; min-width: 0; }
.run-title h1 { margin: 2px 0 0; font-size: 32px; }
.run-title h1 small { color: var(--night-soft); }
.run-progress { flex: 1 1 260px; display: flex; flex-direction: column; gap: 10px; }
.run-progress .facts { margin: 0; gap: 6px 24px; }
.run-progress dt { color: var(--night-soft); }
.track { height: 8px; border-radius: 99px; background: var(--night-track); overflow: hidden; }
.track span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.run-head .run-buttons { flex: 0 1 auto; }
.run-head button { padding: 12px 18px; color: var(--night-text); background: transparent;
  border-color: var(--night-edge); }
.run-head button:hover { border-color: var(--night-text); }
.run-head button.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent);
  font-size: 16px; padding: 12px 22px; }

.run-grid { display: grid; gap: 0 18px; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  grid-template-rows: auto 1fr; align-items: start; }
.run-grid > .run-main { grid-column: 1; }
.run-grid > .mailboxes { grid-column: 2; grid-row: 1 / span 2; margin-top: 18px; padding: 4px 20px 20px;
  border-radius: var(--r-card); background: var(--plate); }
.mailboxes h2 { margin: 16px 2px 10px; }
.mailboxes .letters { padding: 0; background: none; }
.mailboxes .letters > li { padding: 12px 14px; margin-bottom: 8px; border: 0; border-radius: 14px;
  background: var(--page); font-size: 14px; }
.mailboxes section:first-child .letters > li:first-child:not(.muted) { background: var(--panel); box-shadow: inset 0 0 0 2px var(--accent); }
.letters li { overflow-wrap: anywhere; }
.letters .date { font-size: 13px; color: var(--soft); }
.letters a { font-weight: 600; }

.offers { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 12px; }
.offers li { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; border-radius: var(--r-row);
  background: var(--panel); box-shadow: inset 0 0 0 2px var(--accent); }
.offers form { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.offers .offer-trip { font-size: 13px; font-weight: 700; color: var(--accent); text-transform: uppercase;
  letter-spacing: .02em; }
.offers .offer-trip a { color: inherit; }
.offers button { padding: 12px 14px; font-size: 15px; }
.offers .hint { display: block; font-size: 13px; color: var(--soft); }
.run-main .offers { gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin: 0; }
.run-main .offers li { padding: 20px; border-radius: var(--r-card); }
.warnings li.accepted { color: var(--soft); }

@media (max-width: 860px) {
  .run-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .run-grid > .mailboxes { grid-column: 1; grid-row: auto; }
}
@media (max-width: 640px) {
  main { padding: 4px 16px 40px; }
  .bar { padding: 14px 16px; gap: 10px 12px; }
  .exit b { display: none; }
  h1 { font-size: 24px; }
  .run-head { padding: 20px; gap: 16px; }
  .run-title h1 { font-size: 24px; }
  .run-head .run-buttons, .run-head .run-buttons form { flex: 1 1 auto; }
  .run-head .run-buttons button { width: 100%; }
  .box { padding: 16px; }
  .wide { padding: 4px 0; }
  .letter { padding: 18px; }
  .headers { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .headers dd { margin-bottom: 6px; }
  .file > summary { padding: 12px 14px; }
  .file > :not(summary) { margin-left: 12px; margin-right: 12px; }
  .doc-frame { width: calc(100% - 24px); height: 60vh; }
  .stage-cards { grid-template-columns: minmax(0, 1fr); }
}
