/* ===== Tokens ===== */
:root {
  /* Paleta do Dealflow (tokens HSL do app publicado) */
  --primary: #fd6435;          /* hsl(14 98% 60%) */
  --primary-dark: #d75529;
  --primary-soft: #fd643526;
  --on-primary: #fff;
  --ink: #1a2322;             /* hsl(170 15% 12%) */
  --muted: #67837f;           /* hsl(170 12% 46%) */
  --line: #e0e6e5;            /* hsl(170 10% 89%) */
  --line-strong: #c5d0ce;
  --bg: #eff5f4;              /* secondary / mint */
  --surface: #fff;
  --side: #ecf3f2;            /* sidebar */
  --side-accent: #dae7e5;
  --teal: #39ac99;            /* etapa ganha */
  --red: #d32c2c;             /* etapa perdida */
  --amber: #eda71d;
  --blue: #3c8cdd;
  --radius: 8px;
  --side-w: 232px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.45 Outfit, Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { letter-spacing: -0.015em; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.spacer { flex: 1; }
.ic { flex: none; }
[hidden] { display: none !important; }

/* ===== Layout ===== */
#app { display: flex; height: 100%; overflow: hidden; }
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#view { flex: 1; overflow: auto; }

/* ===== Sidebar ===== */
#sidebar {
  width: var(--side-w); flex: none; background: var(--side); color: var(--ink); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 12px 10px; gap: 8px;
  transition: width .18s ease;
}
.collapsed #sidebar { width: 64px; }
.brand { display: block; margin-bottom: 10px; }
.brand-logo {
  display: flex; align-items: center; justify-content: center; height: 46px;
  border-radius: 10px; padding: 6px 10px; overflow: hidden;
}
.brand-logo.bg-white { background: #fff; }
.brand-logo img { max-width: 100%; max-height: 34px; object-fit: contain; display: block; }
.brand-logo.default { justify-content: flex-start; gap: 10px; color: var(--ink); padding-left: 4px; }
.brand-logo.default b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-dot {
  width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--primary);
  color: var(--on-primary); display: grid; place-items: center; font-weight: 700; font-size: 17px;
}
.collapsed .brand-logo { padding: 4px; }
.collapsed .brand-logo.default b { display: none; }
.collapsed .brand-logo.default { justify-content: center; padding-left: 4px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav.bottom { margin-top: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px;
  border-radius: 8px; color: #4b625e; background: none; border: 0; text-align: left; position: relative;
  white-space: nowrap; overflow: hidden; font-weight: 500;
}
.nav-item:hover { background: #e2eeec; color: var(--ink); }
.nav-item.active { background: var(--side-accent); color: var(--ink); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--primary);
}
.collapsed .nav-item span { display: none; }
.collapsed .nav-item { justify-content: center; padding: 0; }
.collapsed [data-action="toggle-sidebar"] .ic { transform: rotate(180deg); }

/* ===== Topbar ===== */
#topbar {
  height: 56px; flex: none; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
}
.search { position: relative; width: min(420px, 45vw); }
.search .s-ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }
.search .input { padding-left: 32px; background: var(--bg); border-color: transparent; height: 34px; }
.search .input:focus { background: #fff; }
.search-results {
  position: absolute; top: 40px; left: 0; right: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 30; max-height: 380px; overflow: auto;
}
.search-results:empty { display: none; }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; }
.sr-item:hover { background: var(--bg); }
.sr-item small { color: var(--muted); display: block; }
.sr-item .sr-ic { width: 28px; height: 28px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-dark); display: grid; place-items: center; flex: none; }
.sr-empty { padding: 14px; color: var(--muted); }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 40px; width: 200px; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 6px; z-index: 30;
}
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 4px; text-align: left; }
.menu button:hover { background: var(--bg); }
.user { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none;
}
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.uname { font-weight: 500; }

/* ===== Buttons & inputs ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.won { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.suspended { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn.lost { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-ghost { color: var(--red); border-color: transparent; background: none; }
.btn.danger-ghost:hover { background: #d32c2c1a; }
.btn.round { width: 34px; padding: 0; border-radius: 50%; height: 34px; }
.btn.icon { width: 32px; padding: 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { background: none; border: 0; padding: 4px; border-radius: 4px; color: var(--muted); display: inline-flex; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }

.input {
  width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink); font: inherit;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; min-height: 84px; }
.input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.sm { width: auto; min-width: 150px; }
.input[type="color"] { padding: 2px; width: 48px; }
.fld { display: block; margin-bottom: 12px; }
.fld > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: #fff; }
.seg-btn { border: 0; background: none; height: 30px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.seg-btn + .seg-btn { border-left: 1px solid var(--line-strong); }
.seg-btn.on { background: var(--ink); color: #fff; }
.seg-btn:not(.on):hover { background: var(--bg); }

/* ===== Page ===== */
.page { padding: 20px 24px 32px; }
.page.narrow { max-width: 980px; }
.page.fill { height: 100%; display: flex; flex-direction: column; padding: 14px 20px 0; }
.h1 { font-size: 22px; font-weight: 600; margin-bottom: 16px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.summary { color: var(--muted); }
.summary b { color: var(--ink); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 20px; margin-bottom: 16px; }
.panel h2 { font-size: 16px; margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ===== Kanban ===== */
.deals-body { flex: 1; min-height: 0; overflow: auto; }
.board { height: 100%; display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.col { flex: 1 0 272px; min-width: 272px; display: flex; flex-direction: column; min-height: 0; }
.col-head { padding: 2px 4px 10px; }
.stage-head {
  display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stage-head::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--sc, var(--primary)); flex: none; }
.col-sum { padding: 2px 0 0 18px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.col-body { flex: 1; overflow-y: auto; padding: 8px 8px 40px; border-radius: 12px; background: var(--bg); }
.col-body.over { background: #dfece9; }
.col-empty { color: var(--muted); text-align: center; font-size: 12px; padding: 18px 8px; border: 1px dashed var(--line-strong); border-radius: 8px; }
.card {
  background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--sc, var(--primary)); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
  cursor: grab; box-shadow: 0 1px 2px rgba(26,35,34,.05);
}
.card:hover { border-color: var(--line-strong); border-left-color: var(--sc, var(--primary)); box-shadow: 0 4px 12px rgba(26,35,34,.10); }
.card.dragging { opacity: .35; }
.card-title { font-weight: 600; word-break: break-word; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; }
.card-val { font-weight: 500; }
.rot { font-size: 11px; color: var(--red); background: #d32c2c1a; padding: 1px 6px; border-radius: 10px; }
.ph { height: 4px; margin: -2px 0 6px; background: var(--primary); border-radius: 2px; }
.ind { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; }
.ind.ok { border: 1.5px solid var(--teal); color: var(--teal); }
.ind.late { background: var(--red); color: #fff; }
.ind.warn { background: var(--amber); color: #fff; }

.dropzones {
  position: fixed; left: 0; right: 0; bottom: 0; height: 84px; display: none; gap: 12px; padding: 12px 24px;
  background: rgba(255,255,255,.96); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(0,0,0,.08); z-index: 40;
}
body.is-dragging .dropzones { display: flex; }
.dz {
  flex: 1; display: grid; place-items: center; border: 2px dashed; border-radius: 8px; font-weight: 600; font-size: 15px;
}
.dz.won { color: #21806f; border-color: var(--teal); }
.dz.suspended { color: #96690a; border-color: var(--amber); }
.dz.lost { color: var(--red); border-color: var(--red); }
.dz.del { color: var(--muted); border-color: var(--line-strong); }
.dz.over.won { background: var(--teal); color: #fff; }
.dz.over.suspended { background: var(--amber); color: #fff; }
.dz.over.lost { background: var(--red); color: #fff; }
.dz.over.del { background: var(--ink); color: #fff; }

/* ===== Tables ===== */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; background: var(--bg);
  border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; position: sticky; top: 0;
}
.tbl th:hover { color: var(--ink); }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr:hover { background: #f6faf9; }
.cell-name { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.muted { color: var(--muted); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; white-space: nowrap; }
.chip.won { background: #39ac9922; border-color: transparent; color: #21806f; }
.chip.suspended { background: #eda71d26; border-color: transparent; color: #96690a; }
.chip.lost { background: #d32c2c1a; border-color: transparent; color: var(--red); }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* ===== Activities ===== */
.check {
  width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: #fff;
  display: inline-grid; place-items: center; color: transparent; padding: 0; flex: none;
}
.check:hover { border-color: var(--primary); color: var(--primary); }
.check.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.act-type { display: inline-flex; align-items: center; gap: 6px; }
.late-txt { color: var(--red); font-weight: 500; }
.type-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.type-chips label { cursor: pointer; }
.type-chips input { position: absolute; opacity: 0; pointer-events: none; }
.type-chips span {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); background: #fff; font-size: 13px;
}
.type-chips input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.type-chips input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-soft); }

/* ===== Deal detail ===== */
.deal-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.deal-head h1 { font-size: 22px; font-weight: 600; }
.deal-meta { color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; margin-top: 2px; }
.stagebar { display: flex; margin: 0 0 18px 6px; }
.st {
  flex: 1; height: 38px; border: 0; margin-left: -6px; background: var(--side-accent); color: #3f5652; font-size: 12.5px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; padding: 0 16px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%);
  min-width: 0;
}
.st span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.st small { font-weight: 400; font-size: 10.5px; opacity: .9; }
.st:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 4px 0 0 4px; margin-left: 0; }
.st.on { background: var(--primary); color: var(--on-primary); }
.st:not(.on):not(:disabled):hover { background: #c9dbd8; }
.st:disabled { cursor: default; }
.deal-grid { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.side-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; }
.side-card h3 { font-size: 13px; padding: 12px 14px 8px; display: flex; align-items: center; justify-content: space-between; }
.kv { padding: 0 14px 12px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-top: 1px solid #f0f1f2; }
.kv div:first-child { border-top: 0; }
.kv dt, .kv span.k { color: var(--muted); }
.kv .v { text-align: right; word-break: break-word; }
.link { color: var(--blue); cursor: pointer; background: none; border: 0; padding: 0; }
.link:hover { text-decoration: underline; }
.composer { background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 8px; }
.tabs button { border: 0; background: none; padding: 12px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 6px; align-items: center; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--primary); }
.composer-body { padding: 14px; }
.section-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 8px; }
.tl-item { display: flex; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; }
.tl-item.hist { background: none; border: 0; padding: 4px 14px; color: var(--muted); font-size: 13px; }
.tl-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: var(--muted); flex: none; }
.tl-item.hist .tl-ic { width: 20px; height: 20px; }
.tl-body { flex: 1; min-width: 0; }
.tl-body p { white-space: pre-wrap; word-break: break-word; }
.tl-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.badge-big { font-size: 13px; padding: 4px 10px; border-radius: 12px; font-weight: 600; }

/* ===== KPI / charts ===== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.kpi small { color: var(--muted); font-weight: 500; }
.kpi b { display: block; font-size: 24px; margin: 4px 0 2px; font-weight: 600; }
.kpi span { color: var(--muted); font-size: 12px; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.funnel-row { display: grid; grid-template-columns: 130px 1fr 110px; gap: 12px; align-items: center; margin: 10px 0; }
.funnel-row .nm { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: #eef0f2; border-radius: 4px; height: 26px; position: relative; overflow: hidden; }
.bar { background: var(--primary); height: 100%; border-radius: 4px; min-width: 3px; }
.bar-txt { display: flex; flex-direction: column; line-height: 1.2; font-size: 13px; text-align: right; }
.bar-txt small { color: var(--muted); font-size: 11px; }
.months { display: flex; align-items: flex-end; gap: 14px; height: 200px; padding-top: 18px; }
.month { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.month .col-bar { width: 100%; max-width: 56px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 3px; }
.month .val { font-size: 11px; font-weight: 600; white-space: nowrap; }
.month .lbl { font-size: 12px; color: var(--muted); }

/* ===== Settings ===== */
.brand-grid { display: grid; grid-template-columns: 300px 1fr; gap: 24px; }
.logo-drop {
  border: 2px dashed var(--line-strong); border-radius: 10px; height: 170px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; text-align: center; color: var(--muted); cursor: pointer; padding: 12px; background: #fafbfb;
}
.logo-drop:hover, .logo-drop.over { border-color: var(--primary); background: var(--primary-soft); color: var(--ink); }
.logo-drop img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-drop small { font-size: 12px; }
.row-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.preview-side { background: var(--side); padding: 12px 10px; border-radius: 8px; width: 232px; margin-top: 12px; }
.swatches { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-strong); padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.stage-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.stage-row .grip { width: 24px; height: 24px; border-radius: 50%; background: #eef0f2; display: grid; place-items: center; font-size: 12px; color: var(--muted); flex: none; }
.stage-row .prob { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.stage-row .prob .input { width: 72px; }
.inline-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.data-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== Modal / toast ===== */
.overlay { position: fixed; inset: 0; background: rgba(38,41,44,.5); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 8px; width: 520px; max-width: 100%; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; }
.modal form { display: flex; flex-direction: column; min-height: 0; }
.modal-body { padding: 18px 20px 6px; overflow: auto; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: #fafbfb; border-radius: 0 0 8px 8px; }
.linked { margin: 4px 0 12px; }
.linked a { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--line); }
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: pop .2s ease; }
.toast.error { background: var(--red); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  #sidebar { width: 64px; }
  #sidebar .nav-item span, .brand-logo.default b { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .deal-grid, .charts, .brand-grid { grid-template-columns: 1fr; }
  .uname { display: none; }
  .page { padding: 16px; }
}

/* ===== Início (dashboard) e acabamento arredondado ===== */
.panel, .table-wrap, .kpi, .side-card, .composer, .tl-item, .stat, .banner { border-radius: 14px; }
.card { border-radius: 12px; }
.modal { border-radius: 16px; }
.modal-foot { border-radius: 0 0 16px 16px; }
.btn { border-radius: 8px; }
.input { border-radius: 8px; }
.seg { border-radius: 8px; }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); padding: 20px 24px; margin-bottom: 20px;
}
.banner-l { display: flex; align-items: center; gap: 16px; min-width: 0; }
.banner h1 { font-size: 22px; font-weight: 600; }
.banner p { color: var(--muted); }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.pills { display: flex; flex-wrap: wrap; gap: 4px; background: var(--bg); border-radius: 999px; padding: 4px; }
.pill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid transparent; background: none; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.pill:hover:not(.on) { color: var(--ink); }
.pill.on { background: var(--primary); color: var(--on-primary); }
/* "Personalizado" precisa se destacar das outras opções de período mesmo sem estar selecionado. */
.pill-custom { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.pill-custom:hover:not(.on) { background: var(--primary-soft); color: var(--primary-dark); }
.pill-custom.on { border-color: var(--primary); }
.only-mobile { display: none; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { position: relative; overflow: hidden; background: #fff; border: 1px solid var(--line); padding: 16px 18px 16px 22px; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.stat-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-val { font-size: 24px; font-weight: 600; margin-top: 8px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 0; }
.feed-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.feed-item:first-of-type { border-top: 0; }
.feed-item:hover .feed-body b { color: var(--primary-dark); }
.feed-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.feed-body b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-body span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-item small { color: var(--muted); white-space: nowrap; }

.mini-chart { display: flex; align-items: flex-end; gap: 16px; height: 190px; padding-top: 8px; }
.mini-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.mini-bar { width: 100%; max-width: 72px; border-radius: 8px 8px 0 0; }
.mini-n { font-weight: 600; }
.mini-l { font-size: 12px; color: var(--muted); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .pills, .status-seg { display: none; } .only-mobile { display: block; } }

.two-col > * { min-width: 0; }
.feed-item .chip { flex: none; }

/* ===== Etiqueta de temperatura do lead ===== */
.temp {
  --tc: var(--muted); --tcd: var(--muted);
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-size: 11.5px; font-weight: 600; line-height: 1.5; white-space: nowrap; color: var(--tcd);
  background: color-mix(in srgb, var(--tc) 15%, transparent);
}
.temp::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tc); flex: none; }
.temp.cold { --tc: #3c8cdd; --tcd: #1f63ad; }
.temp.warm { --tc: #eda71d; --tcd: #8a5e00; }
.temp.hot { --tc: #e8452c; --tcd: #b62d18; }
.temp.none { --tc: var(--line-strong); }
.temp-pick { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.temp-pick .temp { cursor: pointer; opacity: .5; }
.temp-pick .temp:hover { opacity: .85; }
.temp-pick .temp.on { opacity: 1; border-color: var(--tc); }
.temp-pick .temp:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.deal-meta .temp { align-self: center; }
.temp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.temp-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.temp-stat b { font-size: 18px; font-weight: 600; }
.temp-stat span:last-child { color: var(--muted); font-size: 13px; }

/* ===== Login, equipe e permissões ===== */
body.authing #app, body.authing .dropzones { display: none; }
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: 0 8px 30px rgba(26,35,34,.08); }
.auth-brand { margin-bottom: 16px; }
.auth-brand .brand-logo { justify-content: flex-start; padding-left: 0; }
.auth-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.auth-card > p { margin-bottom: 18px; }
.auth-msg { min-height: 20px; margin: 4px 0 12px; color: var(--red); font-size: 13px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 14px; }
.btn.block { width: 100%; height: 40px; }

.user-btn { background: none; border: 0; padding: 3px 8px 3px 3px; border-radius: 999px; }
.user-btn:hover { background: var(--bg); }
.menu-head { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.menu-head small { color: var(--muted); word-break: break-all; }
.menu-head .chip { margin-top: 4px; }

.notice { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.invite-form { display: grid; grid-template-columns: 1fr 200px auto; gap: 12px; align-items: end; }
.invite-form .fld { margin: 0; }
.tbl select.input.sm { min-width: 150px; }
.perm.yes { display: inline-flex; color: var(--teal); }
.perm.no { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 700px) { .invite-form { grid-template-columns: 1fr; } }

body.authing #auth-root { height: 100%; }

/* ===== Histórico de ações ===== */
.nowrap { white-space: nowrap; }
.block { display: block; }
.audit-text { max-width: 560px; word-break: break-word; }
.load-more { display: flex; justify-content: center; padding: 16px 0 4px; }
.audit-user { min-width: 190px; }

/* ===== Anexos em notas (arquivo, print e áudio) ===== */
.note-tools { display: flex; align-items: center; gap: 6px; }
.note-tools .icon-btn { width: 32px; height: 32px; justify-content: center; align-items: center; border: 1px solid var(--line-strong); border-radius: 6px; }
.note-tools .icon-btn.recording { background: var(--red); border-color: var(--red); color: #fff; animation: rec-pulse 1.4s ease-in-out infinite; }
.note-tools .btn { margin-left: auto; }
.rec-timer { font-size: 12px; color: var(--red); font-weight: 600; font-variant-numeric: tabular-nums; }
@keyframes rec-pulse { 50% { opacity: .55; } }

.att-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 10px; }
.att { position: relative; }
.att-img { width: 76px; height: 76px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); flex: none; }
.att-img img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.att-audio { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: flex; align-items: center; }
.att-audio audio { height: 32px; max-width: 230px; }
.att-file { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.att-file a, a.att-file { display: flex; align-items: center; gap: 6px; padding: 7px 10px; color: var(--ink); text-decoration: none; max-width: 220px; }
.att-file .att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.att-file .att-size { color: var(--muted); font-size: 11px; white-space: nowrap; }
.att-x {
  position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); color: #fff;
  display: grid; place-items: center; border: 2px solid #fff; padding: 0; flex: none;
}
.att-x:hover { background: var(--red); }

.lightbox-inner { position: relative; max-width: min(92vw, 900px); max-height: 90vh; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lightbox-inner img { max-width: 100%; max-height: 78vh; border-radius: 8px; display: block; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.lightbox-close { position: absolute; top: -42px; right: -4px; color: #fff; }
.lightbox-close:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ===== Filtro de período (Início e Insights) ===== */
.period-filter { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.period-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.period-filter .hint { margin: 0; }
