/* Family Dashboard — kiosk design system */

:root {
  --bg: #f6f1e7;
  --card: #ffffff;
  --ink: #263238;
  --muted: #7d8894;
  --accent: #1f5fe0;
  --accent-soft: #e6eefc;
  --line: #e9e2d3;
  --danger: #d64545;
  --radius: 18px;
  --shadow: 0 6px 22px rgba(38, 50, 56, 0.07);
  --nav-w: 96px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.kiosk {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  min-height: 100vh;
}

/* ---- Nav rail ---- */

.nav-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 0;
}

.nav-item {
  width: 76px;
  padding: 10px 0 8px;
  border-radius: 16px;
  text-align: center;
  text-decoration: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.nav-item .ico { display: block; font-size: 26px; margin-bottom: 2px; }

.nav-item.active {
  background: var(--card);
  color: var(--accent);
  box-shadow: var(--shadow);
}

/* ---- Top bar ---- */

.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0 20px 20px 4px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 6px;
}

.topbar-id { display: flex; align-items: baseline; gap: 14px; }

.topbar .family {
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 700;
}

.topbar .date { color: var(--muted); font-size: 17px; font-weight: 500; }

.topbar-right { display: flex; align-items: center; gap: 22px; }

.weather { display: flex; align-items: baseline; gap: 8px; }
.weather-emoji { font-size: 24px; }
.weather-now { font-size: 24px; font-weight: 800; }
.weather-range { color: var(--muted); font-size: 14px; font-weight: 600; }

.clock { display: flex; align-items: baseline; gap: 4px; }
.clock-time { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; }
.clock-ampm { font-size: 15px; font-weight: 700; color: var(--muted); }

.content { flex: 1; display: flex; flex-direction: column; }

/* ---- Cards & pages ---- */

.card, .page-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.page-card { padding: 22px; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.page-title { margin: 0; font-size: 24px; font-weight: 800; }

.muted { color: var(--muted); }

/* ---- Week grid ---- */

.week-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.week-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  min-height: 0;
}

.day-col {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: #fbf9f4;
  padding: 10px;
  min-width: 0;
}

.day-col.today { background: var(--accent-soft); }

.day-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
}

.day-name { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.day-col.today .day-name { color: var(--accent); }
.day-num { font-size: 20px; font-weight: 800; }

.day-body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-height: 0; }

.empty-hint { color: var(--line); text-align: center; margin-top: 20px; font-size: 13px; }

/* ---- Buttons & forms ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  background: #eee8db;
  color: var(--ink);
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-danger { background: transparent; color: var(--danger); }

.form { max-width: 480px; display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field label { font-size: 14px; font-weight: 700; color: var(--muted); }

.field input[type="text"],
.field input[type="number"],
.field input[type="email"],
.field input[type="password"],
.field textarea,
.field select {
  min-height: 48px;
  padding: 8px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-size: 17px;
  background: #fff;
  color: var(--ink);
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%237d8894' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  cursor: pointer;
}

.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field input[type="color"] {
  width: 72px;
  height: 48px;
  padding: 4px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.form-actions { display: flex; align-items: center; gap: 10px; }

.form-errors {
  background: #fdeaea;
  color: var(--danger);
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600;
}

/* ---- Settings ---- */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.settings-tile {
  display: block;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
}

.settings-tile .ico { font-size: 30px; display: block; margin-bottom: 8px; }
.settings-tile .name { font-size: 18px; font-weight: 800; }
.settings-tile .hint { color: var(--muted); font-size: 14px; margin-top: 4px; }

.kid-rows { display: flex; flex-direction: column; }

.kid-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}

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

.kid-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.kid-name { font-size: 18px; font-weight: 700; flex: 1; }

.kid-dot { width: 18px; height: 18px; border-radius: 50%; }

/* ---- Chores ---- */

.chores-board {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: start;
}

.kid-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kid-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  padding: 4px;
  border-radius: 12px;
}

.kid-panel-title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.kid-panel-title .kid-name { font-size: 17px; }
.kid-progress { color: var(--muted); font-size: 13px; font-weight: 600; }
.kid-progress.big { font-size: 18px; }

.ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), #eee8db 0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ring-label {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

.kid-panel-chores form, .checklist form { display: block; }

.chore-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 8px 10px;
  border: none;
  border-radius: 12px;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.chore-row:active { background: var(--accent-soft); }

.chore-row.big { min-height: 68px; font-size: 20px; }

.chore-row.done .chore-title { color: var(--muted); text-decoration: line-through; }

.checkbox {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid var(--kid-color, var(--accent));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  flex-shrink: 0;
}

.checkbox.on { background: var(--kid-color, var(--accent)); border-color: transparent; }

.checkbox.big { width: 40px; height: 40px; font-size: 22px; }

.kid-page .kid-title { display: flex; align-items: center; gap: 12px; }
.kid-avatar.big { width: 60px; height: 60px; font-size: 30px; }
.checklist { max-width: 720px; }

.small-note { font-size: 13px; }

.chore-group { margin-top: 18px; }
.chore-group-head { display: flex; align-items: center; gap: 10px; padding-bottom: 4px; border-bottom: 2px solid var(--line); }

/* ---- Bounty (up-for-grabs) chores ---- */

.bounty-panel { grid-column: 1 / -1; }

.bounty-avatar { background: #f5c84c33; }

.kid-avatar.small { width: 34px; height: 34px; font-size: 17px; }

.bounty-row.open {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
}

.bounty-row .chore-title { flex: 1; }

.bounty-amount {
  padding: 3px 10px;
  border-radius: 999px;
  background: #e6f4e6;
  color: #2e7d32;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.bounty-amount.claimed { background: transparent; color: var(--muted); }

.bounty-claim { display: flex; gap: 6px; }
.bounty-claim form { display: block; }

.bounty-claim-btn {
  border: none;
  background: transparent;
  padding: 2px;
  border-radius: 50%;
  cursor: pointer;
}

.bounty-claim-btn:active { transform: scale(0.92); }

/* ---- Meals ---- */

.week-nav { display: flex; align-items: center; gap: 4px; }
.week-label { font-weight: 700; color: var(--muted); min-width: 150px; text-align: center; }
.week-arrow { font-size: 22px; min-width: 48px; }

.meals-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.meal-day {
  border-radius: 14px;
  background: #fbf9f4;
  padding: 10px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
}

.meal-day.today { background: var(--accent-soft); }

.meal-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(38, 50, 56, 0.06);
  text-decoration: none;
  color: var(--ink);
}

.meal-chip .meal-title { font-weight: 700; font-size: 15px; }
.meal-chip .meal-notes { color: var(--muted); font-size: 12px; }

.meal-chip.small {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  font-size: 13px;
  padding: 8px;
}

.meal-chip.small .meal-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.day-body .empty-hint { flex: 1; }

.meal-add {
  display: block;
  padding: 10px;
  border-radius: 12px;
  border: 1.5px dashed var(--line);
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  min-height: 48px;
  line-height: 28px;
}

.meal-form { margin-top: 8px; }

/* ---- Shopping ---- */

.shopping-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.mic {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent-soft);
  font-size: 24px;
  cursor: pointer;
  flex-shrink: 0;
}

.mic:disabled { opacity: 0.4; cursor: default; }

.mic.listening {
  background: #fdeaea;
  animation: mic-pulse 1.2s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(214, 69, 69, 0.35); }
  50% { box-shadow: 0 0 0 12px rgba(214, 69, 69, 0); }
}

.shopping-input {
  flex: 1;
  min-height: 56px;
  padding: 8px 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  font-size: 18px;
  background: #fff;
  color: var(--ink);
}

.shop-list { list-style: none; margin: 0; padding: 0; max-width: 720px; }

.shop-list form { display: block; }

.shop-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.shop-row.done .shop-name { color: var(--muted); text-decoration: line-through; }

.shop-name { flex: 1; }

.shop-row .via { font-size: 14px; opacity: 0.6; }

/* ---- Day-of-week toggles ---- */

.days-row { display: flex; gap: 6px; flex-wrap: wrap; }

.day-toggle input { position: absolute; opacity: 0; pointer-events: none; }

.day-toggle span {
  display: inline-flex;
  min-width: 52px;
  height: 46px;
  padding: 0 10px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #eee8db;
  font-weight: 700;
  cursor: pointer;
}

.day-toggle input:checked + span { background: var(--accent); color: #fff; }

/* ---- Screensaver ---- */

.screensaver {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
}

.screensaver[hidden] { display: none; }

.screensaver-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.6s ease;
}

.screensaver-img.visible { opacity: 1; }

.screensaver.night .screensaver-img { opacity: 0; }

.screensaver-clock {
  position: absolute;
  left: 28px;
  bottom: 24px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 40px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

/* ---- Photo settings ---- */

.photo-upload { display: flex; align-items: center; gap: 10px; }
.photo-upload input[type="file"] { max-width: 320px; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.photo-tile {
  border-radius: 14px;
  overflow: hidden;
  background: #fbf9f4;
  box-shadow: var(--shadow);
}

.photo-tile img { width: 100%; height: 160px; object-fit: cover; display: block; }

.photo-tile.paused img { opacity: 0.35; filter: grayscale(1); }

.photo-actions { display: flex; justify-content: space-between; padding: 4px 8px; }

/* ---- Flash messages ---- */

.flashes { padding: 0 6px 10px; }

.flash {
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
}

.flash-notice { background: #e3f4ec; color: #1e7a52; }
.flash-alert { background: #fdeaea; color: var(--danger); }

/* ---- Calendar events ---- */

.event-chip {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 10px;
  border-left: 4px solid var(--event-color, var(--accent));
  background: color-mix(in srgb, var(--event-color, var(--accent)) 12%, #ffffff);
  font-size: 13px;
  min-width: 0;
}

.event-chip.all-day {
  background: color-mix(in srgb, var(--event-color, var(--accent)) 26%, #ffffff);
  font-weight: 700;
}

.event-time { color: var(--muted); font-weight: 700; white-space: nowrap; font-size: 12px; }

.event-chip .event-title {
  font-weight: 600;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---- Calendar settings ---- */

.setup-note {
  background: #fbf9f4;
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 14px;
}

.setup-title { margin: 0 0 8px; font-size: 18px; }

.setup-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }

.setup-note code.block {
  display: block;
  background: #26323812;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 6px;
  font-size: 13px;
}

.cal-account { margin-top: 16px; }

.cal-account-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--line);
  padding-bottom: 6px;
}

.cal-email { font-size: 17px; font-weight: 800; }

.cal-source-row { display: flex; align-items: center; gap: 8px; }

.cal-source-row form:first-child { flex: 1; }

.color-form input[type="color"] {
  width: 44px;
  height: 36px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 2px;
  background: #fff;
}

/* ---- Bank ---- */

.bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.bank-card {
  border-radius: 14px;
  background: #fbf9f4;
  padding: 16px;
}

.bank-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.bank-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

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

.bank-row.total { font-weight: 800; border-top: 2px solid var(--line); border-bottom: none; }

.bank-row-name { display: flex; align-items: baseline; gap: 8px; min-width: 0; }

.bank-account-name { font-weight: 600; }

.bank-mask { color: var(--muted); font-size: 13px; }

.bank-amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }

.bank-assign-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.bank-assign-row:last-child { border-bottom: none; }

.assign-form select {
  min-height: 44px;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 6px 36px 6px 10px;
  font-size: 15px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%237d8894' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  color: var(--ink);
  cursor: pointer;
}

/* ---- Map ---- */

.map-card {
  position: relative;
  flex: 1;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 0;
}

.map-card #map { position: absolute; inset: 0; }

.map-legend {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-legend-row { display: flex; align-items: center; gap: 10px; }

.map-legend-row .kid-avatar { width: 36px; height: 36px; font-size: 18px; }

.map-legend-text { display: flex; flex-direction: column; }

.map-legend-text .kid-name { font-size: 14px; }

.kid-marker-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  border: 3.5px solid var(--kid-color, var(--accent));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  font-size: 22px;
}

/* ---- Auth (sign in) ---- */

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

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-title { margin: 0; font-size: 26px; text-align: center; }

.auth-hint { margin: 0; text-align: center; color: var(--muted); font-weight: 600; }

.auth-card form { display: flex; flex-direction: column; gap: 16px; }

.auth-submit { width: 100%; margin-top: 4px; }

.auth-links { text-align: center; }

.auth-links a { color: var(--muted); font-size: 14px; font-weight: 600; }

/* ---- Public legal pages (/privacy) ---- */

.auth-screen:has(.legal-doc) {
  align-items: flex-start;
}

.auth-card:has(.legal-doc) {
  max-width: 720px;
}

.legal-doc {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legal-doc h2 {
  margin: 18px 0 0;
  font-size: 18px;
}

.legal-doc h3 {
  margin: 10px 0 0;
  font-size: 15px;
}

.legal-doc p,
.legal-doc li {
  margin: 0;
  line-height: 1.55;
  color: var(--ink);
}

.legal-doc ul {
  margin: 0;
  padding-left: 1.2em;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legal-doc a { color: var(--accent); }

.legal-updated {
  text-align: center;
  font-size: 14px;
  line-height: 1.45;
}
