:root {
  --bg: #f4efe8;
  --panel: rgba(255, 250, 244, 0.9);
  --panel-strong: #fff9f1;
  --text: #1f2933;
  --muted: #52606d;
  --line: rgba(31, 41, 51, 0.12);
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --shadow: 0 22px 48px rgba(61, 41, 20, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(252, 211, 77, 0.32), transparent 28%),
    radial-gradient(circle at top right, rgba(14, 116, 144, 0.18), transparent 24%),
    linear-gradient(160deg, #f8f3ea 0%, #efe4d4 100%);
  min-height: 100vh;
}

main {
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 28px;
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(17, 94, 89, 0.95), rgba(20, 83, 45, 0.92)),
    #115e59;
  color: #f8fafc;
  box-shadow: var(--shadow);
}

.hero-brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.hero-logo {
  display: block;
  width: clamp(240px, 34vw, 320px);
  max-width: 100%;
  height: auto;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.hero p {
  margin: 0;
  flex: 1 1 320px;
  max-width: 700px;
  color: rgba(248, 250, 252, 0.84);
  font-size: 1rem;
  line-height: 1.6;
}

.hero-admin {
  background:
    linear-gradient(135deg, rgba(31, 41, 51, 0.96), rgba(15, 23, 42, 0.92)),
    #1f2933;
}

.panel {
  margin-top: 18px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.toolbar {
  display: grid;
  grid-template-columns:
    minmax(260px, 1.8fr)
    repeat(2, minmax(140px, 0.8fr))
    minmax(190px, 1fr)
    auto;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.28);
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

input,
select,
button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: inherit;
  background: rgba(255, 255, 255, 0.94);
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid rgba(15, 118, 110, 0.26);
  outline-offset: 2px;
}

button {
  cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled,
button[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

button:disabled:hover,
button[disabled]:hover {
  transform: none;
}

.primary {
  align-self: end;
  background: var(--accent);
  color: #f8fafc;
  border-color: transparent;
  font-weight: 700;
}

.checkbox-field {
  display: flex;
  align-items: end;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  min-height: 52px;
  padding: 0 4px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 600;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.primary:hover {
  background: var(--accent-strong);
}

.summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.42);
  font-size: 0.95rem;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 14px 18px;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-strong);
}

th button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-weight: 700;
}

th button.is-active {
  color: var(--accent-strong);
}

th button.is-active::after {
  display: inline-block;
  min-width: 0.9em;
  color: var(--accent);
  font-size: 0.92em;
  line-height: 1;
  content: "↑";
}

th button.is-active[data-sort-dir="desc"]::after {
  content: "↓";
}

th button:hover {
  color: var(--accent-strong);
  transform: none;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.52);
}

.title-cell {
  min-width: 320px;
}

.title-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  line-height: 1.4;
}

.title-link:hover {
  color: var(--accent-strong);
}

.meta {
  display: inline-flex;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.subtle {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.mono {
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 0.82rem;
  color: var(--muted);
  word-break: break-word;
}

.admin-panel {
  margin-top: 20px;
}

.admin-stats-table {
  min-width: 760px;
}

.admin-scraper-column,
.admin-scraper-cell {
  min-width: 280px;
}

.admin-number-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent-strong);
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.42);
}

.pagination .buttons {
  display: flex;
  gap: 10px;
}

.secondary {
  width: auto;
  min-width: 112px;
  background: rgba(255, 255, 255, 0.92);
}

.secondary:disabled,
.secondary[disabled] {
  background: rgba(148, 163, 184, 0.2);
  color: rgba(82, 96, 109, 0.75);
  border-color: rgba(148, 163, 184, 0.35);
}

.status {
  min-height: 1.2em;
  color: var(--muted);
}

.empty {
  padding: 34px 18px 40px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 860px) {
  main {
    width: min(100vw - 20px, 1200px);
    padding-top: 20px;
  }

  .hero,
  .panel {
    border-radius: 20px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .hero-brand {
    width: 100%;
    justify-content: center;
  }

  .hero-logo {
    width: min(100%, 260px);
  }

  .summary,
  .pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-stats-table {
    min-width: 620px;
  }

  .pagination .buttons {
    width: 100%;
  }

  .secondary {
    flex: 1;
  }
}
