/* ============================================================
   PRECIFIKA — CRONOGRAMA DE OBRA INTEGRADO
   css/schedule.css — v4.0 — Julho 2026
   ============================================================ */

/* ── Variáveis ────────────────────────────────────────────── */
:root {
  --sch-blue     : #1d4ed8;
  --sch-blue-lt  : #eff6ff;
  --sch-blue-mid : #3b82f6;
  --sch-green    : #16a34a;
  --sch-green-lt : #f0fdf4;
  --sch-red      : #dc2626;
  --sch-red-lt   : #fef2f2;
  --sch-amber    : #d97706;
  --sch-amber-lt : #fffbeb;
  --sch-gray-50  : #f8fafc;
  --sch-gray-100 : #f1f5f9;
  --sch-gray-200 : #e2e8f0;
  --sch-gray-300 : #cbd5e1;
  --sch-gray-500 : #64748b;
  --sch-gray-700 : #334155;
  --sch-gray-900 : #0f172a;
  --sch-radius   : 10px;
  --sch-shadow   : 0 1px 4px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.05);
}

/* ── Alerta de Revisão ────────────────────────────────────── */
.sch-revision-alert {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fffbeb;
  border: 1.5px solid #fbbf24;
  border-radius: var(--sch-radius);
  padding: 14px 18px;
  margin: 0 0 16px;
  box-shadow: 0 2px 8px rgba(251,191,36,0.15);
}
.sch-rev-alert-icon { font-size: 22px; flex-shrink: 0; }
.sch-rev-alert-text { flex: 1; font-size: 13.5px; color: var(--sch-gray-700); }
.sch-rev-alert-text strong { display: block; color: var(--sch-amber); margin-bottom: 2px; }
.sch-rev-alert-actions { display: flex; gap: 8px; flex-shrink: 0; }
.sch-btn-rev-update, .sch-btn-rev-dismiss {
  padding: 6px 14px; border-radius: 6px; font-size: 12.5px;
  font-weight: 600; cursor: pointer; border: none;
}
.sch-btn-rev-update  { background: var(--sch-amber); color: white; }
.sch-btn-rev-update:hover { background: #b45309; }
.sch-btn-rev-dismiss { background: white; border: 1px solid var(--sch-gray-300); color: var(--sch-gray-700); }
.sch-btn-rev-dismiss:hover { background: var(--sch-gray-100); }

/* ── Header Tabs de Cronogramas ──────────────────────────── */
#sch-header-tabs {
  display: flex;
  gap: 8px;
  padding: 0 0 16px;
  flex-wrap: wrap;
  overflow-x: auto;
}
.sch-header-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 18px;
  border-radius: var(--sch-radius);
  background: white;
  border: 2px solid var(--sch-gray-200);
  cursor: pointer;
  transition: all 0.15s;
  min-width: 160px;
}
.sch-header-tab:hover { border-color: var(--sch-blue-mid); }
.sch-header-tab.active {
  background: var(--sch-blue-lt);
  border-color: var(--sch-blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.sch-header-tab-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--sch-gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.sch-header-tab-sub {
  font-size: 11.5px;
  color: var(--sch-gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

/* ── Barra da Obra (KPIs topo) ────────────────────────────── */
.sch-obra-bar {
  background: white;
  border: 1px solid var(--sch-gray-200);
  border-radius: var(--sch-radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--sch-shadow);
}
.sch-obra-info {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.sch-obra-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sch-obra-icon { font-size: 26px; }
.sch-obra-name { font-size: 15px; font-weight: 700; color: var(--sch-gray-900); }
.sch-obra-meta { font-size: 12px; color: var(--sch-gray-500); margin-top: 1px; }
.sch-obra-value { display: flex; flex-direction: column; gap: 2px; }
.sch-kpi-lbl  { font-size: 11px; color: var(--sch-gray-500); font-weight: 500; }
.sch-kpi-val-money { font-size: 15px; font-weight: 700; color: var(--sch-blue); }

.sch-obra-kpis {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.sch-obra-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 60px;
}
.sch-obra-kpi-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--sch-gray-700);
  line-height: 1;
}
.sch-obra-kpi-lbl {
  font-size: 10.5px;
  color: var(--sch-gray-500);
  text-align: center;
  white-space: nowrap;
}
.sch-obra-kpi.sch-kpi-danger .sch-obra-kpi-num { color: var(--sch-red); }
.sch-obra-kpi.sch-kpi-warn   .sch-obra-kpi-num { color: var(--sch-amber); }
.sch-obra-kpi.sch-kpi-blue   .sch-obra-kpi-num { color: var(--sch-blue-mid); }
.sch-obra-kpi.sch-kpi-green  .sch-obra-kpi-num { color: var(--sch-green); }

/* Círculo de progresso SVG */
.sch-obra-kpi-circle {
  position: relative;
  width: 50px;
  height: 50px;
}
.sch-obra-kpi-circle svg {
  width: 50px;
  height: 50px;
  transform: rotate(-90deg);
}
.sch-obra-kpi-circle span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--sch-blue);
}

/* ── Botões do módulo ─────────────────────────────────────── */
.sch-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: var(--sch-blue);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.sch-btn-primary:hover  { background: #1e40af; }
.sch-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  background: white;
  color: var(--sch-gray-700);
  border: 1.5px solid var(--sch-gray-300);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.sch-btn-secondary:hover { background: var(--sch-gray-100); border-color: var(--sch-gray-500); }
.sch-btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  background: var(--sch-red-lt);
  color: var(--sch-red);
  border: 1.5px solid #fca5a5;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.sch-btn-danger:hover { background: #fee2e2; }
.sch-btn-icon {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; border: 1px solid var(--sch-gray-200);
  background: white; color: var(--sch-gray-500);
  cursor: pointer; font-size: 12.5px;
  transition: all 0.13s;
}
.sch-btn-icon:hover { background: var(--sch-gray-100); color: var(--sch-gray-900); }
.sch-btn-icon-del:hover { background: var(--sch-red-lt); color: var(--sch-red); border-color: #fca5a5; }

/* ── Status badges ────────────────────────────────────────── */
.sch-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.sch-s-nao  { background: #f1f5f9; color: #475569; }
.sch-s-and  { background: #dbeafe; color: #1d4ed8; }
.sch-s-ok   { background: #dcfce7; color: #16a34a; }
.sch-s-late { background: #fee2e2; color: #dc2626; }
.sch-s-par  { background: #fef9c3; color: #b45309; }

/* ── View switcher ────────────────────────────────────────── */
.sch-view-switcher {
  display: flex;
  gap: 4px;
  background: var(--sch-gray-100);
  border-radius: 8px;
  padding: 3px;
}
.sch-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--sch-gray-500);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.sch-view-btn.active {
  background: white;
  color: var(--sch-blue);
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}
.sch-view-btn:not(.active):hover { color: var(--sch-gray-700); }

/* ── Filtros ──────────────────────────────────────────────── */
.sch-filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.sch-filter-select {
  padding: 8px 12px;
  border: 1.5px solid var(--sch-gray-200);
  border-radius: 8px;
  font-size: 13px;
  color: var(--sch-gray-700);
  background: white;
  min-width: 180px;
  cursor: pointer;
}
.sch-filter-select:focus { outline: none; border-color: var(--sch-blue-mid); }

/* ── Tabela ───────────────────────────────────────────────── */
.sch-table-wrap {
  background: white;
  border-radius: var(--sch-radius);
  border: 1px solid var(--sch-gray-200);
  overflow: auto;
  box-shadow: var(--sch-shadow);
}
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.schedule-table thead tr {
  background: var(--sch-gray-50);
  border-bottom: 2px solid var(--sch-gray-200);
}
.schedule-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--sch-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.schedule-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--sch-gray-100);
  vertical-align: middle;
  color: var(--sch-gray-700);
}
.schedule-table tbody tr:hover td { background: var(--sch-gray-50); }

/* Linha de etapa */
.sch-stage-row td { padding: 0; }
.sch-stage-row-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: linear-gradient(to right, #eff6ff, var(--sch-gray-50));
  border-left: 4px solid var(--sch-blue);
}
.sch-stage-icon { font-size: 14px; }
.sch-stage-name { font-size: 13px; font-weight: 700; color: var(--sch-blue); flex: 1; }
.sch-stage-pct-wrap {
  width: 80px; height: 6px;
  background: var(--sch-gray-200);
  border-radius: 3px;
  overflow: hidden;
}
.sch-stage-pct-bar {
  height: 100%;
  background: var(--sch-blue-mid);
  border-radius: 3px;
  transition: width 0.4s;
}
.sch-stage-pct-lbl { font-size: 11.5px; font-weight: 700; color: var(--sch-blue); min-width: 32px; }

/* Linha de atividade */
.sch-activity-row { background: white; }
.sch-activity-row.sch-row-late { background: #fff8f8; }
.sch-act-name { font-weight: 600; color: var(--sch-gray-900); }
.sch-act-desc { font-size: 11.5px; color: var(--sch-gray-500); margin-top: 2px; }
.sch-td-dates  { font-size: 12px; color: var(--sch-gray-500); white-space: nowrap; }
.sch-td-sep    { color: var(--sch-gray-300); font-size: 10px; }
.sch-td-center { text-align: center; }
.sch-td-pct {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 80px;
}
.sch-pct-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--sch-gray-200);
  border-radius: 3px;
  overflow: hidden;
}
.sch-pct-bar-realized {
  height: 100%;
  background: var(--sch-blue-mid);
  border-radius: 3px;
  transition: width 0.4s;
}
.sch-pct-bar-realized.sch-bar-late { background: var(--sch-red); }
.sch-td-qty  { font-size: 12px; white-space: nowrap; }
.sch-td-money { font-size: 12px; font-weight: 600; white-space: nowrap; }
.sch-td-dep { text-align: center; }
.sch-dep-badge {
  display: inline-block;
  padding: 2px 7px;
  background: #f3e8ff;
  color: #6d28d9;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}
.sch-td-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
}
.sch-empty-row { text-align: center; color: var(--sch-gray-500); padding: 40px !important; }

/* ── Empty state ──────────────────────────────────────────── */
.sch-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--sch-gray-500);
}
.sch-empty-state i { font-size: 36px; opacity: 0.4; }
.sch-empty-state p { font-size: 14px; }
.sch-empty-text { font-size: 13px; color: var(--sch-gray-500); padding: 12px 0; }

/* ═══════════════════════════════════════════════════════════
   GANTT
═══════════════════════════════════════════════════════════ */
#sch-gantt-container {
  background: white;
  border-radius: var(--sch-radius);
  border: 1px solid var(--sch-gray-200);
  overflow: hidden;
  box-shadow: var(--sch-shadow);
}

.gantt-wrapper { width: 100%; }

.gantt-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--sch-gray-50);
  border-bottom: 1px solid var(--sch-gray-200);
  flex-wrap: wrap;
  gap: 10px;
}
.gantt-zoom-btns { display: flex; gap: 4px; }
.gantt-zoom-btn {
  padding: 5px 12px;
  border-radius: 6px;
  background: white;
  border: 1.5px solid var(--sch-gray-200);
  color: var(--sch-gray-500);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.13s;
}
.gantt-zoom-btn.active {
  background: var(--sch-blue);
  color: white;
  border-color: var(--sch-blue);
}
.gantt-zoom-btn:hover:not(.active) { border-color: var(--sch-blue-mid); color: var(--sch-blue); }

.gantt-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--sch-gray-500);
  flex-wrap: wrap;
}
.gantt-leg-box {
  display: inline-block;
  width: 12px; height: 8px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 4px;
}
.gantt-leg-today {
  display: inline-block;
  width: 2px; height: 12px;
  background: #ef4444;
  vertical-align: middle;
  margin-right: 4px;
}

.gantt-scroll-outer {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 320px);
  min-height: 300px;
}
.gantt-inner { min-width: 900px; }

/* Header de datas */
.gantt-header-row {
  display: flex;
  background: var(--sch-gray-50);
  border-bottom: 2px solid var(--sch-gray-200);
  position: sticky;
  top: 0;
  z-index: 10;
}
.gantt-label-col { width: 220px; min-width: 220px; flex-shrink: 0; }
.gantt-label-header {
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--sch-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-right: 1px solid var(--sch-gray-200);
}
.gantt-chart-col { flex: 1; position: relative; overflow: hidden; }
.gantt-chart-header { height: 38px; }
.gantt-date-header { position: relative; height: 100%; }
.gantt-hcell {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--sch-gray-500);
  border-right: 1px solid var(--sch-gray-200);
  white-space: nowrap;
  overflow: hidden;
  padding: 0 4px;
}

/* Linhas verticais de grade */
.gantt-vline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--sch-gray-100);
  pointer-events: none;
}

/* Linha de hoje */
.gantt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  z-index: 5;
  pointer-events: none;
}
.gantt-today-line span {
  position: absolute;
  top: 0;
  left: 4px;
  font-size: 9px;
  font-weight: 700;
  color: #ef4444;
  white-space: nowrap;
}

/* Linhas do Gantt */
.gantt-stage-row {
  border-bottom: 1px solid var(--sch-gray-200);
}
.gantt-stage-row.gantt-stage-collapsed .gantt-activity-row { display: none; }
.gantt-stage-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(to right, #eff6ff, var(--sch-gray-50));
  border-right: 1px solid var(--sch-gray-200);
  cursor: pointer;
}
.gantt-stage-toggle {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none;
  color: var(--sch-blue); cursor: pointer;
  font-size: 11px;
  transition: transform 0.2s;
}
.gantt-stage-collapsed .gantt-stage-toggle { transform: rotate(-90deg); }
.gantt-stage-name { font-size: 13px; font-weight: 700; color: var(--sch-blue); flex: 1; }

.gantt-stage-bar-col { background: var(--sch-gray-50); }
.gantt-stage-span {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 10px;
  background: var(--sch-gray-200);
  border-radius: 5px;
  overflow: hidden;
}
.gantt-stage-span-fill {
  height: 100%;
  background: #93c5fd;
  border-radius: 5px;
  transition: width 0.4s;
}

.gantt-activity-row {
  display: flex;
  border-bottom: 1px solid var(--sch-gray-100);
  transition: background 0.1s;
}
.gantt-activity-row:hover { background: var(--sch-gray-50); }
.gantt-row-late { background: #fff8f8 !important; }

.gantt-activity-label {
  padding: 8px 14px;
  border-right: 1px solid var(--sch-gray-200);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  background: white;
}
.gantt-row-late .gantt-activity-label { background: #fff8f8; }
.gantt-act-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sch-gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}
.gantt-act-meta { display: flex; align-items: center; gap: 6px; }
.gantt-pct-txt  { font-size: 11px; color: var(--sch-gray-500); }
.gantt-badge-sm { font-size: 10px; padding: 1px 6px; }

/* Barra do Gantt */
.gantt-chart-col {
  position: relative;
  height: 48px;
  flex: 1;
}
.gantt-bar-wrap {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 22px;
  cursor: grab;
  z-index: 2;
  transition: opacity 0.15s;
}
.gantt-bar-wrap:active { cursor: grabbing; }
.gantt-bar-bg {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  border: 1.5px solid currentColor;
  overflow: hidden;
  position: relative;
}
.gantt-bar-progress {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 3px;
  opacity: 0.7;
  transition: width 0.4s;
}
.gantt-bar-label {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  white-space: nowrap;
  overflow: hidden;
  max-width: calc(100% - 8px);
  pointer-events: none;
}

/* Seta de dependência */
.gantt-dep-arrow {
  position: absolute;
  top: 50%;
  height: 2px;
  background: #c026d3;
  opacity: 0.5;
  z-index: 1;
  pointer-events: none;
}
.gantt-dep-arrow::after {
  content: '▶';
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8px;
  color: #c026d3;
}

/* Empty state Gantt */
.sch-empty-state-gantt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 64px 32px;
  text-align: center;
  color: var(--sch-gray-500);
}
.sch-empty-state-gantt .sch-empty-icon { font-size: 52px; opacity: 0.45; }
.sch-empty-state-gantt h3 { font-size: 17px; font-weight: 700; color: var(--sch-gray-700); }
.sch-empty-state-gantt p  { font-size: 14px; max-width: 360px; }

/* ═══════════════════════════════════════════════════════════
   KPI DASHBOARD
═══════════════════════════════════════════════════════════ */
.sch-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.sch-kpi-card {
  background: white;
  border-radius: var(--sch-radius);
  border: 1px solid var(--sch-gray-200);
  padding: 18px 16px;
  text-align: center;
  box-shadow: var(--sch-shadow);
}
.sch-kpi-card-icon  { font-size: 22px; margin-bottom: 6px; }
.sch-kpi-card-val   { font-size: 26px; font-weight: 800; line-height: 1; }
.sch-kpi-card-lbl   { font-size: 12px; font-weight: 600; color: var(--sch-gray-500); margin-top: 4px; }
.sch-kpi-card-sub   { font-size: 11.5px; color: var(--sch-gray-400); margin-top: 2px; }
.sch-kpi-card-blue  { border-top: 3px solid var(--sch-blue-mid); }
.sch-kpi-card-blue .sch-kpi-card-val  { color: var(--sch-blue-mid); }
.sch-kpi-card-green { border-top: 3px solid var(--sch-green); }
.sch-kpi-card-green .sch-kpi-card-val { color: var(--sch-green); }
.sch-kpi-card-red   { border-top: 3px solid var(--sch-red); }
.sch-kpi-card-red .sch-kpi-card-val   { color: var(--sch-red); }
.sch-kpi-card-amber { border-top: 3px solid var(--sch-amber); }
.sch-kpi-card-amber .sch-kpi-card-val { color: var(--sch-amber); }

.sch-kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.kpi-section-card {
  background: white;
  border-radius: var(--sch-radius);
  border: 1px solid var(--sch-gray-200);
  padding: 20px;
  box-shadow: var(--sch-shadow);
}
.kpi-section-card.kpi-section-half { /* usado no grid */ }
.kpi-section-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--sch-gray-700);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--sch-gray-100);
}
.kpi-timeline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.kpi-tl-item { display: flex; flex-direction: column; gap: 2px; }
.kpi-tl-lbl  { font-size: 11px; color: var(--sch-gray-500); font-weight: 500; }
.kpi-tl-val  { font-size: 14px; font-weight: 700; color: var(--sch-gray-900); }
.kpi-red { color: var(--sch-red) !important; }

.kpi-prog-lbl {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--sch-gray-500);
  margin-bottom: 4px;
}
.kpi-prog-bg {
  height: 8px;
  background: var(--sch-gray-100);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.kpi-prog-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s;
}
.kpi-fill-time  { background: #94a3b8; }
.kpi-fill-phys  { background: var(--sch-blue-mid); }
.kpi-fill-fin   { background: var(--sch-green); }

.kpi-stages-list { display: flex; flex-direction: column; gap: 10px; }
.kpi-stage-row {
  display: grid;
  grid-template-columns: 140px 1fr 40px auto;
  align-items: center;
  gap: 10px;
}
.kpi-stage-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sch-gray-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-stage-bar-wrap {
  height: 10px;
  background: var(--sch-gray-100);
  border-radius: 5px;
  overflow: hidden;
}
.kpi-stage-bar {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s;
}
.kpi-stage-pct {
  font-size: 12px;
  font-weight: 700;
  color: var(--sch-gray-700);
  text-align: right;
}

/* ═══════════════════════════════════════════════════════════
   MODAL: NOVA OBRA (seleção do orçamento)
═══════════════════════════════════════════════════════════ */
.sch-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.sch-modal-overlay.active { display: flex; }
.sch-modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.22);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: schModalIn 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes schModalIn {
  from { opacity: 0; transform: scale(0.93) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.sch-modal-lg { max-width: 760px; }

.sch-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--sch-gray-100);
}
.sch-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--sch-gray-900);
}
.sch-modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; border: none; background: var(--sch-gray-100);
  color: var(--sch-gray-500); font-size: 18px; cursor: pointer;
}
.sch-modal-close:hover { background: var(--sch-gray-200); color: var(--sch-gray-900); }

.sch-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}
.sch-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--sch-gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Campos do modal */
.sch-field-group { margin-bottom: 16px; }
.sch-field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sch-gray-700);
  margin-bottom: 5px;
}
.sch-field-label .req { color: var(--sch-red); }
.sch-field-input, .sch-field-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--sch-gray-200);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--sch-gray-900);
  background: white;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.sch-field-input:focus, .sch-field-select:focus {
  outline: none;
  border-color: var(--sch-blue-mid);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.10);
}

/* Preview da obra selecionada */
.sch-obra-preview {
  background: var(--sch-blue-lt);
  border: 1.5px solid #bfdbfe;
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 12px;
}
.sch-preview-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.sch-preview-item { display: flex; flex-direction: column; gap: 2px; }
.sch-preview-lbl  { font-size: 11px; font-weight: 600; color: #1d4ed8; }
.sch-preview-val  { font-size: 13.5px; font-weight: 600; color: var(--sch-gray-900); }
.sch-val-money    { color: var(--sch-blue); }

/* ═══════════════════════════════════════════════════════════
   MODAL: EDITAR ATIVIDADE
═══════════════════════════════════════════════════════════ */
.sch-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.sch-form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.sch-form-full   { grid-column: 1 / -1; }
.sch-form-section {
  margin-bottom: 20px;
}
.sch-form-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--sch-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--sch-gray-100);
}
.sch-textarea {
  min-height: 64px;
  resize: vertical;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sch-obra-bar { flex-direction: column; align-items: flex-start; }
  .sch-obra-kpis { width: 100%; justify-content: space-between; }
  .sch-kpi-row   { grid-template-columns: 1fr; }
  .sch-form-grid { grid-template-columns: 1fr; }
  .sch-form-grid-3 { grid-template-columns: 1fr 1fr; }
  .gantt-label-col { width: 140px; min-width: 140px; }
  .gantt-act-name  { max-width: 110px; }
  .sch-modal { max-width: 100%; border-radius: 12px 12px 0 0; max-height: 95vh; }
  .sch-preview-row { grid-template-columns: 1fr; }
  .kpi-stage-row   { grid-template-columns: 100px 1fr 36px auto; }

  /* Gantt mobile: scroll horizontal simplificado */
  .gantt-scroll-outer { max-height: 60vh; }
  .gantt-zoom-btns    { gap: 2px; }
  .gantt-zoom-btn     { padding: 4px 8px; font-size: 11.5px; }
}

@media (max-width: 480px) {
  .sch-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .sch-header-tab { min-width: 130px; }
  .sch-header-tab-name { max-width: 110px; }
  .gantt-label-col { width: 110px; min-width: 110px; }
  .kpi-stage-row   { grid-template-columns: 80px 1fr 36px; }
  .kpi-stage-row .sch-status-badge { display: none; }
}
