:root {
  --bg: #05060a;
  --bg-2: #0a0b12;
  --bg-3: #11131c;
  --bg-elev: #14172244;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.055);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e7e9ee;
  --text-dim: #9aa0ae;
  --text-mute: #6b7180;
  --accent: #a78bfa;
  --accent-2: #60a5fa;
  --accent-3: #f472b6;
  --success: #4ade80;
  --danger: #f87171;
  --warning: #fbbf24;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-soft: 0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 40px rgba(0,0,0,0.4);
  --shadow-lg: 0 30px 80px rgba(0,0,0,0.55), 0 2px 0 rgba(255,255,255,0.03) inset;
  --grad: linear-gradient(135deg, #a78bfa 0%, #60a5fa 50%, #f472b6 100%);
  --grad-soft: linear-gradient(135deg, rgba(167,139,250,0.15), rgba(96,165,250,0.08) 50%, rgba(244,114,182,0.15));
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(167,139,250,0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(96,165,250,0.08), transparent 60%),
    radial-gradient(700px 400px at 50% 120%, rgba(244,114,182,0.08), transparent 60%),
    var(--bg);
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }

/* Typography */
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: 34px; line-height: 1.15; }
h2 { font-size: 22px; line-height: 1.2; }
h3 { font-size: 17px; line-height: 1.3; }
p { margin: 0; color: var(--text-dim); }

.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }

/* Layout */
.app { position: relative; z-index: 1; display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; padding: 28px 40px 80px; max-width: 1400px; margin: 0 auto; width: 100%; }

/* Sidebar */
.sidebar {
  width: 256px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent);
  display: flex; flex-direction: column;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 22px;
  font-weight: 600; letter-spacing: -0.01em;
}
.sidebar .brand-mark {
  width: 32px; height: 32px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(255,255,255,0.08));
}
.sidebar .brand-name { font-size: 16px; letter-spacing: -0.015em; }
.sidebar .brand-name .lead { color: var(--text); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text-dim); font-size: 14px; font-weight: 500;
  transition: all 0.15s ease;
}
.sidebar nav a:hover { background: var(--surface); color: var(--text); }
.sidebar nav a.active {
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}
.sidebar nav svg { width: 16px; height: 16px; opacity: 0.85; }
.sidebar .sb-foot {
  margin-top: auto; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-mute);
  display: flex; justify-content: space-between; align-items: center;
}

/* Header */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin-bottom: 28px;
}
.page-head .crumbs {
  font-size: 13px; color: var(--text-mute);
  margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.page-head .crumbs a:hover { color: var(--text); }
.page-head .crumbs .sep { opacity: 0.4; }
.page-head h1 { font-size: 30px; }
.page-head .desc { margin-top: 6px; color: var(--text-dim); max-width: 560px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  font: inherit; font-weight: 500; font-size: 13.5px;
  cursor: pointer; transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn svg { width: 15px; height: 15px; }
.btn.primary {
  background: linear-gradient(180deg, #ffffff 0%, #e5e7eb 100%);
  color: #0b0e17; border-color: transparent;
  box-shadow: 0 2px 0 rgba(255,255,255,0.2) inset, 0 10px 30px rgba(255,255,255,0.08);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.accent {
  background: var(--grad); color: white; border-color: transparent;
  box-shadow: 0 10px 30px rgba(167,139,250,0.3);
}
.btn.accent:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: rgba(248,113,113,0.08); border-color: rgba(248,113,113,0.3); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface); }
.btn.sm { padding: 6px 10px; font-size: 12.5px; }
.btn.lg { padding: 12px 20px; font-size: 15px; border-radius: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.card.pad-sm { padding: 16px; }
.card.interactive:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.card-head h2 { font-size: 17px; }

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.grid.tight { gap: 14px; }

/* Project / Survey card */
.tile {
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  display: flex; flex-direction: column; gap: 14px;
  min-height: 164px;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 10px 30px rgba(0,0,0,0.18);
}
.tile::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(600px 200px at 0% 0%, var(--tile-color, rgba(167,139,250,0.10)), transparent 60%);
  pointer-events: none;
  opacity: 0.9;
  transition: opacity 0.2s;
}
.tile::after {
  content: ''; position: absolute; top: 0; left: 18px; right: 18px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--tile-color, rgba(167,139,250,0.3)), transparent);
  opacity: 0.7;
}
.tile:hover {
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 20px 40px rgba(0,0,0,0.35);
}
.tile:hover::before { opacity: 1; }
.tile .tile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tile .tile-icon {
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--tile-color, var(--grad)); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px rgba(0,0,0,0.35);
}
.tile .tile-icon svg { width: 20px; height: 20px; color: white; }
.tile h3 { font-size: 18px; }
.tile .tile-desc {
  font-size: 13.5px; color: var(--text-dim);
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile .tile-stats {
  display: flex; gap: 14px; margin-top: auto;
  font-size: 12.5px; color: var(--text-mute);
}
.tile .tile-stat { display: flex; align-items: center; gap: 6px; }
.tile .tile-stat svg { width: 13px; height: 13px; }
.tile-menu { position: absolute; top: 14px; right: 14px; }

/* Stat row */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.stat .l { font-size: 12px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.08em; }
.stat .v { font-size: 28px; font-weight: 600; margin-top: 6px; letter-spacing: -0.02em; }
.stat .v .sub { font-size: 14px; color: var(--text-mute); margin-left: 4px; }

/* Form */
.form-row { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.form-row label { font-size: 13px; font-weight: 500; color: var(--text-dim); }
.form-row .hint { font-size: 12px; color: var(--text-mute); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], input[type=date], input[type=url], textarea, select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit; font-size: 14px;
  padding: 10px 12px; border-radius: 10px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
textarea { resize: vertical; min-height: 80px; font-family: inherit; }
input:focus, textarea:focus, select:focus {
  border-color: rgba(167,139,250,0.5);
  box-shadow: 0 0 0 3px rgba(167,139,250,0.12);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa0ae' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  appearance: none; -webkit-appearance: none;
}
.form-row.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.switch {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 36px; height: 20px; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 999px; position: relative;
  transition: all 0.2s;
}
.switch .track::after {
  content: ''; position: absolute; width: 14px; height: 14px;
  background: #cbd0db; border-radius: 50%; top: 2px; left: 2px;
  transition: all 0.2s;
}
.switch input:checked + .track { background: var(--grad); border-color: transparent; }
.switch input:checked + .track::after { left: 18px; background: white; }
.switch .lbl { font-size: 13px; color: var(--text-dim); }

/* Table */
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-weight: 500; color: var(--text-mute);
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
}
table.data td {
  padding: 14px; border-bottom: 1px solid var(--border);
  vertical-align: top; color: var(--text);
}
table.data tr:last-child td { border-bottom: none; }
table.data tr.selectable:hover { background: var(--surface); }
table.data .chk { width: 36px; }
table.data .actions { text-align: right; white-space: nowrap; }

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-dim);
}
.badge.success { background: rgba(74,222,128,0.1); color: #86efac; border-color: rgba(74,222,128,0.2); }
.badge.warn { background: rgba(251,191,36,0.1); color: #fcd34d; border-color: rgba(251,191,36,0.2); }
.badge.accent { background: rgba(167,139,250,0.1); color: #c4b5fd; border-color: rgba(167,139,250,0.2); }
.badge.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Empty */
.empty {
  padding: 72px 24px; text-align: center;
  border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.empty .icon {
  width: 56px; height: 56px; margin: 0 auto 18px;
  background: var(--grad-soft); border: 1px solid var(--border);
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
}
.empty .icon svg { width: 24px; height: 24px; color: var(--accent); }
.empty h3 { margin-bottom: 6px; font-size: 18px; }
.empty p { max-width: 380px; margin: 0 auto 18px; }

/* Flash */
.flash {
  padding: 12px 16px; border-radius: 12px;
  margin-bottom: 20px; font-size: 13.5px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border);
}
.flash.success { background: rgba(74,222,128,0.08); border-color: rgba(74,222,128,0.2); color: #bbf7d0; }
.flash.error { background: rgba(248,113,113,0.08); border-color: rgba(248,113,113,0.3); color: #fecaca; }
.flash.info { background: var(--surface); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(3, 4, 8, 0.72);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
  opacity: 0; transition: opacity 0.2s;
}
.modal-backdrop.open { display: flex; opacity: 1; }
.modal {
  background: linear-gradient(180deg, #141620, #0c0e16);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  max-width: 560px; width: 100%; max-height: 92vh; overflow: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px); transition: transform 0.25s;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-head {
  padding: 22px 24px 0;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
}
.modal-head h2 { font-size: 18px; }
.modal-head .desc { font-size: 13px; margin-top: 4px; }
.modal-body { padding: 22px 24px; }
.modal-foot {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}
.modal .close-btn {
  background: transparent; border: none; color: var(--text-mute);
  cursor: pointer; padding: 4px; border-radius: 6px;
}
.modal .close-btn:hover { color: var(--text); background: var(--surface); }

/* Field builder */
.fb-wrap { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: flex-start; }
@media (max-width: 960px) { .fb-wrap { grid-template-columns: 1fr; } }

.fb-palette { position: sticky; top: 24px; }
.fb-palette .card-head h2 { font-size: 14px; }
.fb-type {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-size: 13px;
  transition: all 0.15s;
  width: 100%; text-align: left; color: var(--text);
  font-family: inherit;
  margin-bottom: 6px;
}
.fb-type:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.fb-type svg { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }

.fb-list { display: flex; flex-direction: column; gap: 12px; }
.fb-field {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  position: relative;
}
.fb-field .fb-field-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.fb-field .fb-field-head .drag {
  cursor: grab; color: var(--text-mute);
  padding: 2px; border-radius: 4px;
}
.fb-field .fb-field-head .type-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 6px;
  background: rgba(167,139,250,0.1); color: #c4b5fd;
  font-size: 11.5px; font-weight: 500;
  border: 1px solid rgba(167,139,250,0.2);
}
.fb-field .fb-field-head .type-pill svg { width: 11px; height: 11px; }
.fb-field .fb-actions { margin-left: auto; display: flex; gap: 4px; }
.fb-field textarea.label-input {
  font-size: 16px; font-weight: 500; background: transparent; border: none;
  padding: 4px 0; margin-bottom: 10px; resize: none; min-height: 28px;
}
.fb-field textarea.label-input:focus { box-shadow: none; }
.fb-field .options-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.fb-field .option-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  background: var(--bg-3); border: 1px solid var(--border);
}
.fb-field .option-row input { background: transparent; border: none; padding: 0; font-size: 13px; }
.fb-field .option-row input:focus { box-shadow: none; }
.fb-field .option-row .remove { color: var(--text-mute); cursor: pointer; padding: 3px; border-radius: 4px; background: transparent; border: none; }
.fb-field .option-row .remove:hover { color: var(--danger); }
.fb-field .option-row .handle { color: var(--text-mute); }
.fb-field .option-row .bullet {
  width: 14px; height: 14px; border: 1px solid var(--border); border-radius: 50%; flex-shrink: 0;
}
.fb-field .option-row .bullet.sq { border-radius: 3px; }
.fb-field .fb-foot { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.fb-placeholder { color: var(--text-mute); font-size: 13px; margin-top: 8px; }
.fb-add-option {
  background: transparent; border: 1px dashed var(--border); color: var(--text-dim);
  padding: 7px 10px; border-radius: 8px; font-size: 12.5px; cursor: pointer;
  width: fit-content; display: flex; align-items: center; gap: 6px;
  font-family: inherit;
}
.fb-add-option:hover { background: var(--surface); color: var(--text); }

/* Public survey */
.public-body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(167,139,250,0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(96,165,250,0.08), transparent 60%),
    var(--bg);
  min-height: 100vh;
  padding: 0;
}
.survey-shell {
  max-width: 760px; margin: 0 auto; padding: 60px 24px 80px;
}
.survey-brand {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 44px; opacity: 0.8;
}
.survey-brand .mark {
  width: 26px; height: 26px;
  display: inline-block;
  vertical-align: middle;
  background: url('/assets/img/emblem.png') no-repeat center / contain;
}
.survey-brand .wordmark {
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--text-dim);
}
.survey-hero {
  text-align: center; margin-bottom: 44px;
}
.survey-hero .label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-dim); margin-bottom: 20px;
}
.survey-hero h1 {
  font-size: 44px; line-height: 1.1; letter-spacing: -0.03em;
  max-width: 640px; margin: 0 auto;
  background: linear-gradient(180deg, #fff 30%, #bbb);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
@media (max-width: 640px) { .survey-hero h1 { font-size: 32px; } }
.survey-hero p {
  margin-top: 16px; max-width: 540px; margin-left: auto; margin-right: auto;
  font-size: 15.5px; line-height: 1.65;
}
.survey-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 36px 36px 28px;
  box-shadow: var(--shadow-lg);
}
@media (max-width: 640px) { .survey-card { padding: 24px 20px; border-radius: 18px; } }
.survey-field { margin-bottom: 28px; }
.survey-field .q-label {
  display: block; font-size: 15.5px; font-weight: 500; color: var(--text);
  margin-bottom: 10px; letter-spacing: -0.01em;
}
.survey-field .q-label .req { color: var(--accent); margin-left: 3px; }
.survey-field .q-help { font-size: 13px; color: var(--text-mute); margin-top: -4px; margin-bottom: 10px; }

.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-radius: 12px;
  background: var(--bg-3); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.15s;
  font-size: 14px;
}
.choice:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .ring {
  width: 18px; height: 18px; border: 1.5px solid var(--border-strong);
  border-radius: 50%; flex-shrink: 0; position: relative;
  transition: all 0.15s;
}
.choice .ring.sq { border-radius: 5px; }
.choice.selected { border-color: rgba(167,139,250,0.5); background: rgba(167,139,250,0.08); }
.choice.selected .ring { border-color: var(--accent); background: var(--accent); }
.choice.selected .ring::after {
  content: ''; position: absolute; inset: 3px; border-radius: 50%; background: white;
}
.choice.selected .ring.sq::after {
  border-radius: 2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E") no-repeat center/10px 10px #a78bfa;
  inset: 0;
}

/* Rating */
.rating { display: flex; gap: 8px; }
.rating button {
  background: transparent; border: none; cursor: pointer; padding: 0;
  color: var(--border-strong); transition: color 0.15s, transform 0.15s;
}
.rating button:hover { transform: scale(1.1); }
.rating button svg { width: 32px; height: 32px; }
.rating button.active { color: #fcd34d; }
.rating button.active svg { filter: drop-shadow(0 0 8px rgba(252,211,77,0.3)); }

/* Scale */
.scale {
  display: flex;
  gap: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  flex-wrap: wrap;
}
.scale button {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 4px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 8px;
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  text-align: center;
}
.scale button:hover { color: var(--text); background: var(--surface); }
.scale button.active {
  background: var(--grad); color: white;
  box-shadow: 0 4px 12px rgba(167,139,250,0.35);
}
@media (max-width: 520px) {
  .scale { gap: 3px; padding: 3px; }
  .scale button { padding: 8px 2px; font-size: 13px; }
}

.survey-submit {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--border);
}

/* Public footer */
.public-foot {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.public-foot-inner {
  display: flex; flex-direction: column; gap: 14px;
  text-align: center;
}
.public-foot-brand {
  display: inline-flex; align-items: center; gap: 8px;
  justify-content: center;
  font-size: 13px; color: var(--text-dim); font-weight: 500;
}
.public-foot-brand .foot-mark {
  width: 22px; height: 22px;
  display: inline-block;
  background: url('/assets/img/emblem.png') no-repeat center / contain;
  opacity: 0.9;
}
.public-foot-links {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  justify-content: center;
  font-size: 13px;
}
.public-foot-links a {
  color: var(--text-mute);
  transition: color 0.15s;
}
.public-foot-links a:hover { color: var(--text); }
.public-foot-fine {
  font-size: 12px; color: var(--text-mute);
  max-width: 560px; margin: 0 auto;
  line-height: 1.6;
}
.public-foot-fine a { color: var(--text-dim); text-decoration: underline; text-decoration-color: rgba(255,255,255,0.15); }
.public-foot-fine a:hover { color: var(--text); text-decoration-color: rgba(255,255,255,0.4); }

/* Legal pages */
article.legal {
  max-width: 760px;
  margin: 0 auto;
  padding-top: 20px;
}
article.legal .legal-head { margin-bottom: 40px; }
article.legal .eyebrow {
  display: inline-block; font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-mute); margin-bottom: 16px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
}
article.legal h1 {
  font-size: 42px; line-height: 1.1; letter-spacing: -0.025em;
  background: linear-gradient(180deg, #fff 30%, #bbb);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
@media (max-width: 640px) { article.legal h1 { font-size: 32px; } }
article.legal section {
  margin-bottom: 28px;
  padding: 22px 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.01));
  border: 1px solid var(--border);
  border-radius: 16px;
}
@media (max-width: 640px) { article.legal section { padding: 18px 18px; } }
article.legal section h2 {
  font-size: 16px; margin-bottom: 10px;
}
article.legal section p {
  color: var(--text-dim); font-size: 14.5px; line-height: 1.7;
  margin-bottom: 10px;
}
article.legal section p:last-child { margin-bottom: 0; }
article.legal section ul {
  color: var(--text-dim); font-size: 14.5px; line-height: 1.7;
  padding-left: 22px; margin: 6px 0 12px;
}
article.legal section ul li { margin-bottom: 4px; }
article.legal section a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(167,139,250,0.5);
  text-underline-offset: 3px;
}
article.legal section a:hover { text-decoration-color: var(--accent); }

/* Thank you screen */
.thankyou {
  text-align: center; padding: 80px 20px;
}
.thankyou .check {
  width: 80px; height: 80px; margin: 0 auto 28px;
  border-radius: 24px; background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 20px 50px rgba(167,139,250,0.3);
  animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.thankyou .check svg { width: 40px; height: 40px; color: white; }
.thankyou h1 {
  font-size: 38px;
  background: linear-gradient(180deg, #fff 30%, #bbb);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.thankyou p { font-size: 16px; margin-top: 14px; }
@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  80% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

/* Submissions */
.tool-row {
  display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap; margin-bottom: 18px;
}
.tool-row .search {
  flex: 1; max-width: 280px;
  position: relative;
}
.tool-row .search input { padding-left: 38px; }
.tool-row .search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-mute); pointer-events: none;
}
.tool-row .count {
  font-size: 13px; color: var(--text-mute);
  padding: 5px 10px; border-radius: 6px; background: var(--surface);
  border: 1px solid var(--border);
}

/* Submission detail */
.sub-detail { display: grid; gap: 14px; }
.sub-answer {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px;
}
.sub-answer .q { font-size: 13px; color: var(--text-mute); margin-bottom: 6px; }
.sub-answer .a { font-size: 15px; color: var(--text); white-space: pre-wrap; word-break: break-word; }

/* Login */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 420px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
  border: 1px solid var(--border);
  border-radius: 20px; padding: 36px;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.login-card::before {
  content: ''; position: absolute; top: -1px; left: 20%; right: 20%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(167,139,250,0.4), transparent);
}
.login-card .mark {
  width: 64px; height: 64px;
  display: block;
  margin: 0 auto 22px;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(255,255,255,0.12));
}
.login-card h1 { text-align: center; font-size: 24px; }
.login-card .sub { text-align: center; margin-top: 6px; margin-bottom: 28px; font-size: 14px; }

/* Misc */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mt-sm { margin-top: 10px; } .mt-md { margin-top: 20px; } .mt-lg { margin-top: 32px; }
.mb-sm { margin-bottom: 10px; } .mb-md { margin-bottom: 20px; } .mb-lg { margin-bottom: 32px; }
.divider { height: 1px; background: var(--border); margin: 22px 0; }

/* Dropdown menu */
.menu-wrap { position: relative; }
.menu-btn { background: transparent; border: none; color: var(--text-mute); cursor: pointer; padding: 6px; border-radius: 6px; }
.menu-btn:hover { background: var(--surface); color: var(--text); }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px;
  background: #141620; border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 6px; z-index: 50;
  box-shadow: var(--shadow-lg);
  display: none;
}
.menu.open { display: block; }
.menu a, .menu button {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; font-size: 13px;
  background: transparent; border: none; color: var(--text); width: 100%;
  text-align: left; cursor: pointer; font-family: inherit;
}
.menu a:hover, .menu button:hover { background: var(--surface); }
.menu a.danger, .menu button.danger { color: var(--danger); }
.menu svg { width: 13px; height: 13px; color: var(--text-mute); }
.menu .sep { height: 1px; background: var(--border); margin: 4px 0; }

/* Copy link input */
.copy-box {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px 4px 4px 12px;
  font-family: var(--mono); font-size: 12.5px; color: var(--text-dim);
}
.copy-box input { background: transparent; border: none; padding: 6px 0; flex: 1; font-family: inherit; font-size: inherit; color: inherit; }
.copy-box input:focus { box-shadow: none; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn 0.3s ease; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); background-clip: content-box; border: 2px solid transparent; }

/* Mobile */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; position: static; height: auto;
    border-right: none; border-bottom: 1px solid var(--border);
    padding: 16px 20px;
  }
  .sidebar nav { flex-direction: row; overflow-x: auto; gap: 6px; }
  .sidebar nav a { white-space: nowrap; }
  .sidebar .brand { padding: 0; margin-bottom: 14px; }
  .sidebar .sb-foot { display: none; }
  .main { padding: 20px; }
}
