* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #f4f5f7;
  margin: 0;
  padding: 0;
  color: #1f2328;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }

header h1 { font-size: 21px; margin: 0 0 4px; }
header .sub { color: #6b7280; font-size: 12px; margin-bottom: 20px; }

.period-bar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  background: #fff; border-radius: 10px; padding: 12px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 20px;
}
.modes { display: flex; gap: 6px; }
.mode-btn {
  border: 1px solid #e2e4e8; background: #fff; color: #444;
  padding: 6px 14px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.mode-btn.active { background: #2f6fed; border-color: #2f6fed; color: #fff; }
.nav { display: flex; align-items: center; gap: 10px; }
.nav button {
  border: 1px solid #e2e4e8; background: #fafafa; border-radius: 6px;
  width: 30px; height: 30px; cursor: pointer; font-size: 14px;
}
.period-label { font-weight: 600; font-size: 14px; min-width: 180px; text-align: center; }
.range-inputs { display: flex; align-items: center; gap: 8px; }
.range-inputs > button {
  border: none; background: #2f6fed; color: #fff; padding: 6px 14px;
  border-radius: 6px; cursor: pointer; font-size: 13px;
}

/* Свой календарь на русском (вместо нативного <input type=date>, чей язык
   зависит от локали браузера посетителя, а не от языка страницы). */
.date-picker { position: relative; }
.dp-trigger {
  padding: 6px 12px; border: 1px solid #e2e4e8; background: #fff;
  border-radius: 6px; font-size: 13px; cursor: pointer; color: #1f2328;
  min-width: 140px; text-align: left;
}
.dp-trigger:hover { border-color: #2f6fed; }
.dp-popup {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20;
  background: #fff; border-radius: 10px; padding: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15); width: 230px;
}
.dp-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-header button {
  border: 1px solid #e2e4e8; background: #fafafa; border-radius: 6px;
  width: 26px; height: 26px; cursor: pointer; font-size: 13px;
}
.dp-title { font-weight: 600; font-size: 13px; text-transform: capitalize; }
.dp-weekdays, .dp-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-weekdays span { text-align: center; font-size: 11px; color: #9aa1ab; padding: 4px 0; }
.dp-day {
  border: none; background: none; padding: 6px 0; font-size: 12.5px;
  border-radius: 5px; cursor: pointer; color: #1f2328;
}
.dp-day:hover { background: #f0f4ff; }
.dp-day.selected { background: #2f6fed; color: #fff; }
.dp-day.dp-empty { cursor: default; }

.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.card {
  background: #fff; border-radius: 10px; padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.card[title] .label, th[title] { cursor: help; border-bottom: 1px dotted #9aa1ab; display: inline-block; }
.card .value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.card .label { color: #6b7280; font-size: 12px; margin-top: 4px; }
.card .sub-value { color: #9aa1ab; font-size: 11px; margin-top: 3px; }

.grid2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

.panel {
  background: #fff; border-radius: 10px; padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 20px;
}
.panel h2 { font-size: 14px; margin: 0 0 14px; color: #374151; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid #eee; font-size: 13px; white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; color: #6b7280; letter-spacing: .03em; }
tbody tr:hover { background: #fafbfc; }
tbody tr.total-row { font-weight: 700; background: #fafbfc; }

.backlog-buckets { display: flex; gap: 16px; margin-bottom: 14px; }
.backlog-buckets .b { text-align: center; }
.backlog-buckets .b .n { font-size: 20px; font-weight: 700; }
.backlog-buckets .b .l { font-size: 11px; color: #6b7280; }
.b.lt1 .n { color: #2f7a3f; }
.b.d1_3 .n { color: #b7791f; }
.b.gt3 .n { color: #c0392b; }

.stage-row { display: flex; align-items: center; gap: 10px; font-size: 12px; margin-bottom: 6px; }
.stage-row .name { width: 170px; flex-shrink: 0; color: #444; }
.stage-row .bar-bg { flex: 1; background: #f0f1f3; border-radius: 4px; height: 10px; overflow: hidden; }
.stage-row .bar-fg { background: #2f6fed; height: 100%; }
.stage-row .count { width: 28px; text-align: right; font-weight: 600; }

.rate-good { color: #2f7a3f; }
.rate-mid { color: #b7791f; }
.rate-bad { color: #c0392b; }
