/* Layout: wall calendar ("folhinha") — a monthly photo cover above the grid, family panel beside it; stacks on phones */
:root {
  --bg: #F2F5F7;
  --surface: #FFFFFF;
  --sunken: #E8EDF1;
  --ink: #132130;
  --muted: #5A6979;
  --line: #D7DEE5;
  --accent: #0A7559;
  --accent-ink: #FFFFFF;
  --accent-soft: #D6EEE6;
  --sun: #D99A00;
  --danger: #C2362B;
  --on-photo: #FFFFFF;

  --c-aniv: #D99A00;
  --c-viag: #0F8A8A;
  --c-comp: #2F6FD0;
  --c-saude: #D0453A;
  --c-trab: #6B57C7;
  --c-festa: #C9468F;
  --c-esp: #3E9A3A;
  --c-lemb: #7B8794;
  --c-feriado: #B4532A;

  --m0: #2F6FD0; --m1: #C9468F; --m2: #0F8A8A; --m3: #D99A00;
  --m4: #6B57C7; --m5: #3E9A3A; --m6: #D0453A; --m7: #4F6475;

  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D141B; --surface: #141D27; --sunken: #1A2531; --ink: #E6EDF3; --muted: #93A2B2; --line: #263342;
    --accent: #3CC69A; --accent-ink: #06261C; --accent-soft: #143A2F; --sun: #F0C02E; --danger: #F07167;
    --c-aniv: #F0C02E; --c-viag: #3CC2C2; --c-comp: #6E9FF0; --c-saude: #F07167; --c-trab: #A594F0;
    --c-festa: #EE7BBE; --c-esp: #6CCB67; --c-lemb: #9AA7B4; --c-feriado: #EE8D5F;
    --m0: #6E9FF0; --m1: #EE7BBE; --m2: #3CC2C2; --m3: #F0C02E; --m4: #A594F0; --m5: #6CCB67; --m6: #F07167; --m7: #9AB0C2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D141B; --surface: #141D27; --sunken: #1A2531; --ink: #E6EDF3; --muted: #93A2B2; --line: #263342;
  --accent: #3CC69A; --accent-ink: #06261C; --accent-soft: #143A2F; --sun: #F0C02E; --danger: #F07167;
  --c-aniv: #F0C02E; --c-viag: #3CC2C2; --c-comp: #6E9FF0; --c-saude: #F07167; --c-trab: #A594F0;
  --c-festa: #EE7BBE; --c-esp: #6CCB67; --c-lemb: #9AA7B4; --c-feriado: #EE8D5F;
  --m0: #6E9FF0; --m1: #EE7BBE; --m2: #3CC2C2; --m3: #F0C02E; --m4: #A594F0; --m5: #6CCB67; --m6: #F07167; --m7: #9AB0C2;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app {
  max-width: 1260px;
  margin: 0 auto;
  padding-block: 20px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  gap: 18px;
}

/* top bar */
.bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bar .label { font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.bar .spacer { flex: 1; }
.status {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--muted);
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status[data-state="ok"]::before { background: var(--accent); }
.status[data-state="ro"]::before { background: var(--sun); }
.status[data-state="off"]::before { background: var(--danger); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface);
  padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 14px;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.danger.armed { background: var(--danger); border-color: var(--danger); color: var(--surface); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
@media (max-width: 980px) { .layout { grid-template-columns: minmax(0, 1fr); } }

/* calendar sheet */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; min-width: 0; }

.cover {
  position: relative; margin: 0;
  aspect-ratio: 21 / 8; max-width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--c-viag) 55%, var(--sun));
  overflow: hidden;
}
@media (max-width: 640px) { .cover { aspect-ratio: 16 / 10; } }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .5s ease; }
.cover img.loading { opacity: 0; }
/* wall-calendar binding holes */
.cover::before {
  content: ""; position: absolute; z-index: 2; left: 0; right: 0; top: 10px; height: 10px;
  background: radial-gradient(circle at 50% 50%, var(--surface) 0 4px, transparent 4.5px) center / 34px 10px repeat-x;
  opacity: .92;
}
.cover-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgb(5 12 20 / .78), rgb(5 12 20 / .15) 55%, rgb(5 12 20 / .25)); }
.cover-text { position: absolute; left: 22px; bottom: 16px; right: 160px; color: var(--on-photo); }
.cover-text .family { font-family: var(--f-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; opacity: .9; margin: 0; }
.cover-text h1 {
  margin: 2px 0 0; font-family: var(--f-display); font-weight: 800;
  font-size: clamp(34px, 6vw, 64px); line-height: .95; letter-spacing: -.02em; text-transform: capitalize;
}
.cover-text h1 .year { font-family: var(--f-mono); font-weight: 400; font-size: .38em; letter-spacing: 0; margin-left: .4em; opacity: .85; vertical-align: .15em; }
.cover-nav { position: absolute; right: 14px; bottom: 16px; display: flex; gap: 6px; }
.cover-nav button {
  background: rgb(255 255 255 / .16); border: 1px solid rgb(255 255 255 / .35); color: var(--on-photo);
  border-radius: 8px; height: 36px; min-width: 36px; padding: 0 10px; font-weight: 600;
  backdrop-filter: blur(6px);
}
.cover-nav button:hover { background: rgb(255 255 255 / .28); }
@media (max-width: 520px) {
  .cover-text { right: 16px; left: 16px; bottom: 58px; }
  .cover-nav { left: 16px; right: auto; bottom: 14px; }
}
.dots { position: absolute; z-index: 3; top: 30px; right: 14px; display: flex; gap: 6px; }
.dots button { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 1px solid rgb(255 255 255 / .8); background: rgb(255 255 255 / .25); }
.dots button.on { background: var(--on-photo); }
.cover.drop::after {
  content: "Solte as fotos aqui"; position: absolute; inset: 0; z-index: 4; display: grid; place-items: center;
  background: rgb(5 12 20 / .6); color: var(--on-photo); font-weight: 700; font-size: 18px; border: 3px dashed var(--on-photo);
}

.strip { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.thumb { position: relative; flex: none; width: 72px; height: 48px; padding: 0; border: 2px solid transparent; border-radius: 7px; overflow: hidden; background: var(--sunken); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.on { border-color: var(--accent); }
.thumb-wrap { position: relative; flex: none; }
.thumb-x {
  position: absolute; top: -6px; right: -6px; z-index: 1; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12px; line-height: 1;
}
.thumb-x.armed { background: var(--danger); border-color: var(--danger); color: var(--surface); font-weight: 600; }
.add-photo {
  flex: none; height: 48px; padding: 0 14px; border-radius: 7px; border: 1.5px dashed var(--muted); background: transparent;
  color: var(--ink); font-weight: 600; font-size: 13px; white-space: nowrap;
}
.add-photo:hover { border-color: var(--accent); color: var(--accent); }
.strip-hint { flex: none; font-size: 12px; color: var(--muted); white-space: nowrap; }

.weekdays, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays div {
  padding: 10px 10px 8px; font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.weekdays .short { display: none; }
@media (max-width: 640px) { .weekdays .long { display: none; } .weekdays .short { display: inline; } .weekdays div { text-align: center; padding-inline: 0; } }

.cell {
  min-height: 112px; padding: 6px 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px; min-width: 0; cursor: pointer; position: relative;
}
.cell:nth-child(7n) { border-right: 0; }
.cell.out { background: var(--sunken); }
.cell.out .num { color: var(--muted); opacity: .7; }
.cell:hover { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.cell.out:hover { background: color-mix(in srgb, var(--accent) 6%, var(--sunken)); }
.cell.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cell .top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.num {
  font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 500;
  width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 50%; flex: none;
}
.cell.sun .num, .cell.hol .num { color: var(--c-feriado); }
.cell.today .num { background: var(--accent); color: var(--accent-ink); }
.hol-name { font-size: 11px; color: var(--c-feriado); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chip {
  --c: var(--c-lemb);
  display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0;
  border: 0; text-align: left; padding: 2px 6px; border-radius: 5px; font-size: 12px; line-height: 1.35;
  background: color-mix(in srgb, var(--c) 17%, var(--surface)); color: var(--ink);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }
.chip .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chip .tm { font-family: var(--f-mono); font-size: 11px; color: var(--muted); flex: none; }
.chip.span { background: color-mix(in srgb, var(--c) 30%, var(--surface)); }
.chip:hover { background: color-mix(in srgb, var(--c) 32%, var(--surface)); }
.more { font-size: 11px; color: var(--muted); padding-left: 6px; }
@media (max-width: 640px) {
  .cell { min-height: 62px; padding: 4px 2px; align-items: center; }
  .cell .top { justify-content: center; }
  .hol-name { display: none; }
  .chips { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 3px; }
  .chip { width: 7px; height: 7px; padding: 0; border-radius: 50%; background: var(--c); }
  .chip::before, .chip .t, .chip .tm { display: none; }
  .more { display: none; }
}

/* side panel */
.side { display: grid; gap: 16px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; min-width: 0; }
.panel h2 { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: 19px; letter-spacing: -.01em; text-wrap: balance; }
.panel h2::first-letter { text-transform: uppercase; }
.panel .sub { margin: -8px 0 0; font-size: 13px; color: var(--muted); }
.panel-head { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; flex-wrap: wrap; }

.list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.item {
  --c: var(--c-lemb);
  display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 9px 8px; border-radius: 8px; border: 0; background: transparent; text-align: left; width: 100%;
}
button.item:hover { background: var(--sunken); }
.item .when { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); line-height: 1.3; padding-top: 2px; }
.item .when b { display: block; font-size: 20px; font-weight: 500; color: var(--ink); }
.item .what { min-width: 0; display: grid; gap: 2px; }
.item .title { font-weight: 600; display: flex; align-items: center; gap: 7px; min-width: 0; }
.item .title::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.item .title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.item .notes { font-size: 13px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { font-size: 14px; color: var(--muted); margin: 0; padding: 4px 2px; }

.members { display: flex; flex-wrap: wrap; gap: 8px; }
.member {
  --mc: var(--m0);
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 3px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 14px; max-width: 100%;
}
.member .who { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; padding: 0 4px 0 0; min-width: 0; }
.member .who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member.on { border-color: var(--mc); box-shadow: 0 0 0 1px var(--mc); }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--mc); color: var(--surface); font-weight: 700; font-size: 12px;
}
.member .x { border: 0; background: transparent; color: var(--muted); width: 22px; height: 22px; border-radius: 50%; line-height: 1; font-size: 15px; }
.member .x:hover { background: var(--sunken); color: var(--danger); }
.member .x.armed { width: auto; padding: 0 8px; border-radius: 999px; background: var(--danger); color: var(--surface); font-size: 12px; font-weight: 600; }
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; min-width: 0; }

.legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.legend span::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

input[type="text"], input[type="date"], input[type="time"], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 15px;
}
textarea { resize: vertical; min-height: 70px; }

/* dialog */
dialog {
  border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--surface); color: var(--ink);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
}
dialog::backdrop { background: rgb(8 14 22 / .5); }
.dlg { display: grid; gap: 14px; padding: 20px; }
.dlg h3 { margin: 0; font-family: var(--f-display); font-size: 22px; font-weight: 700; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.who-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.who-pick label {
  --mc: var(--m0);
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; cursor: pointer;
}
.who-pick input { position: absolute; opacity: 0; pointer-events: none; }
.who-pick label:has(input:checked) { border-color: var(--mc); background: color-mix(in srgb, var(--mc) 16%, var(--surface)); }
.who-pick label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.dlg-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dlg-foot .spacer { flex: 1; }
.byline { font-size: 13px; color: var(--muted); margin: 0; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 20;
  max-width: calc(100vw - 32px);
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* site próprio: reset que o Claude fazia, tela de senha e campos extras */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }

.gate {
  min-height: 100vh; display: grid; place-items: center;
  padding-block: 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.gate-card {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
}
.gate-photo { aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--accent), var(--c-viag) 55%, var(--sun)); position: relative; }
.gate-photo::before {
  content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 10px;
  background: radial-gradient(circle at 50% 50%, var(--surface) 0 4px, transparent 4.5px) center / 34px 10px repeat-x;
}
.gate-photo span {
  position: absolute; left: 20px; bottom: 14px; color: var(--on-photo); font-family: var(--f-display); font-weight: 800;
  font-size: 30px; line-height: 1; letter-spacing: -.02em;
}
.gate-form { display: grid; gap: 12px; padding: 20px; }
.gate-form p { margin: 0; color: var(--muted); font-size: 14px; }
.gate-form input[type="password"] {
  width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 10px 12px; font-size: 16px;
}
.gate-error { color: var(--danger) !important; font-weight: 600; }
.bar .who-am-i { font-size: 13px; color: var(--muted); }

/* capa sem cortar rostos: foto inteira na frente, a mesma foto desfocada preenchendo o fundo */
.cover .cover-bg { object-fit: cover; filter: blur(22px) saturate(1.15) brightness(.85); transform: scale(1.15); }
.cover #coverImg { object-fit: contain; }

/* foto do feriado */
.hol-photo { display: block; width: 100%; max-height: 180px; object-fit: contain; background: var(--sunken); border-radius: 8px; margin-top: 6px; }
.link-btn { justify-self: start; border: 0; background: none; padding: 2px 0; color: var(--accent); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 50vh; overflow-y: auto; }
.thumb.pick { width: 100%; height: 64px; }
.hol-photo.small { width: auto; max-width: 100%; height: 64px; max-height: 64px; object-fit: cover; }
