/* AgendaFluxo — visual quieto: uma fonte, linhas finas, uma cor de ação.
   Tudo que é cor/tamanho está nos tokens abaixo: mude aqui e o app inteiro acompanha. */

:root {
  --papel: #ffffff;
  --papel-2: #f6f7f9;
  --papel-3: #eceef2;
  --grade: #eff1f4;                       /* linhas da grade: quase invisíveis de propósito */
  --grade-forte: #d8dce3;
  --tinta: #1c2430;
  --tinta-2: #5f6b7a;
  --tinta-3: #98a2b0;
  --marca: #ffe27a;                       /* marca-texto: hoje */
  --marca-wash: rgba(255, 226, 122, .10);
  --caneta: #2f5fe0;                      /* a única cor de ação */
  --caneta-hover: #2450c4;
  --caneta-wash: rgba(47, 95, 224, .12);
  --agora: #e0474c;                       /* a linha do agora */
  --erro: #c0343a;
  --ok: #178f6b;
  --sombra: 0 8px 28px rgba(28, 36, 48, .12);
  --fonte: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --hora-px: 52px;                        /* altura de 1 hora na grade */
  --gutter: 48px;
  color-scheme: light;
}

[data-tema="escuro"] {
  --papel: #12161e;
  --papel-2: #181d27;
  --papel-3: #202734;
  --grade: #1f2530;
  --grade-forte: #333c4c;
  --tinta: #e6eaf0;
  --tinta-2: #9aa5b5;
  --tinta-3: #66717f;
  --marca: #e3c94a;
  --marca-wash: transparent;              /* no escuro, só o número do dia marca o hoje */
  --caneta: #7fa1ff;
  --caneta-hover: #9db7ff;
  --caneta-wash: rgba(127, 161, 255, .16);
  --agora: #ff6b6f;
  --erro: #ff8085;
  --ok: #3ccf9e;
  --sombra: 0 8px 28px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --papel: #12161e;
    --papel-2: #181d27;
    --papel-3: #202734;
    --grade: #1f2530;
    --grade-forte: #333c4c;
    --tinta: #e6eaf0;
    --tinta-2: #9aa5b5;
    --tinta-3: #66717f;
    --marca: #e3c94a;
    --marca-wash: transparent;
    --caneta: #7fa1ff;
    --caneta-hover: #9db7ff;
    --caneta-wash: rgba(127, 161, 255, .16);
    --agora: #ff6b6f;
    --erro: #ff8085;
    --ok: #3ccf9e;
    --sombra: 0 8px 28px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------------ base */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font: 13px/1.45 var(--fonte);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--caneta); outline-offset: 2px; }
[hidden] { display: none !important; }
svg.icone { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

#app { display: flex; flex-direction: column; height: 100dvh; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px;
  padding: 0 12px; border-radius: 8px; border: 1px solid var(--grade-forte);
  background: var(--papel); color: var(--tinta); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--papel-2); }
.btn-primario { background: var(--caneta); border-color: var(--caneta); color: #fff; font-weight: 600; }
.btn-primario:hover { background: var(--caneta-hover); border-color: var(--caneta-hover); }
.btn-perigo { color: var(--erro); }
.btn-icone {
  width: 32px; height: 32px; padding: 0; display: inline-grid; place-items: center;
  border-radius: 8px; border: 0; background: transparent; cursor: pointer; color: var(--tinta-2);
}
.btn-icone:hover { background: var(--papel-2); color: var(--tinta); }
a.btn { text-decoration: none; }

/* ------------------------------------------------------------------ topo: uma linha */

.topo { flex: none; border-bottom: 1px solid var(--grade); background: var(--papel); }
.topo-linha { display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 16px; }
.titulo-periodo { font-size: 17px; font-weight: 400; margin: 0 8px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titulo-periodo b { font-weight: 600; }

.rapido { position: relative; flex: 1; max-width: 440px; margin: 0 auto; min-width: 0; }
#rapido-input {
  width: 100%; height: 32px; border: 1px solid transparent; border-radius: 8px; padding: 0 12px;
  background: var(--papel-2); color: var(--tinta); font: inherit; outline: none;
}
#rapido-input::placeholder { color: var(--tinta-3); }
#rapido-input:focus { background: var(--papel); border-color: var(--caneta); box-shadow: 0 0 0 3px var(--caneta-wash); }
.rapido-preview {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 6px; z-index: 30; display: none;
  background: var(--papel); border: 1px solid var(--grade-forte); border-radius: 8px; padding: 10px 12px;
  box-shadow: var(--sombra); font-size: 12px; color: var(--tinta-2);
}
.rapido-preview.ativo { display: block; }
.rapido-preview b { display: block; font-size: 13px; color: var(--tinta); margin-bottom: 2px; }
.rapido-preview .aviso { color: var(--erro); margin-top: 4px; }
.rapido-preview kbd { float: right; font: 11px var(--fonte); color: var(--tinta-3); border: 1px solid var(--grade-forte); border-radius: 4px; padding: 0 5px; }
.rapido-ok { display: none; }   /* botão Salvar da prévia: só no celular */
#btn-voz { display: none; }     /* microfone: só no celular, e só com SpeechRecognition (#app.com-voz) */

.visoes { display: flex; background: var(--papel-2); border-radius: 8px; padding: 2px; margin-left: 8px; }
.visoes button { border: 0; background: transparent; height: 28px; padding: 0 12px; border-radius: 6px; color: var(--tinta-2); cursor: pointer; }
.visoes button[aria-selected="true"] { background: var(--papel); color: var(--tinta); box-shadow: 0 1px 2px rgba(0, 0, 0, .10); }
.acoes { display: flex; align-items: center; gap: 2px; margin-left: 6px; }

/* régua: um fio na base do topo, pintado por projeto. Clique para ver o detalhe. */
.regua { position: relative; cursor: pointer; }
.regua-barra { position: relative; height: 3px; background: var(--papel-3); }
.regua-segs { display: flex; height: 100%; }
.regua-seg { height: 100%; flex: none; }
.regua-agora { position: absolute; top: -2px; width: 2px; height: 7px; background: var(--agora); transform: translateX(-1px); border-radius: 1px; }
.regua-detalhe { display: none; padding: 6px 16px 8px; font-size: 12px; color: var(--tinta-2); border-top: 1px solid var(--grade); }
.regua-detalhe b { color: var(--tinta); font-weight: 500; }
.regua-detalhe span + span::before { content: '·'; margin: 0 8px; color: var(--tinta-3); }
.regua-detalhe i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.regua.aberta .regua-detalhe { display: block; }
.regua:hover .regua-barra { height: 5px; margin-bottom: -2px; }

/* ------------------------------------------------------------------ visão */

.visao { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.vazio { margin: auto; text-align: center; color: var(--tinta-2); max-width: 320px; padding: 24px; }
.vazio b { display: block; font-size: 16px; color: var(--tinta); margin-bottom: 4px; }

/* grade (dia e semana) */
.grade { display: flex; flex-direction: column; height: 100%; --cols: repeat(var(--dias), minmax(0, 1fr)); }
.grade-cab, .grade-di { display: grid; grid-template-columns: var(--gutter) var(--cols); flex: none; }
.grade-cab { border-bottom: 1px solid var(--grade); }
.dia-cab {
  border: 0; background: transparent; color: var(--tinta-2); height: 44px; padding: 0 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; font-size: 12px;
}
.dia-cab:hover { color: var(--tinta); }
.dia-num { font-size: 16px; font-weight: 600; color: var(--tinta); min-width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 6px; }
.dia-cab.hoje { color: var(--tinta); font-weight: 500; }
.dia-cab.hoje .dia-num { background: var(--marca); color: #1c2430; }

.grade-di { border-bottom: 1px solid var(--grade); }
.grade-canto { }
.di-grid { grid-column: 2 / -1; display: grid; grid-template-columns: var(--cols); grid-auto-rows: 22px; gap: 2px 0; padding: 4px 0; }
.ev-di {
  margin: 0 3px; border: 0; border-radius: 4px; background: var(--cor); color: #fff; font-size: 12px; font-weight: 500;
  text-align: left; padding: 0 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; min-width: 0;
}
.ev-di.concluido, .ev-di.cancelado { opacity: .5; text-decoration: line-through; }

.grade-corpo {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: grid; grid-template-columns: var(--gutter) var(--cols); position: relative;
}
.grade-horas { position: relative; height: calc(24 * var(--hora-px)); }
.hora-rotulo { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--tinta-3); }
.grade-col {
  position: relative; height: calc(24 * var(--hora-px)); border-left: 1px solid var(--grade); min-width: 0;
  background-image: repeating-linear-gradient(to bottom, var(--grade) 0 1px, transparent 1px var(--hora-px));
}
.grade-col.hoje { background-color: var(--marca-wash); }

.ev {
  position: absolute; z-index: 1; border: 0; border-left: 3px solid var(--cor); border-radius: 4px;
  background: color-mix(in srgb, var(--cor) 14%, var(--papel));
  color: var(--tinta); font-size: 12px; line-height: 1.3; text-align: left; padding: 3px 7px; overflow: hidden; cursor: pointer;
}
.ev:hover { z-index: 2; background: color-mix(in srgb, var(--cor) 22%, var(--papel)); }
.ev-tit { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-hora { font-size: 11px; color: var(--tinta-2); display: block; }
.ev-proj { font-size: 11px; color: var(--tinta-2); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.curto { padding: 1px 7px; line-height: 1.15; }
.ev.curto .ev-hora, .ev.curto .ev-proj { display: none; }
.ev.concluido { opacity: .5; }
.ev.concluido .ev-tit { text-decoration: line-through; }
.ev.cancelado { border-left-style: dashed; opacity: .5; }
.ev.cancelado .ev-tit { text-decoration: line-through; }

.agora { position: absolute; left: 0; right: 0; height: 2px; background: var(--agora); z-index: 3; pointer-events: none; }
.agora::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--agora); }

/* mês */
.mes { display: flex; flex-direction: column; height: 100%; }
.mes-cab { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 12px; color: var(--tinta-2); text-align: center; padding: 10px 0; border-bottom: 1px solid var(--grade); flex: none; }
.mes-grade { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(88px, 1fr); min-height: 0; overflow-y: auto; -webkit-user-select: none; user-select: none; }
/* segurar o dedo abre "Mover dia": nada de seleção de texto nem menu nativo do sistema */
.mes-dia { border-right: 1px solid var(--grade); border-bottom: 1px solid var(--grade); padding: 6px 4px 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.mes-dia:nth-child(7n) { border-right: 0; }
/* mover dia: o número é arrastável; o dia embaixo do arrasto acende; enquanto arrasta, os chips não roubam o drop */
.mes-num[draggable="true"] { cursor: grab; }
.mes-dia.alvo { background: var(--caneta-wash); box-shadow: inset 0 0 0 2px var(--caneta); }
.mes.arrastando .chip, .mes.arrastando .mais { pointer-events: none; }
.mes-dia.fora { color: var(--tinta-3); }
.mes-dia.fora .mes-num { color: var(--tinta-3); }
.mes-dia.hoje { background: var(--marca-wash); }
.mes-num { align-self: flex-start; border: 0; background: transparent; font-size: 13px; font-weight: 500; color: var(--tinta); min-width: 24px; height: 24px; padding: 0 6px; border-radius: 6px; cursor: pointer; margin-left: 2px; }
.mes-num:hover { background: var(--papel-2); }
.mes-dia.hoje .mes-num { background: var(--marca); color: #1c2430; }
.chip { display: flex; align-items: center; gap: 5px; border: 0; background: transparent; font-size: 12px; color: var(--tinta); text-align: left; padding: 1px 6px; border-radius: 4px; cursor: pointer; min-width: 0; width: 100%; }
.chip:hover { background: var(--papel-2); }
.chip .ponto { width: 7px; height: 7px; border-radius: 50%; background: var(--cor); flex: none; }
.chip-hora { font-size: 11px; color: var(--tinta-2); flex: none; }
.chip-tit { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.chip-di { background: var(--cor); color: #fff; }
.chip.chip-di:hover { filter: brightness(1.08); }
.chip.concluido .chip-tit, .chip.cancelado .chip-tit { text-decoration: line-through; opacity: .6; }
.mais { border: 0; background: transparent; color: var(--tinta-2); font-size: 11px; text-align: left; padding: 0 6px; cursor: pointer; }
.mais:hover { color: var(--caneta); }

/* ------------------------------------------------------------------ diálogos */

dialog.dlg {
  border: 0; border-radius: 12px; padding: 0; width: min(540px, calc(100vw - 32px));
  background: var(--papel); color: var(--tinta); box-shadow: var(--sombra); max-height: calc(100dvh - 32px);
}
dialog::backdrop { background: rgba(28, 36, 48, .4); }
.dlg-corpo { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px 22px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.dlg-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.dlg-cab h2 { font-size: 16px; font-weight: 600; margin: 0; min-width: 0; }
.dlg-cab small { display: block; font-size: 12px; color: var(--tinta-2); font-weight: 400; margin-top: 2px; }
.dlg-rodape { display: flex; gap: 8px; align-items: center; padding-top: 12px; border-top: 1px solid var(--grade); flex-wrap: wrap; }
.espaco { flex: 1; }

.campo { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--tinta-2); min-width: 0; }
.campo input, .campo select, .campo textarea, .entrada {
  font: inherit; font-size: 13px; height: 34px; padding: 0 10px; border: 1px solid var(--grade-forte); border-radius: 8px;
  background: var(--papel); color: var(--tinta); width: 100%; min-width: 0;
}
.campo textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 60px; }
.campo input:focus, .campo select:focus, .campo textarea:focus, .entrada:focus { outline: none; border-color: var(--caneta); box-shadow: 0 0 0 3px var(--caneta-wash); }
.campo-titulo { font: inherit; font-size: 18px; font-weight: 600; border: 0; border-bottom: 1px solid var(--grade-forte); background: transparent; padding: 6px 0; width: 100%; color: var(--tinta); border-radius: 0; }
.campo-titulo:focus { outline: none; border-bottom-color: var(--caneta); }
.linha { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.campo-aviso { margin: 0; font-size: 12px; color: var(--tinta-2); align-self: end; padding-bottom: 8px; }
.linha-data { display: flex; gap: 6px; }
.linha-data input[type="date"] { flex: 1.5; }
.linha-data input[type="time"] { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--caneta); margin: 0; }

.tipos { display: flex; gap: 6px; flex-wrap: wrap; }
.tipo { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--grade-forte); cursor: pointer; font-size: 12px; color: var(--tinta-2); }
.tipo input { position: absolute; opacity: 0; width: 0; height: 0; }
.tipo svg.icone { width: 13px; height: 13px; color: var(--cor); }
.tipo:has(input:checked) { background: color-mix(in srgb, var(--cor) 12%, var(--papel)); border-color: var(--cor); color: var(--tinta); }
.tipo:has(input:focus-visible) { outline: 2px solid var(--caneta); outline-offset: 2px; }

fieldset { border: 1px solid var(--grade); border-radius: 8px; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 10px; margin: 0; min-width: 0; }
legend { font-size: 12px; color: var(--tinta-2); padding: 0 4px; }
.rec-linha { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec-linha input[type="number"] { width: 60px; }
.rec-linha input[type="date"] { width: auto; }
.dias-semana { display: flex; gap: 4px; }
.dias-semana button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--grade-forte); background: transparent; color: var(--tinta-2); font-size: 12px; font-weight: 500; cursor: pointer; }
.dias-semana button[aria-pressed="true"] { background: var(--caneta); color: #fff; border-color: var(--caneta); }
.rec-resumo { margin: 0; font-size: 12px; color: var(--tinta-2); }

.cor-extra summary { cursor: pointer; font-size: 12px; color: var(--tinta-2); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; background: var(--cor); padding: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.swatch[aria-pressed="true"] { border-color: var(--tinta); }
.swatch.auto { background: linear-gradient(135deg, var(--papel-3) 50%, var(--grade-forte) 50%); }
.swatches input[type="color"] { width: 24px; height: 24px; border: 0; padding: 0; background: none; cursor: pointer; }

.realizado { background: var(--papel-2); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.realizado > b { font-weight: 600; }
.realizado > small { color: var(--tinta-2); }

.escopo-botoes { display: flex; flex-direction: column; gap: 8px; }
.escopo-botoes .btn { justify-content: flex-start; height: auto; padding: 10px 14px; }
.escopo-botoes small { display: block; color: var(--tinta-2); font-weight: 400; }

/* mover dia: uma linha por compromisso, marcável */
.mover-lista { display: flex; flex-direction: column; gap: 2px; max-height: 44vh; overflow-y: auto; }
.mover-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; min-width: 0; }
.mover-item:hover { background: var(--papel-2); }
.mover-item input { width: 16px; height: 16px; accent-color: var(--caneta); margin: 0; flex: none; }
.mover-item .ponto { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.mover-hora { font-size: 12px; color: var(--tinta-2); flex: none; min-width: 36px; }
.mover-tit { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mover-item svg.icone { width: 13px; height: 13px; color: var(--tinta-3); }
.mover-item.concluido .mover-tit, .mover-item.cancelado .mover-tit { text-decoration: line-through; color: var(--tinta-2); }
#form-mover input[type="date"].entrada { width: auto; }
#mover-nota { align-self: flex-start; padding: 0; }

/* projetos */
.lista-proj { display: flex; flex-direction: column; gap: 2px; max-height: 38vh; overflow-y: auto; }
.proj-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; border: 0; background: transparent; text-align: left; cursor: pointer; width: 100%; }
.proj-item:hover, .proj-item[aria-current="true"] { background: var(--papel-2); }
.proj-cor { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.proj-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-area { font-size: 11px; color: var(--tinta-3); }
.proj-item.arquivado { opacity: .5; }

/* configurações: uma linha por opção (rótulo à esquerda, valor à direita); a ajuda fica atrás de <details> */
.cfg-bloco { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; border-top: 1px solid var(--grade); }
.cfg-bloco h3 { margin: 0 0 2px; font-size: 13px; font-weight: 600; }
.cfg-linha { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; }
.cfg-linha > span:first-child, .cfg-linha > p { margin: 0; font-size: 13px; color: var(--tinta-2); min-width: 0; }
.cfg-linha small { color: var(--tinta-3); }
.cfg-valor { display: flex; align-items: center; gap: 6px; flex: none; margin-left: auto; color: var(--tinta-2); font-size: 13px; }
.cfg-valor input[type="number"] { width: 56px; text-align: center; }
.cfg-linha select.entrada { width: auto; max-width: 60%; }
.btn-sutil { height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--tinta-2); cursor: pointer; white-space: nowrap; }
.btn-sutil:hover { background: var(--papel-2); color: var(--tinta); }
.cfg-linha > .btn-sutil { margin-left: auto; }
.segmento { display: flex; background: var(--papel-2); border-radius: 8px; padding: 2px; }
.segmento label { flex: 1; position: relative; }
.segmento input { position: absolute; opacity: 0; width: 0; height: 0; }
.segmento span { display: block; text-align: center; height: 30px; line-height: 30px; border-radius: 6px; color: var(--tinta-2); cursor: pointer; }
.segmento input:checked + span { background: var(--papel); color: var(--tinta); font-weight: 500; box-shadow: 0 1px 2px rgba(0, 0, 0, .10); }
.segmento input:focus-visible + span { outline: 2px solid var(--caneta); outline-offset: 2px; }
.ajuda summary { cursor: pointer; font-size: 12px; color: var(--tinta-3); }
.ajuda summary:hover { color: var(--tinta-2); }
.ajuda p { margin: 6px 0 0 14px; font-size: 12px; line-height: 1.5; color: var(--tinta-2); }
.copiar { display: flex; gap: 6px; }
.copiar input { flex: 1; min-width: 0; font-size: 13px; }
.ok-texto { color: var(--ok); }
.ok-texto::before { content: '●'; margin-right: 6px; font-size: 9px; vertical-align: 1px; }
#cron-status { flex: 1; }
#cron-status.alerta { color: var(--erro); }
.cfg-importar { display: flex; align-items: center; gap: 8px; }
.cfg-importar span { flex: 1; min-width: 0; font-size: 12px; color: var(--tinta-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfg-importar select { width: auto; }
.cfg-senha { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 0 14px; }
.cfg-senha .btn { align-self: flex-start; }
.cfg-senha.sem-recuo { margin-left: 0; }   /* formulário que já está dentro de um bloco, não de uma ajuda */
.cfg-nota { margin: 0; font-size: 13px; color: var(--tinta-2); }
.cfg-recuo { margin: 8px 0 0 14px; }
.ajuda p .btn-sutil { margin-left: -10px; }
/* Contas (administrador): uma linha por conta, nome à esquerda e o resto discreto à direita */
.contas-lista { display: flex; flex-direction: column; }
.conta-item { display: flex; align-items: center; gap: 10px; min-height: 44px; border-top: 1px solid var(--grade); }
.conta-item:first-child { border-top: 0; }
.conta-quem { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.conta-quem b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conta-quem small { font-size: 12px; color: var(--tinta-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atalhos { font-size: 12px; color: var(--tinta-3); }
code { font: inherit; font-size: 12px; background: var(--papel-2); border-radius: 4px; padding: 0 4px; }
kbd { font: inherit; font-size: 11px; border: 1px solid var(--grade-forte); border-radius: 4px; padding: 0 4px; }

/* login */
.login { position: fixed; inset: 0; display: grid; place-items: center; background: var(--papel-2); }
.login-card { width: min(340px, calc(100vw - 32px)); background: var(--papel); border: 1px solid var(--grade); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 18px; font-weight: 600; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
/* miniatura do ícone do app: quadrado azul, página branca, dia de hoje em amarelo */
.logo { width: 22px; height: 22px; border-radius: 6px; background: #2f5fe0; position: relative; flex: none; }
.logo::before { content: ''; position: absolute; inset: 5px; background: #fff; border-radius: 3px; }
.logo::after { content: ''; position: absolute; left: 10px; top: 10px; width: 6px; height: 6px; background: #ffe27a; border-radius: 1.5px; }
.login-card .erro { color: var(--erro); font-size: 12px; margin: 0; min-height: 1.2em; }
.login-card .btn { height: 36px; justify-content: center; }

/* toasts */
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 100; pointer-events: none; }
.toast { background: var(--tinta); color: var(--papel); padding: 9px 14px; border-radius: 8px; font-size: 13px; box-shadow: var(--sombra); animation: subir .18s ease-out; max-width: calc(100vw - 32px); }
.toast.erro { background: var(--erro); color: #fff; }
.toast.acao { pointer-events: auto; cursor: pointer; background: var(--caneta); color: #fff; }   /* fica até tocar */
@keyframes subir { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ celular */

@media (max-width: 720px) {
  :root { --hora-px: 48px; --gutter: 40px; }
  /* campos com 16px para o iPhone não dar zoom ao focar */
  input, select, textarea, #rapido-input, .campo input, .campo select, .campo textarea, .entrada { font-size: 16px; }
  /* topo: [Hoje ‹ título › projetos config] e a entrada rápida embaixo */
  .topo-linha {
    display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
    grid-template-areas: "hoje ant titulo prox proj cfg" "rapido rapido rapido rapido rapido rapido";
    height: auto; padding: 6px 10px 8px; row-gap: 8px; column-gap: 0;
  }
  .acoes { display: contents; }
  #btn-hoje { grid-area: hoje; height: 36px; padding: 0 10px; }
  #btn-ant { grid-area: ant; width: 36px; height: 36px; }
  #btn-prox { grid-area: prox; width: 36px; height: 36px; }
  #btn-projetos { grid-area: proj; width: 36px; height: 36px; }
  #btn-config { grid-area: cfg; width: 36px; height: 36px; }
  .titulo-periodo { grid-area: titulo; font-size: 15px; margin: 0 2px; text-align: center; }
  .rapido { grid-area: rapido; max-width: none; margin: 0; }
  #rapido-input { height: 38px; }
  /* barra inferior: visões à esquerda, novo evento à direita */
  #app { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .visoes {
    position: fixed; z-index: 20; left: 12px; right: 72px; bottom: calc(12px + env(safe-area-inset-bottom));
    height: 50px; margin: 0; padding: 4px; border-radius: 14px; background: var(--papel); border: 1px solid var(--grade-forte); box-shadow: var(--sombra);
  }
  .visoes button { flex: 1; height: 100%; border-radius: 10px; font-size: 14px; }
  .visoes button[aria-selected="true"] { background: var(--papel-2); box-shadow: none; font-weight: 600; }
  #btn-novo {
    position: fixed; z-index: 20; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
    width: 50px; height: 50px; border-radius: 14px; background: var(--caneta); color: #fff; box-shadow: var(--sombra);
  }
  #btn-novo svg.icone { width: 22px; height: 22px; stroke-width: 2; }
  /* microfone ao lado do "+", só quando o navegador reconhece voz; ouvindo: pulsa em azul */
  #btn-voz {
    position: fixed; z-index: 20; right: 70px; bottom: calc(12px + env(safe-area-inset-bottom));
    width: 50px; height: 50px; border-radius: 14px; background: var(--papel); border: 1px solid var(--grade-forte); color: var(--caneta); box-shadow: var(--sombra);
  }
  #app.com-voz #btn-voz { display: inline-grid; }
  #app.com-voz .visoes { right: 130px; }
  #btn-voz svg.icone { width: 22px; height: 22px; stroke-width: 2; }
  #btn-voz.ouvindo { background: var(--caneta); border-color: var(--caneta); color: #fff; animation: pulsar 1s ease-in-out infinite; }
  @keyframes pulsar { 0%, 100% { box-shadow: 0 0 0 0 var(--caneta); } 50% { box-shadow: 0 0 0 10px var(--caneta-wash); } }
  .rapido-preview kbd { display: none; }
  .rapido-ok { display: inline-block; float: right; height: 30px; padding: 0 14px; border: 0; border-radius: 8px; background: var(--caneta); color: #fff; font: inherit; font-size: 13px; font-weight: 600; margin-left: 8px; }
  #toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .regua-detalhe { padding: 6px 12px 8px; }
  /* formulários sobem como uma folha, de baixo para cima */
  dialog.dlg { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 94dvh; }
  .dlg-corpo { max-height: 94dvh; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
  .dlg-rodape .btn { height: 40px; }
  .dia-cab { flex-direction: column; gap: 0; height: 46px; font-size: 11px; padding: 0 2px; }
  .dia-num { font-size: 15px; min-width: 24px; height: 24px; }
  .ev { font-size: 11px; padding: 2px 4px; border-left-width: 2px; }
  .ev-hora, .ev-proj { display: none; }
  /* em blocos altos o título quebra em até 3 linhas em vez de cortar */
  .ev:not(.curto) .ev-tit { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: normal; overflow-wrap: normal; hyphens: auto; }
  .ev-di { font-size: 11px; padding: 0 5px; margin: 0 1px; }
  .hora-rotulo { font-size: 10px; right: 4px; }
  .mes-grade { grid-auto-rows: minmax(64px, 1fr); }
  .mes-dia { padding: 3px 2px 2px; }
  .chip { font-size: 11px; padding: 0 3px; gap: 4px; }
  .chip-hora { display: none; }
  .linha { grid-template-columns: 1fr; }
  .cfg-linha { flex-wrap: wrap; }      /* valor largo (botões do Telegram) desce para a linha de baixo, à direita */
  #cron-status { flex-basis: 100%; }   /* o estado do cron ocupa a linha toda; "Verificar agora" desce */
  .atalhos { display: none; }          /* atalhos de teclado não fazem sentido no celular */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
