:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #edf4fb;
  --ink: #162536;
  --muted: #64768a;
  --line: #d5e0eb;
  --accent: #3f6f9f;
  --accent-strong: #2f5d88;
  --accent-soft: #e5eff8;
  --exclude: #a5425d;
  --exclude-soft: #f7e8ee;
  --danger: #b4233a;
  --shadow: 0 12px 30px rgba(36, 70, 105, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
textarea,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 24px;
  overflow-y: auto;
}

.brand {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand p,
.eyebrow {
  color: var(--muted);
  font-size: 13px;
}

.panel {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.panel-heading h2,
.field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.panel-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.sort-control {
  min-width: 230px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
}

.field-help {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.field-help.warning-text {
  color: #8a5a00;
  font-weight: 700;
}

textarea,
input[type="search"],
input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 96px;
  padding: 10px 12px;
}

textarea:focus,
input[type="search"]:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.button-row,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button-row {
  margin-top: 10px;
}

.primary-button,
.ghost-button,
.icon-button,
.load-more {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: 120ms ease;
}

.primary-button {
  flex: 1;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button {
  background: transparent;
  color: var(--accent);
  padding: 0 8px;
}

.read-all-button {
  border-color: var(--line);
  background: #fff;
  color: var(--accent-strong);
  padding: 0 12px;
  font-weight: 700;
  white-space: nowrap;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  background: var(--surface-soft);
  color: var(--ink);
  border-color: var(--line);
  font-weight: 700;
}

.icon-button:hover,
.ghost-button:hover {
  border-color: var(--accent);
}

button:disabled,
button.is-busy {
  cursor: wait;
  opacity: 0.52;
  filter: saturate(0.55);
}

.primary-button:disabled,
.primary-button.is-busy,
.ghost-button:disabled,
.ghost-button.is-busy,
.icon-button:disabled,
.icon-button.is-busy,
.danger-button:disabled,
.danger-button.is-busy,
.row-actions button:disabled,
.row-actions button.is-busy {
  pointer-events: none;
}

.primary-button:disabled:hover,
.primary-button.is-busy:hover {
  background: var(--accent);
}

.ghost-button:disabled:hover,
.ghost-button.is-busy:hover,
.icon-button:disabled:hover,
.icon-button.is-busy:hover {
  border-color: transparent;
}

.tag-picker {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
}

.tag-controls {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.tag-clear {
  justify-self: end;
  min-height: 30px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-list[hidden] {
  display: none;
}

.tag-list-scroll {
  max-height: 152px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.tag-list-selected {
  max-height: none;
  overflow: visible;
}

.tag-empty {
  width: 100%;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.tag-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.tag-tab {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 4px 6px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
}

.tag-tab.active {
  background: #fff;
  color: var(--accent-strong);
  box-shadow: 0 1px 3px rgba(36, 70, 105, 0.12);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 5px 10px;
  font-size: 14px;
}

.tag small {
  color: var(--muted);
}

.tag.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tag.excluded {
  border-color: var(--exclude);
  background: var(--exclude-soft);
  color: var(--exclude);
}

.content {
  min-width: 0;
  padding: 28px;
}

.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.toolbar h2 {
  font-size: 28px;
  line-height: 1.2;
  margin-top: 4px;
}

.search {
  display: grid;
  grid-template-columns: 24px minmax(120px, 220px);
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 10px;
}

.search span {
  color: var(--muted);
}

.search input {
  border: 0;
  padding: 0;
}

.search input:focus {
  box-shadow: none;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  min-height: 38px;
  padding: 0 10px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 32px;
  margin-bottom: 14px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 4px 9px;
  color: var(--muted);
  font-size: 13px;
}

.feed {
  display: grid;
  gap: 12px;
}

.post {
  --feed-thumb-width: clamp(220px, 18vw, 264px);

  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--feed-thumb-width);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow);
}

.post.seen {
  opacity: 0.68;
}

.post.no-media {
  grid-template-columns: minmax(0, 1fr);
}

.post-main {
  min-width: 0;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.post-sources a {
  color: var(--accent-strong);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.post-sources a:hover {
  border-bottom-color: currentColor;
}

.post-source-separator {
  color: var(--muted);
}

.post h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.3;
}

.post h3 a {
  color: inherit;
  text-decoration: none;
}

.post p {
  color: #24364a;
  margin-bottom: 12px;
}

.search-hit {
  border-radius: 4px;
  background: #fff1a8;
  color: inherit;
  padding: 0 2px;
}

.search-full-match {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid #ead26f;
  border-radius: 999px;
  background: #fff1a8;
  color: #5b4a08;
  padding: 3px 9px;
  font-size: 12px;
  margin-bottom: 12px;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.post-tag,
.post-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent-strong);
  padding: 3px 8px;
  font-size: 12px;
}

.post-badge {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.post-badge-icon {
  justify-content: center;
  width: 24px;
  padding: 0;
}

.post-badge svg,
.post-metric svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.post-metrics {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
}

.post-metric {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 20px;
  white-space: nowrap;
}

.post-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.post-actions a,
.post-actions button {
  min-height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 5px 10px;
  text-decoration: none;
  font-size: 14px;
}

.post-actions a {
  border-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 700;
}

.thumb,
.thumb-fallback {
  width: var(--feed-thumb-width);
  aspect-ratio: 4 / 3;
  border-radius: 8px;
}

.thumb {
  object-fit: cover;
  background: var(--surface-soft);
}

.thumb-fallback {
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  background: linear-gradient(135deg, #f8fbfe, #eaf2f9);
  color: var(--muted);
  text-align: center;
  padding: 10px;
  font-size: 13px;
}

.thumb-fallback span::before {
  content: "";
  display: block;
  width: 32px;
  height: 24px;
  margin: 0 auto 6px;
  border: 2px solid #b9c9d8;
  border-radius: 6px;
  background:
    linear-gradient(135deg, transparent 45%, #b9c9d8 46%, #b9c9d8 54%, transparent 55%),
    #fff;
}

.attachment-note {
  display: grid;
  place-items: center;
  width: var(--feed-thumb-width);
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 8px;
  font-size: 13px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 24px;
  color: var(--muted);
}

.load-more {
  display: none;
  width: 100%;
  margin-top: 14px;
  background: var(--surface);
  border-color: var(--line);
  color: var(--accent-strong);
  font-weight: 700;
}

.load-more.visible {
  display: block;
}

.admin-layout {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-header .brand {
  margin-bottom: 0;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topic-switcher {
  display: grid;
  gap: 4px;
  min-width: 180px;
}

.topic-switcher .field-label {
  margin-bottom: 0;
}

.topic-switcher select {
  min-height: 38px;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  padding: 0 12px;
  text-decoration: none;
  font-weight: 700;
}

.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.admin-tabs button {
  min-height: 38px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-weight: 700;
}

.admin-tabs button.active {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.auth-panel {
  max-width: 560px;
}

.admin-form {
  display: grid;
  gap: 10px;
}

.inline-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 8px;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr)) 160px;
  gap: 10px;
  margin-bottom: 14px;
}

.sources-summary {
  grid-template-columns: repeat(3, minmax(120px, 1fr)) minmax(140px, 160px) minmax(170px, 210px);
}

.tech-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.admin-summary > div,
.admin-summary > button,
.tech-summary > div {
  min-height: 66px;
  border-radius: 8px;
}

.admin-summary > div,
.tech-summary > div {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 12px;
}

.admin-summary span,
.tech-summary span {
  display: block;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
}

.admin-summary small,
.admin-table small,
.tech-summary small {
  color: var(--muted);
}

.reread-all-button {
  border-style: dashed;
  line-height: 1.2;
}

.load-summary span {
  font-size: 20px;
  overflow-wrap: anywhere;
}

.load-summary .metric-secondary {
  display: inline;
  font-weight: 500;
}

.load-range-tabs {
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.load-range-tabs .tag-tab {
  min-width: 64px;
}

.load-chart-grid {
  margin-top: 12px;
}

.vk-links-check {
  margin-bottom: 12px;
}

.vk-links-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 700;
}

.vk-links-check .table-wrap {
  margin-top: 8px;
}

.vk-links-table td {
  vertical-align: top;
}

.compact-empty {
  padding: 10px;
}

.graph-summary span {
  font-size: 22px;
}

.graph-layout-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.graph-toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.graph-layout-tabs .tag-tab {
  min-width: 76px;
}

.graph-zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.graph-zoom-controls .icon-button {
  flex: 0 0 auto;
}

.graph-zoom-value {
  min-width: 88px;
  text-align: center;
}

.source-graph-canvas {
  height: clamp(320px, 62vh, 680px);
  min-height: 260px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.source-graph-canvas.is-panning {
  cursor: grabbing;
}

.source-graph-canvas:not(.has-graph-content) {
  cursor: default;
}

.source-graph-content {
  width: 100%;
  height: 100%;
}

.mermaid-rendered,
.mermaid-rendered svg {
  display: block;
  width: 100%;
  height: 100%;
}

.source-graph-content svg {
  max-width: none !important;
}

.graph-clickable-node {
  cursor: pointer;
}

.graph-clickable-node:focus {
  outline: none;
}

.graph-clickable-node:focus-visible > :is(rect, polygon, path, circle, ellipse) {
  stroke-width: 3px;
}

.graph-loading {
  padding: 18px;
  color: var(--muted);
  font-size: 14px;
}

.mermaid-code {
  overflow: auto;
  max-height: 360px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}

.graph-errors {
  margin-top: 8px;
  color: var(--danger);
  font-size: 13px;
}

.graph-missing-table {
  min-width: 720px;
}

.graph-ignored-table {
  min-width: 720px;
}

.graph-ignore-form {
  margin-bottom: 12px;
  grid-template-columns: minmax(220px, 1fr) 140px;
}

.source-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) 120px 140px;
  gap: 10px;
  align-items: end;
}

.source-alias-editor td {
  background: var(--surface-soft);
}

.source-alias-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 140px;
  gap: 10px;
  align-items: end;
}

.source-compare-result {
  margin-bottom: 12px;
}

.source-compare-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
  margin-top: 10px;
}

.source-compare-group h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.source-compare-reasons {
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.source-compare-table {
  min-width: 900px;
  background: var(--surface);
}

.source-compare-pairs {
  margin-top: 8px;
  color: var(--muted);
}

.compact-empty {
  padding: 12px;
}

.tag-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(140px, 0.8fr) minmax(160px, 1fr) 140px;
  gap: 10px;
  align-items: end;
}

.full-field {
  grid-column: 1 / -1;
}

.tag-admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.tags-table {
  min-width: 720px;
}

.tags-table tr.active {
  background: var(--accent-soft);
}

.tags-table tbody tr {
  cursor: pointer;
}

.tags-table tbody tr:hover,
.tags-table tbody tr:focus {
  background: var(--surface-soft);
  outline: none;
}

.tags-table tbody tr.active:hover,
.tags-table tbody tr.active:focus {
  background: var(--accent-soft);
}

.tag-edit-form {
  display: grid;
  gap: 10px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.tag-edit-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.tag-edit-heading h3 {
  margin: 0;
  font-size: 18px;
}

.tag-edit-heading small {
  color: var(--muted);
}

.compact-toggle {
  justify-content: center;
  margin-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.traffic-wrap {
  margin-top: 12px;
}

.traffic-table {
  min-width: 720px;
}

.technical-log-wrap {
  overflow-x: auto;
}

.technical-current-event {
  display: grid;
  grid-template-columns: max-content max-content max-content minmax(0, 1fr);
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  min-width: 0;
}

.technical-current-event.is-idle {
  display: block;
  color: var(--muted);
}

.technical-current-label {
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.technical-current-start,
.technical-current-duration {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.technical-current-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.technical-log-wrap.is-scrollable {
  max-height: 520px;
  overflow: auto;
}

.technical-log-table {
  display: grid;
  grid-template-columns: max-content max-content fit-content(33%) minmax(0, 1fr);
  min-width: min(100%, 760px);
}

.technical-log-table thead,
.technical-log-table tbody,
.technical-log-table tr {
  display: contents;
}

.technical-log-table th,
.technical-log-table td {
  min-width: 0;
}

.technical-log-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.technical-log-start,
.technical-log-duration {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.technical-log-event {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.technical-log-event-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.technical-log-status {
  flex: 0 0 auto;
}

.technical-log-result {
  min-width: 0;
  overflow-wrap: anywhere;
}

.technical-log-empty-cell {
  grid-column: 1 / -1;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.admin-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.sort-hint {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.table-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  text-transform: inherit;
  font: inherit;
}

.table-sort-button:hover,
.table-sort-button:focus-visible {
  color: var(--accent-strong);
}

.table-sort-button.active {
  color: var(--accent-strong);
}

.sort-indicator {
  display: inline-block;
  min-width: 10px;
  color: var(--accent-strong);
}

.admin-table [data-source-sort-column="id"],
.source-number-cell {
  width: 52px;
  white-space: nowrap;
}

.source-number-cell {
  color: var(--muted);
  font-weight: 700;
}

.admin-table a {
  color: var(--accent-strong);
  text-decoration: none;
}

.admin-table tr.is-active-topic td {
  background: var(--accent-soft);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 13px;
  font-weight: 700;
}

.status-pill.ok {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-pill.error {
  background: #fff2f4;
  color: var(--danger);
}

.status-pill.muted {
  background: var(--surface-soft);
  color: var(--muted);
}

.row-actions {
  display: grid;
  gap: 6px;
  min-width: 112px;
}

.row-actions button,
.danger-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 4px 8px;
}

.danger-button {
  border-color: rgba(180, 35, 58, 0.38);
  color: var(--danger);
}

.primary-button.has-action-error,
.ghost-button.has-action-error,
.icon-button.has-action-error,
.danger-button.has-action-error,
.row-actions button.has-action-error {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
  opacity: 1;
  filter: none;
}

.primary-button.has-action-error:hover,
.ghost-button.has-action-error:hover,
.icon-button.has-action-error:hover,
.danger-button.has-action-error:hover,
.row-actions button.has-action-error:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.error-text {
  color: var(--danger);
}

.warning-text {
  color: #8a5a00;
  font-weight: 700;
}

.full-link-text {
  overflow-wrap: anywhere;
}

.admin-status {
  min-height: 24px;
  color: var(--muted);
}

.admin-status.ok {
  color: var(--accent-strong);
}

.admin-status.error {
  color: var(--danger);
}

.queue-panel {
  margin-bottom: 14px;
}

.progress-line {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

#queueProgressText {
  color: var(--muted);
  font-size: 13px;
}

.queue-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.queue-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
}

.queue-item span,
.queue-item small {
  display: block;
}

.queue-item span {
  font-weight: 700;
}

.queue-item small {
  color: var(--muted);
}

.queue-item.running {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.queue-item.error {
  border-color: rgba(180, 35, 58, 0.42);
}

.queue-item.error small {
  color: var(--danger);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
}

.chart-box {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.chart-box.wide {
  grid-column: 1 / -1;
}

.chart-box h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.chart-box canvas {
  display: block;
  width: 100%;
  max-width: 100%;
}

.service-log {
  max-height: 260px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
  color: #1d3042;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.log-details {
  margin-top: 10px;
}

.log-details summary {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.log-details summary:hover {
  border-color: var(--accent);
}

.log-details .service-log {
  margin-top: 8px;
}

.debug-log-text {
  max-height: 420px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tech-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
  margin: 0;
}

.tech-details div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.tech-details dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.tech-details dd {
  margin: 4px 0 0;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .toolbar {
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .search {
    flex: 1;
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .admin-summary,
  .tech-summary,
  .chart-grid,
  .tech-details,
  .source-form,
  .source-alias-form,
  .tag-form,
  .tag-admin-layout {
    grid-template-columns: 1fr 1fr;
  }

  .admin-summary > button,
  .source-form > button,
  .tag-form > button,
  .tag-edit-form,
  .tag-admin-layout > * {
    grid-column: 1 / -1;
  }

  .tag-edit-form {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 14px;
  }
}

@media (max-width: 640px) {
  .content,
  .sidebar {
    padding: 18px;
  }

  .post {
    grid-template-columns: 1fr;
  }

  .thumb,
  .thumb-fallback,
  .attachment-note {
    width: 100%;
  }

  .admin-layout {
    width: min(100% - 24px, 1240px);
    padding-top: 16px;
  }

  .admin-header,
  .technical-current-event,
  .inline-fields {
    grid-template-columns: 1fr;
  }

  .technical-current-name {
    white-space: normal;
  }

  .admin-header {
    display: grid;
  }

  .admin-header-actions {
    justify-content: stretch;
  }

  .admin-header-actions > * {
    flex: 1;
    justify-content: center;
  }

  .panel-heading {
    align-items: flex-start;
  }

  .panel-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .sort-control {
    min-width: min(230px, 100%);
  }

  .admin-summary,
  .tech-summary,
  .chart-grid,
  .tech-details,
  .source-form,
  .source-alias-form,
  .tag-form,
  .tag-admin-layout {
    grid-template-columns: 1fr;
  }

  .progress-line {
    grid-template-columns: 1fr;
  }
}
