  /* ---------- movimento (Design System GRC, secao 6) ---------- */
  :root {
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --d1: 150ms; /* hover, foco, cor */
    --d2: 300ms; /* elevacao, deslocamento */
    --d3: 600ms; /* entrada de bloco */
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--page);
    color: var(--text-primary);
    padding: 24px;
    min-height: 100vh;
  }
  .wrap { max-width: 1180px; margin: 0 auto; }

  header.top {
    display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;
    justify-content: space-between; margin-bottom: 20px;
  }
  .top h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
  .top .sub { color: var(--text-secondary); font-size: 13.5px; margin-top: 4px; }
  .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

  /* Marca do Setor de Dados: link de volta ao portal DataHub (site oficial).
     A logo tem texto navy escuro, entao fica sempre sobre placa branca —
     assim le igual no modo escuro (sem virar um borrao sobre --surface-1). */
  .top-brand { display: flex; align-items: center; gap: 16px; }
  .brand-link {
    display: inline-flex; flex: 0 0 auto; padding: 6px 10px;
    background: #fff; border: 1px solid var(--border); border-radius: var(--raio-m);
    transition: border-color var(--d1) var(--ease);
  }
  .brand-link:hover { border-color: var(--baseline); }
  .brand-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .brand-logo { display: block; height: 44px; width: auto; }
  .portal-link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
  .portal-link svg { flex: 0 0 auto; }

  button, .btn {
    font: inherit; font-size: 13.5px; font-weight: 550;
    border: 1px solid var(--border); border-radius: var(--raio-m);
    background: var(--surface-1); color: var(--text-primary);
    padding: 8px 16px; min-height: 36px; cursor: pointer;
    transition: border-color var(--d1) var(--ease), background var(--d1) var(--ease), color var(--d1) var(--ease);
  }
  button:hover, .btn:hover { border-color: var(--baseline); }
  button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  button.primary, .btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
  button.primary:hover, .btn.primary:hover { filter: brightness(1.06); }
  button.ghost, .btn.ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
  button.ghost:hover, .btn.ghost:hover { background: var(--series-1-wash); color: var(--text-primary); }
  button.danger-armed { background: #d03b3b; border-color: transparent; color: #fff; }
  button:disabled, input:disabled, select:disabled { opacity: 0.6; cursor: not-allowed; }

  /* ---------- KPI row ---------- */
  .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 12px; }
  .tile {
    background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--raio-l);
    padding: 16px 18px; box-shadow: var(--card-shadow);
  }
  .tile .label { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 6px; }
  .tile .value { font-size: 27px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
  .tile .value.hero { font-size: 34px; }
  .tile .value.pair { font-size: 22px; line-height: 1.35; white-space: nowrap; }
  .kpis.pares { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

  /* filtro */
  .filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
  .filter-row label { font-size: 13px; font-weight: 550; color: var(--text-secondary); }
  .filter-row select {
    width: auto; min-width: 220px; background: var(--surface-1);
    border: 1px solid var(--border); font-weight: 550;
  }
  .tile .delta { font-size: 12.5px; margin-top: 5px; color: var(--text-muted); }
  .tile .delta .up { color: var(--good-text); font-weight: 550; }

  /* ---------- cards / charts ---------- */
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
  @media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }
  .card {
    background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--raio-l);
    padding: 18px; box-shadow: var(--card-shadow);
  }
  .card h2 { font-size: 14.5px; font-weight: 600; }
  .card .cap { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; margin-bottom: 14px; }
  .card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }

  /* horizontal bars */
  .hbar-row { display: grid; grid-template-columns: minmax(90px, 170px) 1fr; gap: 10px; align-items: center; margin-bottom: 10px; }
  .hbar-name { font-size: 12.5px; color: var(--text-secondary); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hbar-track { position: relative; height: 22px; display: flex; align-items: center; }
  .hbar-fill {
    height: 18px; max-height: 18px; border-radius: 0 4px 4px 0;
    background: var(--series-1); min-width: 2px;
    transition: width var(--d2) var(--ease);
  }
  .hbar-fill.pot { background: var(--deemph); }
  .hbar-val { font-size: 12px; font-weight: 550; color: var(--text-primary); margin-left: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .hbar-axis { border-left: 1px solid var(--baseline); }
  .seg-wrap { display: flex; gap: 2px; height: 18px; }
  .seg { height: 18px; min-width: 2px; }
  .seg.first { border-radius: 0; }
  .seg.last { border-radius: 0 4px 4px 0; }

  .legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
  .legend .li { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
  .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

  /* line chart */
  .linechart-box { position: relative; }
  svg text { font-family: inherit; }
  .tooltip {
    position: absolute; pointer-events: none; z-index: 30;
    background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--raio-m);
    box-shadow: var(--card-shadow);
    padding: 8px 11px; font-size: 12px; color: var(--text-secondary);
    white-space: nowrap; display: none;
  }
  .tooltip b { color: var(--text-primary); font-weight: 600; display: block; font-size: 12.5px; }

  .empty { color: var(--text-muted); font-size: 13px; padding: 18px 0; text-align: center; }

  /* ---------- table ---------- */
  table { width: 100%; border-collapse: collapse; font-size: 13px; }
  th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
       color: var(--text-muted); font-weight: 550; padding: 8px 10px; border-bottom: 1px solid var(--grid); }
  td { padding: 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
  td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
  tr.proc-row { cursor: pointer; }
  tr.proc-row:hover td { background: var(--series-1-wash); }
  tr.detail-row td { background: color-mix(in srgb, var(--page) 60%, var(--surface-1)); padding: 6px 10px 14px; }
  .emp-table { margin-top: 6px; }
  .emp-table td, .emp-table th { border-bottom: 1px dashed var(--grid); padding: 6px 10px; font-size: 12.5px; }

  /* .chip: rotulo com bolinha de cor definida inline pelo chamador (status legado). */
  .chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 550;
          padding: 3px 10px 3px 8px; border-radius: 999px; border: 1px solid var(--border); }
  .chip .dot { width: 8px; height: 8px; border-radius: 50%; }

  /* .status-pill: padrao DataHub para estados (secao 1.5) — cor + rotulo em texto, nunca so cor. */
  .status-pill {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; line-height: 1.4;
    padding: 3px 10px 3px 8px; border-radius: 999px;
  }
  .status-pill::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%;
    background: currentColor; flex: none;
  }
  .status-pill.-ok { color: var(--status-good); background: color-mix(in srgb, var(--status-good) 12%, transparent); }
  .status-pill.-atencao { color: var(--status-warning); background: color-mix(in srgb, var(--status-warning) 12%, transparent); }
  .status-pill.-neutro { color: var(--text-muted); background: color-mix(in srgb, var(--text-muted) 10%, transparent); }
  .status-pill.-erro { color: var(--status-serious); background: color-mix(in srgb, var(--status-serious) 12%, transparent); }

  /* .row-caret: wrapper do icone SVG de expandir/colapsar linha da tabela. */
  .row-caret { display: inline-flex; transition: transform var(--d2) var(--ease); }
  [aria-expanded="true"] .row-caret { transform: rotate(90deg); }

  .proc-name { font-weight: 600; }
  .muted { color: var(--text-muted); }
  .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
  .row-actions button { padding: 8px 12px; font-size: 12px; min-height: 36px; min-width: 36px; display: inline-flex; align-items: center; justify-content: center; }

  /* ---------- modal ---------- */
  .overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.38); z-index: 100;
    display: none; align-items: flex-start; justify-content: center; padding: 4vh 16px; overflow-y: auto;
  }
  .overlay.open { display: flex; }
  .modal {
    background: var(--surface-1); border-radius: var(--raio-l); width: 100%; max-width: 720px;
    padding: 24px; border: 1px solid var(--border);
  }
  .modal h2 { font-size: 17px; margin-bottom: 4px; }
  .modal .hint { font-size: 12.5px; color: var(--text-muted); margin-bottom: 18px; }
  .frow { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
  .fgroup label { display: block; font-size: 12px; font-weight: 550; color: var(--text-secondary); margin-bottom: 4px; }
  input, select {
    font: inherit; font-size: 13.5px; width: 100%;
    border: 1px solid var(--baseline); border-radius: var(--raio-m);
    background: var(--page); color: var(--text-primary); padding: 8px 10px;
    transition: border-color var(--d1) var(--ease), outline-color var(--d1) var(--ease);
  }
  input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
  .emp-editor { border: 1px solid var(--grid); border-radius: var(--raio-m); padding: 12px; margin-bottom: 10px; }
  .emp-editor .frow { margin-bottom: 0; }
  .emp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .emp-head .t { font-size: 12px; font-weight: 600; color: var(--text-muted); }
  .modal-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; }
  .modal-actions .right { display: flex; gap: 8px; }
  details.params { margin: 4px 0 14px; }
  details.params summary { font-size: 12.5px; color: var(--text-secondary); cursor: pointer; }
  details.params .frow { margin-top: 10px; }
  .calc-preview {
    background: var(--series-1-wash); border-radius: var(--raio-m); padding: 12px 14px;
    font-size: 13px; color: var(--text-secondary); margin-top: 6px;
  }
  .calc-preview b { color: var(--text-primary); }

  footer { margin-top: 18px; font-size: 12px; color: var(--text-muted); text-align: center; }

  /* ---------- tabs ---------- */
  .tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--grid); }
  .tab {
    font: inherit; font-size: 14px; font-weight: 550; cursor: pointer;
    background: none; border: none; border-radius: 0; color: var(--text-muted);
    padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: color var(--d1) var(--ease), border-color var(--d1) var(--ease);
  }
  .tab:hover { color: var(--text-primary); border-color: transparent; }
  .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }
  .view { display: none; }
  .view.active { display: block; }

  /* cadastro */
  .prov-row-grid { display: grid; grid-template-columns: 40px 1fr 200px 110px; gap: 10px; align-items: center; }
  .switch { position: relative; width: 34px; height: 20px; flex: none; }
  .switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
  .switch .trk { position: absolute; inset: 0; border-radius: 999px; background: var(--baseline); transition: background var(--d1) var(--ease); }
  .switch .trk::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform var(--d1) var(--ease); }
  .switch input:checked + .trk { background: var(--accent); }
  .switch input:checked + .trk::after { transform: translateX(14px); }
  .switch input:focus-visible + .trk { outline: 2px solid var(--accent); outline-offset: 2px; }
  .switch input:disabled { opacity: 0; }
  .switch input:disabled + .trk { opacity: 0.6; cursor: not-allowed; }
  .prov-off { opacity: .45; }
  .cfg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  @media (max-width: 900px) { .cfg-grid { grid-template-columns: 1fr; } }
  .pill-total {
    display: inline-block; background: var(--series-1-wash); color: var(--text-primary);
    border-radius: 999px; padding: 4px 14px; font-size: 13px; font-weight: 600;
  }

  /* ---------- acessibilidade: movimento reduzido (secao 6.8 / 7, bloco fixo) ---------- */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.001ms !important;
      animation-delay: 0s !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.001ms !important;
      transition-delay: 0s !important;
      scroll-behavior: auto !important;
    }
  }
