/* Painel de trabalho: mesmo prata, preto e laranja do site, com foco em leitura rápida. */
:root {
  color-scheme: dark;
  --ink: #0a0b0e;
  --panel: #15171c;
  --panel-2: #1d2027;
  --line: #2b2e35;
  --text: #f3f4f6;
  --muted: #a4abb6;
  --orange: #f26a1b;
  --orange-hover: #ff7f33;
  --on-orange: #150a03;
  --good: #49c78a;
  --warn: #f2b84b;
  --bad: #ff7a70;
  --display: "Saira", "Arial Narrow", Arial, sans-serif;
  --body: "Figtree", "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ink); color: var(--text); font: 400 1rem/1.5 var(--body); font-variant-numeric: tabular-nums; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); margin: 0; }
h1 { font-style: italic; font-weight: 800; font-size: clamp(1.625rem, 3vw, 2.25rem); line-height: 1.1; }
h2 { font-size: 1.125rem; font-weight: 800; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 8px 16px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; text-decoration: none; font-weight: 500; }
.btn:hover { border-color: var(--muted); }
.btn.primario { background: var(--orange); border-color: var(--orange); color: var(--on-orange); font-weight: 700; }
.btn.primario:hover { background: var(--orange-hover); }
.btn.perigo { color: var(--bad); }
.btn.pequeno { min-height: 34px; padding: 4px 10px; font-size: .875rem; }
.btn:disabled { opacity: .6; cursor: default; }

/* Login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login form { width: min(380px, 100%); display: grid; gap: 16px; background: var(--panel); padding: 28px; border-radius: 4px; }
.login img { width: 120px; height: auto; justify-self: center; }

/* Estrutura */
.topo { position: sticky; top: 0; z-index: 3; background: var(--ink); border-bottom: 1px solid var(--line); }
.topo-in { max-width: 1400px; margin: auto; padding: 8px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 20px; }
.topo img { width: 62px; height: auto; display: block; }
.abas { display: flex; gap: 2px; overflow-x: auto; align-self: end; min-width: 0; }
.aba { flex: none; padding: 12px 14px; background: none; border: 0; border-bottom: 3px solid transparent; color: var(--muted); cursor: pointer; font-weight: 700; }
.aba:hover { color: var(--text); }
.aba[aria-selected="true"] { color: var(--text); border-color: var(--orange); }
.pagina { max-width: 1400px; margin: auto; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 20px; }
.cabeca { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.vazio { padding: 28px 16px; color: var(--muted); text-align: center; background: var(--panel); border-radius: 4px; }
.mudo { color: var(--muted); font-size: .875rem; }

/* Totais */
.totais { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.total { background: var(--panel); padding: 12px 14px; border-radius: 4px; min-width: 0; }
.total b { display: block; font: 800 clamp(1.125rem, 2.2vw, 1.5rem)/1.2 var(--display); overflow-wrap: anywhere; }
.total span { color: var(--muted); font-size: .875rem; }

/* Etiquetas */
.tag { display: inline-block; padding: 1px 8px; border: 1px solid var(--line); border-radius: 3px; font-size: .75rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.tag.site { color: var(--orange); border-color: var(--orange); }
.tag.bom { color: var(--good); border-color: var(--good); }
.tag.alerta { color: var(--warn); border-color: var(--warn); }
.tag.ruim { color: var(--bad); border-color: var(--bad); }

/* CRM */
.funil { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.coluna { background: var(--panel); border-radius: 4px; padding: 10px; display: grid; gap: 8px; min-width: 0; }
.coluna > h2 { display: flex; justify-content: space-between; align-items: baseline; font-size: 1rem; padding: 2px 4px; }
.coluna > h2 span { color: var(--muted); font: 500 .875rem var(--body); }
.cartao { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 10px; display: grid; gap: 7px; min-width: 0; }
.cartao-nome { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font-weight: 700; overflow-wrap: anywhere; text-decoration: underline; text-decoration-color: transparent; }
.cartao-nome:hover { text-decoration-color: currentColor; }
.cartao .linha { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.cartao p { font-size: .875rem; color: var(--muted); overflow-wrap: anywhere; }
.cartao select { width: 100%; min-height: 34px; background: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 3px 6px; font-size: .875rem; }

/* Tabela */
.tabela-caixa { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 4px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .8125rem; font-weight: 700; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.link-nome { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 700; text-align: left; text-decoration: underline; text-decoration-color: var(--line); overflow-wrap: anywhere; }
.alterna { min-height: 34px; padding: 3px 12px; border-radius: 4px; border: 1px solid var(--line); background: none; cursor: pointer; font-weight: 700; font-size: .875rem; white-space: nowrap; }
.alterna.pago { color: var(--good); border-color: var(--good); }
.alterna.pendente { color: var(--warn); border-color: var(--warn); }
.alterna.atrasado { color: var(--bad); border-color: var(--bad); }

/* Navegação de mês */
.mes-nav { display: flex; align-items: center; gap: 6px; }
.mes-nav strong { min-width: 150px; text-align: center; font-family: var(--display); }

/* Agenda */
.agenda-grade { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.semana { text-align: center; color: var(--muted); font-size: .8125rem; font-weight: 700; padding-block: 4px; }
.dia { min-height: 96px; background: var(--panel); border: 1px solid transparent; border-radius: 3px; padding: 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dia.fora { background: transparent; }
.dia.hoje { border-color: var(--muted); }
.dia.reservado { background: #2a1b12; }
.dia-num { align-self: flex-start; background: none; border: 0; padding: 2px 6px; border-radius: 3px; cursor: pointer; font-weight: 700; font-size: .875rem; min-width: 30px; }
.dia-num:hover { background: var(--panel-2); }
.evento-chip { display: block; width: 100%; padding: 2px 5px; border: 0; border-left: 3px solid var(--orange); border-radius: 2px; background: var(--panel-2); text-align: left; font-size: .75rem; line-height: 1.25; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evento-chip.a_confirmar { border-left-color: var(--warn); }
.evento-chip.realizado { border-left-color: var(--good); }
.evento-chip.cancelado { border-left-color: var(--muted); text-decoration: line-through; color: var(--muted); }
.lista-eventos { display: grid; gap: 6px; }
.item-evento { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; align-items: center; gap: 12px; background: var(--panel); border-radius: 4px; padding: 10px 12px; }
.item-evento .quando { font: 800 1.125rem/1.1 var(--display); }
.item-evento .quando small { display: block; color: var(--muted); font: 400 .75rem var(--body); }

/* Formulário */
dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; }
dialog::backdrop { background: rgba(5, 6, 8, .78); }
.form { display: grid; gap: 14px; padding: 20px; }
.form-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.campo { display: grid; gap: 4px; min-width: 0; }
.campo.largo { grid-column: 1 / -1; }
.campo label { font-size: .875rem; font-weight: 700; }
input:not([type="checkbox"]), select, textarea { width: 100%; min-height: 42px; padding: 8px 10px; background: var(--ink); border: 1px solid var(--line); border-radius: 4px; }
textarea { min-height: 84px; resize: vertical; }
.form-erro { color: var(--bad); font-size: .9375rem; }
.form-alerta { color: var(--warn); font-size: .9375rem; }
.form-pe { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.conversao { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }

#aviso { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 20; max-width: calc(100vw - 32px); background: var(--text); color: var(--ink); padding: 9px 16px; border-radius: 4px; font-weight: 700; }

@media (max-width: 760px) {
  .topo-in { grid-template-columns: auto 1fr; }
  .abas { grid-column: 1 / -1; grid-row: 2; scrollbar-width: none; }
  .aba { padding: 10px 8px; font-size: .875rem; }
  .sair { justify-self: end; }
  .totais { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .funil { grid-auto-columns: 80%; }
  .form-grade { grid-template-columns: minmax(0, 1fr); }
  .dia { min-height: 56px; padding: 2px; align-items: center; }
  .dia-num { min-width: 28px; padding: 4px; }
  .dia .evento-chip { display: none; }
  .dia.reservado .dia-num { color: var(--orange); }
  .dia .contagem { display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }
  table.responsiva thead { display: none; }
  table.responsiva, table.responsiva tbody, table.responsiva tr, table.responsiva td { display: block; }
  table.responsiva tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.responsiva tr:last-child { border-bottom: 0; }
  table.responsiva td { padding: 3px 0; border: 0; text-align: left; }
  table.responsiva td[data-rotulo]::before { content: attr(data-rotulo) ": "; color: var(--muted); font-size: .875rem; }
}
@media (min-width: 761px) { .dia .contagem { display: none; } }
