:root {
  --pmd-brown: #5a2a0c;
  --pmd-green: #4a8c3f;
  --pmd-green-dark: #3c7233;
  --bg: #f4f4f2;
  --card-bg: #ffffff;
  --field-bg: #eeeeee;
  --text: #222222;
  --label: #3a2a1f;
  --danger: #b3261e;
  --warn: #9a6b00;
  --max-width: 480px;
}

* {
  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;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  justify-content: center;
}

.screen {
  width: 100%;
  max-width: var(--max-width);
  min-height: 100vh;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
}

.screen[hidden] {
  display: none;
}

.app-header {
  background: var(--pmd-brown);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  padding: 1.1rem 0.75rem;
}

.card {
  padding: 0 1rem 1.5rem;
  display: flex;
  flex-direction: column;
}

.logo {
  width: min(64%, 260px);
  margin: 1.75rem auto 1.5rem;
  display: block;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.btn {
  border: none;
  border-radius: 6px;
  padding: 0.95rem 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

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

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

.btn-outline {
  background: #fff;
  color: var(--pmd-green);
  border: 2px solid var(--pmd-green);
  margin-top: 0.75rem;
}

.btn-submit {
  margin-top: 1.5rem;
}

.status-panel {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e2e2;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: #555;
}

.conn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #999;
  flex: none;
}

.conn-dot.online {
  background: var(--pmd-green);
}

.conn-dot.offline {
  background: var(--danger);
}

.queue-status {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  color: var(--warn);
  background: #fff6e0;
  border: 1px solid #f0d98c;
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
}

.active-setup-banner {
  font-size: 0.85rem;
  padding: 0.55rem 1rem;
  text-align: center;
  min-height: 1.2em;
}

.active-setup-banner.has-setup {
  background: #eef6ec;
  color: #2f5c28;
}

.active-setup-banner.offline-warning {
  background: #fff6e0;
  color: var(--warn);
}

.active-setup-banner.blank {
  background: #fbeaea;
  color: var(--danger);
}

.form {
  padding-top: 0.75rem;
}

.field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #eee;
}

.field label {
  flex: 0 0 38%;
  font-size: 0.92rem;
  color: var(--label);
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  flex: 1 1 62%;
  min-width: 0;
  background: var(--field-bg);
  border: 1px solid #d8d8d8;
  border-radius: 4px;
  padding: 0.55rem 0.6rem;
  font-size: 0.95rem;
  color: var(--text);
  font-family: inherit;
}

.field-stacked {
  flex-direction: column;
  align-items: stretch;
}

.field-stacked label {
  flex: none;
}

.field textarea {
  min-height: 6rem;
  resize: vertical;
}

.divider {
  background: var(--pmd-brown);
  height: 14px;
  margin: 0.75rem -1rem;
}

.field.invalid input,
.field.invalid select,
.field.invalid textarea {
  border-color: var(--danger);
  outline: 1px solid var(--danger);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  max-width: calc(100% - 2rem);
  background: #222;
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.92rem;
  text-align: center;
  z-index: 1000;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.toast.success {
  background: var(--pmd-green-dark);
}

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

.toast.info {
  background: #3a3a3a;
}
