/* ============================================================
   APP — Painel interno (colaboradores)
   ============================================================ */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------------------------------------- */
.sidebar {
  background: var(--ink-900);
  color: var(--tx-on-dark);
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
  /* Rola internamente quando o conteúdo não cabe na janela (telas baixas/zoom),
     em vez de o rodapé transbordar para fora da barra sobre a página. */
  overflow-y: auto; overscroll-behavior: contain;
  border-right: 1px solid var(--ink-700);
}
.sidebar__brand {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 10px 20px;
}
.sidebar__brand img { height: 34px; width: auto; max-width: 100%; }
.sidebar__brand .brand-name {
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
  letter-spacing: -.01em; line-height: 1;
}
.sidebar__brand .brand-sub {
  font-size: 10.5px; color: var(--tx-on-dark-mut); letter-spacing: .06em;
  text-transform: uppercase; margin-top: 3px;
}
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav__label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--tx-on-dark-mut); padding: 14px 12px 6px; font-weight: 700;
}
.nav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: var(--r-sm);
  color: var(--tx-on-dark-mut); font-weight: 600; font-size: 14.5px;
  transition: background var(--dur-fast), color var(--dur-fast);
  width: 100%; text-align: left;
}
.nav__item[hidden] { display: none; }
.nav__item svg { width: 19px; height: 19px; flex: none; }
.nav__item:hover { background: rgba(255,255,255,.05); color: var(--tx-on-dark); }
.nav__item.is-active {
  background: var(--orange-soft); color: var(--orange);
  box-shadow: inset 2px 0 0 var(--orange);
}
.sidebar__foot {
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--ink-700);
  font-size: 11.5px; color: var(--tx-on-dark-mut);
}
.sidebar__user {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 12px;
}
.sidebar__user-nome {
  color: var(--tx-on-dark); font-weight: 700; font-size: 13px; line-height: 1.25;
}
.sidebar__user-depto {
  color: var(--tx-on-dark-mut); font-size: 11.5px;
}
.btn--logout {
  margin-top: 12px; width: 100%; justify-content: center; gap: 8px;
  color: var(--tx-on-dark); background: rgba(255,255,255,.05);
  border: 1px solid var(--ink-600);
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.btn--logout:hover {
  background: color-mix(in srgb, var(--c-danger) 16%, transparent);
  border-color: var(--c-danger); color: #ff8f6b;
}
.btn--logout svg { flex: none; }

/* ---------- Área principal -------------------------------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 32px;
  background: color-mix(in srgb, var(--c-bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--c-border);
}
.topbar h1 { font-size: 20px; }
.topbar__sub { font-size: 13px; color: var(--c-text-mute); margin-top: 2px; }
.topbar__spacer { flex: 1; }

.view { padding: 28px 32px 60px; max-width: var(--maxw); width: 100%; }
.view[hidden] { display: none; }

.section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 700; color: var(--c-text);
  margin: 4px 0 14px;
}
.section-title .count {
  font-size: 12px; color: var(--c-text-mute); font-weight: 600;
}

/* ---------- KPIs ------------------------------------------ */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-bottom: 26px;
}
.kpi {
  padding: 18px 20px; position: relative; overflow: hidden;
}
.kpi__label { font-size: 12.5px; color: var(--c-text-mute); font-weight: 600; }
.kpi__value {
  font-family: var(--font-display); font-size: 27px; font-weight: 700;
  letter-spacing: -.02em; margin-top: 6px; line-height: 1.1;
}
.kpi__hint { font-size: 12px; color: var(--c-text-soft); margin-top: 4px; }
.kpi__spark { position: absolute; right: 14px; top: 14px; opacity: .9; }
.kpi--accent { background: var(--ink-900); color: var(--tx-on-dark); border-color: transparent; }
.kpi--accent .kpi__label,
.kpi--accent .kpi__hint { color: var(--tx-on-dark-mut); }
.kpi--accent .kpi__value { color: #fff; }
.kpi--accent::after {
  content: ""; position: absolute; inset: auto -40px -60px auto;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, var(--orange-glow), transparent 70%);
}

/* ---------- Tabela ---------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
table.data {
  width: 100%; border-collapse: collapse; background: var(--c-surface);
  font-size: 14px;
}
table.data th {
  text-align: left; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--c-text-mute); font-weight: 700;
  padding: 13px 16px; border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
table.data td {
  padding: 14px 16px; border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
table.data tbody tr { transition: background var(--dur-fast); }
table.data tbody tr:hover { background: var(--c-surface-2); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tfoot td {
  padding: 12px 16px; border-top: 1px solid var(--c-border);
  background: var(--c-surface-2); font-size: 13.5px;
}
table.data tfoot tr:not(:last-child) td { border-bottom: none; }
.td-num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 13.5px; }
.td-strong { font-weight: 650; color: var(--c-text); }
.cell-main { display: flex; flex-direction: column; gap: 2px; }
.cell-main small { color: var(--c-text-mute); font-size: 12px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }

/* Tabela densa (ex.: Base de Cálculo): colunas bem justas para caber sem rolagem. */
table.data.data--tight { font-size: 12.5px; }
table.data.data--tight th,
table.data.data--tight td { padding: 11px 6px; white-space: nowrap; }
table.data.data--tight th { font-size: 10px; letter-spacing: .03em; }
table.data.data--tight th:first-child,
table.data.data--tight td:first-child { padding-left: 14px; }
table.data.data--tight th:last-child,
table.data.data--tight td:last-child { padding-right: 14px; }
table.data.data--tight .td-num { font-size: 11.5px; }
table.data.data--tight .cell-main small { font-size: 11px; }
/* Chip de situação em uma linha, compacto. */
table.data.data--tight .badge { white-space: nowrap; font-size: 11px; padding: 3px 7px; }
table.data.data--tight .row-actions { gap: 4px; }

/* ---------- Propostas: botões de situação ------------------ */
.status-proposta .btn--icon { transition: transform var(--dur-fast), opacity var(--dur-fast), box-shadow var(--dur-fast); }
/* Realce do ícone dentro do círculo: traço mais grosso e um pouco maior. */
.status-proposta .btn--icon svg { width: 17px; height: 17px; stroke-width: 2.8; }
.status-proposta .btn--icon[aria-pressed="true"] { box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.status-proposta .btn--icon[aria-pressed="true"] svg {
  stroke-width: 3.1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.28));
}
.status-proposta .btn--icon:hover { transform: translateY(-1px); }
.status-proposta .btn--icon:not([aria-pressed="true"]):hover { opacity: .85 !important; }

/* ---------- Painel do Comercial: cartões e gráficos --------
   Segue a linguagem de marca Contamac: fundo papel, laranja da
   marca com degradê + brilho (orange-glow), tipografia display
   nos números e raios/sombras dos tokens. */
.stat-tile { position: relative; overflow: hidden; border-top: 3px solid var(--tile); transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast); }
.stat-tile:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }
.stat-tile__top { display: flex; align-items: center; gap: 9px; margin-bottom: 2px; }
.stat-tile__ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  color: var(--tile); background: color-mix(in srgb, var(--tile) 15%, transparent);
}
.stat-tile__ico svg { width: 15px; height: 15px; }
.stat-tile .kpi__value { color: var(--tile); font-family: var(--font-display); }
.stat-tile::after {
  content: ""; position: absolute; inset: auto -36px -52px auto;
  width: 130px; height: 130px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--tile) 24%, transparent), transparent 70%);
}

.chart-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px; margin-top: 8px;
}
.chart-card { padding: 22px 24px; transition: box-shadow var(--dur-fast); }
.chart-card:hover { box-shadow: var(--sh-md); }
.chart-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }

.donut-wrap { flex-shrink: 0; filter: drop-shadow(0 6px 16px rgba(12,12,14,.10)); }
.donut { width: 156px; height: 156px; }
.donut circle { transition: stroke-dasharray var(--dur-med, .3s) ease; }
.donut__big, .donut__small { text-anchor: middle; }
.donut__big { font-size: 5px; font-weight: 700; fill: var(--c-text); font-family: var(--font-display); letter-spacing: -.02em; }
.donut__small { font-size: 2.6px; fill: var(--c-text-mute); text-transform: uppercase; letter-spacing: .08em; }

.chart-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; flex: 1; min-width: 170px; }
.chart-legend__item { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.chart-legend__dot { width: 11px; height: 11px; border-radius: 4px; flex-shrink: 0; }
.chart-legend__lbl { color: var(--c-text-soft); }
.chart-legend__val { margin-left: auto; font-weight: 650; color: var(--c-text); font-variant-numeric: tabular-nums; }

.bars { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.bars__row { display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 12px; }
.bars__lbl { font-size: 12.5px; color: var(--c-text-soft); }
.bars__track { height: 13px; background: var(--c-surface-2); border-radius: var(--r-pill); overflow: hidden; }
.bars__fill {
  height: 100%; min-width: 3px; border-radius: var(--r-pill);
  background: linear-gradient(120deg, var(--orange), var(--orange-700));
  box-shadow: 0 2px 10px -3px var(--orange-glow);
  transition: width var(--dur-med, .3s) ease;
}
.bars__val { font-size: 12.5px; font-weight: 650; color: var(--c-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 560px) {
  .bars__row { grid-template-columns: 1fr auto; }
  .bars__lbl { grid-column: 1 / -1; }
}

/* ---------- Grid de serviços (cards) ---------------------- */
.svc-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.svc-card {
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast);
  cursor: default;
}
.svc-card:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }
.svc-card__top { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.svc-card h3 { font-size: 16px; }
.svc-card .cat { font-size: 11.5px; }
.svc-card p { font-size: 13px; color: var(--c-text-soft); line-height: 1.45; }
.svc-card__foot {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--c-border);
}
.svc-card__price {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
}
.svc-card__price small { font-size: 12px; color: var(--c-text-mute); font-weight: 600; }

/* ---------- Toolbar de ações ------------------------------ */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .search {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 180px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-pill); padding: 8px 15px;
}
.toolbar .search input { border: none; background: none; width: 100%; outline: none; }
.toolbar .search svg { color: var(--c-text-mute); flex: none; }

/* ---------- Empty state ----------------------------------- */
.empty {
  text-align: center; padding: 56px 20px; color: var(--c-text-mute);
}
.empty svg { margin: 0 auto 14px; opacity: .5; }
.empty h3 { color: var(--c-text-soft); font-size: 16px; margin-bottom: 6px; }

/* ---------- Modal ----------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(12,12,14,.5); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity var(--dur);
}
.modal-backdrop.is-open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--c-surface); border-radius: var(--r-xl);
  width: min(620px, 100%); max-height: 90vh; overflow: auto;
  box-shadow: var(--sh-lg);
  transform: translateY(16px) scale(.98);
  transition: transform var(--dur) var(--ease);
}
.modal-backdrop.is-open .modal { transform: none; }
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; background: var(--c-surface); z-index: 2;
}
.modal__head h2 { font-size: 18px; }
.modal__body { padding: 22px 24px; display: grid; gap: 16px; }
.modal__foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px; border-top: 1px solid var(--c-border);
  position: sticky; bottom: 0; background: var(--c-surface);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .col-2 { grid-column: 1 / -1; }
.field .req { color: var(--c-danger, #d6453b); font-weight: 700; }
.form-subhead {
  margin: 10px 0 0; padding-top: 14px; border-top: 1px solid var(--c-border, rgba(0,0,0,.1));
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--brand-accent, #e5a000);
}

/* ---------- Horas por empresa ----------------------------- */
.horas-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px;
}
.hcard { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.hcard__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hcard__name { font-size: 16px; font-weight: 700; color: var(--c-text); line-height: 1.25; }
.hcard__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.hcard__hours { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; flex-shrink: 0; }
.hcard__hours-v { font-size: 28px; font-weight: 800; color: var(--brand-accent, #e5a000); font-family: var(--font-mono, monospace); }
.hcard__hours-u { font-size: 11px; font-weight: 600; color: var(--c-text-mute); text-transform: uppercase; letter-spacing: .04em; }
.hcard__body { display: grid; gap: 7px; }
.hc-info { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.hc-info__k { color: var(--c-text-mute); }
.hc-info__v { color: var(--c-text); font-weight: 600; text-align: right; word-break: break-word; }
.hcard__vol { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; border-top: 1px solid var(--c-border); }
.hcard__vol .chip {
  display: inline-flex; align-items: baseline; gap: 3px; font-size: 12px;
  padding: 3px 9px; border-radius: 999px; background: var(--c-surface-2, rgba(0,0,0,.04));
  color: var(--c-text-mute); border: 1px solid var(--c-border);
}
.hcard__vol .chip strong { color: var(--c-text); font-weight: 700; }
.hcard__foot {
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.hcard__areas { display: flex; flex-wrap: wrap; gap: 6px; }
.area-sub {
  display: inline-flex; align-items: baseline; gap: 5px; font-size: 12px;
  padding: 4px 10px; border-radius: 8px; background: var(--c-surface-2, rgba(0,0,0,.04));
  border: 1px solid var(--c-border);
}
.area-sub__k { color: var(--c-text-mute); }
.area-sub__v { color: var(--c-text); font-weight: 700; }

/* Horas: grid de cards de empresa que expandem ao clicar */
.horas-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px; align-items: start;
}
.empcard { padding: 0; overflow: hidden; }
.empcard.is-open { grid-column: 1 / -1; }
.empcard__head {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer; color: inherit;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 8px;
}
.empcard__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.empcard__title { font-size: 16px; font-weight: 700; color: var(--c-text); line-height: 1.25; }
.empcard__chev { color: var(--c-text-mute); flex-shrink: 0; transition: transform var(--dur, .2s); }
.empcard.is-open .empcard__chev { transform: rotate(180deg); }
.empcard__sub { font-size: 12.5px; color: var(--c-text-mute); }
.empcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.empcard__contact { font-size: 12.5px; color: var(--c-text-mute); text-align: right; }
.empcard__body { display: none; padding: 0 18px 18px; }
.empcard.is-open .empcard__body { display: block; }
.hdep { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--c-border); }
.hdep__label { font-size: 13px; font-weight: 700; color: var(--brand-accent, #e5a000); margin-bottom: 8px; }
.hdep__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Horas: bloco por empresa + cards colapsáveis (Contábil, Pessoal, Fiscal) */
.horas-empresas { display: flex; flex-direction: column; gap: 26px; }
.emp-bloco { display: flex; flex-direction: column; gap: 12px; }
.emp-bloco__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.emp-bloco__name { font-size: 18px; font-weight: 700; color: var(--c-text); }
.emp-bloco__right { display: flex; align-items: center; gap: 8px; }
.emp-bloco__foot { display: flex; justify-content: flex-end; }
.modal--wide { width: min(760px, 100%); }
.horas-grupos { display: flex; flex-direction: column; gap: 12px; }
.hgrupo { padding: 0; overflow: hidden; }
.hgrupo__head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 15px 18px; background: none; border: 0; cursor: pointer; text-align: left; color: inherit;
}
.hgrupo__title { font-size: 15px; font-weight: 700; color: var(--brand-accent, #e5a000); }
.hgrupo__right { display: flex; align-items: center; gap: 10px; }
.hgrupo__chev { display: inline-flex; color: var(--c-text-mute); transition: transform var(--dur, .2s); }
.hgrupo.is-open .hgrupo__chev { transform: rotate(180deg); }
.hgrupo__body { display: none; padding: 0 18px 18px; }
.hgrupo.is-open .hgrupo__body { display: block; }

.vol-ro {
  border: 1px solid var(--c-border); border-radius: var(--r-md, 10px);
  background: var(--c-surface-2, rgba(0,0,0,.025)); padding: 14px 16px; margin-bottom: 16px;
}
.vol-ro__title {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--c-text-mute); margin-bottom: 12px;
}
.vol-ro__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.vol-ro__item { display: flex; flex-direction: column; gap: 2px; }
.vol-ro__k { font-size: 11.5px; color: var(--c-text-mute); line-height: 1.3; }
.vol-ro__v { font-size: 15px; font-weight: 700; color: var(--c-text); }

.hgrupo__horas-title {
  font-size: 12px; font-weight: 700; color: var(--c-text); margin-bottom: 8px;
}
.hgrupo__foot { display: flex; margin-top: 4px; }
.horas-edit td { padding: 5px 5px; vertical-align: middle; }
.horas-edit th { padding: 0 5px 6px; }
.horas-edit .input { padding: 7px 9px; font-size: 13px; }

@media (max-width: 560px) {
  .vol-ro__grid { grid-template-columns: 1fr; }
}

/* ---------- Toast ----------------------------------------- */
.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--ink-900); color: #fff; padding: 13px 18px;
  border-radius: var(--r-md); box-shadow: var(--sh-lg);
  font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 10px;
  transform: translateX(120%); transition: transform var(--dur) var(--ease);
}
.toast.is-show { transform: none; }
.toast--ok { border-left: 3px solid var(--c-success); }
.toast--err { border-left: 3px solid var(--c-danger); }

/* ---------- Construtor de proposta ------------------------ */
.builder { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.builder__pick { display: flex; flex-direction: column; gap: 12px; }
.pick-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: var(--c-surface); transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.pick-item.is-on { border-color: var(--orange); box-shadow: var(--sh-ring); }
.pick-item__check {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--c-border);
  display: grid; place-items: center; flex: none; transition: all var(--dur-fast);
  color: #fff;
}
.pick-item.is-on .pick-item__check { background: var(--orange); border-color: var(--orange); }
.pick-item__info { flex: 1; min-width: 0; }
.pick-item__info h4 { font-size: 14.5px; font-family: var(--font-sans); font-weight: 650; }
.pick-item__info small { color: var(--c-text-mute); font-size: 12.5px; }
.pick-item__qtd { width: 64px; }
.pick-item__qtd input { text-align: center; padding: 7px; }
.pick-item__price { font-family: var(--font-mono); font-size: 13.5px; font-weight: 600; white-space: nowrap; }

.summary { position: sticky; top: 90px; padding: 20px; }
/* Coluna que agrupa a(s) tabela(s) de preço; a sticky passa a ser dela */
.summary-col { position: sticky; top: 90px; }
.summary-col .summary { position: static; top: auto; }
.summary--alt { border: 1px solid var(--orange); }
/* Tabela ajustada empilhada (modo coluna única) ganha respiro no topo */
.summary-col:not(.summary-col--dual) .summary--alt { margin-top: 18px; }

/* Modo comparação: duas tabelas lado a lado ocupando a largura toda */
.builder--dual { grid-template-columns: 1fr; }
.builder--dual .summary-col { position: static; top: auto; }
.summary-col--dual {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start;
}
@media (max-width: 820px) {
  .summary-col--dual { grid-template-columns: 1fr; }
  .summary-col:not(.summary-col--dual) .summary--alt,
  .summary-col--dual .summary--alt { margin-top: 0; }
}
.summary h3 { font-size: 15px; margin-bottom: 14px; }
.summary__line {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 9px 0; font-size: 14px; border-bottom: 1px dashed var(--c-border);
}
.summary__line span:last-child { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.summary .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Cabeçalho da tabela ajustada (título + botão fechar) */
.summary__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.summary__head h3 { margin: 0; }
.summary__close {
  width: 26px; height: 26px; border-radius: 7px; font-size: 20px; line-height: 1;
  color: var(--c-text-mute); display: grid; place-items: center;
  border: 1px solid var(--c-border); background: transparent; transition: all var(--dur-fast, .15s);
}
.summary__close:hover { color: var(--c-danger); border-color: var(--c-danger); }

/* Lado direito da linha de margem fixa: valor + botão "+" */
.summary__mright { display: inline-flex; align-items: center; gap: 10px; }
.summary__add {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--orange); color: #fff; font-size: 18px; font-weight: 700; line-height: 1;
  display: grid; place-items: center; box-shadow: 0 2px 8px var(--orange-glow);
  transition: transform var(--dur-fast, .15s), background var(--dur-fast, .15s);
}
.summary__add:hover { background: var(--orange-600); transform: scale(1.08); }

/* Margem editável (input em %) na tabela ajustada */
.summary__pct-wrap { display: inline-flex; align-items: baseline; gap: 2px; }
.summary__pct {
  width: 58px; padding: 2px 6px; margin: 0 2px; text-align: right;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px;
  border-radius: 6px; -moz-appearance: textfield;
}
.summary__pct::-webkit-outer-spin-button,
.summary__pct::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Valor da margem editável (R$) na tabela ajustada */
.summary__val-wrap { display: inline-flex; align-items: baseline; gap: 2px; font-family: var(--font-mono); }
.summary__val {
  width: 90px; padding: 2px 6px; text-align: right;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px;
  border-radius: 6px; -moz-appearance: textfield;
}
.summary__val::-webkit-outer-spin-button,
.summary__val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Linha de diferença (fixo × ajustado) */
.summary__diff {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 10px; font-size: 13.5px; font-weight: 600;
}
.summary__diff span:last-child { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.summary__diff span:first-child { color: var(--c-text-mute); }
/* Diferença do valor da margem (original × ajustada), ao lado do valor */
.summary__mdiff { font-size: 12px; font-weight: 600; white-space: nowrap; }
.summary__total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 14px; padding-top: 14px; border-top: 2px solid var(--ink-900);
}
.summary__total .lbl { font-weight: 700; }
.summary__total .val { font-family: var(--font-display); font-size: 26px; font-weight: 700; }

/* Mensalidade editável (valor final) na tabela ajustada */
.summary__total-wrap {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-family: var(--font-display); font-size: 26px; font-weight: 700;
}
.summary__total-input {
  width: 150px; padding: 2px 8px; text-align: right;
  font-family: var(--font-display); font-size: 26px; font-weight: 700;
  font-variant-numeric: tabular-nums; border-radius: 8px; -moz-appearance: textfield;
}
.summary__total-input::-webkit-outer-spin-button,
.summary__total-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Responsivo ------------------------------------ */
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 90; width: var(--sidebar-w); transform: translateX(-100%);
    transition: transform var(--dur) var(--ease);
  }
  .sidebar.is-open { transform: none; box-shadow: var(--sh-lg); }
  .menu-toggle { display: inline-flex; }
  .view, .topbar { padding-left: 18px; padding-right: 18px; }
  .builder { grid-template-columns: 1fr; }
  .summary { position: static; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   ACOMPANHAMENTO — lista de empresas + fluxo do processo
   ============================================================ */

/* ---- Cores por etapa (mesmas do fluxograma) ---- */
.flux-node[data-area="comercial"], .tl-av[data-area="comercial"] { --area: var(--orange); }
.flux-node[data-area="horas"],     .tl-av[data-area="horas"]     { --area: #a85a16; }
.flux-node[data-area="aprov"],     .tl-av[data-area="aprov"]     { --area: #2e73c4; }
.flux-node[data-area="cadastro"],  .tl-av[data-area="cadastro"]  { --area: #1f9d57; }
.flux-node[data-area="base"],      .tl-av[data-area="base"]      { --area: #8a4f8f; }
.flux-node[data-area="proposta"],  .tl-av[data-area="proposta"]  { --area: var(--orange-700); }

/* ---- Lista de empresas ---- */
.acomp-list { display: flex; flex-direction: column; gap: 10px; }
.acomp-row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-md); padding: 14px 16px; cursor: pointer;
  font-family: var(--font-sans); color: var(--c-text);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.acomp-row:hover { transform: translateY(-2px); border-color: var(--orange); box-shadow: var(--sh-md); }
.acomp-row.is-done { opacity: .82; }
.acomp-row__dot { width: 11px; height: 11px; border-radius: 50%; flex: none; background: var(--c-text-mute); }
.dot--ok   { background: var(--c-success); }
.dot--accent { background: var(--orange); }
.dot--warn { background: var(--c-warning); }
.dot--err  { background: var(--c-danger); }
.acomp-row__main { min-width: 0; flex: 1 1 auto; }
.acomp-row__nome { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.acomp-row__sub { font-size: 12px; color: var(--c-text-mute); margin-top: 2px; }
.acomp-row__status { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.acomp-row__etapa { font-weight: 600; font-size: 13.5px; }
.acomp-row__tempo { font-size: 12px; font-weight: 600; }
.t--ok  { color: var(--c-success); }
.t--accent { color: var(--orange-700); }
.t--warn { color: var(--c-warning); }
.t--err { color: var(--c-danger); }
.t--mut { color: var(--c-text-mute); }
.t--info { color: #2e73c4; }
.acomp-row__chev { color: var(--c-text-mute); flex: none; display: inline-flex; }

/* ---- Cabeçalho do detalhe ---- */
.acomp-detalhe-top { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.acomp-detalhe-head h2 { font-family: var(--font-display); font-size: 20px; margin: 0; letter-spacing: -.01em; }
.acomp-detalhe-head .muted { font-size: 13px; color: var(--c-text-mute); }
.btn--sm { padding: 7px 13px; font-size: 13px; }

/* ---- Faixa horizontal de etapas (estilo n8n) ---- */
.flux-scroll {
  overflow-x: auto; padding: 8px 4px 18px; margin-bottom: 24px;
  background-image: radial-gradient(var(--c-border) 1.3px, transparent 1.3px);
  background-size: 22px 22px; border-radius: var(--r-md);
}
/* Fluido: os nós dividem a largura disponível (preenchem a tela). Só rola na
   horizontal quando a tela fica estreita demais para o piso de cada nó. */
.flux { display: flex; align-items: flex-start; width: 100%; min-width: 100%; }
.flux-conn {
  flex: 0 1 46px; min-width: 12px; height: 3px; border-radius: 3px; margin-top: 46px;
  background: var(--c-border);
}
.flux-conn.is-done { background: var(--orange); }
.flux-node {
  position: relative; flex: 1 1 0; min-width: 150px; max-width: 260px;
  background: var(--c-surface); border: 1.5px solid var(--c-border);
  border-radius: var(--r-lg); padding: 16px; box-shadow: var(--sh-sm);
}
.flux-node.is-done { border-color: color-mix(in srgb, var(--area) 55%, transparent); }
.flux-node.is-atual {
  border-color: var(--orange);
  box-shadow: 0 0 0 4px var(--orange-soft), var(--sh-md);
}
.flux-node.is-pendente { opacity: .62; }
.flux-node__badge {
  position: absolute; top: -10px; right: -8px; width: 26px; height: 26px;
  border-radius: 50%; display: grid; place-items: center; color: #fff;
}
.flux-node__badge svg { width: 15px; height: 15px; }
.flux-node.is-done .flux-node__badge { background: var(--c-success); }
.flux-node.is-atual .flux-node__badge { background: var(--orange); }
.flux-node__head { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.flux-node__icon {
  width: 38px; height: 38px; flex: none; border-radius: 11px; color: #fff;
  display: grid; place-items: center; background: var(--area, var(--c-text-mute));
}
.flux-node.is-pendente .flux-node__icon { background: var(--c-text-mute); }
.flux-node__icon svg { width: 20px; height: 20px; }
.flux-node__kicker { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--c-text-mute); }
.flux-node__title { font-family: var(--font-display); font-weight: 700; font-size: 14.5px; line-height: 1.15; margin: 1px 0 0; }
.flux-node__time { display: flex; flex-direction: column; gap: 5px; }
.flux-tag {
  font-size: 11.5px; font-weight: 600; color: var(--c-text-soft);
  background: var(--c-surface-2); border-radius: var(--r-pill);
  padding: 3px 10px; align-self: flex-start;
}

/* ---- Etapa clicável no Acompanhamento ---- */
.flux-node--click { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.flux-node--click:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.flux-node--click:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.flux-node.is-selected {
  border-color: var(--orange);
  box-shadow: 0 0 0 4px var(--orange-soft), var(--sh-md);
}
.acomp-etapa-detalhe { margin-top: 22px; }
.acomp-dica {
  padding: 20px; text-align: center; font-size: 13.5px;
  background: var(--c-surface-2); border: 1px dashed var(--c-border);
  border-radius: var(--r-lg);
}

/* ---- Linha do tempo detalhada ---- */
.acomp-timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 14px; }
.tl-marker { display: flex; flex-direction: column; align-items: center; flex: none; width: 16px; }
.tl-dot { width: 13px; height: 13px; border-radius: 50%; margin-top: 4px; background: var(--c-text-mute); border: 2px solid var(--c-surface); box-shadow: 0 0 0 2px var(--c-border); }
.tl-item.is-done .tl-dot  { background: var(--c-success); box-shadow: 0 0 0 2px var(--c-success); }
.tl-item.is-atual .tl-dot { background: var(--orange); box-shadow: 0 0 0 2px var(--orange); }
.tl-marker::after { content: ""; flex: 1; width: 2px; background: var(--c-border); margin: 4px 0; }
.tl-item:last-child .tl-marker::after { display: none; }
.tl-body { flex: 1 1 auto; padding-bottom: 20px; min-width: 0; }
.tl-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tl-head h4 { font-family: var(--font-display); font-size: 14.5px; margin: 0; }
.tl-resumo { font-size: 12.5px; font-weight: 600; }
.tl-pessoas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tl-pessoa { display: flex; align-items: center; gap: 9px; background: var(--c-surface-2); border-radius: var(--r-pill); padding: 4px 13px 4px 4px; }
.tl-av { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 11px; background: var(--area, var(--c-text-mute)); }
.tl-pessoa__meta { display: flex; flex-direction: column; line-height: 1.2; }
.tl-pessoa__nome { font-size: 13px; font-weight: 600; }
.tl-pessoa__tags { display: flex; align-items: center; gap: 6px; margin-top: 1px; }
.tl-depto { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--c-text-mute); }
.tl-est { font-size: 11px; font-weight: 700; }

@media (max-width: 640px) {
  .acomp-row__sub { display: none; }
  .tl-head { gap: 4px; }
}
