/* Cores e espaçamentos compartilhados pelas telas. */
:root {
  color-scheme: light;
  --ink: #151432;
  --muted: #5c5871;
  --purple: #6339c4;
  --line: #e7e0ed;
  --paper: #fffdff;
  --lilac: #eee4ff;
  font: 16px/1.45 "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: #faf6f5;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #8753db; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 1.22rem; letter-spacing: -.015em; }
h1 svg, h2 svg, .brand svg { vertical-align: middle; color: var(--purple); }
p + p { margin-top: .6rem; }
small, .muted { color: var(--muted); }
small { display: block; }
svg { flex-shrink: 0; }
[hidden] { display: none !important; }

/* Navegação fixa no computador e menu recolhível no celular. */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 244px; display: flex; flex-direction: column; gap: 36px; padding: 28px 18px; border-right: 1px solid var(--line); background: linear-gradient(165deg,#fdf8fb 70%,#eee3fa); z-index: 5; }
.brand, .account, .child-tile, .sidebar nav a { display: flex; align-items: center; gap: 12px; }
.brand { font-size: 1.25rem; font-weight: 800; letter-spacing: -.035em; }
.sidebar nav { display: grid; gap: 7px; }
.sidebar nav a { border-radius: 12px; padding: 12px; font-weight: 600; }
.sidebar nav a:hover, .sidebar nav .active { color: #4516a4; background: var(--lilac); }
.sidebar-bottom { margin-top: auto; }
.child-tile { padding: 12px; border-radius: 15px; background: #ffffffa6; border: 1px solid var(--line); }
.child-tile > svg { margin-left: auto; }
.workspace { margin-left: 244px; padding: 20px clamp(18px, 3vw, 44px) 38px; max-width: 1700px; }
.topbar { display: flex; gap: 14px; align-items: center; justify-content: flex-end; margin-bottom: 18px; }
.mobile-bar { display: none; }
.surface { min-width: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.surface > h1 { margin-bottom: 20px; }
.avatar { display: inline-grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; background: #e9d9ff; color: #5529a8; font-weight: 800; }
.green { background: #def3e8; color: #16654b; }

/* Cartões, estados de formulário e ações. */
.card, dialog { background: var(--paper); border: 1px solid var(--line); border-radius: 17px; padding: 19px; box-shadow: 0 3px 10px #21163909; }
.card h2 { margin-bottom: 12px; }
.columns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; align-items: start; }
.narrow { max-width: 540px; }
.list-item, .health-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.list-item:last-child, .health-item:last-child { border-bottom: 0; }
.health-item { align-items: start; flex-direction: column; }
.date-tile { display: grid; place-items: center; padding: 5px 9px; border-radius: 10px; background: var(--lilac); color: var(--purple); font-weight: 700; }
.button, .secondary, .icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: inherit; min-height: 41px; }
.button { background: linear-gradient(135deg,#7948d9,#5c33bd); color: white; border-color: transparent; font-weight: 650; }
.button:hover { background: #5126ab; }
.secondary:hover, .icon-btn:hover { background: var(--lilac); }
.icon-btn { padding: 8px; min-width: 41px; }
.text-link { display: inline-block; margin-top: 9px; color: #5727b0; font-weight: 650; text-decoration: underline; text-underline-offset: .2em; }
.stack { display: grid; gap: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.stack label:not(.check) { display: grid; gap: 5px; font-weight: 600; }
input:not([type=checkbox]):not([type=hidden]), textarea, select { min-width: 0; width: 100%; padding: 9px 11px; color: var(--ink); border: 1px solid #d9d0e4; background: white; border-radius: 9px; }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox] { accent-color: var(--purple); }
.inline-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notice { border-radius: 10px; background: #e5f6eb; padding: 10px 14px; margin-bottom: 14px; overflow-wrap: anywhere; }
.notice.error { background: #ffebe9; color: #8a261b; }
dialog { width: min(580px,calc(100% - 24px)); max-height: 90vh; color: var(--ink); }
dialog::backdrop { background: #20143385; }
.auth-wrap { max-width: 465px; margin: 8vh auto; padding: 18px; }
.auth-wrap .brand { margin: 0 0 20px; }
.auth-wrap .surface { border: 1px solid var(--line); border-radius: 20px; background: var(--paper); padding: 26px; }
.auth-foot { margin-top: 14px; }
.auth-foot a { text-decoration: underline; color: var(--purple); }

/* O painel agrupa os dados mais consultados por responsáveis. */
.profile-banner { display: flex; align-items: center; gap: 20px; padding: 22px; margin-bottom: 18px; border-radius: 20px; background: linear-gradient(115deg,#f4ebff,#ebe3f7); }
.profile-banner .avatar { width: 72px; height: 72px; font-size: 1.8rem; }
.profile-banner .next-event { margin-left: auto; display: flex; gap: 14px; align-items: center; border-left: 1px solid #d8c8ee; padding-left: 22px; }
.next-event strong { display: block; }
.dashboard-grid { align-items: stretch; }
.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card-title .text-link { margin: 0 0 8px; }
.list-label { flex: 1; min-width: 0; }
.badge { display: inline-flex; border-radius: 100px; background: var(--lilac); color: #4b218c; padding: 4px 10px; font-size: .8rem; }
.badge.green { background: #def3e8; color: #16654b; }

/* A agenda usa colunas semanais no computador e uma lista legível em telas menores. */
.calendar { padding: 0; overflow: hidden; }
.calendar-head, .calendar-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.calendar-head { padding: 14px; justify-content: space-between; }
.calendar-head h2 { margin: 0; }
.calendar-controls .selected { background: var(--purple); color: white; }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); }
.weekdays { text-align: center; background: #f2edf6; padding: 9px 0; font-weight: 650; }
.calendar-day { min-height: 100px; padding: 8px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); }
.calendar-day.outside { background: #f7f4f8; color: var(--muted); }
.calendar-day.current { background: #faf5ff; }
.event-chip { display: block; margin-top: 6px; padding: 7px; border-radius: 8px; background: var(--lilac); color: #401789; font-weight: 650; font-size: .87rem; overflow-wrap: anywhere; }
.event-chip small { color: inherit; font-weight: 400; }
.event-chip.blue, .event-chip.green { background: #def3e8; color: #16563f; }
.event-chip.amber { background: #fff0ce; color: #713c00; }
.event-chip.gray { background: #eeebf1; color: #453c54; }
.event-chip.cancelled { text-decoration: line-through; }
.event-chip.completed { box-shadow: inset 3px 0 #2c855e; }
.mobile-date { display: none; }
.calendar.day .calendar-grid { grid-template-columns: 1fr; }
.calendar.day .event-chip { max-width: 620px; }

/* O chat mantém o compositor visível enquanto as mensagens rolam. */
.chat-surface { background: #fffafc; border-radius: 20px; padding: 20px; }
.chat-grid { display: grid; grid-template-columns: minmax(185px, 1fr) minmax(0, 2.35fr); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: white; }
.conversations { padding: 14px; border-right: 1px solid var(--line); }
.conversations .button { width: 100%; margin-bottom: 16px; }
.conversation { background: var(--lilac); padding: 10px; border-radius: 12px; margin-top: 10px; display: flex; align-items: center; gap: 9px; }
.conversation div { min-width: 0; overflow-wrap: anywhere; }
.conversation time, .message-meta time { color: var(--muted); font-size: .8rem; }
.conversation time { margin-left: auto; }
.chat-room { min-width: 0; display: flex; flex-direction: column; }
.room-header { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.room-header p { color: var(--muted); }
.room-header a { margin-left: auto; }
.chat-messages { height: clamp(300px,52vh,680px); overflow: auto; padding: 14px; }
.message { display: flex; gap: 8px; align-items: end; margin: 14px 0; }
.message.mine { flex-direction: row-reverse; }
.message .avatar { width: 35px; height: 35px; }
.message-body { max-width: 82%; min-width: 0; }
.message-meta { display: flex; gap: 8px; font-size: .9rem; align-items: baseline; }
.mine .message-meta { justify-content: end; }
.bubble { background: #f2eff2; border-radius: 14px; padding: 8px 12px; overflow-wrap: anywhere; }
.mine .bubble { background: var(--lilac); }
.message-content { white-space: pre-wrap; }
.bubble a { display: block; text-decoration: underline; }
.important { background: #ffe7ac; color: #663c00; margin: 4px; padding: 2px 6px; border-radius: 20px; font-size: .78rem; }
.receipt { margin-left: 7px; color: var(--purple); font-weight: 700; }
.day-separator { display: flex; align-items: center; gap: 12px; justify-content: center; color: var(--muted); font-size: .85rem; }
.day-separator::before, .day-separator::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.day-separator span { padding: 5px 10px; border-radius: 20px; background: #f3eff4; }
.chat-empty { text-align: center; padding: 35px 10px; color: var(--muted); }
.chat-empty h2 { margin-top: 8px; }
.composer { padding: 10px; border-top: 1px solid var(--line); }
.compose-row, .compose-options { display: flex; align-items: center; gap: 8px; }
.compose-options { font-size: .82rem; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.file-picker { position: relative; cursor: pointer; }
.file-picker:focus-within { outline: 3px solid #8753db; }
.file-picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

@media (max-width: 900px) {
  .sidebar { width: 205px; }
  .workspace { margin-left: 205px; }
  .conversations { display: none; }
  .chat-grid { grid-template-columns: 1fr; }
  .columns { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fffafd; }
  .sidebar { display: none; inset: 64px 12px auto; width: auto; max-height: calc(100dvh - 78px); overflow: auto; padding: 14px; gap: 10px; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 25px #25154625; }
  .sidebar.open { display: flex; }
  .sidebar > .brand { display: none; }
  .workspace { margin: 0; padding: 10px 12px 24px; }
  .topbar { margin-bottom: 10px; }
  .topbar .avatar { width: 30px; height: 30px; }
  .section-heading { flex-wrap: wrap; }
  .profile-banner { flex-wrap: wrap; padding: 15px; }
  .profile-banner .next-event { width: 100%; border-left: 0; border-top: 1px solid #d8c8ee; padding: 12px 0 0; margin: 0; }
  .dashboard-grid .routine-card { grid-row: 1; }
  .calendar-grid, .calendar.day .calendar-grid { grid-template-columns: 1fr; }
  .calendar-day { min-height: 0; border-right: 0; }
  .calendar.month .calendar-day:not(.has-events):not(.current) { display: none; }
  .weekdays, .desktop-date { display: none; }
  .mobile-date { display: inline; }
  .chat-surface { padding: 0; }
}
@media (max-width: 390px) {
  .form-grid { grid-template-columns: 1fr; }
}

.avatar.profile-photo{object-fit:cover}.card .profile-photo{width:75px;height:75px}

/* A agenda só posiciona eventos quando há espaço para ler a grade horária. */
.hour-tick { display: none; }
@media (min-width: 1050px) {
  .timed-calendar .calendar-day { display: flex; flex-direction: column; }
  .timed-calendar .day-events { display: flex; flex-direction: column; flex: 1; position: relative; }
  .timed-calendar .timeline { display: block; height: var(--timeline-height); position: relative; margin-top: auto; border-bottom: 1px solid var(--line); }
  .timed-calendar .hour-tick { display: block; position: absolute; left: -33px; right: 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .68rem; }
  .timed-calendar [data-start] { position: absolute; top: var(--event-top); left: var(--lane-left); width: var(--lane-width); height: var(--event-height); margin: 0; padding: 3px 5px; overflow: auto; z-index: 1; }
}
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; min-width: 0; }
.profile-photo { object-fit: cover; }

@media (max-width: 1049px) {
  .timeline { height: auto !important; }
}
@media (min-width: 1050px) {
  .timed-calendar .timeline { margin-left: 33px; }
  .timed-calendar .calendar-day:has(.timeline) { min-width: 0; }
}
.profile-banner a.avatar { overflow: hidden; }

/* Estrutura comum inspirada nas telas de referência. */
:root {
  --ink: #101333;
  --muted: #5a5b73;
  --purple: #653ac4;
  --line: #e7e1ed;
  --lilac: #eee4fa;
  --paper: #fffefe;
  background: #faf7f7;
}
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 20; background: white; padding: 12px; border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.sidebar { padding: 34px 17px 24px; gap: 40px; background: #faf5f8; }
.sidebar .brand { padding-inline: 8px; }
.sidebar nav { gap: 5px; }
.sidebar nav a { gap: 14px; min-height: 50px; font-weight: 550; }
.sidebar nav a.active { background: #eadefa; color: #4818a5; font-weight: 700; }
.sidebar-bottom details .text-link { display: block; overflow-wrap: anywhere; }
.sidebar-bottom details { margin-top: 8px; }
.child-tile strong { overflow-wrap: anywhere; }
.workspace { padding-top: 22px; }
.topbar { min-height: 44px; margin-bottom: 17px; }
.topbar .account { gap: 8px; border-radius: 12px; padding: 3px 8px 3px 3px; font-size: .92rem; }
.topbar .account:hover { background: var(--lilac); }
.topbar .avatar { width: 38px; height: 38px; }
.bottom-nav, .mobile-logout { display: none; }
.page-heading { margin-bottom: 20px; }
.page-heading p { margin-top: 5px; color: var(--muted); }
.card { box-shadow: 0 2px 6px #2615370c; }
.card h2 svg { margin-right: 5px; }
.button, .secondary, .icon-btn { min-height: 42px; }
.button { box-shadow: 0 2px 5px #5926a823; }
input[readonly] { background: #f5f2f7 !important; }
.surface:not(.dashboard-surface):not(.agenda-surface):not(.chat-surface) > .columns { margin-top: 18px; }

/* Painel com identidade familiar, destaque para o próximo compromisso e rotina. */
.dashboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.family-strip, .family-person { display: flex; align-items: center; gap: 10px; }
.family-strip { flex-wrap: wrap; justify-content: end; }
.family-person { padding: 0 12px; border-left: 1px solid var(--line); }
.family-person:first-child { border-left: 0; }
.profile-banner { gap: 16px; min-height: 132px; border: 1px solid #ece2f4; padding: 22px 26px; }
.profile-banner .avatar { width: 80px; height: 80px; }
.profile-banner h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); overflow-wrap: anywhere; }
.profile-banner .next-event { padding-left: 26px; }
.next-event > svg { color: var(--purple); }
.next-event > div { min-width: 0; }
.next-event strong { overflow-wrap: anywhere; }
.dashboard-grid { grid-template-columns: minmax(0,1.15fr) minmax(0,1fr); }
.dashboard-grid .card { min-height: 125px; }
.card-title .text-link { text-decoration: none; font-size: .9rem; }
.card-title .text-link:hover { text-decoration: underline; }
.event-icon { display: grid; place-items: center; width: 45px; height: 42px; flex: 0 0 auto; border-radius: 12px; background: var(--lilac); color: #5826b8; }
.event-icon.blue, .event-icon.green { background: #e6f5eb; color: #16654b; }
.event-icon.amber { background: #fdf0d9; color: #8a4708; }
.event-icon.gray { background: #f1eef4; color: #524862; }
.dashboard-grid .list-item:is(a):hover { background: #f9f5fc; }
.routine-row { padding: 9px 10px; border-radius: 9px; margin-bottom: 4px; }
.routine-row.done { background: #e7f6ed; border-color: transparent; }
.routine-check { width: 21px; height: 21px; border: 1.5px solid #7a7688; border-radius: 6px; display: grid; place-items: center; flex-shrink: 0; }
.done .routine-check { background: #228b55; border-color: #228b55; color: white; }

/* Controle de data e cabeçalhos da grade. */
.calendar-head { padding: 14px 16px; gap: 10px; }
.calendar-controls { gap: 4px; }
.calendar-controls[aria-label] { background: #f6f2f9; padding: 3px; border: 1px solid var(--line); border-radius: 12px; }
.calendar-controls[aria-label] .secondary { min-height: 34px; border: 0; background: transparent; padding: 5px 10px; }
.calendar-controls[aria-label] .selected { background: var(--purple); }
.calendar-day > strong { display: block; padding: 7px 3px; text-align: center; }
.calendar-day.current > strong { color: #492294; background: var(--lilac); border-radius: 8px; }
.event-chip svg { vertical-align: -.15em; }
.event-chip small { font-size: .77rem; }
.agenda-surface .event-chip { outline-offset: 0; }
@media (min-width: 1050px) {
  .timed-calendar .calendar-day { padding: 5px; }
  .timed-calendar.week .timeline { margin-left: 0; }
  .timed-calendar.week .calendar-day:first-child .timeline { margin-left: 31px; }
  .timed-calendar.week .calendar-day:not(:first-child) .hour-tick { left: 0; font-size: 0; }
}

/* Chat e formulários de configurações. */
.chat-surface { background: #fffcff; border: 1px solid #efe8f0; padding: 18px; }
.chat-grid { grid-template-columns: minmax(210px, .9fr) minmax(0,1.85fr); }
.conversations { background: #fdfbff; }
.room-header h2 { line-height: 1.25; overflow-wrap: anywhere; }
.room-header .icon-btn { border-color: transparent; }
.chat-messages { height: clamp(310px,54vh,680px); }
.bubble { padding: 9px 13px; }
.chat-empty { display: grid; justify-items: center; gap: 7px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; align-items: start; }
.settings-card .button { justify-self: start; }
.settings-card .stack { margin-top: 18px; }
.settings-card #password-help { margin-top: -10px; }
.settings-card #agenda-help { font-size: .88rem; }

@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-grid, .chat-grid { grid-template-columns: 1fr; }
  .dashboard-heading { align-items: start; flex-wrap: wrap; }
  .family-strip { justify-content: start; }
  .family-person:first-child { padding-left: 0; }
}
@media (max-width: 680px) {
  .mobile-bar { position: sticky; top: 0; z-index: 6; }
  .sidebar { z-index: 7; max-height: calc(100dvh - 148px); }
  .mobile-logout { display: block; }
  .workspace { padding: 16px 13px 24px; }
  .has-child .workspace { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .topbar, .family-strip { display: none; }
  .page-heading, .section-heading { margin-bottom: 15px; }
  .bottom-nav { position: fixed; z-index: 6; inset: auto 0 0; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 3px; padding: 5px 8px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fffcff; box-shadow: 0 -5px 16px #2212390e; }
  .bottom-nav a, .bottom-nav button { display: grid; justify-items: center; gap: 2px; min-height: 50px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font-size: .74rem; padding: 5px 2px; }
  .bottom-nav .active { background: var(--lilac); color: #4920a0; font-weight: 700; }
  .profile-banner { gap: 12px; padding: 14px; }
  .profile-banner .avatar { width: 57px; height: 57px; }
  .profile-banner .next-event { padding-top: 10px; gap: 8px; }
  .next-event .badge { margin-left: auto; }
  .card { padding: 14px; }
  .calendar { padding: 0; }
  .calendar-day > strong { text-align: left; }
  .calendar.day .calendar-day > strong { text-align: center; }
  .calendar-head { padding: 10px; }
  .chat-surface { padding: 0; border: 0; background: transparent; }
  .chat-messages { height: max(250px, calc(100dvh - 335px)); }
  .room-header { padding: 10px 12px; }
}

/* A agenda diária mantém a escala de horários mesmo no celular. */
@media (max-width: 680px) {
  .timed-calendar.day .day-events { display: grid; gap: 5px; }
  .timed-calendar.day .timeline { display: block; height: var(--timeline-height) !important; position: relative; margin-left: 40px; }
  .timed-calendar.day .hour-tick { display: block; position: absolute; left: -40px; right: 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .73rem; }
  .timed-calendar.day [data-start] { position: absolute; top: var(--event-top); left: var(--lane-left); width: var(--lane-width); height: var(--event-height); z-index: 1; margin: 0; overflow: auto; }
}


/* Avatares recortados das prévias. Fotos enviadas pela família usam o estilo original. */
.avatar > img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; }
.avatar:has(> img) { overflow: hidden; }
.profile-banner .avatar { width: 100px; height: 100px; }
.family-person .avatar { width: 48px; height: 48px; }

/* A régua horária fica fora das colunas, como na referência. */
.reference-agenda > .section-heading { margin-bottom: 22px; }
.reference-agenda .calendar { background: transparent; border: 0; box-shadow: none; overflow: visible; }
.reference-agenda .mobile-create { display: none; }
.reference-agenda .agenda-toolbar { display: flex; padding: 0; margin-bottom: 25px; justify-content: initial; gap: 10px; }
.reference-agenda .agenda-toolbar > nav { margin-left: auto; }
.reference-agenda .period-controls { gap: 8px; }
.reference-agenda .period-controls .secondary { background: #fffdfd; }
.reference-agenda .period-controls .date-button { padding-inline: 15px; gap: 14px; }
.reference-agenda .today-control { order: -1; }
.reference-agenda .desktop-create { padding-inline: 16px; }
.reference-agenda .calendar.month .calendar-grid, .reference-agenda .weekdays { border: 1px solid #e4dfe9; background-color: #fffdfd; }
.reference-agenda .calendar.month .calendar-grid { border-radius: 0 0 12px 12px; }
.reference-agenda .weekdays { border-radius: 12px 12px 0 0; }
.reference-agenda .timed-calendar .calendar-grid { --ruler-width: 54px; grid-template-columns: var(--ruler-width) repeat(7,minmax(0,1fr)); }
.reference-agenda .timed-calendar.day .calendar-grid { grid-template-columns: var(--ruler-width) minmax(0,1fr); }
.reference-agenda .agenda-ruler { align-self: end; position: relative; padding-right: 10px; color: #272844; }
.reference-agenda .agenda-ruler span { position: absolute; inset-inline: 0 8px; text-align: right; padding-top: 3px; font-size: .8rem; font-variant-numeric: tabular-nums; }
.reference-agenda .timed-calendar .calendar-day { display: flex; min-width: 0; padding: 0; flex-direction: column; border: 1px solid #e4e0ea; border-left: 0; background: #fffefe; overflow: hidden; }
.reference-agenda .timed-calendar .calendar-day:nth-child(2) { border-left: 1px solid #e4e0ea; border-radius: 13px 0 0 13px; }
.reference-agenda .timed-calendar .calendar-day:last-child { border-radius: 0 13px 13px 0; }
.reference-agenda .timed-calendar.day .calendar-day { border-radius: 13px; }
.reference-agenda .timed-calendar .calendar-day > strong { background: #f6f3f6; color: var(--ink); border-bottom: 1px solid #e4e0ea; border-radius: 0; padding: 10px 4px; text-align: center; font-size: 1.04rem; }
.reference-agenda .timed-calendar .calendar-day > strong span { display: block; font-weight: 450; font-size: .83rem; }
.reference-agenda .timed-calendar .selected-day > strong { background: #ece3f8; color: #392175; }
.reference-agenda .timed-calendar .day-events { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.reference-agenda .timed-calendar .day-events > small { display: none; }
.reference-agenda .timed-calendar .timeline {
  display: block;
  position: relative;
  margin: auto 0 0;
  height: var(--timeline-height) !important;
  background: repeating-linear-gradient(to bottom, #e6e3ea 0 1px, transparent 1px var(--agenda-hour));
}
.reference-agenda .timed-calendar .event-chip:not([data-start]) { margin: 3px; }
.reference-agenda .timed-calendar [data-start] {
  position: absolute;
  z-index: 1;
  top: var(--event-top);
  left: calc(var(--lane-left) + 3px);
  width: calc(var(--lane-width) - 6px);
  height: calc(var(--event-height) - 1px);
  margin: 0;
  padding: 5px 7px;
  overflow: auto;
  border-radius: 9px;
}
.reference-agenda .event-chip.purple { background: #e9ddfa; color: #27155c; }
.reference-agenda .event-chip.blue { background: #d9f3e6; color: #164d3b; }
.reference-agenda .event-chip.green { background: #ffebc6; color: #603a0c; }
.reference-agenda .event-chip small { font-size: .76rem; }
.reference-agenda .week .event-chip svg { display: block; margin-bottom: 3px; }
.reference-agenda .week .event-chip:not([data-start]) svg { display: inline; }
@media (max-width: 1080px) {
  .reference-agenda .agenda-toolbar { flex-wrap: wrap; }
  .reference-agenda .event-chip { font-size: .81rem; }
  .reference-agenda .timed-calendar.week { overflow-x: auto; }
  .reference-agenda .timed-calendar.week .calendar-grid { min-width: 660px; }
}
@media (max-width: 680px) {
  .profile-banner .avatar { width: 61px; height: 61px; }
  .reference-agenda .desktop-create { display: none; }
  .reference-agenda .mobile-create { display: inline-flex; }
  .reference-agenda > .section-heading { margin-bottom: 14px; }
  .reference-agenda .agenda-toolbar { margin-bottom: 13px; gap: 7px; }
  .reference-agenda .agenda-toolbar > nav { margin-left: 0; }
  .reference-agenda .period-controls { display: grid; grid-template-columns: auto minmax(0,1fr) auto; width: 100%; gap: 6px; }
  .reference-agenda .period-controls .date-button { grid-column: 2; grid-row: 1; padding-inline: 5px; gap: 5px; font-size: .86rem; }
  .reference-agenda .period-controls a:nth-child(2) { grid-column: 3; }
  .reference-agenda .timed-calendar .calendar-grid { --ruler-width: 46px; }
  .reference-agenda .timed-calendar.day .calendar-day > strong span { display: inline; padding-left: 5px; font-size: inherit; font-weight: inherit; }
  .reference-agenda .timed-calendar.day .calendar-day > strong { padding-block: 9px; }
  .reference-agenda .timed-calendar.day .event-chip { padding-inline: 9px; }
}


/* A conta fica na mesma linha do título na agenda de computador. */

.reference-agenda > .section-heading > .topbar { margin: 0; }
.reference-agenda > .section-heading { min-height: 58px; }
@media (max-width: 680px) {

  .reference-agenda > .section-heading { min-height: 0; }
}

/* O horário já está na régua. O bloco mostra somente o título, sem rolagem interna. */
.agenda-surface .calendar .event-chip > :is(svg, small) { display: none; }
.agenda-surface .calendar .event-chip {
  font-weight: 400;
  font-synthesis: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* Permite escrever várias linhas mantendo o compositor compacto. */
.composer textarea {
  min-height: 42px;
  max-height: 112px;
  resize: vertical;
  field-sizing: content;
}


/* Dá espaço ao sobrenome sem reduzir o avatar ou o alvo do cartão. */
.sidebar .child-tile { gap: 8px; }
.sidebar .child-tile strong { display: block; font-size: .85rem; line-height: 1.25; }
.child-surnames { display: block; }
/* Mantém a seleção, os dados e o download legíveis em cartões estreitos. */
.report-item { flex-wrap: wrap; }
.report-item input[type=checkbox] { width: 17px; height: 17px; margin: 0; flex: 0 0 auto; }
.report-item .list-label { min-width: 105px; }
.report-item a { white-space: nowrap; }
.report-delete { margin-top: 10px; color: #922f3c; }
.report-delete.button { color: #fff; background: #922f3c; }


/* Mantém o seletor nativo de anexos, com um botão compacto no estilo do app. */
.stack input[type=file] { padding: 5px 7px; font-size: .82rem; }
.stack input[type=file]::file-selector-button {
  margin-inline-end: 8px;
  border: 1px solid #e0d3f1;
  border-radius: 7px;
  padding: 5px 8px;
  color: #50269b;
  background: var(--lilac);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.stack input[type=file]:hover::file-selector-button { background: #e4d5f7; }
#report-dates-help { grid-column: 1 / -1; }


/* Barra superior do painel. */
.dashboard-topbar { display: flex; justify-content: flex-end; }
.dashboard-topbar > form { flex: 0 0 auto; }
/* Os responsáveis ficam ao lado de Sair. */
.dashboard-topbar .family-strip { display: flex; justify-content: flex-end; }
.dashboard-topbar .family-person { padding-inline: 8px; }
.dashboard-topbar .family-person .avatar { width: 42px; height: 42px; }
@media (max-width: 680px) {
  .dashboard-topbar { flex-wrap: wrap; }
  .dashboard-topbar .family-strip { flex: 1; justify-content: flex-start; }
}


/* O fundo amarelo sinaliza o cancelamento nas três visões da agenda. */
.agenda-surface .calendar .event-chip.cancelled {
  background: #fff0b3;
  color: #5f430c;
  text-decoration: none;
}
.secondary:disabled { opacity: .65; cursor: default; }



/* Ativos aparecem em verde; os cancelados têm fundo amarelo. */
.agenda-surface .calendar .event-chip.scheduled {
  background: #d9f3e6;
  color: #164d3b;
}

/* Formulário e histórico compactos na tela de detalhes do compromisso. */
.event-details #editar-compromisso { padding: 15px; }
.event-details #editar-compromisso .stack { gap: 9px; }
.event-details #editar-compromisso .form-grid { gap: 8px; }
.event-details #editar-compromisso :is(input:not([type=hidden],[type=checkbox],[type=file]), select, textarea) { padding-block: 6px; }
.event-details #editar-compromisso textarea { min-height: 65px; }
.event-details #editar-compromisso .button { justify-self: start; }
.event-history-card > p { margin-bottom: 10px; }
.event-history-card > h2:not(:first-child) { margin-top: 16px; }
.event-history-scroll {
  max-height: 365px;
  overflow-y: auto;
  scrollbar-color: #a98bce #f2edf8;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
  padding-inline-end: 6px;
}
.event-history-list { list-style: none; margin: 0; padding: 0; }
.event-history-entry { padding: 8px 7px; border-bottom: 1px solid var(--line); font-size: .86rem; overflow-wrap: anywhere; }
.event-history-entry:nth-child(odd) { background: #faf7fc; }
.event-history-meta { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 3px 10px; margin-bottom: 3px; }
.event-history-meta time { color: var(--muted); font-size: .78rem; }
.event-history-entry ul { list-style: none; margin: 0; padding: 0; }
.event-history-entry li + li { margin-top: 3px; }
.event-history-more summary { margin-block: 8px; color: #50269b; min-height: 34px; padding: 4px 8px; }
.event-history-more:not([open]) .history-hide,
.event-history-more[open] .history-show { display: none; }

/* As duas colunas têm a mesma altura no computador; só o histórico rola. */
@media (min-width: 901px) {
  .event-details > .columns { align-items: stretch; }
  .event-history-card { display: flex; flex-direction: column; }
  .event-history-card .event-history-scroll { flex: 1 1 0; min-height: 155px; max-height: none; }
}



/* O controle de uma data fica junto ao histórico da série. */
.event-occurrences { margin-block: 13px; }
.event-occurrences .inline-actions { align-items: end; margin-block: 6px; }
.event-occurrences label { display: grid; gap: 3px; font-size: .85rem; }
.event-occurrences details { margin-top: 7px; }

.event-time-mode, .event-time-fields { grid-column: 1 / -1; }
.event-time-fields small { align-self: end; }
[data-prescription] { container-type: inline-size; }

@container (min-width: 350px) {
  .prescription-fields {
    grid-template-columns: minmax(0, .65fr) minmax(0, 1fr) minmax(105px, 1.55fr) minmax(84px, 1fr);
    align-items: start;
    gap: 8px;
  }

  .prescription-fields label { font-size: .8125rem; white-space: nowrap; }
  .prescription-fields :is(input, select) { min-width: 0; height: 42px; padding-inline: 7px; }
}

.nutrition-nav, .nutrition-card { margin-top: 16px; }
.nutrition-card > summary { font-weight: 700; }
.nutrition-card > summary + .stack { margin-top: 12px; }
.nutrition-filter { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.nutrition-filter label { display: grid; gap: 5px; flex: 1 1 150px; min-width: 0; }
.nutrition-values { margin: 8px 0 12px; overflow-wrap: anywhere; }
.nutrition-values dt { font-weight: 650; margin-top: 8px; }
.nutrition-values dd { margin: 0; white-space: pre-wrap; }
.growth-chart { display: block; width: 100%; height: 220px; }

.submodule-toolbar { display: flex; align-items: start; gap: 8px; }
.submodule-toolbar :is(h1, .submodule-links) { min-width: 0; overflow-wrap: anywhere; }
.submodule-toolbar .submodule-back { margin-inline-start: auto; flex: none; white-space: nowrap; }

/* Editor de foto de perfil */
button.avatar-editor { border: 0; padding: 0; overflow: hidden; cursor: pointer; }
button.avatar-editor:focus-visible, .photo-preview:focus-visible { outline: 2px solid var(--primary, #683fc5); outline-offset: 3px; }
.photo-editor { width: min(440px, calc(100% - 24px)); }
.photo-preview { display: block; width: min(100%, 270px); aspect-ratio: 1; margin: 10px auto; border-radius: 50%; touch-action: none; cursor: grab; }
.photo-preview:active { cursor: grabbing; }
.photo-editor input[type="range"] { width: 100%; padding-inline: 0; }
.photo-editor .inline-actions { margin-block-start: 12px; }
.photo-editor-footer { justify-content: flex-end; }
.child-tile-link { display: flex; align-items: center; justify-content: space-between; gap: 7px; flex: 1; min-width: 0; }
.photo-file-picker { margin-top: 10px; position: relative; cursor: pointer; }
.photo-file-picker:focus-within { outline: 3px solid #8753db; outline-offset: 3px; }
.photo-file-picker input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.photo-zoom { display: flex; align-items: end; gap: 8px; margin-top: 8px; }
.photo-zoom label { flex: 1; min-width: 0; }
.photo-zoom button { min-width: 41px; }
