:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --surface-2: #0f3460;
  --accent: #e94560;
  --accent-hover: #d63851;
  --text: #eee;
  --text-muted: #94a3b8;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius: 12px;
  --font: system-ui, -apple-system, sans-serif;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

header {
  background: var(--surface);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.queue-badge {
  background: var(--warning);
  color: #000;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  display: none;
}

.queue-badge.visible { display: inline-block; }

main {
  flex: 1;
  padding: 1.25rem;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

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

.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--surface-2);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.group-display {
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  min-height: 2.6rem;
}

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

.btn {
  width: 100%;
  padding: 0.85rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  touch-action: manipulation;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  margin-bottom: 0.75rem;
}

.btn-secondary:hover { background: #1a4a80; }

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#qr-reader {
  margin-bottom: 1rem;
  border-radius: 8px;
  overflow: hidden;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  max-width: calc(100% - 2rem);
  text-align: center;
}

.toast.show { opacity: 1; }
.toast.success { background: var(--success); color: #000; }
.toast.error { background: var(--error); color: #fff; }
.toast.info { background: var(--surface-2); color: var(--text); }

.offline-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

@media (min-width: 600px) {
  main { padding: 2rem; }
}
