:root {
  --bg: #0f1115;
  --card: #181b22;
  --card-2: #20242e;
  --line: #2a2f3a;
  --text: #e8eaed;
  --muted: #9aa3b2;
  --accent: #4ade80;
  --accent-2: #fbbf24;
  --danger: #f87171;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2030, var(--bg));
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* Lock screen */
.lock {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.lock-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 40px;
  max-width: 420px;
  text-align: center;
}
.lock-emoji { font-size: 48px; }
.lock-card h1 { margin: 12px 0 8px; }
.lock-card p { color: var(--muted); margin: 0; }

/* App */
main {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 18px 80px;
}
.hero { text-align: center; margin-bottom: 22px; }
.hero h1 { margin: 0 0 6px; font-size: 28px; }
.sub { color: var(--muted); margin: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 22px;
}

/* Dropdown (secção de marcação) */
.dropdown { padding: 0; overflow: hidden; }
.dropdown-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  padding: 18px 22px;
  cursor: pointer;
  text-align: left;
}
.dropdown-head:hover { color: var(--accent); }
.dropdown-head .chev {
  font-size: 18px;
  color: var(--accent);
  transition: transform .25s ease;
}
.dropdown:not(.collapsed) .dropdown-head .chev { transform: rotate(180deg); }

/* truque grid 0fr/1fr: anima a altura sem a saber */
.dropdown-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows .28s ease;
}
.dropdown.collapsed .dropdown-body { grid-template-rows: 0fr; }
.dropdown-body > .dropdown-inner { overflow: hidden; min-height: 0; }
.dropdown-inner { padding: 0 22px; }
.dropdown-inner > .actions { margin-bottom: 22px; }

.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }

/* Seleção rápida */
.bulk { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.btn-bulk {
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .12s;
}
.btn-bulk:hover { border-color: var(--accent); color: var(--accent); }
.btn-bulk.ghost { color: var(--muted); }
.btn-bulk.ghost:hover { border-color: var(--danger); color: var(--danger); }

/* Calendars */
.month { margin-bottom: 22px; }
.month-title { font-size: 17px; margin: 0 0 10px; text-transform: capitalize; }
.weekdays, .grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.weekdays { margin-bottom: 6px; }
.weekdays span { text-align: center; font-size: 11px; color: var(--muted); text-transform: uppercase; }

.day {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 74px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.day.empty { background: transparent; border: none; }
.day .num { font-size: 12px; color: var(--muted); font-weight: 600; }
.day.weekend .num { color: var(--accent-2); }

.slot {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
  padding: 4px 2px;
  transition: .12s;
}
.slot .ic { font-size: 13px; line-height: 1; }
.slot:hover { border-color: var(--accent); }
.slot.on { color: #0c0f14; font-weight: 700; border-color: transparent; }
.slot.almoco.on { background: var(--accent-2); }
.slot.jantar.on { background: var(--accent); }

/* Actions */
.actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn-primary {
  background: var(--accent);
  color: #0c0f14;
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
}
.status { font-size: 13px; color: var(--muted); }
.status.ok { color: var(--accent); }
.status.err { color: var(--danger); }

/* Results */
.results-head { display: flex; align-items: center; justify-content: space-between; }
.results-head h2 { margin: 0; font-size: 18px; }

/* Vencedor (topo da votação) */
.poll-winner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(74,222,128,.16), rgba(251,191,36,.10));
  border: 1px solid var(--accent);
}
.poll-winner .trophy { font-size: 30px; }
.pw-title { font-weight: 800; font-size: 16px; }
.pw-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Mapa de calor */
.heat { display: flex; flex-wrap: wrap; gap: 18px; }
.heat-month { flex: 1; min-width: 240px; }
.heat-title { margin: 0 0 8px; font-size: 14px; text-transform: capitalize; color: var(--muted); }
.heat-week, .heat-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.heat-week { margin-bottom: 4px; }
.heat-week span { text-align: center; font-size: 10px; color: var(--muted); }
.heat-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-2);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .1s, box-shadow .1s;
}
.heat-cell.empty { background: transparent; border: none; cursor: default; }
.heat-cell.has { color: #0c0f14; font-weight: 700; }
.heat-cell.has:hover { transform: scale(1.08); }
.heat-cell.best { box-shadow: 0 0 0 2px var(--accent-2); }
.heat-cell.sel { box-shadow: 0 0 0 2px #fff; }
.heat-cell .hc-num { font-size: 12px; }
.heat-cell .hc-n {
  position: absolute;
  top: 2px; right: 3px;
  font-size: 9px;
  font-weight: 800;
  background: rgba(0,0,0,.35);
  color: #fff;
  border-radius: 999px;
  padding: 0 4px;
  line-height: 14px;
}

/* Painel: quem pode no dia */
.heat-detail {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
}
.hd-title { font-weight: 800; font-size: 15px; margin-bottom: 10px; text-transform: capitalize; }
.hd-row { display: flex; gap: 10px; padding: 6px 0; flex-wrap: wrap; }
.hd-row + .hd-row { border-top: 1px solid var(--line); }
.hd-row.muted { color: var(--muted); }
.hd-meal { min-width: 120px; font-size: 13px; color: var(--muted); }
.hd-meal b { color: var(--text); }
.hd-names { flex: 1; }
.pill {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  margin: 2px 4px 2px 0;
}
.pill.almoco { background: rgba(251,191,36,.18); color: var(--accent-2); }
.pill.jantar { background: rgba(74,222,128,.18); color: var(--accent); }
.empty-state { color: var(--muted); padding: 14px 0; }

/* Notas / ideias */
.notes-block { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.notes-title { font-size: 15px; margin: 0 0 10px; }
.note-row {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 6px;
}
.note-name { font-weight: 700; color: var(--accent); white-space: nowrap; }
.note-text { color: var(--text); }

/* ---------- Responsivo (Android / iPhone) ---------- */
@media (max-width: 560px) {
  main { padding: 18px 12px 60px; }
  .hero h1 { font-size: 22px; }
  .card { padding: 16px; border-radius: 14px; }
  .weekdays, .grid { gap: 4px; }
  .day { min-height: 64px; padding: 4px; border-radius: 9px; }
  .slot .lb { display: none; }       /* só ícone no telemóvel */
  .slot { padding: 6px 2px; }
  .slot .ic { font-size: 16px; }
  .poll-opt { font-size: 13px; }
  .poll-winner .trophy { font-size: 26px; }
  .note-row { flex-direction: column; gap: 2px; }
}
