:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4f;
  --text: #e8eef7;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --accent-dim: #2563b8;
  --danger: #f87171;
  --ok: #4ade80;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
.app-shell {
  min-height: 100vh;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.banner { margin: 0 1rem 1rem; padding: 0.65rem 1rem; background: rgba(220, 53, 69, 0.12); border-radius: 6px; }
.section-heading { margin: 1.5rem 0 0.75rem; font-size: 1rem; color: var(--muted); font-weight: 600; }
a, td a, .link-cell a { color: #7ec8ff; text-decoration: none; }
a:hover, td a:hover, .link-cell a:hover { color: #b8e0ff; text-decoration: underline; }
a:visited { color: #9ed4ff; }
.link-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { max-width: 360px; margin: 10vh auto; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; }

input, button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.6rem 0.9rem;
}
input { width: 100%; margin: 0.4rem 0 1rem; background: var(--bg); color: var(--text); }
button {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
}
button:hover { background: var(--accent-dim); }
button.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }

header {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}
header h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}
.header-brand-link {
  color: inherit !important;
  text-decoration: none !important;
}
.header-brand-link:hover {
  color: var(--accent) !important;
}
#logout-btn {
  flex-shrink: 0;
  margin-left: auto;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
}
.header-scheduler-status {
  flex-shrink: 0;
}
.scheduler-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: help;
  white-space: nowrap;
}
.scheduler-status-pill .ssp-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}
.sched-status-hot {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(245, 158, 11, 0.12);
}
.sched-status-cold {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.1);
}
.sched-status-normal {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.1);
}
.sched-status-unknown {
  color: var(--muted);
  border-color: var(--border);
  background: rgba(15, 20, 25, 0.45);
}
.scheduler-status-banner {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.scheduler-status-banner .ssb-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  font-size: 1rem;
}
.scheduler-status-banner .ssb-main strong {
  font-size: 1.05rem;
}
.scheduler-status-banner .ssp-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  flex-shrink: 0;
}
.scheduler-status-banner .ssb-metrics {
  font-size: 0.8rem;
}
.scheduler-status-banner .ssb-hint {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}
.header-stats {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.3rem 0.4rem;
  min-width: 0;
}
.header-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.15rem 0.45rem;
  background: rgba(15, 20, 25, 0.55);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.68rem;
  line-height: 1.2;
}
.header-stat .hs-val {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.75rem;
}
.header-stat .hs-lbl {
  color: var(--muted);
  white-space: nowrap;
}
@media (max-width: 1100px) {
  .header-stats { justify-content: flex-start; }
  #logout-btn { margin-left: 0; }
}
.tabs { display: flex; gap: 0.5rem; padding: 1rem 1.5rem 0; }
.tabs button { background: transparent; color: var(--muted); border: 1px solid transparent; }
.tabs button.active { color: var(--text); border-color: var(--border); background: var(--surface); }

/* ─── Start-Dashboard ─── */
.home-dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: stretch;
}
.home-panel-stats,
.home-panel-notices {
  width: 100%;
  min-width: 0;
}
.chart-detail-dialog {
  width: min(96vw, 1100px);
  max-width: 96vw;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
}
.chart-detail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.chart-detail-form {
  margin: 0;
  padding: 1rem 1.1rem 0.85rem;
}
.chart-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.chart-detail-head h3 {
  margin: 0;
  font-size: 1.05rem;
}
.chart-detail-close {
  padding: 0.25rem 0.55rem;
  line-height: 1;
}
.chart-range-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.chart-range-pill {
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.chart-range-pill:hover {
  color: var(--text);
  border-color: rgba(96, 165, 250, 0.4);
}
.chart-range-pill.active {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.55);
  color: var(--accent);
  font-weight: 600;
}
.chart-detail-canvas-wrap {
  position: relative;
  height: min(52vh, 420px);
  min-height: 240px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(8, 12, 18, 0.35);
  padding: 0.5rem 0.35rem 0.25rem;
}
.chart-detail-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}
.chart-detail-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  background: rgba(8, 12, 18, 0.55);
  border-radius: 10px;
}
.chart-detail-loading.hidden { display: none; }
.chart-detail-hint {
  margin: 0.5rem 0 0;
}
.chart-detail-actions {
  margin-top: 0.75rem;
}
.articles-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.articles-toolbar input[type="search"] {
  flex: 1 1 240px;
  min-width: 200px;
  max-width: 480px;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.articles-scroll {
  overflow: auto;
  max-height: calc(100vh - 11rem);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.articles-table { width: 100%; border-collapse: collapse; }
.articles-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}
.articles-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.articles-table th.sortable:hover { color: var(--accent); }
.articles-table th.sort-active { color: var(--accent); }
.articles-table .sort-arrow {
  display: inline-block;
  min-width: 0.85em;
  margin-left: 0.2em;
  opacity: 0.35;
  font-size: 0.8em;
}
.articles-table th.sort-active .sort-arrow { opacity: 1; }
.articles-load-hint {
  text-align: center;
  padding: 0.65rem;
  margin: 0;
}
.home-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.1rem 1.15rem;
  min-height: 0;
}
.home-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}
.home-panel-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.home-panel-sub { font-size: 0.72rem; white-space: nowrap; }
.home-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
}
@media (max-width: 1400px) {
  .home-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .home-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.dash-tile {
  background: rgba(15, 20, 25, 0.45);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.6rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 88px;
  cursor: default;
}
.dash-tile[title] {
  cursor: help;
}
.dash-tile-chart {
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: inherit;
  font: inherit;
  background: rgba(15, 20, 25, 0.45);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.6rem 0.5rem;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.dash-tile-chart:hover {
  border-color: rgba(96, 165, 250, 0.4);
  background: rgba(15, 20, 25, 0.65);
}
.dash-tile-chart:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.dash-tile-label {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-tile-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.15;
  word-break: break-word;
}
.dash-tile-value.value-warn { color: #fbbf24; }
.dash-tile-value.value-ok { color: var(--ok); }
.dash-tile-spark {
  margin-top: auto;
  height: 36px;
  width: 100%;
  opacity: 0.9;
}
.dash-tile-spark-interactive {
  position: relative;
  cursor: crosshair;
  touch-action: none;
}
.dash-tile-spark svg {
  display: block;
  width: 100%;
  height: 100%;
}
.dash-tile-spark .spark-hover-dot {
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.08s ease;
}
.dash-tile-spark.is-hovering .spark-hover-dot {
  opacity: 1;
}
.spark-crosshair {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 1px;
  background: rgba(255, 255, 255, 0.28);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.08s ease;
}
.dash-tile-spark.is-hovering .spark-crosshair {
  opacity: 1;
}
.spark-tooltip {
  position: fixed;
  z-index: 2000;
  pointer-events: none;
  padding: 0.4rem 0.55rem;
  min-width: 5.5rem;
  background: rgba(8, 12, 18, 0.94);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.72rem;
  line-height: 1.35;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, calc(-100% - 10px));
}
.spark-tooltip.hidden {
  display: none;
}
.spark-tip-rel {
  display: block;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.75rem;
}
.spark-tip-val {
  display: block;
  color: var(--text);
  font-weight: 700;
  font-size: 0.85rem;
  margin-top: 0.1rem;
}
.spark-tip-abs {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  margin-top: 0.15rem;
}
.dash-tile-spark .spark-fill {
  fill: url(#sparkGrad);
  opacity: 0.35;
}
.home-notice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  max-height: min(62vh, 520px);
  overflow-y: auto;
  padding-right: 2px;
}
@media (max-width: 1200px) {
  .home-notice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .home-notice-grid { grid-template-columns: 1fr; }
}
.home-notice-grid .notice-card {
  margin: 0;
  font-size: 0.82rem;
  padding: 0.65rem 0.7rem;
}
.home-notice-grid .notice-card p {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.78rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.home-notice-grid .notice-head strong {
  font-size: 0.8rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.home-notice-grid .notice-actions button {
  padding: 0.35rem 0.55rem;
  font-size: 0.72rem;
}
.home-notice-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.notice-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.notice-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(15, 20, 25, 0.35);
}
.notice-card.notice-warn { border-color: #f59e0b55; background: rgba(245, 158, 11, 0.08); color: var(--text); }
.notice-card.notice-error { border-color: #ef444455; background: rgba(239, 68, 68, 0.1); color: var(--text); }
.notice-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.notice-head time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.notice-card p { margin: 8px 0 10px; font-size: 13px; line-height: 1.45; }
.notice-actions { display: flex; gap: 8px; }
.tab { padding: 1.5rem; }
.toolbar { margin-bottom: 1rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 0.75rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 0.75rem;
  text-align: center;
  min-width: 0;
}
.card .value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.25;
  word-break: break-word;
}
.card .label { color: var(--muted); font-size: 0.78rem; margin-top: 0.35rem; line-height: 1.2; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
td code { font-size: 0.75rem; word-break: break-all; }

.token-display {
  margin-top: 1rem;
  padding: 0.8rem;
  background: var(--bg);
  border-radius: 8px;
  word-break: break-all;
  font-family: monospace;
  color: var(--ok);
}

.token-blur-field {
  display: inline-block;
  max-width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 0.75rem;
  line-height: 1.4;
  word-break: break-all;
  filter: blur(6px);
  transition: filter 0.2s ease;
  cursor: pointer;
  user-select: none;
}
.token-blur-field:hover,
.token-blur-field:focus {
  filter: blur(0);
  user-select: all;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.profile-dl .token-blur-field {
  display: block;
  width: 100%;
}
.copy-toast {
  position: fixed;
  z-index: 20000;
  transform: translate(-50%, -120%);
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 0.8rem;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

.admin-toast-stack {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 20001;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(360px, 92vw);
  max-height: min(70vh, 480px);
  overflow-x: hidden;
  overflow-y: auto;
  pointer-events: none;
}

.admin-toast {
  position: relative;
  pointer-events: auto;
  padding: 0.75rem 2.25rem 0.85rem 0.85rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.4;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: admin-toast-in 0.22s ease;
}

.admin-toast-success { border-color: #166534; }
.admin-toast-error { border-color: #7f1d1d; }
.admin-toast-warn { border-color: #854d0e; }
.admin-toast-alert {
  border-color: #ea580c;
  background: linear-gradient(135deg, #431407 0%, var(--surface) 55%);
  color: #ffedd5;
}

.admin-toast-out {
  opacity: 0;
  transform: translateX(12px);
  transition: opacity 0.2s, transform 0.2s;
}

.admin-toast-close {
  position: absolute;
  top: 0.35rem;
  right: 0.5rem;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: none;
  background: transparent;
  color: #8b9cb3;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.admin-toast-close:hover { color: var(--text); }
.admin-toast-alert .admin-toast-close { color: #fdba74; }
.admin-toast-alert .admin-toast-close:hover { color: #ffedd5; }

.admin-toast-from {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #8b9cb3;
  margin-bottom: 0.25rem;
}

.admin-toast-alert .admin-toast-from { color: #fdba74; }
.admin-toast-message { white-space: pre-wrap; word-break: break-word; }

.user-toast-dialog textarea {
  width: 100%;
  min-width: min(420px, 88vw);
  min-height: 6rem;
  margin-top: 0.35rem;
  resize: vertical;
}

.user-toast-label { display: block; margin-top: 0.75rem; }
.user-toast-meta { margin: 0.35rem 0 0; }

.admin-toast-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
}

.admin-toast-progress-bar {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left center;
}

.admin-toast-success .admin-toast-progress-bar { background: #4ade80; }
.admin-toast-error .admin-toast-progress-bar { background: #f87171; }
.admin-toast-warn .admin-toast-progress-bar { background: #fbbf24; }

@keyframes admin-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: min(720px, 94vw);
  width: 94vw;
}
dialog menu,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  padding: 0;
  border: none;
  list-style: none;
}
dialog::backdrop { background: rgba(0,0,0,0.6); }
.top-dialog,
.confirm-dialog,
.save-confirm-dialog {
  z-index: 2147483647;
}
.confirm-dialog { max-width: min(440px, 94vw); width: auto; }
.save-confirm-dialog { max-width: min(480px, 94vw); width: auto; }
.top-dialog::backdrop,
.confirm-dialog::backdrop,
.save-confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.82);
}
.confirm-dialog-message { margin: 0.75rem 0 0; line-height: 1.45; color: var(--text); }
.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  padding: 0;
  border: none;
}
button.danger { background: #dc2626; }
button.danger:hover { background: #b91c1c; }

.role-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: middle;
}
.role-badge.role-admin { background: #1e3a5f; color: #93c5fd; }
.role-badge.role-owner { background: #422006; color: #fcd34d; }
.role-badge.tier-gold { background: #422006; color: #fcd34d; }
.role-badge.tier-silver { background: #334155; color: #cbd5e1; }

.live-eng-active { color: #4ade80; font-variant-numeric: tabular-nums; }
.live-eng-inactive { color: #fbbf24; font-variant-numeric: tabular-nums; }
.live-eng-hold { color: #f87171; font-weight: 600; }

.live-engagement-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.live-engagement-row .icon-btn { flex-shrink: 0; }
.live-engagement-row .compact-btn {
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  line-height: 1.3;
}

.user-engagement-chart-dialog { max-width: min(640px, 94vw); }
.user-engagement-chart-canvas-wrap {
  position: relative;
  height: 300px;
  margin: 0.75rem 0;
  padding: 8px;
  background: #0f1419;
  border: 1px solid #2d3a4f;
  border-radius: 8px;
}
.user-engagement-chart-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.protocol-log {
  min-height: 280px;
  height: 480px;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.8rem;
}
.protocol-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.protocol-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}
.protocol-search-wrap input {
  width: 100%;
  margin: 0;
  padding-right: 2.2rem;
}
.protocol-filter-clear {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  line-height: 1;
  font-size: 1.25rem;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
}
.protocol-filter-clear:hover { color: var(--text); }
.protocol-load-hint { margin: 0.5rem 0 0; font-size: 0.85rem; }
.conn-role-blocked { color: var(--danger); font-weight: 600; }
.conn-avg-response { font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-line {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid rgba(45, 58, 79, 0.5);
  line-height: 1.4;
}
.log-line .ts { color: var(--muted); margin-right: 0.5rem; }
.log-line.level-success .cat { color: var(--ok); }
.log-line.level-error .cat { color: var(--danger); }
.log-line.level-warn .cat { color: #fbbf24; }
.log-line.level-info .cat { color: var(--accent); }
/* Discord-Bot: helles Cyan, abgehoben von Accent/Grün/Gelb/Lila – Fehler bleiben rot */
.log-line .cat.cat-discord_bot,
.log-line.level-info .cat.cat-discord_bot,
.log-line.level-success .cat.cat-discord_bot,
.log-line.level-warn .cat.cat-discord_bot {
  color: #67e8f9;
}
.log-line.level-error .cat.cat-discord_bot {
  color: var(--danger);
}
.log-line .user { color: #a78bfa; }
.log-line .msg { color: var(--text); }
button.user.user-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: #a78bfa;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
button.user.user-link:hover { color: #c4b5fd; }

.channel-fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem 0.5rem;
  margin: 1rem 0;
}
.channel-fieldset legend {
  padding: 0 0.4rem;
  color: var(--muted);
  font-weight: 600;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.checkbox-row input {
  width: auto;
  margin: 0;
}
.settings-form label:not(.checkbox-row) {
  display: block;
}
.retention-status {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 0.85rem;
  background: rgba(15, 20, 25, 0.35);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.5;
}
.error-text { color: #f87171; }

.user-profile-dialog { max-width: min(840px, 94vw); }
.user-dialog { max-width: min(560px, 94vw); }
.user-profile-body {
  display: flex;
  flex-direction: column;
  max-height: min(72vh, 640px);
  min-height: 0;
  overflow: hidden;
  font-size: 0.88rem;
}
.user-profile-info {
  flex-shrink: 0;
}
.user-profile-logs {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.user-profile-logs h4:first-child { margin-top: 0; }
.article-profile-dialog { max-width: min(920px, 96vw); }
.article-profile-body {
  display: flex;
  flex-direction: column;
  max-height: min(68vh, 600px);
  min-height: 0;
  overflow: hidden;
  font-size: 0.88rem;
}
.article-profile-info {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.article-profile-main {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}
.article-profile-fields {
  flex: 1;
  min-width: 0;
}
.article-profile-media {
  flex-shrink: 0;
  width: min(200px, 34vw);
}
.article-profile-media img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.article-profile-media .muted { font-size: 0.8rem; text-align: center; padding: 2rem 0.5rem; }
.article-profile-variants {
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.article-profile-variants h4 { margin: 0 0 0.35rem; font-size: 0.9rem; }
.article-etv-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.article-profile-logs {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.button.secondary.small,
button.secondary.small {
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
}
.article-variants-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-bottom: 1rem;
}
.article-variants-table th,
.article-variants-table td {
  text-align: left;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.sighting-list { margin: 0.25rem 0 1rem; padding-left: 0; list-style: none; }
.sighting-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  line-height: 1.45;
}
.sighting-list li:last-child { border-bottom: none; }
.profile-dl { display: grid; grid-template-columns: 8rem 1fr; gap: 0.25rem 0.75rem; margin: 0; }
.profile-dl dt { color: var(--muted); }
.gdpr-quota-row { display: flex; align-items: center; gap: 0.5rem; }
.icon-btn {
  width: 1.75rem; height: 1.75rem; padding: 0; border-radius: 50%;
  border: 1px solid var(--border, #ccc); background: var(--surface, #fff);
  cursor: pointer; font-size: 1rem; line-height: 1;
}
.icon-btn:hover { background: var(--hover, #f0f0f0); }
.profile-list { margin: 0.25rem 0 1rem; padding-left: 1.1rem; font-size: 0.82rem; }
.user-profile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}
.user-profile-discord-label {
  font-size: 0.85rem;
  color: var(--muted);
}
.user-profile-discord-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.5rem;
}
.user-profile-discord-row input {
  flex: 1;
  min-width: 10rem;
  margin: 0;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  line-height: 1.25;
  box-sizing: border-box;
  height: 2.35rem;
}
.user-profile-discord-hint { margin: 0 0 0.5rem; }
.btn-discord-admin {
  margin: 0;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 8px;
  background: #5865f2;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-discord-admin:hover { background: #4752c4; }
.guild-gate-hint {
  margin: 0.75rem auto 1rem;
  max-width: 28rem;
  text-align: left;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(88, 101, 242, 0.35);
  background: rgba(88, 101, 242, 0.1);
  border-radius: 8px;
}
.guild-gate-hint p { margin: 0 0 0.75rem; }
.guild-gate-hint .btn-discord-admin {
  display: inline-block;
  text-decoration: none;
}
.guild-gate-admin-box { margin-bottom: 1.25rem; }
.guild-gate-admin-box h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.linkish { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; text-align: left; }
.linkish:hover { text-decoration: underline; }
.admin-list { margin: 0.5rem 0 1rem; font-size: 0.85rem; }

.strikes-dialog { max-width: min(840px, 94vw); }
.scan-block-active { color: var(--danger); }
button.scan-unblock-btn {
  margin-left: 0.35rem;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
}
.strikes-scan-block {
  margin: 0 0 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}
.strike-block-warn { margin: 0 0 0.35rem; color: var(--danger); font-size: 0.9rem; }
.strike-block-hint { margin: 0 0 0.65rem; font-size: 0.8rem; }
.strikes-list { max-height: 50vh; overflow-y: auto; margin: 0.75rem 0; }
.strike-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.strike-row .strike-meta { color: var(--muted); font-size: 0.8rem; }
.strike-row .strike-actions { display: flex; gap: 0.35rem; }
.strikes-add { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.strikes-add h4 { margin: 0 0 0.5rem; font-size: 0.9rem; color: var(--muted); }
.strikes-add-fields {
  display: grid;
  grid-template-columns: 1fr minmax(10rem, 14rem);
  gap: 0.75rem;
  align-items: end;
}
@media (max-width: 560px) {
  .strikes-add-fields { grid-template-columns: 1fr; }
}
button.strike-btn {
  padding: 0.15rem 0.45rem;
  font-size: 0.8rem;
  min-width: 0;
}
button.strike-count-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 0.15rem 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 6px;
}
button.strike-count-btn:hover { border-color: var(--accent); }
