/* Cockpit Jarvis v1.2 — mobile-first dark mode + tabs + Kanban */

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0a0e1a;
  --bg-elev: #131826;
  --bg-elev2: #1a2138;
  --bg-elev3: #232a44;
  --border: #232a44;
  --text: #e6edf7;
  --text-dim: #8a93a8;
  --accent: #4f8eff;
  --green: #2dd47f;
  --yellow: #f5c542;
  --red: #ff5e5e;
  --orange: #ff924d;
  --gray: #6b7388;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh; min-height: 100dvh;
  overflow-x: hidden;
}
body { display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }

/* ==== TOPBAR ==== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--bg-elev); border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(20px);
}
.topbar-left { display: flex; flex-direction: column; gap: 2px; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.subtitle { font-size: 11px; color: var(--text-dim); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.badge { font-size: 18px; color: var(--green); transition: color 0.3s; }
.badge.stale { color: var(--yellow); animation: pulse 2s infinite; }
.badge.offline { color: var(--red); }
.badge.fresh { color: var(--green); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.icon-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; font-size: 18px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.1s;
}
.icon-btn:active { transform: scale(0.92); background: var(--bg-elev2); }

/* ==== TABS ==== */
.tabs {
  position: sticky; top: 65px; z-index: 40;
  display: flex; gap: 4px; padding: 8px 12px;
  background: var(--bg); border-bottom: 1px solid var(--border);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  background: var(--bg-elev2); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.tab:active { transform: scale(0.96); }
.tab.active { background: var(--accent); color: white; border-color: var(--accent); }

.tab-count {
  font-size: 11px; padding: 2px 7px; border-radius: 10px;
  background: rgba(255,255,255,0.18); color: white; font-weight: 700;
}
.tab:not(.active) .tab-count { background: var(--border); color: var(--text-dim); }

/* ==== TAB PANES ==== */
#cockpit-grid { flex: 1; padding: 14px; max-width: 1400px; margin: 0 auto; width: 100%; }
.tab-pane { display: flex; flex-direction: column; gap: 14px; }
.tab-pane[hidden] { display: none !important; }

.section-intro {
  font-size: 12px; color: var(--text-dim); padding: 8px 12px;
  background: var(--bg-elev2); border-radius: 8px; border: 1px solid var(--border);
}
.section-title { font-size: 14px; font-weight: 600; color: var(--text-dim); margin-top: 4px; }

/* ==== KPI ROW ==== */
.kpi-row {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
@media (min-width: 600px) { .kpi-row { grid-template-columns: repeat(4, 1fr); } }
.kpi {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; text-align: center;
}
.kpi-num { font-size: 28px; font-weight: 700; line-height: 1; }
.kpi-label { font-size: 11px; color: var(--text-dim); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.04em; }

/* ==== CARDS LIST / GRID ==== */
.cards-list { display: flex; flex-direction: column; gap: 10px; }
.cards-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 600px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .cards-grid { grid-template-columns: repeat(3, 1fr); } }

/* ==== ACTION CARD V2 (clearer + Jarvis suggestion) ==== */
.action-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-left: 4px solid var(--gray); border-radius: 12px;
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.action-card.tier-1 { border-left-color: var(--red); box-shadow: 0 0 0 1px rgba(255,94,94,0.15); }
.action-card.tier-2 { border-left-color: var(--orange); }
.action-card.tier-3 { border-left-color: var(--yellow); }
.action-card.tier-4 { border-left-color: var(--gray); }
.action-card.healthy { border-left-color: var(--green); }
.action-card.critico { border-left-color: var(--red); background: linear-gradient(180deg, rgba(255,94,94,0.06), var(--bg-elev)); }

/* F1 deep-link highlight (Telegram → cockpit ?action_id=) */
.action-card.deep-link-highlight {
  animation: deep-link-pulse 3s ease-out;
  box-shadow: 0 0 0 2px var(--blue, #4dabf7), 0 0 20px rgba(77,171,247,0.4);
}
@keyframes deep-link-pulse {
  0%   { box-shadow: 0 0 0 4px var(--blue, #4dabf7), 0 0 30px rgba(77,171,247,0.6); }
  100% { box-shadow: 0 0 0 0 transparent, 0 0 0 transparent; }
}

.ac-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ac-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--text-dim); }
.ac-tier {
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 6px;
  text-transform: uppercase; letter-spacing: 0.05em; background: var(--border); color: var(--text);
}
.ac-tier.t1 { background: var(--red); color: white; }
.ac-tier.t2 { background: var(--orange); color: white; }
.ac-tier.t3 { background: var(--yellow); color: #1a1f2e; }
.ac-tier.t4 { background: var(--gray); color: white; }
.ac-agent { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.ac-age { font-size: 11px; color: var(--text-dim); }

.ac-title { font-size: 15px; font-weight: 600; line-height: 1.3; }

.ac-body { font-size: 13px; color: var(--text); line-height: 1.4; }

/* Jarvis suggestion box (PROEMINENTE) */
.ac-suggest {
  background: rgba(79, 142, 255, 0.08);
  border: 1px solid rgba(79, 142, 255, 0.3);
  border-radius: 10px; padding: 10px 12px;
}
.ac-suggest-label {
  font-size: 10px; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px;
  display: flex; align-items: center; gap: 4px;
}
.ac-suggest-text { font-size: 13px; color: var(--text); line-height: 1.4; }

.ac-impact {
  font-size: 12px; font-weight: 600; color: var(--green);
  display: inline-flex; align-items: center; gap: 4px;
}
.ac-impact.alto { color: var(--orange); }

/* ==== ACTION BUTTONS V2 ==== */
.ac-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.ac-actions-row { display: flex; gap: 6px; }

.btn-jarvis {
  flex: 1; padding: 12px 14px;
  background: var(--accent); color: white;
  border: none; border-radius: 10px;
  font-size: 14px; font-weight: 700;
  cursor: pointer; transition: opacity 0.15s, transform 0.1s;
}
.btn-jarvis:active { transform: scale(0.97); opacity: 0.9; }

.btn-secondary, .btn-deny, .btn-edit, .btn-snooze {
  flex: 1; padding: 10px 12px;
  background: var(--bg-elev2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s, transform 0.1s;
}
.btn-secondary:active, .btn-deny:active, .btn-edit:active, .btn-snooze:active { transform: scale(0.97); }
.btn-deny { color: var(--red); border-color: rgba(255, 94, 94, 0.3); }
.btn-edit { color: var(--accent); border-color: rgba(79, 142, 255, 0.3); }
.btn-snooze { color: var(--text-dim); }

.btn-trace {
  background: transparent; color: var(--text-dim);
  border: none; padding: 6px 10px; font-size: 11px; cursor: pointer;
  text-decoration: underline;
}

.btn-primary { background: var(--accent); color: white; border: 1px solid var(--accent); padding: 12px; border-radius: 10px; font-weight: 600; cursor: pointer; }

/* ==== L3 health card (compact) ==== */
.l3-card {
  background: var(--bg-elev2); border: 1px solid var(--border);
  border-left: 3px solid var(--gray); border-radius: 8px;
  padding: 8px 10px; font-size: 12px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  cursor: pointer; transition: transform 0.1s;
}
.l3-card.healthy { border-left-color: var(--green); }
.l3-card.warn { border-left-color: var(--yellow); }
.l3-card.bad { border-left-color: var(--red); }
.l3-card:active { transform: scale(0.98); }
.l3-card .name { font-weight: 600; }

/* ==== UNIT CARD ==== */
.unit-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-left: 4px solid var(--gray); border-radius: 12px;
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.unit-card.OK { border-left-color: var(--green); }
.unit-card.WARN { border-left-color: var(--yellow); background: linear-gradient(180deg, rgba(245,197,66,0.05), var(--bg-elev)); }
.unit-card.CRITICA { border-left-color: var(--red); background: linear-gradient(180deg, rgba(255,94,94,0.08), var(--bg-elev)); }

.unit-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.unit-name { font-weight: 700; font-size: 14px; }
.unit-marca { font-size: 11px; color: var(--text-dim); }
.unit-score { font-size: 18px; font-weight: 700; }
.unit-meta { font-size: 11px; color: var(--text-dim); }

/* ==== KANBAN ==== */
.kanban {
  display: grid; grid-template-columns: 1fr; gap: 12px;
}
@media (min-width: 800px) { .kanban { grid-template-columns: repeat(3, 1fr); } }

.kanban-col {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; min-height: 200px;
  display: flex; flex-direction: column; gap: 10px;
}
.kanban-col-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.kanban-col-count {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: var(--bg-elev2); color: var(--text);
}
.kanban-col-body { display: flex; flex-direction: column; gap: 8px; }

.kanban-card {
  background: var(--bg-elev2); border: 1px solid var(--border);
  border-left: 3px solid var(--gray); border-radius: 8px;
  padding: 10px; font-size: 12px;
  display: flex; flex-direction: column; gap: 4px;
  cursor: pointer; transition: transform 0.1s;
}
.kanban-card:active { transform: scale(0.98); }
.kanban-card.tier-1 { border-left-color: var(--red); }
.kanban-card.tier-2 { border-left-color: var(--orange); }
.kanban-card.tier-3 { border-left-color: var(--yellow); }
.kanban-card .kc-title { font-weight: 600; font-size: 12px; }
.kanban-card .kc-body { font-size: 11px; color: var(--text-dim); line-height: 1.3; }
.kanban-card .kc-meta { font-size: 10px; color: var(--text-dim); display: flex; gap: 6px; }

/* ==== FILTROS / SEARCH ==== */
.filters-bar {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px;
}
.filter-input {
  width: 100%; padding: 10px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 14px;
}
.filter-input:focus { outline: none; border-color: var(--accent); }
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  background: var(--bg-elev2); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.pill.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ==== DECISOES (history) ==== */
.decision-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-left: 3px solid var(--gray); border-radius: 8px;
  padding: 10px 12px; font-size: 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.decision-card.ok { border-left-color: var(--green); }
.decision-card.no { border-left-color: var(--red); }
.decision-card.snooze { border-left-color: var(--yellow); }
.decision-card .dc-title { font-weight: 600; font-size: 13px; }
.decision-card .dc-meta { font-size: 11px; color: var(--text-dim); display: flex; gap: 8px; }
.decision-card .dc-action { font-size: 11px; color: var(--text-dim); font-style: italic; }

/* ==== EMPTY ==== */
.empty {
  font-size: 13px; color: var(--text-dim); text-align: center;
  padding: 30px 12px; font-style: italic;
}

/* ==== MODAL ==== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0; animation: fade-in 0.15s;
}
@media (min-width: 768px) { .modal-backdrop { align-items: center; padding: 20px; } }
.modal-backdrop[hidden] { display: none !important; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 16px 16px 0 0; max-width: 600px; width: 100%;
  max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
  animation: slide-up 0.2s;
}
@media (min-width: 768px) { .modal { border-radius: 16px; max-height: 80vh; } }
@keyframes slide-up { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; }
.modal-body {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.modal-body label { font-size: 12px; color: var(--text-dim); }
.modal-body textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-family: inherit; font-size: 14px;
  resize: vertical; min-height: 120px;
}

.modal-actions { display: flex; gap: 8px; margin-top: 8px; }
.modal-actions .btn-primary, .modal-actions .btn-secondary {
  flex: 1; padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
}
.modal-actions .btn-secondary { background: var(--bg-elev2); color: var(--text); border: 1px solid var(--border); }

.trace-row { display: flex; justify-content: space-between; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.trace-row:last-child { border: none; }
.trace-key { color: var(--text-dim); }
.trace-value { font-weight: 600; max-width: 60%; text-align: right; word-break: break-word; }
.trace-value pre { font-size: 11px; white-space: pre-wrap; }

/* ==== TOAST ==== */
.toast {
  position: fixed; bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  background: var(--bg-elev2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 18px; border-radius: 12px;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow); z-index: 200;
  animation: toast-in 0.2s;
}
.toast[hidden] { display: none !important; }
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error { border-color: var(--red); color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ==== CHAT ==== */
#chat-container {
  display: flex; flex-direction: column;
  height: calc(100vh - 200px); height: calc(100dvh - 200px);
  min-height: 400px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.assistant, .chat-msg.system { justify-content: flex-start; }
.chat-bubble {
  max-width: 85%; padding: 10px 14px; border-radius: 14px;
  font-size: 13px; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word;
}
.chat-msg.user .chat-bubble { background: var(--accent); color: white; border-bottom-right-radius: 4px; }
.chat-msg.assistant .chat-bubble { background: var(--bg-elev2); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-msg.system .chat-bubble { background: rgba(245,197,66,0.1); border: 1px solid rgba(245,197,66,0.3); color: var(--text-dim); font-size: 12px; max-width: 100%; }

.chat-input-row {
  display: flex; gap: 8px; padding: 12px;
  border-top: 1px solid var(--border); background: var(--bg-elev2);
}
.chat-input-row textarea {
  flex: 1; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-family: inherit; font-size: 14px;
  resize: none; max-height: 120px;
}
.chat-input-row textarea:focus { outline: none; border-color: var(--accent); }
.chat-input-row .btn-primary { padding: 10px 16px; }

/* ==== LOADING ==== */
.loading-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 60px 20px; color: var(--text-dim); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==== FOOTER ==== */
.footer-info {
  text-align: center; font-size: 10px; color: var(--text-dim);
  padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); margin-top: 8px;
}

/* === AGENT MODAL V2 (Wave 7 26/abr) === */
.agent-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin: -8px -8px 12px;
  padding: 0 8px;
}
.agent-tab {
  background: transparent; border: 0; color: var(--text-dim);
  padding: 8px 12px; cursor: pointer; font-size: 13px;
  border-bottom: 2px solid transparent;
}
.agent-tab.active {
  color: var(--text); border-bottom-color: #4cf;
  font-weight: 600;
}
.agent-tab:hover:not(.active) { color: var(--text); }
.agent-tab-body {
  max-height: 60vh; overflow-y: auto;
}
.agent-tab-body input[type="text"],
.agent-tab-body input[type="number"],
.agent-tab-body select,
.agent-tab-body textarea {
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  color: var(--text); padding: 6px 8px; border-radius: 6px;
  font: inherit; width: 100%; box-sizing: border-box;
}
.agent-tab-body textarea { resize: vertical; min-height: 50px; }
.agent-tab-body input:focus, .agent-tab-body select:focus, .agent-tab-body textarea:focus {
  outline: 2px solid #4cf;
}
.kc-status-pausado { background: rgba(255,200,0,.2); color: #fc4; padding: 1px 6px; border-radius: 4px; font-size: 10px; }
.kc-status-em_treino { background: rgba(255,150,50,.2); color: #f95; padding: 1px 6px; border-radius: 4px; font-size: 10px; }
.kc-status-inativo { background: rgba(150,150,150,.2); color: #999; padding: 1px 6px; border-radius: 4px; font-size: 10px; }

/* ==== COMPRAS PANEL (Wave 1 27/abr) ==== */
.section-intro {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; font-size: 12px; color: var(--text-dim);
  line-height: 1.4;
}
.section-intro .hint { display: block; margin-top: 4px; font-size: 11px; color: var(--gray); }
.section-intro code { background: var(--bg-elev2); padding: 1px 5px; border-radius: 4px; font-size: 11px; color: var(--text); }

/* === COMPRAS OVERHAUL 27/abr 21:46 — Bezos+Jarvis+Musk === */

/* Banner fila fantasma (SF3 SA-SRE) */
.compras-fantasma-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  padding: 10px 14px;
  border-radius: 8px;
  margin: 8px 0;
  font-size: 13px;
}
.compras-fantasma-banner a {
  color: #f59e0b;
  text-decoration: underline;
  margin-left: 6px;
}

/* Sort bar (F5 Bezos) */
.sort-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  flex-wrap: wrap;
}
.sort-label {
  font-size: 11px;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sort-btn { font-size: 12px; }

/* Card: badge Graci (UX4 Jarvis) */
.cc-graci {
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 600;
}

/* Histórico fornecedor (F2 Bezos + I3 sparkline Stripe) */
.hist-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.hist-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
}
.hist-badge.hist-novo {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
}
.hist-badge.hist-recorrente {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}
.hist-spark-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  opacity: 0.85;
}
.hist-spark-label { opacity: 0.6; }
.sparkline { vertical-align: middle; }
.sparkline.trend-up { color: #ef4444; }
.sparkline.trend-down { color: #22c55e; }
.sparkline.trend-flat { color: #94a3b8; }

.hist-rows-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  font-size: 12px;
}
.hist-row {
  display: grid;
  grid-template-columns: 80px 1fr 60px 100px;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
}
.hist-row:hover { background: rgba(255, 255, 255, 0.06); }
.hist-data { opacity: 0.7; }
.hist-nf { font-weight: 600; }
.hist-filial { opacity: 0.6; font-size: 11px; }
.hist-valor { text-align: right; font-variant-numeric: tabular-nums; }
.hist-empty { font-size: 12px; opacity: 0.6; font-style: italic; }

/* WIP colapsado (F3 Bezos) */
.sinais-wip-collapsed {
  margin-top: 10px;
  padding: 8px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.06);
}
.sinais-wip-collapsed summary {
  cursor: pointer;
  font-size: 12px;
  opacity: 0.7;
}
.sinais-wip-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wip-pill {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
}

/* Timeline (I2 Stripe pattern) */
.timeline-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tl-row {
  padding: 8px 10px;
  border-left: 3px solid rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.04);
  border-radius: 0 6px 6px 0;
}
.tl-head { font-size: 12px; }
.tl-head code {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
}
.tl-obs {
  margin: 4px 0;
  font-style: italic;
  font-size: 11px;
  opacity: 0.85;
}
.tl-exec, .tl-fantasma { font-size: 11px; opacity: 0.75; }
.tl-fantasma { color: #f59e0b; }
.timeline-empty { font-size: 12px; opacity: 0.6; font-style: italic; }

/* Motivo pills (AP3 Jarvis: rejeitar exige motivo) */
.motivo-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 11px;
}
.motivo-label { opacity: 0.7; margin-right: 4px; }
.motivo-pill {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #cbd5e1;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
}
.motivo-pill:hover {
  background: rgba(148, 163, 184, 0.2);
  border-color: rgba(148, 163, 184, 0.6);
}

/* Atalhos kbd (UX2 Jarvis) */
kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 10px;
  margin: 0 2px;
}

.compras-grid {
  display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 10px;
}
@media (min-width: 700px) { .compras-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .compras-grid { grid-template-columns: repeat(3, 1fr); } }

.compras-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-left: 4px solid var(--gray); border-radius: 12px;
  padding: 12px 14px; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  transition: transform 0.1s, border-color 0.15s;
}
.compras-card:active { transform: scale(0.98); }
.compras-card:hover { border-color: var(--accent); }
.compras-card.tier-1 { border-left-color: var(--red); }
.compras-card.tier-2 { border-left-color: var(--orange); }
.compras-card.tier-3 { border-left-color: var(--yellow); }
.compras-card.rec-bloqueio { background: linear-gradient(180deg, rgba(255,94,94,0.08) 0%, var(--bg-elev) 60%); }
.compras-card.rec-alerta { background: linear-gradient(180deg, rgba(255,146,77,0.06) 0%, var(--bg-elev) 60%); }

.compras-card .cc-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.compras-card .cc-tier {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  background: var(--bg-elev2); padding: 3px 7px; border-radius: 5px; color: var(--text-dim);
}
.compras-card .cc-rec {
  font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
  padding: 3px 7px; border-radius: 5px;
}
.cc-rec.rec-bloqueio { background: rgba(255,94,94,0.18); color: var(--red); }
.cc-rec.rec-alerta { background: rgba(255,146,77,0.18); color: var(--orange); }
.cc-rec.rec-ok { background: rgba(45,212,127,0.18); color: var(--green); }
.cc-rec.rec-neutro { background: var(--bg-elev2); color: var(--text-dim); }
.compras-card .cc-score {
  font-size: 10px; font-weight: 600; color: var(--text-dim);
  margin-left: auto;
}
.compras-card .cc-fornec { font-weight: 700; font-size: 14px; line-height: 1.25; }
.compras-card .cc-cnpj { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.compras-card .cc-valor {
  font-size: 22px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; margin-top: 2px;
}
.compras-card .cc-meta {
  display: flex; gap: 10px; flex-wrap: wrap;
  font-size: 11px; color: var(--text-dim);
}
.compras-card .cc-datas { font-size: 10px; }
.compras-card .cc-sinais { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

.sinal-pill {
  font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px;
  background: var(--bg-elev2); color: var(--text-dim);
  white-space: nowrap;
}
.sinal-pill.sinal-bloqueio { background: rgba(255,94,94,0.18); color: var(--red); }
.sinal-pill.sinal-alerta { background: rgba(255,146,77,0.18); color: var(--orange); }
.sinal-pill.sinal-ok { background: rgba(45,212,127,0.15); color: var(--green); }
.sinal-pill.sinal-wip { background: rgba(138,147,168,0.15); color: var(--gray); font-style: italic; }
.sinal-pill.sinal-na { background: var(--bg-elev2); color: var(--gray); }

/* ==== COMPRAS MODAL ==== */
.compras-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.compras-modal[hidden] { display: none !important; }
@media (min-width: 768px) { .compras-modal { align-items: center; padding: 24px; } }
.compras-modal-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.75);
  animation: fade-in 0.15s;
}
.compras-modal-card {
  position: relative; z-index: 1;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 16px 16px 0 0; max-width: 720px; width: 100%;
  max-height: 92vh; overflow-y: auto;
  padding: 20px 18px 24px; animation: slide-up 0.2s;
}
@media (min-width: 768px) { .compras-modal-card { border-radius: 16px; max-height: 88vh; } }
.compras-modal-close {
  position: absolute; top: 10px; right: 10px;
  background: var(--bg-elev2); border: 1px solid var(--border); color: var(--text);
  width: 34px; height: 34px; border-radius: 8px; font-size: 18px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.compras-modal-close:active { transform: scale(0.92); }

.cm-head { margin-bottom: 14px; padding-right: 40px; }
.cm-title { font-size: 18px; font-weight: 700; line-height: 1.2; margin-bottom: 6px; }
.cm-rec {
  display: inline-block; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 6px;
}

.cm-section {
  border-top: 1px solid var(--border); padding: 14px 0;
}
.cm-section:first-of-type { border-top: none; padding-top: 4px; }
.cm-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  color: var(--text-dim); letter-spacing: 0.06em; margin-bottom: 10px;
}
.cm-grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px;
}
@media (max-width: 480px) { .cm-grid-2 { grid-template-columns: 1fr; } }
.cm-grid-2 > div {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--bg-elev2); border-radius: 8px; padding: 8px 10px;
}
.cm-k { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.cm-v { font-size: 13px; font-weight: 600; color: var(--text); word-break: break-word; }
.cm-valor-big {
  font-size: 30px; font-weight: 800; color: var(--text);
  font-variant-numeric: tabular-nums; margin-bottom: 10px;
}

.sinais-grid { display: flex; flex-direction: column; gap: 6px; }
.sinal-row {
  background: var(--bg-elev2); border-left: 3px solid var(--gray);
  border-radius: 6px; padding: 8px 10px;
}
.sinal-row.sinal-bloqueio { border-left-color: var(--red); background: rgba(255,94,94,0.08); }
.sinal-row.sinal-alerta { border-left-color: var(--orange); background: rgba(255,146,77,0.08); }
.sinal-row.sinal-ok { border-left-color: var(--green); background: rgba(45,212,127,0.08); }
.sinal-row.sinal-wip { border-left-color: var(--gray); opacity: 0.6; }
.sinal-row.sinal-na { border-left-color: var(--gray); opacity: 0.5; }
.sinal-row-head { font-size: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sinal-row-head b { font-weight: 600; flex: 1; }
.sinal-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  padding: 1px 6px; border-radius: 4px; background: var(--bg);
  color: var(--text-dim);
}
.sinal-row-detalhe { font-size: 11px; color: var(--text-dim); margin-top: 4px; padding-left: 22px; }

.cm-actions {
  margin-top: 16px; display: flex; flex-direction: column; gap: 8px;
}
.cm-actions textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font: inherit; font-size: 13px; resize: vertical;
}
.cm-actions textarea:focus { outline: none; border-color: var(--accent); }
.cm-actions-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cm-actions-row button {
  border: none; border-radius: 8px; padding: 12px 8px;
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
}
.cm-actions-row button:active { transform: scale(0.96); }
.cm-actions-row button:disabled { opacity: 0.5; cursor: wait; }
.btn-no { background: var(--red); color: white; }
.btn-warn { background: var(--orange); color: white; }
.btn-ok { background: var(--green); color: #00220f; }
.cm-hint { font-size: 11px; color: var(--text-dim); text-align: center; margin-top: 4px; }
.cm-hint code { background: var(--bg-elev2); padding: 1px 5px; border-radius: 4px; }

/* ===== TAB HOJE — CEO-first overhaul 28/abr ===== */
.hoje-status-bar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 8px 10px; margin-bottom: 8px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px;
}
.hoje-status-bar.loading { opacity: 0.5; }
.hs-pill {
  font-size: 12px; padding: 4px 9px; border-radius: 999px;
  background: var(--bg-elev2); color: var(--text-dim);
  border: 1px solid var(--border);
}
.hs-pill b { color: var(--text); }
.hs-time { margin-left: auto; font-variant-numeric: tabular-nums; }
.hs-ok { color: var(--green); }
.hs-warn { color: var(--orange); }
.hs-critical { color: var(--red); }

/* Diff "estado do negócio agora" */
.hoje-diff {
  display: grid; grid-template-columns: 1fr; gap: 6px;
  margin-bottom: 4px;
}
@media (min-width: 600px) { .hoje-diff { grid-template-columns: repeat(2, 1fr); } }
.diff-item {
  font-size: 12px; padding: 8px 10px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;
}
.diff-item b { color: var(--text); }
.diff-detail { color: var(--text-dim); margin-left: 6px; }

/* Filiais semáforo */
.filiais-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 600px) { .filiais-grid { grid-template-columns: repeat(4, 1fr); } }
.filial-card {
  padding: 10px; border-radius: 10px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-left: 4px solid var(--border);
}
.semaforo-red    { border-left-color: var(--red);    background: linear-gradient(90deg, rgba(255,94,94,0.10), var(--bg-elev) 30%); }
.semaforo-orange { border-left-color: var(--orange); background: linear-gradient(90deg, rgba(255,146,77,0.10), var(--bg-elev) 30%); }
.semaforo-yellow { border-left-color: var(--yellow); }
.semaforo-green  { border-left-color: var(--green); }
.fc-head { font-weight: 600; font-size: 13px; }
.fc-stats { display: flex; gap: 10px; margin: 4px 0; font-size: 12px; }
.fc-crit { color: var(--text-dim); }
.fc-crit.on { color: var(--red); font-weight: 600; }
.fc-ab { color: var(--text-dim); }
.fc-meta { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Top decisões com feedback inline */
.hoje-pendentes-list { display: flex; flex-direction: column; gap: 6px; }
.hp-row {
  padding: 10px 12px; border-radius: 10px;
  background: var(--bg-elev); border: 1px solid var(--border);
  transition: opacity 0.5s, transform 0.5s;
}
.hp-row.hp-resolved { opacity: 0; transform: translateX(40px); }
.hp-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hp-urg {
  font-size: 10px; padding: 2px 7px; border-radius: 4px; font-weight: 700;
  letter-spacing: 0.04em;
}
.urg-alta { background: rgba(255,94,94,0.15); color: var(--red); }
.urg-media { background: rgba(245,197,66,0.15); color: var(--yellow); }
.urg-baixa { background: var(--bg-elev2); color: var(--text-dim); }
.hp-tier { font-size: 11px; color: var(--text-dim); }
.hp-valor { font-size: 12px; color: var(--green); margin-left: auto; font-weight: 600; }
.hp-title { font-weight: 600; font-size: 14px; margin-top: 4px; }
.hp-meta { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.hp-actions {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  margin-top: 8px;
}
.btn-feedback {
  border: 0; border-radius: 8px; padding: 8px 6px;
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
}
.btn-feedback:active { transform: scale(0.96); }
.btn-feedback:disabled { opacity: 0.5; cursor: wait; }

/* Pessoas em crise (compact card Tab Hoje) */
.pessoas-grid { display: grid; gap: 6px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 600px) { .pessoas-grid { grid-template-columns: repeat(3, 1fr); } }
.pessoa-card {
  padding: 8px 10px; border-radius: 8px;
  background: var(--bg-elev); border: 1px solid var(--border);
}
.pc-nome { font-weight: 600; font-size: 13px; }
.pc-stats { display: flex; gap: 8px; margin-top: 3px; font-size: 11px; }
.pc-crit { color: var(--red); font-weight: 600; }
.pc-res { color: var(--text-dim); margin-left: auto; }

/* Pessoa-card-full (Tab Time) */
.pessoa-card-full {
  padding: 10px 12px; border-radius: 10px;
  background: var(--bg-elev); border: 1px solid var(--border);
}
.pcf-nome { font-weight: 600; font-size: 14px; }
.pcf-cargo { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.pcf-stats { display: flex; gap: 12px; font-size: 12px; flex-wrap: wrap; }

/* Líderes (Tab Time) */
.lideres-grid { display: grid; gap: 6px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .lideres-grid { grid-template-columns: repeat(2, 1fr); } }
.lider-card {
  padding: 8px 10px; border-radius: 8px;
  background: var(--bg-elev); border: 1px solid var(--border);
}
.lc-nome { font-weight: 600; font-size: 13px; }
.lc-stats { display: flex; gap: 10px; margin-top: 3px; font-size: 11px; color: var(--text-dim); }
.lc-crit { color: var(--red); font-weight: 600; }

/* Anomalias 3-7d */
.anomalia-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  background: var(--bg-elev); border: 1px solid var(--border);
}
.ar-pessoa { flex: 1; font-weight: 600; font-size: 13px; }
.ar-sinal {
  font-size: 10px; padding: 2px 7px; border-radius: 4px; font-weight: 700;
  letter-spacing: 0.04em;
}
.sinal-surto { background: rgba(255,94,94,0.15); color: var(--red); }
.sinal-silencioso { background: rgba(255,146,77,0.15); color: var(--orange); }
.sinal-normal { background: var(--bg-elev2); color: var(--text-dim); }
.ar-pct { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.ar-detail { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* Findings infra */
.findings-list { display: flex; flex-direction: column; gap: 6px; }
.finding-row {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: 8px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-left: 3px solid var(--text-dim);
}
.sev-alta    { border-left-color: var(--red); }
.sev-media   { border-left-color: var(--orange); }
.sev-baixa   { border-left-color: var(--text-dim); }
.fr-sev {
  font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 700;
  background: var(--bg-elev2); color: var(--text);
}
.fr-agent { font-size: 11px; color: var(--text-dim); }
.fr-title { flex: 1; font-size: 13px; }

/* 28/abr Wave Lucas precision: stale bar Compras */
.compras-staleness-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; margin-bottom: 6px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;
  font-size: 12px; color: var(--text-dim);
}
.compras-staleness-bar.stale {
  border-color: var(--orange);
  background: linear-gradient(90deg, rgba(255,146,77,0.10), var(--bg-elev) 50%);
  color: var(--orange);
}
.compras-staleness-bar #compras-stale-msg { flex: 1; }
.btn-mini {
  background: var(--bg-elev2); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 10px; font: inherit; font-size: 11px; cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
}
.btn-mini:hover { background: var(--bg-elev3); }
.btn-mini:active { transform: scale(0.96); }
.btn-mini:disabled { opacity: 0.5; cursor: wait; }

/* 28/abr fix Lucas: separar informativos de decisões */
.hoje-informativos-wrap {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.hoje-informativos-wrap summary {
  font-size: 14px;
  color: var(--text-dim);
  user-select: none;
}
.hoje-informativos-wrap[open] summary { color: var(--text); }
.info-count {
  display: inline-block;
  background: var(--bg-elev2);
  color: var(--text-dim);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 6px;
}
.informativos-list {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 8px;
}
.info-row {
  display: flex; gap: 10px; align-items: center;
  font-size: 12px; color: var(--text-dim);
  padding: 4px 8px;
  border-bottom: 1px dashed var(--border);
}
.info-row:last-child { border-bottom: 0; }
.info-rotina { font-weight: 600; color: var(--text); flex: 0 0 auto; }
.info-dominio { font-size: 11px; }
.info-time { margin-left: auto; font-variant-numeric: tabular-nums; }

/* 28/abr Tab Decidir — fila completa com breakdown */
.fila-summary {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
}
.fila-counts { display: flex; flex-wrap: wrap; gap: 8px; }
.fc-item { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--bg-elev2); }
.fc-critica { color: var(--red); font-weight: 600; }
.fc-alta { color: var(--orange); font-weight: 600; }
.fc-media { color: var(--yellow); }
.fc-baixa { color: var(--text-dim); }
.fila-rotinas { margin-top: 10px; }
.fila-rotinas summary { font-size: 12px; color: var(--text-dim); cursor: pointer; }
.fila-rotinas-list { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.fr-row { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 6px; }
.fr-row:hover { background: var(--bg-elev2); border-radius: 4px; }
.fr-count { color: var(--text-dim); font-variant-numeric: tabular-nums; font-weight: 600; }

.fila-items { display: flex; flex-direction: column; gap: 6px; }
.fila-row {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px;
}
.fila-row-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fila-urg { font-size: 10px; padding: 2px 7px; border-radius: 4px; font-weight: 700; }
.fila-urg-critico, .fila-urg-crítico { background: rgba(255,94,94,0.2); color: var(--red); }
.fila-urg-importante { background: rgba(255,146,77,0.2); color: var(--orange); }
.fila-urg-informativo { background: var(--bg-elev2); color: var(--text-dim); }
.fila-tier { font-size: 11px; color: var(--text-dim); }
.fila-rotina { font-weight: 600; font-size: 13px; }
.fila-data { margin-left: auto; font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.fila-row-body { font-size: 13px; margin-top: 4px; line-height: 1.4; }
.fila-row-meta { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.fila-footer { text-align: center; padding: 12px; color: var(--text-dim); font-size: 12px; }
.fila-cleanup-btn {
  background: rgba(255,146,77,0.15) !important;
  border-color: var(--orange) !important;
  color: var(--orange) !important;
  margin-left: auto;
}
.fila-cleanup-btn:hover { background: rgba(255,146,77,0.25) !important; }

/* ========== TAB ATENDIMENTO — Inbox WhatsApp ========== */
.atend-status-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 8px;
  background: var(--bg-elev1); border-radius: 6px;
  font-size: 12px;
}
.atend-toolbar {
  display: flex; gap: 12px; align-items: center;
  padding: 6px 12px; margin-bottom: 8px;
}
.atend-toolbar .filter-pills { flex: 1; }
.atend-toolbar .btn-secondary.active {
  background: rgba(255,146,77,0.2); color: var(--orange); border-color: var(--orange);
}
.atend-layout {
  display: grid; grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 12px;
  height: calc(100vh - 240px);
  min-height: 420px;
}
.atend-list {
  overflow-y: auto;
  border: 1px solid var(--bg-elev2);
  border-radius: 6px;
  background: var(--bg-elev1);
}
.atend-conv {
  display: flex; flex-direction: column;
  border: 1px solid var(--bg-elev2); border-radius: 6px;
  background: var(--bg-elev1);
  overflow: hidden;
}
.atend-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-dim); text-align: center;
  padding: 40px 20px; gap: 8px;
}
/* Cards thread (lista esquerda) */
.atend-thread-card {
  padding: 10px 12px; border-bottom: 1px solid var(--bg-elev2);
  cursor: pointer; transition: background .12s;
}
.atend-thread-card:hover { background: var(--bg-elev2); }
.atend-thread-card.sel { background: rgba(94,158,255,0.12); border-left: 3px solid var(--blue, #5e9eff); }
.atend-thread-card.breach { border-left: 3px solid var(--red); }
.atend-thread-head { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.atend-thread-status { font-size: 14px; }
.atend-thread-name { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atend-thread-age { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.atend-thread-preview {
  font-size: 12px; color: var(--text-dim); margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.atend-thread-meta { display: flex; gap: 6px; margin-top: 6px; font-size: 10px; flex-wrap: wrap; }
.marca-pill {
  padding: 2px 6px; border-radius: 3px; font-weight: 600;
  background: var(--bg-elev2); color: var(--text-dim);
  text-transform: uppercase; font-size: 10px;
}
.marca-pill.marca-bode { background: rgba(229,180,57,0.2); color: #e5b439; }
.marca-pill.marca-burguer { background: rgba(255,94,94,0.2); color: var(--red); }
.marca-pill.marca-italiano { background: rgba(86,200,135,0.2); color: var(--green); }
.marca-pill.marca-salmare { background: rgba(94,158,255,0.2); color: #5e9eff; }
.loja-pill, .esc-tag, .msgs-count, .status-pill, .phone-mono {
  padding: 2px 6px; border-radius: 3px;
  background: var(--bg-elev2); color: var(--text-dim); font-size: 10px;
}
.esc-tag { background: rgba(255,94,94,0.2); color: var(--red); font-weight: 700; }
.phone-mono { font-family: monospace; font-size: 11px; }
.status-pill.status-ia_atendendo { background: rgba(86,200,135,0.15); color: var(--green); }
.status-pill.status-aguardando_humano { background: rgba(255,146,77,0.2); color: var(--orange); }
.status-pill.status-em_atendimento_humano { background: rgba(94,158,255,0.2); color: #5e9eff; }
.status-pill.status-fechado { background: var(--bg-elev2); color: var(--text-dim); }
/* Conversa direita */
.atend-conv-head {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 10px 12px; border-bottom: 1px solid var(--bg-elev2);
}
.atend-conv-title { display: flex; gap: 8px; align-items: center; flex: 1; flex-wrap: wrap; font-size: 13px; }
.atend-conv-actions { display: flex; gap: 6px; }
.atend-banner-esc {
  background: rgba(255,94,94,0.1); color: var(--red);
  padding: 8px 12px; border-bottom: 1px solid rgba(255,94,94,0.3);
  font-size: 12px; display: flex; gap: 8px; align-items: center;
}
.atend-banner-esc .btn-link { margin-left: auto; font-size: 11px; }
.atend-conv-history {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.conv-msg { display: flex; }
.conv-msg.in { justify-content: flex-start; }
.conv-msg.out { justify-content: flex-end; }
.conv-bubble {
  max-width: 70%; padding: 8px 12px; border-radius: 10px;
  background: var(--bg-elev2); font-size: 13px; line-height: 1.4;
}
.conv-msg.in .conv-bubble { background: var(--bg-elev2); }
.conv-msg.out .conv-bubble { background: rgba(94,158,255,0.15); border: 1px solid rgba(94,158,255,0.3); }
.conv-msg.sender-humano .conv-bubble { background: rgba(86,200,135,0.15); border: 1px solid rgba(86,200,135,0.3); }
.conv-msg.sender-sistema .conv-bubble { background: rgba(255,146,77,0.1); border: 1px solid rgba(255,146,77,0.3); font-style: italic; }
.conv-meta { font-size: 10px; color: var(--text-dim); margin-bottom: 2px; }
.conv-body { white-space: pre-wrap; word-break: break-word; }
.atend-send-row {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--bg-elev2);
}
.atend-send-row textarea {
  flex: 1; resize: none; padding: 8px 10px;
  background: var(--bg); border: 1px solid var(--bg-elev2);
  border-radius: 6px; color: var(--text); font-size: 13px;
  font-family: inherit;
}
@media (max-width: 768px) {
  .atend-layout { grid-template-columns: 1fr; height: auto; }
  .atend-list { max-height: 280px; }
}

/* ═══════════════════════════════════════════════════════════════
   DECISION CARD UNIFICADO (29/abr Wave Musk + 5 engs)
   Substitui hp-row, action-card e variantes. Usado em Tab Hoje + Tab Decidir.
   ═══════════════════════════════════════════════════════════════ */
.dc-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  transition: opacity 0.3s, transform 0.3s, border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.dc-card:focus,
.dc-card.dc-card-focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(79,142,255,0.25);
}
.dc-card.dc-resolved { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.dc-card.dc-card-pending { opacity: 0.55; pointer-events: none; }
.dc-card-group { border-left: 4px solid var(--blue); }

.dc-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 11px; margin-bottom: 6px;
}
.dc-urg {
  font-size: 10px; padding: 3px 8px; border-radius: 4px; font-weight: 800;
  letter-spacing: 0.02em;
}
.dc-urg.urg-alta { background: rgba(255,94,94,0.18); color: var(--red); }
.dc-urg.urg-media { background: rgba(255,146,77,0.18); color: var(--orange); }
.dc-urg.urg-baixa { background: var(--bg-elev2); color: var(--text-dim); }
.dc-tier { font-size: 11px; padding: 2px 7px; border-radius: 4px; background: var(--bg-elev2); color: var(--text-dim); }
.dc-valor { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.dc-meta { color: var(--text-dim); margin-left: auto; }
.dc-group-count { font-weight: 700; color: var(--blue); }
/* F1 Method Layer 01/mai — outcome_qualitativo badges */
.dc-outcome { font-size: 10px; padding: 3px 8px; border-radius: 4px; font-weight: 700; letter-spacing: 0.02em; }
.dc-outcome-ok      { background: rgba(0,200,120,0.18); color: var(--green, #00c878); }
.dc-outcome-warn    { background: rgba(255,191,0,0.18); color: var(--orange, #ffbf00); }
.dc-outcome-bad     { background: rgba(255,94,94,0.18); color: var(--red); }
.dc-outcome-neutral { background: var(--bg-elev2); color: var(--text-dim); }
.dc-card-followup { border-left: 3px solid var(--orange, #ffbf00); }

.dc-title { font-size: 14px; line-height: 1.4; color: var(--text); margin: 4px 0 8px 0; }
.dc-suggest {
  background: var(--bg-elev2);
  border-left: 3px solid var(--blue);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-dim);
  margin: 8px 0;
}
.dc-suggest b { color: var(--text); }

/* 4 BOTÕES GRANDES — AppleHIG mín 44px */
.dc-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.dc-btn {
  min-height: 44px;
  border: none; border-radius: 10px;
  font: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: transform 0.08s, opacity 0.15s, filter 0.15s;
  display: flex; align-items: center; justify-content: center;
  white-space: nowrap;
  padding: 8px 4px;
}
.dc-btn:hover { filter: brightness(1.12); }
.dc-btn:active { transform: scale(0.97); }
.dc-btn:disabled { opacity: 0.4; cursor: wait; }
.dc-approve { background: linear-gradient(135deg, #2dd47f, #1fa863); color: #062614; }
.dc-reject  { background: linear-gradient(135deg, #ff5e5e, #d63838); color: #fff; }
.dc-snooze  { background: rgba(245,197,66,0.18); color: var(--yellow); border: 1px solid rgba(245,197,66,0.4); }
.dc-ignore  { background: var(--bg-elev2); color: var(--text-dim); border: 1px solid var(--border); }

/* Mobile: 2x2 grid */
@media (max-width: 600px) {
  .dc-actions { grid-template-columns: repeat(2, 1fr); }
  .dc-btn { font-size: 12px; min-height: 48px; }
  .dc-meta { width: 100%; margin-left: 0; }
}

/* Group: 4 botões + lateral expand */
.dc-card-group .dc-actions { grid-template-columns: repeat(4, 1fr); }
.dc-expand {
  background: transparent; color: var(--blue); border: 1px solid var(--blue);
  font-weight: 600; font-size: 12px;
}

/* Hint de atalhos no header das seções */
.kbd-hint {
  font-size: 11px; color: var(--text-dim);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--bg-elev2); padding: 3px 8px; border-radius: 4px;
}

/* Layout das 3 seções da Tab Hoje (29/abr Wave Musk) */
.hoje-section {
  background: transparent;
  margin: 16px 0;
}
.hoje-section-decidir { /* mais proeminente */
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(79,142,255,0.04), transparent 80%);
}
.hoje-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.hoje-section-actions { display: flex; gap: 8px; align-items: center; }
.hoje-section .section-title { margin: 0; }
.hoje-section details > summary {
  cursor: pointer; user-select: none; padding: 8px 0;
  list-style: none;
}
.hoje-section details > summary::-webkit-details-marker { display: none; }
.hoje-section details > summary::before {
  content: "▶ "; transition: transform 0.15s; display: inline-block; color: var(--text-dim); font-size: 11px;
}
.hoje-section details[open] > summary::before { transform: rotate(90deg); }
.hoje-vendo-content, .hoje-infra-content { padding-top: 8px; }
.subsection-title {
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  margin: 12px 0 8px 0; text-transform: uppercase; letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════════════════════════
   29/abr Wave Musk II — UNDO toast + empty celebra + supressão + filtros domínio
   ═══════════════════════════════════════════════════════════════ */

/* UNDO Toast (Gmail-style, 5s countdown) */
#undo-toast-host {
  position: fixed;
  bottom: 80px; left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex; flex-direction: column-reverse; gap: 8px;
  pointer-events: none;
}
.undo-toast {
  background: #1a1f2e;
  border: 1px solid #4f8eff;
  border-radius: 10px;
  padding: 10px 14px;
  display: flex; align-items: center; gap: 12px;
  color: #e6edf7;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  min-width: 280px;
}
.undo-toast .ut-label { flex: 1; font-size: 13px; font-weight: 600; }
.undo-toast .ut-undo {
  background: #4f8eff; color: white;
  border: none; border-radius: 6px;
  padding: 6px 12px; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: filter 0.15s;
}
.undo-toast .ut-undo:hover { filter: brightness(1.15); }
.undo-toast .ut-progress {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; background: rgba(79,142,255,0.2);
}
.undo-toast .ut-bar {
  display: block; height: 100%;
  width: 100%;
  background: #4f8eff;
}
.dc-card-pending-undo {
  opacity: 0.7;
  border-style: dashed;
}
.dc-card-pending-undo::after {
  content: attr(data-pending-act);
  position: absolute; top: 8px; right: 8px;
  font-size: 10px;
  background: rgba(79,142,255,0.2);
  color: #4f8eff;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 700;
}

/* Empty state celebrativo (Tab Hoje + Decidir zerados) */
.empty-celebra {
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(180deg, rgba(45,212,127,0.06), transparent);
  border-radius: 12px;
}
.empty-emoji { font-size: 48px; margin-bottom: 8px; }
.empty-title { font-size: 18px; font-weight: 700; color: var(--green, #2dd47f); margin-bottom: 4px; }
.empty-sub { font-size: 13px; color: var(--text-dim); max-width: 420px; margin: 0 auto; line-height: 1.5; }

/* Banner skills suprimidas (hit rate <40%) */
.hoje-suprimido-banner {
  background: rgba(245,197,66,0.10);
  border: 1px solid rgba(245,197,66,0.3);
  color: var(--yellow);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: help;
}

/* Filtros domínio (Tab Decidir 2 linhas pílulas) */
#fila-dominio-pills { margin-top: 6px; }
#fila-dominio-pills .pill { font-size: 12px; }
.filters-bar { display: flex; flex-direction: column; gap: 8px; }
.filters-bar .filter-input { order: -1; }
@media (min-width: 900px) {
  .filters-bar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .filters-bar .filter-input { order: 0; flex: 1 1 200px; }
  #fila-dominio-pills, #fila-pills { flex: 0 0 auto; margin-top: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   29/abr Pivot — banner pivot + PWA install prompt
   ═══════════════════════════════════════════════════════════════ */
.pivot-banner {
  background: linear-gradient(90deg, rgba(79,142,255,0.15), rgba(79,142,255,0.05));
  border-bottom: 1px solid rgba(79,142,255,0.3);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: var(--text);
}
.pivot-banner-text { flex: 1; line-height: 1.4; }
.pivot-banner-close {
  background: transparent; color: var(--text-dim); border: none;
  font-size: 20px; cursor: pointer; padding: 0 8px;
}
.pivot-banner-close:hover { color: var(--text); }

.pwa-install-prompt {
  background: rgba(45,212,127,0.10);
  border-bottom: 1px solid rgba(45,212,127,0.3);
  padding: 8px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
  color: var(--text-dim);
}
.pwa-prompt-text { flex: 1; }
.pwa-prompt-text kbd {
  background: var(--bg-elev2); padding: 2px 6px; border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px;
}
.pwa-prompt-close {
  background: transparent; color: var(--text-dim); border: none;
  font-size: 18px; cursor: pointer;
}

/* Tabs deprecated (hidden) — defensive style se aparecerem por bug */
.tab-deprecated { opacity: 0.4; }

/* ═══════════════════════════════════════════════════════════════
   29/abr Wave Musk II — Tab Jarvis Admin header KPIs
   ═══════════════════════════════════════════════════════════════ */
.jarvis-admin-kpis { margin-bottom: 8px; }
.jarvis-admin-breakdown {
  display: flex; flex-wrap: wrap; gap: 14px;
  padding: 10px 14px; margin-bottom: 14px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px;
  font-size: 12px; color: var(--text-dim);
}
.jarvis-admin-breakdown b { color: var(--text); font-variant-numeric: tabular-nums; }
.kpi-good { color: var(--green, #2dd47f) !important; }
.kpi-warn { color: var(--yellow, #f5c542) !important; }
.kpi-alert { color: var(--red, #ff5e5e) !important; }
.kpi.kpi-good { border-left: 3px solid var(--green, #2dd47f); }
.kpi.kpi-warn { border-left: 3px solid var(--yellow, #f5c542); }
.kpi.kpi-alert { border-left: 3px solid var(--red, #ff5e5e); }

/* KPI Tab Compras "Mais antiga" coloração por idade */
#compras-kpi-mais-antiga.kpi-warn { color: var(--yellow, #f5c542); }
#compras-kpi-mais-antiga.kpi-alert { color: var(--red, #ff5e5e); }

/* ═══════════════════════════════════════════════════════════════
   29/abr Wave Musk II — Sub-tabs Jarvis Admin (Skills/Lessons/Logs/Syncs)
   ═══════════════════════════════════════════════════════════════ */
.subtabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 0; margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.subtab {
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; font: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.subtab:hover { background: var(--bg-elev); color: var(--text); }
.subtab.active { background: var(--blue, #4f8eff); color: #fff; border-color: var(--blue, #4f8eff); }
.subtab-pane { padding-top: 10px; }
.subtab-intro {
  font-size: 12px; color: var(--text-dim);
  padding: 8px 12px; margin-bottom: 12px;
  background: var(--bg-elev); border-radius: 8px;
  border-left: 3px solid var(--blue, #4f8eff);
}
.jarvis-list { display: flex; flex-direction: column; gap: 6px; }
.jarvis-row {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 13px;
}
.jarvis-row .jr-head {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline;
}
.jarvis-row .jr-head b { font-weight: 600; color: var(--text); }
.jarvis-row .jr-meta { color: var(--text-dim); font-size: 11px; }
.jarvis-row .jr-body {
  margin-top: 6px; color: var(--text-dim);
  font-size: 12px; line-height: 1.4;
  word-break: break-word;
}
.jarvis-row .jr-pct {
  margin-top: 4px; font-weight: 700; font-variant-numeric: tabular-nums;
}
