/* =====================================================
   PORTAL REDE — Projetos & Obras
   Planilha de cotações · Timeline · Dashboard de obra
   ===================================================== */

/* ---------- Planilha de cotações ---------- */

.sheet-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.qsheet {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 100%;
}
.qsheet th, .qsheet td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
  vertical-align: top;
  white-space: nowrap;
}
.qsheet th:last-child, .qsheet td:last-child { border-right: none; }

.qsheet thead .sup-group {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--pine-soft);
  color: var(--pine);
  border-bottom: 1px solid var(--line);
}
.qsheet thead .sup-group .sup-contact {
  display: block;
  font-weight: 500;
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 1px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qsheet thead .sup-group .homolog {
  display: inline-block;
  background: var(--lime);
  color: var(--pine-deep);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  margin-left: 6px;
  vertical-align: 1px;
}
.qsheet thead .base-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-faint);
  background: var(--paper);
  text-align: left;
}

/* Coluna fixa do nome do item */
.qsheet .item-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  min-width: 220px;
  max-width: 280px;
  white-space: normal;
  border-right: 1px solid var(--line-strong);
}
.qsheet thead .item-col { background: var(--paper); z-index: 3; }
.qsheet tbody tr:hover td { background: var(--pine-soft); }
.qsheet tbody tr:hover .item-col { background: var(--pine-soft); }

.item-name { font-weight: 600; font-size: 13.5px; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.item-name .qty {
  background: var(--pine-soft);
  color: var(--pine);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
}
.item-sub { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }

.prio-chip {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.prio-chip.late { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

.istatus {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.istatus.open { background: var(--line-strong); }
.istatus.quoting { background: var(--warn); }
.istatus.decided { background: var(--success); }

/* Célula de cotação */
.qcell { min-width: 168px; }
.qcell-filled {
  display: block;
  text-decoration: none;
  cursor: pointer;
}
.qcell .qprice { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.qcell .qpay { font-size: 11.5px; color: var(--ink-soft); }
.qcell .qnotes {
  font-size: 11.5px;
  color: var(--ink-faint);
  white-space: normal;
  max-width: 220px;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.qcell .chosen-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--success);
  background: var(--success-soft);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  margin-bottom: 3px;
}
.qcell-empty {
  color: var(--ink-faint);
  font-size: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  display: inline-block;
  cursor: pointer;
  transition: border-color .15s var(--ease), color .15s var(--ease);
}
.qcell-empty:hover { border-color: var(--pine); color: var(--pine); }

/* Popover de cotação: modal centrado (não é cortado pelo scroll da tabela) */
.qpop summary { list-style: none; cursor: pointer; }
.qpop summary::-webkit-details-marker { display: none; }

.qpop[open] > .qpop-backdrop {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(13, 27, 20, .45);
  animation: flash-in .2s var(--ease);
}
.qpop[open] > .qpop-body {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 96;
  width: min(380px, calc(100vw - 32px));
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 18px;
  white-space: normal;
  animation: card-rise .25s var(--ease);
}
.qpop-body h5 {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 14px;
  margin: 0 0 14px;
}
.qpop-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .15s var(--ease), color .15s var(--ease);
}
.qpop-close:hover { border-color: var(--danger); color: var(--danger); }
.qpop-body .field { margin-bottom: 10px; }
.qpop-body label { font-size: 12px; }

.qdelivery { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; display: block; }
.qdelivery.late { color: var(--danger); font-weight: 700; }

/* ---------- Cards de cotação por item ---------- */

.qcell-list { white-space: normal; width: 100%; }
.qcards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}
.qcard {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-width: 210px;
  max-width: 280px;
  transition: border-color .15s var(--ease);
}
.qcard:hover { border-color: var(--pine); }
.qcard.chosen { border-color: var(--success); background: var(--success-soft); }
.qcard > summary { display: block; padding: 9px 12px; }
.qcard .qc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.qcard .qc-sup { font-weight: 700; font-size: 12.5px; color: var(--ink); }
.qcard .qc-sup .homolog {
  display: inline-block;
  background: var(--lime);
  color: var(--pine-deep);
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  margin-left: 4px;
  vertical-align: 1px;
}
.qcard .qc-price { display: block; font-size: 13.5px; font-weight: 700; }
.qcard .qc-price small { font-weight: 500; color: var(--ink-soft); }
.qcard .qnotes { display: block; }

/* ---------- Banner de risco da inauguração ---------- */

.risk-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 14px;
  margin-bottom: 16px;
  color: var(--ink);
}
.risk-banner .grow { flex: 1; min-width: 260px; line-height: 1.6; }
.risk-banner strong { color: var(--danger); }
.risk-banner .grow strong:not(:first-child) { color: var(--ink); }
.risk-adjust { display: flex; gap: 8px; align-items: center; }
.risk-adjust .input { width: auto; padding: 8px 12px; }

/* ---------- Cabeçalho do projeto ---------- */

.proj-meta {
  display: flex;
  gap: 22px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--ink-soft);
}
.proj-meta strong { color: var(--ink); }
.countdown {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--lime-soft);
  border: 1px solid var(--lime);
  color: var(--pine-deep);
  font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  font-size: 13.5px;
}
.countdown.late { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

/* ---------- Linha do tempo ---------- */

.tl {
  position: relative;
  padding-left: 26px;
}
.tl::before {
  content: "";
  position: absolute;
  left: 8px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--line);
  border-radius: 2px;
}
.tl-item { position: relative; padding: 0 0 22px; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -24px; top: 5px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--lime);
  border: 2px solid var(--pine);
}
.tl-meta { font-size: 12px; color: var(--ink-faint); margin-bottom: 3px; }
.tl-meta .tl-item-tag {
  background: var(--pine-soft);
  color: var(--pine);
  font-weight: 600;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  margin-right: 6px;
}
.tl-body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 16px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
}

/* ---------- Dashboard do projeto ---------- */

.proj-projection {
  background: var(--pine-deep);
  border-radius: var(--radius);
  color: #fff;
  padding: 24px 28px;
  margin-bottom: 16px;
}
.proj-projection .pp-head {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.55);
  margin-bottom: 8px;
}
.proj-projection .pp-line {
  font-family: var(--font-display);
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -0.01em;
}
.proj-projection .pp-line em { font-style: normal; color: var(--lime); }

.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 150px;
  padding-top: 8px;
}
.mini-bars .mb {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  height: 100%;
}
.mini-bars .mb i {
  display: block;
  width: 70%;
  max-width: 30px;
  background: var(--pine);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}
.mini-bars .mb:first-child i { background: var(--lime); }
.mini-bars .mb span { font-size: 10.5px; color: var(--ink-faint); }

.late-list .list-row .t { color: var(--danger); }
