/* Crew Rewards — mobile-first */
:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --ink: #1f1b16;
  --muted: #7a736a;
  --accent: #c0392b;
  --accent-dark: #96281b;
  --gold: #d4a017;
  --line: #e3ddd2;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
}
.hidden { display: none !important; }
.screen { padding: 16px; padding-bottom: 32px; }
h1 { font-size: 2rem; margin: 0.5em 0 0.2em; }
h2 { font-size: 1.3rem; margin: 0.6em 0; }
h3 { font-size: 1.05rem; margin: 0.4em 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: var(--accent); font-size: 0.9rem; min-height: 1.2em; }
.rgm-only {
  background: #fff3cd; border: 1px solid var(--gold);
  border-radius: 8px; padding: 8px 12px; font-weight: 600; font-size: 0.9rem;
}

.hero { text-align: center; padding: 48px 8px; }
.tagline { color: var(--muted); margin-bottom: 32px; font-size: 1.1rem; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin: 12px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
label { display: block; margin: 10px 0; font-size: 0.95rem; font-weight: 600; }
input, select {
  display: block; width: 100%; margin-top: 4px;
  font-size: 1rem; padding: 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink);
}
.btn {
  border: none; border-radius: 10px; padding: 12px 18px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent-dark); }
.btn.secondary { background: #e9e2d6; color: var(--ink); }
.btn.big { display: block; width: 100%; margin: 10px 0; }
.btn.small { padding: 10px 12px; font-size: 0.9rem; }
.btn.link { background: none; color: var(--muted); display: block; margin: 8px auto; }
.btn:disabled { opacity: 0.5; }

.appbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--ink); color: #fff;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
}
.store-name { font-weight: 800; font-size: 1.05rem; }
.me-line { font-size: 0.8rem; opacity: 0.85; }
.code-chip {
  background: var(--gold); color: var(--ink); font-weight: 800;
  border-radius: 8px; padding: 8px 10px; font-size: 0.95rem; letter-spacing: 1px;
}

.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 640px;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; border: none; background: none; padding: 14px 4px;
  font-size: 0.78rem; font-weight: 700; color: var(--muted); cursor: pointer;
}
.tabbar button.active { color: var(--accent); }
.tab { padding: 16px 16px 90px; }

.feed { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.msg {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
}
.msg .who { font-weight: 700; font-size: 0.85rem; }
.msg .when { color: var(--muted); font-size: 0.75rem; margin-left: 6px; }
.msg.mine { border-left: 4px solid var(--accent); }

.cov-card {
  background: #fff8e1; border: 2px solid var(--gold); border-radius: var(--radius);
  padding: 12px; margin: 4px 0;
}
.cov-card .cov-title { font-weight: 800; }
.cov-card .cov-reward { color: var(--accent-dark); font-weight: 800; }
.cov-card .cov-status { font-size: 0.85rem; color: var(--muted); }

.composer {
  position: sticky; bottom: 64px; background: var(--bg);
  padding: 8px 0; border-top: 1px solid var(--line);
}
.row { display: flex; gap: 8px; align-items: center; }
.row input, .row select { flex: 1; }
#cov-fields { margin-bottom: 8px; }
#cov-fields .row { margin-bottom: 8px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.list-item .sub { color: var(--muted); font-size: 0.85rem; }
.pts { font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.pts.pos { color: #1e7e34; }
.pts.neg { color: var(--accent); }
.rank { font-weight: 800; width: 2em; color: var(--muted); }

.pills { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
.pills button {
  border: 1px solid var(--line); background: var(--card); border-radius: 20px;
  padding: 8px 12px; font-weight: 700; font-size: 0.85rem; white-space: nowrap; cursor: pointer;
}
.pills button.active { background: var(--ink); color: #fff; }
.task-check {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--muted); background: #fff; cursor: pointer; flex-shrink: 0;
  font-size: 1rem; line-height: 1;
}
.task-check.done { background: #1e7e34; border-color: #1e7e34; color: #fff; }
.task-title.done { text-decoration: line-through; color: var(--muted); }
.icon-btn { border: none; background: none; font-size: 1.1rem; cursor: pointer; padding: 6px; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 20;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-box { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 380px; }

.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 24px;
  font-weight: 600; z-index: 30; max-width: 90%; text-align: center;
}

/* Award points: Give/Take toggle */
.award-row { display: flex; gap: 8px; align-items: stretch; margin: 4px 0 12px; }
.award-row #award-delta { flex: 1; margin: 0; }
.seg-toggle { display: flex; border: 1px solid #ccc; border-radius: 8px; overflow: hidden; }
.seg-toggle button { border: 0; background: #f4f4f4; padding: 10px 14px; font-size: 15px; cursor: pointer; }
.seg-toggle button.active[data-dir="1"] { background: #2e7d32; color: #fff; }
.seg-toggle button.active[data-dir="-1"] { background: #c62828; color: #fff; }

/* Chat photos */
.chat-img { max-width: 100%; max-height: 280px; border-radius: 8px; margin: 4px 0; cursor: pointer; display: block; }
#btn-photo { font-size: 18px; }

/* ---------- v2 batch ---------- */
/* Employee of the Week */
.eotw-banner {
  background: linear-gradient(90deg, #fff8e1, #ffe082);
  border-bottom: 2px solid var(--gold);
  padding: 10px 16px; font-weight: 700; font-size: 0.95rem; text-align: center;
}
.challenge-banner {
  background: #fff8e1; border: 2px solid var(--gold);
  border-radius: var(--radius); padding: 12px; margin-bottom: 12px; font-weight: 700;
}
.challenge-banner .sub { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.list-item.eotw {
  border: 2px solid var(--gold); background: #fffdf5;
  box-shadow: 0 0 0 1px var(--gold) inset;
}
.eotw-star { color: var(--gold); font-size: 1.3rem; }
.eotw-title { color: #8a6d00; font-size: 0.8rem; font-weight: 800; text-transform: uppercase; }
.streak { color: #e65100; font-weight: 800; font-size: 0.9rem; white-space: nowrap; }

/* Shout-out messages in chat */
.msg.shoutout { border-left: 4px solid var(--gold); background: #fffdf5; }

/* Attendance */
.att-dot {
  display: inline-block; min-width: 92px; text-align: center;
  border-radius: 20px; padding: 5px 10px; font-size: 0.8rem; font-weight: 800;
}
.att-checkedin { background: #d4edda; color: #155724; }
.att-pending { background: #ffffff; color: var(--muted); border: 1px solid var(--line); }
.att-noshow { background: #f8d7da; color: #721c24; }
.att-calledout { background: #f8d7da; color: #721c24; }

/* Hall of Fame */
.hof-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.hof-row:last-child { border-bottom: none; }

/* RGM notes (RGM view only — never rendered for crew) */
.notes-box { margin-top: 8px; background: #fdf8ec; border: 1px solid var(--gold); border-radius: 8px; padding: 10px; }
.notes-box .note { font-size: 0.9rem; padding: 6px 0; border-bottom: 1px solid var(--line); }
.notes-box .note:last-child { border-bottom: none; }
.notes-box textarea { width: 100%; font-size: 0.95rem; padding: 10px; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; }
