/* Layout: menu lateral fixo + área de conteúdo. A Agenda ocupa a altura toda (grade: colunas = profissionais,
   linhas = horários); as demais telas rolam e são feitas de blocos (números-resumo, gráficos, tabelas). */
:root {
  --bg: #f6f2f3;          /* fundo pó-de-arroz */
  --surface: #ffffff;
  --surface-2: #faf7f8;
  --ink: #2b1d23;
  --muted: #7b6870;
  --line: #e7dde1;
  --line-strong: #d3c4ca;
  --accent: #8a2846;      /* vinho / batom */
  --accent-ink: #ffffff;
  --accent-soft: #f5e3e9;
  --danger: #b3261e;
  --bom: #1d7a45;
  --focus: #c0567a;

  /* séries dos gráficos (entradas / saídas) */
  --s1: #2a78d6;
  --s2: #eb6834;

  /* status (fundo, borda, texto) */
  --ag-bg: #fdf1cf; --ag-bd: #e2b53f; --ag-tx: #5a4200;
  --cf-bg: #d9f1de; --cf-bd: #4aa564; --cf-tx: #154428;
  --cc-bg: #e1e8f4; --cc-bd: #7890ba; --cc-tx: #22324e;
  --ft-bg: #f9dede; --ft-bd: #cc5a59; --ft-tx: #5c1919;
  --bl-bg: #ebe6e8; --bl-bd: #b3a6ab; --bl-tx: #54464c;
  --fora: #efe9eb;

  --f-ui: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-display: "Young Serif", Georgia, "Times New Roman", serif;
  --r: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171214; --surface: #211a1d; --surface-2: #1c1619; --ink: #f2e9ec; --muted: #a8969d;
    --line: #372c31; --line-strong: #4a3c42; --accent: #e68aa6; --accent-ink: #2a0f19; --accent-soft: #3b2029;
    --danger: #ff8a80; --bom: #6fcf97; --focus: #e68aa6;
    --s1: #3987e5; --s2: #d95926;
    --ag-bg: #3f3312; --ag-bd: #b89331; --ag-tx: #f7e2a6;
    --cf-bg: #173723; --cf-bd: #4aa564; --cf-tx: #bfe8c9;
    --cc-bg: #1f2a3e; --cc-bd: #6f86b0; --cc-tx: #cbd8ef;
    --ft-bg: #43201f; --ft-bd: #cc5a59; --ft-tx: #f6c7c6;
    --bl-bg: #2c2528; --bl-bd: #5d4f55; --bl-tx: #cdbfc5;
    --fora: #1e181b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171214; --surface: #211a1d; --surface-2: #1c1619; --ink: #f2e9ec; --muted: #a8969d;
  --line: #372c31; --line-strong: #4a3c42; --accent: #e68aa6; --accent-ink: #2a0f19; --accent-soft: #3b2029;
  --danger: #ff8a80; --bom: #6fcf97; --focus: #e68aa6;
  --s1: #3987e5; --s2: #d95926;
  --ag-bg: #3f3312; --ag-bd: #b89331; --ag-tx: #f7e2a6;
  --cf-bg: #173723; --cf-bd: #4aa564; --cf-tx: #bfe8c9;
  --cc-bg: #1f2a3e; --cc-bd: #6f86b0; --cc-tx: #cbd8ef;
  --ft-bg: #43201f; --ft-bd: #cc5a59; --ft-tx: #f6c7c6;
  --bl-bg: #2c2528; --bl-bd: #5d4f55; --bl-tx: #cdbfc5;
  --fora: #1e181b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* até o sistema confirmar o login, o painel fica escondido (evita o menu "piscar" antes da senha) */
.aguardando .shell { visibility: hidden; }
.aguardando .login-caixa { visibility: hidden; }
.aguardando.sem-sessao .login-caixa { visibility: visible; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.45 var(--f-ui);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2 { margin: 0; text-wrap: balance; }

/* ---------- estrutura */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); height: 100%; }
.menu {
  display: flex; flex-direction: column; gap: 16px;
  padding: 18px 12px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.marca-nome {
  font-family: var(--f-display);
  font-size: 1.3rem;
  color: var(--accent);
  padding: 0 10px;
  line-height: 1.2;
}
.menu-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.menu-nav a, .menu-sair {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 0; border-radius: var(--r);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
}
.menu-nav a:hover, .menu-sair:hover { background: var(--surface-2); }
.menu-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.menu-nav svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.menu-grupo { margin: 12px 10px 2px; font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.menu-sair { margin-top: auto; color: var(--muted); }

.conteudo { min-width: 0; height: 100%; overflow-y: auto; }
.pagina { display: flex; flex-direction: column; gap: 14px; padding: 18px 22px 28px; max-width: 1240px; }
.pagina-agenda { height: 100%; min-height: 560px; max-width: none; gap: 10px; padding-block: 14px 10px; }

.pag-topo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.pag-topo h1 { font-family: var(--f-display); font-weight: 400; font-size: 1.55rem; }
.pag-topo .acoes { margin-left: auto; }
.sub { margin: 0; color: var(--muted); max-width: 70ch; }
.dica { margin: 0; font-size: .8rem; color: var(--muted); }
.nota { margin: 10px 0 0; font-size: .82rem; color: var(--muted); }
.nota:empty { display: none; }

/* ---------- botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface);
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  color: var(--ink);
  text-decoration: none;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn-icone { width: 36px; padding: 0; font-size: 1.3rem; line-height: 1; }
.btn-primario { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primario:hover { background: var(--accent); filter: brightness(1.08); }
.btn-fantasma { background: transparent; border-color: transparent; }
.btn-perigo { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-perigo:hover { background: var(--danger); color: var(--surface); border-color: var(--danger); }
.btn-peq { min-height: 30px; padding: 0 10px; font-size: .84rem; }
.btn:disabled { opacity: .55; cursor: default; }
.acoes { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- agenda: topo */
.topo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.nav-data { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }
.grupo-setas { display: inline-flex; }
.grupo-setas .btn:first-child { border-radius: var(--r) 0 0 var(--r); }
.grupo-setas .btn:last-child { border-radius: 0 var(--r) var(--r) 0; margin-left: -1px; }
.data-titulo {
  position: relative;
  font-family: var(--f-display);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.data-titulo:hover { background: var(--accent-soft); }
.data-titulo input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.data-titulo input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }

/* semana */
.semana { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.dia {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 6px 10px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface);
  cursor: pointer; text-align: left; min-width: 0;
}
.dia:hover { border-color: var(--accent); }
.dia .d-sem { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.dia .d-num { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.dia .d-qtd { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dia.hoje .d-num { color: var(--accent); }
.dia[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.dia[aria-selected="true"] .d-sem, .dia[aria-selected="true"] .d-qtd, .dia[aria-selected="true"] .d-num { color: var(--accent-ink); }

/* resumo + legenda */
.resumo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 18px; }
.resumo-num { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.resumo-num b { color: var(--ink); font-weight: 600; }
.legenda { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; list-style: none; font-size: .8rem; color: var(--muted); }
.legenda li { display: inline-flex; align-items: center; gap: 6px; }
.st { width: 12px; height: 12px; border-radius: 3px; border: 1px solid; display: inline-block; }
.st-agendado { background: var(--ag-bg); border-color: var(--ag-bd); }
.st-confirmado { background: var(--cf-bg); border-color: var(--cf-bd); }
.st-concluido { background: var(--cc-bg); border-color: var(--cc-bd); }
.st-faltou { background: var(--ft-bg); border-color: var(--ft-bd); }
.st-bloqueio { background: repeating-linear-gradient(135deg, var(--bl-bg) 0 3px, var(--bl-bd) 3px 4px); border-color: var(--bl-bd); }
.st-fora { background: var(--fora); border-color: var(--line-strong); }

.vazio-grade { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: var(--r); background: var(--surface); }
.vazio-grade p { margin: 0; flex: 1 1 280px; }

/* grade (EventCalendar) */
.grade { flex: 1 1 auto; min-height: 0; }
.grade .ec { height: 100%; }
.ec {
  --ec-bg-color: var(--surface);
  --ec-border-color: var(--line);
  --ec-text-color: var(--ink);
  --ec-today-bg-color: var(--surface);
  --ec-now-indicator-color: var(--accent);
  --ec-bg-event-color: var(--fora);
  --ec-bg-event-opacity: 1;
  --ec-event-col-gap: 4px;
  --ec-popup-bg-color: var(--surface);
  color-scheme: inherit;
}
.ec-main { border-radius: var(--r); border-color: var(--line-strong); background: var(--surface); }
.ec-toolbar { display: none; }
.ec-header .ec-col-head { padding: 8px 4px; background: var(--surface-2); }
.ec-time-grid .ec-sidebar { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; padding-inline: 10px; }
.ec-header .ec-sidebar { background: var(--surface-2); }
/* fora do expediente: hachurado + as mesmas linhas de horário da grade, para não "sumirem" */
.ec-bg-event {
  background-image:
    linear-gradient(to top, var(--line-strong) 1px, transparent 1px),
    repeating-linear-gradient(135deg, transparent 0 7px, var(--line) 7px 8px);
  background-size: 100% var(--ec-slot-height), auto;
}

.prof-cab { display: flex; align-items: center; gap: 8px; justify-content: center; min-width: 0; }
.avatar {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: .72rem; font-weight: 700; color: #fff; letter-spacing: .02em;
}
.prof-txt { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.2; }
.prof-nome { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.prof-qtd { font-size: .72rem; color: var(--muted); }

.ec-event.ag { border: 1px solid; border-left-width: 4px; border-radius: 6px; padding: 3px 6px; box-shadow: none; overflow: hidden; }
.ec-event.ag-agendado { background: var(--ag-bg); border-color: var(--ag-bd); color: var(--ag-tx); }
.ec-event.ag-confirmado { background: var(--cf-bg); border-color: var(--cf-bd); color: var(--cf-tx); }
.ec-event.ag-concluido { background: var(--cc-bg); border-color: var(--cc-bd); color: var(--cc-tx); }
.ec-event.ag-faltou { background: var(--ft-bg); border-color: var(--ft-bd); color: var(--ft-tx); }
.ec-event.ag-cancelado { background: var(--surface); border-color: var(--line-strong); border-style: dashed; color: var(--muted); opacity: .8; }
.ec-event.ag-cancelado .ag-cli { text-decoration: line-through; }
.ec-event.ag-bloqueio { background: repeating-linear-gradient(135deg, var(--bl-bg) 0 6px, transparent 6px 12px), var(--bl-bg); border-color: var(--bl-bd); color: var(--bl-tx); }
.ag-corpo { display: flex; flex-direction: column; min-width: 0; width: 100%; font-size: .8rem; line-height: 1.3; }
.ag-linha1 { display: flex; justify-content: space-between; gap: 6px; font-variant-numeric: tabular-nums; font-size: .74rem; opacity: .9; }
.ag-status { font-weight: 600; text-transform: uppercase; letter-spacing: .05em; font-size: .64rem; white-space: nowrap; }
.ag-cli { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-serv, .ag-obs { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-obs { font-style: italic; opacity: .85; }

/* ---------- blocos das telas de gestão */
.seletor-mes { display: inline-flex; align-items: center; gap: 6px; }
.seletor-mes .mes-rot { min-width: 150px; text-align: center; font-weight: 600; font-size: 1rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.tile { container-type: inline-size; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.tile-rot { font-size: .8rem; color: var(--muted); font-weight: 500; }
.tile-val { font-size: clamp(1.1rem, 11.5cqi, 1.6rem); font-weight: 700; letter-spacing: -.01em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-extra { font-size: .78rem; color: var(--muted); }
.delta { font-weight: 600; }
.delta.bom { color: var(--bom); }
.delta.ruim { color: var(--danger); }
.tile-destaque .tile-val { color: var(--accent); }

.painel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.painel-tabela { padding: 4px 0 0; }
.painel-tabela .painel-cab { padding: 10px 16px 0; }
.painel-cab { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 10px; }
.painel h2 { font-size: 1rem; font-weight: 700; }
.painel-sub { font-size: .8rem; color: var(--muted); }
.duas-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.grafico { position: relative; height: 260px; }
.grafico-baixo { height: 210px; }
.grafico svg { display: block; width: 100%; height: 100%; overflow: visible; }
.grafico .eixo { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.grafico .grade-linha { stroke: var(--line); stroke-width: 1; }
.grafico .base { stroke: var(--line-strong); stroke-width: 1; }
.grafico .alvo { fill: transparent; cursor: default; }
.grafico .alvo:hover + .marca-hover, .grafico .coluna-grupo:hover .alvo-fundo { fill: var(--surface-2); }
.legenda-graf { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); }
.legenda-graf span { display: inline-flex; align-items: center; gap: 6px; }
.legenda-graf i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.vazio { color: var(--muted); font-style: italic; margin: 0; padding: 8px 0; }

.barras-h { display: flex; flex-direction: column; gap: 8px; }
.barra-linha { display: grid; grid-template-columns: minmax(90px, 38%) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: .86rem; }
.barra-rot { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-trilho { height: 12px; }
.barra { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.barra-val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.barra-val small { color: var(--muted); font-weight: 400; margin-left: 4px; }

.filtros { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.filtro { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); font-weight: 500; }
.filtro select { width: auto; min-width: 180px; }

.segmento { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.segmento label { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; cursor: pointer; font-weight: 500; font-size: .88rem; }
.segmento label + label { border-left: 1px solid var(--line); }
.segmento label:has(input:checked) { background: var(--accent-soft); color: var(--accent); }
.segmento input { position: absolute; opacity: 0; pointer-events: none; }
.segmento label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.modal .segmento { margin-bottom: 14px; }

/* tabelas */
.tabela-rolagem { overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; min-width: 560px; }
.tabela th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line-strong); background: var(--surface); white-space: nowrap; }
.tabela td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabela tr.clicavel { cursor: pointer; }
.tabela tr.clicavel:hover td { background: var(--surface-2); }
.tabela td input:not([type="checkbox"]) { min-height: 34px; }
.tabela td:nth-child(2) input, .tabela td:nth-child(3) input, .tabela td:nth-child(4) input { max-width: 120px; font-variant-numeric: tabular-nums; }
.tabela .muted { color: var(--muted); }
.valor-entrada { color: var(--bom); font-weight: 600; }
.valor-saida { color: var(--ink); font-weight: 600; }
.tabela tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.acoes-linha { display: flex; gap: 6px; justify-content: flex-end; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; vertical-align: 1px; }
.tag-alerta { background: var(--ag-bg); color: var(--ag-tx); border-color: var(--ag-bd); }
.tag-perigo { background: var(--ft-bg); color: var(--ft-tx); border-color: var(--ft-bd); }
.pastilha { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }

/* comissões */
.lista-com { display: flex; flex-direction: column; gap: 10px; }
.com-item { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.com-cab { display: grid; grid-template-columns: minmax(150px, 1.4fr) repeat(4, minmax(90px, 1fr)) auto; align-items: center; gap: 12px; padding: 14px 16px; }
.com-nome { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 0; }
.com-num { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.com-num small { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.com-num b { font-size: 1.02rem; }
.com-num.apagar b { color: var(--accent); }
.com-item details { border-top: 1px solid var(--line); }
.com-item summary { cursor: pointer; padding: 8px 16px; color: var(--muted); font-size: .85rem; }
.com-item details .tabela-rolagem { padding: 0 4px 8px; }

/* profissionais */
.lista { display: flex; flex-direction: column; gap: 10px; }
.prof-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--surface); }
.prof-item.inativo { opacity: .6; }
.prof-linha { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.prof-linha input[type="text"] { flex: 1 1 200px; width: auto; }
.prof-linha input[type="color"] { width: 44px; padding: 3px; flex: none; }
.chk { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 6px; font-size: .85rem; white-space: nowrap; }
.chk input { width: auto; min-height: 0; accent-color: var(--accent); }
.expediente { display: grid; grid-template-columns: repeat(7, minmax(92px, 1fr)); gap: 6px; overflow-x: auto; }
.exp-dia { display: flex; flex-direction: column; gap: 4px; font-size: .75rem; }
.exp-dia b { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.exp-dia b input { width: auto; min-height: 0; accent-color: var(--accent); }
.exp-dia input[type="time"] { min-height: 30px; padding: 3px 6px; font-size: .82rem; }
.exp-dia.folga input[type="time"] { visibility: hidden; }
.exp-dia .folga-txt { display: none; color: var(--muted); font-style: italic; }
.exp-dia.folga .folga-txt { display: block; }
.salvo { color: var(--bom); font-size: .8rem; font-weight: 600; }

/* configurações */
.form-config { display: flex; flex-direction: column; gap: 12px; max-width: 820px; }
.form-config h2 { font-size: 1.05rem; margin-top: 6px; }
.campo { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; font-weight: 600; color: var(--muted); max-width: 420px; }
.chk-bloco { white-space: normal !important; align-items: flex-start !important; gap: 10px !important; font-size: .9rem !important; color: var(--ink); max-width: 70ch; line-height: 1.4; }
.chk-bloco input { margin-top: 3px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.presets .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.campos-cfg { grid-template-columns: repeat(3, minmax(0, 200px)); }
.previa { margin: 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); font-variant-numeric: tabular-nums; }

/* ---------- formulários e modais */
.modal {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 50px rgb(40 10 20 / .25);
}
.modal-largo { width: min(880px, calc(100vw - 32px)); }
.modal::backdrop { background: rgb(30 12 20 / .45); }
.modal-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal h2 { font-family: var(--f-display); font-weight: 400; font-size: 1.35rem; }
.modal .sub { margin: -4px 0 14px; }
.modal-rodape { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.espaco { flex: 1; }

.campos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.campos label { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; font-weight: 600; color: var(--muted); letter-spacing: .02em; min-width: 0; }
.campos .c2 { grid-column: span 2; }
.campos .c3 { grid-column: 1 / -1; }
input, select, textarea {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--ink);
  font-size: .95rem;
  font-weight: 400;
}
textarea { resize: vertical; }
input[type="radio"], input[type="checkbox"] { width: auto; min-height: 0; padding: 0; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.modo-bloqueio .so-atend { display: none; }
.sem-conclusao .so-concluido { display: none; }

.aviso {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 14px; padding: 10px 12px;
  border: 1px solid var(--ag-bd); background: var(--ag-bg); color: var(--ag-tx); border-radius: var(--r);
}
.aviso p { margin: 0; flex: 1 1 260px; }
.erro { color: var(--danger); margin: 10px 0 0; }

/* consulta do bot */
.campos-bot { grid-template-columns: 2fr 1.2fr 1.4fr .7fr; margin-bottom: 14px; }
.bot-resultado { display: flex; flex-direction: column; gap: 12px; max-height: 45vh; overflow: auto; }
.bot-dia h3 { margin: 0 0 6px; font-size: .95rem; }
.bot-dia h3 small { color: var(--muted); font-weight: 400; }
.bot-prof { display: grid; grid-template-columns: 130px 1fr; gap: 8px; align-items: start; padding: 6px 0; border-top: 1px solid var(--line); }
.bot-prof > span { font-weight: 600; padding-top: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { padding: 2px 8px; border-radius: 999px; background: var(--cf-bg); color: var(--cf-tx); border: 1px solid var(--cf-bd); font-size: .8rem; font-variant-numeric: tabular-nums; }
.bot-json summary { cursor: pointer; margin-top: 14px; color: var(--muted); font-weight: 500; }
.bot-json pre { max-height: 240px; overflow: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; font-size: .78rem; }

/* login */
.login { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 50; padding: 16px; }
.login-caixa { width: min(340px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 28px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; }
.login-caixa .marca-nome { padding: 0; }
.login-caixa label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .8rem; color: var(--muted); }

/* dica do gráfico e toast */
.dica-graf {
  position: fixed; z-index: 70; pointer-events: none;
  background: var(--ink); color: var(--bg);
  padding: 7px 10px; border-radius: 6px;
  font-size: .8rem; line-height: 1.4; font-variant-numeric: tabular-nums;
  box-shadow: 0 6px 18px rgb(0 0 0 / .18);
  max-width: 260px;
}
.dica-graf b { display: block; margin-bottom: 2px; }
.dica-graf i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: var(--r);
  font-weight: 500; z-index: 80;
  box-shadow: 0 8px 24px rgb(0 0 0 / .2);
}

/* ---------- telas menores */
@media (max-width: 1100px) {
  .com-cab { grid-template-columns: minmax(140px, 1fr) repeat(2, minmax(90px, 1fr)); }
  .com-cab .btn { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 900px) {
  html, body { height: auto; }
  .shell { display: block; height: auto; }
  .menu {
    position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
    flex-direction: row; align-items: center; gap: 10px;
    padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line);
    overflow-x: auto; overflow-y: hidden;
  }
  .marca-nome { font-size: 1.1rem; padding: 0 4px; white-space: nowrap; }
  .menu-nav { flex-direction: row; gap: 2px; }
  .menu-grupo { display: none; }
  .menu-sair { margin-top: 0; }
  .conteudo { height: auto; overflow: visible; }
  .pagina { padding: 14px 16px 24px; }
  .pagina-agenda { height: auto; }
  .grade { height: 72vh; flex: none; }
  .duas-col { grid-template-columns: 1fr; }
  .acoes .btn-primario { order: -1; }
}
@media (max-width: 640px) {
  .semana { gap: 4px; }
  .dia { padding: 5px 4px; align-items: center; }
  .dia .d-qtd, .dia .d-mes { display: none; }
  .campos, .campos-bot, .campos-cfg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .campos .c2, .campos .c3 { grid-column: 1 / -1; }
  .bot-prof { grid-template-columns: 1fr; }
  .dica { display: none; }
  .pag-topo .acoes { margin-left: 0; }
  .com-cab { grid-template-columns: 1fr 1fr; }
  .com-nome { grid-column: 1 / -1; }
  .barra-linha { grid-template-columns: minmax(80px, 34%) minmax(0, 1fr) auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
