:root {
  --bg: #0f1419;
  --card: #1a222c;
  --text: #e7ecf1;
  --muted: #8b98a5;
  --accent: #1d9bf0;
  --ok: #00ba7c;
  --warn: #f7931a;
  --border: #2f3b4a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
}

.top h1 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  font-weight: 600;
}

.muted {
  color: var(--muted);
  margin: 0;
  font-size: 0.9rem;
}

.filters {
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
}

.filters form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  min-width: 10rem;
}

.grid {
  padding: 1.5rem 2rem 3rem;
  display: grid;
  gap: 1.25rem;
  max-width: 960px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: #2a3441;
  color: var(--muted);
}

.badge.ok {
  background: rgba(0, 186, 124, 0.15);
  color: var(--ok);
}

.badge.no {
  background: rgba(244, 33, 46, 0.12);
  color: #f4212e;
}

.badge.cat {
  background: rgba(29, 155, 240, 0.12);
  color: var(--accent);
}

.status-raw,
.status-filtered {
  color: var(--warn);
}

.status-generated {
  color: var(--accent);
}

.status-approved {
  color: var(--ok);
}

.card-head-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-delete-form {
  margin: 0;
}

.score {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--muted);
}

.card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.card h2 a {
  color: var(--text);
  text-decoration: none;
}

.card h2 a:hover {
  text-decoration: underline;
  color: var(--accent);
}

.meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.summary {
  font-size: 0.9rem;
  color: #c4cdd6;
  margin: 0 0 1rem;
}

.ai-out {
  background: #131a22;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.ai-out h3 {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.ai-title {
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.ai-caption {
  white-space: pre-wrap;
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
}

.angle,
.cta,
.tags {
  font-size: 0.85rem;
  margin: 0.35rem 0 0;
  color: #b8c3ce;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn.is-loading {
  cursor: wait;
  opacity: 0.9;
  pointer-events: none;
}

.btn .btn-spinner {
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  margin-right: 0.45em;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -0.12em;
  animation: rss-spin 0.65s linear infinite;
}

.btn.success .btn-spinner {
  border-color: rgba(0, 16, 10, 0.35);
  border-top-color: #00100a;
}

.btn.secondary .btn-spinner {
  border-color: rgba(231, 236, 241, 0.25);
  border-top-color: var(--text);
}

.btn.secondary {
  background: #38444d;
  color: var(--text);
}

.btn.success {
  background: var(--ok);
  color: #00100a;
}

.btn.danger {
  background: #b42318;
  color: #fff;
}

.btn.danger:hover {
  filter: brightness(1.08);
}

.btn.danger .btn-spinner {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
}

.btn.warn {
  background: #b45309;
  color: #fff;
}

.btn.warn:hover {
  filter: brightness(1.08);
}

.btn-sm {
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 6px;
}

.empty {
  color: var(--muted);
  grid-column: 1 / -1;
}

code {
  background: #131a22;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 28rem;
  max-height: min(75vh, 26rem);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}

.modal-close:hover {
  color: var(--text);
  background: #2a3441;
}

.modal-body {
  padding: 1rem;
  overflow: auto;
  flex: 1;
  min-height: 5rem;
}

.modal-foot {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border);
}

.modal-foot-split {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.rss-loading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: rss-spin 0.65s linear infinite;
  flex-shrink: 0;
}

@keyframes rss-spin {
  to {
    transform: rotate(360deg);
  }
}

.rss-result {
  margin: 0;
  padding: 0.75rem;
  background: #131a22;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c4cdd6;
  max-height: 14rem;
  overflow: auto;
}

.rss-hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
}
