:root {
  --bg: #f6f8fb;
  --text: #172033;
  --muted: #657086;
  --line: #dbe2ee;
  --accent: #1463ff;
  --accent-dark: #0f4fc7;
  --panel: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(20, 99, 255, 0.08), transparent 38%),
    linear-gradient(315deg, rgba(21, 176, 132, 0.08), transparent 42%),
    var(--bg);
  padding: 24px;
}

.page {
  width: min(960px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 28px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
}

.brand span {
  color: var(--accent);
}

.pill-link {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.pill-link:hover {
  border-color: var(--accent);
}

main {
  display: grid;
  gap: 20px;
}

.panel {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(24px, 4.5vw, 44px);
  box-shadow: 0 24px 70px rgba(21, 32, 56, 0.10);
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.08;
}

.intro {
  margin: 14px 0 0;
  max-width: 640px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.filter {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.filter:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  color: inherit;
  text-decoration: none;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(21, 32, 56, 0.08);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-top strong {
  font-size: 17px;
}

.card-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.fav {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  flex: none;
}

.tag {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.card-url {
  margin-top: auto;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.empty {
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 4px 0;
}

.section-title {
  margin: 0;
  font-size: 21px;
}

.section-tagline {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.card-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.tag--vetted {
  background: rgba(21, 176, 132, 0.1);
  border-color: rgba(21, 176, 132, 0.35);
  color: #0c7a5a;
}

.facts {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 16px 18px;
  margin-top: 22px;
  max-width: 680px;
}

.fact {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.fact-label {
  flex: none;
  width: 150px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fact-value {
  font-size: 14.5px;
  font-weight: 600;
}

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

.site-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}

.site-aside {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 24px;
}

.panel--aside {
  padding: 18px 20px;
  box-shadow: none;
}

.aside-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.kg-aside-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kg-summary {
  margin: 12px 0 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.aside-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.guides-block {
  margin-top: 26px;
}

.guides-block h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.guide-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}

.guide-list a {
  color: var(--accent);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
}

.guide-list a:hover {
  text-decoration: underline;
}

.guide-body {
  margin-top: 18px;
  max-width: 680px;
}

.guide-body h2 {
  font-size: 19px;
  margin: 26px 0 8px;
}

.guide-body p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
  margin: 0 0 14px;
}

.fav--btn {
  width: 18px;
  height: 18px;
  margin-right: 7px;
  vertical-align: -3px;
  border-radius: 4px;
}

@media (max-width: 860px) {
  .site-layout {
    grid-template-columns: 1fr;
  }

  .site-aside {
    position: static;
  }

  .fact-label {
    width: 100%;
  }
}

.discover-form {
  display: flex;
  gap: 10px;
  margin-top: 26px;
  max-width: 600px;
}

.discover-form input {
  flex: 1;
  min-width: 0;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 15px;
  font: inherit;
  background: #fff;
  color: var(--text);
  outline: none;
}

.discover-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(20, 99, 255, 0.12);
}

.ai-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.card--static:hover {
  border-color: var(--line);
  box-shadow: none;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.card-foot .card-url {
  margin-top: 0;
}

.mini-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  padding: 7px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.mini-btn:hover {
  background: var(--accent-dark);
}

.mini-btn--ghost {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--accent);
}

.mini-btn--ghost:hover {
  background: var(--bg);
  border-color: var(--accent);
}

@media (max-width: 720px) {
  .discover-form {
    flex-direction: column;
  }

  .discover-form .button {
    width: 100%;
  }
}

.back-link {
  display: inline-block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 14px;
}

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

.site-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}

.site-ico {
  width: 56px;
  height: 56px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 8px;
  object-fit: contain;
}

.site-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.site-shot {
  display: block;
  max-width: 100%;
  max-height: 340px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 22px;
  object-fit: cover;
}

.wiki-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

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

.site-desc {
  margin: 18px 0 0;
  max-width: 680px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-line;
}

.visit-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 26px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  border: 0;
  border-radius: 10px;
  padding: 0 22px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

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

.visit-host {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

form.submit-form {
  display: grid;
  gap: 16px;
  margin-top: 26px;
  max-width: 560px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 14px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 15px;
  font: inherit;
  background: #fff;
  color: var(--text);
  outline: none;
}

.field textarea {
  min-height: 130px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(20, 99, 255, 0.12);
}

.kg-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(21, 176, 132, 0.4);
  background: rgba(21, 176, 132, 0.06);
  border-radius: 12px;
  padding: 14px;
  margin-top: 22px;
  max-width: 560px;
}

.kg-img {
  width: 64px;
  height: 64px;
  flex: none;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.kg-name {
  font-weight: 800;
}

.kg-kind {
  color: #0c7a5a;
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
}

.kg-wiki {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.optional {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
}

.form-preview {
  max-width: 240px;
  max-height: 130px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 4px;
  object-fit: cover;
  background: #fff;
}

.form-preview--icon {
  width: 36px;
  height: 36px;
  max-width: none;
  padding: 5px;
  object-fit: contain;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 15px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 22px;
}

.notice.success {
  border-color: rgba(21, 176, 132, 0.4);
  background: rgba(21, 176, 132, 0.08);
  color: #0c7a5a;
}

.notice.error {
  border-color: rgba(214, 69, 69, 0.4);
  background: rgba(214, 69, 69, 0.07);
  color: #b03030;
}

footer {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

@media (max-width: 720px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel {
    border-radius: 14px;
  }

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

/* ---- Admin ---- */

.page-wide {
  width: min(1180px, 100%);
}

.header-links {
  display: flex;
  gap: 8px;
}

.admin-brand-pill,
.brand .admin-brand-pill {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 10px;
  vertical-align: 3px;
  margin-left: 6px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.admin-aside {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 4px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.admin-aside-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 12px 4px;
}

.admin-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.admin-link:hover {
  background: var(--bg);
  color: var(--accent);
}

.admin-link.active {
  background: var(--accent);
  color: #fff;
}

.badge-count {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 8px;
}

.admin-link.active .badge-count {
  background: rgba(255, 255, 255, 0.22);
  border-color: transparent;
  color: #fff;
}

.badge-pending {
  background: rgba(240, 160, 20, 0.14);
  border-color: rgba(240, 160, 20, 0.45);
  color: #9a6a00;
}

.admin-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

/* Grid items default to min-width:auto — without this, a wide table stretches
   its panel past the viewport instead of scrolling inside .table-wrap. */
.admin-main > * {
  min-width: 0;
}

.admin-page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-page-head h1 {
  font-size: 27px;
}

.panel--admin {
  padding: 22px 24px;
}

.panel--admin h2 {
  margin: 0;
  font-size: 18px;
}

.head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.head-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}

.stat-card .num {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
}

.stat-card .lbl {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-top: 3px;
}

.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th {
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.admin-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.cell-name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
}

.cell-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.cell-dim {
  color: var(--muted);
  white-space: nowrap;
}

.status-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-pill.live {
  background: rgba(21, 176, 132, 0.1);
  color: #0c7a5a;
  border: 1px solid rgba(21, 176, 132, 0.35);
}

.status-pill.pending {
  background: rgba(240, 160, 20, 0.12);
  color: #9a6a00;
  border: 1px solid rgba(240, 160, 20, 0.4);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.row-actions form {
  display: inline;
  margin: 0;
}

.row-action {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.row-action:hover {
  text-decoration: underline;
}

.row-action.danger {
  color: #b03030;
}

.submit-form--admin {
  max-width: none;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.admin-form-grid .field.wide {
  grid-column: 1 / -1;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.check-label input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.login-shell {
  min-height: 78vh;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(400px, 100%);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 18px;
}

.login-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 14px;
}

.login-foot a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.login-foot a:hover {
  color: var(--accent);
}

@media (max-width: 860px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-aside {
    position: static;
  }

  .stat-grid,
  .admin-form-grid {
    grid-template-columns: 1fr;
  }
}
