/* restable field — doorstep screen.
   Mobile-first, one screen, nothing decorative. Legibility in bright sunlight matters more
   than polish: high contrast, generous spacing, no animation. */

:root {
  --bg: #f4f4f2;
  --panel: #ffffff;
  --text: #14171a;
  --muted: #5b6167;
  --border: #d6d9dc;
  --accent: #0a5c36;
  --accent-text: #ffffff;
  --warn-bg: #fff3cd;
  --warn-text: #6b4c00;
  --error-bg: #fde2e1;
  --error-text: #7a1712;
  --ok-bg: #dff5e6;
  --ok-text: #0a5c36;
  --badge-open: #0a5c36;
  --badge-free: #8a6d00;
  --badge-locked: #7a1712;
  --badge-unknown: #5b6167;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101214;
    --panel: #1b1e21;
    --text: #f2f3f4;
    --muted: #a7adb3;
    --border: #33383d;
    --accent: #35c185;
    --accent-text: #08110d;
    --warn-bg: #4a3c00;
    --warn-text: #ffe066;
    --error-bg: #4a1613;
    --error-text: #ffb4ae;
    --ok-bg: #0f3a24;
    --ok-text: #7be3af;
    --badge-open: #35c185;
    --badge-free: #e0c34a;
    --badge-locked: #ff8a80;
    --badge-unknown: #a7adb3;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
               sans-serif;
  font-size: 17px;
  line-height: 1.4;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
            env(safe-area-inset-left);
  padding-bottom: calc(env(safe-area-inset-bottom) + 24px);
}

.topbar {
  padding: 16px 16px 8px;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

/* MUST come before any rule that sets `display`, and must be !important.
 *
 * The browser's own `[hidden] { display: none }` is a UA-stylesheet rule, so ANY author rule with
 * a class selector beats it. `.banner-error { display: flex }` below therefore made the `hidden`
 * attribute completely inert: the "Could not load venues." banner sat on screen permanently, next
 * to a fully loaded list of venues — observed live on 2026-08-07, after every unit test passed.
 * The save-error banner shares those classes, so it would have announced a failure after every
 * successful save, which is the same lie in the direction that costs a logged visit.
 *
 * One rule here rather than a `:not([hidden])` on each component: this way a future element that
 * uses `hidden` cannot reintroduce the bug. */
[hidden] { display: none !important; }

.banner {
  margin: 8px 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 15px;
}

.banner-warn { background: var(--warn-bg); color: var(--warn-text); }
.banner-error {
  background: var(--error-bg);
  color: var(--error-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.banner-ok { background: var(--ok-bg); color: var(--ok-text); }

.btn-retry {
  min-height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: var(--error-text);
  color: var(--error-bg);
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}

.filter-box {
  display: block;
  width: calc(100% - 32px);
  margin: 8px 16px;
  padding: 12px 14px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
}

.venue-list {
  list-style: none;
  margin: 8px 0;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.venue {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 44px;
  color: var(--text);
}

.venue.selected {
  border-color: var(--accent);
  border-width: 2px;
}

.venue-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.venue-name {
  font-size: 17px;
  font-weight: 600;
}

.venue-meta {
  margin-top: 2px;
  font-size: 14px;
  color: var(--muted);
}

.venue-history {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
}

.badge {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--accent-text);
  background: var(--badge-unknown);
  text-transform: uppercase;
}

.badge-open { background: var(--badge-open); }
.badge-free_tier { background: var(--badge-free); color: #14171a; }
.badge-locked { background: var(--badge-locked); }
.badge-unknown { background: var(--badge-unknown); }

.detail-view {
  min-height: 100vh;
}

.detail-topbar {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 16px;
  background: var(--bg);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.detail-info {
  margin: 0 16px 16px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.detail-info-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.visit-form {
  margin: 0 16px 16px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.form-venue-name {
  margin: 0;
  font-size: 19px;
}

.field-group {
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

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

.chip {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.chip.chip-selected {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.text-input, .note-input {
  display: block;
  width: 100%;
  padding: 12px 14px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}

.note-input {
  resize: vertical;
}

.toggle {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.toggle-btn {
  flex: 1;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.toggle-btn-selected {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.save-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn-secondary, .btn-save {
  flex: 1;
  min-height: 48px;
  border-radius: 10px;
  border: none;
  font-size: 17px;
  font-weight: 700;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-save {
  background: var(--accent);
  color: var(--accent-text);
}

/* Save is disabled until an outcome chip is picked (see app.js selectVenue/selectOutcome). A
   disabled button that looks identical to an enabled one is invisible feedback on a screen used
   one-handed in bright sunlight — this is the one visual cue that Save cannot be tapped yet. */
.btn-save:disabled {
  opacity: 0.45;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

.login-card h1 {
  font-size: 20px;
  margin: 0 0 16px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
