:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #62707f;
  --line: #dce2e8;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --accent: #b45309;
  --danger: #b42318;
  --success: #137333;
  --shadow: 0 12px 30px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

a {
  color: var(--primary-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

pre {
  overflow-x: auto;
  background: #101820;
  color: #eef6f7;
  padding: 1rem;
  border-radius: 8px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
  padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  flex-direction: column;
  color: var(--text);
  font-weight: 800;
  font-size: 1rem;
}

.brand span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.top-nav,
.admin-nav,
.actions,
.tag-row,
.table-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.top-nav a,
.admin-nav a {
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  color: var(--text);
  font-weight: 650;
}

.top-nav a:hover,
.admin-nav a:hover {
  background: #e8f3f1;
  text-decoration: none;
}

.admin-nav {
  position: sticky;
  top: 68px;
  z-index: 15;
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  background: #eef5f4;
  border-bottom: 1px solid var(--line);
}

.layout {
  width: min(1180px, calc(100% - 2rem));
  margin: 1.25rem auto 3rem;
}

.admin-layout {
  width: min(1380px, calc(100% - 2rem));
}

.hero-compact,
.auth-card,
.tool-panel,
.panel,
.answer-card,
.result-card,
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-compact {
  min-height: 48vh;
  display: grid;
  align-items: center;
  padding: clamp(1.5rem, 5vw, 4rem);
}

.hero-compact h1 {
  max-width: 840px;
  margin: 0 0 1rem;
  font-size: clamp(2rem, 6vw, 4.2rem);
  line-height: 1.03;
}

.hero-compact p {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.08rem;
}

.eyebrow {
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.auth-card,
.tool-panel,
.panel,
.answer-card {
  padding: clamp(1rem, 3vw, 1.5rem);
  margin-bottom: 1rem;
}

.admin-heading {
  margin: 1rem 0;
}

.admin-heading h1,
.tool-panel h1,
.auth-card h1 {
  margin: 0 0 0.35rem;
}

.admin-heading p,
.muted {
  color: var(--muted);
}

.form-stack,
.grid-form,
.search-form {
  display: grid;
  gap: 0.85rem;
}

.grid-form,
.filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 700;
}

.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  padding: 0.58rem 0.7rem;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.score-input {
  width: 7rem;
}

.button,
button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.55rem 0.85rem;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 750;
}

.button:hover,
button:hover {
  text-decoration: none;
  background: #f1f5f8;
}

.button.primary,
button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

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

.button.warning {
  border-color: var(--accent);
  color: var(--accent);
}

.button.small {
  min-height: 32px;
  padding: 0.35rem 0.55rem;
  font-size: 0.88rem;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.65rem;
}

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

.filter-grid {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.75rem;
}

.live-results {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.live-result {
  border-left: 4px solid var(--primary);
  padding: 0.65rem 0.8rem;
  background: #f3faf8;
  border-radius: 6px;
}

.results-list {
  display: grid;
  gap: 0.85rem;
}

.admin-search-results,
.search-result-group {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.search-result-group h3 {
  margin: 0.25rem 0 0;
}

.result-card {
  padding: 1rem;
}

.result-card.compact {
  box-shadow: none;
}

.result-card p {
  margin: 0.8rem 0;
}

.result-meta,
.score-line {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.92rem;
}

.result-meta strong {
  color: var(--text);
}

.score-line span,
.status,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: #edf2f7;
  padding: 0.25rem 0.55rem;
  font-size: 0.84rem;
  font-weight: 700;
}

.tag {
  background: #fff7ed;
  color: var(--accent);
}

.flash {
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.flash.success {
  border-color: #a7d7b5;
  background: #eef9f1;
  color: var(--success);
}

.flash.error {
  border-color: #f3b2aa;
  background: #fff1f0;
  color: var(--danger);
}

.stat-grid,
.summary-grid,
.two-column {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.summary-grid,
.two-column {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.stat-card {
  padding: 1rem;
}

.stat-card span {
  color: var(--muted);
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

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

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

blockquote {
  margin: 0.8rem 0;
  padding-left: 1rem;
  border-left: 4px solid var(--line);
  color: #2d3748;
}

.social-placeholders {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.social-placeholders button {
  cursor: not-allowed;
  opacity: 0.6;
}

.site-footer {
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem);
  color: var(--muted);
  border-top: 1px solid var(--line);
}

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

  .admin-nav {
    top: 96px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
