/* ============================================================
   VX CRM — Shell + componentes compartilhados
   Identidade: Vieira Xavier — navy var(--bg), acento var(--accent).
   Requer: assets/css/base.css (tokens).
   ============================================================ */

[hidden] { display: none !important; }

body { overflow: hidden; }

/* ============================================================
   LAYOUT — .app grid (sidebar + main)
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  height: 100vh;
  height: 100dvh;
  transition: grid-template-columns .25s cubic-bezier(.22, 1, .36, 1);
}
.app.collapsed { grid-template-columns: 68px 1fr; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--navy-deep);
  display: flex;
  flex-direction: column;
  padding: 20px 10px 12px;
  overflow: hidden;
  min-height: 0;
}
.sidebar .logo {
  padding: 0 10px 18px;
  font-size: 19px;
  gap: 9px;
  white-space: nowrap;
  align-items: center;
}
.pro-badge {
  background: var(--green);
  color: var(--on-accent);
  font-family: var(--font-ui);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1.4px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--pill);
  transform: translateY(1px);
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 10px;
  scrollbar-width: thin;
}

.nav-sec {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--muted);
  margin: 16px 12px 6px;
  white-space: nowrap;
  transition: opacity .2s;
}
.sidebar-nav .nav-sec:first-child { margin-top: 2px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { color: var(--white); background: hsla(0, 0%, 100%, .05); }
.nav-item.active { color: var(--white); background: var(--surface-3); }
.nav-item.active svg { stroke: var(--green); }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--green);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.side-link {
  display: block;
  color: var(--subtle);
  font-size: 12px;
  padding: 7px 12px;
  white-space: nowrap;
  transition: color .15s;
}
.side-link:hover { color: var(--muted); }
.side-collapse { color: var(--subtle); font-size: 12.5px; }

/* Assinatura da Saraiva's no pé do menu */
.side-credito {
  display: block; margin-top: 14px; padding: 12px 12px 4px;
  border-top: 1px solid var(--border); text-decoration: none;
  line-height: 1.45; transition: opacity .15s;
}
.side-credito span { display: block; font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--subtle); }
.side-credito b { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.side-credito:hover b { color: var(--accent-soft); }
.app.collapsed .side-credito { display: none; }
.side-collapse svg { transition: transform .25s ease; }

/* ---------- Sidebar colapsada ---------- */
.app.collapsed .sidebar { padding-left: 8px; padding-right: 8px; }
.app.collapsed .logo { justify-content: center; padding: 0 0 18px; }
.app.collapsed .logo-text,
.app.collapsed .pro-badge,
.app.collapsed .side-link { display: none; }
.app.collapsed .nav-item { justify-content: center; padding: 11px 0; gap: 0; }
.app.collapsed .nav-item span { display: none; }
.app.collapsed .nav-item.active::before { left: -8px; }
.app.collapsed .nav-sec {
  height: 1px;
  margin: 10px 8px;
  padding: 0;
  background: var(--border);
  overflow: hidden;
  color: transparent;
  font-size: 0;
  letter-spacing: 0;
}
.app.collapsed .side-collapse svg { transform: rotate(180deg); }

/* ---------- Main + topbar sticky com blur ---------- */
.main {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(3, 13, 53, .78);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
}
.topbar h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar-actions .btn { white-space: nowrap; }

/* ---------- Busca global ---------- */
.search-box { position: relative; flex: 1; max-width: 420px; min-width: 140px; }
.search-box > svg {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--subtle);
  cursor: pointer;
  transition: color .15s;
  z-index: 2;
}
.search-box > svg:hover { color: var(--white); }
.search-box input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--pill);
  padding: 10px 74px 10px 42px;
  color: var(--white);
  font-size: 13.5px;
}
.search-box input:focus { border-color: var(--green); background: var(--surface-3); }
.kbd-hint {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--subtle);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.kbd-hint:hover { color: var(--white); border-color: var(--accent-soft); }

/* Dropdown de resultados da busca do topbar */
.search-drop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, .6);
  z-index: 300;
  max-height: 380px;
  overflow-y: auto;
  padding: 6px;
  animation: gp-menu-in .15s ease;
}

/* ---------- Botão de ícone ---------- */
.btn-icon {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, color .15s, transform .1s;
}
.btn-icon:hover { background: var(--surface-3); color: var(--white); }
.btn-icon:active { transform: scale(.92); }
/* Desabilitado continua OCUPANDO o lugar, só apagado — como o Voltar de
   qualquer navegador. É o que faz a pessoa saber que ele existe antes de
   precisar dele. Sem hover e sem clique afundando, para não prometer uma
   ação que não vai acontecer. */
.btn-icon:disabled { opacity: .3; cursor: default; }
.btn-icon:disabled:hover { background: transparent; color: var(--muted); }
.btn-icon:disabled:active { transform: none; }

/* ---------- Pílula de alternância (.dsh-range) ----------
   Carga/Desempenho no painel Equipe, 3m/6m/12m na receita. Morava dentro do
   view-dashboard.js, preso a `#view-dashboard`. Quando o painel Equipe passou
   a aparecer também em Relatórios, os botões de lá saíram com a cara padrão
   do navegador — branco com borda preta no meio de um painel navy.
   Veio para cá em 14/08 porque deixou de pertencer a uma tela só. */
.dsh-range { display: flex; align-items: center; gap: 2px; background: var(--surface-2); border-radius: var(--pill); padding: 3px; }
.dsh-range button { border: none; background: none; color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; padding: 5px 12px; border-radius: var(--pill); cursor: pointer; transition: background .15s, color .15s, transform .1s; }
.dsh-range button:hover { color: var(--white); }
.dsh-range button:active { transform: scale(.95); }
.dsh-range button.active { background: var(--green); color: var(--on-accent); }

/* ---------- Badge do sino ---------- */
.bell-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--green);
  color: var(--on-accent);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
  box-sizing: content-box;
  line-height: 1;
}

/* ---------- Avatares ---------- */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .4px;
  color: var(--white);
  background: var(--surface-3);
  flex-shrink: 0;
  user-select: none;
}
.avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-lg { width: 56px; height: 56px; font-size: 19px; }
#topbar-avatar { cursor: pointer; transition: box-shadow .15s, transform .1s; }
#topbar-avatar:hover { box-shadow: 0 0 0 2px var(--green); }
#topbar-avatar:active { transform: scale(.94); }

/* ---------- Conteúdo e views ---------- */
.content { flex: 1; padding: 26px 32px 48px; min-width: 0; }
.view { display: none; }
.view.active { display: block; animation: gp-view-in .3s ease; }

/* ============================================================
   INPUTS GLOBAIS (dark)
   ============================================================ */
input, select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--white);
  font-size: 13.5px;
  font-family: var(--font-ui);
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, background .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); }
input::placeholder, textarea::placeholder { color: var(--subtle); }
input[type="checkbox"], input[type="radio"] {
  width: auto;
  padding: 0;
  accent-color: var(--green);
  cursor: pointer;
}
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] { color-scheme: dark; }
input[type="file"] { padding: 8px; cursor: pointer; }
select { cursor: pointer; }
select option { background: var(--surface-2); color: var(--white); }
textarea { resize: vertical; min-height: 70px; line-height: 1.5; }

.btn:focus-visible, .btn-icon:focus-visible, .nav-item:focus-visible,
.tab:focus-visible, .menu-item:focus-visible, .cmdk-item:focus-visible,
.kbd-hint:focus-visible, .avatar:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* ============================================================
   COMPONENTES
   ============================================================ */

/* ---------- Painel ---------- */
.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-head h3 { font-size: 15px; font-weight: 700; min-width: 0; }
.panel-head h3 span { color: var(--subtle); font-weight: 400; font-size: 12px; margin-left: 8px; }
.panel-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.panel-body { min-width: 0; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar input[type="text"], .toolbar input[type="search"] { min-width: 190px; }
.toolbar select { max-width: 220px; }

/* ---------- Tabela ---------- */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: auto;
  min-width: 0;
}
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--subtle);
  font-weight: 600;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table-wrap tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.table-wrap tbody tr { transition: background .12s; }
.table-wrap tbody tr:hover { background: var(--surface-2); }
.table-wrap tbody tr:last-child td { border-bottom: none; }
.right { text-align: right; }

/* ---------- KPIs ---------- */
/* ⚠️ 190px cortava o numero em 1366x768, que e a tela de escritorio mais
   comum. Com esse minimo cabiam CINCO colunas: sobravam 161px de largura
   util, e "R$ 136.757,18" em 25px monoespacada precisa de 189. O ultimo
   digito ficava por baixo da borda do cartao — e um valor cortado na casa
   final e pior que valor nenhum, porque ainda parece um numero.

   240px faz caber quatro colunas em 1366 (272px cada) e cinco so a partir
   de ~1600, onde ha espaco de verdade. Medido no navegador em 09-10/09. */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
/* O cartao vira contexto de medida para o valor la dentro: assim a fonte
   encolhe com a LARGURA DO CARTAO, e nao com a da janela. Sem isto, abrir o
   menu lateral ou usar uma tela menor voltaria a cortar. */
.kpi {
  container-type: inline-size;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px 20px 14px;
  position: relative;
  overflow: hidden;
  min-width: 0;
  transition: background .2s;
}
.kpi:hover { background: var(--surface-2); }
.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .9px;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* A fonte acompanha o cartao. 11.5cqw cabe "R$ 136.757,18" (13 caracteres
   monoespacados, ~0,6 de largura cada) com folga dentro do cartao, e o
   clamp impede que ela fique ilegivel num cartao estreito ou gigante numa
   tela larga. O nowrap fica: valor quebrado em duas linhas e pior que
   valor menor. */
.kpi-value {
  font-family: var(--font-mono);
  font-size: clamp(17px, 11.5cqw, 25px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.5px;
  white-space: nowrap;
}
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  margin-top: 6px;
}
.kpi-delta.up { color: var(--green-hover); }
.kpi-delta.down { color: var(--danger); }
.kpi-spark { margin-top: 10px; height: 36px; opacity: .9; }
.kpi-spark svg { width: 100%; display: block; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: none;
  color: var(--muted);
  border-radius: var(--pill);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, color .15s, transform .1s;
}
.tab:hover { color: var(--white); background: var(--surface-3); }
.tab:active { transform: scale(.97); }
.tab.active { background: var(--green); color: var(--on-accent); }
.tab-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  background: hsla(0, 0%, 100%, .12);
  padding: 1px 7px;
  border-radius: var(--pill);
  line-height: 1.5;
}
.tab.active .tab-count { background: rgba(0, 0, 0, .18); color: var(--on-accent); }

/* ---------- Chip ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: hsla(0, 0%, 100%, .07);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--pill);
  line-height: 1.5;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Progress ---------- */
.progress {
  height: 8px;
  background: var(--surface-3);
  border-radius: 6px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-hover));
  border-radius: 6px;
  min-width: 2px;
  transition: width .6s cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Estado vazio ---------- */
.empty-state { text-align: center; padding: 44px 20px; }
.empty-state .es-icon { font-size: 34px; margin-bottom: 12px; }
.empty-state h4 { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--subtle); max-width: 360px; margin: 0 auto; line-height: 1.55; }

/* ---------- Formulários ---------- */
.form-field { margin-bottom: 14px; min-width: 0; }
.form-field label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.form-field input, .form-field select, .form-field textarea { width: 100%; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ============================================================
   SEÇÃO DE FORMULÁRIO — 05/09/2026

   A ficha do cliente passou de 8 para 20 campos com os dados
   previdenciários. Vinte campos em fila viram parede: ninguém acha o CPF,
   e quem preenche desiste no meio.

   Cada bloco tem título e uma linha acima. O título é pequeno e em caixa
   alta — ele orienta, não compete com o rótulo do campo.
   ============================================================ */
.form-sec { margin: 20px 0 2px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-sec:first-of-type { margin-top: 4px; padding-top: 0; border-top: 0; }
.form-sec-t {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 12px;
}
.form-sec-t b {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--accent-soft);
}
.form-sec-t i {
  font-style: normal;
  font-size: 11.5px;
  color: var(--subtle);
}

/* ---------- Grids de painéis ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }

/* ---------- Seções de drawer / pares label-valor ---------- */
.d-sec { margin-bottom: 22px; }
.d-sec-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--subtle);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 7px 0;
  font-size: 13px;
}
.kv span { color: var(--muted); flex-shrink: 0; }
.kv b { font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ---------- Menu dropdown (UI.dropdown) ---------- */
.menu {
  position: fixed;
  z-index: 500;
  min-width: 190px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: var(--shadow);
  animation: gp-menu-in .14s ease;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: 7px;
  white-space: nowrap;
  transition: background .12s;
}
.menu-item:hover { background: hsla(0, 0%, 100%, .08); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: rgba(var(--danger-rgb), .12); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }

/* ============================================================
   COMMAND PALETTE (.cmdk)
   ============================================================ */
.cmdk {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, .65);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
  animation: gp-fade-in .15s ease;
}
.cmdk-box {
  width: min(640px, 100%);
  max-height: min(480px, 72vh);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 28px 72px rgba(0, 0, 0, .7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: gp-pop-in .18s cubic-bezier(.22, 1, .36, 1);
}
.cmdk-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.cmdk-input-wrap svg { color: var(--subtle); flex-shrink: 0; }
.cmdk .cmdk-input {
  flex: 1;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  color: var(--white);
  font-size: 16px;
}
.cmdk-results { flex: 1; overflow-y: auto; padding: 8px; }
.cmdk-group {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--subtle);
  padding: 10px 12px 5px;
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.cmdk-item .ci-icon { width: 22px; text-align: center; flex-shrink: 0; font-size: 15px; }
.cmdk-item .ci-label {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.cmdk-item .ci-sub {
  margin-left: auto;
  color: var(--subtle);
  font-family: var(--font-mono);
  font-size: 11.5px;
  flex-shrink: 0;
  white-space: nowrap;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmdk-item.sel { background: hsla(0, 0%, 100%, .08); }
.cmdk-item.sel .ci-label { color: var(--white); }
.cmdk-item.sel .ci-icon { transform: scale(1.1); }
.cmdk-empty { padding: 36px 20px; text-align: center; color: var(--subtle); font-size: 13.5px; }
.cmdk-foot {
  display: flex;
  gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  color: var(--subtle);
  font-size: 11px;
}
.cmdk-foot kbd {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  margin-right: 4px;
}

/* ============================================================
   PAINEL DE NOTIFICAÇÕES
   ============================================================ */
.notif-panel {
  position: fixed;
  top: 64px;
  right: 20px;
  width: min(370px, calc(100vw - 32px));
  max-height: 70vh;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .65);
  z-index: 550;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: gp-drop-in .18s cubic-bezier(.22, 1, .36, 1);
}
.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.notif-head h4 { font-size: 14px; font-weight: 700; }
.notif-actions { display: flex; gap: 4px; }
.notif-actions button {
  background: none;
  border: none;
  color: var(--subtle);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color .12s, background .12s;
}
.notif-actions button:hover { color: var(--white); background: var(--surface-3); }
.notif-list { overflow-y: auto; padding: 6px; }
.notif-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: background .12s;
}
.notif-item:hover { background: hsla(0, 0%, 100%, .05); }
.notif-item .ni-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.notif-item .ni-text { flex: 1; min-width: 0; line-height: 1.45; overflow-wrap: anywhere; }
.notif-item .ni-time { display: block; font-family: var(--font-mono); font-size: 10.5px; color: var(--subtle); margin-top: 3px; }
.notif-item.unread { color: var(--text); }
.notif-item.unread::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  margin-top: 6px;
}

/* ============================================================
   DRAWER (painel deslizante à direita)
   ============================================================ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 450;
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: gp-fade-in .2s ease;
  overscroll-behavior: contain;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 460;
  width: 560px;
  max-width: calc(100vw - 20px);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -24px 0 60px rgba(0, 0, 0, .55);
  display: flex;
  flex-direction: column;
  animation: gp-drawer-in .25s cubic-bezier(.22, 1, .36, 1);
}
.drawer.closing, .drawer-overlay.closing .drawer { animation: gp-drawer-out .2s ease forwards; }
.drawer-overlay.closing { animation: gp-fade-out .2s ease forwards; }
.drawer-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-shrink: 0;
}
.drawer-head > div:first-child, .drawer-head .drawer-titles { flex: 1; min-width: 0; }
.drawer-head h2, .drawer-head h3 { font-size: 17px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.drawer-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.drawer-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}
.drawer-close:hover { color: var(--white); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 28px; min-height: 0; }
.drawer-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  flex-shrink: 0;
  background: var(--surface);
}
.drawer-foot:empty { display: none; }

/* ============================================================
   MODAL (v2 — escopo do Pro)
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 520;
  background: rgba(0, 0, 0, .7);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: gp-fade-in .18s ease;
  overscroll-behavior: contain;
}
.modal {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: min(540px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 28px 72px rgba(0, 0, 0, .65);
  animation: gp-pop-in .22s cubic-bezier(.22, 1, .36, 1);
}
.modal.wide, .modal.modal-wide, .modal-wide { width: min(880px, 100%); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 14px;
  flex-shrink: 0;
}
.modal-head h2, .modal-head h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--white); }
.modal-body { padding: 2px 24px 20px; overflow-y: auto; min-height: 0; }
.modal-foot, .modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-foot:empty { display: none; }

/* ============================================================
   TOASTS
   ============================================================ */
.toast-zone {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 700;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast {
  pointer-events: auto;
  background: var(--green);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 13.5px;
  padding: 11px 24px;
  border-radius: var(--pill);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  animation: gp-toast-in .28s cubic-bezier(.22, 1, .36, 1);
}
.toast.ok { background: var(--green); color: var(--on-accent); }
.toast.err { background: var(--danger); color: var(--white); }
.toast.info { background: var(--surface-3); color: var(--white); border: 1px solid var(--border); }
.toast.out, .toast.hide { animation: gp-toast-out .25s ease forwards; }

/* ---------- Tooltip de gráfico ---------- */
.chart-tip {
  position: fixed;
  z-index: 800;
  pointer-events: none;
  background: var(--navy-deep);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  padding: 7px 11px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.chart-tip b { color: var(--green-hover); }

/* ============================================================
   ANIMAÇÕES
   ============================================================ */
@keyframes gp-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes gp-fade-out { to { opacity: 0; } }
@keyframes gp-view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes gp-menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes gp-drop-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes gp-pop-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes gp-drawer-in { from { opacity: 0; transform: translateX(64px); } to { opacity: 1; transform: none; } }
@keyframes gp-drawer-out { to { opacity: 0; transform: translateX(64px); } }
@keyframes gp-toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes gp-toast-out { to { opacity: 0; transform: translateY(10px) scale(.96); } }

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 1200px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .app, .app.collapsed { grid-template-columns: 1fr; height: auto; }
  .main { overflow: visible; height: auto; }
  .content { padding: 18px 16px 96px; }

  /* Sidebar vira barra inferior */
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 90;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    padding: 8px 10px;
    border-top: 1px solid var(--border);
    overflow: visible;
  }
  .sidebar .logo { padding: 0 8px 0 2px; }
  .logo-text, .pro-badge { display: none; }
  .sidebar-nav {
    flex-direction: row;
    align-items: center;
    gap: 2px;
    padding-bottom: 0;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .nav-sec { display: none; }
  .nav-item { width: auto; padding: 10px; justify-content: center; gap: 0; }
  .nav-item span { display: none; }
  .nav-item.active::before {
    left: 8px;
    right: 8px;
    top: auto;
    bottom: 2px;
    width: auto;
    height: 3px;
    border-radius: 3px;
  }
  .sidebar-footer { margin: 0; padding: 0; border: none; flex-direction: row; align-items: center; }
  .side-link, .side-collapse { display: none; }

  .topbar { padding: 12px 16px; gap: 10px; flex-wrap: wrap; }
  .topbar h1 { font-size: 18px; }
  /* O #btn-collapse da barra de cima saiu em 13/08 — era gêmeo do "Recolher"
     do pé da barra lateral. A regra que o escondia aqui foi junto.
     O #btn-voltar, que ocupou o lugar dele, FICA visível no celular: voltar
     é ainda mais necessário em tela pequena. */
  .search-box { order: 5; flex-basis: 100%; max-width: none; }
  .kbd-hint { display: none; }
  .search-box input { padding-right: 18px; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .drawer { width: 100vw; max-width: 100vw; border-left: none; }
  .notif-panel { top: 58px; right: 8px; left: 8px; width: auto; }
  .cmdk { padding: 6vh 12px 12px; }
  .toast-zone { bottom: 84px; }
}
