:root {
  color-scheme: light dark;
  --bg: var(--tg-theme-bg-color, #0f1419);
  --fg: var(--tg-theme-text-color, #e7ecf1);
  --muted: var(--tg-theme-hint-color, #8b98a5);
  --button: var(--tg-theme-button-color, #2aabee);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --secondary: var(--tg-theme-secondary-bg-color, #1c2730);
  --danger: #e85d5d;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.45;
}

.panel {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.hidden {
  display: none !important;
}

header h1,
section h2 {
  margin: 0 0 8px;
}

.hint {
  font-size: 0.85rem;
  margin: 0.25rem 0 1rem;
  line-height: 1.35;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

section {
  background: var(--secondary);
  border-radius: 12px;
  padding: 14px;
  margin-top: 14px;
}

.row,
.field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
}

.action-mode {
  border: 1px solid color-mix(in srgb, var(--muted) 35%, transparent);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 12px 0;
}

.action-mode legend {
  padding: 0 6px;
  font-weight: 600;
}

.action-mode .radio {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 8px 0;
  font-size: 0.92rem;
}

.action-mode input {
  margin-top: 3px;
}

.field {
  flex-direction: column;
  align-items: stretch;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--bg);
  color: var(--fg);
}

button {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: var(--button);
  color: var(--button-text);
  font-weight: 600;
  cursor: pointer;
}

.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.counts span {
  background: var(--bg);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
}

.activity {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity li {
  background: var(--bg);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.9rem;
}

.activity .reason {
  color: var(--danger);
  font-weight: 600;
}

.btn-small {
  width: auto;
  margin: 0;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.groups,
.feed {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.groups li,
.feed li {
  background: var(--bg);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.9rem;
  border-left: 4px solid transparent;
  cursor: pointer;
}

.groups li.active {
  border-left-color: var(--button);
}

.groups li .meta,
.feed li .meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 4px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.tag {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.tag-kept,
.feed li.status-kept {
  border-left-color: #3dba7a;
}
.tag-kept {
  background: color-mix(in srgb, #3dba7a 25%, transparent);
  color: #3dba7a;
}

.tag-deleted,
.feed li.status-deleted {
  border-left-color: #e85d5d;
}
.tag-deleted {
  background: color-mix(in srgb, #e85d5d 25%, transparent);
  color: #e85d5d;
}

.tag-banned,
.feed li.status-banned {
  border-left-color: #c44dff;
}
.tag-banned {
  background: color-mix(in srgb, #c44dff 25%, transparent);
  color: #c44dff;
}

.tag-notified,
.feed li.status-notified {
  border-left-color: #f0a202;
}
.tag-notified {
  background: color-mix(in srgb, #f0a202 25%, transparent);
  color: #f0a202;
}

.tag-queued,
.feed li.status-queued {
  border-left-color: #2aabee;
}
.tag-queued {
  background: color-mix(in srgb, #2aabee 25%, transparent);
  color: #2aabee;
}

.tag-dry_run,
.feed li.status-dry_run {
  border-left-color: #e6c84a;
}
.tag-dry_run {
  background: color-mix(in srgb, #e6c84a 25%, transparent);
  color: #e6c84a;
}

.tag-skipped,
.feed li.status-skipped {
  border-left-color: #8b98a5;
}
.tag-skipped {
  background: color-mix(in srgb, #8b98a5 25%, transparent);
  color: #8b98a5;
}

.feed .status-label {
  font-weight: 700;
  text-transform: lowercase;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}
