:root {
  --bg: #f6f4ee;
  --panel: #fffdf8;
  --ink: #1a2226;
  --accent: #26667f;
  --accent-2: #e7833f;
  --line: #d9d2c5;
  --glow-a: rgba(38, 102, 127, 0.08);
  --glow-b: rgba(231, 131, 63, 0.06);
  --theme-gradient: linear-gradient(120deg, #e9f6ff, #fff2e7);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  background: radial-gradient(circle at 10% 5%, #fff, transparent 40%),
    radial-gradient(circle at 90% 20%, #fff2df, transparent 35%),
    var(--bg);
  color: var(--ink);
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: var(--theme-gradient);
  opacity: 0.65;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.hero h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  margin: 0;
}

.eyebrow {
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.subtitle {
  max-width: 60ch;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow: 0 24px 60px rgba(26, 34, 38, 0.08);
}

.brand-studio {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  background: linear-gradient(145deg, #ffffff, #faf6ef);
}

.brand-studio h3 {
  margin-top: 0;
  margin-bottom: 0.35rem;
  font-family: "Fraunces", serif;
}

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

.tab-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.tab.active {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fade-in 250ms ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 600;
  font-size: 0.92rem;
}

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

input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  background: #fff;
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.65rem;
}

button {
  border: 1px solid transparent;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  cursor: pointer;
  transition: transform 130ms ease;
}

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

button.secondary {
  background: #fff;
  color: var(--accent);
  border-color: var(--line);
}

.result {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  background: #fff;
}

.hidden {
  display: none;
}

.passage {
  margin-bottom: 0.9rem;
}

.passage h4 {
  margin: 0 0 0.3rem;
}

.meta {
  color: #4f626c;
  font-size: 0.9rem;
}

.admin-toolbar {
  margin-top: 1rem;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.admin-stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem;
  background: #fff;
}

.admin-stat .label {
  display: block;
  font-size: 0.78rem;
  color: #4f626c;
}

.admin-stat .value {
  font-family: "Fraunces", serif;
  font-size: 1.2rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.status-chip.approved {
  background: #e8f6ef;
  color: #1e7b4f;
}

.status-chip.draft {
  background: #fff3e8;
  color: #a35618;
}

.status-chip.rejected {
  background: #fdeaea;
  color: #9b2c2c;
}

.template-card {
  margin-bottom: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem;
  background: linear-gradient(180deg, #ffffff, #fdfbf7);
}

.template-card .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  gap: 0.5rem;
}

.template-card p {
  margin-top: 0;
}

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

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

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

@media print {
  body {
    background: #fff;
  }

  .hero,
  .tab-row,
  #query-form,
  #admin-form,
  #admin-list,
  #tab-admin,
  #tab-user {
    display: none !important;
  }

  #result {
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }
}
