/* ANC Design System 2026.11 — camada visual; não altera conteúdo ou lógica. */
:root{
  color-scheme:light;
  --anc-font-sans:"Segoe UI Variable","Segoe UI",Roboto,Arial,sans-serif;
  --anc-font-mono:"Cascadia Mono",Consolas,monospace;
  --anc-color-primary:var(--bg,var(--cor-primaria,#185c37));
  --anc-color-primary-strong:var(--mg,var(--cor-primaria-escura,#124a2c));
  --anc-color-primary-soft:var(--clg,var(--cor-clara,#eaf4ed));
  --anc-color-canvas:#f5f7f6;
  --anc-color-surface:#fff;
  --anc-color-surface-muted:#f8faf9;
  --anc-color-text:#203129;
  --anc-color-muted:#5d6d64;
  --anc-color-border:#d8e2dc;
  --anc-color-border-strong:#b8c9bf;
  --anc-color-focus:#005fcc;
  --anc-color-success:#17653a;
  --anc-color-warning:#7a5700;
  --anc-color-danger:#922b25;
  --anc-radius-sm:8px;
  --anc-radius-md:12px;
  --anc-radius-lg:16px;
  --anc-radius-pill:999px;
  --anc-shadow-sm:0 1px 2px rgba(19,46,31,.05),0 5px 15px rgba(19,46,31,.05);
  --anc-shadow-md:0 12px 32px rgba(19,46,31,.09);
  --anc-control-height:44px;
  --anc-page-width:1280px;
  --anc-space-1:.25rem;
  --anc-space-2:.5rem;
  --anc-space-3:.75rem;
  --anc-space-4:1rem;
  --anc-space-5:1.5rem;
  --anc-space-6:2rem;
  --anc-transition:160ms ease;
}

*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%;scroll-behavior:smooth}
:where(body){margin:0;font-family:var(--anc-font-sans);line-height:1.55;color:var(--anc-color-text);background:var(--anc-color-canvas)}
:where(main,section,article,aside,header,footer,nav,form,fieldset,div){min-inline-size:0}
:where(img,video,canvas){max-inline-size:100%;height:auto}
:where(h1,h2,h3,h4){line-height:1.2;text-wrap:balance;overflow-wrap:anywhere}
:where(p,li,dd,td,th,label,small){overflow-wrap:anywhere}
:where(a){text-underline-offset:.18em;text-decoration-thickness:.08em}
:where(code,pre,.mono,.codigo){font-family:var(--anc-font-mono)}
:where([hidden],[data-anc-hidden="true"],[data-page-enabled="false"]){display:none!important}

:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{
  outline:3px solid var(--anc-color-focus)!important;
  outline-offset:3px!important;
  box-shadow:0 0 0 2px var(--anc-color-surface),0 0 0 5px var(--anc-color-focus)!important;
}

:where(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),select,textarea){
  min-block-size:var(--anc-control-height);
  max-inline-size:100%;
  border:1px solid var(--anc-color-border-strong);
  border-radius:var(--anc-radius-sm);
  background:var(--anc-color-surface);
  color:var(--anc-color-text);
  font:inherit;
}
:where(textarea){resize:vertical;line-height:1.5}
:where(button,.btn,.button,[role="button"],input[type="submit"],input[type="button"]){
  min-block-size:var(--anc-control-height);
  max-inline-size:100%;
  border-radius:var(--anc-radius-sm);
  font-family:inherit;
  font-weight:700;
  line-height:1.2;
  transition:background-color var(--anc-transition),border-color var(--anc-transition),box-shadow var(--anc-transition),transform var(--anc-transition);
}
:where(button,.btn,.button,[role="button"]):not(:disabled):hover{box-shadow:var(--anc-shadow-sm)}
:where(button,.btn,.button,[role="button"]):disabled{cursor:not-allowed;opacity:.58}

:where(.card,.painel,.panel,.cartao,.box,.anc-card,.pl-card,.pl-section){
  min-inline-size:0;
  border-color:var(--anc-color-border);
  border-radius:var(--anc-radius-md);
  background:var(--anc-color-surface);
  box-shadow:var(--anc-shadow-sm);
}
:where(.grid,.grade,.cards,.card-grid,.admin-dashboard,.metrics){min-inline-size:0;gap:var(--anc-space-4)}
:where(.grid,.grade,.cards,.card-grid,.admin-dashboard,.metrics)>*{min-inline-size:0}
:where(.acoes,.actions,.botoes,.button-row,.admin-header-actions){display:flex;flex-wrap:wrap;gap:var(--anc-space-2);align-items:center}

:where(.alert,.aviso,.msg,.mensagem,.notice,.pl-alert){
  border:1px solid var(--anc-color-border);
  border-radius:var(--anc-radius-sm);
  padding:var(--anc-space-3) var(--anc-space-4);
  line-height:1.45;
}
:where(.badge,.tag,.pill,.status,.pl-tag){border-radius:var(--anc-radius-pill);font-weight:700}
:where(.empty,.estado-vazio,.sem-dados,.empty-state,.pl-empty){
  padding:clamp(1.25rem,4vw,2.5rem);
  border:1px dashed var(--anc-color-border-strong);
  border-radius:var(--anc-radius-md);
  background:var(--anc-color-surface-muted);
  color:var(--anc-color-muted);
  text-align:center;
}

:where(.table-responsive,.table-wrap,.tabela-rolavel,.scroll,.pl-table-wrap,.anc-table-scroll){
  max-inline-size:100%;
  overflow-x:auto;
  overflow-y:visible;
  overscroll-behavior-inline:contain;
  scrollbar-gutter:stable;
  -webkit-overflow-scrolling:touch;
}
:where(table){max-inline-size:100%;border-collapse:collapse;background:var(--anc-color-surface)}
:where(th,td){vertical-align:top}
:where(thead th){font-weight:800}
:where(tbody tr){transition:background-color var(--anc-transition)}
:where(tbody tr:hover){background:var(--anc-color-surface-muted)}

:where(dialog,.modal-content,[role="dialog"]:not(.md-overlay):not(.modal-fundo):not(#anc-doc-modal)){
  max-inline-size:min(92vw,920px);
  max-block-size:min(90vh,840px);
  border:1px solid var(--anc-color-border);
  border-radius:var(--anc-radius-lg);
  background:var(--anc-color-surface);
  box-shadow:var(--anc-shadow-md);
}
:where(dialog)::backdrop{background:rgba(17,31,23,.62);backdrop-filter:blur(2px)}
:where(.modal-body,.dialog-body,[role="dialog"]>.body){max-block-size:calc(90vh - 8rem);overflow:auto;overscroll-behavior:contain}

@media(max-width:720px){
  :root{--anc-space-5:1.125rem;--anc-space-6:1.5rem}
  :where(.acoes,.actions,.botoes,.button-row,.admin-header-actions){align-items:stretch}
  :where(.acoes,.actions,.botoes,.button-row,.admin-header-actions)>:where(button,.btn,.button,form){max-inline-size:none}
  :where(dialog,.modal-content,[role="dialog"]:not(.md-overlay):not(.modal-fundo):not(#anc-doc-modal)){max-inline-size:calc(100vw - 16px);max-block-size:calc(100dvh - 16px);border-radius:var(--anc-radius-md)}
}

@media(prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  *,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}

@media(forced-colors:active){
  :where(.card,.painel,.panel,.cartao,.box,.anc-card,.pl-card,.pl-section,.alert,.aviso,.msg){border:1px solid CanvasText}
}

@media print{
  :where(body){background:#fff;color:#000}
  :where(.card,.painel,.panel,.cartao,.box,.anc-card,.pl-card,.pl-section){box-shadow:none}
}

/* Integrações com os nomes existentes dos módulos. Especificidade intencional:
   a camada continua efetiva mesmo quando importada antes da folha legada. */
body :is(.card,.painel,.panel,.cartao,.box,.anc-card,.pl-card,.pl-section,.protocolo-card,.tp-card){
  min-width:0;
  border-color:var(--anc-color-border);
  border-radius:var(--anc-radius-md);
  box-shadow:var(--anc-shadow-sm);
}
body :is(.grid,.grade,.cards,.card-grid,.admin-dashboard,.metrics,.tp-grade,.pl-grid)>*{min-width:0}
body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),select,textarea,.form-control,.form-select){
  min-height:var(--anc-control-height);
  max-width:100%;
  border-color:var(--anc-color-border-strong);
  border-radius:var(--anc-radius-sm);
}
body :is(button,.btn,.button,.pl-button,[role="button"]){min-height:var(--anc-control-height);border-radius:var(--anc-radius-sm)}
body :is(.table-responsive,.table-wrap,.tabela-wrap,.tabela-rolavel,.scroll,.pl-table-wrap){
  max-width:100%;
  overflow-x:auto;
  overscroll-behavior-inline:contain;
  scrollbar-gutter:stable both-edges;
}
body :is(.modal-content,.modal-conteudo,.detalhes-modal,[role="dialog"]){border-radius:var(--anc-radius-lg);box-shadow:var(--anc-shadow-md)}
body .tp-icone{font-size:0!important;width:36px;height:36px;display:grid;place-items:center;border-radius:10px;background:var(--anc-color-primary-soft)}
body .tp-icone::before{content:"";width:12px;height:12px;border:2px solid var(--anc-color-primary);border-radius:3px;box-shadow:5px 5px 0 -3px var(--anc-color-primary)}
body .pl-main{width:min(calc(100% - 24px),var(--anc-page-width))}
body .pl-header nav a{min-height:var(--anc-control-height);display:flex;align-items:center;justify-content:center}
body .pl-empty{background:var(--anc-color-surface-muted);border-color:var(--anc-color-border-strong)}

@media(max-width:720px){
  body :is(.grid,.grade,.cards,.card-grid,.admin-dashboard,.metrics){grid-template-columns:1fr}
  body :is(.acoes,.actions,.botoes,.button-row,.admin-header-actions)>*{min-width:0}
}

/* Organização progressiva: conteúdo simples primeiro e auditoria sob demanda. */
.anc-ux-breadcrumb{
  width:min(calc(100% - 32px),var(--anc-page-width));
  margin:var(--anc-space-3) auto;
  color:var(--anc-color-muted);
  font-size:.875rem;
}
.anc-ux-breadcrumb ol{display:flex;flex-wrap:wrap;gap:.35rem;margin:0;padding:0;list-style:none}
.anc-ux-breadcrumb li{display:inline-flex;align-items:center;gap:.35rem;min-width:0}
.anc-ux-breadcrumb li+li::before{content:"/";color:var(--anc-color-border-strong)}
.anc-ux-breadcrumb [aria-current="page"]{font-weight:700;color:var(--anc-color-text)}
.anc-ux-breadcrumb a{color:var(--anc-color-primary-strong)}

body .anc-ux-filters{
  min-width:0;
  gap:var(--anc-space-3);
  border-color:var(--anc-color-border);
}
body .anc-ux-filters :is(input,select,textarea,button){width:100%;min-width:0}
body .anc-ux-actions{display:flex;flex-wrap:wrap;align-items:center;gap:var(--anc-space-2)}
body .anc-ux-actions>*{min-width:0}
body .anc-ux-actions-many>[data-anc-priority="secondary"]{background:var(--anc-color-surface);color:var(--anc-color-primary-strong);border:1px solid var(--anc-color-border-strong)}
body .anc-ux-actions-many>[data-anc-priority="secondary"]:first-of-type{margin-inline-start:var(--anc-space-2)}

body .anc-ux-technical{
  margin-block:var(--anc-space-3);
  border:1px solid var(--anc-color-border);
  border-radius:var(--anc-radius-sm);
  background:var(--anc-color-surface-muted);
}
body .anc-ux-technical>summary{cursor:pointer;padding:var(--anc-space-3) var(--anc-space-4);font-weight:750;color:var(--anc-color-primary-strong)}
body .anc-ux-technical[open]>summary{border-bottom:1px solid var(--anc-color-border)}
body .anc-ux-technical>:not(summary){margin-inline:var(--anc-space-4)}
body .anc-ux-evidence-item{color:var(--anc-color-muted);font-size:.875rem;line-height:1.45}
body .anc-ux-empty{max-width:none!important;padding:clamp(1.25rem,4vw,2.5rem)!important;border:1px dashed var(--anc-color-border-strong)!important;border-radius:var(--anc-radius-md)!important;background:var(--anc-color-surface-muted)!important;color:var(--anc-color-muted)!important;text-align:center!important}
body .anc-ux-table{margin-block:var(--anc-space-2);border:1px solid var(--anc-color-border);border-radius:var(--anc-radius-sm)}
body .anc-ux-table:focus-visible{outline-offset:2px!important}
body a[data-anc-external="1"]:not(.hfe-menu-item):not(.hfe-sub-menu-item)::after{content:" \2197";font-size:.8em;text-decoration:none}
body #masthead a.hfe-menu-item[data-anc-external="1"]::after,
body #masthead a.hfe-sub-menu-item[data-anc-external="1"]::after{content:none!important;display:none!important}
body:not(.anc-admin-unified) [data-anc-review-state="draft"],
body:not(.anc-admin-unified) [data-anc-review-state="rascunho"],
body:not(.anc-admin-unified) [data-anc-review-state="template"],
body:not(.anc-admin-unified) [data-anc-review-state="modelo"],
body:not(.anc-admin-unified) [data-anc-review-state="pending"],
body:not(.anc-admin-unified) [data-anc-review-state="pendente"],
body:not(.anc-admin-unified) [data-anc-review-state="revisao"],
body:not(.anc-admin-unified) [data-anc-review-state="revisão"]{display:none!important}
body.anc-admin-unified .anc-review-pending{position:relative;border:1px dashed #a56a00!important;background:#fffaf0!important}
body.anc-admin-unified .anc-review-badge{display:table;margin:0 0 var(--anc-space-2);padding:.25rem .6rem;border-radius:var(--anc-radius-pill);background:#fff0c2;color:#654500;font-size:.75rem;font-weight:800;line-height:1.3}

@media(max-width:720px){
  .anc-ux-breadcrumb{width:min(calc(100% - 20px),var(--anc-page-width));font-size:.8125rem}
  body .anc-ux-actions{align-items:stretch}
  body .anc-ux-actions>*{flex:1 1 min(100%,15rem)}
  body .anc-ux-actions-many>[data-anc-priority="secondary"]:first-of-type{margin-inline-start:0}
  body .anc-ux-filters{grid-template-columns:1fr!important}
}
