:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --sidebar: #ffffff;
  --control: #ffffff;
  --line: #cbd5e1;
  --line-strong: #aebccc;
  --text: #172033;
  --muted: #526277;
  --accent: #1d5fae;
  --accent-hover: #174d8d;
  --accent-soft: #e7f0fb;
  --table-head: #eef2f7;
  --row-hover: #f3f6fa;
  --disabled: #e8edf3;
  --green: #137a44;
  --green-soft: #e7f6ed;
  --yellow: #9a6700;
  --yellow-soft: #fff5cc;
  --red: #b4233a;
  --red-soft: #fcebed;
  --shadow: 0 1px 3px rgb(23 32 51 / 10%);
  --nav-text: #334155;
  --nav-hover: #f0f4f9;
  --label: #334155;
  --placeholder: #64748b;
  --preview-bg: #e7eef5;
  --message-bg: #ffffff;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #252a31;
  --panel: #343a43;
  --sidebar: #171b21;
  --control: #2c323a;
  --line: #4c5663;
  --line-strong: #657181;
  --text: #f0f3f7;
  --muted: #b6c0cd;
  --accent: #76b7ff;
  --accent-hover: #a7d0ff;
  --accent-soft: #253c57;
  --table-head: #2a3038;
  --row-hover: #3c444e;
  --disabled: #424a55;
  --green: #75d9a2;
  --green-soft: #233f31;
  --yellow: #ffd66b;
  --yellow-soft: #4a3d20;
  --red: #ff9aaa;
  --red-soft: #512d35;
  --shadow: 0 1px 4px rgb(0 0 0 / 30%);
  --nav-text: #d9e1ea;
  --nav-hover: #252c35;
  --label: #d9e1ea;
  --placeholder: #9faaba;
  --preview-bg: #222830;
  --message-bg: #3b424c;
}

[data-theme="dark"] main > header {
  margin: -28px -28px 22px;
  padding: 22px 28px;
  background: var(--sidebar);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, sans-serif;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}

aside {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 14px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
}

.brand {
  padding: 0 10px 25px;
  color: var(--text);
  font-size: 17px;
  font-weight: 750;
}

nav {
  display: grid;
  gap: 6px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(29 95 174 / 28%);
  outline-offset: 2px;
}

aside a {
  padding: 11px 12px;
  border-radius: 9px;
  color: var(--nav-text);
  font-weight: 600;
}

aside a:hover {
  background: var(--nav-hover);
  color: var(--accent-hover);
  text-decoration: none;
}

aside a.active {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 var(--accent);
  color: var(--accent-hover);
}

.logout {
  margin-top: auto;
}

.logout button,
.secondary {
  background: var(--panel);
  color: var(--nav-text);
  border: 1px solid var(--line-strong);
}

.logout button:hover,
.secondary:hover {
  background: var(--row-hover);
  border-color: #8494a8;
  color: var(--text);
  text-decoration: none;
}

.logout button {
  width: 100%;
}

main {
  width: 100%;
  min-width: 0;
  max-width: 1600px;
  padding: 28px;
}

header {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 22px;
}

h1 {
  margin: 2px 0;
  color: var(--text);
  font-size: 28px;
}

h2 {
  color: var(--text);
  font-size: 17px;
}

h3 {
  margin-top: 22px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.eyebrow,
header p {
  margin: 0;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.cards.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cards.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cards article,
.panel,
.quick a {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.cards span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.cards strong {
  color: var(--text);
  font-size: 22px;
}

.cards article.positive strong,
.positive {
  color: var(--green) !important;
}

.monitoring-summary strong {
  display: block;
  margin-top: 8px;
  line-height: 1;
}
.monitoring-workspace { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:0 0 16px; }
.channel-publication-list { display:grid; gap:12px; }
.channel-publication-card { display:grid; grid-template-columns:minmax(0,180px) minmax(0,1fr); gap:16px; }
.channel-publication-card-media,.channel-publication-preview-frame,.channel-publication-media-placeholder { width:100%; max-width:520px; aspect-ratio:16/9; border:1px solid var(--line); border-radius:10px; background:var(--surface); overflow:hidden; }
.channel-publication-preview-frame,.selected-image-preview { max-width:280px; }
.selected-image-preview { display:grid; gap:6px; min-width:0; }
.selected-image-preview img { display:block; width:100%; max-height:158px; object-fit:contain; border:1px solid var(--line); border-radius:10px; }
.selected-image-preview span { color:var(--muted); font-size:12px; overflow-wrap:anywhere; }
.channel-publication-card img,.channel-publication-preview-frame img,.channel-publication-preview { display:block; width:100%; height:100%; object-fit:contain; }
.channel-publication-media-placeholder { display:grid; place-items:center; min-width:0; color:var(--muted); background:var(--panel); }
.channel-publication-workspace > *,.channel-publication-workspace form,.channel-publication-workspace label { min-width:0; }
.editorial-note { color:var(--muted); }
.editorial-note small { font-weight:400; }
.field-summary { display:grid; gap:4px; }
.field-summary span { color:var(--muted); font-size:12px; }
.quick-times { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0; }
.quick-times button { width:auto; min-width:70px; }
.quick-times button.active { border-color:var(--accent); background:var(--accent-soft); color:var(--accent); }
.schedule-time { min-width:0; margin:0; padding:0; border:0; }
.schedule-time legend { margin-bottom:6px; font-weight:700; }
.planning-panel .schedule-time + .actions { margin-top:12px; }
.media-remove-form { margin-top:12px; }
.media-remove-form + .media-upload-form { margin-top:12px; }
.channel-inline-delete { display:flex; flex-direction:column; align-items:flex-start; gap:12px; margin-top:24px; padding-top:18px; border-top:1px solid var(--line); }
.channel-inline-delete [data-delete-confirm] { display:flex; align-items:center; flex-wrap:wrap; gap:10px; margin:0; }
.channel-inline-delete [data-delete-confirm][hidden] { display:none; }
.daily-timeline { display:grid; gap:0; margin:18px 0; }
.timeline-slot { min-width:0; display:grid; grid-template-columns:120px minmax(0,1fr); gap:16px; padding:16px 0; border-top:1px solid var(--line); }
.timeline-slot time { font-weight:700; }
.timeline-slot > * { min-width:0; }
.timeline-publication { display:grid; gap:5px; }
.slot-publication-chooser { min-width:0; }
.slot-publication-chooser > summary { display:inline-flex; align-items:center; cursor:pointer; color:var(--accent); font-weight:700; list-style:none; }
.slot-publication-chooser > summary::-webkit-details-marker { display:none; }
.slot-publication-chooser-body { display:grid; gap:12px; max-width:720px; margin-top:12px; padding:14px; border:1px solid var(--line); border-radius:12px; background:var(--panel); }
.slot-publication-chooser-body h3,.slot-publication-chooser-body h4 { margin:0; }
.slot-create-publication { justify-self:start; }
.slot-draft-list { display:grid; gap:8px; max-height:320px; overflow-y:auto; }
.slot-draft-row { min-width:0; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:12px; padding:9px 0; border-top:1px solid var(--line); }
.slot-draft-row span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.slot-draft-add { width:auto; padding:7px 11px; white-space:nowrap; }
.monitoring-workspace-card { min-width:0; display:grid; gap:10px; padding:16px; border:1px solid var(--line); border-radius:12px; background:var(--panel); color:var(--text); box-shadow:var(--shadow); }
.monitoring-workspace-card:hover { border-color:#93add0; text-decoration:none; }
.monitoring-workspace-card.active { border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); }
.monitoring-workspace-card span { overflow-wrap:anywhere; }
.monitoring-workspace-card strong { font-size:22px; }
.monitoring-workflow { color:var(--muted); overflow-wrap:anywhere; }
.monitoring-quick-filters { align-items:center; }
.monitoring-search { flex:1 1 280px; min-width:0; }
.monitoring-search input { width:100%; min-width:0; }
.league-chips { display:flex; flex-wrap:wrap; gap:7px; min-width:0; }
.league-chip { min-height:36px; }
.league-chip.active { border-color:var(--accent); background:var(--accent); color:#fff; }
.monitoring-bulk { min-width:0; margin-bottom:14px; padding:12px 14px; border:1px solid var(--line); border-radius:12px; background:var(--panel); }
.monitoring-bulk summary { cursor:pointer; font-weight:700; }
.monitoring-bulk[open] summary { margin-bottom:12px; }
.monitoring-bulk form, .monitoring-bulk .bulk-bar { min-width:0; }

.cards article.negative strong,
.negative {
  color: var(--red) !important;
}
.meta-tags{display:flex;gap:.45rem;flex-wrap:wrap;align-items:center}.material-body{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.65;font-size:1rem}

.quick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.quick a {
  display: grid;
  gap: 7px;
  color: var(--text);
}

.quick a span {
  color: var(--muted);
}

.quick a:hover {
  border-color: #93add0;
  color: var(--accent-hover);
  text-decoration: none;
}

.filters {
  min-width: 0;
  display: flex;
  gap: 9px;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.filters label {
  display: grid;
  gap: 5px;
  color: var(--label);
  font-weight: 600;
}

input,
select,
textarea,
button,
.primary,
.secondary {
  min-height: 38px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--control);
  color: var(--text);
  font: inherit;
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #8494a8;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--accent);
}

input:disabled,
select:disabled,
textarea:disabled,
button:disabled {
  background: var(--disabled);
  color: #66758a;
  cursor: not-allowed;
}

button,
.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 650;
}

button:hover,
.primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: #ffffff;
  text-decoration: none;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--table-head);
  color: var(--label);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:hover {
  background: var(--row-hover);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.mono {
  font-family: ui-monospace, monospace;
}

.break {
  overflow-wrap: anywhere;
}

.badge {
  display: inline-block;
  padding: 3px 7px;
  border: 1px solid #d3dbe6;
  border-radius: 99px;
  background: #e8edf3;
  color: var(--label);
}

.badge.ok {
  border-color: #a9d8bc;
  background: var(--green-soft);
  color: var(--green);
}

.badge.off {
  color: var(--muted);
}

.badge.expense {
  border-color: #efb9c2;
  background: var(--red-soft);
  color: var(--red);
}

.comment {
  max-width: 340px;
  overflow-wrap: anywhere;
}

.money {
  white-space: nowrap;
}

.inline {
  display: inline;
}

.danger {
  min-height: auto;
  padding: 5px 8px;
  border: 1px solid #d86879;
  background: var(--panel);
  color: var(--red);
}

.danger:hover {
  border-color: var(--red);
  background: var(--red-soft);
  color: #8f1830;
  text-decoration: none;
}

td a + a {
  margin-left: 8px;
}

.empty {
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.pagination a {
  min-width: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel);
  text-align: center;
}

.pagination a:hover {
  background: var(--row-hover);
  text-decoration: none;
}

.pagination a.current {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.pagination span {
  margin-left: 8px;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.panel.wide {
  grid-column: 1 / -1;
}

dl {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 8px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
}

.event {
  display: flex;
  gap: 18px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.event time {
  color: var(--muted);
}

.form-panel {
  max-width: 760px;
}

.entry-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.entry-form label {
  min-width: 0;
  display: grid;
  gap: 6px;
  color: var(--label);
  font-weight: 600;
}

.entry-form .full,
.actions {
  grid-column: 1 / -1;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.form-error {
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid #efb9c2;
  border-radius: 8px;
  background: var(--red-soft);
  color: #8f1830;
}

.notice {
  padding: 10px 12px;
  border: 1px solid #a9d8bc;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tabs a {
  padding: 9px 13px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
}

.tabs a.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.publication-editor {
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(280px, 420px);
  gap: 20px;
  align-items: start;
}

.publication-editor form,
.preview {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.button-grid {
  display: grid;
  grid-template-columns: 150px minmax(180px, 2fr) 1fr 1fr;
  gap: 8px;
}

.optional-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.optional-section summary {
  cursor: pointer;
  font-weight: 700;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.phone {
  padding: 18px;
  border-radius: 16px;
  background: var(--preview-bg);
}

.message {
  margin-top: 8px;
  padding: 12px;
  border-radius: 10px;
  background: var(--message-bg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.entry-form small {
  color: var(--muted);
  font-weight: 400;
}

.preview-button {
  display: inline-block;
  margin: 10px 5px 0 0;
  padding: 7px 12px;
  border-radius: 7px;
  background: #d8e8f7;
  color: var(--accent);
  font-weight: 650;
}

.history-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
}

.history-toolbar a {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-decoration: none;
}

.history-toolbar a.active {
  color: #fff;
  background: var(--accent);
}

.history-toolbar .secondary {
  margin-left: auto;
}

.header-actions,
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.theme-options {
  display: flex;
  gap: 24px;
}

.theme-options label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.theme-options input {
  min-height: auto;
}

.status-failed,
.status-partial {
  color: #8a3b13;
  background: #fff0d9;
}

.overview-header { gap: 24px; }
.health-monitor { margin-left: auto; min-width: min(760px, 64vw); }
.health-summary { margin: 0 0 7px; color: var(--muted); text-align: right; font-size: 12px; }
.health-strip { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.health-item { display: grid; grid-template-columns: auto auto; column-gap: 6px; align-items: center; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); white-space: nowrap; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.health-label { font-weight: 700; }
.health-state { grid-column: 2; color: var(--muted); font-size: 11px; }
.health-line { width: 20px; height: 2px; background: var(--line-strong); }
.health-item[data-status="healthy"] .health-dot { background: var(--green); animation: health-pulse 3s ease-in-out infinite; }
.health-item[data-status="warning"] .health-dot { background: var(--yellow); }
.health-item[data-status="unhealthy"] .health-dot { background: var(--red); }
.health-item[data-status="healthy"] + .health-line { background: var(--green); }
.health-item[data-status="warning"] + .health-line { background: var(--yellow); }
.health-item[data-status="unhealthy"] + .health-line { background: var(--red); }
.bot-health-item { padding-inline: 10px; }
.bot-health-item .health-label { max-width: 112px; overflow: hidden; text-overflow: ellipsis; }
@keyframes health-pulse { 50% { opacity: .7; box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 18%, transparent); } }
@media (prefers-reduced-motion: reduce) { .health-item[data-status="healthy"] .health-dot { animation: none; } }
.attention-panel { margin-top: 24px; max-width: 900px; }
.attention-panel h2 { margin: 0 0 12px; font-size: 18px; }
.attention-item { display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.attention-item + .attention-item { margin-top: 10px; }
.attention-item.status-error { border-color: #e8aaaa; }
.attention-item.status-warning { border-color: var(--yellow); background: var(--yellow-soft); }
.attention-item.status-unknown { border-color: #c8ccd2; }
.attention-item p { margin: 4px 0 0; color: var(--muted); }
.attention-item time { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.attention-icon { line-height: 1.4; }
.attention-ok { margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--muted); }

.channel-own { border-left: 4px solid var(--accent, #2563eb); }
.channel-hero { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(2, minmax(140px, 1fr)) auto; gap: 18px; align-items: center; }
.channel-hero strong { font-size: 1.25rem; }
.channel-hero span { display: block; color: var(--muted, #64748b); font-size: .82rem; }
.channel-hero b { display: block; margin-top: 6px; }
.channel-add { margin: 18px 0; align-items: end; }
.channel-add label { flex: 1 1 360px; }
.periods { display: flex; gap: 8px; }
.periods a { padding: 8px 12px; border-radius: 8px; background: var(--surface, #fff); }
.periods a.active { background: var(--accent, #2563eb); color: #fff; }
.sparkline { min-height: 110px; display: flex; align-items: end; gap: 5px; padding: 12px; border-bottom: 1px solid var(--border, #dbe3ef); }
.sparkline i { display: block; flex: 1; min-height: 12px; height: 45%; border-radius: 4px 4px 0 0; background: var(--accent, #2563eb); opacity: .75; }

.analytics-heading { align-items: flex-start; }
.overview-identity { display: flex; align-items: center; gap: 13px; min-width: 220px; }
.overview-logo { display: block; flex: 0 0 54px; width: 54px; height: 54px; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); box-shadow: var(--shadow); object-fit: contain; }
.analytics-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 19px; font-weight: 700; }
.analytics-period { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 22px; padding: 14px 16px; }
.period-presets { display: flex; flex-wrap: wrap; gap: 7px; }
.period-chip { padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--nav-text); font-weight: 650; }
.period-chip:hover { border-color: var(--accent); text-decoration: none; }
.period-chip.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.custom-period-form { display: flex; align-items: end; gap: 8px; }
.custom-period-form label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 650; }
.custom-period-form input { min-width: 138px; }
.custom-period-form button { padding: 9px 14px; }
.analytics-alert { margin-bottom: 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.analytics-alert.error { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.analytics-alert.success { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.analytics-unavailable { max-width: 800px; }
.analytics-section { min-width: 0; margin-top: 24px; }
.analytics-section.panel { margin-top: 0; }
.section-title { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 12px; }
.section-title h2 { margin: 0; font-size: 19px; }
.section-title .eyebrow { margin-bottom: 3px; }
.section-note { max-width: 520px; color: var(--muted); font-size: 12px; text-align: right; }
.analytics-kpis { display: grid; gap: 12px; }
.analytics-kpis.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.analytics-kpi { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); }
.analytics-kpi > span, .compact-kpis span, .language-row span, .retention-row span { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
.analytics-kpi > strong { display: block; margin: 8px 0 4px; font-size: clamp(22px, 2.1vw, 31px); line-height: 1; }
.analytics-kpi small { color: var(--muted); }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }
.analytics-grid { display: grid; gap: 16px; margin-top: 16px; }
.analytics-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
section[aria-labelledby="users-title"] + .analytics-grid.two { align-items: stretch; }
.analytics-grid > .panel { min-width: 0; }
.league-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.league-grid article { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.league-grid strong { display: block; margin: 4px 0; font-size: 21px; }
.league-grid small { color: var(--muted); }
progress { overflow: hidden; width: 100%; height: 7px; border: 0; border-radius: 999px; background: var(--disabled); }
progress::-webkit-progress-bar { background: var(--disabled); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.league-grid progress { margin-top: 9px; }
.analytics-footnote { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.language-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.language-row > div { display: grid; grid-template-columns: auto auto; gap: 2px 10px; min-width: 110px; padding: 9px 11px; border-radius: 9px; background: var(--accent-soft); }
.language-row strong { font-size: 18px; }
.language-row small { grid-column: 1 / -1; color: var(--muted); }
.language-row .muted { background: var(--disabled); }
.compact-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.compact-kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.compact-kpis article { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.compact-kpis strong { display: block; margin-top: 5px; font-size: 18px; overflow-wrap: anywhere; }
.retention-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.retention-row article { padding: 9px; border-radius: 9px; background: var(--accent-soft); }
.retention-row strong, .retention-row small { display: block; }
.retention-row strong { margin: 4px 0; font-size: 18px; }
.retention-row small { color: var(--muted); }
.empty.compact { min-height: 0; margin-top: 12px; padding: 14px; }
.analytics-grid.two.chart-grid { align-items: stretch; }
.chart-panel { display: flex; flex-direction: column; height: 360px; min-height: 360px; overflow: hidden; }
.chart-panel > .bar-chart { flex: 0 0 246px; }
.chart-panel > .empty { display: grid; place-items: center; flex: 0 0 246px; box-sizing: border-box; }
.chart-footnote { min-height: 30px; }
.bar-chart { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; gap: 3px; height: 246px; min-height: 246px; box-sizing: border-box; padding: 26px 4px 10px; overflow: hidden; }
.bar-column { display: grid; grid-template-rows: 18px 140px 52px; align-items: end; align-self: end; justify-items: center; min-width: 0; height: 210px; border-bottom: 1px solid transparent; }
.bar-value { color: var(--muted); font-size: 10px; }
.bar-column .bar { display: block; width: min(18px, 80%); min-height: 2px; border-radius: 5px 5px 0 0; background: var(--accent); opacity: .86; }
.activity-chart .bar { background: var(--green); }
.channel-actions-heading { text-align: center; }
.channel-actions { display: grid; grid-template-columns: repeat(2, 132px); justify-content: center; align-items: center; gap: 8px 28px; white-space: nowrap; }
.channel-action-button { display: inline-flex; box-sizing: border-box; width: 100%; min-height: 36px; align-items: center; justify-content: center; gap: 7px; padding: 7px 12px; border: 1px solid; border-radius: 8px; background: var(--panel); font-size: 14px; font-weight: 700; line-height: 1.2; }
.channel-actions a + a { margin-left: 0; }
.channel-action-open { border-color: var(--accent); color: var(--accent); }
.channel-action-open:hover { border-color: var(--accent-hover); background: var(--accent-soft); color: var(--accent-hover); text-decoration: none; }
.channel-action-delete { border-color: #d86879; color: var(--red); }
.channel-action-delete:hover { border-color: var(--red); background: var(--red-soft); color: var(--red); text-decoration: none; }
.finance-journal { margin-top: 18px; }
.bar-column small { align-self: start; margin-top: 8px; color: var(--muted); font-size: 9px; white-space: nowrap; transform: rotate(-35deg); transform-origin: center; }
.bar.level-0 { height: 2px; opacity: .3; }
.bar.level-1 { height: 14px; }.bar.level-2 { height: 28px; }.bar.level-3 { height: 42px; }.bar.level-4 { height: 56px; }.bar.level-5 { height: 70px; }
.bar.level-6 { height: 84px; }.bar.level-7 { height: 98px; }.bar.level-8 { height: 112px; }.bar.level-9 { height: 126px; }.bar.level-10 { height: 140px; }
.event-log-filters { margin-bottom: 18px; }
.event-log-filter-form, .event-history-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.event-log-filter-form label, .event-history-form label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 650; }
.event-log-filter-form select { min-width: 170px; }
.event-log-table td:first-child { white-space: nowrap; }
.event-level { display: inline-flex; min-width: 74px; justify-content: center; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.event-level.level-info { color: var(--green); background: var(--green-soft); }
.event-level.level-warning { color: #785900; background: var(--yellow-soft); }
.event-level.level-error { color: var(--red); background: var(--red-soft); }
.event-history { margin-top: 18px; }
.event-history h2 { margin-top: 0; }
.rank-list { display: grid; }
.rank-list article { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rank-list article:last-child { border-bottom: 0; }
.rank { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 750; }
.rank-list small { display: block; color: var(--muted); }
.rank-value { text-align: right; }
.interest-list { display: grid; gap: 13px; }
.interest-list article { display: grid; grid-template-columns: 130px minmax(0, 1fr); align-items: center; gap: 12px; }
.interest-list strong, .interest-list span { display: block; }
.interest-list span { color: var(--muted); font-size: 12px; }

@media (max-width: 1200px) {
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .overview-header { flex-direction: column; align-items: stretch; }
  .health-monitor { margin-left: 0; min-width: 0; }
  .health-summary { text-align: left; }
  .health-strip { justify-content: flex-start; flex-wrap: wrap; }
  .health-line { width: 12px; }
  .analytics-kpis.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .analytics-period { align-items: stretch; flex-direction: column; }
  .custom-period-form { flex-wrap: wrap; }
}

.view-toggle { display: flex; gap: 8px; }
.view-toggle a { padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; }
.view-toggle a.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.content-plan-calendar { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:10px; margin-bottom:18px; min-width:0; }
.content-plan-day { position:relative; display:grid; gap:5px; min-width:0; padding:10px 34px 10px 10px; color:inherit; background:var(--panel); border:1px solid var(--line); border-radius:10px; overflow-wrap:anywhere; }
.content-plan-slot-indicators { position:absolute; top:12px; right:12px; display:grid; gap:6px; }
.content-plan-slot-dot { width:9px; height:9px; border-radius:50%; background:#c2cad6; box-shadow:0 0 0 1px rgba(26,49,82,.12); }
.content-plan-slot-dot.occupied { background:var(--green); }
.content-plan-slot-dot.published { background:var(--red); }
.content-plan-published-status { color:var(--green); }
.content-plan-day:hover, .content-plan-day.selected { border-color: var(--accent); text-decoration: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.content-plan-day strong { font-size: 12px; color: var(--muted); }
.content-plan-day em { font-style: normal; font-weight: 700; }
.content-plan-day small { color: var(--muted); }
.content-plan-card-facts { display: grid; gap: 2px; margin-top: 2px; }
.content-plan-news-candidates { display: grid; gap: 10px; margin-top: 18px; }
.content-plan-news-candidates article { display: grid; gap: 7px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.content-plan-news-candidates strong { overflow-wrap: anywhere; }
.news-candidate-add { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: 0; }
.news-candidate-add > * { width: 100%; min-width: 0; max-width: 100%; }
.status-READY { color: var(--green); }.status-DRAFT { color: #785900; }.status-EMPTY { color: var(--muted); }
.content-plan-editor, .content-plan-editor form, .planned-items { min-width: 0; }
.content-plan-editor { scroll-margin-top: 16px; }
.content-plan-selected-header { margin-bottom:16px; }
.content-plan-day-settings { display: flex; align-items: end; gap: 10px; margin: 14px 0; }
.content-plan-day-settings fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.content-plan-day-settings legend { margin-bottom: 5px; font-weight: 700; }
.league-selector { display: flex; flex-wrap: wrap; gap: 6px; }
.league-selector label { min-width: 0; cursor: pointer; }
.league-selector input { position: absolute; opacity: 0; pointer-events: none; }
.league-selector span { display: block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.league-selector input:checked + span { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.league-selector input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.standard-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.standard-slots span { padding: 7px 11px; background: var(--accent-soft); border-radius: 999px; font-weight: 700; }
.planned-items { margin-top: 20px; }
.planned-item { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, .75fr) minmax(0, 1.5fr) minmax(0, 2fr) minmax(0, .8fr) minmax(0, .8fr); gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.planned-item > select, .planned-item > input:not([type="hidden"]), .planned-item > button { width: 100%; min-width: 0; max-width: 100%; }
.planned-item > button { height: auto; overflow-wrap: anywhere; }
.planned-item.new-item { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, .75fr) minmax(0, 1.5fr) minmax(0, 2fr) minmax(0, 1.2fr); }
.planned-item.new-item { margin-top: 14px; border: 1px dashed var(--line); border-radius: 10px; padding: 12px; }
.safety-note { margin-top: 20px; padding: 14px; border-left: 4px solid var(--green); background: var(--green-soft); }
@media (max-width: 1200px) { .planned-item, .planned-item.new-item { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .content-plan-calendar { grid-template-columns:repeat(4,minmax(0,1fr)); } }
@media (max-width: 760px) { .content-plan-calendar { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width: 600px) { .planned-item, .planned-item.new-item, .content-plan-day-settings, .news-candidate-add { display: grid; grid-template-columns: minmax(0, 1fr); } .league-selector { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } .league-selector span { min-width: 0; text-align: center; overflow-wrap: anywhere; } .section-title > *, .section-title form, .section-title button { min-width: 0; max-width: 100%; } }
@media (max-width: 420px) { .content-plan-calendar { grid-template-columns:minmax(0,1fr); } }

@media (max-width: 900px) {
  .app {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  aside {
    padding-inline: 10px;
  }

  aside span {
    display: none;
  }

  aside a {
    padding-inline: 0;
    text-align: center;
  }

  .brand {
    padding-inline: 0;
    text-align: center;
  }

  .logout button {
    padding-inline: 0;
    font-size: 0;
  }

  .logout button::before {
    content: "↪";
    font-size: 18px;
  }

  .cards,
  .cards.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  main {
    padding: 18px;
  }

  [data-theme="dark"] main > header {
    margin: -18px -18px 22px;
    padding: 18px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
  .monitoring-workspace { grid-template-columns:1fr; }
  .channel-publication-card { grid-template-columns:1fr; }
  .timeline-slot { grid-template-columns:1fr; gap:8px; }
  .monitoring-quick-filters, .league-chips, .monitoring-bulk .bulk-bar { width:100%; min-width:0; }
  .monitoring-bulk .bulk-bar > * { width:100%; min-width:0; max-width:100%; }

  .publication-editor {
    grid-template-columns: 1fr;
  }

  .button-grid {
    grid-template-columns: 1fr 1fr;
  }

  .panel.wide {
    grid-column: auto;
  }
  .channel-hero { grid-template-columns: 1fr 1fr; }
  .analytics-grid.two { grid-template-columns: 1fr; }
  section[aria-labelledby="users-title"] + .analytics-grid.two { align-items: start; }
  .analytics-kpis.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-title { align-items: flex-start; flex-direction: column; }
  .section-note { text-align: left; }
  .compact-kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .channel-actions { grid-template-columns: 1fr; justify-items: stretch; gap: 10px; }
}

@media (max-width: 600px) {
  header {
    align-items: stretch;
    flex-direction: column;
  }

  header > .primary {
    align-self: flex-start;
  }

  header > *,
  .filters,
  .filters > *,
  .entry-form > *,
  .entry-form input,
  .entry-form select,
  .entry-form textarea {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .cards,
  .cards.four,
  .cards.three,
  .quick,
  .entry-form {
    grid-template-columns: 1fr;
  }

  .button-grid {
    grid-template-columns: 1fr;
  }

  .entry-form .full,
  .actions {
    grid-column: auto;
  }

  dl {
    grid-template-columns: 1fr;
  }
  .channel-hero { grid-template-columns: 1fr; }
  .analytics-kpis.five,
  .league-grid,
  .compact-kpis,
  .compact-kpis.four,
  .retention-row { grid-template-columns: 1fr; }
  .custom-period-form { display: grid; grid-template-columns: 1fr; }
  .custom-period-form > * { width: 100%; }
  .interest-list article { grid-template-columns: 1fr; }
  .overview-logo { width: 48px; height: 48px; flex-basis: 48px; }
}
.backup-panel{margin-top:18px}.backup-content{width:100%;max-width:760px}.backup-heading{display:flex;align-items:center;justify-content:space-between;gap:16px}.backup-heading h2{margin:2px 0 0}.backup-health,.status-dot{color:var(--green);font-weight:750}.backup-unavailable{margin:18px 0 2px;color:var(--muted)}.backup-metrics,.backup-summary{display:grid;gap:12px;margin-top:16px}.backup-metrics{grid-template-columns:minmax(0,2fr) minmax(140px,1fr)}.backup-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.backup-metrics section,.backup-summary section{min-width:0;padding:12px;border:1px solid var(--line);border-radius:10px}.backup-summary .backup-retention{grid-column:1}.backup-panel h3{margin:0 0 7px;font-size:14px;text-transform:none}.backup-panel p{margin:4px 0;color:var(--muted)}.database-metric{align-self:start}.disk-progress{display:block;width:100%;height:8px;margin:11px 0 3px;overflow:hidden;border:0;border-radius:999px;background:var(--disabled);color:var(--green);appearance:none}.disk-progress::-webkit-progress-bar{background:var(--disabled);border-radius:999px}.disk-progress::-webkit-progress-value{background:currentColor;border-radius:999px}.disk-progress::-moz-progress-bar{background:currentColor;border-radius:999px}.disk-progress.warning{color:var(--yellow)}.disk-progress.critical{color:var(--red)}.backup-warning{color:var(--red)}.backup-next{margin-top:14px!important}.backup-next strong{color:var(--text)}.backup-next small{display:block;margin-top:3px}.recent-title{margin-top:20px!important}.backup-table-wrap{max-width:100%;overflow-x:hidden}.backup-table{width:100%;min-width:0;table-layout:fixed;font-size:13px}.backup-table th:nth-child(1){width:11%}.backup-table th:nth-child(2){width:35%}.backup-table th:nth-child(3){width:20%}.backup-table th:nth-child(4){width:20%}.backup-table th:nth-child(5){width:14%}.backup-table td,.backup-table th{padding:9px 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@media(max-width:900px){.backup-content{max-width:100%}}@media(max-width:600px){.backup-heading{align-items:flex-start;flex-direction:column}.backup-metrics,.backup-summary{grid-template-columns:1fr}.backup-summary .backup-retention{grid-column:auto}.backup-table{font-size:12px}.backup-table td,.backup-table th{padding-left:4px;padding-right:4px}}
.backup-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.backup-grid .backup-panel{margin-top:18px}.backup-grid .backup-content{max-width:none}.backup-download-form{margin-top:18px}.backup-download-form button{width:100%}@media(max-width:1100px){.backup-grid{grid-template-columns:1fr}}

/* BOT-PUBLICATION-IMAGES-A0: double the initial height; keep manual resizing. */
#publication-form textarea[name="body_ru"] { min-height: 400px; height: 400px; resize: vertical; }
#publication-form textarea[name="body_en"] { min-height: 400px; height: 400px; resize: vertical; }
#publication-image-preview { display: block; width: 100%; height: auto; border-radius: 12px; margin-bottom: 12px; }
#publication-image-preview[hidden] { display: none; }
