/* Manrope локально, те же файлы и диапазоны, что в веб-интерфейсе WMS */
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/manrope-400-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/manrope-400-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/manrope-400-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/manrope-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/manrope-500-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/manrope-500-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/manrope-500-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/manrope-500-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/manrope-600-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/manrope-600-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/manrope-600-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/manrope-600-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/manrope-700-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/manrope-700-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/manrope-700-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/manrope-700-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: light;
  /* Холодная туманная палитра с тёмно-синим акцентом */
  --bg: #eef2f8;
  --card: #ffffff;
  --ink: #0f1b35;
  --ink-2: #45526b;
  --muted: #5f6b82;
  --hairline: #e2e8f1;
  --chip-border: #d6deea;
  --accent: #1d3b8f;
  --wash: #f4f7fc;
  --focus: #2a78d6;
  --warn: #b42318;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(15, 27, 53, 0.04), 0 14px 34px -20px rgba(15, 27, 53, 0.22);
  --ease: cubic-bezier(0.22, 0.8, 0.26, 1);
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 36px 24px 56px;
}

h1 {
  margin: 0 0 20px;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}

.periods-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.period-icon {
  width: 19px;
  height: 19px;
  flex: none;
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.periods {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.period-button {
  height: 38px;
  padding: 0 17px;
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.period-button:hover {
  border-color: #c3cfe0;
  background: var(--wash);
  color: var(--ink);
}

.period-button:active { transform: scale(0.97); }

.period-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.period-button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.asof {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.asof.stale { color: var(--warn); }

/* Итоги за период: одна полоса из четырёх чисел */
.stats {
  margin-top: 20px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.stats-range {
  margin: 0;
  padding: 16px 24px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 6px 0 18px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 6px 24px 0;
}

.stat + .stat { border-left: 1px solid var(--hairline); }

.stat-label {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.stat-value {
  color: var(--ink);
  font-size: 26px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.stat-value small {
  margin-left: 5px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
}

.stat.total .stat-value { color: var(--accent); }

.stat-note {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
}

.card {
  margin-top: 18px;
  padding: 22px 24px 14px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px 20px;
  margin-bottom: 10px;
}

h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px 14px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.key {
  display: inline-block;
  flex: none;
}

.key-box {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.key-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.key-line {
  position: relative;
  width: 20px;
  height: 2.5px;
  border-radius: 2px;
}

.key-line.with-dot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: inherit;
  box-shadow: 0 0 0 2px var(--card);
}

.card-note {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.chart {
  position: relative;
  height: 280px;
  outline: none;
  touch-action: pan-y;
}

.chart:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
  border-radius: 10px;
}

.chart svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart .tick {
  fill: var(--muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.chart .axis-title {
  fill: var(--muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
}

.chart .empty {
  fill: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
}

/* Движение только в ответ на действие: при открытии и смене месяца */
@keyframes rise {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.anim-rise { animation: rise 0.62s var(--ease) both; }
.anim-fade { animation: fade 0.45s ease-out 0.4s both; }

@media (prefers-reduced-motion: reduce) {
  .anim-rise,
  .anim-fade { animation: none; }
  .period-button { transition: none; }
}

.tip {
  position: absolute;
  z-index: 5;
  min-width: 180px;
  max-width: 290px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 16px 36px -12px rgba(15, 27, 53, 0.28);
  color: var(--ink);
  font-size: 12.5px;
  pointer-events: none;
}

.tip[hidden] { display: none; }

.tip-title {
  margin-bottom: 5px;
  color: var(--ink-2);
  font-weight: 700;
}

.tip-row {
  display: grid;
  grid-template-columns: 14px auto 1fr;
  align-items: center;
  column-gap: 7px;
  padding: 1px 0;
}

.tip-row .tip-key {
  width: 12px;
  height: 3px;
  border-radius: 2px;
}

.tip-row b {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tip-row span:last-child {
  overflow: hidden;
  color: var(--ink-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tip-row.sub { padding-left: 14px; font-size: 12px; }
.tip-row.sub b { font-weight: 600; }

.tip-row.total {
  margin-top: 5px;
  padding-top: 6px;
  border-top: 1px solid var(--hairline);
}

.table-wrap {
  overflow-x: auto;
  margin: 4px -24px 0;
  padding: 0 24px;
}

table.grid {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

table.grid th,
table.grid td {
  padding: 9px 6px;
  border-bottom: 1px solid var(--hairline);
  text-align: right;
  white-space: nowrap;
}

table.grid thead th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  vertical-align: bottom;
}

table.grid thead tr:first-child th { padding-bottom: 3px; border-bottom: 0; }
table.grid thead th.group { text-align: center; color: var(--ink-2); }
table.grid thead tr:first-child th.group { border-bottom: 1px solid var(--hairline); }
table.grid thead th.wrap { max-width: 78px; white-space: normal; line-height: 1.2; }

table.grid th:first-child,
table.grid td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--card);
  text-align: left;
}

table.grid tbody tr { transition: background-color 0.15s ease; }
table.grid tbody tr:hover td { background: var(--wash); }

table.grid td.name {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

table.grid td.name .key { margin-right: 9px; vertical-align: 1px; }

/* Сводная приёмки: клиенты строками, дни столбцами, ширина по числу дней */
table.grid.compact { width: auto; min-width: 100%; font-size: 12.5px; }
table.grid.compact th,
table.grid.compact td { padding: 9px 4px; }
table.grid.compact td.name { max-width: 170px; }

table.grid td.zero { color: var(--muted); font-weight: 400; }

table.grid td.unbilled {
  color: #b54708;
  font-size: 12.5px;
  font-weight: 600;
}

table.grid td.money { font-weight: 700; }

table.grid tr.unsized td { color: var(--ink-2); background: #fafbfd; }
table.grid tr.unsized td:first-child { background: #fafbfd; font-weight: 500; }
table.grid tr.unsized td.merge { text-align: center; }
table.grid tr.unsized td.zero { color: var(--muted); font-weight: 400; }

table.grid tr.total td {
  border-top: 1px solid #cfd8e6;
  border-bottom: 0;
  font-weight: 700;
}

@media (max-width: 760px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
  .stat:nth-child(3) { border-left: 0; }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .page { padding: 22px 16px 40px; }
  h1 { font-size: 26px; margin-bottom: 14px; }
  .period-icon { display: none; }
  .period-button { height: 36px; padding: 0 13px; font-size: 14px; }
  .stats { margin-top: 16px; border-radius: 18px; }
  .stats-range { padding: 14px 16px 0; }
  .stat { padding: 4px 16px 0; }
  .stat-value { font-size: 21px; }
  .stat-value small { font-size: 12.5px; }
  .card { padding: 18px 16px 10px; border-radius: 18px; }
  .card-head { margin-bottom: 8px; }
  h2 { font-size: 16px; }
  .legend { justify-content: flex-start; gap: 3px 12px; font-size: 12px; }
  .chart { height: 236px; }
  .table-wrap { margin: 4px -16px 0; padding: 0 16px; }
}

/* Страница «Поток» (potok.html, ANT-17): только свои классы, основная страница их не использует */
.crumbs { margin: 0 0 8px; font-size: 13.5px; }

.nav-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.nav-link:hover { text-decoration: underline; }
.nav-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.stat.warn .stat-value { color: var(--warn); }

.flow-chart { height: 240px; }

.chart .bar-label {
  fill: var(--ink-2);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
}

table.grid tr.group td,
table.grid tr.group td:first-child { background: var(--wash); font-weight: 700; }
table.grid tr.sub td.name { padding-left: 20px; font-weight: 500; }
table.grid th.left,
table.grid td.left { text-align: left; }
table.grid td.warn { color: var(--warn); font-weight: 700; }
table.grid td.flow-empty { color: var(--muted); font-weight: 500; text-align: left; }

.flow-note {
  margin: 8px 0 4px;
  color: var(--ink-2);
  font-size: 13px;
}

.flow-note:empty { display: none; }

@media (max-width: 640px) {
  .flow-chart { height: 220px; }
}
