/* KMAIL — complementos do webmail ao kmail.css global (componentes dinâmicos). */

/* Corpo da mensagem: iframe sandbox com altura ajustada pelo webmail.js */
.mail-iframe { display: block; width: 100%; min-height: 120px; height: 240px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }

/* Conversa: cada mensagem é um <details>; fechadas mostram só a prévia */
.thread-item > summary { list-style: none; cursor: pointer; }
.thread-item > summary::-webkit-details-marker { display: none; }
.thread-item:not([open]) .thread-full { display: none; }
.thread-item[open] .thread-collapsed { display: none; }
.thread-item:not([open]) > summary { padding-top: .75rem; padding-bottom: .75rem; }
.thread-item:not([open]) .avatar-lg { width: 32px; height: 32px; font-size: .75rem; }
.thread-collapsed { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Aviso de imagens bloqueadas */
.images-blocked { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: 0 1.25rem .85rem; padding: .6rem .85rem; border-radius: var(--radius-sm); background: var(--warning-soft); color: var(--text); }
.images-blocked > i { color: var(--warning); }

/* Estados vazios */
.empty-state, .reader-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45rem; text-align: center; padding: 3rem 1.5rem; color: var(--text-dim); }
.empty-state > i, .reader-empty > i { font-size: 2rem; color: var(--text-faint); margin-bottom: .35rem; }
.reader-empty { height: 100%; }

/* Menu do usuário (avatar) */
.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu-panel { position: absolute; right: 0; top: calc(100% + .5rem); min-width: 240px; padding: .85rem; display: flex; flex-direction: column; gap: .25rem; z-index: 60; box-shadow: var(--shadow); }
.user-menu-panel form { margin: 0; }
.btn-reset { background: none; border: 0; font: inherit; color: inherit; width: 100%; text-align: left; cursor: pointer; }

/* Formulários compactos em linha (ações da leitura, tabelas) */
.inline-form { display: inline-flex; align-items: center; gap: .25rem; margin: 0; flex-wrap: wrap; }
.select-sm, .input-sm { width: auto; padding: .3rem .6rem; font-size: .8rem; }
.move-to { display: inline-flex; align-items: center; gap: .15rem; }
.move-to .select-sm { max-width: 150px; }
.btn-icon.is-on i { color: var(--warning); }

/* Menu lateral */
.nav-sub { padding-left: 1.9rem; }
.nav-folder { position: relative; }
.nav-folder > .nav-link { padding-left: calc(.7rem + var(--depth, 0) * 1.15rem); }
.nav-folder.has-kids > .nav-link { padding-right: 2.1rem; }
.nav-folder[hidden] { display: none; }
.nav-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-caret { position: absolute; top: 50%; right: .3rem; transform: translateY(-50%); width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border: 0; border-radius: 7px; background: none; color: var(--text-faint); cursor: pointer; }
.nav-caret:hover { background: var(--surface-hover); color: var(--text); }
.nav-caret:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.nav-caret i { font-size: .7rem; transition: transform .15s; }
.nav-caret[aria-expanded="false"] i { transform: rotate(-90deg); }
.nav-empty { padding: .25rem .85rem .5rem; margin: 0; }

/* Leitura em largura total (agendados, código-fonte) */
.reader-wide { grid-column: span 2; }

/* Código-fonte */
.code-block { margin: 0; padding: 1rem 1.25rem; font-family: var(--font-mono); font-size: .78rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 60vh; overflow: auto; color: var(--text-dim); }
details.card > summary { list-style: none; cursor: pointer; }

/* Assinaturas */
.signature-preview { padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
.editor-sm { min-height: 140px; border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* Editor */
.color-pick { position: relative; overflow: hidden; }
.color-pick input[type=color] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload .link { color: var(--accent-light); font-weight: 600; text-decoration: underline; }
.upload.is-dragging { border-color: var(--accent); background: var(--accent-soft); }
.attachment input[type=checkbox] { margin-right: .25rem; }
.editor blockquote { margin: 0 0 0 .5rem; padding-left: .8rem; border-left: 3px solid #d0d7de; color: #57606a; }

/* Contagem dinâmica do menu */
.nav-link .count[hidden] { display: none !important; }

/* Impressão: só a conversa aberta */
@media print {
  .topbar, .folders, .list-pane, .reader-toolbar, .quick-reply, .site-footer, .images-blocked, .mail-frame-caption { display: none !important; }
  .mail { display: block !important; }
  .reader-body { overflow: visible !important; padding: 0 !important; }
  .mail-iframe { border: 0; }
}

/* Filtros */
.filter-cond { flex-wrap: wrap; }
.filter-cond .input { min-width: 180px; }

/* Autocompletar de destinatários */
.autocomplete { position: absolute; left: 4.5rem; right: 0; top: 100%; z-index: 40; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 280px; overflow-y: auto; }
.autocomplete-item { display: flex; flex-direction: column; gap: .1rem; padding: .55rem .8rem; cursor: pointer; }
.autocomplete-item:hover, .autocomplete-item.is-active { background: var(--accent-soft); }

/* Contatos */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .4rem .9rem; }
a.list-item { color: inherit; text-decoration: none; }

/* Segurança */
.otp-setup { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; }
.otp-qr { background: #fff; padding: 8px; border-radius: var(--radius-sm); image-rendering: pixelated; }
.otp-key, .code-input { font-family: var(--font-mono); letter-spacing: .04em; }

/* Agenda */
.mini-grid a { padding: .3rem 0; border-radius: 8px; position: relative; color: inherit; text-decoration: none; }
.mini-grid a:hover { background: var(--surface-hover); }
.mini-grid a.out { color: var(--text-faint); }
.mini-grid a.has::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.mini-grid a.today { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.month .num { color: inherit; text-decoration: none; }
.month .day { position: relative; }
.day-add { position: absolute; right: .35rem; top: .35rem; font-size: .7rem; color: var(--text-faint); opacity: 0; }
.month .day:hover .day-add { opacity: 1; }
.ev-pending { border-left-style: dashed !important; opacity: .85; }
.ev-declined { text-decoration: line-through; opacity: .55; }
.cal-toggle { margin: 0; }
.color-input { width: 42px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--input-bg); }
.segmented button { border: 0; background: none; font: inherit; color: inherit; padding: .35rem .8rem; cursor: pointer; border-radius: inherit; }
.segmented button.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.invite-rsvp { margin-top: 1rem; }
.agenda-group { margin-bottom: 1rem; }

/* Grade de semana/dia: 1px = 1 minuto */
.timegrid { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; display: flex; flex-direction: column; height: calc(100vh - 200px); height: calc(100dvh - 200px); min-height: 420px; }
.tg-head, .tg-allday { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.tg-head a { padding: .5rem; font-size: .78rem; font-weight: 600; text-align: center; color: var(--text-dim); text-decoration: none; }
.tg-head a.today { color: var(--accent-light); }
.tg-allday > div { padding: .25rem; display: flex; flex-direction: column; gap: 2px; min-width: 0; border-left: 1px solid var(--border); }
.tg-body { position: relative; display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); overflow-y: auto; flex: 1; }
.tg-hours { grid-column: 1; }
.tg-hour { height: 60px; font-size: .68rem; color: var(--text-faint); text-align: right; padding: 0 .4rem; transform: translateY(-.45em); }
.tg-allday .tg-hour { height: auto; transform: none; padding: .35rem .4rem; border-left: 0; }
.tg-col { position: relative; height: 1440px; border-left: 1px solid var(--border); background-image: repeating-linear-gradient(to bottom, transparent 0 59px, var(--border) 59px 60px); }
.tg-col.today { background-color: var(--accent-soft); }
.tg-ev { position: absolute; overflow: hidden; display: flex; flex-direction: column; gap: 1px; font-size: .74rem; padding: .2rem .35rem; }
.tg-ev span { opacity: .8; font-size: .7rem; }

/* Arquivos */
.crumb { color: inherit; text-decoration: none; }
.crumb:hover { text-decoration: underline; }
.file-name { color: inherit; display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; font-weight: 500; }
.file-name:hover { color: var(--accent-light); }
.file-menu { position: relative; display: inline-block; }
.file-menu > summary { list-style: none; }
.file-menu > summary::-webkit-details-marker { display: none; }
/* Posição calculada no JS (fixed, relativa à janela): não é cortado pela lista. */
.file-menu-panel { position: fixed; z-index: 60; min-width: 300px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; padding: .75rem; box-shadow: var(--shadow); text-align: left; }
.file-menu-panel form { margin: 0; }

/* Tarefas */
.task.is-dragging { opacity: .5; }
.task-meta a { text-decoration: none; }

/* Contagem nas pastas: total discreto; não lidas em destaque */
.folders .nav-link .count { font-weight: 600; }
.folders .nav-link .count.unread { min-width: 1.4rem; padding: .05rem .45rem; border-radius: 999px; text-align: center; background: var(--accent-soft); color: var(--accent-light); font-weight: 700; }
.folders .nav-link.active .count.unread { background: var(--accent); color: var(--accent-ink); }

/* Destinatários em etiquetas (Para, Cc, Cco) */
.recip-field { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; min-width: 160px; cursor: text; }
.recip-field .recip-entry { flex: 1; min-width: 140px; }
.recip-chip { display: inline-flex; align-items: center; gap: .25rem; max-width: 100%; padding: .15rem .25rem .15rem .6rem; border-radius: 999px; background: var(--accent-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); font-size: .84rem; line-height: 1.4; user-select: none; }
.recip-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recip-x { display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; border: 0; border-radius: 50%; background: transparent; color: var(--text-dim); font-size: 1rem; line-height: 1; cursor: pointer; padding: 0; }
.recip-x:hover { background: color-mix(in srgb, var(--text) 12%, transparent); color: var(--text); }

/* Lixeira: botão Limpar e-mails */
.btn-empty-trash { color: var(--danger); }
.btn-empty-trash:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* Modal "Sair sem enviar?" da tela de escrita */

/* Arquivos: lista e grade, miniaturas e seleção múltipla */
.files-card { overflow: visible; }
.files-head { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; border-bottom: 1px solid var(--border); min-height: 52px; flex-wrap: wrap; }
.files-head-default { flex: 1; display: grid; grid-template-columns: 44px 1fr 32px; gap: .75rem; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.files-head-info { display: grid; grid-template-columns: 1fr 110px 120px; gap: 1rem; }
.files-bulk { flex: 1; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.files-bulk[hidden], .files-head-default[hidden] { display: none; }
.files-move { display: inline-flex; gap: .35rem; align-items: center; }
.files-move .select { width: auto; max-width: 200px; }
.files-view { display: inline-flex; gap: .15rem; padding: .15rem; border: 1px solid var(--border); border-radius: 999px; }
.files-view .btn.is-active { background: var(--accent-soft); color: var(--accent-light); }
.files-check { display: inline-grid; place-items: center; width: 22px; flex-shrink: 0; cursor: pointer; }
.files-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.files { display: flex; flex-direction: column; }
.file-item { position: relative; display: grid; grid-template-columns: 22px 44px 1fr 32px; align-items: center; gap: .75rem; padding: .55rem 1rem; border-bottom: 1px solid var(--border); }
.file-item:last-child { border-bottom: 0; }
.file-item:hover { background: var(--surface-hover); }
.file-item.is-selected { background: var(--accent-soft); }
.file-thumb { width: 44px; height: 44px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); font-size: 1.15rem; text-decoration: none; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-info { min-width: 0; display: grid; grid-template-columns: 1fr 110px 120px; gap: 1rem; align-items: center; }
.file-info .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.file-meta { display: contents; color: var(--text-dim); font-size: .85rem; }
/* Cores por tipo */
.kind-folder { color: var(--accent-light); background: var(--accent-soft); border-color: transparent; }
.kind-pdf { color: #ff7b72; } .kind-excel { color: #3fb950; } .kind-word { color: #58a6ff; } .kind-powerpoint { color: #f0883e; }
.kind-image { color: #d2a8ff; } .kind-zipper { color: #e3b341; } .kind-audio, .kind-video { color: #f778ba; }

/* Grade */
.files.is-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; padding: 1rem; }
.files.is-grid .file-item { grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: .4rem .25rem; padding: .55rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.files.is-grid .file-item:hover { border-color: var(--accent); }
.files.is-grid .files-check { position: absolute; top: .9rem; left: .9rem; z-index: 2; background: var(--surface); border-radius: 6px; width: 26px; height: 26px; box-shadow: var(--shadow); }
.files.is-grid .file-thumb { grid-column: 1 / -1; width: 100%; height: auto; aspect-ratio: 4 / 3; font-size: 2.6rem; }
.files.is-grid .file-info { grid-template-columns: 1fr; gap: .1rem; }
.files.is-grid .file-meta { display: flex; gap: .5rem; font-size: .75rem; }
.files.is-grid .file-menu { align-self: start; }
.is-grid-view .files-head-default { visibility: hidden; }
.file-item > .file-menu { justify-self: end; }

@media (max-width: 720px) {
  .files-head-default { display: none; }
  .file-info { grid-template-columns: 1fr; gap: .1rem; }
  .file-meta { display: flex; gap: .6rem; font-size: .75rem; }
  .files.is-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; padding: .6rem; }
}

/* Login: manter conectado */
.remember-me { font-size: .88rem; color: var(--text-dim); }
.remember-me input { accent-color: var(--accent); }

/* Barra de aplicativos (só ícones) à esquerda das caixas */
.app-rail { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .85rem 0; background: var(--bg); border-right: 1px solid var(--border); overflow-y: auto; }
.rail-link { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--text-dim); text-decoration: none; font-size: 1.1rem; transition: background .15s, color .15s; }
.rail-link > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rail-link:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.rail-link.active { background: var(--accent-soft); color: var(--accent-light); }
.rail-link.active::before { content: ""; position: absolute; left: -10px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.rail-spacer { flex: 1; }
/* Dica com o nome ao passar o mouse */
@media (hover: hover) {
  .rail-link::after { content: attr(aria-label); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); padding: .3rem .6rem; border-radius: 6px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); font: 600 .78rem var(--font); white-space: nowrap; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 80; }
  .rail-link:hover::after, .rail-link:focus-visible::after { opacity: 1; }
  .app-rail { overflow: visible; }
}
/* Celular: a barra vira a navegação inferior */
@media (max-width: 760px) {
  .app-rail { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; flex-direction: row; justify-content: space-around; gap: 0; padding: .3rem .5rem calc(.3rem + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--border); background: var(--bg-alt); overflow: visible; }
  .rail-spacer { display: none; }
  .rail-link { width: auto; flex: 1; height: 52px; border-radius: 10px; font-size: 1.15rem; gap: .1rem; }
  .rail-link > span { position: static; width: auto; height: auto; clip: auto; font-size: .62rem; font-weight: 600; }
  .rail-link.active::before { left: 25%; right: 25%; top: -5px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .webmail .mail { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .webmail > .site-footer { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}

/* Acesso de suporte da equipe Kyrux */
.support-banner { flex-shrink: 0; display: flex; align-items: center; gap: .6rem; padding: .45rem 1.5rem; background: #E3B341; color: #1a1300; font-size: .82rem; }
.support-banner span { flex: 1; min-width: 0; }
.support-banner form { margin: 0; }
.support-banner .btn { background: rgba(0,0,0,.14); color: inherit; border: 0; }
.support-banner .btn:hover { background: rgba(0,0,0,.24); }
@media (max-width: 760px) { .support-banner { padding: .45rem 1rem; font-size: .76rem; } }

/* Tarefas: a linha abre a edição; prazo e horário no cadastro rápido */
.task[data-tk] { cursor: pointer; }
.task[data-tk]:hover { border-color: var(--border-strong); }
[data-tk-add] .task-add-due { max-width: 150px; }
[data-tk-add] .task-add-time { max-width: 110px; }
@media (max-width: 760px) {
  [data-tk-add] { flex-wrap: wrap; }
  [data-tk-add].row > .input-icon { flex: 1 1 100% !important; }
  [data-tk-add].row > .task-add-due, [data-tk-add].row > .task-add-time { flex: 1 1 0 !important; max-width: none; min-width: 0; }
  [data-tk-add] > .btn { flex: 1 1 100%; }
}

/* ------------------------------------------------------------------
   Celular: rodapé, busca, leitura de mensagens e agenda
   ------------------------------------------------------------------ */
.search-toggle { display: none; }
@media (max-width: 760px) {
  /* O rodapé "Desenvolvido por" sai do webmail no celular (a barra de apps ocupa o pé da tela). */
  .webmail > .site-footer { display: none; }

  /* Busca: botão de lupa no topo abre o campo sobre a barra */
  .search-toggle { display: inline-flex; }
  .webmail .topbar.search-open .search { display: flex !important; position: absolute; left: .75rem; right: 3.25rem; top: 50%; transform: translateY(-50%); z-index: 3; max-width: none; }
  .webmail .topbar.search-open .search .input { background: var(--surface); }
  .webmail .topbar.search-open > :not(.search):not(.search-toggle) { visibility: hidden; }
  .webmail .topbar.search-open .search-toggle { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); }

  .mail > *, .reader, .reader-body { min-width: 0; max-width: 100vw; }
  html:has(> body.webmail) { overflow-x: hidden; }
  /* Leitura: barra de ações em uma linha (rolagem lateral), cabeçalho compacto */
  .reader-toolbar:has([data-reader-action]) { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: .1rem; padding: .4rem .5rem; }
  .reader-toolbar:has([data-reader-action])::-webkit-scrollbar { display: none; }
  .reader-toolbar:has([data-reader-action]) > *, .reader-toolbar [data-reader-action] > * { flex-shrink: 0; }
  .reader-toolbar [data-reader-action], .reader-toolbar:has([data-reader-action]) > .inline-form { display: flex; align-items: center; gap: .1rem; flex-shrink: 0; }
  .reader-toolbar:has([data-reader-action]) .sep, .reader-toolbar:has([data-reader-action]) .spacer { display: none; }
  .reader-toolbar .move-to .select-sm { max-width: 120px; }
  /* Demais barras (Arquivos, Tarefas, Contatos…): quebram linha; a busca ocupa uma linha própria */
  .reader-toolbar:not(:has([data-reader-action])) { flex-wrap: wrap; row-gap: .5rem; }
  .reader-toolbar > [role=search], .reader-toolbar > form.input-icon { flex: 1 1 100%; max-width: none !important; order: 10; }
  .reader-subject h1 { font-size: 1.2rem; line-height: 1.3; }
  .quick-reply { gap: .4rem; flex-wrap: wrap; }
  .quick-reply > .btn { flex: 1 1 calc(50% - .4rem); justify-content: center; padding-inline: .5rem; }
  .mail-head { flex-wrap: wrap; padding: .85rem 1rem; gap: .7rem; }
  .mail-head .who { overflow-wrap: normal; }
  .mail-head .who .addr, .mail-head .who .to { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mail-head > .stack-sm { flex: 1 1 100%; flex-direction: row !important; justify-content: space-between; align-items: center !important; padding-left: 3.3rem; }
}

/* Agenda (mês) no celular: grade compacta + eventos do mês listados por dia */
.month-agenda { display: none; }
@media (max-width: 760px) {
  .month .day { min-height: 58px; padding: .2rem; }
  .month .ev { font-size: 0; height: 5px; padding: 0; border-radius: 3px; }
  .month .day-add { display: none; }
  .month-agenda { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
  .ma-day { display: flex; gap: .75rem; align-items: flex-start; }
  .ma-num { flex: 0 0 2.25rem; height: 2.25rem; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--text); font-weight: 700; font-family: var(--font-display); text-decoration: none; }
  .ma-day.today .ma-num { background: var(--accent); color: var(--accent-ink); }
  .ma-events { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .35rem; }
  .ma-ev { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--ev, var(--accent)); color: var(--text); text-decoration: none; min-width: 0; }
  .ma-ev .ma-time { flex-shrink: 0; font-size: .75rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
  .ma-ev .ma-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .88rem; }
  .ma-ev.ev-declined .ma-title { text-decoration: line-through; color: var(--text-faint); }
  /* Cabeçalho da agenda: título com navegação à direita; visões em linha própria */
  .reader-toolbar:has(.segmented) { flex-wrap: wrap; row-gap: .5rem; }
  .reader-toolbar .segmented { flex: 1 1 100%; }
  .reader-toolbar .segmented > a { flex: 1; text-align: center; }
  .cal-toolbar { padding: .75rem 1rem; column-gap: .25rem; }
  .cal-toolbar .cal-title { order: -1; flex: 1 1 auto; min-width: 0; margin: 0; font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cal-toolbar .cal-spacer { display: none; }
  .cal-toolbar .cal-today { order: 1; }
  .cal-toolbar .segmented { order: 2; }
}

/* Tarefas: título com linha de apoio (notas/lista), prazo e prioridade à direita */
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.task-main .task-title { flex: none; padding: .2rem .25rem; }
.task-sub { display: flex; align-items: center; gap: .6rem; min-width: 0; padding: 0 .25rem .15rem; font-size: .76rem; color: var(--text-faint); }
.task-sub .task-list { flex-shrink: 0; }
.task-sub .task-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { gap: .5rem; }
.task-meta .badge { white-space: nowrap; }
.task-prio { display: inline-flex; font-size: .85rem; }
.task-prio.prio-high { color: var(--danger); }
.task-prio.prio-mid { color: var(--warning); }
.task-mail { color: var(--text-faint); font-size: .9rem; }
.task-mail:hover { color: var(--accent-light); }
.task.is-high:not(.done) { box-shadow: inset 3px 0 0 var(--danger); }
.task-head { display: flex; align-items: center; gap: .5rem; }
.task-head-count { min-width: 1.35rem; padding: 0 .4rem; border-radius: 999px; background: var(--surface-2); color: var(--text-dim); font-size: .66rem; font-weight: 700; text-align: center; letter-spacing: 0; }
[data-tk-add] > .input-icon { flex: 1 1 180px; }
@media (min-width: 761px) { [data-tk-add] { flex-wrap: nowrap; } }
@media (max-width: 760px) {
  .task { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-areas: "s d m x" "s d t x"; align-items: center; column-gap: .3rem; row-gap: .1rem; padding: .5rem .35rem .5rem .6rem; }
  .task-handle, .tk-drag-hint { display: none; }
  .task-select { grid-area: s; }
  .task-done { grid-area: d; }
  .task-main { grid-area: m; }
  .task-meta { grid-area: t; width: auto; padding: 0 .25rem; justify-content: flex-start; }
  .task-meta:empty { display: none; }
  .task-menu { grid-area: x; }
  .task-main .task-title { white-space: normal; overflow: visible; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}

/* Modelos e assinaturas: editor visual ou HTML */
.segmented-sm > button { border: 0; background: transparent; color: var(--text-dim); font: 600 .78rem/1 var(--font); padding: .45rem .75rem; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; }
.segmented-sm > button.active { background: var(--accent); color: var(--accent-ink); }
.html-mode { display: flex; flex-direction: column; gap: .5rem; }
.html-mode[hidden] { display: none; }
.html-source { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: .8rem; line-height: 1.5; min-height: 220px; white-space: pre; tab-size: 2; }
.html-preview-head { display: flex; align-items: center; gap: .35rem; }
.html-preview { width: 100%; min-height: 220px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.html-editor .hint { margin: .25rem 0 0; }
.html-notes { margin: .35rem 0 0; padding-left: 1.1rem; }
.html-notes li { margin: .15rem 0; }

/* Escrever: modo HTML (código + pré-visualização no lugar do editor visual) */
.compose-html { padding: 1rem 1.1rem; }
.compose-html .html-preview { min-height: 360px; }
.is-html .editor-toolbar > :not(.compose-mode):not(.editor-extras) { display: none; }

/* Agenda: título e navegação */
.cal-nav { display: inline-flex; }
.cal-title { font-family: var(--font-display); font-size: 1.05rem; margin-left: .25rem; }
.cal-spacer { flex: 1; }
/* Agenda: cadastro rápido de evento (mesmo padrão do "Adicionar tarefa") */
.cal-add { margin-bottom: 1rem; }
.cal-add .cal-add-date { max-width: 150px; }
.cal-add .cal-add-time { max-width: 110px; }
@media (max-width: 760px) {
  .cal-add { flex-wrap: wrap; }
  .cal-add.row > .input-icon { flex: 1 1 100% !important; }
  .cal-add.row > .cal-add-date, .cal-add.row > .cal-add-time { flex: 1 1 0 !important; max-width: none; min-width: 0; }
  .cal-add > .btn { flex: 1 1 100%; }
}

/* Evento: dias da semana da repetição */
.weekday-picker { display: grid; grid-template-columns: repeat(7, minmax(0, 44px)); gap: .4rem; }
.weekday-picker .wd { position: relative; cursor: pointer; }
.weekday-picker .wd input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.weekday-picker .wd span[aria-hidden] { display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 50%; border: 1px solid var(--border-strong); color: var(--text-dim); font-weight: 700; font-size: .85rem; transition: background .15s, color .15s, border-color .15s; }
@media (hover: hover) { .weekday-picker .wd:hover span[aria-hidden] { border-color: var(--accent); color: var(--text); } }
.weekday-picker .wd input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.weekday-picker .wd input:focus-visible + span { outline: 3px solid var(--accent-light); outline-offset: 2px; }
/* No computador: Repetir e Número de vezes lado a lado, dias da semana embaixo */
.form-grid:has(> [data-weekdays]) { grid-auto-flow: row dense; }

/* Preferências › Aplicativo: passo a passo do iPhone */
.install-ios { padding: .25rem 1.25rem 1.1rem; font-size: .88rem; }
.install-ios ol { margin: .5rem 0; padding-left: 1.25rem; display: flex; flex-direction: column; gap: .35rem; }
.install-ios .hint { margin: 0; }

/* App instalado com tela cheia (viewport-fit=cover): conteúdo fora do recorte
   da câmera nas laterais; a barra de apps de baixo já respeita a barra de gestos. */
.webmail { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }

/* Preferências › Aplicativo: motivos para instalar; destaque ao chegar pelo site (#aplicativo) */
.install-perks { list-style: none; margin: 0; padding: .25rem 0 .75rem; display: grid; gap: .45rem; font-size: .88rem; color: var(--text-dim); }
.install-perks li { display: flex; align-items: flex-start; gap: .6rem; }
.install-perks i { color: var(--accent-light); width: 16px; margin-top: .2rem; }
.install-card { scroll-margin-top: 1rem; }
.install-card:target, .install-card.is-target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Login: faixa de instalação do app (sem precisar entrar) */
.install-login { width: 100%; max-width: 420px; margin: 1.5rem auto 0; padding: .75rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: .85rem; color: var(--text-dim); }
.install-login-row { display: flex; align-items: center; gap: .6rem; }
.install-login-row > i { color: var(--accent-light); font-size: 1rem; }
.install-login-row > span { flex: 1; min-width: 0; line-height: 1.4; }
.install-login-row .btn { flex-shrink: 0; }
.install-login-ios { margin: .5rem 0 0 1.6rem; line-height: 1.5; }
/* Fica embaixo, logo acima do rodapé; o cartão centraliza no espaço que sobra */
/* (só com a faixa visível; no app instalado ela some e vale o layout padrão) */
.auth-main > .install-login:not([hidden]) { margin-top: auto; }
.auth .auth-main > .install-login:not([hidden]) + .site-footer { margin-top: 0; padding-top: .75rem; }
