/* PathQ — hosted PWA styles. Mobile-first, big tap targets, one-thumb use. */
:root {
  --green: #1b4332;
  --green-2: #2d6a4f;
  --gold: #f0b43c;
  --paper: #f7f5f0;
  --ink: #1d2129;
  --muted: #6b7280;
  --line: #e3ded2;
  --danger: #b3261e;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  padding-bottom: 128px; /* room for the bottom bar */
  -webkit-tap-highlight-color: transparent;
}
h1 { font-size: 1.55rem; margin: 0.4rem 0 0.2rem; }
h2 { font-size: 1.05rem; margin: 1rem 0 0.3rem; }
.sub { color: var(--muted); margin: 0.15rem 0 0.8rem; }
.center { text-align: center; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  background: var(--green); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.brand { font-weight: 800; font-size: 1.25rem; letter-spacing: 0.02em; }
.sync-state { font-size: 0.8rem; color: #9be29b; }
.sync-state.offline { color: var(--gold); }

main { padding: 12px 16px 0; max-width: 640px; margin: 0 auto; }
.screen { display: none; }
.screen.active { display: block; }

button { font: inherit; cursor: pointer; }
.primary {
  background: var(--green); color: #fff; border: 0; border-radius: var(--radius);
  padding: 14px 18px; font-weight: 700; width: 100%;
}
.primary:active { background: var(--green-2); }
.ghost {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; color: var(--ink);
}
.ghost.danger { color: var(--danger); border-color: #ecc9c6; }
.big { font-size: 1.1rem; min-height: 54px; margin-top: 12px; width: 100%; }

.card-list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-align: left; width: 100%;
}
.card .name { font-weight: 700; font-size: 1.08rem; }
.card .meta { color: var(--muted); font-size: 0.92rem; margin-top: 2px; }
.card .reason { margin-top: 8px; font-size: 0.98rem; }
.card .warn { color: var(--danger); font-weight: 600; margin-top: 6px; font-size: 0.9rem; }
.card .hold { color: #8a6d00; font-weight: 600; margin-top: 6px; font-size: 0.9rem; }
.empty { color: var(--muted); padding: 18px 4px; }

.streak-banner {
  background: #fff7e0; border: 1px solid #f2dd9a; border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 10px; font-weight: 600;
}
.queue-counts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.queue-counts .pill {
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 0.9rem;
}

input[type="search"], input[type="text"], input[type="tel"], input[type="email"], textarea, select {
  width: 100%; padding: 13px; font-size: 1rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  margin-bottom: 10px;
}
.queue-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 6px; }
.qtab {
  white-space: nowrap; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: 8px 14px; font-size: 0.95rem;
}
.qtab.active { background: var(--green); color: #fff; border-color: var(--green); }

/* Contact detail + outcome logging */
.actions-row { display: flex; gap: 8px; margin: 12px 0; }
.actions-row a, .actions-row button {
  flex: 1; text-align: center; text-decoration: none; font-weight: 700;
  border-radius: var(--radius); padding: 14px 6px; min-height: 52px;
}
.btn-call { background: var(--green); color: #fff; }
.btn-text { background: #e8f0fe; color: #174ea6; }
.btn-mail { background: #fdf3e0; color: #7a5200; }
.btn-disabled { background: #eee; color: var(--muted); pointer-events: none; }
.guide {
  background: #f2efe7; border-radius: var(--radius); padding: 12px 14px;
  font-size: 0.98rem; margin: 10px 0; white-space: pre-wrap;
}
.notes { white-space: pre-wrap; font-size: 0.95rem; color: #333; }
.outcomes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.outcomes button {
  padding: 13px 8px; border-radius: var(--radius); border: 1px solid var(--line);
  background: #fff; font-weight: 600; min-height: 50px;
}
.outcomes button:active { background: var(--green); color: #fff; }

/* Overlays (contact card, upload sheet) */
.overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(20, 24, 20, 0.5);
  display: flex; align-items: flex-end; justify-content: center;
}
.overlay[hidden] { display: none; }
.sheet {
  background: var(--paper); width: 100%; max-width: 640px; max-height: 92vh;
  overflow-y: auto; border-radius: 20px 20px 0 0; padding: 18px 18px 30px;
  position: relative;
}
.sheet-close {
  position: absolute; top: 10px; right: 12px; border: 0; background: transparent;
  font-size: 1.8rem; line-height: 1; color: var(--muted); padding: 8px;
}
.route {
  display: block; width: 100%; text-align: left; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 10px;
}
.route strong { display: block; font-size: 1.08rem; margin-bottom: 3px; }
.route span { color: var(--muted); font-size: 0.95rem; }

/* Bottom bar: Upload contacts button (always visible) + tabs */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: #fff; border-top: 1px solid var(--line);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  max-width: 640px; margin: 0 auto;
}
.upload-btn {
  width: 100%; border: 0; border-radius: var(--radius); min-height: 52px;
  background: var(--gold); color: #231a00; font-weight: 800; font-size: 1.08rem;
  margin-bottom: 8px;
}
.tabbar { display: flex; }
.tab {
  flex: 1; border: 0; background: transparent; padding: 9px 2px;
  font-size: 0.92rem; color: var(--muted); font-weight: 600;
}
.tab.active { color: var(--green); }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 14px 14px; margin-bottom: 12px; }
.keyrow { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.apikey { flex: 1; overflow: hidden; text-overflow: ellipsis; background: #f2efe7; padding: 10px; border-radius: 8px; font-size: 0.9rem; }

.toast {
  position: fixed; left: 12px; right: 12px; bottom: 140px; z-index: 50;
  background: var(--ink); color: #fff; border-radius: var(--radius);
  padding: 12px 16px; display: flex; justify-content: space-between; align-items: center;
  max-width: 616px; margin: 0 auto;
}
.toast[hidden] { display: none; }
.toast button { background: var(--gold); border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 700; }
