/* reports_ui — компактный собственный CSS (без CDN), палитра на переменных */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1c2430;
  --muted: #6b7684;
  --border: #dde2e8;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --ok-bg: #e7f6ec;
  --ok-text: #1a7f37;
  --err-bg: #fdebec;
  --err-text: #b42318;
  --warn-bg: #fff4e5;
  --warn-text: #b25e09;
  --red-row: #fff1f0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand { font-weight: 700; color: var(--text); text-decoration: none; }

.topbar nav { display: flex; gap: 12px; flex: 1; }

.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
}

.topbar nav a:hover { color: var(--text); background: var(--bg); }
.topbar nav a.active { color: var(--accent-dark); font-weight: 600; }

.logout-form { margin: 0; }

.container { max-width: 1400px; margin: 0 auto; padding: 16px 20px 48px; }

h1 { font-size: 20px; margin: 8px 0 12px; }
h2 { font-size: 16px; margin: 20px 0 8px; }
.red-title { color: var(--err-text); }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, monospace; font-size: 12px; }

.flash { padding: 8px 12px; border-radius: 8px; margin: 8px 0; }
.flash-ok { background: var(--ok-bg); color: var(--ok-text); }
.flash-err { background: var(--err-bg); color: var(--err-text); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0 12px;
}

.filters label { display: flex; align-items: center; gap: 4px; }

input, select, button {
  font: inherit;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
}

.btn { cursor: pointer; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }

table.report { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }

table.report th, table.report td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

table.report thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
table.report tfoot th { border-top: 2px solid var(--border); }
table.report .num { text-align: right; }
table.report .day { color: var(--muted); }
table.report .row-total { font-weight: 600; }
table.report tr.unattributed, table.report.red-list tbody tr { background: var(--red-row); }
table.report a { color: var(--accent-dark); text-decoration: none; }
table.report a:hover { text-decoration: underline; }
table.matrix th.chat-col { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }

.pos { color: var(--ok-text); }
.neg { color: var(--err-text); }

.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
  margin-left: 4px;
}
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }

.stats { display: flex; flex-wrap: wrap; gap: 16px; margin: 12px 0; color: var(--muted); }
.stats b { color: var(--text); }

.edit-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0 16px;
}

.edit-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.edit-form .hint { width: 100%; margin: 0; }

.hint { color: var(--muted); font-size: 12px; }

.pagination { display: flex; gap: 12px; align-items: center; margin: 12px 0; }

.login-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; }

.login-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 340px;
}

.login-box h1 { margin-top: 0; font-size: 18px; }
.login-box form { display: flex; flex-direction: column; gap: 10px; }

.partial-loading { opacity: 0.5; }

.metric-switch { display: flex; gap: 10px; align-items: center; padding-left: 8px; border-left: 1px solid var(--border); }
.metric-switch label { display: flex; align-items: center; gap: 4px; }

.legend { margin: 20px 0; color: var(--muted); font-size: 13px; }
.legend summary { cursor: pointer; font-weight: 600; }
.legend dl { margin: 8px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; }
.legend dt { font-weight: 600; }
.legend dd { margin: 0; }
