/* ChEBE Reports — design tokens (humanist 521 BT corporate) */
:root {
  --fg: #1a1a2e;
  --fg-muted: #4a4a5e;
  --fg-soft: #6e6e88;
  --bg: #fafafa;
  --bg-card: #ffffff;
  --line: #e6e6ee;
  --line-soft: #f0f0f5;
  --accent: #1a1a2e;
  --green: #14a06f;
  --red: #d24545;
  --amber: #d97706;
  --blue: #2563eb;
  --shadow: 0 1px 2px rgba(26,26,46,.04), 0 4px 12px rgba(26,26,46,.04);
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
body {
  font-family: 'Humanist 521 BT','Helvetica Neue',Helvetica,Arial,system-ui,-apple-system,sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* Header bar */
.topbar {
  border-bottom: 1px solid var(--line);
  background: white;
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; max-width: 1200px; margin: 0 auto;
}
.brand {
  font-weight: 600; font-size: 14px; letter-spacing: 0.5px;
}
.brand-mark { color: var(--accent); }
.brand-meta { color: var(--fg-soft); }
.topnav { display: flex; gap: 24px; font-size: 13px; }
.topnav a { color: var(--fg-muted); text-decoration: none; transition: color .15s; }
.topnav a:hover { color: var(--accent); }
.btn-pdf {
  background: var(--accent); color: white; border: none;
  padding: 8px 16px; border-radius: 6px; font-size: 13px;
  cursor: pointer; font-family: inherit;
}

/* Hero */
.hero {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, white 0%, var(--bg) 100%);
}
.hero-tag {
  font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--fg-soft); margin-bottom: 12px;
}
.hero h1 {
  font-size: 40px; font-weight: 700; line-height: 1.15;
  margin-bottom: 16px; letter-spacing: -0.5px;
}
.hero-sub {
  font-size: 18px; color: var(--fg-muted); max-width: 720px;
}
.hero-meta {
  margin-top: 24px; display: flex; gap: 32px;
  font-size: 13px; color: var(--fg-soft); flex-wrap: wrap;
}
.hero-meta b { color: var(--fg); font-weight: 600; }

/* TL;DR strip */
.tldr {
  padding: 32px 0;
}
.tldr-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.kpi-card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow);
}
.kpi-label {
  font-size: 11px; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--fg-soft);
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 32px; font-weight: 700; line-height: 1.1;
  display: flex; align-items: baseline; gap: 8px;
}
.kpi-suffix { font-size: 14px; color: var(--fg-soft); font-weight: 400; }
.kpi-delta {
  font-size: 12px; margin-top: 6px;
  display: flex; align-items: center; gap: 4px;
}
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.kpi-delta.neutral { color: var(--fg-soft); }
.kpi-arrow { font-size: 10px; }

/* Sections */
section { padding: 48px 0; border-top: 1px solid var(--line); }
section.no-border { border-top: none; }
.section-tag {
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--fg-soft); margin-bottom: 8px;
}
section h2 {
  font-size: 28px; font-weight: 700; line-height: 1.2;
  margin-bottom: 8px; letter-spacing: -0.3px;
}
section .lead { font-size: 16px; color: var(--fg-muted); max-width: 760px; margin-bottom: 32px; }

/* Cards */
.card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 14px; font-weight: 600;
  color: var(--fg-muted); margin-bottom: 4px;
  letter-spacing: 0.3px;
}
.card-sub { font-size: 12px; color: var(--fg-soft); margin-bottom: 16px; }

/* Two-col layout */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) {
  .two-col, .three-col, .tldr-grid { grid-template-columns: 1fr; }
}

/* Tables */
table.data {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
table.data th, table.data td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line-soft);
}
table.data th {
  font-weight: 600; color: var(--fg-muted); font-size: 11px;
  letter-spacing: 0.5px; text-transform: uppercase;
}
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:hover { background: var(--bg); }

/* Severity badges */
.badge {
  display: inline-block; padding: 2px 8px; font-size: 11px;
  border-radius: 4px; font-weight: 600; letter-spacing: 0.3px;
}
.badge.crit  { background: #fce8e8; color: var(--red); }
.badge.high  { background: #fef3c7; color: var(--amber); }
.badge.med   { background: #e0e7ff; color: var(--blue); }
.badge.low   { background: #f0f0f5; color: var(--fg-soft); }
.badge.ok    { background: #d1fae5; color: var(--green); }

/* Charts */
.chart {
  width: 100%; height: 320px;
}
.chart-tall { height: 420px; }

/* Cause boxes */
.cause-box {
  border-left: 4px solid var(--red); padding: 16px 20px;
  background: #fef7f7; border-radius: 0 8px 8px 0; margin: 16px 0;
}
.cause-box.amber { border-color: var(--amber); background: #fffbeb; }
.cause-box.green { border-color: var(--green); background: #ecfdf5; }
.cause-box h4 { font-size: 14px; margin-bottom: 8px; font-weight: 600; }
.cause-box p { font-size: 14px; color: var(--fg-muted); margin-top: 6px; }
.cause-box ul { margin: 8px 0 0 18px; font-size: 14px; color: var(--fg-muted); }
.cause-box ul li { margin: 4px 0; }
.cause-box code {
  background: rgba(0,0,0,.06); padding: 1px 6px;
  border-radius: 3px; font-size: 12px; font-family: ui-monospace,monospace;
}

/* Footer */
footer {
  padding: 32px 0; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--fg-soft); text-align: center;
}
footer p { margin: 4px 0; }
footer a { color: var(--fg-muted); text-decoration: none; }

/* Update banner — "Актуализировано" */
.update-banner {
  background: linear-gradient(180deg, #ffffff 0%, #f5f5fa 100%);
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}
.update-banner .ub-tag {
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--green); font-weight: 600; margin-bottom: 8px;
}
.update-banner h3 {
  font-size: 18px; font-weight: 700; margin-bottom: 12px;
  letter-spacing: -0.2px;
}
.update-banner .ub-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 700px) { .update-banner .ub-cols { grid-template-columns: 1fr; } }
.update-banner .ub-col h4 {
  font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase;
  margin-bottom: 8px; color: var(--fg-muted);
}
.update-banner ul { margin: 0 0 0 4px; list-style: none; }
.update-banner ul li {
  font-size: 13.5px; color: var(--fg-muted); margin: 6px 0;
  padding-left: 22px; position: relative; line-height: 1.4;
}
.update-banner ul li.fixed::before { content: '✅'; position: absolute; left: 0; font-size: 12px; }
.update-banner ul li.open::before  { content: '🔴'; position: absolute; left: 0; font-size: 12px; }
.update-banner ul li.new::before   { content: '🆕'; position: absolute; left: 0; font-size: 12px; }

/* Status pills for tables */
.st { display: inline-block; padding: 2px 8px; font-size: 11px; border-radius: 4px; font-weight: 600; white-space: nowrap; }
.st-fixed { background: #d1fae5; color: var(--green); }
.st-open  { background: #fce8e8; color: var(--red); }
.st-new   { background: #fef3c7; color: var(--amber); }
.st-part  { background: #e0e7ff; color: var(--blue); }

/* Print — PDF optimization */
@media print {
  .topbar, .btn-pdf, .topnav { display: none; }
  body { background: white; font-size: 11pt; }
  section { padding: 16pt 0; page-break-inside: avoid; border: none; }
  .card { box-shadow: none; border: 0.5pt solid #ccc; }
  .hero { padding: 0; }
  .hero h1 { font-size: 22pt; }
  .chart { page-break-inside: avoid; }
}

/* ============================================================
   Monthly report system — additions (2026-05-20)
   ============================================================ */

/* Month picker in topbar */
.report-picker { display: flex; align-items: center; gap: 8px; }
.report-picker label {
  font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--fg-soft);
}
.report-picker select {
  font-family: inherit; font-size: 13px; color: var(--fg);
  background: white; border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 28px 6px 10px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236e6e88' stroke-width='1.5' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.report-picker select:hover { border-color: var(--fg-soft); }

/* Admin-version banner */
.admin-banner {
  background: #1a1a2e; color: #fff;
  text-align: center; font-size: 12px; letter-spacing: 0.5px;
  padding: 8px 16px;
}
.admin-banner b { color: #ffd166; }

/* Variant tag in hero */
.hero-variant {
  display: inline-block; font-size: 11px; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
  padding: 3px 10px; border-radius: 4px; margin-left: 10px;
  vertical-align: middle;
}
.hero-variant.client { background: #d1fae5; color: var(--green); }
.hero-variant.admin  { background: #1a1a2e; color: #ffd166; }

/* "Выполнено за месяц" — done list */
.done-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px) { .done-grid { grid-template-columns: 1fr; } }
.done-list { list-style: none; }
.done-list li {
  font-size: 14px; color: var(--fg-muted); margin: 10px 0;
  padding-left: 26px; position: relative; line-height: 1.45;
}
.done-list li::before {
  content: '✓'; position: absolute; left: 0; top: 0;
  width: 18px; height: 18px; border-radius: 50%;
  background: #d1fae5; color: var(--green);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.done-list li b { color: var(--fg); font-weight: 600; }

/* Plan cards — next month */
.plan-group { margin-top: 24px; }
.plan-group-title {
  font-size: 13px; font-weight: 700; letter-spacing: 0.3px;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.plan-item {
  border-left: 3px solid var(--line); padding: 12px 16px;
  background: var(--bg-card); border-radius: 0 8px 8px 0;
  margin: 8px 0; font-size: 14px; color: var(--fg-muted);
}
.plan-item.p0 { border-color: var(--red); }
.plan-item.p1 { border-color: var(--amber); }
.plan-item.p2 { border-color: var(--blue); }
.plan-item b { color: var(--fg); font-weight: 600; }
.plan-item .plan-tag {
  font-size: 11px; font-weight: 700; margin-right: 8px;
}
.plan-item.p0 .plan-tag { color: var(--red); }
.plan-item.p1 .plan-tag { color: var(--amber); }
.plan-item.p2 .plan-tag { color: var(--blue); }

/* Admin-only callout */
.admin-only {
  border: 1px dashed #b08400; background: #fffdf5;
  border-radius: 8px; padding: 16px 20px; margin: 16px 0;
}
.admin-only .ao-tag {
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  color: #b08400; font-weight: 700; margin-bottom: 6px;
}
.admin-only p, .admin-only ul { font-size: 13.5px; color: var(--fg-muted); }
.admin-only ul { margin: 6px 0 0 18px; }
.admin-only ul li { margin: 4px 0; }

/* MoM delta inline */
.mom { font-size: 12px; font-weight: 600; }
.mom.up { color: var(--green); }
.mom.down { color: var(--red); }
.mom.neutral { color: var(--fg-soft); }

@media print {
  .report-picker, .admin-banner { display: none; }
}
