@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --surface-2: #F3F4F8;
  --border: #E4E7EC;
  --border-soft: #EDEFF3;
  --text: #14171C;
  --text-dim: #667085;
  --text-faint: #98A2B3;

  --accent: #3B7BFA;
  --accent-hover: #2F62D6;
  --accent-soft: #EAF0FF;
  --accent-text-on: #FFFFFF;

  --critical: #DC2626;   --critical-soft: #FDEBEB;
  --alto: #EA6C1D;       --alto-soft: #FDF0E4;
  --medio: #CA8A04;      --medio-soft: #FBF3DA;
  --baixo: #16A34A;      --baixo-soft: #E7F7EC;
  --info: #6B7280;       --info-soft: #F1F2F4;

  --hot: var(--critical);   --hot-soft: var(--critical-soft);
  --warm: var(--alto);      --warm-soft: var(--alto-soft);
  --cool: var(--medio);     --cool-soft: var(--medio-soft);
  --cold: var(--info);      --cold-soft: var(--info-soft);
  --green: var(--baixo);    --red: var(--critical);

  --shadow-sm: 0 1px 2px rgba(16,24,40,0.05);
  --shadow-md: 0 8px 24px rgba(16,24,40,0.10);
  --radius: 12px;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
h1, h2, h3 { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 800; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
.mono { font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px 0; }
.brand .word { font-weight: 800; font-size: 17px; letter-spacing: -0.01em; color: var(--text); }
.brand .word b { color: var(--accent); font-weight: 800; }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); padding: 0 10px; margin-bottom: 6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--text-dim); font-weight: 500; font-size: 13.5px;
  border-left: 2px solid transparent;
}
.nav-item svg { flex-shrink: 0; opacity: 0.8; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.nav-item.active svg { opacity: 1; }

/* ---- topbar ---- */
.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px; border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}
.crumb { color: var(--text-faint); font-size: 13px; font-weight: 500; }
.crumb b { color: var(--text); font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
}
.icon-btn:hover { color: var(--text); border-color: var(--text-faint); }

.avatar-menu { position: relative; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; overflow: hidden; cursor: pointer; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-dropdown {
  position: absolute; right: 0; top: 42px; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-md); padding: 6px; z-index: 20;
}
.avatar-dropdown .who { padding: 8px 10px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; }
.avatar-dropdown .name { font-weight: 600; font-size: 13px; color: var(--text); }
.avatar-dropdown .role { font-size: 11.5px; color: var(--text-faint); }
.avatar-dropdown a { display: block; padding: 7px 10px; border-radius: 6px; color: var(--text-dim); font-size: 13px; }
.avatar-dropdown a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

main { padding: 24px 32px 48px; max-width: 1280px; }

h1 { font-size: 20px; }
.subtitle { color: var(--text-dim); margin-bottom: 20px; font-size: 13px; }

/* ---- stats ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; position: relative; box-shadow: var(--shadow-sm); }
.stat .n { font-weight: 800; font-size: 24px; letter-spacing: -0.01em; color: var(--text); }
.stat .l { color: var(--text-dim); font-size: 12px; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.03em; }
.stat .icon-badge {
  position: absolute; top: 14px; right: 14px; width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
}
.dot-lg { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: currentColor; vertical-align: middle; }
.stat.tone-hot .icon-badge { background: var(--critical-soft); color: var(--critical); }
.stat.tone-warm .icon-badge { background: var(--alto-soft); color: var(--alto); }
.stat.tone-cool .icon-badge { background: var(--cool-soft); color: var(--cool); }
.stat.tone-cold .icon-badge { background: var(--cold-soft); color: var(--cold); }
.stat.tone-info .icon-badge { background: var(--accent-soft); color: var(--accent); }
.stat.tone-ok .icon-badge { background: var(--baixo-soft); color: var(--baixo); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }

/* ---- barlist (funil) ---- */
.barlist { display: flex; flex-direction: column; gap: 10px; }
.barlist-row { display: grid; grid-template-columns: 150px 1fr 40px; align-items: center; gap: 10px; font-size: 12.5px; }
.barlist-row .label { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barlist-track { background: var(--surface-2); border-radius: 6px; height: 9px; overflow: hidden; }
.barlist-fill { height: 100%; border-radius: 6px; min-width: 2px; }
.barlist-row .value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }

/* ---- trend chart ---- */
.trendchart { display: flex; align-items: flex-end; gap: 5px; height: 110px; }
.trendchart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.trendchart .v { font-size: 10px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.trendchart .bar { width: 100%; background: var(--accent-soft); border-radius: 3px 3px 0 0; min-height: 2px; }
.trendchart .bar.hoje { background: var(--accent); }
.trendchart .lbl { font-size: 10px; color: var(--text-faint); }

/* ---- table ---- */
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border-soft); }
th { color: var(--text-faint); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ---- badges/pills (temperatura) ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-hot { background: var(--hot-soft); color: var(--hot); }
.badge-warm { background: var(--warm-soft); color: var(--warm); }
.badge-cool { background: var(--cool-soft); color: var(--cool); }
.badge-cold { background: var(--cold-soft); color: var(--cold); }

/* ---- pill filters (segmented) ---- */
.pillbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill-filter {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-dim); font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.pill-filter:hover { border-color: var(--text-faint); color: var(--text); text-decoration: none; }
.pill-filter.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text-on); }
.pill-filter .count { opacity: 0.75; font-weight: 500; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text-on); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text-on); }

/* ---- kanban ---- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { flex: 0 0 260px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 12px; }
.kanban-col-head .t { font-size: 12.5px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.03em; }
.kanban-col-head .count { font-size: 11.5px; color: var(--text-faint); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; }
.kanban-card {
  background: var(--surface); border: 1px solid var(--border-soft); border-left: 3px solid var(--info);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; display: block; color: var(--text);
  box-shadow: var(--shadow-sm);
}
.kanban-card:hover { border-color: var(--accent); text-decoration: none; }
.kanban-card.tone-hot { border-left-color: var(--hot); }
.kanban-card.tone-warm { border-left-color: var(--warm); }
.kanban-card.tone-cool { border-left-color: var(--cool); }
.kanban-card .co { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.kanban-card .meta { font-size: 11.5px; color: var(--text-faint); display: flex; justify-content: space-between; }

.login-wrap { display: flex; align-items: center; justify-content: center; height: 100vh; background: var(--bg); }
.login-card { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 48px; box-shadow: var(--shadow-md); }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card p { color: var(--text-dim); margin-bottom: 26px; font-size: 13.5px; }
.google-btn { display: inline-flex; align-items: center; gap: 10px; background: var(--accent); color: var(--accent-text-on); padding: 10px 22px; border-radius: 8px; font-weight: 600; }
.google-btn:hover { background: var(--accent-hover); text-decoration: none; }

.error { color: var(--critical); background: var(--critical-soft); border: 1px solid var(--critical-soft); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.notice { color: var(--accent); background: var(--accent-soft); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }

input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2398A2B3' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M4 6.2l4 4 4-4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 11px;
  cursor: pointer;
}
input:hover, select:hover, textarea:hover { border-color: var(--text-faint); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
label { display: block; color: var(--text-faint); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin: 12px 0 4px; }

.checkbox-cell { text-align: center; }
.checkbox-cell input[type=checkbox] { width: 20px; height: 20px; cursor: pointer; accent-color: var(--accent); }
