/* Все цвета — в двух списках ниже. Новая тема = ещё один такой список. */
:root, [data-theme="dark"] {
  --bg: #151517; --side: #111113; --card: #1B1B1E; --soft: #26262A; --post: #101012;
  --line: #2A2A2E; --line2: #3A3A40;
  --text: #F2F2F3; --muted: #9B9BA1; --dim: #8A8A92;
  --accent: #8B7CF6; --on-accent: #111113; --link: #B3A8FF;
  --primary: #F2F2F3; --on-primary: #111113;
  --ok: #6FD79A; --ok-bg: #16301F; --warn: #E0A458; --bad: #F0736A;
}
[data-theme="light"] {
  --bg: #F4F5FA; --side: #FFFFFF; --card: #FFFFFF; --soft: #EEF0F7; --post: #F0F1F6;
  --line: #E4E6EE; --line2: #CDD1DC;
  --text: #16181D; --muted: #5A6070; --dim: #6B7180;
  --accent: #4F5BD5; --on-accent: #FFFFFF; --link: #3D48B8;
  --primary: #4F5BD5; --on-primary: #FFFFFF;
  --ok: #1C7A47; --ok-bg: #E3F4EA; --warn: #8A5300; --bad: #B3362B;
}

* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 Inter, system-ui, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--link); }
h1 { margin: 0; font-size: 28px; font-weight: 600; }
h2 { margin: 0; font-size: 18px; font-weight: 600; }
.muted { color: var(--muted); font-size: 13px; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }

.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
aside { flex: 1 0 220px; background: var(--side); border-right: 1px solid var(--line); padding: 24px 14px;
        display: flex; flex-direction: column; gap: 24px; }
.brand { padding: 0 14px; } .brand b { display: block; font-size: 22px; font-weight: 600; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a, .side-button { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 14px;
        border-radius: 8px; color: var(--muted); text-decoration: none; font: inherit; background: none; border: 0;
        cursor: pointer; text-align: left; width: 100%; }
nav a:hover, .side-button:hover { color: var(--text); background: var(--soft); }
nav a.active { background: var(--soft); color: var(--text); font-weight: 600; }
nav .later { color: var(--dim); cursor: default; } nav .later:hover { background: none; color: var(--dim); }
.count { background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.side-label { padding: 0 14px 6px; font-size: 12px; color: var(--dim); }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }

main { flex: 999 1 560px; min-width: 0; padding: 28px 32px; display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.row > .grow { flex: 2 1 420px; min-width: 0; } .row > .side { flex: 1 1 280px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px;
        display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat { gap: 6px; padding: 18px; } .stat b { font-size: 34px; font-weight: 600; line-height: 1.1; }
.line { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding-top: 10px; border-top: 1px solid var(--line); }
.line > .fill { flex: 1 1 200px; min-width: 0; }
.pill { font-size: 13px; padding: 5px 12px; border-radius: 16px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.tag { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 6px; background: var(--soft); white-space: nowrap; }

button, .button { min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line2); background: var(--card);
        color: var(--text); font: inherit; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
button:hover, .button:hover { border-color: var(--dim); }
button.primary, .button.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
button.danger { color: var(--bad); }
button.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
input, select, textarea { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line2); border-radius: 8px;
        background: var(--card); color: var(--text); font: inherit; max-width: 100%; }
textarea { resize: vertical; width: 100%; } input[type=file] { padding: 9px 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
label > input, label > select { width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#notice { display: none; padding: 12px 16px; border-radius: 8px; background: var(--soft); border: 1px solid var(--line2); }
#notice.show { display: block; } #notice.bad { border-color: var(--bad); color: var(--bad); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
th { border-top: 0; color: var(--muted); font-weight: 500; white-space: nowrap; cursor: pointer; user-select: none; }
th[aria-sort="ascending"]::after { content: " ↑"; } th[aria-sort="descending"]::after { content: " ↓"; }
td input { min-height: 36px; padding: 4px 8px; }

.list { padding: 8px; gap: 4px; }
.list a { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 8px; border: 1px solid transparent;
        text-decoration: none; color: var(--text); }
.list a:hover { background: var(--soft); } .list a.active { background: var(--soft); border-color: var(--accent); }
.photos { display: flex; flex-wrap: wrap; gap: 8px; } .photos img { max-width: 220px; max-height: 180px; border-radius: 10px; }
.box { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }

.post { max-width: 420px; background: var(--post); border: 1px solid var(--line); border-radius: 14px; padding: 16px;
        display: flex; flex-direction: column; gap: 10px; }
.post b { font-size: 17px; font-weight: 600; } .post .body { white-space: pre-line; font-size: 14px; }
.post img { max-width: 100%; border-radius: 10px; }
.post .links { font-size: 13px; color: var(--link); }
.post .keys { display: flex; flex-direction: column; gap: 6px; }
.post .keys button, .post .keys span { min-height: 40px; border-radius: 8px; background: var(--soft); border: 0; color: var(--text);
        display: flex; align-items: center; justify-content: center; font-size: 14px; width: 100%; }
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 620px; overflow-y: auto; padding: 4px; }
.chat .in { align-self: flex-end; background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: 14px;
        max-width: 85%; white-space: pre-line; }
.chat .post { align-self: flex-start; max-width: 85%; }
.login { max-width: 380px; margin: 12vh auto; }

[hidden] { display: none !important; }

input::file-selector-button { font: inherit; color: var(--text); background: var(--soft); border: 1px solid var(--line2);
        border-radius: 6px; padding: 4px 10px; margin-right: 10px; cursor: pointer; }

/* Графики: один цвет, тонкие столбцы, подсказка при наведении */
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--accent); } .chart .hit { fill: transparent; }
.chart g:hover .bar { opacity: .75; }
.chart .axis { stroke: var(--line2); stroke-width: 1; } .chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.chart text { fill: var(--muted); font-size: 11px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel .track { height: 10px; border-radius: 5px; background: var(--soft); overflow: hidden; }
.funnel .fill { height: 100%; border-radius: 5px; background: var(--accent); min-width: 2px; }
#tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font-size: 13px; padding: 6px 10px;
        border-radius: 6px; white-space: nowrap; z-index: 10; }
code { background: var(--soft); padding: 2px 6px; border-radius: 4px; font-size: 13px; }

.pill.bad { color: var(--bad); }
