:root {
  color-scheme: light dark;
  --bg: #f8f7f4;
  --fg: #1c1c1e;
  --muted: #6b6b70;
  --accent: #2f6f4f;
  --accent-fg: #ffffff;
  --border: #dedcd6;
  --danger: #b3261e;
  --card-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --fg: #f2f2f2;
    --muted: #9a9a9e;
    --accent: #4f9d76;
    --accent-fg: #0c0c0c;
    --border: #2c2c2e;
    --card-bg: #1c1c1e;
  }
}

* {
  box-sizing: border-box;
}

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

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 4px;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 20px;
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 0 0 16px;
}

/* ---- User picker ---- */

.user-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-button {
  font-size: 1.1rem;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
}

.user-button:active {
  background: var(--accent);
  color: var(--accent-fg);
}

/* ---- PIN pad ---- */

.pin-dots {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 20px 0;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--muted);
}

.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
}

.pin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 320px;
  margin: 0 auto;
  width: 100%;
}

.pin-key {
  font-size: 1.4rem;
  padding: 18px 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
}

.pin-key:active {
  background: var(--accent);
  color: var(--accent-fg);
}

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

/* Real input drives PIN entry too; kept at 16px so iOS Safari doesn't
   auto-zoom the page on focus, then hidden visually. */
#pin-hidden-input {
  position: absolute;
  opacity: 0;
  height: 1px;
  width: 1px;
  font-size: 16px;
}

/* ---- Dashboard ---- */

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.dash-header h1 {
  margin: 0;
}

#logout-btn {
  font-size: 0.9rem;
  color: var(--muted);
  background: none;
  border: none;
  padding: 8px;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  margin-top: 40px;
}
