:root {
  --surface-0: #f1efe8;
  --surface-1: #f7f6f2;
  --surface-2: #ffffff;
  --text-primary: #1a1a18;
  --text-secondary: #5f5e5a;
  --text-muted: #888780;
  --border: rgba(0,0,0,0.10);
  --border-strong: rgba(0,0,0,0.18);
  --border-danger: rgba(180,40,40,0.3);
  --bg-accent: #e6f1fb;
  --text-accent: #185fa5;
  --fill-accent: #378add;
  --fill-accent-hover: #185fa5;
  --on-accent: #fff;
  --bg-danger: #fcebeb;
  --text-danger: #a32d2d;
  --fill-danger: #e24b4a;
  --bg-warning: #faeeda;
  --text-warning: #854f0b;
  --fill-warning: #ef9f27;
  --bg-success: #eaf3de;
  --text-success: #3b6d11;
  --fill-success: #639922;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--surface-0); color: var(--text-primary); height: 100vh; overflow: hidden; }
a { text-decoration: none; color: inherit; }

.app { display: flex; height: 100vh; }

/* ── SIDEBAR ── */
.sidebar { width: 224px; background: var(--surface-1); border-right: 0.5px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; }
.sidebar-header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 0.5px solid var(--border); }
.sidebar-header i { font-size: 20px; color: var(--fill-accent); }
.sidebar-header strong { display: block; font-size: 13px; font-weight: 500; }
.sidebar-header span { font-size: 11px; color: var(--text-muted); }
.nav-section { padding: 6px 0; border-bottom: 0.5px solid var(--border); }
.nav-label { font-size: 10px; font-weight: 500; color: var(--text-muted); padding: 4px 16px 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 7px 16px; cursor: pointer; color: var(--text-secondary); font-size: 12.5px; transition: background 0.1s; }
.nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-item.active { background: var(--bg-accent); color: var(--text-accent); }
.nav-item i { font-size: 15px; flex-shrink: 0; }
.badge { margin-left: auto; font-size: 10px; font-weight: 500; background: var(--fill-danger); color: #fff; border-radius: 10px; padding: 1px 6px; min-width: 18px; text-align: center; }
.badge.warn { background: var(--fill-warning); }
.badge-setor { margin-left: auto; font-size: 10px; color: var(--text-muted); }

/* ── MAIN ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 0.5px solid var(--border); background: var(--surface-2); flex-shrink: 0; }
.topbar h1 { font-size: 14px; font-weight: 500; flex: 1; }
.select-sm { font-size: 12px; padding: 5px 8px; border: 0.5px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text-primary); cursor: pointer; font-family: var(--font); }

/* STATS */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 10px 12px; flex-shrink: 0; }
.stat-card { background: var(--surface-1); border-radius: var(--radius); padding: 10px 12px; border: 0.5px solid var(--border); }
.stat-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 20px; font-weight: 500; }
.stat-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.stat-value.danger { color: var(--text-danger); }
.stat-value.success { color: var(--text-success); }
.stat-value.warning { color: var(--text-warning); }

/* KANBAN */
.kanban-wrap { flex: 1; overflow: hidden; padding: 0 12px 12px; }
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; height: 100%; }
.column { background: var(--surface-1); border-radius: 10px; border: 0.5px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.col-header { padding: 10px 12px; border-bottom: 0.5px solid var(--border); display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.col-title { font-size: 12px; font-weight: 500; flex: 1; }
.col-count { font-size: 11px; color: var(--text-muted); }
.col-cards { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }

/* CARD */
.card { background: var(--surface-2); border: 0.5px solid var(--border); border-radius: 8px; padding: 9px 10px; cursor: pointer; transition: border-color 0.15s; }
.card:hover { border-color: var(--fill-accent); }
.card.selecionado { border-color: var(--fill-accent); background: var(--bg-accent); }
.card-name { font-size: 12px; font-weight: 500; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sector { font-size: 11px; color: var(--text-muted); margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-footer { display: flex; align-items: center; gap: 4px; }
.tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 500; }
.tag.gut3 { background: var(--bg-danger); color: var(--text-danger); }
.tag.gut2 { background: var(--bg-warning); color: var(--text-warning); }
.tag.gut1 { background: var(--bg-success); color: var(--text-success); }
.tag.done { background: var(--bg-success); color: var(--text-success); }
.card-time { font-size: 10px; color: var(--text-muted); margin-left: auto; }

/* ── DETAIL PANE ── */
.detail-pane { width: 300px; border-left: 0.5px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden; }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 12px 14px; border-bottom: 0.5px solid var(--border); gap: 8px; flex-shrink: 0; }
.detail-empresa { font-size: 13px; font-weight: 500; }
.detail-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.panel-toggle { display: flex; border-bottom: 0.5px solid var(--border); flex-shrink: 0; }
.ptab { flex: 1; text-align: center; padding: 7px; font-size: 11px; color: var(--text-muted); cursor: pointer; border: none; border-bottom: 2px solid transparent; background: none; font-family: var(--font); }
.ptab.active { color: var(--text-accent); border-bottom-color: var(--fill-accent); font-weight: 500; }

/* ABA */
.aba { display: flex; flex-direction: column; flex: 1; overflow: hidden; }

/* CHAT */
.chat-msgs { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 85%; font-size: 12px; line-height: 1.45; padding: 7px 10px; border-radius: 10px; }
.msg.in { background: var(--surface-0); border: 0.5px solid var(--border); align-self: flex-start; border-bottom-left-radius: 3px; }
.msg.out { background: var(--bg-accent); color: var(--text-accent); align-self: flex-end; border-bottom-right-radius: 3px; }
.msg-time { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.msg.out .msg-time { text-align: right; color: #5a8bbf; }
.chat-input { padding: 8px; border-top: 0.5px solid var(--border); display: flex; gap: 6px; flex-shrink: 0; }
.chat-input input { flex: 1; font-size: 12px; padding: 6px 10px; border: 0.5px solid var(--border-strong); border-radius: 20px; background: var(--surface-1); color: var(--text-primary); outline: none; font-family: var(--font); }
.chat-input input:focus { border-color: var(--fill-accent); }
.chat-send { width: 30px; height: 30px; border-radius: 50%; background: var(--fill-accent); color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; }
.chat-send:hover { background: var(--fill-accent-hover); }

/* FORMS */
.field-group { display: flex; flex-direction: column; gap: 4px; }
.field-group label { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.field-group input, .field-group select, .field-group textarea {
  font-size: 12px; padding: 6px 8px; border: 0.5px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface-1); color: var(--text-primary);
  outline: none; font-family: var(--font); resize: vertical;
}
.field-group input:focus, .field-group select:focus, .field-group textarea:focus { border-color: var(--fill-accent); }
#aba-dados { gap: 10px; padding: 12px; overflow-y: auto; }

/* BUTTONS */
.btn { font-size: 12px; padding: 6px 12px; border: 0.5px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text-primary); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-family: var(--font); transition: background 0.1s; }
.btn:hover { background: var(--surface-1); }
.btn.btn-primary { background: var(--fill-accent); color: var(--on-accent); border-color: var(--fill-accent); }
.btn.btn-primary:hover { background: var(--fill-accent-hover); border-color: var(--fill-accent-hover); }
.btn.w-full { width: 100%; justify-content: center; }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 18px; padding: 2px; display: flex; align-items: center; }
.btn-icon:hover { color: var(--text-primary); }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.35); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--surface-2); border-radius: 12px; border: 0.5px solid var(--border); width: 480px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 0.5px solid var(--border); }
.modal-header h2 { font-size: 15px; font-weight: 500; }
.modal-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.modal-footer { padding: 12px 18px; border-top: 0.5px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* VAZIO */
.empty { text-align: center; color: var(--text-muted); font-size: 12px; padding: 24px 8px; }

/* ── SIDEBAR FOOTER ── */
.sidebar-footer { display:flex; align-items:center; gap:8px; padding:10px 16px; border-top:0.5px solid var(--border); margin-top:auto; }
.user-info { display:flex; align-items:center; gap:6px; flex:1; font-size:12px; color:var(--text-secondary); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }

/* ── CHAT WHATS TOGGLE ── */
.chat-whats-toggle { padding:4px 10px; border-top:0.5px solid var(--border); flex-shrink:0; background:var(--surface-1); }

/* ── TOAST ── */
.toast { position:fixed; bottom:24px; right:24px; background:#1a1a18; color:#fff; font-size:13px; padding:12px 18px; border-radius:10px; z-index:999; display:flex; align-items:center; gap:8px; box-shadow:0 4px 20px rgba(0,0,0,.2); animation:slideup .2s ease; }
@keyframes slideup { from{transform:translateY(16px);opacity:0} to{transform:none;opacity:1} }
