:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #d9dee3;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

header.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

header.topbar h1 {
  font-size: 1.1rem;
  margin: 0;
}

header.topbar a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

h2 {
  margin-top: 0;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 0.9rem;
}

textarea {
  resize: vertical;
  min-height: 4rem;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--primary);
  color: white;
}

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

button.secondary {
  background: #e5e7eb;
  color: var(--text);
}

button.secondary:hover {
  background: #d1d5db;
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: #b91c1c;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-draft { background: #e5e7eb; color: #374151; }
.badge-open { background: #dcfce7; color: #166534; }
.badge-closed { background: #fef3c7; color: #92400e; }
.badge-published { background: #dbeafe; color: #1e40af; }

.badge-active { background: #dcfce7; color: #166534; }
.badge-invalidated { background: #fee2e2; color: #991b1b; }
.badge-pending { background: #fef3c7; color: #92400e; }

.error {
  color: var(--danger);
  font-weight: 600;
  margin: 0.5rem 0;
}

.success {
  color: var(--success);
  font-weight: 600;
  margin: 0.5rem 0;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

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

.option-row input {
  margin-bottom: 0;
}

.list-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
}

.list-item h3 {
  margin: 0 0 0.3rem;
  font-size: 1.02rem;
}

.actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.poll-link {
  display: block;
}

.progress {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.progress span {
  flex: 1;
  text-align: center;
  padding: 0.4rem;
  border-radius: 6px;
  background: #e5e7eb;
  color: #6b7280;
  font-size: 0.82rem;
  font-weight: 700;
}

.progress span.current {
  background: var(--primary);
  color: white;
}

.progress span.done {
  background: #dcfce7;
  color: #166534;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.bar-label {
  width: 40%;
  font-size: 0.9rem;
}

.bar-track {
  flex: 1;
  background: #e5e7eb;
  border-radius: 4px;
  height: 18px;
  overflow: hidden;
}

.bar-fill {
  background: var(--primary);
  height: 100%;
}

.bar-count {
  width: 3rem;
  text-align: right;
  font-weight: 700;
}
