@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700&family=Space+Mono:wght@400;700&display=swap');

:root {
  --bg: #0d1117;
  --bg-card: #131c2e;
  --bg-input: #182236;
  --border: #243049;
  --border-focus: #6366f1;
  --text: #b8cef0;
  --text-dim: #6a82b0;
  --text-muted: #3d5480;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-dim: rgba(99,102,241,0.12);
  --success: #34d399;
  --success-dim: rgba(52,211,153,0.12);
  --danger: #f87171;
  --danger-dim: rgba(248,113,113,0.12);
  --warning: #fbbf24;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 2px 16px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.mono { font-family: 'Space Mono', monospace; }

/* Layout */
.container { max-width: 720px; margin: 0 auto; padding: 2rem 1.25rem; }
.container-wide { max-width: 1080px; margin: 0 auto; padding: 2rem 1.25rem; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* Typography */
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1rem; font-weight: 600; }
.dim { color: var(--text-dim); }
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }

/* Poll description block */
.poll-description {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-top: 0.75rem;
  color: var(--text);
  font-size: 1rem;
}
.poll-description p { margin-bottom: 0.75rem; }
.poll-description p:last-child { margin-bottom: 0; }
.poll-description h1,
.poll-description h2,
.poll-description h3,
.poll-description h4,
.poll-description h5,
.poll-description h6 {
  text-align: center;
  margin-bottom: 0.5rem;
}

/* Forms */
label { display: block; font-weight: 500; margin-bottom: 0.35rem; font-size: 0.9rem; }
input[type="text"], input[type="email"], input[type="url"],
input[type="number"], input[type="password"],
input[type="datetime-local"],
select, textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
}
textarea { resize: vertical; min-height: 80px; }

.form-group { margin-bottom: 1rem; }
.form-row { display: flex; gap: 1rem; }
.form-row > * { flex: 1; }
@media (max-width: 520px) { .form-row { flex-direction: column; gap: 0; } }

.checkbox-row {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0;
}
.checkbox-row input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border: none; border-radius: var(--radius);
  font-family: inherit; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--text-muted); }
.btn-danger { background: var(--danger-dim); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--success-dim); color: var(--success); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-icon { padding: 0.4rem; border-radius: 8px; background: transparent; border: 1px solid var(--border); color: var(--text-dim); cursor: pointer; }
.btn-icon:hover { border-color: var(--text-muted); color: var(--text); }

.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 6px; font-size: 0.75rem; font-weight: 600;
}
.badge-active { background: var(--success-dim); color: var(--success); }
.badge-inactive { background: var(--danger-dim); color: var(--danger); }
.badge-count { background: var(--accent-dim); color: var(--accent); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 0.65rem 0.85rem;
  text-align: left; font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
th { color: var(--text-dim); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab {
  padding: 0.65rem 1.2rem;
  font-weight: 600; font-size: 0.9rem;
  color: var(--text-dim); cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Alert */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.alert-error { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(248,113,113,0.2); }
.alert-success { background: var(--success-dim); color: var(--success); border: 1px solid rgba(52,211,153,0.2); }
.alert-info { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(99,102,241,0.2); }

/* Header */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.header-brand {
  font-family: 'Space Mono', monospace;
  font-weight: 700; font-size: 1.1rem;
  color: var(--accent);
  text-decoration: none;
}

/* Misc */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.hidden { display: none; }

/* Question card in form */
.question-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.question-card .q-label {
  font-weight: 600; margin-bottom: 0.5rem;
}
.question-card .q-label .optional {
  font-weight: 400; color: var(--text-muted); font-size: 0.85rem;
}

/* Pill */
.pill-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg-input);
  color: var(--text);
}
.pill:hover { border-color: var(--accent); }
.pill.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Skeleton loading */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--border) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

/* Success animation */
@keyframes checkIn {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
.success-check {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--success-dim);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  animation: checkIn 0.4s ease-out;
}
.success-check svg { color: var(--success); }
