/* ---------- design tokens ---------- */
:root {
  --bg: #0b1020;
  --bg-elev: #131a33;
  --bg-elev-2: #1b2447;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e9ecf5;
  --text-dim: #a3acc8;
  --text-mute: #6c7799;
  --accent: #4dd0e1;
  --accent-strong: #22d3ee;
  --accent-soft: rgba(77, 208, 225, 0.12);
  --good: #34d399;
  --warn: #fbbf24;
  --bad:  #f87171;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --maxw: 880px;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(77, 208, 225, 0.12), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(168, 85, 247, 0.10), transparent 60%),
    linear-gradient(180deg, #0a0f1f 0%, #0b1020 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- layout ---------- */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 56px 24px 80px;
}
.page--wide { max-width: 1200px; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}
.header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.header__nav { display: flex; gap: 16px; align-items: center; }
.header__nav a { color: var(--text-dim); font-size: 0.92rem; }
.header__nav a:hover { color: var(--text); text-decoration: none; }

.hero { margin-bottom: 36px; }
.hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { color: var(--text-dim); margin: 0; max-width: 60ch; }

/* ---------- card ---------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}
.card + .card { margin-top: 20px; }
.card__title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card__help {
  margin: 0 0 14px;
  color: var(--text-mute);
  font-size: 0.88rem;
}

/* ---------- form ---------- */
.field { margin-bottom: 24px; }
.field__label { display: block; font-weight: 600; margin-bottom: 6px; }
.field__help { color: var(--text-mute); font-size: 0.85rem; margin-bottom: 10px; }
.field__error { color: var(--bad); font-size: 0.85rem; margin-top: 6px; }
.field-textarea {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="text"], input[type="password"] {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus, input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- rating (5 stars) ----------
   Django 5 renders RadioSelect as <div><div><label><input class="rating-input"…>N</label></div>…</div>.
   We target the outer <div> via :has() and turn each <label> into a clickable star. */
.rating-group {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}
.rating-group > div { margin: 0; padding: 0; }

.rating-group label {
  display: inline-block;
  width: 40px;
  height: 40px;
  cursor: pointer;
  /* hide the numeric "1 2 3 4 5" trailing text */
  font-size: 0;
  color: transparent;
  background-color: rgba(255, 255, 255, 0.18);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.62L12 2 9.19 8.62 2 9.24l5.46 4.73L5.82 21z'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.62L12 2 9.19 8.62 2 9.24l5.46 4.73L5.82 21z'/></svg>") center / contain no-repeat;
  transition: background-color .12s ease, transform .08s ease;
}

.rating-group input.rating-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

/* Hover preview: this star and all earlier siblings fill in gold */
.rating-group > div:hover label,
.rating-group > div:has(~ div:hover) label {
  background-color: #facc15;
  transform: scale(1.06);
}

/* Selected state (suppressed while hovering the group) */
.rating-group:not(:has(> div:hover)) > div:has(input:checked) label,
.rating-group:not(:has(> div:hover)) > div:has(~ div input:checked) label {
  background-color: #fbbf24;
}

/* Focus indicator (keyboard) */
.rating-group > div:focus-within label {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- yes / no ---------- */
.yesno-group {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.yesno-group label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 600;
  transition: all .12s ease;
  user-select: none;
}
.yesno-group label:hover {
  border-color: var(--accent);
  color: var(--text);
}
.yesno-group > div:has(input:checked) label {
  background: var(--accent);
  color: #062028;
  border-color: var(--accent);
}
.yesno-group input.yesno-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

/* select */
select {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
}
select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #062028;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, background .15s;
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.25);
}
.btn:hover { background: var(--accent-strong); }
.btn:active { transform: translateY(1px); }
.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- thanks ---------- */
.thanks {
  text-align: center;
  padding: 40px 16px;
}
.thanks__icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  font-size: 32px;
}
.thanks h1 { margin: 0 0 12px; font-size: 2rem; font-weight: 800; }

/* ---------- dashboard ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-card__label { color: var(--text-dim); font-size: 0.85rem; margin: 0 0 8px; }
.stat-card__value { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-card__hint { color: var(--text-mute); font-size: 0.85rem; margin-top: 4px; }

.filter-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0 0 24px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  font-size: 0.88rem;
  font-weight: 500;
}
.chip:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }
.chip--active {
  background: var(--accent);
  color: #062028;
  border-color: var(--accent);
}
.chip--active:hover { color: #062028; }

.q-block {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.q-block__head {
  display: flex; justify-content: space-between; gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.q-block__title { margin: 0; font-size: 1.05rem; font-weight: 600; }
.q-block__meta { color: var(--text-mute); font-size: 0.85rem; }

.rating-summary {
  display: flex; gap: 24px; align-items: center;
}
.rating-summary__avg {
  font-size: 2.6rem; font-weight: 800; letter-spacing: -0.02em;
  color: var(--accent);
  min-width: 90px;
}
.rating-summary__chart {
  flex: 1; min-width: 0;
  max-height: 140px;
}

.yesno-row { display: flex; gap: 16px; }
.yesno-bar {
  flex: 1;
  border-radius: 10px;
  padding: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
}
.yesno-bar__label { color: var(--text-dim); font-size: 0.85rem; }
.yesno-bar__value { font-size: 1.6rem; font-weight: 800; }
.yesno-bar--yes .yesno-bar__value { color: var(--good); }
.yesno-bar--no  .yesno-bar__value { color: var(--bad); }

.text-list { list-style: none; padding: 0; margin: 0; }
.text-list li {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
  color: var(--text);
  white-space: pre-wrap;
}
.text-list--empty { color: var(--text-mute); font-style: italic; }

.recent {
  margin-top: 32px;
}
.recent table { width: 100%; border-collapse: collapse; }
.recent th, .recent td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.recent th { color: var(--text-dim); font-weight: 500; }

/* login page */
.login-card {
  max-width: 380px;
  margin: 80px auto;
  padding: 32px;
}
.login-card h1 { margin: 0 0 18px; font-size: 1.4rem; }

/* helpers */
.muted { color: var(--text-mute); }
.spacer { height: 16px; }
.flex { display: flex; gap: 12px; align-items: center; }
.right { margin-left: auto; }

/* error list */
.errorlist { color: var(--bad); padding-left: 18px; margin: 8px 0 0; font-size: 0.88rem; }
