:root {
  --teal: #2a7a82;
  --teal-dark: #1e5b61;
  --bg: #f4f6f6;
  --card-bg: #ffffff;
  --border: #d9e0e0;
  --text: #2c3333;
  --text-muted: #6b7677;
  --danger: #c0392b;
  --success: #2e7d32;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

.topbar {
  background: var(--teal);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.topbar-title {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.topbar-title strong {
  font-size: 15px;
}

.topbar-title span {
  font-size: 11px;
  opacity: 0.85;
}

.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(255,255,255,0.2);
}

.badge-offline {
  background: #c0392b;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 96px;
}

.queue-banner {
  background: #fff8e1;
  border: 1px solid #f0d78c;
  color: #6b5900;
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 13px;
}

.queue-banner button {
  background: var(--teal);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.field-group {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.field-group label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}

.field-group label.mt {
  margin-top: 16px;
}

.required {
  color: var(--danger);
}

select, input[type="date"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: white;
  color: var(--text);
  font-family: inherit;
}

select:focus, input:focus, textarea:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

textarea {
  resize: vertical;
}

.radio-list, .checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.radio-item, .checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s;
}

.radio-item:active, .checkbox-item:active {
  background: #eef4f4;
}

.radio-item input, .checkbox-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
  flex-shrink: 0;
}

.radio-item.selected, .checkbox-item.selected {
  border-color: var(--teal);
  background: #eef7f7;
}

.conditional {
  border-left: 3px solid var(--teal);
}

.form-error {
  background: #fdecea;
  border: 1px solid #f5b7b1;
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.btn-primary {
  width: 100%;
  background: var(--teal);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:active {
  background: var(--teal-dark);
}

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

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: white;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 14px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  z-index: 20;
}

.toast.error {
  background: var(--danger);
}

.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  gap: 10px;
}

.app-footer button {
  background: var(--teal);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
