/* Tokens de design (cores dos temas claro/escuro, tipografia,
   espaçamento, raio, sombras). Fonte única — ver tokens.css. */
@import "tokens.css";
/* Componente de notificações flutuantes (toast). Ver toast.css + assets/js/toast.js */
@import "toast.css";

/* ===== Base ===== */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }

/* ===== Layout ===== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #0f172a;
  color: #cbd5e1;
  padding: 20px 14px;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  padding: 4px 8px 20px;
}

.menu { display: flex; flex-direction: column; gap: 4px; }

.menu a {
  padding: 10px 12px;
  border-radius: var(--radius);
  color: #cbd5e1;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.menu a:hover { background: #1e293b; color: #fff; }
.menu a.active { background: var(--primary); color: #fff; }

/* Agrupamento sanfonado (accordion) */
.menu-group { display: flex; flex-direction: column; }
.menu-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--radius);
  text-align: left;
}
.menu-group-header:hover { background: #1e293b; color: #fff; }
.menu-group-header .chev { transition: transform 0.15s; color: #64748b; }
.menu-group.open > .menu-group-header .chev { transform: rotate(90deg); }

.menu-group-body { display: none; flex-direction: column; gap: 2px; padding: 2px 0 4px 10px; }
.menu-group.open > .menu-group-body { display: flex; }
.menu-group-body a { font-size: 13px; padding: 8px 12px; }
/* Subgrupo aninhado (ex.: Develop → QA/Monitoramento/Dashboards) */
.menu-group-body .menu-group-header { font-size: 13px; padding: 7px 12px; }
.menu-group-body .menu-group-body { padding-left: 12px; }

.main { display: flex; flex-direction: column; }

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

.topbar h1 { font-size: 18px; margin: 0; }

.status { font-size: 22px; line-height: 1; color: var(--muted); }
.status.ok { color: var(--ok); }
.status.down { color: var(--danger); }

.content { padding: 24px; }

/* ===== Componentes ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 { margin: 0 0 12px; font-size: 15px; }

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

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .value { font-size: 28px; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
tr:last-child td { border-bottom: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-contrast);
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { filter: brightness(0.95); }
.btn.secondary { background: transparent; color: var(--primary); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); }
.field input {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}
.field input:focus { outline: 2px solid var(--primary); border-color: transparent; }

.row { display: flex; gap: 12px; align-items: flex-end; }

.msg { padding: 10px 12px; border-radius: var(--radius); font-size: 14px; margin-bottom: 14px; }
.msg.error { background: #fef2f2; color: var(--danger); }
.msg.ok { background: #f0fdf4; color: var(--ok); }

.muted { color: var(--muted); }
.empty { padding: 24px; text-align: center; color: var(--muted); }

/* Menu agrupado */
.menu-group {
  margin: 16px 12px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
}

/* Topbar: usuário + logout */
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.user-box { font-size: 14px; color: var(--text); }

/* Badges de status de sistema */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.online { background: #f0fdf4; color: var(--ok); }
.badge.degraded { background: #fffbeb; color: #b45309; }
.badge.down { background: #fef2f2; color: var(--danger); }
.badge.neutral { background: #f1f5f9; color: var(--muted); }

/* Login */
.login-overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.login-brand {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.login-card .btn { width: 100%; justify-content: center; margin-top: 4px; }

/* Utilitários */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.spacer { flex: 1; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #f1f5f9; color: var(--muted); }
.muted-sm { font-size: 12px; color: var(--muted); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.field textarea { padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius); font-family: inherit; font-size: 14px; min-height: 70px; }
.field.checkbox label { flex-direction: row; align-items: center; gap: 8px; display: flex; }
.field select { padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; background: #fff; }
pre.code { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; overflow: auto; font-size: 12px; white-space: pre-wrap; }

/* Abas */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 8px 0 16px; flex-wrap: wrap; }
.tab { border: none; background: transparent; padding: 9px 14px; cursor: pointer; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Toast: agora é componente reutilizável (assets/css/toast.css + assets/js/toast.js),
   importado no topo. ui.js re-exporta toast() delegando a ele. */

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 2500; padding: 20px; }
.modal-card { background: var(--surface); border-radius: 10px; width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; }
.modal-card.wide { max-width: 760px; }
.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-x { border: none; background: transparent; font-size: 16px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 18px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* Sino de notificações */
.bell { position: relative; }
.bell-btn { position: relative; border: none; background: transparent; font-size: 18px; cursor: pointer; }
.bell-count { position: absolute; top: -4px; right: -6px; background: var(--danger); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 999px; }
.bell-drop { position: absolute; right: 0; top: 32px; width: 300px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 8px; z-index: 2000; max-height: 400px; overflow: auto; }
.notif { display: block; padding: 8px 10px; border-radius: 6px; font-size: 13px; color: var(--text); }
.notif:hover { background: var(--bg); }
.notif.unread { font-weight: 600; }

/* Kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { background: #eef1f5; border-radius: 8px; min-width: 240px; width: 240px; flex-shrink: 0; display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.kanban-col-h { font-size: 13px; font-weight: 600; padding: 10px 12px; color: var(--text); flex-shrink: 0; }
.kanban-list { padding: 0 8px 8px; min-height: 40px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; }
.list-scroll { max-height: calc(100vh - 210px); overflow-y: auto; }
.kanban-card { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 10px; cursor: grab; font-size: 13px; }
.kanban-card:hover { border-color: var(--primary); }
.dep-badge { float: right; font-size: 11px; background: #eef2ff; color: #4338ca; border-radius: 10px; padding: 1px 7px; }
.sys-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.mon-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mon-count { border: 1px solid var(--border); border-radius: 10px; padding: 14px; text-align: center; }
.mon-count b { display: block; font-size: 26px; }
.mon-count span { font-size: 12px; color: var(--muted); }
/* KPIs da página + lista "top" das subpáginas */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.kpi { border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; }
.kpi b { display: block; font-size: 28px; }
.kpi span { font-size: 12px; color: var(--muted); }
.kpi { cursor: help; }
.kpi-help { color: var(--primary); font-size: 11px; cursor: help; }
/* Avatar do site: favicon por cima, globinho cinza (SVG) como fundo/fallback */
.favi { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; overflow: hidden; vertical-align: middle; margin-right: 8px; flex-shrink: 0;
  background: #f1f5f9 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='1.7'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cline x1='3' y1='12' x2='21' y2='12'/%3E%3Cpath d='M12 3a15 15 0 0 1 0 18 15 15 0 0 1 0-18'/%3E%3C/svg%3E") center/62% no-repeat; }
.favi img { width: 100%; height: 100%; object-fit: cover; display: block; background: #fff; }
.cli-name .favi { width: 28px; height: 28px; }
.top-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; cursor: pointer; }
.top-row:hover { border-color: var(--primary); background: #f8fafc; }
.top-rank { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.top-main { flex: 1; }
.top-val { text-align: right; }
.top-val b { display: block; font-size: 18px; }
.top-val span { font-size: 11px; color: var(--muted); }
.top-chev { color: var(--muted); font-size: 18px; }

/* ---------- Uptime / monitores ---------- */
.back-link { display: inline-block; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 10px; }
.back-link:hover { color: var(--primary); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tag-row { display: flex; gap: 8px; align-items: center; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* Bolinha de status do monitor */
.mon-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: middle; background: var(--muted); }
.mon-dot.online { background: #16a34a; }
.mon-dot.down { background: #dc2626; }
.mon-dot.degraded { background: #d97706; }
.mon-dot.paused { background: #94a3b8; }

/* Sparkline de disponibilidade (barras) */
.spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 26px; }
.spark-bar { width: 4px; height: 100%; border-radius: 2px; background: #16a34a; }
.spark-bar.down { background: #dc2626; height: 60%; }

/* Linha do tempo (detalhe) */
.timeline { display: flex; align-items: flex-end; gap: 3px; height: 130px; padding-top: 8px; }
.tl-bar { flex: 1; min-width: 4px; border-radius: 3px 3px 0 0; background: #16a34a; }
.tl-bar.down { background: #dc2626; }

/* Segmented control (tipo, método, regiões) */
.seg { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.seg-btn { padding: 8px 16px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; font: inherit; color: var(--text); }
.seg-btn:hover { border-color: var(--primary); }
.seg-btn.on { background: #dcfce7; border-color: #16a34a; color: #15803d; font-weight: 600; }

/* Headers da requisição */
.hdr-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; }

/* Editor de template em tela: editor à esquerda, preview à direita */
.tpl-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-top: 12px; }
@media (max-width: 1000px) { .tpl-editor { grid-template-columns: 1fr; } }
.tpl-left, .tpl-right { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.tpl-right { position: sticky; top: 12px; padding: 0; overflow: hidden; }
.tpl-preview-head { padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; color: var(--muted); }
.tpl-preview { width: 100%; height: 620px; border: 0; background: #fff; }
.var-legend { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 10px; }
.var-group { margin-bottom: 8px; }
.var-group-t { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.var-chip { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; background: #f8fafc; cursor: pointer; color: var(--text); }
.var-chip:hover { border-color: var(--primary); background: #eff6ff; }
.var-chip.img { background: #f5f3ff; }

/* Prancheta de desenho (assinatura da empresa) */
.draw-pad { height: 170px; border: 1px dashed #94a3b8; border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; display: block; }

/* Prova de vida no detalhe da assinatura */
.proof-grid { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.proof img { display: block; margin-top: 4px; max-height: 180px; max-width: 260px; border: 1px solid var(--border); border-radius: 8px; }
.proof img.on-white { background: #fff; }

/* Lista de envios no detalhe do template */
.envio-list { max-height: 592px; overflow: auto; padding: 4px 12px 12px; }
.envio-row { display: flex; align-items: center; gap: 8px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.envio-row:last-child { border-bottom: 0; }
.envio-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Banco de logos */
.logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.logo-slot { border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.logo-frame { height: 90px; display: flex; align-items: center; justify-content: center; border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.logo-frame img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-frame.on-dark { background: #1e293b; }
.logo-frame.on-light { background: #f1f5f9; }
.logo-slot-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.logo-slot code { font-size: 11px; }

/* Editor de texto do template (HTML/Jinja) */
.code-editor { width: 100%; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; tab-size: 2; background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: 12px; border: 1px solid var(--border); }
/* Editor com gutter de números de linha */
.code-wrap { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #0f172a; }
.code-gutter { flex: 0 0 auto; min-width: 40px; padding: 12px 8px 12px 6px; margin: 0; text-align: right; color: #64748b; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; background: #0b1220; white-space: pre; overflow: hidden; user-select: none; }
.code-wrap .code-editor { flex: 1; border: 0; border-radius: 0; min-height: 440px; resize: vertical; overflow: auto; }

/* Resposta de formulário: pares campo/valor (nunca JSON cru) */
.kv { display: flex; flex-direction: column; gap: 1px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.kv-row { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 12px; padding: 10px 14px; background: #fff; }
.kv-row:nth-child(even) { background: #f8fafc; }
.kv-k { color: var(--muted); font-size: 13px; word-break: break-word; }
.kv-v { font-size: 14px; white-space: pre-wrap; word-break: break-word; }

/* Combo buscável (título + subtítulo) */
.combo { position: relative; }
.combo-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; font-size: 14px; text-align: left; color: var(--muted); }
.combo-btn.has { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.combo-btn.has .combo-sublabel { color: rgba(255,255,255,.8); font-weight: 400; }
.combo-sublabel { color: var(--muted); }
.combo-chev { opacity: .7; }
.combo-pop { position: absolute; z-index: 30; left: 0; right: 0; margin-top: 4px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.15); overflow: hidden; }
.combo-search { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--muted); }
.combo-search input { flex: 1; border: none; outline: none; font-size: 14px; }
.combo-list { max-height: 280px; overflow-y: auto; }
.combo-opt { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.combo-opt:hover { background: #f8fafc; }
.combo-opt.sel { background: var(--primary); color: #fff; }
.combo-opt.sel .combo-s { color: rgba(255,255,255,.85); }
.combo-t { font-weight: 600; font-size: 14px; }
.combo-s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.combo-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
.status-banner { border-radius: 8px; padding: 12px 14px; margin: 4px 0 16px; font-size: 14px; }
.status-banner.warn { background: #fefce8; border: 1px solid #fde68a; color: #92400e; }
.status-banner.info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

.quote-total { text-align: right; font-size: 16px; margin-top: 12px; }

/* Builder de cotação */
.qb { display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px; }
.qb-total { font-size: 15px; }
.qb-catalog, .qb-cart { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg-btn { background: #fff; border: none; padding: 6px 10px; cursor: pointer; color: var(--muted); }
.seg-btn.on { background: var(--primary); color: #fff; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.cat-card { border: 1px solid var(--border); border-radius: 8px; padding: 8px; text-align: center; background: #fff; }
.cat-card img, .cat-row img { width: 100%; max-height: 84px; object-fit: cover; border-radius: 6px; }
.cat-row img { width: 44px; height: 44px; }
.cat-noimg { font-size: 28px; background: #f1f5f9; border-radius: 6px; padding: 14px 0; }
.cat-name { font-weight: 600; margin: 6px 0 2px; font-size: 13px; }
.cat-actions { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
.cat-listing { display: flex; flex-direction: column; gap: 6px; }
.cat-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.cart-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cart-item .ci-name { flex: 1; }
.cart-item .ci-price { width: 110px; }
.cart-item .star { background: none; border: none; cursor: pointer; font-size: 16px; }
.cart-item .star.on { color: #f59e0b; }
.qb-pricing { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.qb-pricing .muted-sm { flex-basis: 100%; }
@media (max-width: 900px) { .qb { grid-template-columns: 1fr; } }

/* Template da cotação (visão do cliente) */
.quote-view { display: flex; justify-content: center; padding: 24px 12px; }
.qv-card { width: 100%; max-width: 560px; background: linear-gradient(160deg, #0f172a, #1e3a5f); color: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.qv-brand { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.qv-sub { font-size: 12px; opacity: .7; margin-top: 2px; }
.qv-hi { margin: 18px 0 20px; font-size: 26px; }
.qv-items { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.qv-items td { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.15); }
.qv-items .qv-val { text-align: right; font-variant-numeric: tabular-nums; }
.qv-total { font-size: 20px; text-align: right; margin-top: 8px; }
.qv-total strong { font-size: 28px; color: #7dd3fc; }
.qv-notes { opacity: .8; font-size: 13px; margin-top: 16px; }

/* Proposta comercial (dashboard do cliente) */
.prop { display: flex; flex-direction: column; gap: 16px; }
.prop-hero { background: linear-gradient(155deg, #0f172a 0%, #1e3a5f 60%, #2563eb 140%); color: #fff; border-radius: 18px; padding: 26px; box-shadow: 0 14px 44px rgba(15,23,42,.28); }
.prop-brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.prop-logo { max-height: 40px; }
.prop-logo-txt { font-weight: 800; font-size: 20px; letter-spacing: .02em; }
.prop-tag { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; background: rgba(255,255,255,.15); padding: 5px 10px; border-radius: 20px; }
.prop-to { font-size: 15px; opacity: .9; }
.prop-addr { font-size: 12px; opacity: .7; }
.prop-plan { margin-top: 12px; font-size: 14px; opacity: .95; }
.prop-price { margin: 6px 0 2px; }
.prop-price span { font-size: 46px; font-weight: 800; color: #7dd3fc; }
.prop-price small { font-size: 18px; opacity: .8; }
.prop-setup { font-size: 13px; opacity: .85; }
.prop-valid { font-size: 12px; opacity: .7; margin-top: 8px; }
.prop-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.btn-cta { background: #22c55e; color: #052e16; border: none; font-weight: 700; font-size: 15px; padding: 12px 22px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-cta:hover { filter: brightness(1.05); }
.btn-cta.ghost { background: rgba(255,255,255,.14); color: #fff; }
.btn-cta:disabled { background: #16a34a; color: #fff; cursor: default; opacity: .9; }
.prop-sec { background: #fff; border-radius: 16px; padding: 22px; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.prop-sec h2 { margin: 0 0 14px; font-size: 18px; }
.prop-services { display: flex; flex-direction: column; gap: 12px; }
.prop-svc { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.prop-svc-h { display: flex; align-items: center; gap: 8px; }
.prop-svc-h strong { flex: 1; }
.prop-svc-val { font-weight: 700; color: var(--primary); }
.prop-star { font-size: 11px; color: #b45309; background: #fef3c7; padding: 1px 7px; border-radius: 10px; }
.prop-svc p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.prop-invest { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.prop-inv-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; }
.prop-inv-label { color: var(--muted); font-size: 13px; }
.prop-inv-val { font-size: 28px; font-weight: 800; margin-top: 4px; }
.prop-inv-val small { font-size: 15px; font-weight: 500; color: var(--muted); }
.prop-inv-note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.prop-cond { margin: 0; padding-left: 18px; color: #334155; font-size: 14px; line-height: 1.7; }
.prop-notes { margin-top: 12px; color: var(--muted); font-size: 13px; }
.prop-close { background: linear-gradient(155deg, #052e16, #16a34a); color: #fff; border-radius: 18px; padding: 28px; text-align: center; }
.prop-close h2 { margin: 0 0 8px; }
.prop-close p { opacity: .9; margin: 0 0 16px; }
.prop-close .prop-cta { justify-content: center; }
.prop-foot { margin-top: 18px; font-size: 12px; opacity: .8; }
@media (max-width: 560px) { .prop-invest { grid-template-columns: 1fr; } .prop-price span { font-size: 38px; } }
.grid a.stat { text-decoration: none; }

/* CRM — barra e toggle */
.crm-bar { background: var(--surface); padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--border); }
.viewtoggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.vt { border: none; background: #fff; padding: 8px 14px; cursor: pointer; font-size: 13px; color: var(--muted); }
.vt.on { background: var(--primary); color: #fff; }
.btn-icon { border: 1px solid var(--border); background: #fff; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 16px; }
.btn-icon:hover { border-color: var(--primary); }
.link-btn { border: none; background: none; color: var(--primary); cursor: pointer; font-size: 12px; padding: 0; }

/* CRM — card do lead */
.lead-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.lead-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.lead-top { display: flex; justify-content: space-between; align-items: center; }
.protocol { font-weight: 700; font-size: 13px; }
.lead-contact { display: flex; gap: 10px; align-items: center; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #e2e8f0; color: #475569; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.lead-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.tag.removable b { cursor: pointer; margin-left: 2px; }
.lead-foot { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 8px; }
.owner-badge { background: #f1f5f9; padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.col-count { float: right; background: #e2e8f0; color: var(--muted); border-radius: 999px; padding: 0 8px; font-size: 12px; }

/* CRM — detalhe */
.lead-detail { display: flex; flex-direction: column; gap: 18px; }
.det-sec h4 { margin: 0 0 8px; font-size: 14px; }
.det-sec textarea { width: 100%; min-height: 60px; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius); font-family: inherit; font-size: 14px; margin-bottom: 8px; }
.tag-search { display: flex; gap: 6px; margin-bottom: 8px; }
.tag-search input { flex: 1; padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius); }

/* CRM — detalhe em 2 colunas (dados | chat) */
.lead-modal { display: grid; grid-template-columns: 300px 1fr; gap: 16px; min-height: 60vh; }
.lead-side { border-right: 1px solid var(--border); padding-right: 16px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; max-height: 70vh; }
.lead-main { display: flex; flex-direction: column; min-height: 0; }
.chat-wrap { display: flex; flex-direction: column; height: 56vh; }
.chat-log { flex: 1; overflow-y: auto; background: #f1f5f9; border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-sys { text-align: center; font-size: 12px; color: var(--muted); }
.chat-msg { display: flex; justify-content: flex-end; }
.chat-bub { background: #dcf8c6; border-radius: 10px; padding: 8px 12px; max-width: 80%; font-size: 14px; }
.chat-meta { font-size: 11px; color: #64748b; margin-bottom: 2px; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.chat-input select { padding: 8px; border: 1px solid var(--border); border-radius: 6px; }
.chat-input textarea { flex: 1; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; min-height: 44px; }

/* CRM — automações (nós) */
.auto-row { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
.auto-row .grow { flex: 1; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(18px); }

/* Cliente — detalhe */
.cli-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.cli-name { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 24px; }
.info-field { display: flex; flex-direction: column; gap: 2px; }
.info-label { font-size: 12px; color: var(--muted); }
.info-value { font-size: 14px; font-weight: 600; }
.addr-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.addr-row > div:first-child { flex: 1; }
@media (max-width: 900px) { .info-grid { grid-template-columns: 1fr 1fr; } }

/* CRM — config de colunas */
.stage-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.stage-row .s-name { flex: 1; padding: 8px; border: 1px solid var(--border); border-radius: 6px; }
.stage-row .s-order { width: 64px; padding: 8px; border: 1px solid var(--border); border-radius: 6px; }
.btn-icon.s-del { width: 34px; height: 34px; font-size: 14px; }

/* Botão compacto (ações em linha) */
.btn.small { padding: 5px 10px; font-size: 12px; }

/* Filtro de projeto (combo) na toolbar do QA — compacto */
.combo.qa-filter { display: inline-block; min-width: 200px; vertical-align: middle; }

/* QA — feed, regressão e runner */
.feed-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: none; }
.feed-top { display: flex; align-items: center; gap: 8px; }
.feed-tags { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 1px 8px; color: var(--muted); }
.reg-grid { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .reg-grid { grid-template-columns: 1fr; } }
.reg-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 6px; }
.reg-item:hover { background: var(--bg); }
.reg-item.on { background: var(--bg); box-shadow: inset 3px 0 0 var(--primary); }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.run-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 8px 0 4px; }
.run-bar-fill { height: 100%; background: var(--ok); transition: width .2s; }
.run-case { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.run-case.is-fail { border-left: 3px solid var(--danger); }
.run-case.is-warn { border-left: 3px solid #d97706; }
.run-case-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.run-actions { display: flex; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
.run-obs { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

/* QA — RUNNER com iframe do sistema (execução na mesma tela) */
.runner-head { display: flex; align-items: center; gap: 8px; padding: 4px 0 12px; }
.runner-main { margin-right: calc(380px + 2rem); transition: margin-right .15s; }
.runner-frame { margin: 0 auto; }
.frame-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 0; }
.frame-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.frame-seg button { border: none; background: var(--surface); padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--text); }
.frame-seg button.active { background: var(--primary); color: #fff; }
.frame-stage { position: relative; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.frame-stage.mobile { max-width: 100%; }
.frame-stage iframe { border: 0; display: block; background: #fff; }
.frame-handle { position: absolute; left: 0; bottom: 0; width: 22px; height: 22px; cursor: nesw-resize; z-index: 6;
  background: repeating-linear-gradient(45deg, var(--muted) 0 2px, transparent 2px 4px); border-bottom-left-radius: var(--radius); }
.runner-panel { position: fixed; top: 5rem; right: 1.5rem; bottom: 1.5rem; width: 380px; max-width: 44vw; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; overflow: auto; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.runner-panel.min { width: auto; top: 50%; bottom: auto; transform: translateY(-50%); padding: 8px; }
.runner-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.icon-btn { border: 1px solid var(--border); background: var(--bg); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: 14px; }
.steps-box { border: 1px solid var(--border); background: var(--bg); border-radius: 6px; padding: 8px; font-size: 13px; white-space: pre-wrap; max-height: 200px; overflow: auto; }
.result-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0; }
.res-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 8px; font-size: 13px; cursor: pointer; color: var(--text); }
.res-btn.active.res-passed { background: var(--ok); color: #fff; border-color: var(--ok); }
.res-btn.active.res-failed { background: var(--danger); color: #fff; border-color: var(--danger); }
.res-btn.active.res-blocked { background: #d97706; color: #fff; border-color: #d97706; }
.res-btn.active.res-skipped { background: var(--muted); color: #fff; border-color: var(--muted); }
.runner-nav { display: flex; gap: 8px; margin-top: 12px; }
.runner-nav .btn { flex: 1; }
.evi-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.evi-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 2px; }
.evi-thumb img { width: 54px; height: 54px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; display: block; }
.evi-skel { display: inline-block; width: 54px; height: 54px; border-radius: 6px; background: var(--border); }
@media (max-width: 900px) { .runner-main { margin-right: 0; } .runner-panel { position: static; width: auto; max-width: none; transform: none; margin-top: 12px; box-shadow: none; } }

/* PIX: resultado (QR + copia-e-cola) */
.pix-result { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-top: 12px; }
.pix-qr { width: 200px; height: 200px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; padding: 8px; }
.pix-copy { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 8px; }
.pix-copy textarea { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }

/* E-mail: legenda de variáveis + editor */
textarea.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }
.var-legend { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 8px; }
.var-group { margin-bottom: 8px; font-size: 12px; }
.var-chip { border: 1px solid var(--border); background: var(--bg); border-radius: 12px; padding: 2px 9px; font-size: 11px; font-family: ui-monospace, Consolas, monospace; cursor: pointer; margin: 2px 2px 2px 0; color: var(--primary); }
.var-chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Matriz de perfil de acesso */
.matrix-wrap { overflow-x: auto; margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius); }
table.matrix { font-size: 13px; }
table.matrix th, table.matrix td { border-bottom: 1px solid var(--border); }
table.matrix thead th { text-align: center; vertical-align: bottom; background: var(--bg); }
table.matrix th.matrix-screen, table.matrix td.matrix-screen { text-align: left; text-transform: none; font-size: 13px; color: var(--text); font-weight: 500; white-space: nowrap; }
table.matrix .matrix-cell { text-align: center; width: 96px; }
table.matrix .matrix-all { display: block; font-size: 10px; text-transform: none; color: var(--muted); font-weight: 400; margin-top: 4px; }
table.matrix .matrix-all input { vertical-align: middle; }
table.matrix input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
tr.matrix-group td { background: var(--bg); font-weight: 700; text-transform: uppercase; font-size: 11px; color: var(--muted); letter-spacing: .04em; }
table.matrix td code { font-size: 11px; }
