:root {
  color-scheme: light;
  --bg: #eef2f7;
  --panel: #ffffff;
  --text: #111827;
  --muted: #64748b;
  --line: #dbe3ef;
  --primary: #1d4ed8;
  --primary-dark: #1e3a8a;
  --danger: #b91c1c;
  --ok: #047857;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, #dfe8f5 0%, #eef2f7 320px),
    var(--bg);
}

a {
  color: inherit;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
}

.home {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  padding: 32px 0;
}

.hero {
  width: min(680px, 100%);
  text-align: center;
}

.brand {
  margin: 0 0 20px;
  font-size: clamp(36px, 8vw, 76px);
  line-height: 1;
  letter-spacing: 0;
}

.wordmark {
  position: relative;
  display: inline-block;
  color: transparent;
  background:
    linear-gradient(90deg, #2563eb, #06b6d4, #16a34a, #f59e0b, #e11d48, #7c3aed, #2563eb);
  background-size: 320% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: wordmark-flow 9s linear infinite;
  text-shadow: 0 18px 48px rgba(37, 99, 235, 0.18);
}

.wordmark::after {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: -8px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0), #06b6d4, #22c55e, #f59e0b, rgba(225, 29, 72, 0));
  background-size: 220% 100%;
  animation: wordmark-glow 5s ease-in-out infinite alternate;
  opacity: 0.8;
}

@keyframes wordmark-flow {
  from {
    background-position: 0% 50%;
  }

  to {
    background-position: 320% 50%;
  }
}

@keyframes wordmark-glow {
  from {
    transform: scaleX(0.72);
    filter: blur(0);
  }

  to {
    transform: scaleX(1);
    filter: blur(1px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wordmark,
  .wordmark::after {
    animation: none;
  }
}

.subtitle {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 17px;
}

.searchbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

.searchbar input,
.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

.textarea {
  min-height: 82px;
  padding-top: 10px;
  resize: vertical;
}

.searchbar input {
  border: 0;
  font-size: 17px;
}

.searchbar input:focus,
.input:focus,
.select:focus,
.textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.22);
}

.button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  color: #fff;
  background: var(--primary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button:hover {
  background: var(--primary-dark);
}

.button.secondary {
  color: var(--primary);
  background: #dbeafe;
}

.button.danger {
  color: #fff;
  background: var(--danger);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.75);
  color: #334155;
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 16px 0;
  background: rgba(238, 242, 247, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(219, 227, 239, 0.8);
}

#results-view {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.logo {
  font-weight: 800;
  font-size: 22px;
  text-decoration: none;
}

.logo.wordmark::after {
  bottom: -5px;
  height: 2px;
}

.results-meta {
  color: var(--muted);
  margin: 26px 0 18px;
}

.group {
  margin-bottom: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  font: inherit;
  cursor: pointer;
}

.group-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.swatch {
  width: 12px;
  height: 28px;
  border-radius: 4px;
  background: var(--primary);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding: 16px;
}

.tool-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  min-height: 150px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.1);
}

.icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e2e8f0;
  color: #1e293b;
  font-weight: 800;
  overflow: hidden;
}

.icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tool-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.tool-card p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: #e5e7eb;
  color: #1f2937;
  font-size: 12px;
  font-weight: 700;
}

.empty {
  margin-top: 34px;
  padding: 42px 20px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.site-footer {
  width: min(1120px, calc(100vw - 32px));
  margin: 32px auto 18px;
  padding: 14px 0;
  color: #64748b;
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
}

.site-footer p {
  margin: 0 0 4px;
}

.site-footer a {
  color: #475569;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.admin-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  padding: 22px 16px;
  background: #111827;
  color: #fff;
}

.sidebar h1 {
  margin: 0 0 24px;
  font-size: 24px;
}

.nav-button {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  border: 0;
  border-radius: 6px;
  padding: 12px;
  text-align: left;
  color: #dbeafe;
  background: transparent;
  cursor: pointer;
}

.nav-button.active,
.nav-button:hover {
  background: #1f2937;
  color: #fff;
}

.admin-main {
  padding: 24px;
}

.panel {
  margin-bottom: 18px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

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

th {
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .searchbar,
  .topbar-inner,
  .admin-layout,
  .grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static;
  }

  .admin-main {
    padding: 16px;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
