:root {
  --bg: #f4f5f7; --card: #fff; --text: #1d2330; --muted: #667085; --line: #e1e4ea;
  --accent: #2b5fd9; --accent-text: #fff; --danger: #c0392b; --ok: #1e7a46;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171f; --card: #1c212c; --text: #e8ebf2; --muted: #98a2b3; --line: #2b3242;
          --accent: #6b93f5; --accent-text: #0e1220; --danger: #ef7b6c; --ok: #5fcf8f; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 16px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.top { display: flex; align-items: center; gap: 1.25rem; padding: .75rem 16px; background: var(--card);
       border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top .brand { font-weight: 700; text-decoration: none; color: var(--text); }
.top nav { display: flex; gap: 1rem; flex: 1; }
.top .logout { display: flex; gap: .75rem; align-items: center; margin: 0; }
.who { color: var(--muted); font-size: .9rem; }
main { max-width: 960px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.card.narrow { max-width: 440px; margin: 40px auto; }
h1 { font-size: 1.4rem; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 1.25rem 0 .5rem; }
h1 small { color: var(--muted); font-weight: 400; }
label { display: block; margin: .75rem 0; }
label.inline { display: inline-block; margin: 0 .75rem 0 0; font-size: .9rem; }
input[type=text], input[type=password], input[type=date], select {
  display: block; width: 100%; margin-top: .25rem; padding: .55rem .65rem; font: inherit;
  color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
input.wide { width: 100%; }
td input[type=date], .inline-form input, .inline-form select { width: auto; display: inline-block; }
.inline-form { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: .75rem 0; }
fieldset ul { list-style: none; padding: 0; margin: 0; }
button, .button { display: inline-block; padding: .55rem 1rem; font: inherit; border: 0; border-radius: 8px;
                  background: var(--accent); color: var(--accent-text); cursor: pointer; text-decoration: none; }
.button.secondary, button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button.link { background: none; color: var(--accent); padding: 0; text-decoration: underline; }
button.danger, .danger { color: var(--danger); }
button.danger { background: transparent; border: 1px solid var(--danger); }
.error { color: var(--danger); }
.ok { color: var(--ok); }
.hint, .muted { color: var(--muted); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.actions { display: flex; gap: .5rem; }
.chip { display: inline-block; margin-right: .5rem; padding: .15rem .6rem; border: 1px solid var(--line);
        border-radius: 99px; text-decoration: none; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.qr svg { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 8px; }
.codes { columns: 2; list-style: none; padding: 0; }
.files { list-style: none; padding: 0; }
.files li { padding: .35rem 0; border-bottom: 1px solid var(--line); display: flex; gap: 1rem; }
.small { font-size: .85rem; }
@media (max-width: 600px) { .codes { columns: 1; } .top nav { order: 3; width: 100%; } }

/* Журнал */
.tabs { display: flex; gap: 1rem; margin: 0 0 1rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .4rem .2rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.current { color: var(--text); border-bottom-color: var(--accent); }
.filters { margin-bottom: .5rem; }
.nowrap { white-space: nowrap; }
tr.failure td { background: rgba(200, 60, 60, .07); }
.chip.warn { border-color: var(--danger); color: var(--danger); }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; }

/* загрузка файлов */
.upload { display: grid; gap: .6rem; max-width: 520px; }
.upload label { display: grid; gap: .2rem; }
.upload progress { width: 100%; }
.upload-message { min-height: 1.2em; margin: 0; }

.banner { background: #5a2a1a; color: #fff; padding: .6rem 1rem; text-align: center; }

.search { display: flex; gap: .5rem; align-items: end; margin: .5rem 0 1rem; flex-wrap: wrap; }

/* статистика каналов (фаза 7) */
.chart { width: 100%; height: auto; max-height: 200px; }
.chart .line { stroke: #2563eb; stroke-width: 2; }
.chart .axis { stroke: #cbd5e1; stroke-width: 1; }
.chart .label { font-size: 11px; fill: #64748b; }
table.stats { width: 100%; border-collapse: collapse; font-size: 14px; }
table.stats th, table.stats td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #e2e8f0; }
