:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --card: #ffffff;
  --line: #d9e0ea;
  --text: #1f2937;
  --muted: #64748b;
  --accent: #7c3aed;
  --accent-strong: #6d28d9;
  --accent-soft: #ede9fe;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --shadow: 0 18px 35px rgba(15, 23, 42, 0.08);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
.page {
  max-width: 1600px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}
.hero, .filters, .stats, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.hero {
  padding: 24px 28px;
  margin-bottom: 20px;
}
.hero h1 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.1;
}
.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 920px;
  line-height: 1.55;
}
.filters {
  padding: 18px;
  margin-bottom: 20px;
}
.filters form {
  display: grid;
  grid-template-columns: 240px 180px 180px auto auto auto;
  gap: 14px;
  align-items: end;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.field input,
.field select {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0 13px;
  background: #fff;
  color: var(--text);
  font-size: 15px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary {
  color: #fff;
  background: var(--accent);
}
.btn-secondary {
  color: var(--text);
  background: transparent;
  border-color: var(--line);
}
.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
  margin-bottom: 20px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fff;
}
.stat-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
  font-weight: 700;
}
/* суммы длиннее счётчиков — не даём им ломать сетку карточек.
   Селектор из двух классов: strict-тема подключается после этого файла
   и её `.stat-value` иначе перебивает размер. */
.stat .stat-value-money {
  font-size: 26px;
  overflow-wrap: anywhere;
}
.stat-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
}
.error {
  display: none;
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(185, 28, 28, 0.18);
  background: var(--bad-soft);
  color: var(--bad);
}
.panel {
  overflow: hidden;
  margin-bottom: 20px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  margin: 0;
  font-size: 18px;
}
.meta {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}
.grid-state {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 14px;
  padding: 8px 4px;
}
.ctor-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}
.ctor-head {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}
.ctor-name {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.3;
}
.ctor-card.is-others .ctor-name {
  color: var(--muted);
}
.ctor-count-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
}
.ctor-count {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}
.ctor-percent {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.ctor-amount-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.ctor-amount {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--accent-strong);
}
.ctor-card.is-others .ctor-amount {
  color: var(--muted);
}
.ctor-orders {
  display: flex;
  flex-direction: column;
  max-height: 420px;
  overflow: auto;
}
.order-row {
  padding: 9px 16px;
  border-bottom: 1px solid #eef2f7;
  font-size: 13px;
  line-height: 1.4;
}
.order-row:last-child { border-bottom: none; }
.order-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.order-main > a,
.order-main > .order-title {
  flex: 1 1 auto;
  min-width: 0;
}
.order-amount {
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.order-row a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-row a:hover { text-decoration: underline; }
.order-title {
  display: block;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.muted {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.orders-empty {
  padding: 12px 16px;
  color: var(--muted);
  font-size: 13px;
}
@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .filters form { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-head { flex-direction: column; align-items: flex-start; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .page { padding: 18px 12px 28px; }
  .hero, .filters, .stats, .panel { border-radius: 14px; }
  .hero h1 { font-size: 24px; }
  .filters form { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }
}

/* блок входа в закрытый отчёт (заглушка «нужно войти») */
.access-actions {
  margin-top: 14px;
}

/* Пикер месяца рисует общая тема (monthPickerCss); поля этого отчёта выше и
   круглее стандартных, поэтому подгоняем его переменными, а не копией правил. */
.month-picker {
  --mp-h: 46px;
  --mp-radius: 8px;
  --mp-font: 15px;
}
