/* Стиль «Ареал»: Manrope, Areal White/Grey/Black/Gold. Цвета — только через токены. */
@font-face { font-family: Manrope; src: url(fonts/Manrope-Regular.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: Manrope; src: url(fonts/Manrope-Medium.ttf); font-weight: 500; font-display: swap; }
@font-face { font-family: Manrope; src: url(fonts/Manrope-SemiBold.ttf); font-weight: 600; font-display: swap; }
:root {
  --white: #FBFBFB; --grey: #F0F0F0; --black: #262626; --gold: #BEB180; --gold-soft: #E6E3D2; --gold-mid: #D2CBA7;
  --g1: #D6D6D6; --g2: #C3C3C3; --g3: #969696; --g4: #555555;
  --bad: #F4442E; --good: #377D2D; --bad-soft: #F6D9D4; --good-soft: #DDE9DA;
  --font: Manrope, Arial, sans-serif; --radius: 10px; --wrap: 1240px;
}
* { box-sizing: border-box; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--white); color: var(--black); font: 400 15px/1.5 var(--font); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.top { background: var(--white); border-bottom: 1px solid var(--g1); position: sticky; top: 0; z-index: 5; }
.bar { display: flex; align-items: center; gap: 20px; min-height: 72px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.logo { height: 58px; width: auto; display: block; margin: -4px 0; }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tabs button.tabbtn { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: 500 14px var(--font); color: var(--g4); cursor: pointer; }
.tabs button.tabbtn[aria-selected="true"] { color: var(--black); border-bottom-color: var(--gold); }
.tabs button.tabbtn:hover { color: var(--black); }
.who { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--g4); }
button { font: 500 14px var(--font); }
button.ghost { background: none; border: 1px solid var(--g2); color: var(--black); border-radius: 8px; padding: 7px 14px; cursor: pointer; }
button.ghost:hover { border-color: var(--black); }
button:not(.ghost):not(.tabbtn), .row button[type=submit] { background: var(--black); color: var(--white); border: 0; border-radius: 8px; padding: 9px 18px; cursor: pointer; }
button:active { transform: translateY(1px); }
button:disabled { background: var(--g1); color: var(--g3); cursor: not-allowed; }
h1 { font: 500 clamp(18px, 2.1vw, 26px)/1.25 var(--font); letter-spacing: -0.01em; margin: 28px 0 4px; }
@media (min-width: 900px) { #tab-report h1 { white-space: nowrap; } }
h2 { font: 500 18px/1.3 var(--font); margin: 30px 0 12px; }
.sub { margin: 0 0 18px; color: var(--g4); }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.card { background: var(--grey); border-radius: var(--radius); padding: 10px 14px; }
.card .k { color: var(--g4); font-size: 12px; line-height: 1.3; }
.card .v { font: 500 20px/1.2 var(--font); font-variant-numeric: tabular-nums; margin-top: 2px; }
.card.gold { background: var(--gold-soft); }
.tablebox { overflow-x: auto; border: 1px solid var(--g1); border-radius: var(--radius); background: var(--white); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 14px; text-align: right; border-bottom: 1px solid var(--g1); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; }
thead th { background: var(--grey); font-weight: 500; font-size: 13px; color: var(--g4); vertical-align: bottom; white-space: normal; }
tbody tr:last-child td { border-bottom: 0; font-weight: 600; background: var(--gold-soft); }
.neg { color: var(--bad); } .pos { color: var(--good); }
.note { color: var(--g4); font-size: 13px; margin: 10px 0 0; max-width: 90ch; }
.scheme { margin: 22px 0 0; }
.mapbox { border: 1px solid var(--g1); border-radius: var(--radius); overflow: hidden; background: var(--grey); }
.mapbox svg { display: block; width: 100%; height: auto; aspect-ratio: 2241 / 804; }
.mapbox text { font-family: var(--font); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 12px; font-size: 13px; color: var(--g4); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend svg { width: 28px; height: 14px; }
.refresh { color: var(--g3); font-size: 13px; }
/* вход */
dialog { border: 0; border-radius: 14px; padding: 26px; width: min(380px, 92vw); background: var(--white); box-shadow: 0 20px 60px #26262633; }
dialog::backdrop { background: #26262666; }
dialog h2 { margin-top: 0; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--g4); margin-bottom: 12px; }
input, select, textarea { font: 400 14px var(--font); color: var(--black); background: var(--white); border: 1px solid var(--g2); border-radius: 8px; padding: 9px 11px; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.err { color: var(--bad); min-height: 1.4em; margin: 0; font-size: 13px; }
/* ввод данных */
.inhead { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 24px 0 10px; }
.inhead h1 { margin: 0; font-size: 22px; max-width: none; }
.status { font-size: 13px; color: var(--g4); }
.status.ok { color: var(--good); } .status.bad { color: var(--bad); }
.grid { overflow: auto; max-height: calc(100vh - 210px); border: 1px solid var(--g1); border-radius: var(--radius); }
.grid table { min-width: 1100px; }
.grid th, .grid td { padding: 4px 6px; text-align: center; }
.grid thead th { position: sticky; top: 0; z-index: 2; height: 34px; }
.grid thead tr:nth-child(2) th { top: 34px; height: 52px; }
.grid thead th:first-child { left: 0; z-index: 4; text-align: left; vertical-align: middle; }
.grid td.date { font-weight: 500; text-align: left; white-space: nowrap; background: var(--grey); position: sticky; left: 0; z-index: 1; }
.grid td.calc { color: var(--g4); background: var(--grey); }
.grid td input, .grid td select { padding: 6px 7px; border-color: transparent; background: transparent; text-align: center; min-width: 62px; }
.grid td input, .grid td select { border-bottom-color: var(--g1); }
.grid td input:hover, .grid td select:hover { border-color: var(--g2); }
.grid td input:focus, .grid td select:focus { background: var(--white); }
.grid td.wide input, .grid td.wide select { min-width: 130px; text-align: left; }
.grid tr.today td { background: var(--gold-soft); }
.grid tr.today td.date { background: var(--gold-mid); }
.grid tr.future td.date { color: var(--g3); }
.grid td.saved input, .grid td.saved select { background: var(--good-soft); }
.grid td.err input, .grid td.err select { background: var(--bad-soft); border-color: var(--bad); }
@media (max-width: 720px) { .wrap { padding: 0 14px; } .logo { height: 44px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.points { list-style: none; margin: 16px 0 0; padding: 0; columns: 3 260px; column-gap: 28px; font-size: 14px; }
.points li { display: flex; align-items: center; gap: 10px; padding: 3px 0; break-inside: avoid; }
.points .n { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 3px solid; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--black); }

/* ---- мобильная версия ---- */
@media (max-width: 720px) {
  body { font-size: 15px; }
  .bar { gap: 8px 12px; min-height: 0; padding-top: 6px; padding-bottom: 0; }
  .logo { height: 40px; }
  .who { margin-left: auto; }
  .tabs { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button.tabbtn { white-space: nowrap; padding: 10px 12px; font-size: 14px; }
  button, button.ghost { min-height: 40px; }
  h1 { margin: 18px 0 14px; font-size: 19px; line-height: 1.3; }
  .cards { gap: 6px; }
  .card { padding: 8px 9px; border-radius: 8px; }
  .card .k { font-size: 10.5px; }
  .card .v { font-size: 14px; margin-top: 3px; }
  /* таблица план/факт — карточками */
  .tablebox { border: 0; background: none; overflow: visible; }
  #rtable, #rtable tbody, #rtable tr, #rtable td { display: block; width: 100%; }
  #rtable thead { display: none; }
  #rtable tr { background: var(--white); border: 1px solid var(--g1); border-radius: var(--radius); margin-bottom: 10px; padding: 6px 14px 8px; }
  #rtable tbody tr:last-child { background: var(--gold-soft); border-color: var(--gold-mid); }
  #rtable td { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border: 0; text-align: right; white-space: normal; }
  #rtable td:first-child { font-weight: 600; font-size: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--g1); margin-bottom: 4px; text-align: left; }
  #rtable td:not(:first-child)::before { content: attr(data-l); color: var(--g4); text-align: left; font-weight: 400; }
  #rtable tbody tr:last-child td { background: none; }
  /* схема: горизонтальная прокрутка, чтобы номера читались */
  .mapbox { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .mapbox svg { width: 980px; max-width: none; }
  .scheme::before { content: 'Схему можно прокручивать вправо'; display: block; color: var(--g3); font-size: 12px; margin: 0 0 6px; }
  .points { columns: 1; }
  .legend { gap: 8px 16px; }
  /* ввод данных */
  .inhead { margin: 16px 0 8px; }
  .inhead h1 { font-size: 18px; margin: 0; }
  .grid { max-height: calc(100vh - 190px); margin: 0 -14px; border-radius: 0; border-left: 0; border-right: 0; }
  .grid td input, .grid td select { font-size: 16px; min-height: 40px; }
  .grid td.wide input, .grid td.wide select { min-width: 150px; }
  dialog { width: 92vw; padding: 20px; }
  input, select { font-size: 16px; }
}
