: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;
  color-scheme: dark;
}

* { 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; }

/* —— Native form controls (dark baseline) —— */
label { color: inherit; }
input, button, select, textarea {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.6rem 0.9rem;
  color: var(--text);
}
input, select, textarea { width: 100%; margin: 0.4rem 0 1rem; background: var(--bg); color: var(--text); }
textarea {
  resize: vertical;
  min-height: 4.5rem;
  line-height: 1.45;
}
select { cursor: pointer; appearance: auto; }
option,
optgroup {
  background: var(--surface);
  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); }
input[type="checkbox"],
input[type="radio"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0 0.4rem 0 0;
  padding: 0;
  border: none;
  background: transparent;
}
input[type="file"] {
  width: auto;
  margin: 0.4rem 0;
  padding: 0.25rem 0;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:disabled,
input:disabled,
select:disabled,
textarea:disabled,
button[disabled],
input[disabled],
select[disabled],
textarea[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

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;
  line-height: 1.15;
}
.header-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  flex-shrink: 0;
  min-width: 0;
}
.header-version {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: text;
}
.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.35rem 0 0;
  font-size: 0.8rem;
  line-height: 1.35;
  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;
  gap: 0.55rem;
  margin: 0;
  background: rgba(8, 12, 18, 0.55);
  border-radius: 10px;
}
.chart-detail-loading.hidden { display: none; }

/* Loading skeletons (Statistik / Home / Listen) */
.ve-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(147, 197, 253, 0.35);
  border-top-color: #93c5fd;
  animation: ve-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes ve-spin { to { transform: rotate(360deg); } }

.panel-loading-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}
.home-stat-grid > .panel-loading-hint {
  grid-column: 1 / -1;
}

.dash-tile-skeleton,
.stat-cat-card.is-skeleton,
.home-notice-skeleton,
.list-row-skeleton {
  pointer-events: none;
  position: relative;
  overflow: hidden;
}
.skeleton-line,
.skeleton-block,
.skeleton-pill {
  position: relative;
  overflow: hidden;
  background: rgba(45, 58, 79, 0.55);
  border-radius: 6px;
}
.skeleton-line::after,
.skeleton-block::after,
.skeleton-pill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 0%,
    transparent 40%,
    rgba(180, 200, 230, 0.28) 50%,
    transparent 60%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: ve-skeleton-shimmer 1.5s linear infinite;
}
@keyframes ve-skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.skeleton-line {
  display: block;
  height: 11px;
  margin-bottom: 0.45rem;
}
.skeleton-line-sm { width: 42%; }
.skeleton-line-md { width: 68%; }
.skeleton-line-lg { width: 88%; }
.skeleton-line-value {
  width: 56%;
  height: 1.35rem;
  margin: 0.15rem 0 0.55rem;
}
.dash-tile-skeleton .dash-tile-spark.skeleton-block {
  height: 34px;
  border-radius: 6px;
  margin-top: 0.35rem;
}
.stat-cat-card.is-skeleton {
  min-height: 9rem;
  padding: 0.85rem 1rem;
}
.stat-cat-card.is-skeleton .stat-cat-metrics {
  display: grid;
  gap: 0.65rem;
  margin: 0.75rem 0;
}
.home-notice-skeleton {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.home-notice-skeleton .skeleton-line:last-child { margin-bottom: 0; }
.table-loading-row td {
  padding: 1.1rem 0.75rem;
}
.table-loading-row .panel-loading-hint { margin: 0; }
.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-archive-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--muted);
  user-select: none;
  cursor: pointer;
}
.articles-archive-toggle .ve-switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  display: inline-block;
}
.articles-archive-toggle .ve-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.articles-archive-toggle .ve-switch-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #4b5563;
  border-radius: 999px;
  transition: background 0.18s ease;
}
.articles-archive-toggle .ve-switch-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.18s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.articles-archive-toggle .ve-switch input:checked + .ve-switch-slider {
  background: #3d8bfd;
}
.articles-archive-toggle .ve-switch input:checked + .ve-switch-slider::before {
  transform: translateX(18px);
}
.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-head-notices {
  align-items: center;
  min-height: 1.75rem;
}
.home-panel-head-notices .home-panel-title {
  line-height: 1.35;
}
.home-panel-head-notices #home-resolve-all-notices {
  flex-shrink: 0;
  margin-left: auto;
}
.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-secondary {
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--accent);
  opacity: 0.85;
  line-height: 1.2;
  word-break: break-word;
  margin-top: 0.1rem;
}
.dash-tile-value.value-warn { color: #fbbf24; }
.dash-tile-value.value-ok { color: var(--ok); }
.dash-tile.has-subrows {
  min-height: 0;
}
.dash-tile-subrows {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.15rem;
  padding-top: 0.2rem;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}
.dash-tile-subrow {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--muted);
  padding-left: 0.15rem;
}
.dash-tile-subrow strong {
  color: var(--text);
  font-weight: 650;
  text-align: right;
}
.dash-tile-subrow.is-warn strong { color: #fbbf24; }
.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; }

.server-layout-note { margin: 0 0 0.85rem; }
.server-panels {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
.server-panel {
  background: rgba(15, 20, 25, 0.4);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem 1rem;
}
.server-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}
.server-panel-head-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.server-panel-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}
.server-db-tables { margin-top: 0.85rem; overflow-x: auto; }
.server-db-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.server-db-table th,
.server-db-table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.backup-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin: 0.75rem 0 1rem;
}
.backup-upload-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.backup-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.backup-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 20, 25, 0.45);
}
.backup-row-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.backup-row-name {
  font-weight: 650;
  word-break: break-all;
}
.backup-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}
@media (max-width: 720px) {
  .backup-row {
    grid-template-columns: 1fr;
  }
  .backup-row-actions {
    justify-content: flex-start;
  }
}
.server-db-table th { color: var(--muted); font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 0.75rem; }
.stat-cat-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.stat-cat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}
@media (max-width: 1280px) {
  .stat-cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .stat-cat-grid { grid-template-columns: 1fr; }
}
.stat-cat-card,
.stat-gen-card {
  background: rgba(15, 20, 25, 0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.85rem 0.85rem;
  border-top: 2px solid var(--stat-accent, var(--accent));
  min-width: 0;
}
.stat-gen-card {
  border-top-color: rgba(148, 163, 184, 0.45);
}
.stat-cat-head .small-btn {
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  flex-shrink: 0;
}
.scan-queue-card .scan-queue-meta {
  text-align: right;
  max-width: 60%;
}
.scan-queue-hint {
  margin: 0 0 0.55rem;
}
.scan-queue-wrap {
  max-height: 22rem;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}
.scan-queue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.scan-queue-table th,
.scan-queue-table td {
  padding: 0.28rem 0.55rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.scan-queue-table th {
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: rgba(15, 20, 25, 0.95);
  z-index: 1;
}
.scan-queue-table .sq-idx {
  width: 2.2rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.scan-queue-table .sq-page {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.scan-queue-table .sq-scanned {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted);
}
.scan-queue-table tr.sq-fse td.sq-queue,
.scan-queue-table tr.sq-fse td.sq-kind { color: #4ade80; }
.scan-queue-table tr.sq-aa-early td.sq-queue,
.scan-queue-table tr.sq-aa-early td.sq-kind { color: #60a5fa; }
.scan-queue-table tr.sq-aa-beyond td.sq-queue,
.scan-queue-table tr.sq-aa-beyond td.sq-kind { color: #93c5fd; }
.scan-queue-table tr.sq-etv td.sq-queue,
.scan-queue-table tr.sq-etv td.sq-kind { color: #fbbf24; }
.sq-prio {
  margin-left: 0.25rem;
  color: #fbbf24;
}
.stat-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.stat-cat-head h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--text);
}
.stat-cat-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  box-sizing: border-box;
  min-width: 6.75rem;
  height: 1.45rem;
  font-size: 0.68rem;
  font-weight: 650;
  padding: 0 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.stat-cat-mode .mode-name {
  min-width: 3.2em;
  text-align: right;
}
.stat-cat-mode .mode-timer {
  min-width: 2.6em;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  opacity: 0.92;
}
.stat-cat-mode.mode-hot {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.1);
}
.stat-cat-mode.mode-cold {
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.08);
}
.stat-cat-mode.mode-normal {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.08);
}
.stat-cat-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.stat-cat-metric {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: rgba(8, 12, 16, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.45rem 0.5rem 0.4rem;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
  cursor: default;
}
button.stat-cat-metric {
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
button.stat-cat-metric:hover {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(8, 12, 16, 0.55);
}
.stat-cat-metric-label {
  font-size: 0.68rem;
  color: var(--muted);
}
.stat-cat-metric-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.15;
}
.stat-cat-spark {
  height: 28px;
  margin-top: 0.15rem;
}
.stat-cat-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.75rem;
}
.stat-cat-row-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.stat-cat-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.stat-cat-row.is-sub {
  padding-left: 0.7rem;
  font-size: 0.72rem;
}
.stat-cat-row.is-sub span::before {
  content: "· ";
  opacity: 0.7;
}
.stat-cat-row strong {
  color: var(--text);
  font-weight: 650;
  text-align: right;
}
.stat-gen-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.5rem;
}
@media (max-width: 1200px) {
  .stat-gen-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .stat-gen-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-cat-metrics,
  .stat-cat-rows { grid-template-columns: 1fr; }
}
.stat-gen-item {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  background: rgba(8, 12, 16, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.45rem 0.5rem 0.4rem;
  min-height: 64px;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
  cursor: default;
}
button.stat-gen-item {
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
button.stat-gen-item:hover {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(8, 12, 16, 0.55);
}
.stat-gen-item.is-warn .stat-gen-value { color: #fbbf24; }
.stat-gen-label {
  font-size: 0.68rem;
  color: var(--muted);
}
.stat-gen-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  word-break: break-word;
}
.stat-gen-item .dash-tile-spark {
  height: 24px;
  margin-top: auto;
}
.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; }

/* —— Filter-Tab —— */
.filter-page {
  padding: 0 1.25rem 2.5rem;
}
.filter-page-title {
  margin-top: 0.5rem;
  font-size: 1.15rem;
  color: var(--text);
}
.filter-page-intro { margin-bottom: 0.5rem; }
.filter-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}
.filter-form-grid .filter-span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .filter-form-grid { grid-template-columns: 1fr; }
}
.filter-form select,
.filter-form textarea,
.filter-test-panel select,
.filter-test-panel textarea,
.ai-page textarea {
  width: 100%;
  margin: 0.4rem 0 1rem;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.filter-form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 1.25rem 0 0.5rem;
}
.filter-form-footer #filter-msg { margin: 0; flex: 1 1 12rem; }
.filter-list-editors { display: flex; flex-direction: column; gap: 0; }
.filter-list-editor .filter-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.filter-list-editor .filter-list-toolbar .filter-chip-input {
  flex: 1 1 12rem;
  margin: 0;
  min-width: 10rem;
}
.filter-list-editor .filter-list-search {
  width: auto;
  flex: 0 1 10rem;
  margin: 0;
  min-width: 7rem;
}
.filter-list-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 0.5rem;
}
.filter-list-meta .filter-count {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}
.filter-list-hint {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 2.5rem;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.65rem;
  background: rgba(15, 20, 25, 0.45);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.35rem;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  padding: 0.2rem 0.25rem 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(61, 139, 253, 0.14);
  border: 1px solid rgba(61, 139, 253, 0.35);
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.3;
}
.filter-chip-block {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
}
.filter-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 16rem;
}
.filter-chip-remove {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.filter-chip-remove:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--danger);
}
.filter-chips-empty {
  width: 100%;
  margin: 0;
  padding: 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}
.filter-test-result {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  background: rgba(15, 20, 25, 0.45);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.55;
}
.filter-test-result[hidden] { display: none !important; }
.filter-test-score {
  font-size: 1.35rem;
  font-weight: 650;
  color: var(--text);
  margin: 0 0 0.5rem;
}
.filter-test-score.is-high { color: var(--ok); }
.filter-test-score.is-mid { color: #fbbf24; }
.filter-test-score.is-low { color: var(--muted); }
.filter-test-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}
.filter-test-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}
.filter-test-badge.is-yes {
  border-color: rgba(74, 222, 128, 0.45);
  color: var(--ok);
}
.filter-test-badge.is-no {
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--danger);
}
.filter-test-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.85rem;
  margin: 0;
}
.filter-test-dl dt { color: var(--muted); }
.filter-test-dl dd { margin: 0; }

/* —— KI-Tab —— */
.ai-page .ai-provider-hint { margin: 0 0 0.75rem; }
.ai-provider-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.85rem;
}
.ai-provider-add-row select {
  flex: 1 1 14rem;
  margin: 0;
  min-width: 12rem;
}
.ai-providers-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.ai-providers-empty { margin: 0.25rem 0 0.75rem; }
.ai-provider-card {
  position: relative;
  margin: 0;
}
.ai-provider-card .ai-provider-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.ai-provider-card .ai-provider-card-head .ai-provider-name {
  font-weight: 650;
  color: var(--text);
}
.ai-provider-remove {
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
}
.ai-subheading {
  margin: 1.25rem 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--text);
}
.ai-training-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
}
.ai-training-toolbar #ai-training-status { margin-left: auto; }
.ai-suggestions-wrap,
.ai-signals-wrap {
  margin-top: 0.35rem;
}
.ai-scroll-table-wrap {
  position: relative;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 20, 25, 0.35);
}
.ai-scroll-table-wrap .ai-table { margin: 0; }
.ai-scroll-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #151c26;
  box-shadow: 0 1px 0 var(--border);
}
.ai-blacklist-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.65rem;
}
.ai-blacklist-add input {
  flex: 1 1 10rem;
  margin: 0;
  min-width: 8rem;
}
.ai-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.ai-table th,
.ai-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.ai-table th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: rgba(0, 0, 0, 0.18);
}
.ai-table tr:last-child td { border-bottom: none; }
.ai-table .ai-cell-actions {
  white-space: nowrap;
  text-align: right;
}
.ai-table .ai-cell-actions button {
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
  margin-left: 0.25rem;
}
.ai-table .ai-cell-actions button.danger {
  background: #dc2626;
  border: 1px solid #b91c1c;
  color: #fff;
}
.ai-table .ai-cell-actions button.danger:hover {
  background: #b91c1c;
}
.ai-sug-accept {
  background: #16a34a !important;
  border: 1px solid #15803d !important;
  color: #fff !important;
}
.ai-sug-accept:hover { background: #15803d !important; }
.ai-sug-dismiss {
  background: #dc2626 !important;
  border: 1px solid #b91c1c !important;
  color: #fff !important;
}
.ai-sug-dismiss:hover { background: #b91c1c !important; }

.ai-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.ai-table th.sortable:hover { color: var(--accent); }
.ai-table th.sort-active { color: var(--accent); }
.ai-table .sort-arrow {
  display: inline-block;
  min-width: 0.85em;
  margin-left: 0.2em;
  opacity: 0.35;
  font-size: 0.8em;
}
.ai-table th.sort-active .sort-arrow { opacity: 1; }
.ai-kind-badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 650;
  border: 1px solid var(--border);
  background: rgba(61, 139, 253, 0.12);
  color: #93c5fd;
  text-transform: uppercase;
}
.ai-kind-badge.is-brand {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.1);
  color: var(--ok);
}
.ai-kind-badge.is-keyword {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}
.ai-score {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.ai-score.is-high { color: var(--ok); }
.ai-score.is-mid { color: #fbbf24; }
.ai-signal-asin {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
}
.ai-signal-title {
  color: var(--muted);
  max-width: 28rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-empty {
  margin: 0;
  padding: 1rem 0.85rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}
.ai-count-pills {
  display: inline-flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.ai-count-pill {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}
.ai-count-pill.is-order { color: var(--ok); border-color: rgba(74, 222, 128, 0.35); }
.ai-count-pill.is-attempt { color: #fbbf24; border-color: rgba(251, 191, 36, 0.35); }
.ai-count-pill.is-search { color: #93c5fd; border-color: rgba(61, 139, 253, 0.35); }

.article-score-cell { white-space: nowrap; }
.article-score {
  display: inline-block;
  min-width: 1.6rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  font-size: 0.88rem;
}
.article-score.is-high { color: var(--ok); }
.article-score.is-mid { color: #fbbf24; }
.article-score.is-low { color: var(--muted); }
.article-score-gold {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(251, 191, 36, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.user-profile-dialog {
  width: min(900px, 96vw);
  height: min(820px, 90vh);
  max-width: min(900px, 96vw);
  max-height: min(820px, 90vh);
  box-sizing: border-box;
  overflow: hidden;
}
/* display:flex nur wenn offen – sonst bleibt das Dialog nach close() sichtbar (Backdrop weg) */
.user-profile-dialog[open] {
  display: flex;
  flex-direction: column;
}
.user-profile-dialog > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin: 0;
}
.user-dialog { max-width: min(560px, 94vw); }
.user-profile-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.user-profile-tab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.user-profile-tab.active {
  color: var(--text);
  border-color: var(--accent, #6af);
  background: color-mix(in srgb, var(--accent, #6af) 14%, transparent);
}
.user-profile-panel.hidden { display: none !important; }
.user-profile-body {
  flex: 1 1 auto;
  height: 0;
  min-height: 280px;
  overflow: hidden;
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
}
.user-profile-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
#user-profile-panel-overview:not(.hidden) {
  display: flex;
  flex-direction: column;
}
.user-profile-info {
  flex-shrink: 0;
}
.user-profile-logs {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.user-profile-logs h4:first-child { margin-top: 0; }
#user-profile-panel-history .user-profile-logs {
  height: 100%;
}
.user-profile-overview-actions {
  flex-shrink: 0;
}
.user-profile-overview-actions.hidden {
  display: none !important;
}
.user-profile-relative table,
.user-profile-activity table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.user-profile-relative th,
.user-profile-relative td,
.user-profile-activity th,
.user-profile-activity td {
  text-align: left;
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.ag-token-count {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.user-profile-dialog .dialog-actions {
  flex-shrink: 0;
  margin-top: 0.5rem;
}
.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); }
button.premium-until-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;
  white-space: nowrap;
}
button.premium-until-btn:hover { border-color: var(--accent); }
button.premium-until-btn.is-active { color: #16a34a; border-color: #16a34a55; }
button.premium-until-btn.is-expired { color: var(--muted); }
.premium-dialog {
  max-width: min(720px, 94vw);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel, #0f1419);
  color: inherit;
  overflow: hidden;
}
.premium-dialog::backdrop {
  background: rgba(15, 20, 25, 0.55);
}
.premium-dialog-shell {
  display: flex;
  flex-direction: column;
  max-height: min(82vh, 760px);
  min-height: 320px;
}
.premium-dialog-top {
  flex: 0 0 auto;
  padding: 1rem 1.1rem 0.35rem;
}
.premium-dialog-top h3 { margin: 0 0 0.5rem; }
.premium-dialog-extend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}
.premium-dialog-clear-row { margin-top: 0.55rem; }
.premium-day-btn {
  min-width: 3rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #1a2332;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
}
.premium-day-btn.premium-day-add { color: #4ade80; }
.premium-day-btn.premium-day-sub { color: #f87171; }
.premium-day-btn:hover { border-color: var(--accent); filter: brightness(1.08); }
.premium-set-block { margin-top: 0.85rem; padding-top: 0.75rem; }
.premium-history-title {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.premium-events-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 120px;
  padding: 0 1.1rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.premium-dialog-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem;
}
.premium-event-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0.45rem 0;
}
.premium-event-row .strike-meta { color: var(--muted); font-size: 0.8rem; }

/* ─── Tickets (Admin) ───────────────────────────────────────────── */
.ticket-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
}
.ticket-toolbar select {
  width: auto;
  min-width: 10rem;
  margin: 0;
}
.ticket-list-table-wrap { overflow-x: auto; }
.ticket-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
}
.ticket-badge-open { color: #ff9900; border-color: #ff9900; }
.ticket-badge-claimed { color: #22c55e; border-color: #22c55e; }
.ticket-badge-closed { color: var(--muted); }

/* Verbesserungsvorschläge Status-Pills */
.suggestion-status-open {
  color: #60a5fa;
  border-color: #60a5fa;
  background: rgba(96, 165, 250, 0.12);
}
.suggestion-status-reviewing {
  color: #fbbf24;
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
}
.suggestion-status-planned {
  color: #a78bfa;
  border-color: #a78bfa;
  background: rgba(167, 139, 250, 0.12);
}
.suggestion-status-done {
  color: #4ade80;
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
}
.suggestion-status-rejected {
  color: var(--muted);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.ticket-detail-dialog {
  width: min(920px, 96vw);
  height: min(820px, 92vh);
  max-width: min(920px, 96vw);
  max-height: min(820px, 92vh);
  box-sizing: border-box;
  overflow: hidden;
  padding: 1rem 1.15rem;
}
.ticket-detail-dialog[open] {
  display: flex;
  flex-direction: column;
}
.ticket-detail-dialog > form.ticket-detail-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin: 0;
  width: 100%;
  max-width: 100%;
}
.ticket-detail-dialog h3 {
  margin: 0 0 0.35rem;
  flex-shrink: 0;
}
.ticket-detail-status {
  flex-shrink: 0;
  margin-bottom: 0.45rem;
  font-size: 0.88rem;
}
.ticket-detail-participants {
  flex-shrink: 0;
  margin-bottom: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.ticket-participant-chip {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.ticket-participant-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}
.ticket-user-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: #7ec8ff;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ticket-user-link:hover { color: #b8e0ff; }
.ticket-detail-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.65rem 0.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ticket-msg {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.02);
}
.ticket-msg-system { opacity: 0.75; font-style: italic; }
.ticket-msg-head { margin-bottom: 0.25rem; }
.ticket-msg-body { white-space: pre-wrap; word-break: break-word; }

.ve-discord-mention {
  display: inline;
  position: relative;
  z-index: 1;
  color: #00a8fc;
  background: rgba(88, 101, 242, 0.18);
  border-radius: 3px;
  padding: 0 2px;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  pointer-events: auto;
}
a.ve-discord-mention { cursor: pointer; }
.ve-discord-mention:hover { text-decoration: underline; filter: brightness(1.08); }
.ve-discord-mention-role { color: #f23f43; background: rgba(242, 63, 67, 0.15); }
.ve-discord-custom-emoji {
  display: inline-block;
  vertical-align: -0.35em;
  width: 1.375em;
  height: 1.375em;
  object-fit: contain;
}
.ticket-detail-footer {
  flex: 0 0 auto;
  padding: 0.65rem 0 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}
.ticket-detail-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ticket-detail-actions-left { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ticket-reply-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  min-width: 0;
  width: 100%;
}
.ticket-reply-row textarea {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  max-width: 100%;
  min-height: 3.4rem;
  resize: vertical;
  margin: 0;
  box-sizing: border-box;
}
.ticket-reply-row #ticket-reply-send-btn { flex: 0 0 auto; }
.ticket-participant-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  position: relative;
  min-width: 0;
  width: 100%;
}
.ticket-participant-search {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
}
.ticket-participant-search input {
  margin: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.ticket-detail-dialog input:focus,
.ticket-detail-dialog textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: -2px;
  border-color: var(--accent);
}
.ticket-participant-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 20;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
.ticket-participant-suggest button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  color: var(--text);
  padding: 0.45rem 0.65rem;
  cursor: pointer;
}
.ticket-participant-suggest button:last-child { border-bottom: 0; }
.ticket-participant-suggest button:hover {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.ticket-detail-dialog .dialog-actions {
  flex-shrink: 0;
  margin-top: 0.35rem;
}
.user-profile-tickets table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.user-profile-tickets th,
.user-profile-tickets td {
  text-align: left;
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

/* Settings: collapsible groups */
.settings-form-grouped {
  max-width: 920px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.settings-group {
  background: rgba(15, 20, 25, 0.45);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.15rem 0.85rem 0.85rem;
}
.settings-group > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 650;
  font-size: 0.95rem;
  padding: 0.75rem 0.15rem;
  color: var(--text);
  user-select: none;
}
.settings-group > summary::-webkit-details-marker { display: none; }
.settings-group > summary::before {
  content: "▸";
  display: inline-block;
  width: 1.1em;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.settings-group[open] > summary::before { transform: rotate(90deg); }
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem 1rem;
}
@media (max-width: 720px) {
  .settings-grid { grid-template-columns: 1fr; }
}
.settings-form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}
.stat-inv-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
@media (max-width: 900px) {
  .stat-inv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}



/* Ticket attachments */
.ticket-reply-row { flex-direction: column; align-items: stretch; }
.ticket-reply-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.ticket-pending-files { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ticket-pending-chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.2rem 0.45rem; border: 1px solid var(--border); border-radius: 8px; font-size: 0.85rem;
}
.ticket-pending-chip button { border: none; background: transparent; cursor: pointer; color: var(--muted); }
.ticket-attachments { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.4rem; }
.ticket-att {
  display: flex; flex-direction: column; gap: 0.2rem; max-width: 160px;
  padding: 0.35rem; border: 1px solid var(--border); border-radius: 8px;
  background: rgba(255,255,255,0.02); color: inherit; cursor: pointer; text-align: left; font: inherit;
}
.ticket-att:hover { border-color: var(--accent); }
.ticket-att-image img { width: 120px; height: 80px; object-fit: cover; border-radius: 6px; display: block; background: #0003; }
.ticket-media-dialog {
  width: min(920px, 96vw); max-height: 90vh; border: 1px solid var(--border);
  border-radius: 12px; padding: 0; background: var(--bg, #111); color: var(--text);
}
.ticket-media-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.ticket-media-head h3 { margin: 0; font-size: 1rem; }
.ticket-media-body { padding: 0.75rem 1rem 1rem; overflow: auto; }
.ticket-lightbox-img { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto; border-radius: 8px; }
.ticket-text-preview {
  white-space: pre-wrap; word-break: break-word; margin: 0 0 0.75rem; padding: 0.75rem;
  border-radius: 8px; border: 1px solid var(--border); background: rgba(0,0,0,0.25);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem;
  max-height: 60vh; overflow: auto;
}

/* Ticket reactions / reply (1.2.119) */
.ticket-msg-reply {
  border-left: 3px solid var(--accent, #f90);
  padding: 0.25rem 0.5rem;
  margin: 0.25rem 0 0.4rem;
  background: rgba(255, 153, 0, 0.08);
  font-size: 0.85rem;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}
.ticket-msg-head {
  display: flex;
  margin-bottom: 0.2rem;
  align-items: center;
  gap: 0.5rem;
}
.ticket-msg-meta { min-width: 0; }
.ticket-avatar-wrap { position: relative; flex-shrink: 0; }
.ticket-avatar,
.ticket-avatar-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1f2937;
  color: #e5e7eb;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border, #333);
}
.ticket-avatar.hidden,
.ticket-avatar-fallback.hidden { display: none; }
.ticket-msg-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin-top: 0.35rem;
}
.ticket-reactions { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.ticket-reactions:empty { display: none; }
.ticket-msg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.ticket-reaction {
  border: 1px solid var(--border, #333);
  background: rgba(0,0,0,0.2);
  color: var(--text);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.ticket-reaction.me { border-color: var(--accent, #f90); background: rgba(255,153,0,0.15); }
.ticket-react-add { position: relative; }
.ticket-reply-btn .ve-reply-arrow,
.ve-reply-arrow { margin-right: 0.15rem; opacity: 0.9; }

.ticket-reply-quote {
  width: 100%;
  border-left: 3px solid var(--accent, #f90);
  padding: 0.35rem 0.55rem;
  background: rgba(255,153,0,0.08);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.ticket-reply-quote.hidden { display: none; }
.admin-toast.ticket-toast-clickable { cursor: pointer; }

/* Shared emoji picker (1.2.120) */
.ve-emoji-picker {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 50;
  width: min(20rem, 86vw);
  max-height: 18rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.45rem;
  background: #0f172a;
  border: 1px solid var(--border, #333);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.ve-emoji-picker-head { display: flex; }
.ve-emoji-picker-search {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border, #333);
  background: #111827;
  color: var(--text, #eee);
  font-size: 0.85rem;
}
.ve-emoji-picker-cats { display: flex; flex-wrap: wrap; gap: 0.15rem; }
.ve-emoji-cat {
  border: none; background: transparent; font-size: 1rem;
  padding: 0.2rem 0.3rem; cursor: pointer; border-radius: 6px; line-height: 1; opacity: 0.75;
}
.ve-emoji-cat.active, .ve-emoji-cat:hover { background: rgba(255,255,255,0.08); opacity: 1; }
.ve-emoji-picker-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.15rem;
  overflow: auto; max-height: 11rem;
}
.ve-emoji-item {
  border: none; background: transparent; font-size: 1.2rem;
  cursor: pointer; padding: 0.2rem; line-height: 1; border-radius: 6px;
}
.ve-emoji-item:hover { background: rgba(255,255,255,0.1); }
.ve-emoji-empty { padding: 0.5rem; text-align: center; }
