/* Identidade visual compartilhada com o VendaOM. */
:root {
  color-scheme: light;
  --bg: #f7f7ff;
  --surface: #fff;
  --surface2: #f1f1f8;
  --surface3: #e9e9f2;
  --border: #e3e3ee;
  --border-strong: #b6becd;
  --text: #3c4857;
  --text2: #5f6b7a;
  --text3: #657185;
  --accent: #117d95;
  --accent2: #0e6a7f;
  --accent-soft: #e6f3f6;
  --bar: #2e2e3a;
  --bar-item: #dfe3ea;
  --bar-border: #636370;
  --active-line: #e22446;
  --green: #197b48;
  --red: #b83243;
  --blue: #3d6694;
  --purple: #6d28d9;
  --warning-text: #8a4d0c;
  --focus-ring: #117d95;
  --radius: 6px;
  --radius-card: 8px;
  --shadow-card: 0 2px 10px rgb(46 46 58 / 8%);
  --shadow-dialog: 0 16px 42px rgb(46 46 58 / 21%);
  --font-body: 'Figtree', 'Segoe UI', system-ui, sans-serif;
  --font-head: var(--font-body);
}

body { font-size: 14px; line-height: 1.45; }
input, select, textarea, button { font-family: inherit; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
::placeholder { color: var(--text3); opacity: 1; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Entrada e navegação */
#login-screen {
  min-height: 100dvh;
  background: var(--bg);
  padding: 24px 16px;
}
.login-box {
  width: min(100%, 396px);
  padding: 32px;
  border-radius: 12px;
  box-shadow: var(--shadow-card);
}
.login-logo { display: block; width: 196px; max-width: 100%; margin: 0 auto 22px; }
.login-title { margin: 0 0 22px; font-size: 23px; font-weight: 700; }
.login-field { display: grid; gap: 5px; margin: 0 0 12px; text-align: left; }
.login-field label { font-size: 13px; font-weight: 600; }
.login-field input { min-height: 42px; }
.login-lembrar { display: flex; align-items: center; gap: 8px; margin: 6px 0 18px; text-align: left; }
.login-lembrar label { font-size: 13px; color: var(--text2); cursor: pointer; }
.login-lembrar input { width: 16px; height: 16px; cursor: pointer; }
.login-error { font-size: 13px; }
.login-box .btn-primary { min-height: 42px; padding: 9px 14px; font-size: 14px; letter-spacing: 0; text-transform: none; }

.topbar {
  min-height: 56px;
  background: var(--bar);
  color: #fff;
  border-bottom: 1px solid var(--bar);
  box-shadow: none;
  column-gap: 14px;
}
.topbar > img { max-width: 135px; flex-shrink: 0; }
.topbar-center { min-width: 160px; }
.topbar-right { min-width: 0; gap: 6px; }
.topbar .search-input {
  color: #fff;
  background: #393947;
  border-color: var(--bar-border);
}
.topbar .search-input::placeholder, .topbar .search-icon { color: #d0d2df; }
.topbar :where(a, button, input):focus-visible { outline-color: #87dceb; }
.topbar .user-badge {
  max-width: 122px;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #393947;
  border-color: var(--bar-border);
  color: var(--bar-item);
  border-radius: var(--radius);
}
.topbar .btn-ghost {
  background: transparent;
  border-color: var(--bar-border);
  color: var(--bar-item);
}
.topbar .btn-ghost:hover { background: #454554; border-color: #8a8a99; color: #fff; }
.topbar .btn-accent { background: var(--accent); }
.nav-tabs { gap: 2px; padding: 0; background: transparent; }
.nav-tab {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--bar-item);
  font-size: 13px;
  font-weight: 600;
}
.nav-tab:hover { color: #fff; background: #41414e; }
.nav-tab.active { color: #fff; background: #393947; box-shadow: inset 0 -3px 0 var(--active-line); }
#search-results { position: absolute; top: 100%; box-shadow: var(--shadow-card); }
#search-results:empty { display: none; }

/* Campos, tabelas e ações */
.btn-sm, .btn-primary, .modal-close { border-radius: var(--radius); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-weight: 600; }
.btn-accent, .btn-primary { background: var(--accent); color: #fff; }
.btn-accent:hover, .btn-primary:hover { background: var(--accent2); opacity: 1; }
.btn-green { background: var(--green); color: #fff; }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text2); }
.btn-ghost:hover { background: var(--surface2); border-color: var(--text3); color: var(--text); }
.form-label { color: var(--text); font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; }
:is(.search-input, .user-select, .pin-digit, .form-input, .form-select, .form-textarea, .msg-sidebar-search, .msg-input) {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
}
:is(.search-input, .user-select, .pin-digit, .form-input, .form-select, .form-textarea, .msg-sidebar-search, .msg-input):focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 2px rgb(17 125 149 / 14%);
}
.modal-overlay { background: rgb(46 46 58 / 53%); }
.modal { border-radius: 12px; box-shadow: var(--shadow-dialog); }
.modal-title { font-size: 18px; }
.modal-header, .modal-footer { border-color: var(--border); }
.canal-chip.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent2); }
.history-item { border: 1px solid var(--border); border-left-width: 3px; }
:is(#view-relatorios, #view-admin, #view-site, #view-conversador, #view-anuncios) th {
  background: #e9eaf4;
  color: var(--text);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
:is(#view-relatorios, #view-admin, #view-site, #view-conversador, #view-anuncios) tbody tr:hover { background: var(--surface2); }
.stat-card, .chart-section, .admin-section, .perdidos-box, .lead-fin-card {
  border-color: var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.stat-label, .stat-sub { font-size: 12px; }
.chart-title, .admin-title { color: var(--text); }

/* Atendimentos */
.kanban-toolbar select { border-radius: var(--radius); border: 1px solid var(--border-strong); padding: 5px 8px; }
.kanban-col { background: var(--surface2); border-radius: var(--radius-card); }
.col-header { border-radius: var(--radius-card) var(--radius-card) 0 0; }
.col-title { font-size: 12px; text-transform: none; letter-spacing: 0; }
.col-count { background: var(--surface2); }
.lead-card { background: var(--surface); border-radius: var(--radius-card); padding: 11px 12px; }
.lead-card:hover { border-color: var(--accent); box-shadow: var(--shadow-card); }
.lead-card.unowned { background: #fffcf2; border-color: #e3b966; }
.lead-card.esfriando { background: #f4f8ff; border-color: #b9cce8; }
.lead-card.urgente { background: #fff1f4; border-color: #d98997; }
.card-name { font-size: 14px; }
.card-owner, .card-tag.canal, .card-tag.sem-dono { color: var(--warning-text); }
.card-tag.esfriando-tag { color: var(--blue); }

/* Mensagens */
.msg-sidebar, .msg-header, .msg-footer { background: var(--surface); }
.msg-body { background: var(--bg); }
.msg-conv-item { border-bottom-color: var(--border); }
.msg-conv-item.active { background: var(--accent-soft); }
.msg-conv-item.nao-lida .msg-conv-name { color: var(--text); }
.msg-filter-tab { background: var(--surface); color: var(--text2); border-color: var(--border-strong); }
.msg-filter-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.msg-bubble { font-size: 14px; line-height: 1.5; }
.msg-bubble.in { background: var(--surface); border: 1px solid var(--border); }
.msg-bubble.out { background: #dceff4; color: #214853; border: 1px solid #bfdde6; }
.msg-bubble.out a, .msg-bubble.in a { color: var(--accent2); }
.msg-bubble .cw-transcricao { color: var(--text2); }
.msg-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 260px;
  margin-top: 4px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.msg-attachment-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--surface2);
  color: var(--text2);
  border-radius: var(--radius);
  font-size: 10px;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
}
.msg-attachment-icon.pdf { background: #fff0f3; font-size: 20px; }
.msg-attachment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 12px; font-weight: 600; }
.msg-attachment-link { display: inline-block; margin-top: 3px; color: var(--accent2); font-size: 12px; font-weight: 600; }
.msg-send-btn { border-radius: var(--radius); color: #fff; }
#badge-pontos { color: #fce0aa !important; }
#copyright { color: var(--text3); }

@media (min-width: 769px) and (max-width: 1190px) {
  .topbar { height: auto; flex-wrap: wrap; padding-block: 8px 5px; row-gap: 5px; }
  .topbar .nav-tabs { order: 1; flex: 1 0 100%; }
  .topbar-right { margin-left: auto; }
}

@media (max-width: 768px) {
  #app.logado { height: 100dvh; }
  #view-mensagens { position: relative; }
  .topbar { row-gap: 7px; padding: 8px 12px; }
  .topbar-center { min-width: 0; }
  .topbar-right { margin-left: auto; gap: 4px; }
  .topbar-right .btn-sm { min-height: 38px; padding: 6px 9px; }
  .search-input, .msg-sidebar-search, .msg-input, .login-field input { font-size: 16px; }
  .msg-input { min-width: 0; }
  .msg-filter-tab { min-height: 36px; padding: 7px 11px; }
  .modal-body { padding: 18px 16px; }
  #nav-mobile { border-top-color: var(--border); box-shadow: 0 -2px 12px rgb(46 46 58 / 7%); }
  .navmob-item.ativo { color: var(--accent2); box-shadow: inset 0 2px 0 var(--active-line); }
}

@media (max-width: 380px) {
  .login-box { padding: 24px; }
  .topbar > img { max-width: 106px; }
}
