/* PeopleDo — Base Styles */
/* Design philosophy: big, readable, tappable. Wall tablet + phones. */
/* Color palette inspired by The Fifth Element — Korben, Leeloo, the Diva */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0c0e1a;
  --bg-card: #141829;
  --bg-surface: #1a2040;
  --text: #e8e6e3;
  --text-muted: #7a8599;
  --accent: #e8531e;
  --accent-green: #4ecca3;
  --accent-blue: #5eb8ff;
  --accent-gold: #f0a830;
  --accent-coral: #e8531e;
  --accent-diva: #7c6bff;
  --radius: 12px;
  --min-touch: 60px;
}

html {
  overflow-x: hidden;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100%;
}

/* --- Header & Identity Bar --- */
header {
  margin-bottom: 1.5rem;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--accent-coral), var(--accent-gold), var(--accent-diva), var(--accent-blue)) 1;
  padding-bottom: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
}

#header-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 0.75rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: end;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  justify-self: center;
  text-decoration: none;
}

.header-brand img {
  width: 32px;
  height: 32px;
}

#header-row h1 {
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-coral), var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

#household-name-display {
  justify-self: start;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.gear-btn {
  width: 48px;
  height: 48px;
  border: none;
  background: none;
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  color: var(--text-muted);
}

.gear-btn:hover {
  background: var(--bg-surface);
  color: var(--text);
}

#header-logout {
  color: var(--accent-coral);
  font-size: 1.3rem;
  opacity: 0.85;
}

#header-logout:hover {
  background: rgba(232, 83, 30, 0.15);
  opacity: 1;
}

#identity-bar {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-height: 80px;
}

/* --- Avatar Buttons (identity bar) --- */
.avatar-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  transition: border-color 0.15s, transform 0.1s;
  color: white;
  position: relative;
}

.avatar-btn:hover {
  transform: scale(1.08);
}

.avatar-btn.selected {
  border-color: var(--accent-green);
  box-shadow: 0 0 12px rgba(78, 204, 163, 0.5);
}

.avatar-btn .avatar-name {
  font-size: 0.55rem;
  font-weight: 600;
  margin-top: 1px;
  text-align: center;
  color: white;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

/* --- Avatar / Color Grid (pickers) --- */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
}

.avatar-grid .avatar-option {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: var(--bg-surface);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, transform 0.1s;
}

.avatar-grid .avatar-option:hover {
  transform: scale(1.1);
}

.avatar-grid .avatar-option.selected {
  border-color: var(--accent-green);
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px;
}

.color-grid .color-option {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.color-grid .color-option:hover {
  transform: scale(1.1);
}

.color-grid .color-option.selected {
  border-color: white;
  box-shadow: 0 0 8px rgba(255,255,255,0.4);
}

/* --- Screens --- */
.screen {
  display: none;
}
.screen.active {
  display: block;
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.screen-header h2 {
  font-size: 1.4rem;
}

.empty-state {
  text-align: center;
  font-size: 1.3rem;
  margin-top: 3rem;
  color: var(--text-muted);
}

/* --- Buttons --- */
.btn {
  min-height: var(--min-touch);
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: #d63451;
}

.btn-success {
  background: var(--accent-green);
  color: #111;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text);
}

.btn-danger {
  background: #c0392b;
  color: white;
}

.btn-sm {
  min-height: 40px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.back-btn {
  min-height: 44px;
  padding: 0.5rem 1rem;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 0.75rem;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  min-height: var(--min-touch);
  padding: 0.75rem;
  border: 2px solid var(--bg-surface);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 1.1rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-blue);
}

.form-group small {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.8rem;
}

.form-group select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='%23eee' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* --- Overlays (modals) --- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.overlay-card > h3 {
  flex-shrink: 0;
}

.overlay-card > .overlay-actions {
  flex-shrink: 0;
}

/* Everything between the title and action buttons scrolls */
.overlay-card .form-group,
.overlay-card .form-row,
.overlay-card .error-text,
.overlay-card .pin-parents,
.overlay-card #member-calendar-group,
.overlay-card #chore-schedule-group,
.overlay-card #chore-season-group,
.overlay-card #cl-items-editor,
.overlay-card #stats-content {
  flex-shrink: 0;
}

.overlay-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 0.25rem;
}

/* Subtle scrollbar */
.overlay-scroll::-webkit-scrollbar { width: 6px; }
.overlay-scroll::-webkit-scrollbar-track { background: transparent; }
.overlay-scroll::-webkit-scrollbar-thumb { background: var(--bg-surface); border-radius: 3px; }

.overlay-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.overlay-actions .btn {
  flex: 1;
}

/* --- PIN Dialog --- */
.pin-parents {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.pin-parent-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  transition: border-color 0.15s;
  color: white;
}

.pin-parent-btn.selected {
  border-color: var(--accent);
}

.pin-parent-btn .pin-parent-name {
  font-size: 0.55rem;
  font-weight: 600;
  line-height: 1;
}

/* --- Error text --- */
.error-text {
  color: var(--accent);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.error-text.hidden {
  display: none;
}

/* --- Member list cards (admin) --- */
.member-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.member-card.inactive {
  opacity: 0.5;
}

.member-card-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.member-card-info {
  flex: 1;
  min-width: 0;
}

.member-card-info .member-card-name {
  font-weight: 600;
  font-size: 1.1rem;
}

.member-card-info .member-card-role {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.member-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* --- Setup Card --- */
.setup-card {
  max-width: 500px;
  margin: 2rem auto;
}

.setup-card h2 {
  margin-bottom: 0.5rem;
}

/* --- Admin Hub --- */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.admin-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  background: var(--bg-card);
  border: 2px solid var(--bg-surface);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.15s, transform 0.1s;
}

.admin-tile:hover {
  border-color: var(--accent-blue);
  transform: scale(1.02);
}

.admin-tile:active {
  transform: scale(0.98);
}

.admin-tile-icon {
  font-size: 2rem;
}

/* --- Chore Dashboard --- */
.chore-category {
  margin-bottom: 1.5rem;
}

.category-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
}

.chore-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.12s, transform 0.1s;
  border-left: 4px solid transparent;
  min-height: var(--min-touch);
}

.chore-row:hover {
  background: var(--bg-surface);
}

.chore-row:active {
  transform: scale(0.99);
}

.chore-row.chore-done {
  border-left-color: var(--accent-green);
  opacity: 0.7;
}

.chore-row.chore-partial {
  border-left-color: var(--accent-blue);
}

.chore-row.chore-optional {
  border-left-color: transparent;
  opacity: 0.8;
}

.chore-row.i-did-this.chore-done {
  opacity: 0.6;
}

.chore-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.chore-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chore-title {
  font-size: 1.05rem;
  font-weight: 500;
}

.chore-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  color: white;
}

.badge-multi { background: var(--accent-blue); }
.badge-optional { background: #7f8c8d; }
.badge-once { background: #8e44ad; }
.badge-sched { background: #d35400; }

.chore-completions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.completion-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-green);
  margin-right: 2px;
}

.completion-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  position: relative;
}

.completion-avatar.can-undo {
  cursor: pointer;
}

.undo-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 0.7rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.completion-avatar.can-undo:hover .undo-btn {
  display: flex;
}

.chore-action {
  font-size: 1.2rem;
  color: var(--accent-green);
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

/* Inline member picker (when no identity set) */
.inline-member-picker {
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 6px;
  text-align: center;
}

.picker-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.picker-avatars {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.picker-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: white;
  transition: border-color 0.15s, transform 0.1s;
}

.picker-avatar:hover {
  transform: scale(1.1);
  border-color: var(--accent-green);
}

.picker-name {
  font-size: 0.55rem;
  font-weight: 600;
  line-height: 1;
}

/* --- Tasks Section --- */
.task-due {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-surface);
  color: var(--text-muted);
}

.task-due.overdue {
  background: var(--accent);
  color: white;
}

.task-assigned {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.task-row.completed {
  opacity: 0.5;
  text-decoration: line-through;
}

/* --- Checklists (dashboard) --- */
.checklist-card {
  margin-bottom: 0.75rem;
}

.checklist-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.checklist-card-name {
  font-weight: 600;
  font-size: 1.05rem;
  flex: 1;
}

.checklist-progress {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.progress-bar {
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-fill {
  height: 100%;
  background: var(--accent-green);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.checklist-items-compact {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.checklist-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  cursor: pointer;
  font-size: 0.95rem;
  min-height: 44px;
}

.checklist-item-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--accent-green);
  flex-shrink: 0;
}

.cl-checked {
  text-decoration: line-through;
  opacity: 0.5;
}

.checklist-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* --- Checklist editor items --- */
.cl-item-edit-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 6px;
}

.cl-item-title-input {
  flex: 1;
  min-height: 40px;
  padding: 0.5rem;
  border: 2px solid var(--bg-surface);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}

.cl-item-title-input:focus {
  border-color: var(--accent-blue);
}

.cl-item-reminder-input {
  width: 70px;
  min-height: 40px;
  padding: 0.5rem;
  border: 2px solid var(--bg-surface);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
  text-align: center;
  outline: none;
}

.cl-item-reminder-input:focus {
  border-color: var(--accent-blue);
}

.cl-item-add-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 6px;
}

/* --- Leaderboard --- */
.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.lb-row:hover {
  background: var(--bg-surface);
}

.lb-rank {
  font-size: 1.3rem;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.lb-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.lb-name {
  flex: 1;
  font-weight: 600;
  font-size: 1.05rem;
}

.lb-points {
  font-weight: 700;
  color: var(--accent-green);
  font-size: 1rem;
}

/* --- Stats Overlay --- */
.stats-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stats-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.stat-box {
  text-align: center;
  padding: 0.5rem;
  background: var(--bg-surface);
  border-radius: 8px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent-green);
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Streaks --- */
.streaks-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.streak-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  font-size: 0.9rem;
}

.streak-emoji {
  font-size: 1.1rem;
}

.streak-title {
  flex: 1;
}

.streak-current {
  font-weight: 700;
  color: var(--accent);
}

.streak-best {
  font-size: 0.75rem;
}

/* --- Hall of Shame --- */
.shame-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shame-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
}

.shame-info {
  flex: 1;
  min-width: 0;
}

.shame-name {
  font-weight: 600;
  font-size: 0.95rem;
  display: block;
  margin-bottom: 4px;
}

.shame-rate {
  font-weight: 700;
  font-size: 1.1rem;
  width: 50px;
  text-align: right;
}

/* --- Reports tabs --- */
.reports-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.reports-tab.active {
  background: var(--accent-blue);
  color: white;
}

/* --- Notification preferences --- */
.notif-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--bg-surface);
  cursor: pointer;
  font-size: 0.95rem;
}

.notif-pref-row:last-child {
  border-bottom: none;
}

.notif-pref-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--accent-green);
}

/* --- PWA Install Banner --- */
#install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

#install-banner div {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* --- Dashboard actions bar --- */
.dashboard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0 0.25rem;
}

/* --- Chore Editor Extras --- */
.form-row {
  display: flex;
  gap: 0.75rem;
}

.day-checkboxes {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.day-cb {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.day-cb input {
  width: 28px;
  height: 28px;
  margin-bottom: 2px;
  accent-color: var(--accent-blue);
}

.day-cb span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Assignment toggles */
.assign-toggles {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.assign-toggle {
  padding: 0.5rem 0.75rem;
  border-radius: 20px;
  border: 2px solid var(--bg-surface);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.assign-toggle.selected {
  border-color: var(--accent-green);
  background: var(--bg-surface);
}

/* --- Utilities --- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* --- Multipass easter egg --- */
@keyframes multipass-flash {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); background: linear-gradient(135deg, var(--accent-diva), var(--accent-coral), var(--accent-gold)); -webkit-background-clip: text; background-clip: text; }
  100% { opacity: 1; transform: scale(1); }
}

/* --- Schedule mode tabs --- */
.schedule-mode-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0.6rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.15);
}
.schedule-mode-btn {
  flex: 1;
  padding: 0.5rem 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.schedule-mode-btn + .schedule-mode-btn {
  border-left: 1px solid rgba(255,255,255,0.1);
}
.schedule-mode-btn.selected {
  background: var(--accent-gold);
  color: var(--bg);
}
.schedule-pane {
  padding: 0.3rem 0;
}

/* Monthly day grid */
.monthly-day-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.monthly-day-btn {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.monthly-day-btn:hover {
  background: rgba(255,255,255,0.08);
}
.monthly-day-btn.selected {
  background: var(--accent-gold);
  color: var(--bg);
  border-color: var(--accent-gold);
  font-weight: 700;
}
.monthly-day-btn.last-day {
  grid-column: span 3;
  aspect-ratio: auto;
  padding: 0.4rem;
  font-size: 0.75rem;
}

/* --- Emoji picker --- */
.emoji-picker-btn {
  width: 100%;
  height: 60px;
  font-size: 2rem;
  background: var(--card-bg);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.emoji-picker-btn:hover { border-color: var(--accent-blue); }
.emoji-picker-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  width: 300px;
  max-height: 350px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.8);
  overflow-y: auto;
  padding: 0.5rem;
}
.form-group { position: relative; }
.emoji-search {
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: var(--text);
  margin-bottom: 0.4rem;
  min-height: auto;
  height: auto;
}
.emoji-cat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.4rem 0 0.2rem;
  font-weight: 600;
}
.emoji-cat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.emoji-option {
  width: 36px;
  height: 36px;
  font-size: 1.3rem;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}
.emoji-option:hover { background: rgba(255,255,255,0.1); }

/* --- Assign toggle away style --- */
.assign-toggle.away {
  opacity: 0.5;
}
.assign-toggle.away.selected {
  opacity: 0.8;
}

/* --- Form label alignment fix --- */
.form-group label {
  text-align: left;
  display: block;
}

/* --- Away member badge --- */
.avatar-btn.away {
  opacity: 0.45;
  filter: grayscale(40%);
  position: relative;
}
.avatar-btn.away.selected {
  opacity: 0.75;
  filter: grayscale(20%);
}
.away-badge {
  display: block;
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ffa500;
  margin-top: -2px;
  font-weight: 700;
}

/* --- Away view --- */
.away-view {
  padding: 0.5rem 0;
}
.away-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.away-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}
.away-name {
  margin: 0;
  font-size: 1.4rem;
}
.away-status {
  color: #ffa500;
  font-size: 0.85rem;
  font-weight: 600;
}
.away-view .checklist-card {
  margin-bottom: 1rem;
}
.away-view .checklist-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  font-size: 1.1rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.away-view .checklist-item.checked span {
  text-decoration: line-through;
  opacity: 0.5;
}
.away-view .checklist-item input[type="checkbox"] {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  accent-color: var(--accent-green);
}
.away-view .checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.away-view .checklist-progress {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.away-view .progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.away-view .progress-fill {
  height: 100%;
  background: var(--accent-green);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* --- Weekly grid --- */
.weekly-grid-wrapper {
  display: block;
}

.grid-panel {
  margin-bottom: 1rem;
}
.grid-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px 10px 0 0;
  padding: 0.6rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.grid-toggle:hover {
  background: rgba(255,255,255,0.08);
}
.grid-panel.collapsed .grid-toggle {
  border-radius: 10px;
}
.grid-toggle-chevron {
  font-size: 0.8rem;
  opacity: 0.6;
}
.grid-content {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-top: none;
  border-radius: 0 0 10px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.grid-panel.collapsed .grid-content {
  display: none;
}
.weekly-grid table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.weekly-grid th, .weekly-grid td {
  padding: 0.4rem 0.3rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.weekly-grid th {
  text-align: center;
}
.weekly-grid td {
  text-align: center;
}
.grid-chore-header {
  width: 180px;
  min-width: 120px;
}
.weekly-grid .grid-day-header {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  padding-bottom: 0.5rem;
  white-space: nowrap;
  text-align: center;
  padding-left: 0.3rem;
}
.grid-date-num {
  font-size: 0.85rem;
  color: var(--text);
}
.grid-day-header.grid-today {
  color: var(--accent-gold);
}
.grid-day-header.grid-today .grid-date-num {
  color: var(--accent-gold);
  font-weight: 700;
}
.weekly-grid .grid-chore-label {
  text-align: left;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 0.5rem;
  max-width: 180px;
}
.grid-cell {
  vertical-align: middle;
  min-width: 60px;
}
.grid-cell.grid-today {
  background: rgba(240, 168, 48, 0.06);
}
.grid-avatars {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
}
.grid-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  border: 1.5px solid var(--bg);
  flex-shrink: 0;
  margin-left: -4px;
}
.grid-avatar:first-child {
  margin-left: 0;
}
.grid-avatar.stacked {
  position: relative;
}
/* Grid edit popup (backfill past days) */
.grid-edit-popup {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 0.6rem;
  z-index: 100;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  cursor: default;
}
.grid-edit-header {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 0.4rem;
  font-weight: 600;
}
.grid-edit-completions {
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 0.4rem;
}
.grid-edit-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0;
  font-size: 0.8rem;
}
.grid-edit-row .btn-danger {
  margin-left: auto;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  min-width: unset;
}
.grid-edit-add {
  display: flex;
  gap: 0.3rem;
  justify-content: center;
  flex-wrap: wrap;
}
.grid-edit-add-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, transform 0.1s;
}
.grid-edit-add-btn:hover {
  border-color: var(--accent-green);
  transform: scale(1.15);
}

.grid-count {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-left: 2px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .grid-chore-header {
    width: 120px;
    min-width: 90px;
  }
  .weekly-grid .grid-chore-label {
    max-width: 120px;
    font-size: 0.75rem;
  }
  .grid-cell {
    min-width: 44px;
  }
  .grid-avatar {
    width: 22px;
    height: 22px;
    font-size: 0.65rem;
  }
  .weekly-grid .grid-day-header {
    font-size: 0.65rem;
  }
  .grid-date-num {
    font-size: 0.75rem;
  }
}
@media (max-width: 480px) {
  html { font-size: 16px; }
  #app { padding: 0.75rem; }
  .avatar-btn { width: 60px; height: 60px; font-size: 1.7rem; }
  .overlay-card { max-height: 85vh; }
  .overlay { padding: 0.5rem; }
}

@media (min-width: 1024px) {
  #app { max-width: 960px; }
}

/* =============================================
   PeopleDo v2 — Additional Styles
   Auth pages, admin panel, kiosk, households
   ============================================= */

/* --- Auth Pages (login, join, reset) --- */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.auth-container {
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo .logo-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.auth-logo h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-coral), var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-card {
  margin-bottom: 1rem;
}

.auth-card h2 {
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.auth-links {
  text-align: center;
  padding: 0.75rem;
  font-size: 0.9rem;
}

.auth-links a {
  color: var(--accent-blue);
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

.success-text {
  color: var(--accent-green);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* --- Operator Admin Panel --- */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--accent-coral), var(--accent-gold), var(--accent-diva), var(--accent-blue)) 1;
  margin-bottom: 1.5rem;
}

.admin-header h1 {
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--accent-coral), var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.admin-badge {
  background: var(--accent-gold);
  -webkit-background-clip: initial;
  -webkit-text-fill-color: var(--bg);
  background-clip: initial;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.admin-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.admin-section {
  margin-bottom: 2rem;
}

.admin-section h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--bg-surface);
}

.admin-section h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.admin-row select {
  min-height: 36px;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--bg-surface);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
}

.invite-form {
  padding: 1rem;
}

.invite-form .form-row {
  display: flex;
  gap: 0.5rem;
}

.form-input {
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--bg-surface);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-blue);
}

/* Badge variants for admin */
.badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
}

.badge-pending { background: var(--accent-gold); color: var(--bg); }
.badge-accepted { background: var(--accent-green); color: var(--bg); }
.badge-expired { background: var(--bg-surface); color: var(--text-muted); }
.badge-approved { background: var(--accent-green); color: var(--bg); }
.badge-rejected { background: var(--accent); color: white; }

/* --- Kiosk Mode --- */
/* =============================================
   Kiosk Mode
   The viewport meta tag in kiosk.html is set to width=960
   so the browser scales everything up ~2x on a 1920px screen.
   We don't need font-size overrides — the base styles just work bigger.
   ============================================= */
.kiosk-mode {
  padding: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.kiosk-mode #app {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  max-width: 100% !important;
  padding: 0.5rem 1rem;
}

.kiosk-identity-bar {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
  flex-shrink: 0;
  background: var(--bg);
}

.kiosk-identity-bar .avatar-btn {
  width: 70px;
  height: 70px;
  font-size: 2rem;
}

/* Kiosk columns */
#kiosk-columns {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  gap: 1rem;
}

.kiosk-col {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: 0 0.25rem;
}

#kiosk-left {
  flex: 3;
  min-width: 0;
}

#kiosk-right {
  flex: 2;
  min-width: 0;
}

/* Grid always expanded in kiosk — no toggle needed */
.kiosk-mode .grid-toggle { display: none; }
.kiosk-mode .grid-panel.collapsed .grid-content { display: block; }
.kiosk-mode .grid-content {
  border-radius: 10px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* Narrow kiosk fallback (phone-sized, unlikely for wall tablet) */
@media (max-width: 600px) {
  #kiosk-columns { flex-direction: column; overflow-y: auto; }
  #kiosk-left { order: 2; }
  #kiosk-right { order: 1; }
}

/* --- Household Switcher --- */
#household-switcher select {
  min-height: 36px;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--bg-surface);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}

/* --- Household Settings --- */
#household-settings-content .card {
  margin-bottom: 0.75rem;
}

/* --- Sticky add buttons on admin list screens --- */
.sticky-add-btn {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  max-width: 600px;
  margin: 0 auto;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
}

/* --- Chore reorder buttons --- */
.reorder-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: 0.4rem;
}
.btn-reorder {
  width: 28px;
  height: 22px;
  border: 1px solid var(--bg-surface);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.65rem;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.btn-reorder:hover:not(:disabled) {
  background: var(--bg-surface);
  color: var(--text);
}
.btn-reorder:disabled {
  opacity: 0.25;
  cursor: default;
}

/* --- Unlocked gear glow --- */
.gear-btn.unlocked {
  color: var(--accent-green);
  text-shadow: 0 0 8px rgba(78, 204, 163, 0.6);
}
