:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91d1d;
  --warning: #d97706;
  --success: #16a34a;
  --border: #e5e7eb;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

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

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px;
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

h1, h2 {
  margin: 0 0 16px;
  font-size: 1.5rem;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge.open { background: #dcfce7; color: #166534; }
.badge.closed { background: #fee2e2; color: #991b1b; }

.meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.wait {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
}

form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

label {
  width: 100%;
  font-weight: 500;
}

input[type="text"], select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
}

input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

button {
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

button:active { transform: translateY(1px); }

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

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

.btn-secondary { background: #e5e7eb; color: #1f2937; }
.btn-secondary:hover { background: #d1d5db; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }

button:disabled, .disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.closed-message {
  text-align: center;
  padding: 32px 0;
}

.closed-message h2 {
  font-size: 1.75rem;
  margin-bottom: 8px;
}

.booking {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.booking h3 {
  margin: 0 0 6px;
}

.booking p { margin: 0 0 12px; }

.countdown {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
}

.next-message {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 12px;
  color: #92400e;
  font-weight: 600;
}

.entries {
  list-style: none;
  padding: 0;
  margin: 0;
}

.entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.entry:last-child { border-bottom: none; }

.entry-position {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg);
  font-weight: 700;
  flex-shrink: 0;
}

.entry-info { flex: 1; min-width: 0; }

.entry-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-wait {
  font-size: 0.85rem;
  color: var(--muted);
}

.entry-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.entry-actions button {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 24px 0;
}

.settings {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.settings label {
  width: auto;
}

.settings select {
  width: auto;
  min-width: 120px;
}

.settings input[type="text"]#headerText {
  flex: 1;
  min-width: 200px;
}

.manual-entry {
  margin-bottom: 16px;
}

.manual-name {
  color: var(--muted);
  font-style: italic;
  font-weight: 500;
}

.error {
  background: #fee2e2;
  color: #991b1b;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 16px;
}

@media (max-width: 480px) {
  .container { padding: 16px; }
  .card { padding: 18px; }
  .entry { flex-wrap: wrap; }
  .entry-actions { width: 100%; justify-content: flex-end; }
}
