/* ============================================================
   APEX GESTÃO — style.css
   Cores: #CC0000 (vermelho), #0a0a0a (preto profundo)
   Font: DM Sans
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --r: #CC0000;
  --rd: #990000;
  --rl: #e04444;
  --bg: #0a0a0a;
  --s1: #141414;
  --s2: #1c1c1c;
  --s3: #242424;
  --bd: #2e2e2e;
  --t: #f0f0f0;
  --m: #777;
  --g: #3aaa70;
  --yl: #cc9900;
  --font: 'DM Sans', system-ui, sans-serif;
}

html, body { height: 100%; background: var(--bg); color: var(--t); font-family: var(--font); font-size: 14px; }

/* ── LOGIN ─────────────────────────────────────────── */
.screen-login {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 2rem; background: var(--bg);
}
.login-container { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; }

.logo-upload-area {
  width: 100%; padding: 14px;
  border: 1.5px dashed #333; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--m); font-size: 13px; cursor: pointer; margin-bottom: 1.5rem;
  transition: border-color .2s;
}
.logo-upload-area:hover { border-color: var(--r); color: var(--t); }

.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 2rem; }
.brand-mark {
  width: 52px; height: 52px; background: var(--r); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 500; color: #fff; overflow: hidden;
}
.brand-mark img { width: 52px; height: 52px; object-fit: contain; }
.brand-name { font-size: 20px; font-weight: 500; letter-spacing: 1px; }
.brand-sub { font-size: 11px; color: var(--m); letter-spacing: 2px; margin-top: 2px; }

.login-card {
  width: 100%; background: var(--s1);
  border: 0.5px solid var(--bd); border-radius: 12px; padding: 2rem;
}
.login-card h2 { font-size: 16px; font-weight: 500; margin-bottom: 3px; }
.login-card p { font-size: 12px; color: var(--m); margin-bottom: 1.5rem; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 11px; color: var(--m); letter-spacing: .5px; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--s2); border: 0.5px solid var(--bd);
  border-radius: 6px; padding: 10px 12px; color: var(--t);
  font-size: 14px; font-family: var(--font); outline: none;
  transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--r); }
.field select option { background: var(--s2); }
.field textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

.login-error { font-size: 12px; color: var(--rl); margin-bottom: .75rem; }

.btn-login {
  width: 100%; background: var(--r); border: none; border-radius: 6px;
  padding: 11px; color: #fff; font-size: 14px; font-weight: 500;
  cursor: pointer; font-family: var(--font); transition: background .15s;
}
.btn-login:hover { background: var(--rd); }

/* ── TOPBAR ─────────────────────────────────────────── */
.screen-app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar {
  height: 54px; background: var(--s1); border-bottom: 0.5px solid #1e1e1e;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem; flex-shrink: 0; z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-mark {
  width: 30px; height: 30px; background: var(--r); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 500; color: #fff; overflow: hidden;
}
.topbar-mark img { width: 30px; height: 30px; object-fit: contain; }
.topbar-name { font-size: 15px; font-weight: 500; }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--s2); border: 0.5px solid var(--bd);
  border-radius: 20px; padding: 4px 12px 4px 4px; cursor: pointer;
  transition: border-color .15s;
}
.user-chip:hover { border-color: var(--r); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; color: #fff;
}
.user-name { font-size: 12px; color: var(--m); }

/* ── LAYOUT ─────────────────────────────────────────── */
.app-layout { display: flex; flex: 1; overflow: hidden; }

.sidebar {
  width: 210px; background: var(--s1); border-right: 0.5px solid #1e1e1e;
  padding: 1rem 0; overflow-y: auto; flex-shrink: 0;
}
.nav-section { margin-bottom: 1rem; }
.nav-label { font-size: 10px; color: var(--m); letter-spacing: 1px; padding: 0 1rem; margin-bottom: 4px; margin-top: .75rem; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 1rem; font-size: 13px; color: var(--m);
  cursor: pointer; border-left: 2px solid transparent;
  transition: all .15s; user-select: none;
}
.nav-item i { font-size: 15px; }
.nav-item:hover { color: var(--t); background: rgba(255,255,255,.03); }
.nav-item.active { color: #fff; border-left-color: var(--r); background: rgba(204,0,0,.08); }

.main-content { flex: 1; overflow-y: auto; padding: 1.25rem; background: var(--bg); }

/* ── COMPONENTES GERAIS ────────────────────────────── */
.page-title { font-size: 18px; font-weight: 500; margin-bottom: 3px; }
.page-sub { font-size: 13px; color: var(--m); margin-bottom: 1.25rem; }

.stats-grid { display: grid; gap: 10px; margin-bottom: 1rem; }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }

.stat-card { background: var(--s1); border: 0.5px solid var(--bd); border-radius: 8px; padding: .85rem; }
.stat-label { font-size: 11px; color: var(--m); margin-bottom: 5px; }
.stat-value { font-size: 20px; font-weight: 500; }
.stat-delta { font-size: 11px; margin-top: 2px; }

.card { background: var(--s1); border: 0.5px solid var(--bd); border-radius: 8px; padding: 1rem; margin-bottom: 10px; }
.card-title { font-size: 11px; color: var(--m); letter-spacing: .5px; margin-bottom: 10px; font-weight: 500; }

.row-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 0.5px solid #1e1e1e;
}
.row-item:last-child { border-bottom: none; }
.row-name { font-size: 13px; flex: 1; }
.row-sub { font-size: 11px; color: var(--m); }
.row-value { font-size: 13px; font-weight: 500; }

.badge { font-size: 10px; padding: 2px 7px; border-radius: 4px; font-weight: 500; white-space: nowrap; }
.badge-green { background: rgba(40,160,100,.15); color: #3aaa70; }
.badge-amber { background: rgba(200,150,0,.15); color: #cc9900; }
.badge-red { background: rgba(204,0,0,.2); color: #e04444; }
.badge-blue { background: rgba(50,120,220,.15); color: #5599ff; }
.badge-purple { background: rgba(130,60,180,.15); color: #aa66ff; }

.pos { color: var(--g); }
.neg { color: var(--rl); }
.warn { color: var(--yl); }

.btn {
  font-size: 12px; padding: 6px 12px; border-radius: 6px;
  border: 0.5px solid var(--bd); background: var(--s2);
  color: var(--m); cursor: pointer; font-family: var(--font);
  transition: all .15s;
}
.btn:hover { border-color: var(--r); color: var(--t); }
.btn-primary {
  background: var(--r); border: none; color: #fff;
  font-size: 12px; padding: 7px 14px; border-radius: 6px;
  cursor: pointer; font-weight: 500; font-family: var(--font);
  transition: background .15s;
}
.btn-primary:hover { background: var(--rd); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

.modal-panel {
  background: rgba(0,0,0,.7); border-radius: 8px;
  padding: 1.25rem; margin-bottom: 10px;
}
.modal-title { font-size: 13px; font-weight: 500; margin-bottom: 12px; color: var(--t); }

/* ── CALENDÁRIO ─────────────────────────────────────── */
.cal-wrapper { background: var(--s1); border: 0.5px solid var(--bd); border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.cal-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 0.5px solid var(--bd); }
.cal-header-title { font-size: 14px; font-weight: 500; }
.cal-dow-row, .cal-days-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow-cell { text-align: center; font-size: 11px; color: var(--m); padding: 7px 4px; background: var(--s2); border-bottom: 0.5px solid var(--bd); }
.cal-cell { min-height: 74px; border-right: 0.5px solid #1e1e1e; border-bottom: 0.5px solid #1e1e1e; padding: 4px; cursor: pointer; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: rgba(204,0,0,.04); }
.cal-cell.today { background: rgba(204,0,0,.07); }
.cal-cell.other-month { opacity: .3; pointer-events: none; }
.cal-day-num { font-size: 11px; color: var(--m); margin-bottom: 3px; }
.cal-cell.today .cal-day-num { color: var(--r); font-weight: 500; }
.cal-task-chip {
  font-size: 10px; padding: 2px 5px; border-radius: 3px;
  margin-bottom: 2px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; cursor: default;
}
.chip-josue { background: rgba(204,0,0,.25); color: #ffaaaa; border-left: 2px solid var(--r); }
.chip-leo { background: rgba(50,120,220,.2); color: #aaccff; border-left: 2px solid #5599ff; }
.chip-geral { background: rgba(80,160,80,.18); color: #aaffaa; border-left: 2px solid #55aa55; }
.cal-add-btn { font-size: 10px; color: var(--m); padding: 1px 4px; border-radius: 3px; border: 0.5px dashed #333; cursor: pointer; display: inline-block; margin-top: 2px; }
.cal-add-btn:hover { border-color: var(--r); color: var(--r); }

/* ── CATEGORIAS DE CUSTO ─────────────────────────────── */
.cat-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 10px; }
.cat-card { background: var(--s2); border: 0.5px solid var(--bd); border-radius: 8px; padding: 10px; cursor: pointer; transition: border-color .15s; }
.cat-card:hover { border-color: var(--r); }
.cat-icon { font-size: 20px; margin-bottom: 6px; }
.cat-name { font-size: 12px; font-weight: 500; }
.cat-label { font-size: 10px; color: var(--m); margin-top: 4px; }
.cat-val { font-size: 13px; font-weight: 500; margin-top: 1px; }
.cat-alert { font-size: 10px; color: var(--rl); margin-top: 3px; }
.prog-track { height: 4px; background: var(--s3); border-radius: 2px; margin-top: 6px; }
.prog-fill { height: 4px; border-radius: 2px; }

/* ── BALANÇOS MENSAIS ──────────────────────────────── */
.bal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; margin-bottom: 10px; }
.bal-cell { background: var(--s2); border: 0.5px solid var(--bd); border-radius: 8px; padding: 10px; cursor: pointer; transition: border-color .15s; }
.bal-cell:hover { border-color: var(--r); }
.bal-cell.selected { border-color: var(--r); background: rgba(204,0,0,.09); }
.bal-cell-month { font-size: 12px; font-weight: 500; margin-bottom: 6px; }
.bal-saida { font-size: 11px; color: var(--rl); }
.bal-entrada { font-size: 11px; color: var(--g); }
.bal-saldo { font-size: 12px; font-weight: 500; margin-top: 4px; padding-top: 4px; border-top: 0.5px solid var(--bd); }
.bal-vazio { font-size: 11px; color: var(--m); }

/* ── SAÚDE FINANCEIRA ──────────────────────────────── */
.health-bar { margin-bottom: 12px; }
.health-bar-labels { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.health-bar-labels span:first-child { color: var(--m); }
.health-track { height: 7px; background: var(--s3); border-radius: 4px; }
.health-fill { height: 7px; border-radius: 4px; }

/* ── INVESTIMENTOS ─────────────────────────────────── */
.inv-card { background: var(--s2); border: 0.5px solid var(--bd); border-radius: 6px; padding: 10px; margin-bottom: 8px; }
.inv-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.inv-card-name { font-size: 13px; font-weight: 500; }
.inv-card-val { font-size: 14px; font-weight: 500; }
.inv-track { height: 4px; background: var(--s3); border-radius: 2px; margin-top: 7px; }
.inv-fill { height: 4px; border-radius: 2px; }

/* ── AI REUNIÃO ─────────────────────────────────────── */
.ai-result-box {
  background: rgba(204,0,0,.07); border: 0.5px solid rgba(204,0,0,.3);
  border-radius: 8px; padding: 1rem; margin-bottom: 10px;
}
.ai-result-label { font-size: 11px; color: var(--r); letter-spacing: .5px; margin-bottom: 8px; font-weight: 500; }
.task-gen-row { background: var(--s2); border: 0.5px solid var(--bd); border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.task-gen-name { font-size: 13px; flex: 1; }
.task-gen-resp { font-size: 11px; padding: 2px 8px; border-radius: 4px; }

/* ── AGENDA FINANCEIRA ─────────────────────────────── */
.agenda-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 0.5px solid #1e1e1e; }
.agenda-row:last-child { border-bottom: none; }
.agenda-day-badge { width: 38px; height: 38px; background: var(--s2); border-radius: 6px; border: 0.5px solid var(--bd); display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; }
.agenda-day-num { font-size: 14px; font-weight: 500; }
.agenda-day-mon { font-size: 9px; color: var(--m); }

/* ── PIPELINE CRM ─────────────────────────────────── */
.pipeline-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pipeline-col { background: var(--s2); border-radius: 8px; padding: 10px; }
.pipeline-col-header { font-size: 11px; color: var(--m); margin-bottom: 8px; display: flex; justify-content: space-between; }
.pipeline-count { background: #2a2a2a; border-radius: 10px; padding: 1px 7px; font-size: 10px; }
.pipeline-card { background: var(--s1); border: 0.5px solid var(--bd); border-radius: 6px; padding: 10px; margin-bottom: 6px; }
.pipeline-card-name { font-size: 12px; font-weight: 500; }
.pipeline-card-val { font-size: 11px; color: var(--m); margin-top: 2px; }

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 0; overflow: hidden; position: absolute; z-index: 20; height: calc(100vh - 54px); }
  .sidebar.open { width: 210px; }
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .pipeline-cols { grid-template-columns: 1fr; }
}
