/**
 * Custo Horário — Sobratema v3
 * Usa tokens globais de style.css (--sb-*, --ff, --container).
 * Visual do simulador: simulador-visual-spec.md (harmonizado ao site).
 */

.main--programa:has(.ch-page) {
  padding: 0;
  background: var(--sb-bg, #f5f5f5);
}

.ch-page {
  --font-main: var(--ff, "Barlow", system-ui, sans-serif);
  --ch-red: var(--sb-red);
  --ch-red-dark: var(--sb-red-dark);
  --ch-ink: var(--sb-gray-dark, #3c3c3c);
  --ch-muted: var(--sb-gray);
  --ch-surface: var(--sb-white);
  --ch-border: var(--sb-border);
  --ch-radius: var(--radius-md, 10px);
  --ch-grupo-bg: #fff3cd;
  --ch-grupo-border: #e6c200;
  --ch-item-bg: #454545;
  --ch-item-text: #f2f2f2;
  --ch-subtotal-bg: #1a1a1a;
  --ch-total-bg: var(--sb-red-light);
  --ch-hover-data: rgba(200, 16, 46, 0.05);
  --sb-dark: var(--sb-gray-dark, #2c2c2c);
  --sb-dark-mid: #3c3c3c;
  --sb-surf: var(--sb-gray-light, #f4f4f4);
  --sb-surf2: #f9f9f9;
  --sb-red-light: #fbeaea;
  --sb-border-light: #ebebeb;
  --sb-success: #2e7d32;
  --sb-success-bg: #e8f5e9;
  --sb-success-border: #a5d6a7;
  --sb-info: #0c447c;
  --sb-info-bg: #e6f1fb;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --r-xl: 14px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-family: var(--font-main);
  color: var(--ch-ink);
  font-size: inherit;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.ch-page .ch-section {
  padding: var(--space-lg, 2.5rem) 0;
}

.ch-section > .sim-wrap {
  width: var(--container);
  margin-inline: auto;
}

.ch-page .ch-sim > .container {
  width: var(--container);
  max-width: var(--container-max, 1440px);
}

/* —— Container do simulador —— */
.sim-wrap,
body.ch-print {
  font-family: var(--font-main);
  color: var(--sb-dark);
}

.sim-wrap {
  padding: 0.25rem 0 2.5rem;
  max-width: 100%;
  margin: 0;
}

.sim-page-title {
  margin: 0 0 0.5rem;
  font-family: var(--ffc, var(--font-main));
  font-size: var(--text-xl, clamp(1.25rem, 2vw, 1.75rem));
  font-weight: 700;
  color: var(--sb-dark);
  line-height: 1.2;
}

.section-label,
.sim-section-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sb-gray);
  margin: 0 0 0.75rem;
  padding: 0;
}

/* —— Topbar spec (§4) —— */
.sim-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 1rem;
  border-bottom: 0.5px solid var(--sb-border);
  margin-bottom: 1.5rem;
  gap: 12px;
}

.sim-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo-chip {
  background: var(--sb-red);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--r-md);
  letter-spacing: 0.04em;
  line-height: 1;
  flex-shrink: 0;
}

.sim-title {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
  color: var(--sb-dark);
}

.sim-topbar-right {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.sim-topbar-user {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 400;
  color: var(--sb-gray);
  padding: 4px 8px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sim-topbar-user i {
  font-size: 14px;
  flex-shrink: 0;
}

.topbar-link {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 400;
  color: var(--sb-gray);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--r-md);
  transition: color 0.15s, background 0.15s;
  border: none;
  background: transparent;
  font-family: var(--font-main);
  cursor: pointer;
}

.topbar-link i {
  font-size: 14px;
}

.topbar-link:hover {
  color: var(--sb-red);
  background: var(--sb-red-light);
}

/* —— Botões do simulador (alinhados ao .btn do site) —— */
.sim-wrap .btn-primary,
.sim-wrap a.btn-primary,
.ch-modal .btn-primary,
.ch-modal a.btn-primary,
.ch-onboarding .btn-primary,
.ch-print .btn-primary,
.ch-page .sim-wrap .btn.btn-primary {
  background: var(--sb-red);
  color: #fff;
  border: 2px solid var(--sb-red);
  border-radius: var(--radius-sm, var(--r-sm));
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-main);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.sim-wrap .btn-primary:hover,
.sim-wrap a.btn-primary:hover,
.ch-modal .btn-primary:hover,
.ch-modal a.btn-primary:hover,
.ch-onboarding .btn-primary:hover,
.ch-page .sim-wrap .btn.btn-primary:hover {
  background: var(--sb-red-dark);
  border-color: var(--sb-red-dark);
  color: #fff;
  transform: translateY(-1px);
}

.sim-wrap .btn-primary:active,
.sim-wrap a.btn-primary:active {
  transform: translateY(0);
}

.sim-wrap .btn-secondary,
.sim-wrap a.btn-secondary {
  background: var(--sb-surf);
  color: var(--sb-dark);
  border: 2px solid var(--sb-border);
  border-radius: var(--radius-sm, var(--r-sm));
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.sim-wrap .btn-secondary:hover,
.sim-wrap a.btn-secondary:hover {
  border-color: var(--sb-red);
  background: var(--sb-red-light);
}

.sim-wrap .btn-ghost,
.sim-wrap a.btn-ghost,
.ch-modal .btn-ghost,
.ch-modal a.btn-ghost,
.ch-page .sim-wrap .btn.btn-outline {
  background: transparent;
  color: var(--sb-dark);
  border: 2px solid var(--sb-border);
  border-radius: var(--radius-sm, var(--r-sm));
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.sim-wrap .btn-ghost:hover,
.sim-wrap a.btn-ghost:hover,
.ch-modal .btn-ghost:hover,
.ch-modal a.btn-ghost:hover {
  border-color: var(--sb-red);
  color: var(--sb-red);
}

.sim-wrap .btn-primary i,
.sim-wrap .btn-ghost i,
.sim-wrap .btn-secondary i,
.sim-wrap .btn-danger i {
  font-size: 14px;
}

.sim-wrap .btn-danger,
.sim-wrap button.btn-danger,
.ch-modal .btn-danger,
.ch-modal button.btn-danger {
  background: #b71c1c;
  color: #fff;
  border: 2px solid #b71c1c;
  border-radius: var(--radius-sm, var(--r-sm));
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
  white-space: nowrap;
}

.sim-wrap .btn-danger:hover,
.ch-modal .btn-danger:hover {
  background: #7f1212;
}

.sim-wrap .icon-btn,
.ch-modal .icon-btn,
.obra-card-tools .icon-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--r-md);
  border: 1px solid var(--sb-border);
  background: var(--sb-surf);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: var(--sb-gray);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  flex-shrink: 0;
  padding: 0;
  text-decoration: none;
}

.sim-wrap .icon-btn:hover,
.ch-modal .icon-btn:hover,
.obra-card-tools .icon-btn:hover {
  border-color: var(--sb-red);
  color: var(--sb-red);
  background: var(--sb-red-light);
}

.sim-wrap .icon-btn.danger:hover,
.obra-card-tools .icon-btn.danger:hover {
  border-color: #b71c1c;
  color: #b71c1c;
  background: #ffebee;
}

.sim-wrap .btn-white {
  background: #fff;
  color: var(--sb-dark);
  border: none;
  border-radius: var(--r-md);
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s;
  text-decoration: none;
}

.sim-wrap .btn-white:hover {
  opacity: 0.88;
}

.sim-wrap .btn-ghost-white {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--r-md);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
  text-decoration: none;
}

.sim-wrap .btn-ghost-white:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sim-wrap .btn-sm,
.ch-modal .btn-sm {
  padding: 8px 14px;
  font-size: 12px;
}

.sim-wrap .btn-lg,
.ch-modal .btn-lg {
  padding: 14px 24px;
  font-size: 14px;
}

/* Botões compactos em barras escuras e toolbars */
.total-bar-actions .btn-white,
.total-bar-actions .btn-ghost-white,
.ch-edit-custo .total-bar-actions .btn-primary,
.ch-edit-custo .total-bar-actions .btn-white,
.ch-edit-custo .total-bar-actions .btn-ghost,
.ch-edit-custo .total-bar-actions .btn-ghost-white,
.ch-edit-custo .ch-custo-panel__expand-all.btn-ghost,
.nav-actions .btn-ghost,
.painel-header .btn-primary {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

/* —— Formulários spec (§9) —— */
.sim-wrap .field,
.ch-modal .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sim-wrap .field label,
.ch-modal .field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--sb-gray);
}

.sim-wrap .field input[type="text"],
.sim-wrap .field input[type="number"],
.sim-wrap .field input[type="search"],
.sim-wrap .field textarea,
.sim-wrap .field select,
.ch-modal .field input[type="text"],
.ch-modal .field input[type="number"],
.ch-modal .field input[type="search"],
.ch-modal .field textarea,
.ch-modal .field select {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font-main);
  font-weight: 400;
  color: var(--sb-dark);
  background: var(--sb-white);
  border: 1px solid var(--sb-border);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color 0.15s;
  height: 34px;
  box-sizing: border-box;
}

.sim-wrap .field textarea,
.ch-modal .field textarea {
  height: auto;
  resize: vertical;
  min-height: 80px;
}

.sim-wrap .field input:focus,
.sim-wrap .field select:focus,
.sim-wrap .field textarea:focus,
.ch-modal .field input:focus,
.ch-modal .field select:focus,
.ch-modal .field textarea:focus {
  border-color: var(--sb-red);
  box-shadow: 0 0 0 2px var(--sb-red-light);
}

.sim-wrap .field-hint,
.ch-modal .field-hint {
  font-size: 11px;
  color: var(--sb-gray);
  margin-top: 2px;
  line-height: 1.4;
}

.sim-wrap .form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 1.25rem;
}

.sim-wrap .custo-input input {
  text-align: right;
  font-size: 13px;
  padding: 4px 8px;
  height: 30px;
  border: 1px solid var(--sb-border);
  border-radius: var(--r-sm);
  width: 100%;
  background: var(--sb-white);
  font-family: var(--font-main);
  color: var(--sb-dark);
  outline: none;
}

.sim-wrap .custo-input input:focus {
  border-color: var(--sb-red);
  box-shadow: 0 0 0 2px var(--sb-red-light);
}

.sim-wrap .custo-input input.editado {
  border-color: var(--sb-info);
  background: var(--sb-info-bg);
  color: var(--sb-info);
}

/* —— Animações spec (§17) —— */
.sim-wrap .painel {
  animation: sim-fade-in 0.2s ease;
}

@keyframes sim-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sim-wrap .total-bar-valor.atualizado {
  animation: sim-pulso 0.35s ease;
}

@keyframes sim-pulso {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.06);
  }

  100% {
    transform: scale(1);
  }
}

.sim-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sim-wrap .ch-section__lead {
  font-size: 0.95em;
  line-height: 1.6;
}

@media (max-width: 640px) {
  .topbar-link span {
    display: none;
  }

  .sim-title {
    font-size: 14px;
  }

  .sim-topbar-user span {
    display: none;
  }

  .sim-wrap .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* —— Hero landing —— */
.ch-hero {
  position: relative;
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
  color: #fff;
  overflow: hidden;
}

.ch-hero__bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(18, 20, 26, 0.97) 0%, rgba(30, 32, 42, 0.92) 50%, rgba(158, 12, 36, 0.88) 100%);
  z-index: 0;
}

.ch-hero__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 85% 50%, rgba(196, 16, 46, 0.35) 0%, transparent 55%);
}

.ch-hero__inner {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.ch-hero__kicker {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.ch-hero__title {
  margin: 0 0 1rem;
  font-family: var(--ffc, var(--font-main));
  font-size: var(--text-hero, clamp(1.85rem, 4.5vw, 2.75rem));
  font-weight: 800;
  line-height: 1.12;
}

.ch-hero__text {
  margin: 0 0 1.75rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.88);
}

.ch-hero__text p {
  margin: 0 0 0.85rem;
}

.ch-hero__text p:last-child {
  margin-bottom: 0;
}

.ch-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.ch-hero .btn-outline {
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

.ch-hero .btn-outline:hover {
  border-color: #fff;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.ch-hero .btn-outline:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* —— Conteúdo —— */

.ch-section__header {
  margin-bottom: 1.5rem;
}

.ch-section__header h1 {
  margin: 0 0 0.5rem;
  font-family: var(--ffc, var(--font-main));
  font-size: var(--text-xl, clamp(1.5rem, 3vw, 2rem));
  font-weight: 700;
  color: var(--ch-ink);
  line-height: 1.2;
}

.ch-section__lead {
  margin: 0;
  max-width: 70ch;
  line-height: 1.6;
  color: var(--ch-muted);
}

.ch-section__lead a {
  color: var(--ch-red);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.ch-section__lead a:hover {
  color: var(--ch-red-dark);
}

.ch-section__lead a:focus-visible {
  outline: 2px solid rgba(196, 16, 46, 0.35);
  outline-offset: 2px;
}

.ch-card {
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.ch-card + .ch-card {
  margin-top: 1.25rem;
}

/* —— Breadcrumb / voltar —— */
.ch-back {
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.ch-back a {
  color: var(--ch-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ch-back a:hover {
  color: var(--ch-red);
}

.ch-back a:focus-visible {
  outline: 2px solid rgba(196, 16, 46, 0.35);
  outline-offset: 2px;
  color: var(--ch-red);
}

/* —— Tabelas (base) —— */
.ch-table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  background: var(--ch-surface);
  -webkit-overflow-scrolling: touch;
}

.ch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ch-table th,
.ch-table td {
  border-bottom: 1px solid var(--ch-border);
  padding: 0.65rem 0.85rem;
  vertical-align: middle;
  text-align: left;
}

.ch-table tbody tr:last-child td {
  border-bottom: none;
}

.ch-table thead th {
  background: var(--sb-gray-light, #f4f4f4);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ch-muted);
  white-space: nowrap;
}

.ch-table td.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Hover suave apenas em listagens claras (obras, equipamentos da obra) */
.ch-table:not(.ch-table--breakdown) > tbody > tr:not(.ch-detail-row):hover > td {
  background-color: var(--ch-hover-data);
}

.ch-table:not(.ch-table--breakdown) > tbody > tr:not(.ch-detail-row):hover > td.num {
  color: var(--ch-ink);
}

.ch-table:not(.ch-table--breakdown) > tbody > tr.is-inactive:hover > td {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Links simples em células de listagem — não afeta .ch-action-btn */
.ch-table:not(.ch-table--breakdown) tbody td a:not(.btn):not(.ch-action-btn) {
  color: var(--ch-red);
  font-weight: 600;
  text-decoration: none;
}

.ch-table:not(.ch-table--breakdown) tbody td a:not(.btn):not(.ch-action-btn):hover {
  color: var(--ch-red-dark);
  text-decoration: underline;
}

.ch-table:not(.ch-table--breakdown) tbody td a:not(.btn):not(.ch-action-btn):focus-visible {
  outline: 2px solid rgba(196, 16, 46, 0.35);
  outline-offset: 2px;
}

/* Cabeçalho de grupo (legado amarelo) — suporta classe no tr ou no td */
.ch-grupo td,
td.ch-grupo {
  background: var(--ch-grupo-bg);
  color: var(--ch-ink);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--ch-grupo-border);
}

.ch-grupo:hover td,
tr:has(> td.ch-grupo):hover > td.ch-grupo {
  background: var(--ch-grupo-bg);
}

.ch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.ch-actions a:not(.ch-action-btn) {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ch-red);
  text-decoration: none;
}

.ch-actions a:not(.ch-action-btn):hover {
  color: var(--ch-red-dark);
  text-decoration: underline;
}

.ch-actions a:focus-visible {
  outline: 2px solid rgba(196, 16, 46, 0.35);
  outline-offset: 2px;
}

.ch-expand,
.ch-table a.ch-link-expand {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ch-red);
  font-weight: 700;
  padding: 0 0.35rem 0 0;
  font-size: 1rem;
  line-height: 1;
  text-decoration: none;
  font-family: inherit;
}

.ch-expand:hover,
.ch-table a.ch-link-expand:hover {
  color: var(--ch-red-dark);
}

.ch-expand:focus-visible,
.ch-table a.ch-link-expand:focus-visible {
  outline: 2px solid rgba(196, 16, 46, 0.35);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Linha expandível (tabela resumo) */
.ch-detail-row td.ch-detail-cell {
  background: var(--sb-gray-light, #f4f4f4);
  padding: 1rem;
}

.ch-detail-row:hover td.ch-detail-cell {
  background: var(--sb-gray-light, #f4f4f4);
}

.ch-detail-cell .ch-table {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.ch-detail-cell .ch-table th,
.ch-detail-cell .ch-table td {
  padding: 0.45rem 0.6rem;
}

.ch-detail-empty,
.ch-detail-error,
.ch-detail-loading {
  margin: 0;
  font-size: 0.9rem;
}

.ch-detail-error {
  color: var(--ch-red-dark);
}

.ch-detail-loading {
  color: var(--ch-muted);
}

/* —— Breakdown accordion (detalhe por família) —— */
.ch-breakdown__title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ch-ink);
}

.ch-table--breakdown {
  background: var(--ch-surface);
  border-radius: 8px;
}

.ch-table--breakdown .ch-breakdown__grupo-header.ch-grupo td {
  background: var(--ch-grupo-bg);
  color: var(--ch-ink);
  border-bottom: 1px solid var(--ch-grupo-border);
}

.ch-table--breakdown .ch-breakdown__grupo-header:hover td {
  background: var(--ch-grupo-bg);
}

.ch-breakdown__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  margin-right: 0.5rem;
  padding: 0;
  background: var(--ch-surface);
  border: 1px solid var(--ch-grupo-border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--ch-red);
  font-family: inherit;
  vertical-align: middle;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.ch-breakdown__toggle:hover {
  color: var(--ch-red-dark);
  border-color: var(--ch-red);
  background: #fff;
}

.ch-breakdown__toggle:focus-visible {
  outline: 2px solid rgba(196, 16, 46, 0.35);
  outline-offset: 2px;
}

.ch-breakdown__icon {
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.ch-breakdown__grupo-header.is-expanded .ch-breakdown__icon {
  transform: rotate(90deg);
}

.ch-breakdown__grupo-header.ch-grupo td {
  cursor: pointer;
}

.ch-breakdown__grupo-header.is-expanded td {
  border-bottom-color: var(--ch-grupo-border);
}

/* Subitens expandidos: fundo escuro, texto claro */
.ch-table--breakdown .ch-breakdown__grupo-body:not(.ch-breakdown__sub) td {
  background: var(--ch-item-bg);
  color: var(--ch-item-text);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.ch-table--breakdown .ch-breakdown__grupo-body:not(.ch-breakdown__sub):hover td {
  background: var(--ch-item-bg);
  color: var(--ch-item-text);
}

.ch-table--breakdown .ch-breakdown__grupo-body:not(.ch-breakdown__sub) td.num {
  color: #fff;
}

.ch-table--breakdown .ch-breakdown__tot td {
  font-weight: 600;
}

.ch-table--breakdown .ch-breakdown__sub td {
  background: var(--ch-subtotal-bg);
  color: #fff;
  border-top: 2px solid #333;
  font-weight: 700;
}

.ch-table--breakdown .ch-breakdown__sub:hover td {
  background: var(--ch-subtotal-bg);
  color: #fff;
}

.ch-table--breakdown .ch-breakdown__sub td.num {
  color: #fff;
}

.ch-table--breakdown .ch-breakdown__total td {
  background: var(--ch-total-bg);
  color: var(--ch-ink);
  font-size: 0.95rem;
  font-weight: 700;
  border-top: 2px solid var(--ch-red);
}

.ch-table--breakdown .ch-breakdown__total:hover td {
  background: var(--ch-total-bg);
  color: var(--ch-ink);
}

.ch-table--breakdown .ch-breakdown__total td.num {
  color: var(--ch-red-dark);
}

/* —— Minhas obras / equipamentos spec (§7, §10, §13–15) —— */
/* §7 Minhas obras */
.obras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
  margin-bottom: 1.25rem;
}

.obra-card-wrap {
  position: relative;
}

.obra-card {
  display: block;
  background: var(--sb-white);
  border: 1px solid var(--sb-border);
  border-radius: var(--r-lg);
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 90px;
  text-decoration: none;
  color: inherit;
}

.obra-card:hover {
  border-color: var(--sb-red);
  box-shadow: var(--shadow-sm);
}

.obra-card.selected {
  border: 2px solid var(--sb-red);
}

.obra-nome {
  font-size: 14px;
  font-weight: 500;
  color: var(--sb-dark);
  margin: 0 0 4px;
  line-height: 1.35;
}

.obra-meta {
  font-size: 12px;
  color: var(--sb-gray);
  margin: 0;
}

.obra-total {
  font-size: 15px;
  font-weight: 500;
  color: var(--sb-red);
  margin: 8px 0 0;
}

.obra-card-tools {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.obra-card-wrap:hover .obra-card-tools,
.obra-card-wrap:focus-within .obra-card-tools {
  opacity: 1;
}

.obra-nova {
  background: var(--sb-surf);
  border: 1px dashed var(--sb-border);
  border-radius: var(--r-lg);
  padding: 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 90px;
  transition: border-color 0.15s, background 0.15s;
  font-family: var(--font-main);
}

.obra-nova:hover {
  border-color: var(--sb-red);
  background: var(--sb-red-light);
}

.obra-nova i {
  font-size: 22px;
  color: var(--sb-red);
}

.obra-nova span {
  font-size: 13px;
  color: var(--sb-gray);
}

/* —— Modais (overlay + diálogo) —— */
.ch-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 3vw, 1.5rem);
}

.ch-modal[hidden] {
  display: none !important;
}

body.ch-modal-open {
  overflow: hidden;
}

.ch-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 20, 26, 0.55);
  cursor: pointer;
}

.ch-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(92vh, 880px);
  display: flex;
  flex-direction: column;
  background: var(--sb-white);
  border-radius: var(--r-lg);
  border: 1px solid var(--sb-border);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.ch-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--sb-border);
  background: linear-gradient(180deg, #fafafa 0%, #fff 100%);
}

.ch-modal__body {
  flex: 1;
  min-height: 0;
  padding: 1rem 1.15rem 1.15rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ch-modal__lead {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--sb-gray);
}

.ch-modal .ch-field input,
.ch-modal .ch-field textarea,
.ch-modal .ch-field select {
  width: 100%;
  box-sizing: border-box;
}

/* Modal spec dentro de ch-modal */
.ch-modal .modal-titulo {
  font-size: 15px;
  font-weight: 500;
  color: var(--sb-red);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ch-modal .modal-footer {
  padding: 0.75rem 0 0;
  border-top: 0.5px solid var(--sb-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 1rem;
}

.ch-modal__close.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--r-md);
}

/* §10 Lista equipamentos */
.painel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 12px;
}

.painel-meta {
  font-size: 12px;
  color: var(--sb-gray);
  margin: 3px 0 0;
}

.equip-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 1rem;
}

.equip-item {
  background: var(--sb-white);
  border: 1px solid var(--sb-border);
  border-radius: var(--r-lg);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: opacity 0.2s;
}

.equip-item.inativo {
  opacity: 0.45;
}

.equip-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}

.equip-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--sb-border);
  border-radius: 20px;
  transition: background 0.2s;
}

.equip-toggle input:checked + .toggle-track {
  background: var(--sb-red);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.equip-toggle input:checked ~ .toggle-thumb {
  transform: translateX(16px);
}

.equip-info {
  flex: 1;
  min-width: 0;
}

.equip-nome {
  font-size: 13px;
  font-weight: 500;
  color: var(--sb-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

.equip-obs {
  font-size: 12px;
  color: var(--sb-gray);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.obs-chip {
  font-size: 10px;
  font-weight: 500;
  background: var(--sb-info-bg);
  color: var(--sb-info);
  border-radius: var(--r-sm);
  padding: 2px 7px;
  white-space: nowrap;
}

.equip-valores {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 118px;
  flex-shrink: 0;
}

.equip-valor-line {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  text-align: right;
}

.equip-valor-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sb-gray);
  line-height: 1.2;
}

.equip-valor-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--sb-dark);
  white-space: nowrap;
  line-height: 1.2;
}

.equip-valor-num--destaque {
  font-size: 14px;
  font-weight: 700;
  color: var(--sb-red);
}

.equip-valor-unit {
  font-size: 10px;
  color: var(--sb-gray);
  font-weight: 500;
}

.equip-valor-line--obra {
  padding-top: 4px;
  border-top: 1px dashed var(--sb-border);
}

.equip-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.total-bar {
  background: var(--sb-dark);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 1.5rem;
}

.total-bar-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.25rem 2rem;
  flex: 1;
  min-width: 0;
}

.total-bar-metric {
  min-width: 0;
}

.total-bar-metric--obra .total-bar-valor {
  color: var(--sb-red-light);
}

.total-bar-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.total-bar-valor {
  font-size: 22px;
  font-weight: 500;
  color: #fff;
  line-height: 1;
}

.total-bar-valor--obra {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

.total-bar-valor span {
  font-size: 13px;
  opacity: 0.6;
  margin-left: 2px;
}

.total-bar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.total-bar-valor.atualizado {
  animation: sim-pulso 0.35s ease;
}

@keyframes sim-pulso {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* §13 Nav-actions */
.nav-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--sb-border);
}

/* §14 Confirma exclusão */
.confirma-overlay {
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--r-lg);
  padding: 30px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  margin: 8px 0;
}

.confirma-overlay[hidden] {
  display: none !important;
}

.confirma-box {
  background: var(--sb-white);
  border-radius: var(--r-lg);
  border: 1px solid var(--sb-border);
  padding: 1.25rem;
  max-width: 380px;
  width: 100%;
}

.confirma-texto {
  font-size: 13px;
  color: var(--sb-dark);
  margin: 0 0 1rem;
  line-height: 1.55;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.confirma-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* §15 Empty state */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--sb-gray);
}

.empty-state i {
  font-size: 44px;
  display: block;
  margin: 0 auto 0.875rem;
  color: var(--sb-border);
}

.empty-state p {
  font-size: 14px;
  color: var(--sb-gray);
  margin: 0 0 1.25rem;
}

/* Responsivo sim */
@media (max-width: 640px) {
  .topbar-link span {
    display: none;
  }

  .sim-title {
    font-size: 14px;
  }

  .step-label {
    display: none;
  }

  .step-line {
    min-width: 12px;
    margin: 0 6px;
  }

  .total-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .total-bar-actions {
    justify-content: center;
  }

  .painel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .painel-header .btn-primary {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .equip-item {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .equip-valores {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    padding-top: 0.5rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--sb-border-light, #ebebeb);
  }

  .equip-valor-line--obra {
    border-top: none;
    padding-top: 0;
  }

  .equip-valor-line {
    align-items: flex-start;
    text-align: left;
  }

  .total-bar-metrics {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .nav-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .nav-actions .btn-ghost,
  .nav-actions .btn-primary {
    width: 100%;
    justify-content: center;
  }
}

/* —— Incluir equipamento (formulário único) —— */
.ch-modal__dialog--equip {
  width: min(640px, 100%);
}

.ch-equip-form .ch-field + .ch-equip-standard {
  margin-top: -0.5rem;
}

.ch-equip-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--ch-border);
  border-radius: var(--r-md);
  background: var(--ch-surface);
}

.ch-equip-filter:focus-within {
  border-color: var(--sb-red);
  box-shadow: 0 0 0 2px var(--sb-red-light);
}

.ch-equip-filter i {
  color: var(--ch-muted);
  font-size: 1rem;
  flex-shrink: 0;
}

.ch-equip-filter input {
  flex: 1;
  min-width: 0;
  border: none;
  padding: 0.6rem 0;
  font-size: 13px;
  font-family: var(--font-main);
  background: transparent;
  color: var(--ch-ink);
}

.ch-equip-filter input:focus {
  outline: none;
}

.ch-equip-form select[size] {
  height: auto;
  min-height: 10.5rem;
  padding: 0.25rem;
  line-height: 1.4;
}

.ch-equip-form #chEquipModeloSelect[size] {
  min-height: 14rem;
}

.ch-equip-form select[size] option {
  padding: 0.4rem 0.5rem;
  border-radius: 3px;
}

.ch-equip-standard {
  margin: 0 0 1rem;
  font-size: 0.88rem;
}

.ch-equip-meta {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ch-muted);
}

.ch-equip-meta[hidden],
.ch-equip-empty[hidden] {
  display: none !important;
}

.ch-equip-empty {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0;
  padding: 0.75rem;
  font-size: 0.88rem;
  color: var(--ch-muted);
  background: var(--sb-gray-light, #f4f4f4);
  border-radius: var(--r-md);
}

.ch-equip-form__footer {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 1.25rem;
}

.ch-equip-form__footer [data-ch-equip-custos] {
  margin-left: auto;
}

.ch-equip-form__footer .btn {
  min-height: 44px;
}

.ch-equip-form__footer .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 560px) {
  .ch-equip-form__footer {
    flex-direction: column;
    align-items: stretch;
  }

  .ch-equip-form__footer [data-ch-equip-custos] {
    margin-left: 0;
    order: -1;
  }
}

.ch-field__search {
  margin-bottom: 0.5rem;
}

.ch-label-muted {
  font-weight: 400;
  color: var(--ch-muted);
}

.ch-field select[size] {
  min-height: 12rem;
  padding: 0.35rem 0.5rem;
}

.ch-field select[size] option {
  padding: 0.35rem 0.5rem;
  border-radius: 2px;
}

.ch-field {
  margin-bottom: 1.15rem;
}

.ch-field:last-child {
  margin-bottom: 0;
}

.ch-field label,
.ch-field .ch-field__label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ch-ink);
}

.ch-field__hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--ch-muted);
  line-height: 1.45;
}

.ch-field input,
.ch-field textarea,
.ch-field select {
  display: block;
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--ch-border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 400;
  background: var(--ch-surface);
  color: var(--ch-ink);
  box-sizing: border-box;
}

.ch-field textarea {
  min-height: 100px;
  resize: vertical;
}

.ch-field select {
  cursor: pointer;
  appearance: auto;
}

.ch-loading {
  padding: 1rem;
  text-align: center;
  color: var(--ch-muted);
  font-size: 0.9rem;
}

.ch-toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 10001;
  max-width: min(360px, calc(100vw - 2rem));
  padding: 0.85rem 1.1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  animation: ch-toast-in 0.25s ease;
}

.ch-toast--erro {
  background: #fde8ec;
  color: var(--ch-red-dark);
  border: 1px solid rgba(200, 16, 46, 0.2);
}

.ch-toast--ok {
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid rgba(27, 94, 32, 0.15);
}

@keyframes ch-toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— Formulários —— */
.ch-form .form,
.ch-page .form {
  max-width: 640px;
}

.ch-grid-form {
  max-width: none;
}

.ch-breakdown {
  margin-bottom: 1rem;
}

.ch-edit-meta + .ch-breakdown,
.ch-edit-meta + .ch-custo-panel {
  margin-top: 0;
}

/* —— Editar custo (obra) — namespaced —— */
.ch-edit-custo .ch-breadcrumb {
  margin: 0 0 1rem;
}

.ch-breadcrumb__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  color: var(--ch-muted);
}

.ch-breadcrumb__list li:not(:last-child)::after {
  content: "/";
  margin-left: 0.5rem;
  color: var(--ch-border);
  font-weight: 400;
}

.ch-breadcrumb__list a {
  color: var(--ch-red);
  text-decoration: none;
  font-weight: 600;
}

.ch-breadcrumb__list a:hover {
  color: var(--ch-red-dark);
  text-decoration: underline;
}

.ch-breadcrumb__list [aria-current="page"] {
  color: var(--ch-ink);
  font-weight: 600;
}

.ch-edit-custo__intro {
  margin-bottom: 1.5rem;
}

.ch-edit-custo__intro h1 {
  margin: 0 0 0.65rem;
  font-family: var(--ffc, var(--font-main));
  font-size: var(--text-xl, clamp(1.45rem, 3vw, 1.85rem));
  font-weight: 700;
  color: var(--ch-ink);
  line-height: 1.2;
}

.ch-edit-custo__context {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
}

.ch-edit-custo__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ch-ink);
}

.ch-edit-custo__chip i {
  color: var(--ch-red);
  font-size: 1rem;
}

.ch-edit-custo__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0;
  font-size: 0.9rem;
}

.ch-edit-custo__links a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ch-red);
  font-weight: 600;
  text-decoration: none;
}

.ch-edit-custo__links a:hover {
  color: var(--ch-red-dark);
  text-decoration: underline;
}

.ch-edit-meta__grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .ch-edit-meta__grid {
    grid-template-columns: 1fr 1fr;
  }

  .ch-field--full {
    grid-column: 1 / -1;
  }
}

.ch-custo-panel {
  margin-bottom: 1rem;
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.ch-custo-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--ch-border);
  background: linear-gradient(180deg, #fafafa 0%, var(--ch-surface) 100%);
}

.ch-custo-panel__titles h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.ch-custo-panel__lead {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ch-muted);
  max-width: 42rem;
  line-height: 1.45;
}

.ch-custo-panel__table {
  margin: 0;
  border: none;
  border-radius: 0;
}

.ch-custo-panel__table .ch-table--breakdown {
  border-radius: 0;
}

.ch-edit-custo__form {
  padding-bottom: 0.5rem;
}

/* —— Tutorial —— */
.ch-tutorial__embed {
  border-radius: var(--ch-radius);
  overflow: hidden;
  border: 1px solid var(--ch-border);
  background: var(--ch-surface);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.ch-tutorial__embed .issuuembed {
  display: block;
  max-width: 100%;
}

.ch-tutorial__actions {
  margin-top: 1.25rem;
}

/* —— Empty state —— */
.ch-empty {
  padding: 2rem;
  text-align: center;
  color: var(--ch-muted);
}

.ch-empty p {
  margin: 0 0 1rem;
}

/* —— Utilitários —— */
.is-inactive {
  opacity: 0.55;
}

.is-inactive td {
  background: rgba(0, 0, 0, 0.02);
}

.is-hidden {
  display: none;
}

/* —— Impressão (§16) —— */
@page {
  size: A4;
  margin: 10mm 14mm 22mm;
}

.ch-print {
  --font-main: "Barlow", system-ui, sans-serif;
  --sb-red: #c8102e;
  --sb-dark: #2c2c2c;
  --sb-gray: #6d6e71;
  --sb-surf: #f4f4f4;
  --sb-border: #e0e0e0;
  padding: 1.5rem 1.5rem 3.5rem;
  font-family: var(--font-main);
  color: var(--sb-dark);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

.ch-print__sheet {
  max-width: 900px;
  margin: 0 auto;
}

.ch-print__banner {
  background: var(--sb-red);
  color: #fff;
  margin: -1.5rem -1.5rem 1.75rem;
  padding: 1.35rem 1.5rem 1.5rem;
}

.ch-print__banner-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  max-width: 900px;
  margin: 0 auto;
}

.ch-print__logo {
  display: block;
  width: 168px;
  height: auto;
  flex-shrink: 0;
}

.ch-print__banner-text {
  min-width: 0;
}

.ch-print__banner-secao {
  margin: 0 0 0.3rem;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.9;
}

.ch-print__banner-titulo {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
}

.ch-print__banner-sub {
  margin: 0.4rem 0 0;
  font-size: 0.88rem;
  font-weight: 400;
  line-height: 1.45;
  opacity: 0.92;
}

.ch-print__section {
  margin-top: 1.5rem;
}

.ch-print__section-title {
  margin: 0 0 0.75rem;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sb-gray);
}

.ch-print__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ch-print__table th,
.ch-print__table td {
  border: 1px solid var(--sb-border);
  padding: 0.55rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

.ch-print__table thead th {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sb-gray);
  background: var(--sb-surf);
}

.ch-print__table tbody tr:nth-child(even) td {
  background: #fafafa;
}

.ch-print__table td.num,
.ch-print__table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ch-print__total-row td {
  background: var(--sb-surf);
  font-weight: 500;
  border-top: 2px solid var(--sb-border);
}

.ch-print__total-val,
.ch-print__valor-destaque {
  color: var(--sb-red);
}

.ch-print__unit {
  font-size: 0.88em;
  font-weight: 500;
}

.ch-print__resumo {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--sb-surf);
  border-radius: var(--r-lg, 10px);
  border-left: 3px solid var(--sb-red);
}

.ch-print__resumo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.ch-print__resumo-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 13px;
}

.ch-print__resumo-item--destaque strong {
  font-size: 1.1rem;
}

.ch-print__resumo-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sb-gray);
}

.ch-print__obs {
  margin: 1.25rem 0 0;
  padding: 0.85rem 1rem;
  font-size: 12px;
  color: var(--sb-gray);
  line-height: 1.55;
  background: #fafafa;
  border-radius: var(--r-md, 6px);
}

.ch-print__obs strong {
  color: var(--sb-dark);
  font-weight: 600;
}

.ch-print .nota-legal {
  padding: 0.9rem 1rem;
  background: var(--sb-surf);
  border-radius: var(--r-lg, 10px);
  border-left: 3px solid var(--sb-red);
  margin: 0 0 1.25rem;
}

.ch-print .nota-legal p {
  font-size: 11px;
  color: var(--sb-gray);
  margin: 0 0 0.45rem;
  line-height: 1.65;
}

.ch-print .nota-legal p:last-child {
  margin-bottom: 0;
}

.ch-print .nota-legal strong {
  color: var(--sb-dark);
  font-weight: 600;
}

.ch-print__footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 14mm;
  font-size: 9pt;
  color: var(--sb-gray);
  background: #fff;
  border-top: 1px solid var(--sb-border);
}

.ch-print__footer-page::after {
  content: "Página " counter(page) " de " counter(pages);
}

/* —— Metodologia & ajuda contextual —— */
.ch-metodologia-panel {
  margin: 0 0 1.25rem;
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  background: var(--ch-surface);
  overflow: hidden;
}

.ch-metodologia-panel__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.ch-metodologia-panel__summary::-webkit-details-marker {
  display: none;
}

.ch-metodologia-panel__summary::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.5rem;
  border-right: 2px solid var(--ch-muted);
  border-bottom: 2px solid var(--ch-muted);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}

.ch-metodologia-panel[open] .ch-metodologia-panel__summary::before {
  transform: rotate(45deg);
}

.ch-metodologia-panel__title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.ch-metodologia-panel__badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ch-muted);
  background: var(--ch-hover-data);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.ch-metodologia-panel__body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--ch-border);
}

.ch-metodologia-panel__lead {
  margin: 0.85rem 0 1rem;
  color: var(--ch-muted);
  line-height: 1.55;
  font-size: 0.92rem;
}

.ch-metodologia-panel__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.ch-metodologia-panel__heading {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ch-muted);
}

.ch-metodologia-panel__list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.88rem;
  line-height: 1.5;
}

.ch-metodologia-panel__list li + li {
  margin-top: 0.25rem;
}

.ch-metodologia-panel__block--excl .ch-metodologia-panel__list {
  color: var(--ch-muted);
}

.ch-metodologia-panel__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ch-metodologia-panel__aviso {
  margin: 0.85rem 0 1rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ch-ink);
}

.ch-metodologia-panel__aviso p {
  margin: 0 0 0.65rem;
}

.ch-metodologia-panel__aviso p:last-child {
  margin-bottom: 0;
}

.ch-metodologia-panel__nested {
  margin: 0 0 1rem;
  border: 1px solid var(--ch-border);
  border-radius: 8px;
  background: var(--sb-bg, #f5f5f5);
}

.ch-metodologia-panel__nested summary {
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
}

.ch-metodologia-panel__nested-body {
  padding: 0 0.85rem 0.85rem;
  max-height: 280px;
  overflow-y: auto;
}

.ch-metodologia-panel__sim-hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--ch-muted);
}

/* Blocos reutilizáveis .ch-metodologia (landing, etc.) */
.ch-metodologia {
  margin: 1.25rem 0 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  background: var(--ch-surface);
  font-size: 0.9rem;
  line-height: 1.55;
}

.ch-metodologia--landing {
  margin-top: 1.5rem;
}

.ch-metodologia__aviso p {
  margin: 0 0 0.65rem;
  color: var(--ch-ink);
}

.ch-metodologia__aviso p:last-child {
  margin-bottom: 0;
}

.ch-metodologia__details-wrap {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ch-metodologia__details {
  border: 1px solid var(--ch-border);
  border-radius: 8px;
  background: var(--sb-bg, #f5f5f5);
}

.ch-metodologia__details summary {
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
}

.ch-metodologia__details-body {
  padding: 0 0.85rem 0.85rem;
}

.ch-metodologia__list {
  margin: 0;
  padding-left: 1.15rem;
}

.ch-metodologia__list li + li {
  margin-top: 0.25rem;
}

.ch-metodologia__familias {
  margin: 0;
}

.ch-metodologia__familia-row {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--ch-border);
}

.ch-metodologia__familia-row:last-child {
  border-bottom: none;
}

.ch-metodologia__familia-row dt {
  margin: 0 0 0.2rem;
  font-weight: 700;
  font-size: 0.84rem;
}

.ch-metodologia__familia-row dd {
  margin: 0;
  color: var(--ch-muted);
  font-size: 0.84rem;
}

.ch-metodologia__pdf {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
}

.ch-metodologia-databadge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.5rem 0 0;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: var(--ch-muted);
  background: var(--ch-hover-data);
  border-radius: 999px;
}

.ch-help {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  margin-left: 0.2rem;
}

.ch-help__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ch-muted);
  cursor: help;
  border-radius: 50%;
}

.ch-help__btn:hover,
.ch-help__btn:focus-visible,
.ch-help.is-open .ch-help__btn {
  color: var(--ch-red);
  outline: none;
  box-shadow: 0 0 0 2px var(--ch-hover-data);
}

.ch-help__tip {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: calc(100% + 0.45rem);
  transform: translateX(-50%);
  width: max-content;
  max-width: min(280px, 85vw);
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--ch-ink);
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.ch-help:hover .ch-help__tip,
.ch-help:focus-within .ch-help__tip,
.ch-help.is-open .ch-help__tip {
  opacity: 1;
  visibility: visible;
}

.ch-metodologia-familia-standard {
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.9rem;
  background: var(--ch-hover-data);
  border-left: 3px solid var(--ch-red);
  border-radius: 0 var(--ch-radius) var(--ch-radius) 0;
}

.ch-metodologia-familia-standard__title {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ch-metodologia-familia-standard--inline {
  margin: 0 0 1.25rem;
}

.ch-metodologia-familia-standard__text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ch-muted);
}

.ch-metodologia-sugerido {
  color: var(--ch-muted);
}

.ch-metodologia-adotado.ch-metodologia-diff .ch-valor,
.ch-metodologia-adotado.ch-metodologia-diff .ch-valor-readonly {
  background: #fff8e6;
  border-color: #e6c200;
}

.ch-metodologia-adotado.ch-metodologia-diff::before {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.25rem;
  border-radius: 50%;
  background: #e6a800;
  vertical-align: middle;
}

.ch-onboarding {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.ch-onboarding[hidden] {
  display: none !important;
}

.ch-onboarding__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 20, 26, 0.55);
}

.ch-onboarding__card {
  position: relative;
  z-index: 1;
  max-width: 420px;
  width: 100%;
  padding: 1.35rem 1.25rem;
  background: var(--ch-surface);
  border-radius: var(--ch-radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.ch-onboarding__title {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.ch-onboarding__steps {
  margin: 0 0 0.85rem;
  padding-left: 1.2rem;
  line-height: 1.55;
  font-size: 0.92rem;
}

.ch-onboarding__steps li + li {
  margin-top: 0.4rem;
}

.ch-onboarding__hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--ch-muted);
}

.ch-print__databadge {
  margin-bottom: 0.5rem;
}

.ch-print__metodologia {
  margin-bottom: 1rem;
}

.ch-print__disclaimer {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #444;
}

@media print {
  .site-header,
  .site-footer,
  .topbar,
  .ch-subnav,
  .ch-toolbar,
  .sim-topbar,
  .nav-actions,
  .horas-slider-row,
  .equip-actions,
  .equip-toggle,
  .total-bar-actions {
    display: none !important;
  }

  body.ch-print {
    font-size: 10pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ch-print {
    padding: 0 0 2.5rem;
  }

  .ch-print__banner {
    margin: 0 0 1.25rem;
    padding: 1rem 0 1.15rem;
    background: #c8102e !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ch-print__banner-titulo,
  .ch-print__banner-secao,
  .ch-print__banner-sub {
    color: #fff !important;
  }

  .ch-print__table thead th {
    background: #f4f4f4 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ch-print__table tbody tr:nth-child(even) td {
    background: #fafafa !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ch-print__table,
  .ch-print__table tr,
  .ch-print__table th,
  .ch-print__table td {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .ch-print__total-val,
  .ch-print__valor-destaque {
    color: #c8102e !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ch-print .nota-legal {
    display: block !important;
    border-left: 3px solid #c8102e !important;
    background: #f4f4f4 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ch-print__resumo {
    border-left: 3px solid #c8102e !important;
    background: #f4f4f4 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ch-print__footer {
    position: fixed;
    background: #fff !important;
    border-top-color: #e0e0e0 !important;
  }

  .ch-metodologia-databadge,
  .ch-print__databadge {
    display: block !important;
    margin-bottom: 0.75rem;
    font-size: 9pt;
  }
}

@media (max-width: 768px) {
  .ch-breakdown__toggle {
    width: 2.75rem;
    height: 2.75rem;
    margin-right: 0.35rem;
  }

  .ch-edit-custo__context {
    flex-direction: column;
    align-items: flex-start;
  }

  .ch-custo-panel__head {
    flex-direction: column;
    align-items: stretch;
  }

  .ch-custo-panel__expand-all {
    width: 100%;
    justify-content: center;
  }

  .ch-expand {
    min-width: 44px;
    min-height: 44px;
    padding: 0.35rem 0.5rem;
  }

  .ch-actions .btn,
  .ch-form-actions .btn {
    min-height: 44px;
    width: 100%;
    justify-content: center;
  }

  .ch-form-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .ch-table {
    font-size: 0.82rem;
  }

  .ch-table th,
  .ch-table td {
    padding: 0.5rem 0.55rem;
  }

  .ch-modal__footer .btn {
    width: 100%;
    justify-content: center;
  }

  .ch-detail-cell {
    padding: 0.75rem;
  }

  .ch-tutorial__embed .issuuembed {
    height: min(680px, 70vh) !important;
  }

  .ch-metodologia-panel__summary {
    padding: 0.75rem 0.85rem;
  }

  .ch-metodologia-panel__grid {
    grid-template-columns: 1fr;
  }

  .ch-metodologia__familia-row {
    grid-template-columns: 1fr;
  }

  .ch-help__tip {
    left: auto;
    right: 0;
    transform: none;
    max-width: min(260px, 90vw);
  }

  .ch-onboarding__card {
    max-width: none;
  }
}

/* —— Edição de custo (planilha estilo legado, visual Sobratema) —— */

.ch-custo-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 1.25rem;
}

.ch-custo-sheet-title {
  margin: 0;
  font-family: var(--ffc, var(--font-main));
  font-size: var(--text-xl, 1.35rem);
  font-weight: 700;
  color: var(--sb-dark);
  line-height: 1.2;
}

.ch-custo-sheet {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ch-custo-ident {
  background: var(--sb-gray-dark, #3c3c3c);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 1rem 1.15rem 1.15rem;
  box-shadow: var(--shadow-sm);
}

.ch-custo-ident__title {
  margin: 0 0 0.85rem;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.72);
}

.ch-custo-ident__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 14px;
}

.ch-custo-ident .field label {
  color: rgba(255, 255, 255, 0.75);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ch-custo-ident .field input,
.ch-custo-ident .field textarea {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--sb-dark);
}

.ch-custo-ident .field input[readonly] {
  background: rgba(255, 255, 255, 0.88);
  color: var(--sb-gray);
  cursor: default;
}

.ch-custo-ident .ch-field--full {
  grid-column: 1 / -1;
}

.ch-custo-config {
  margin: 0;
}

.ch-custo-planilha {
  background: var(--sb-white);
  border: 1px solid var(--sb-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.ch-custo-planilha__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--sb-border);
  background: linear-gradient(180deg, #fafafa 0%, #fff 100%);
}

.ch-custo-planilha__head h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--sb-dark);
}

.ch-custo-planilha__lead {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--sb-gray);
  max-width: 52rem;
}

.ch-custo-legenda {
  margin: 0;
  padding: 0.55rem 1.15rem;
  font-size: 0.78rem;
  color: var(--sb-gray);
  background: var(--sb-gray-light, #f4f4f4);
  border-bottom: 1px solid var(--sb-border);
}

.ch-custo-legenda__ico {
  font-weight: 700;
  color: var(--sb-red);
  font-family: ui-monospace, monospace;
}

.ch-custo-planilha__body {
  padding: 0.75rem 1rem 0.5rem;
  background: #f8f8f8;
}

.ch-custo-footer {
  border-top: 2px solid var(--sb-border);
  background: #fff;
}

.ch-custo-footer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 0.85rem 1.15rem;
  border-top: 1px solid var(--sb-border-light, #ebebeb);
  font-size: 0.9rem;
}

.ch-custo-footer-row:first-child {
  border-top: none;
}

.ch-custo-footer-label {
  font-weight: 600;
  color: var(--sb-dark);
}

.ch-custo-footer-valor {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--sb-red);
  white-space: nowrap;
}

.ch-custo-footer-valor.atualizado {
  animation: sim-pulso 0.35s ease;
}

.ch-custo-footer-unit {
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0.8;
  margin-left: 2px;
}

.ch-custo-footer-row--horario {
  background: var(--sb-red-light);
}

.ch-custo-footer-row--horario .ch-custo-footer-label {
  color: var(--sb-red-dark);
}

.ch-custo-footer-row--obra {
  background: linear-gradient(90deg, var(--sb-red-light) 0%, #fff 100%);
}

.ch-custo-footer-row--obra .ch-custo-footer-valor {
  font-size: 1.5rem;
}

.ch-custo-footer-horas {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(280px, 100%);
}

.ch-custo-footer-horas input[type="range"] {
  flex: 1;
  min-width: 120px;
  accent-color: var(--sb-red);
}

.ch-custo-footer-horas .horas-val {
  min-width: 4.5rem;
  text-align: right;
  font-weight: 700;
  color: var(--sb-dark);
}

.ch-custo-footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 1.15rem;
  background: var(--sb-gray-light, #f4f4f4);
  border-top: 1px solid var(--sb-border);
}

.ch-edit-custo .section-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sb-gray);
  margin: 0 0 0.75rem;
  padding: 0;
}

.ch-edit-custo .badge-red {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  background: var(--sb-red-light);
  color: var(--sb-red);
  border-radius: var(--r-sm);
  padding: 2px 8px;
  vertical-align: middle;
  margin-left: 6px;
}

.ch-edit-custo .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ch-edit-custo .field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--sb-gray);
}

.ch-edit-custo .field input[type="text"],
.ch-edit-custo .field textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font-main);
  color: var(--sb-dark);
  background: var(--sb-white);
  border: 1px solid var(--sb-border);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color 0.15s;
  height: 34px;
}

.ch-edit-custo .field textarea {
  height: auto;
  resize: vertical;
}

.ch-edit-custo .field input:focus,
.ch-edit-custo .field textarea:focus {
  border-color: var(--sb-red);
  box-shadow: 0 0 0 2px var(--sb-red-light);
}

.ch-edit-custo .form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 0;
}

.ch-edit-custo .ch-custo-panel__head.painel-header {
  background: var(--sb-white);
  border-bottom: 1px solid var(--sb-border);
}

.ch-edit-custo .ch-custo-panel__titles h2 {
  font-size: 15px;
  font-weight: 500;
}

.ch-edit-custo .ch-custo-panel__lead.painel-meta {
  font-size: 12px;
  color: var(--sb-gray);
}

.ch-edit-custo .ch-custo-panel__expand-all.btn-ghost {
  background: transparent;
  color: var(--sb-dark);
  border: 1px solid var(--sb-border);
  border-radius: var(--r-md);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
}

.ch-edit-custo .ch-custo-panel__expand-all.btn-ghost:hover {
  border-color: var(--sb-red);
  color: var(--sb-red);
}

.ch-edit-custo .ch-custo-panel__table {
  padding: 0.75rem 1rem 1rem;
  background: var(--sb-white);
}

.ch-edit-custo .sim-custos.ch-breakdown-sim {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ch-edit-custo .custo-grupo.ch-custo-grupo {
  border: 1px solid #e0d5a8;
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ch-edit-custo .grupo-header.ch-breakdown__grupo-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 1rem;
  background: linear-gradient(180deg, #fff8dc 0%, #fff3cd 100%);
  border-bottom: 1px solid #e6c200;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, filter 0.15s;
}

.ch-edit-custo .grupo-header.ch-breakdown__grupo-header:hover {
  filter: brightness(0.98);
}

.ch-edit-custo .grupo-header.is-expanded,
.ch-edit-custo .grupo-header.aberto {
  background: linear-gradient(180deg, #ffe9a8 0%, #ffd966 100%);
  border-bottom-color: #d4a800;
}

.ch-edit-custo .grupo-toggle {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--sb-red);
  min-width: 1.75rem;
}

.ch-edit-custo .grupo-toggle::before {
  content: "[+]";
}

.ch-edit-custo .grupo-header.is-expanded .grupo-toggle::before,
.ch-edit-custo .grupo-header.aberto .grupo-toggle::before {
  content: "[−]";
}

.ch-edit-custo .grupo-titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--sb-dark);
}

.ch-edit-custo .grupo-titulo i {
  font-size: 15px;
  color: var(--sb-red);
}

.ch-edit-custo .grupo-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ch-edit-custo .grupo-subtotal {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--sb-red-dark);
  white-space: nowrap;
}

.ch-edit-custo .grupo-subtotal-unit {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.85;
}

.ch-edit-custo .grupo-body.ch-breakdown__grupo-chunk {
  background: var(--sb-white);
}

.ch-edit-custo .grupo-body.ch-breakdown__grupo-chunk[hidden] {
  display: none !important;
}

.ch-edit-custo .custo-col-header {
  display: grid;
  grid-template-columns: 1fr 120px 120px;
  gap: 8px;
  padding: 0.4rem 1rem;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sb-gray);
  border-top: 1px solid var(--sb-border);
  background: var(--sb-surf2);
}

.ch-edit-custo .custo-row {
  display: grid;
  grid-template-columns: 1fr 120px 120px;
  gap: 8px;
  align-items: center;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--sb-border-light);
  font-size: 13px;
}

.ch-edit-custo .custo-row.par {
  background: var(--sb-surf);
}

.ch-edit-custo .custo-var {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--sb-gray);
}

.ch-edit-custo .custo-var .tooltip-wrap i {
  font-size: 14px;
  color: var(--sb-red);
  cursor: help;
}

.ch-edit-custo .custo-sugerido {
  text-align: right;
  color: var(--sb-gray);
  font-size: 12px;
}

.ch-edit-custo .custo-input input {
  text-align: right;
  font-size: 13px;
  padding: 4px 8px;
  height: 30px;
  border: 1px solid var(--sb-border);
  border-radius: var(--r-sm);
  width: 100%;
  background: var(--sb-white);
  font-family: var(--font-main);
  color: var(--sb-dark);
  outline: none;
}

.ch-edit-custo .custo-input input:focus {
  border-color: var(--sb-red);
  box-shadow: 0 0 0 2px var(--sb-red-light);
}

.ch-edit-custo .custo-input input.editado,
.ch-edit-custo .ch-metodologia-adotado.ch-metodologia-diff .ch-valor {
  border-color: var(--sb-info);
  background: var(--sb-info-bg);
  color: var(--sb-info);
}

.ch-edit-custo .custo-input .ch-valor-readonly {
  display: block;
  text-align: right;
  font-weight: 500;
  color: var(--sb-dark);
}

.ch-edit-custo .ch-metodologia-adotado.ch-metodologia-diff::before {
  display: none;
}

.ch-edit-custo .custo-row.ch-breakdown__tot {
  font-weight: 500;
  color: var(--sb-dark);
}

.ch-edit-custo .custo-row.subtotal-row {
  background: #e8f4fc !important;
  font-weight: 600;
  border-top: 1px solid #b8d4ea !important;
}

.ch-edit-custo .subtotal-valor {
  text-align: right;
  font-weight: 700;
  color: #0c447c;
  font-size: 13px;
}

.ch-edit-custo .tooltip-wrap {
  position: relative;
  display: inline-block;
}

.ch-edit-custo .tooltip-wrap .tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--sb-dark);
  color: #fff;
  font-size: 12px;
  line-height: 1.55;
  padding: 7px 10px;
  border-radius: var(--r-md);
  width: 230px;
  z-index: 200;
  white-space: normal;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}

.ch-edit-custo .tooltip-wrap .tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--sb-dark);
}

.ch-edit-custo .tooltip-wrap:hover .tip {
  display: block;
}

.ch-edit-custo .custo-total-calculado {
  background: var(--sb-red);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 14px;
  font-weight: 500;
}

.ch-edit-custo .custo-total-calculado span:last-child {
  font-size: 22px;
  font-weight: 500;
}

.ch-edit-custo .custo-total-unit {
  font-size: 13px;
  opacity: 0.75;
  margin-left: 2px;
}

.ch-edit-custo .horas-slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0.875rem 1rem;
  background: var(--sb-surf);
  border-radius: var(--r-lg);
  margin: 1rem 0 1.5rem;
  flex-wrap: wrap;
}

.ch-edit-custo .horas-slider-row label {
  font-size: 13px;
  color: var(--sb-gray);
  white-space: nowrap;
}

.ch-edit-custo .horas-slider-row input[type="range"] {
  flex: 1;
  min-width: 100px;
  -webkit-appearance: none;
  height: 4px;
  background: var(--sb-border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.ch-edit-custo .horas-slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--sb-red);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ch-edit-custo .horas-slider-row input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--sb-red);
  border: 2px solid #fff;
  cursor: pointer;
}

.ch-edit-custo .ch-horas-input {
  width: 6.5rem;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--sb-border);
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 500;
  text-align: right;
  background: var(--sb-white);
  color: var(--sb-dark);
}

.ch-edit-custo .ch-horas-input:focus {
  border-color: var(--sb-red);
  box-shadow: 0 0 0 2px var(--sb-red-light);
  outline: none;
}

.ch-edit-custo .horas-val {
  font-size: 15px;
  font-weight: 500;
  min-width: 55px;
  text-align: right;
  white-space: nowrap;
}

.ch-edit-custo .custo-total-obra-txt {
  font-size: 13px;
  color: var(--sb-gray);
  white-space: nowrap;
}

.ch-edit-custo .custo-total-obra-txt strong {
  color: var(--sb-red);
  font-size: 15px;
  font-weight: 500;
}

.ch-edit-custo .ch-horas-hint {
  flex-basis: 100%;
  font-size: 11px;
  color: var(--sb-gray);
  margin-top: -4px;
}

.ch-edit-custo .resultado-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 1.5rem;
}

.ch-edit-custo .res-card {
  background: var(--sb-surf);
  border-radius: var(--r-md);
  padding: 0.875rem 1rem;
}

.ch-edit-custo .rc-label {
  font-size: 11px;
  color: var(--sb-gray);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 5px;
}

.ch-edit-custo .rc-val {
  font-size: 18px;
  font-weight: 500;
  color: var(--sb-dark);
  margin: 0;
  line-height: 1.2;
}

.ch-edit-custo .rc-val.destaque {
  color: var(--sb-red);
  font-size: 24px;
}

.ch-edit-custo .rc-unit {
  font-size: 13px;
  font-weight: 400;
  opacity: 0.75;
}

.ch-edit-custo .total-bar.ch-custo-sticky {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin-top: 0;
  margin-bottom: 0.5rem;
  background: var(--sb-dark);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
}

.ch-edit-custo .total-bar.ch-custo-sticky .total-bar-info {
  flex: 1;
  min-width: 0;
}

.ch-edit-custo .total-bar-label,
.ch-edit-custo .ch-custo-sticky__label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.ch-edit-custo .total-bar-valor,
.ch-edit-custo .ch-custo-sticky__value {
  font-size: 24px;
  font-weight: 500;
  color: var(--sb-red);
  line-height: 1;
}

.ch-edit-custo .total-bar-valor span,
.ch-edit-custo .ch-custo-sticky__value span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 400;
  margin-left: 2px;
}

.ch-edit-custo .total-bar-valor.atualizado {
  animation: ch-pulso-total 0.35s ease;
}

@keyframes ch-pulso-total {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.ch-edit-custo .total-bar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.ch-edit-custo .total-bar-actions .btn-primary,
.ch-edit-custo .total-bar-actions .btn-white {
  background: #fff;
  color: var(--sb-dark);
  border: none;
  border-radius: var(--r-md);
}

.ch-edit-custo .total-bar-actions .btn-primary:hover,
.ch-edit-custo .total-bar-actions .btn-white:hover {
  opacity: 0.88;
  background: #fff;
  color: var(--sb-dark);
}

.ch-edit-custo .total-bar-actions .btn-ghost,
.ch-edit-custo .total-bar-actions .btn-ghost-white,
.ch-edit-custo .total-bar-actions .btn-outline {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--r-md);
}

.ch-edit-custo .total-bar-actions .btn-ghost:hover,
.ch-edit-custo .total-bar-actions .btn-ghost-white:hover,
.ch-edit-custo .total-bar-actions .btn-outline:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.ch-edit-custo .ch-help__btn {
  color: rgba(255, 255, 255, 0.65);
}

.ch-edit-custo .ch-help__btn:hover {
  color: #fff;
}

@media (max-width: 768px) {
  .ch-custo-ident__grid {
    grid-template-columns: 1fr;
  }

  .ch-custo-planilha__head {
    flex-direction: column;
    align-items: stretch;
  }

  .ch-custo-footer-row {
    grid-template-columns: 1fr;
  }

  .ch-custo-footer-valor {
    justify-self: start;
  }

  .ch-custo-footer-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .ch-edit-custo .form-grid-2 {
    grid-template-columns: 1fr;
  }

  .ch-edit-custo .custo-row,
  .ch-edit-custo .custo-col-header {
    grid-template-columns: 1fr 100px;
  }

  .ch-edit-custo .custo-row .custo-sugerido,
  .ch-edit-custo .custo-col-header span:nth-child(2) {
    display: none;
  }

  .ch-edit-custo .resultado-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ch-edit-custo .resultado-grid .res-card:last-child {
    grid-column: 1 / -1;
  }

  .ch-edit-custo .total-bar.ch-custo-sticky {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .ch-edit-custo .total-bar-actions {
    justify-content: center;
    flex-wrap: wrap;
  }
}
