body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f4f6f8;
  color: #1f2937;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  background: #0f172a;
  color: #f8fafc;
}

.container {
  padding: 20px 28px 28px 28px;
}

.login {
  max-width: 520px;
  margin: 60px auto;
}

.card {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  padding: 16px;
  margin-bottom: 16px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  background: #ffffff;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.stat .label {
  font-size: 12px;
  color: #64748b;
}

.stat .value {
  font-size: 24px;
  font-weight: 700;
}

.grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.stack {
  display: grid;
  gap: 10px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-row {
  margin-bottom: 10px;
}

.inline {
  display: flex;
  gap: 6px;
  align-items: center;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}

input, select, button, textarea {
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font: inherit;
}

button {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: white;
  cursor: pointer;
}

button.secondary {
  background: #64748b;
  border-color: #64748b;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 12px;
}

.badge.ok {
  background: #dcfce7;
  color: #166534;
}

.badge.bad {
  background: #fee2e2;
  color: #991b1b;
}

.badge.errcat {
  margin-bottom: 4px;
}

.badge.errcat-policy {
  background: #fee2e2;
  color: #991b1b;
}

.badge.errcat-auth {
  background: #ffedd5;
  color: #9a3412;
}

.badge.errcat-dns {
  background: #dbeafe;
  color: #1e40af;
}

.badge.errcat-media {
  background: #fef9c3;
  color: #854d0e;
}

.badge.errcat-api {
  background: #ede9fe;
  color: #5b21b6;
}

.badge.errcat-unknown {
  background: #e2e8f0;
  color: #334155;
}

.alert {
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 8px;
  background: #fee2e2;
  color: #991b1b;
}

.flash {
  font-weight: 600;
}

.flash-success {
  border-left: 4px solid #10b981;
}

.flash-error {
  border-left: 4px solid #ef4444;
}

.subtle {
  color: #64748b;
  font-size: 12px;
  margin-top: 4px;
}

.pre {
  white-space: pre-wrap;
  line-height: 1.35;
  max-height: 220px;
  overflow: auto;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  margin-top: 6px;
}

.linkbtn {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 6px;
  text-decoration: none;
  border: 1px solid #cbd5e1;
  color: #334155;
  background: #f8fafc;
}

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

.detail-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  display: grid;
  gap: 4px;
}

.detail-item .k {
  font-size: 12px;
  color: #64748b;
}

.thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  margin-top: 6px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.image-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.image-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.img-failed {
  opacity: 0.3;
  filter: grayscale(1);
}

.image-meta {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.image-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.image-selected {
  border-color: #10b981;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.25);
}

.image-excluded {
  opacity: 0.65;
}

@media (max-width: 920px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid.two {
    grid-template-columns: 1fr;
  }
}
