/* ==========================================================================
   CRM reZeta — base de estilo (Fase 0)
   Tokens em :root, tema escuro por data-theme. Sem framework.
   ========================================================================== */

:root {
  --brand: #22aaa1;
  --brand-dark: #178f87;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f0f2f5;
  --border: #dfe3e8;
  --text: #1c2024;
  --text-muted: #5f6b76;
  --danger: #d4342c;
  --warn: #c77700;
  --ok: #1a7f52;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #15181c;
  --surface: #1d2126;
  --surface-soft: #23282e;
  --border: #31373f;
  --text: #e8eaed;
  --text-muted: #9aa4b0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Login ---------- */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.login__card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
}

.login__brand {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}

.login__sub {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 22px;
}

/* ---------- Formulário ---------- */

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 550;
  margin-bottom: 5px;
}

.input {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color .15s, box-shadow .15s;
}

.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
}

.input[aria-invalid="true"] { border-color: var(--danger); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 550;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}

.btn:hover:not(:disabled) { background: var(--border); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn--primary {
  width: 100%;
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.btn--primary:hover:not(:disabled) { background: var(--brand-dark); }

/* ---------- Mensagens ---------- */

.alert {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 16px;
}

.alert--error {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 100;
}

.toast {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  max-width: 340px;
}

.toast--error { border-left-color: var(--danger); }
.toast--ok { border-left-color: var(--ok); }

/* ---------- Shell autenticado (provisório da Fase 0) ---------- */

.shell { padding: 24px 16px; max-width: 880px; margin: 0 auto; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.panel h2 { margin: 0 0 12px; font-size: 17px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.muted { color: var(--text-muted); font-size: 13px; }

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.badge--ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.badge--fail { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }

/* ==========================================================================
   Shell: barra lateral, conteúdo, tabelas, kanban
   ========================================================================== */

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  padding: 18px 16px 14px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 17px;
  border-bottom: 1px solid var(--border);
}

.sidebar__nav { flex: 1; padding: 10px 8px; overflow-y: auto; }

.navlink {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 1px;
}

.navlink:hover { background: var(--surface-soft); }

.navlink--active {
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--brand);
  font-weight: 600;
}

.navlink__icon { width: 18px; text-align: center; opacity: .75; }

.sidebar__foot { padding: 12px 14px; border-top: 1px solid var(--border); font-size: 13px; }
.sidebar__buttons { display: flex; gap: 6px; margin-top: 8px; }

.content { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}

.searchbtn {
  width: 100%;
  max-width: 420px;
  text-align: left;
  padding: 8px 12px;
  font: inherit;
  color: var(--text-muted);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.searchbtn:hover { border-color: var(--brand); }

.view { padding: 24px; }

/* ---------- Cabeçalho de página ---------- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-head h1 { margin: 0 0 2px; font-size: 21px; letter-spacing: -0.01em; }
.page-head__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back-link {
  display: inline-block; margin: 0 0 6px; padding: 0;
  background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--text-muted);
}
.back-link:hover { color: inherit; text-decoration: underline; }

/* ---------- Painéis ---------- */

.panel { margin-bottom: 18px; padding: 0; overflow: hidden; }

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.panel__head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.panel__body { padding: 16px 18px; }
.panel__actions { display: flex; gap: 8px; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .input { max-width: 320px; }

/* ---------- Indicadores ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.stat__label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.stat__value { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat__hint { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.35; }

.stat--ok { border-left-color: var(--ok); }
.stat--warn { border-left-color: var(--warn); }
.stat--danger { border-left-color: var(--danger); }

/* ---------- Tabelas ---------- */

.table-wrap { overflow-x: auto; margin: 0 -18px -16px; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table th {
  text-align: left;
  padding: 9px 12px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover { background: var(--surface-soft); }
.table .right, .table th.right { text-align: right; }
.table tfoot td { font-weight: 650; background: var(--surface-soft); }
.table tr.row--danger td { background: color-mix(in srgb, var(--danger) 5%, transparent); }
.table tr.row--cancelled td { background: color-mix(in srgb, var(--danger) 9%, transparent); color: color-mix(in srgb, var(--danger) 70%, var(--text)); }
.table tr.row--cancelled td:nth-child(2) { text-decoration: line-through; }

.mono { font-variant-numeric: tabular-nums; }
.empty { color: var(--text-muted); font-size: 13.5px; padding: 8px 0; }
.plain { list-style: none; padding: 0; margin: 8px 0; font-size: 13.5px; }
.plain li { padding: 3px 0; }

.text-danger { color: var(--danger); }
.text-warn { color: var(--warn); }
.text-ok { color: var(--ok); }

/* ---------- Badges ---------- */

.badge--ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.badge--warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.badge--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.badge--info { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 35%, transparent); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.badge--muted { color: var(--text-muted); }

.alert--warn {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}

/* ---------- Medidor (teto do regime) ---------- */

.meter { height: 10px; background: var(--surface-soft); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.meter__fill { height: 100%; background: var(--ok); border-radius: 99px; }
.meter__fill--warning { background: var(--warn); }
.meter__fill--danger, .meter__fill--high { background: #e8820c; }
.meter__fill--critical { background: var(--danger); }

/* ---------- Formulários ---------- */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.field__hint { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.35; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.btn--sm { padding: 5px 10px; font-size: 12.5px; }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--active { border-color: var(--brand); color: var(--brand); }

.items { display: grid; gap: 6px; margin-bottom: 8px; }
.item-row { display: grid; grid-template-columns: 2fr 1.2fr 80px 120px 1.1fr 34px; gap: 6px; align-items: center; }
.item-row .input { width: 100%; }

.proposal {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--surface-soft);
}

/* ---------- Modal ---------- */

.modal.hidden { display: none; }

.modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, .5);
  z-index: 50;
}

.modal__box, .searchmodal {
  position: fixed;
  z-index: 51;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(10, 14, 20, .3);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 64px);
}

.modal__box { top: 32px; }

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal__head h3 { margin: 0; font-size: 16px; }
.modal__body { padding: 16px 18px; overflow-y: auto; }
.modal__body h4 { margin: 16px 0 6px; font-size: 13.5px; }
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

/* ---------- Busca global ---------- */

.searchmodal { top: 80px; width: min(620px, calc(100vw - 32px)); padding: 12px; }
.searchresults { max-height: 60vh; overflow-y: auto; margin-top: 8px; }
.searchgroup { margin-bottom: 10px; }
.searchgroup__title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  padding: 4px 8px;
}
.searchitem {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
}
.searchitem:hover { background: var(--surface-soft); }

/* ---------- Kanban ---------- */

/* A altura vem do JS (ajustarAltura): o quadro cabe na tela, cada coluna rola
   por dentro e a barra horizontal fica sempre à vista. */
.kanban {
  display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; padding-bottom: 8px;
  align-items: flex-start; cursor: grab; scrollbar-gutter: stable;
}
.kanban.is-panning { cursor: grabbing; user-select: none; }
.kanban::-webkit-scrollbar { height: 12px; }
.kanban::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; border: 3px solid var(--bg); }
.kanban::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.kanban__col {
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: default;
}
.kanban__col .kanban__drop { overflow-y: auto; flex: 1 1 auto; }

.kanban__col--recurring { flex-basis: 260px; background: color-mix(in srgb, var(--brand) 5%, var(--surface)); }
.kanban__col--recurring .kanban__head { border-top-color: var(--brand); align-items: center; }
.kanban__hint { margin: 4px; font-size: 12.5px; }
.card--recurring { background: var(--surface); }
.card--recurring.is-paused { opacity: .6; }
.card__rule { color: var(--brand-dark); font-weight: 600; }
:root[data-theme="dark"] .card__rule { color: var(--brand); }
.card__todo {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--border);
  font-size: 12px; color: var(--warn); font-weight: 600;
}

.kanban__head {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-top: 3px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.kanban__drop { padding: 8px; min-height: 80px; display: grid; gap: 6px; }
.kanban__drop.over { background: color-mix(in srgb, var(--brand) 8%, transparent); }

.card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
  font-size: 13px;
}

.card:hover { border-color: var(--brand); }
.card--danger { border-left: 3px solid var(--danger); }
.card__title { font-weight: 550; margin-bottom: 3px; }
.card__meta { color: var(--text-muted); font-size: 12px; }
.card__foot { display: flex; justify-content: space-between; gap: 6px; margin-top: 6px; font-size: 11.5px; color: var(--text-muted); }

/* ---------- Linha do tempo ---------- */

.timeline { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.timeline li { display: grid; grid-template-columns: 90px 90px 1fr auto; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: none; }
.timeline__date { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.timeline__kind { color: var(--brand); font-size: 12px; }

.prose { font-size: 14px; line-height: 1.6; }
.prose p { margin: 0 0 8px; }

/* ==========================================================================
   Tela "O Dia" e tarefas.
   ========================================================================== */

/* Foco visível em TUDO que recebe teclado.
   O arquivo tinha `outline: none` no .input e nenhum estado de foco em botão,
   link de navegação, card ou linha clicável — o que inviabiliza navegar por
   teclado e é barreira de acessibilidade, não detalhe estético. */
.btn:focus-visible,
.navlink:focus-visible,
.card:focus-visible,
tr.clickable:focus-visible,
.day-task:focus-within,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Tela do dia ----------
   Três andares: alerta (se houver), resumo em quatro números, duas colunas. */

.day-head { align-items: flex-end; }
.day-head__date { margin: 0; color: var(--text-muted); font-size: 14px; }
.day-head__date::first-letter { text-transform: uppercase; }

.day-status {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-muted); white-space: nowrap;
}
.day-status::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--text-soft);
}
.day-status--verde::before { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.day-status--amarelo { color: var(--warn); }
.day-status--amarelo::before { background: var(--warn); }
.day-status--vermelho { color: var(--danger); font-weight: 600; }
.day-status--vermelho::before { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }

.day-alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; margin-bottom: 16px;
  border: 1px solid; border-radius: var(--radius);
}
.day-alert--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.day-alert--warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 7%, var(--surface)); }
.day-alert__icon { display: flex; padding-top: 1px; }
.day-alert__body { flex: 1 1 auto; min-width: 0; }
.day-alert__title { display: block; font-size: 14px; }
.day-alert ul { margin: 2px 0 0; padding: 0; list-style: none; color: var(--text); font-size: 13px; }
.day-alert li strong { font-weight: 600; }
.day-alert .btn { flex: none; white-space: nowrap; }

.day-summary {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.day-stat {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  padding: 14px 16px 14px 18px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; transition: border-color .12s, transform .12s;
}
.day-stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--border); }
.day-stat:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.day-stat:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.day-stat__label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.day-stat__value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; }
.day-stat__hint { font-size: 12.5px; color: var(--text-soft); }
.day-stat--danger::before { background: var(--danger); }
.day-stat--danger .day-stat__value { color: var(--danger); }
.day-stat--warn::before { background: var(--warn); }
.day-stat--brand::before { background: var(--brand); }
.day-stat--ok::before { background: var(--ok); }

.day-layout {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 16px; align-items: start;
}
.day-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.day-col > .panel { margin-bottom: 0; }

.day-panel .panel__head h2 { display: flex; align-items: center; gap: 8px; }
.day-panel__count {
  font-size: 11.5px; font-weight: 600; color: var(--text-muted);
  background: var(--surface-soft); border: 1px solid var(--border); border-radius: 99px; padding: 0 8px; line-height: 1.6;
}
.day-panel .panel__body { padding: 6px 18px 14px; }

.day-link {
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-muted);
  background: none; border: 0; padding: 4px 2px; cursor: pointer; white-space: nowrap;
}
.day-link:hover { color: var(--brand); }

.day-group {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  margin: 14px 0 2px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
}
.day-group:first-child { margin-top: 8px; }
.day-group__total { font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--text); font-variant-numeric: tabular-nums; }
.day-group--danger, .day-group--danger .day-group__total { color: var(--danger); }

.day-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 9px 0; border-top: 1px solid var(--border);
}
.day-group + .day-item { border-top: 0; }
.panel__body > .day-item:first-child { border-top: 0; }
.day-item__main { min-width: 0; flex: 1 1 auto; }
.day-item__title { font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-item__sub { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-item__side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.day-item__value { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.day-item__note { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.day-item--danger .day-item__sub { color: var(--danger); }

.day-more {
  display: block; width: 100%; margin-top: 4px; padding: 8px 0 0;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--brand); text-align: left;
  background: none; border: 0; border-top: 1px solid var(--border); cursor: pointer;
}
.day-more:hover { text-decoration: underline; }

.day-empty { margin: 10px 0 4px; color: var(--text-muted); font-size: 13.5px; }
.day-footnote { margin: 12px 0 0; padding: 10px 12px; font-size: 12.5px; color: var(--text-muted); background: var(--surface-soft); border-radius: var(--radius-sm); }

.day-quickadd {
  display: flex; align-items: center; gap: 8px; margin: 10px 0 6px;
  padding: 0 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-soft);
}
.day-quickadd:focus-within { border-style: solid; border-color: var(--brand); background: var(--surface); }
.day-quickadd__plus { color: var(--text-soft); font-size: 18px; line-height: 1; }
.day-quickadd .input { flex: 1 1 auto; border: 0; background: transparent; box-shadow: none; padding-left: 0; padding-right: 0; }
.day-quickadd .input:focus { outline: none; box-shadow: none; }

.day-task {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--border);
}
.day-task:first-child { border-top: 0; }
.day-task__check { flex: none; width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--brand); cursor: pointer; }
.day-task__body { flex: 1 1 auto; min-width: 0; }
.day-task__title { font-size: 14px; line-height: 1.4; }
.day-task__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; font-size: 12.5px; color: var(--text-muted); }
.day-task__snooze { flex: none; color: var(--text-muted); opacity: 0; transition: opacity .12s; }
.day-task:hover .day-task__snooze,
.day-task:focus-within .day-task__snooze { opacity: 1; }
@media (hover: none) { .day-task__snooze { opacity: 1; } }

@media (max-width: 1100px) {
  .day-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .day-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .day-summary { gap: 8px; }
  .day-stat { padding: 12px 12px 12px 14px; }
  .day-stat__value { font-size: 18px; }
}

.tag {
  color: var(--text-muted);
  cursor: help;
}

.btn--block { width: 100%; }
.btn--sm { padding: 3px 8px; font-size: .85rem; }
.small { font-size: .85rem; }
.danger { color: var(--danger); }

/* Respeita quem pediu menos animação no sistema. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Confirmação de ação destrutiva (core/confirm.js) ---------- */
.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn--danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 85%, #000); }
.confirm__warning { margin: 0 0 12px; line-height: 1.5; }
.confirm__preview {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 12px;
}
.confirm__preview p { margin: 0 0 6px; }
.confirm__list { margin: 0; padding-left: 18px; font-size: 13px; }

/* ---------- Financeiro: previsto × realizado ---------- */
.progress {
  position: relative;
  height: 28px;
  margin: 4px 0 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.progress__bar { height: 100%; background: color-mix(in srgb, var(--ok) 35%, transparent); }
.progress__label {
  position: absolute; inset: 0;
  display: flex; align-items: center; padding: 0 12px;
  font-size: 13px; color: var(--text);
}
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }

/* A confirmação fica acima do formulário que a abriu. */
.modal--top .modal__backdrop { z-index: 60; }
.modal--top .modal__box { z-index: 61; top: 64px; width: min(560px, calc(100vw - 32px)); }

/* ---------- Gaveta técnica (Ctrl .) ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40;
  width: min(420px, 100vw); overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(10, 14, 20, .18);
  padding: 16px 18px 32px;
}
.drawer.hidden { display: none; }
.drawer__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.drawer__head h3 { margin: 0; }
.drawer__section { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 12px; }
.drawer__section h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.drawer__item { padding: 6px 0; }
.drawer__cred { border-bottom: 1px dashed var(--border); padding-bottom: 8px; margin-bottom: 4px; }
.drawer__form { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-top: 12px; background: var(--surface-soft); }

/* ---------- Rastro ---------- */
.trace__row { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.trace__row:last-child { border-bottom: 0; }
.trace__label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding-top: 2px; }
.trace__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.trace__chip { border: 1px solid var(--border); background: var(--surface-soft); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; color: var(--text); }
.trace--focus { outline: 2px solid var(--brand); outline-offset: 1px; font-weight: 600; }

/* ---------- Clientes: modos de visualização e filtro por letra ---------- */

.btn--auto { width: auto; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg__btn {
  padding: 8px 14px; font: inherit; font-size: 13px; font-weight: 550;
  color: var(--text-muted); background: var(--surface); border: 0; cursor: pointer;
}
.seg__btn + .seg__btn { border-left: 1px solid var(--border); }
.seg__btn:hover { background: var(--surface-soft); }
.seg__btn.is-active { color: #fff; background: var(--brand); }

.letter-bar { display: flex; flex-wrap: wrap; gap: 2px; margin: 4px 0 10px; }
.letter-bar__btn {
  min-width: 30px; height: 30px; padding: 0 6px; font: inherit; font-size: 13px; font-weight: 650;
  color: var(--text); background: transparent; border: 0; border-radius: 6px; cursor: pointer;
}
.letter-bar__btn:hover:not(:disabled) { background: var(--surface-soft); }
.letter-bar__btn:disabled { color: var(--border); cursor: default; }
.letter-bar__btn.is-active { color: #fff; background: var(--brand); }
.letter-bar__btn--all { padding: 0 12px; }

.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }

.client-card {
  display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.client-card:hover, .client-card:focus-visible {
  outline: none; border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); box-shadow: var(--shadow);
}

.client-card__head { display: flex; align-items: flex-start; gap: 12px; }
.client-card__avatar {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; overflow: hidden;
  border-radius: 50%; font-size: 14px; font-weight: 700; color: var(--brand-dark);
  background: color-mix(in srgb, var(--brand) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
}
.client-card__avatar.has-logo { background: #fff; }
.client-card__avatar img { width: 100%; height: 100%; object-fit: contain; }
.client-card__id { flex: 1; min-width: 0; }
.client-card__name { display: block; font-size: 14.5px; line-height: 1.3; overflow-wrap: anywhere; }
.client-card__sub {
  margin-top: 2px; font-size: 12.5px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.client-card__count {
  flex: none; padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap;
  color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: 999px;
}
.client-card__meta { display: flex; flex-wrap: wrap; gap: 6px; }
.client-card__meta:empty { display: none; }
.client-card__actions { display: flex; gap: 6px; margin-top: auto; }
.client-card__act {
  display: grid; place-items: center; width: 32px; height: 32px; font-size: 15px;
  background: var(--surface-soft); border: 1px solid var(--border); border-radius: 7px; cursor: pointer;
}
.client-card__act:hover { border-color: var(--brand); }
.client-card__act.is-brand { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); }

:root[data-theme="dark"] .client-card__avatar { color: var(--brand); }

/* ---------- Ficha do cliente ---------- */

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 0 18px; align-items: start; }
.sub-head { margin: 16px 0 6px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.sub-head--first { margin-top: 0; }
.pre-line { white-space: pre-line; margin: 0; font-size: 13.5px; }
.contact-list { display: flex; flex-direction: column; }
.contact-list__item { padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.contact-list__item:last-child { border-bottom: 0; }
.contact-list__ways { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; }
.detail-grid .table-wrap { margin: 0 -18px; }
.link-more { margin-top: 6px; }

.more-info { margin-top: 4px; }
.more-info > summary {
  display: flex; align-items: baseline; gap: 12px; padding: 12px 4px; margin-bottom: 12px;
  font-weight: 650; cursor: pointer; list-style: none; border-top: 1px solid var(--border);
}
.more-info > summary::-webkit-details-marker { display: none; }
.more-info > summary::before { content: '▸'; color: var(--text-muted); transition: transform .15s; }
.more-info[open] > summary::before { transform: rotate(90deg); }

/* ---------- Leads ---------- */

.input--static { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; background: var(--surface-soft); }
.request-text {
  margin-top: 8px; padding: 12px 14px; border-radius: 8px; line-height: 1.55;
  background: var(--surface-soft); border-left: 3px solid var(--brand);
}
.client-card__when { font-size: 12px; align-self: center; }
.timeline li.timeline--lead { grid-template-columns: 90px 110px 1fr; }
.toolbar select.input { width: auto; }

/* ==========================================================================
   Camada visual v2 — tokens refinados, shell agrupado, componentes.
   Fica no fim do arquivo de propósito: sobrescreve as regras antigas sem
   mexer em cada tela.
   ========================================================================== */

:root {
  --brand: #17938a;          /* texto/ícone de marca: contraste AA no branco */
  --brand-dark: #10766f;     /* fundo de botão primário com texto branco */
  --brand-bright: #22aaa1;   /* a cor da marca, para detalhe */
  --brand-soft: color-mix(in srgb, var(--brand-bright) 12%, transparent);
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f3f5f7;
  --surface-hover: #eef1f4;
  --border: #e3e7ec;
  --border-strong: #d0d6dd;
  --text: #15191e;
  --text-muted: #5c6773;
  --text-soft: #8a949e;
  --danger: #c9302a;
  --warn: #b86e00;
  --ok: #167a4d;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .06);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sidebar-w: 236px;
}

:root[data-theme="dark"] {
  --brand: #3fc2b8;
  --brand-dark: #1c9a91;
  --bg: #0f1216;
  --surface: #161a1f;
  --surface-soft: #1c2127;
  --surface-hover: #222830;
  --border: #283038;
  --border-strong: #36404a;
  --text: #e7eaed;
  --text-muted: #9ba6b1;
  --text-soft: #6f7a85;
  --danger: #ef6a63;
  --warn: #e3a03a;
  --ok: #4cc28a;
  --shadow-xs: none;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
}

body { font-size: 14px; letter-spacing: -0.003em; }
a { color: var(--brand); text-underline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--brand-bright) 28%, transparent); }

.icon { flex: none; display: block; }

/* ---------- Shell ---------- */

.layout { grid-template-columns: var(--sidebar-w) 1fr; }

.sidebar { background: var(--surface); border-right: 1px solid var(--border); }

.sidebar__brand {
  display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px;
  border-bottom: 0; color: var(--text); text-decoration: none; font-size: 15px;
}
.sidebar__brand strong { font-weight: 700; letter-spacing: -0.02em; }
.sidebar__brand-sub {
  margin-left: 6px; padding: 1px 6px; border-radius: 5px; font-size: 10.5px; font-weight: 650;
  letter-spacing: .06em; color: var(--brand); background: var(--brand-soft);
}
.logo-field { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.logo-field__acoes { display: flex; gap: 8px; }
.logo-preview {
  display: grid; place-items: center; min-width: 200px; min-height: 72px; padding: 12px;
  border: 1px dashed var(--border); border-radius: 10px;
  /* xadrez: deixa visível um logo branco ou transparente */
  background: repeating-conic-gradient(rgba(127,127,127,.12) 0 25%, transparent 0 50%) 0 0 / 16px 16px;
}
.logo-preview img { max-height: 56px; max-width: 240px; object-fit: contain; }
.sidebar__logo { display: block; max-height: 34px; max-width: 180px; object-fit: contain; }
.brandmark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  font-size: 12.5px; font-weight: 800; letter-spacing: -0.04em; color: #fff;
  background: linear-gradient(135deg, var(--brand-bright), var(--brand-dark));
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);
}

.sidebar__nav { padding: 4px 10px 12px; }
.navgroup + .navgroup { margin-top: 14px; }
.navgroup__title {
  padding: 0 10px 6px; font-size: 10.5px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-soft);
}

.navlink {
  position: relative; gap: 10px; padding: 7px 10px; margin-bottom: 1px;
  font-size: 13.5px; font-weight: 500; color: var(--text-muted); border-radius: var(--radius-sm);
  transition: background .12s, color .12s;
}
.navlink:hover { background: var(--surface-hover); color: var(--text); }
.navlink__icon { width: 18px; opacity: 1; display: grid; place-items: center; }
.navlink--active, .navlink--active:hover { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.navlink--active::before {
  content: ''; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand-bright);
}

.sidebar__foot {
  display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 14px; border-top: 1px solid var(--border);
}
.useravatar {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  font-size: 11.5px; font-weight: 700; color: var(--brand); background: var(--brand-soft);
}
.sidebar__user { flex: 1; min-width: 0; font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.iconbtn {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  color: var(--text-muted); background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .12s, color .12s;
}
.iconbtn:hover { background: var(--surface-hover); color: var(--text); }
.iconbtn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.iconbtn.is-busy { opacity: .5; cursor: progress; }

.topbar {
  display: flex; align-items: center; gap: 16px; padding: 10px 28px; margin: 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__title { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--text-muted); }

.searchbtn {
  display: flex; align-items: center; gap: 8px; width: 340px; max-width: 100%; padding: 7px 8px 7px 11px;
  font-size: 13px; color: var(--text-soft); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-xs); transition: border-color .12s, color .12s;
}
.searchbtn:hover { border-color: var(--border-strong); color: var(--text-muted); }
.searchbtn__text { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd {
  font: 600 10.5px/1 var(--font); padding: 3px 6px; color: var(--text-muted);
  background: var(--surface-soft); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px;
}

.view { padding: 24px 28px 40px; }

/* ---------- Cabeçalho de página ---------- */

.page-head { margin-bottom: 20px; align-items: flex-end; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; }

/* ---------- Botões ---------- */

.btn {
  padding: 8px 14px; font-size: 13.5px; font-weight: 600; line-height: 1.2;
  background: var(--surface); border-color: var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs); transition: background .12s, border-color .12s, box-shadow .12s, opacity .12s;
}
.btn:hover:not(:disabled) { background: var(--surface-hover); }
.btn--primary { width: auto; color: #fff; background: var(--brand-dark); border-color: var(--brand-dark); }
.btn--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--brand-dark) 88%, #000); }
:root[data-theme="dark"] .btn--primary { color: #04110f; background: var(--brand); border-color: var(--brand); }
:root[data-theme="dark"] .btn--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--brand) 85%, #fff); }
.btn--block { width: 100%; }
.btn--sm { padding: 5px 10px; font-size: 12.5px; }
.btn--ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn--ghost:hover:not(:disabled) { background: var(--surface-hover); }
.btn--active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.btn--danger { color: #fff; background: var(--danger); border-color: var(--danger); }

/* ---------- Campos ---------- */

.input {
  padding: 8px 11px; font-size: 13.5px; background: var(--surface);
  border-color: var(--border-strong); border-radius: var(--radius-sm);
}
.input:hover:not(:focus) { border-color: color-mix(in srgb, var(--border-strong) 70%, var(--text-soft)); }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-bright) 22%, transparent); }
.input::placeholder { color: var(--text-soft); }
select.input { padding-right: 28px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.field__hint { color: var(--text-soft); }

/* ---------- Painéis ---------- */

.panel { border-color: var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel__head { padding: 13px 18px; min-height: 52px; }
.panel__head h2 { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.panel__body { padding: 16px 18px 18px; }

/* ---------- Indicadores ---------- */

.stat-row { gap: 12px; margin-bottom: 20px; }
.stat {
  position: relative; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.stat--ok::before { background: var(--ok); }
.stat--warn::before { background: var(--warn); }
.stat--danger::before { background: var(--danger); }
.stat--ok, .stat--warn, .stat--danger { border-left-color: var(--border); }
.stat__label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 6px; }
.stat__value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.stat--danger .stat__value { color: var(--danger); }
.stat__hint { margin-top: 4px; color: var(--text-soft); }

/* ---------- Tabelas ---------- */

.table { font-size: 13.5px; }
.table th {
  padding: 9px 14px; font-size: 11px; letter-spacing: .06em; color: var(--text-soft);
  background: var(--surface-soft); border-bottom: 1px solid var(--border);
}
.table td { padding: 11px 14px; border-bottom-color: var(--border); }
.table tr.clickable { transition: background .1s; }
.table tr.clickable:hover { background: var(--surface-hover); }
.table td strong { font-weight: 600; }

/* ---------- Selos ---------- */

.badge { padding: 2px 9px; font-size: 11.5px; font-weight: 600; line-height: 1.5; border-color: var(--border); }
.badge--muted { color: var(--text-muted); background: var(--surface-soft); }

/* ---------- Modal ---------- */

.modal__backdrop { background: rgba(9, 12, 16, .45); backdrop-filter: blur(2px); animation: fade-in .15s ease-out; }
.modal__box, .searchmodal { border-radius: 14px; box-shadow: var(--shadow-lg); border-color: var(--border); }
.modal__box { top: max(32px, 8vh); animation: pop-in .16s ease-out; }
.modal__head { padding: 16px 20px; }
.modal__head h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.015em; }
.modal__body { padding: 18px 20px; }
.modal__foot { padding: 12px 20px; background: var(--surface-soft); border-radius: 0 0 14px 14px; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%, 6px) scale(.985); } }

.searchmodal { padding: 10px; }
.searchitem:hover { background: var(--surface-hover); }

/* ---------- Toasts ---------- */

.toast { border-radius: 10px; box-shadow: var(--shadow-lg); border-left-width: 3px; font-weight: 500; }

/* ---------- Kanban ---------- */

.kanban__col { border-radius: var(--radius); background: var(--surface-soft); box-shadow: none; }
.kanban__head { background: var(--surface); padding: 11px 12px; font-size: 13px; }
.kanban__head strong { font-weight: 650; }
.card { background: var(--surface); border-color: var(--border); border-radius: 10px; box-shadow: var(--shadow-xs); }
.card:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); box-shadow: var(--shadow); }
.kanban__col--recurring { background: color-mix(in srgb, var(--brand-bright) 6%, var(--surface-soft)); }

/* ---------- Cards de cliente/lead ---------- */

.client-card { border-color: var(--border); box-shadow: var(--shadow-xs); }
.client-card:hover, .client-card:focus-visible { box-shadow: var(--shadow); }
.client-card__avatar { color: var(--brand); background: var(--brand-soft); border-color: transparent; }
.client-card__act { background: var(--surface); border-color: var(--border); }
.client-card__act:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.seg { border-color: var(--border-strong); background: var(--surface); }
.seg__btn { padding: 7px 13px; }
.seg__btn.is-active { color: #fff; background: var(--brand-dark); }
.letter-bar__btn { min-width: 28px; height: 28px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.letter-bar__btn:hover:not(:disabled) { color: var(--text); background: var(--surface-hover); }
.letter-bar__btn:disabled { color: color-mix(in srgb, var(--text-soft) 45%, transparent); }
.letter-bar__btn.is-active { color: #fff; background: var(--brand-dark); }

/* ---------- Barra de meses ---------- */

.monthbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -6px 0 20px; }
.monthbar__year {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-xs);
}
.monthbar__year strong { min-width: 46px; text-align: center; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.monthbar__arrow {
  width: 28px; height: 28px; font: 600 17px/1 var(--font); color: var(--text-muted);
  background: transparent; border: 0; border-radius: 7px; cursor: pointer;
}
.monthbar__arrow:hover { background: var(--surface-hover); color: var(--text); }
.monthbar__months { display: flex; gap: 6px; flex-wrap: wrap; }
.monthbar__m {
  position: relative; min-width: 50px; padding: 6px 12px; font: 500 13px/1.2 var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.monthbar__m:hover { border-color: var(--brand); color: var(--brand); }
.monthbar__m.is-now::after {
  content: ''; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: var(--brand-bright);
}
.monthbar__m.is-active {
  font-weight: 700; color: #fff; background: var(--brand-dark); border-color: var(--brand-dark);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand-dark) 35%, transparent);
}
.monthbar__m.is-active.is-now::after { background: #fff; }
:root[data-theme="dark"] .monthbar__m.is-active { color: #04110f; background: var(--brand); border-color: var(--brand); }
.monthbar__arrow:focus-visible, .monthbar__m:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Google Drive (NF) ---------- */

.drive-strip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 18px; padding: 10px 14px;
  font-size: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs);
}
.drive-strip > span:nth-child(2) { flex: 1; min-width: 0; }
.drive-strip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-soft); }
.drive-strip__dot.is-on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.table .row-actions { flex-wrap: nowrap; }
.table .btn { white-space: nowrap; }
.list-more { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; }

/* ---------- Erro com "tentar de novo" (E3), abas e ações de formulário ---------- */

.alert--retry { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin: -4px 0 18px; }
.tabs { display: flex; gap: 4px; margin: -6px 0 18px; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs__tab {
  padding: 9px 14px; font-size: 13.5px; font-weight: 600; color: var(--text-muted); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs__tab:hover { color: var(--text); }
.tabs__tab.is-active { color: var(--brand); border-bottom-color: var(--brand-bright); }

/* ---------- Relatórios ---------- */

.bars { display: grid; gap: 8px; }
.bars__row { display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; align-items: center; font-size: 13px; }
.bars__track { height: 10px; background: var(--surface-soft); border-radius: 99px; overflow: hidden; }
.bars__fill { display: block; height: 100%; border-radius: 99px; min-width: 2px; }
.bars__value { color: var(--text-muted); white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Kanban: mover por botão (E4) ---------- */

.card__move { display: inline-flex; gap: 2px; margin-left: auto; }
.card__step {
  width: 22px; height: 22px; padding: 0; font-size: 10px; line-height: 1; color: var(--text-muted);
  background: transparent; border: 1px solid transparent; border-radius: 6px; cursor: pointer;
}
.card__step:hover, .card__step:focus-visible { color: var(--brand); border-color: var(--border); background: var(--surface); }
.card:not(:hover):not(:focus-within) .card__step { opacity: .35; }
@media (hover: none) { .card .card__step { opacity: 1; } }

/* ---------- Tabelas no celular viram cartões (E5) ---------- */

@media (max-width: 700px) {
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr {
    margin: 0 0 10px; padding: 6px 0; background: var(--surface);
    border: 1px solid var(--border); border-radius: 10px;
  }
  .table--stack tbody tr:last-child td { border-bottom: 0; }
  .table--stack td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 6px 12px; border: 0; text-align: right;
  }
  .table--stack td[data-label]::before {
    content: attr(data-label); flex: none; max-width: 45%; text-align: left;
    font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft);
  }
  .table--stack td:first-child { font-weight: 600; }
  .table--stack td:not([data-label])::before, .table--stack td[data-label=""]::before { content: none; }
  .table--stack td:not([data-label]), .table--stack td[data-label=""] { justify-content: flex-end; }
  .table--stack tfoot { display: block; }
  .table-wrap { margin: 0; overflow: visible; }
  .table--stack .row-actions { flex-wrap: wrap; justify-content: flex-end; }
}

/* ---------- Atalhos (E9) ---------- */

.searchitem.is-selected { background: var(--brand-soft); color: var(--brand); }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; align-items: center; }
.shortcuts dd { margin: 0; color: var(--text-muted); }

/* ==========================================================================
   Telas estreitas — TODAS as media queries de largura num lugar só (E11).
   Antes eram dois blocos de 900px e dois de 480px espalhados, e o segundo
   anulava o primeiro em silêncio. Ficam no fim de propósito: a ordem de
   precedência é explícita.
   ========================================================================== */

@media (max-width: 900px) {
  /* minmax(0, 1fr) + min-width: 0: sem isso a coluna crescia até caber a fila
     de ícones do menu (≈780px) e a página inteira ficava mais larga que a tela. */
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .content { min-width: 0; }
  .sidebar { position: sticky; top: 0; z-index: 6; height: auto; flex-direction: row; align-items: center; }
  .sidebar__nav { min-width: 0; flex: 1 1 auto; }
  .sidebar__brand { padding: 10px 12px; }
  .sidebar__brand > span:last-child { display: none; }
  .sidebar__logo { max-height: 24px; max-width: 110px; }
  .sidebar__nav { display: flex; gap: 2px; padding: 6px; overflow-x: auto; }
  .navgroup { display: flex; gap: 2px; }
  .navgroup + .navgroup { margin: 0 0 0 6px; padding-left: 6px; border-left: 1px solid var(--border); }
  .navgroup__title, .navlink__label, .sidebar__user { display: none; }
  .navlink { padding: 8px; white-space: nowrap; }
  .navlink--active::before { display: none; }
  .sidebar__foot { border: 0; padding: 6px 8px; }
  .useravatar { display: none; }
  .topbar { position: static; padding: 10px 16px; }
  .topbar__title { display: none; }
  .searchbtn { width: 100%; }
  .view { padding: 16px 16px 32px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: 1fr 1fr; }
  .monthbar__months { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 4px; }
  .monthbar__m { flex: none; }
}

@media (max-width: 600px) {
  .bars__row { grid-template-columns: 1fr auto; }
  .bars__track { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .client-grid { grid-template-columns: 1fr; }
  .toolbar .input { max-width: none; flex: 1 1 100%; }
}

/* ---------- Notas fiscais por mês ---------- */

.linklike {
  padding: 0; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--warn);
  background: none; border: 0; border-bottom: 1px dashed currentColor; cursor: pointer;
}
.linklike:hover { color: var(--brand); }
.more-fields { margin: 4px 0 8px; }
.more-fields > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 10px; }
.linklike { white-space: nowrap; }

/* ---------- Sites: ferramentas de domínio ---------- */
.domain-search { margin-bottom: 8px; }
.domain-search .input { flex: 1 1 220px; max-width: none; }
.domain-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.chip {
  font: inherit; font-size: 12.5px; padding: 3px 10px; border-radius: 99px; cursor: pointer;
  background: var(--surface-soft); color: var(--text); border: 1px solid var(--border);
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.domain-summary { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.domain-summary__name { flex: 1 1 200px; min-width: 0; }
.domain-summary__name h2 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.domain-summary__badges { display: flex; gap: 6px; flex-wrap: wrap; }
.domain-favicon { width: 32px; height: 32px; border-radius: 6px; flex: none; }
.domain-grid { gap: 16px; align-items: start; }
.domain-grid > .panel { margin-bottom: 0; }
.domain-map { width: 100%; height: 280px; border: 0; border-radius: 8px; display: block; margin-bottom: 8px; }
.tabs__tab--button { background: none; border-top: 0; border-left: 0; border-right: 0; cursor: pointer; font-family: inherit; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; }
.break { overflow-wrap: anywhere; word-break: break-word; }
.table tr.row--ok td { background: color-mix(in srgb, var(--ok) 6%, transparent); }
.route { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 0; }
.route__hop { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; position: relative; }
.route__hop + .route__hop::before {
  content: ''; position: absolute; left: 15px; top: -10px; height: 20px; border-left: 2px dashed var(--border);
}
.route__n {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--surface-soft); border: 1px solid var(--border); position: relative; z-index: 1;
}
.route__hop--dest .route__n { background: var(--brand); color: #fff; border-color: var(--brand); }
.route__body { min-width: 0; overflow-wrap: anywhere; }
.route__ms { color: var(--text-muted); font-size: 13px; }
@media (max-width: 720px) {
  .domain-grid { grid-template-columns: 1fr; }
}

/* Validade de domínio: dourado = expira em até 30 dias */
:root { --gold: #9a7200; }
:root[data-theme="dark"] { --gold: #e3b341; }
.badge--gold { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 40%, transparent); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.text-gold { color: var(--gold); }
.domain-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-start; }
.domain-tags .badge { white-space: nowrap; }

/* ---------- Cartão de OS: borda pela situação + checkbox de concluir ---------- */

.card--os { border-left: 4px solid var(--card-st, var(--border-strong)); }
.card--os:hover { border-left-color: var(--card-st, var(--border-strong)); }
.card--st-open { --card-st: var(--brand-bright, var(--brand)); }
.card--st-waiting_client { --card-st: var(--warn); }
.card--st-paused { --card-st: var(--text-soft, var(--text-muted)); }
.card--st-done { --card-st: var(--ok); }
.card--st-cancelled { --card-st: var(--border-strong); }
.card--st-overdue { --card-st: var(--danger); }
.card--st-done .card__title { color: var(--text-muted); text-decoration: line-through; }

.card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card__check {
  flex: none; width: 20px; height: 20px; margin: -1px -2px 0 0; padding: 0;
  display: inline-grid; place-items: center;
  border: 1.5px solid var(--border-strong, var(--border)); border-radius: 6px;
  background: var(--surface); color: transparent; cursor: pointer;
  font-size: 12px; font-weight: 700; line-height: 1;
}
.card__check:hover, .card__check:focus-visible { border-color: var(--ok); color: var(--ok); }
.card__check:hover::after { content: '✓'; }
.card__check.is-done { background: var(--ok); border-color: var(--ok); color: #fff; cursor: default; }
.kanban__hidden { padding: 6px 12px 0; font-size: 11.5px; }

.card__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.card__tag {
  font-size: 11px; line-height: 1.5; padding: 0 6px;
  border: 1px solid var(--border-strong, var(--border)); border-radius: 6px;
  color: var(--text-muted);
}

/* ---------- Manutenção ---------- */

.maint-site { display: inline-flex; align-items: center; gap: 6px; }
.maint-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong, var(--border)); flex: none; }
.maint-dot.is-up { background: var(--ok); }
.maint-dot.is-down { background: var(--danger); }
.proposal__contract {
  margin: 8px 0 4px; padding: 8px 10px; border-radius: 8px;
  background: color-mix(in srgb, var(--brand-bright, var(--brand)) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand-bright, var(--brand)) 25%, transparent);
}

/* ---------- Repetitivas: em espera ---------- */

.kanban__waiting { margin-top: 4px; }
.kanban__waiting > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  cursor: pointer; list-style: none; padding: 9px 10px; border-radius: 8px;
  border: 1px dashed var(--border-strong, var(--border));
  font-size: 12.5px; font-weight: 600; color: var(--text-muted);
  user-select: none;
}
.kanban__waiting > summary:hover, .kanban__waiting > summary:focus-visible {
  color: var(--text); border-color: var(--brand); background: var(--surface);
}
.kanban__waiting > summary::-webkit-details-marker { display: none; }
.kanban__waiting > summary > span:first-child::before { content: '▸ '; }
.kanban__waiting[open] > summary > span:first-child::before { content: '▾ '; }
.kanban__waiting-hint { font-weight: 400; font-size: 11.5px; }
.kanban__waiting > .card { margin-top: 6px; opacity: .75; }
.maint-reps { display: grid; gap: 3px; font-size: 12.5px; }
.proposal__rep { margin-top: 8px; padding-top: 8px; border-top: 1px dashed color-mix(in srgb, var(--brand-bright, var(--brand)) 25%, transparent); }

/* ---------- Tarefas (formato To Do) ---------- */

.todo__add {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-xs, none);
}
.todo__add:focus-within { border-color: var(--brand); }
.todo__add-plus { color: var(--brand); font-size: 20px; font-weight: 600; width: 22px; text-align: center; }
.todo__add-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 14.5px; color: var(--text); padding: 6px 0;
}
.todo__add-date { width: auto; max-width: 150px; }

.todo { display: grid; gap: 18px; }
.todo__group { display: grid; gap: 4px; }
.todo__group-title {
  display: flex; align-items: center; gap: 8px; margin: 0 0 4px;
  font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted);
}
.todo__group--atrasadas .todo__group-title { color: var(--danger); }
.todo__group--hoje .todo__group-title { color: var(--brand); }
.todo__count {
  font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 999px;
  background: var(--surface-soft); color: var(--text-muted);
}

.todo__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; min-height: 52px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer;
}
.todo__item:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.todo__item:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.todo__item.is-late { border-left: 3px solid var(--danger); }
.todo__body { flex: 1; min-width: 0; }
.todo__title { font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.todo__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px;
  font-size: 12px; color: var(--text-muted);
}
.todo__auto { color: var(--text-muted); }
.todo__item.is-done .todo__title { text-decoration: line-through; color: var(--text-muted); }

.todo__check {
  flex: none; width: 22px; height: 22px; padding: 0; border-radius: 50%;
  border: 2px solid var(--border-strong, var(--text-muted)); background: transparent;
  display: grid; place-items: center; cursor: pointer; color: transparent; font-size: 12px; line-height: 1;
}
.todo__check:hover, .todo__check:focus-visible { border-color: var(--ok); color: var(--ok); }
.todo__check:hover::after { content: '✓'; }
.todo__check.is-done { background: var(--ok); border-color: var(--ok); color: #fff; }
.todo__check.is-done::after { content: '✓'; }

.todo__star {
  flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent;
  font-size: 18px; line-height: 1; color: var(--text-muted); cursor: pointer;
}
.todo__star:hover { background: var(--surface-soft); color: var(--warn); }
.todo__star.is-on { color: var(--warn); }

.todo__done > summary {
  display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer;
  padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 650; color: var(--text-muted);
  border: 1px dashed var(--border-strong, var(--border));
}
.todo__done > summary:hover { color: var(--text); border-color: var(--brand); }
.todo__done > summary::-webkit-details-marker { display: none; }
.todo__done > summary::before { content: '▸'; }
.todo__done[open] > summary::before { content: '▾'; }
.todo__done[open] > summary { margin-bottom: 4px; }
.todo__done > .todo__item { margin-top: 4px; opacity: .8; }
.todo__empty { text-align: center; padding: 40px 0; color: var(--text-muted); }

/* painel lateral de detalhes */
.todo-panel__backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 14, 20, .35); display: flex; justify-content: flex-end;
}
.todo-panel {
  width: min(420px, 100vw); height: 100%; display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg, var(--shadow));
}
.todo-panel__head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.todo-panel__body { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 12px; align-content: start; }
.todo-panel__go { justify-self: start; }
.todo-panel__snooze { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.todo-panel__snooze .input { width: auto; }
.todo-panel__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.todo-panel__foot .btn--danger { margin-right: auto; }

@media (max-width: 640px) {
  .todo__add { flex-wrap: wrap; }
  .todo__add-input { flex-basis: calc(100% - 40px); }
}
.todo-panel .input:disabled { opacity: .65; cursor: not-allowed; }

/* ---------- Calendário ---------- */

.alert--info {
  border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent);
  background: color-mix(in srgb, var(--brand) 8%, transparent);
}
.alert--ok {
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
  background: color-mix(in srgb, var(--ok) 8%, transparent);
  display: grid; gap: 6px; justify-items: start;
}
.alert--warn ul { margin: 6px 0; padding-left: 1.2em; }
.cal__google { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

.cal__legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.cal__chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 12.5px; cursor: pointer;
}
.cal__chip.is-off { opacity: .45; text-decoration: line-through; }
.cal__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cal-cor); }
.cal__chip--os, .cal__item--os { --cal-cor: var(--brand-bright, var(--brand)); }
.cal__chip--tarefa, .cal__item--tarefa { --cal-cor: var(--warn); }
.cal__chip--repetitiva, .cal__item--repetitiva { --cal-cor: var(--text-muted); }
.cal__chip--google, .cal__item--google { --cal-cor: #6b7cff; }
.cal__item--st-waiting_client, .cal__item--st-paused { --cal-cor: var(--warn); }

.cal { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal__weekdays, .cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal__weekdays > div {
  padding: 8px; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.cal--semana .cal__weekdays { display: none; }
.cal__day {
  min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); cursor: pointer;
}
.cal__day:nth-child(7n) { border-right: 0; }
.cal__day:hover { background: var(--surface-soft); }
.cal__day.is-out { background: color-mix(in srgb, var(--surface-soft) 60%, transparent); }
.cal__day.is-out .cal__daynum { opacity: .5; }
.cal--semana .cal__day { min-height: 420px; }
.cal__daynum { display: flex; gap: 6px; align-items: baseline; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 2px; }
.cal__dow { text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
.cal__day.is-today .cal__daynum > span:last-child {
  background: var(--brand); color: #fff; border-radius: 999px; min-width: 22px; height: 22px;
  display: inline-grid; place-items: center; padding: 0 6px;
}

.cal__item {
  display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0;
  padding: 2px 6px; border: 0; border-radius: 5px; cursor: pointer; text-align: left;
  font: inherit; font-size: 12px; line-height: 1.45; color: var(--text);
  background: color-mix(in srgb, var(--cal-cor) 16%, transparent);
  border-left: 3px solid var(--cal-cor);
}
.cal__item:hover { background: color-mix(in srgb, var(--cal-cor) 28%, transparent); }
.cal__item--repetitiva { background: transparent; border: 1px dashed var(--cal-cor); border-left-width: 3px; border-left-style: solid; }
.cal__item.is-done { opacity: .55; }
.cal__item.is-done .cal__label { text-decoration: line-through; }
.cal__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal--semana .cal__label { white-space: normal; }
.cal__time { flex: none; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 11px; color: var(--text-muted); }
.cal__star { color: var(--warn); flex: none; }
.cal__more {
  border: 0; background: transparent; padding: 2px 6px; text-align: left; cursor: pointer;
  font: inherit; font-size: 11.5px; color: var(--text-muted);
}
.cal__more:hover { color: var(--text); text-decoration: underline; }
.cal-day-panel__row { display: grid; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.cal-day-panel__row .cal__label { white-space: normal; }

@media (max-width: 760px) {
  .cal--mes .cal__day { min-height: 74px; padding: 3px; }
  .cal--mes .cal__item { font-size: 10.5px; padding: 1px 3px; }
  .cal--mes .cal__time { display: none; }
  .cal--semana .cal__grid { grid-template-columns: 1fr; }
  .cal--semana .cal__day { min-height: 0; border-right: 0; }
}

/* ---------- Configurações → Google ---------- */

.google-status { display: grid; gap: 8px; margin-bottom: 12px; }
.google-status__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.google-status__row strong { min-width: 64px; }
.google-steps { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 4px; color: var(--text-muted); font-size: 13.5px; }
.google-uri {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px;
  padding: 8px 10px; border-radius: 8px; background: var(--surface-soft); border: 1px solid var(--border);
}
.google-uri code { overflow-wrap: anywhere; font-size: 12.5px; flex: 1; min-width: 0; }

.prazo-field { display: grid; grid-template-columns: 140px 1fr; gap: 8px; }
