/* ===========================================================================
   SmartCartório — sistema visual da aplicacao (sobre brand/tokens.css)
   Shell e acoes seguem a skin; o lima permanece reservado a IA aguardando validacao.

   REGRA: nao escrever cor literal aqui. Use os papeis --nf-action, --nf-shell e derivados.
   Use var(--nf-*); para versoes translucidas, use color-mix() com uma cor solida
   declarada antes como fallback.
   =========================================================================== */

html, body {
    margin: 0;
    background-color: var(--nf-paper);
    color: var(--nf-ink);
    font-family: var(--nf-font-sans);
    -webkit-font-smoothing: antialiased;
}

body {
    /* Pintado no proprio body: uma pseudo-camada com z-index negativo ficaria atras do fundo
       opaco. Sem criar contexto de empilhamento, os popovers permanecem livres. */
    background-image:
        radial-gradient(900px 500px at 100% -10%,
            color-mix(in srgb, var(--nf-accent) 6%, transparent), transparent 60%),
        radial-gradient(700px 500px at -10% 110%,
            color-mix(in srgb, var(--nf-secondary-accent) 8%, transparent), transparent 60%);
    background-attachment: fixed;
}

::selection { background: var(--nf-action); color: var(--nf-action-on); }

button:focus-visible,
a:focus-visible,
.nf-skin-cor:focus-visible,
.nf-skin-fonte:focus-visible {
    outline: 3px solid var(--nf-focus);
    outline-offset: 2px;
    outline-color: var(--nf-focus) !important;
}

a { color: var(--nf-action); }

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.nf-skip-link {
    position: fixed;
    top: .5rem;
    left: .75rem;
    z-index: 2000;
    padding: .6rem .9rem;
    border-radius: var(--nf-radius-xs);
    background: var(--nf-surface);
    color: var(--nf-action);
    box-shadow: var(--nf-shadow);
    transform: translateY(-180%);
    transition: transform .15s ease;
}
.nf-skip-link:focus { transform: translateY(0); }

.nf-mono, .nf-mono * {
    font-family: var(--nf-font-mono) !important;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
}

.nf-container {
    width: 100%;
    max-width: 80rem;
    min-width: 0;
    margin-inline: auto;
    padding-inline: clamp(.85rem, 2.5vw, 1.75rem);
    box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   APP BAR + marca
   -------------------------------------------------------------------------- */
.nf-appbar {
    background: var(--nf-shell) !important;
    color: var(--nf-shell-on) !important;
    border-bottom: 1px solid var(--nf-shell-border);
    box-shadow: 0 1px 0 color-mix(in srgb, var(--nf-gold) 35%, transparent) !important;
}
.nf-appbar-centered {
    display: grid !important;
    grid-template-columns: max-content minmax(0, 1fr) max-content;
    align-items: center;
    gap: .5rem;
    overflow: visible;
}
.nf-header-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
}
.nf-header-brand:hover, .nf-header-brand:focus { text-decoration: none; }
.nf-header-actions {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .2rem;
    white-space: nowrap;
}
.nf-header-actions form { display: inline-flex; margin: 0; }
.nf-shell-action {
    min-width: 2.5rem;
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    border: 1px solid transparent;
    border-radius: var(--nf-radius-xs);
    background: transparent;
    color: var(--nf-shell-on);
    font: inherit;
    cursor: pointer;
}
.nf-shell-action:hover { background: var(--nf-shell-hover); }
.nf-menu-toggle { color: var(--nf-shell-on) !important; }
.nf-menu-toggle-compact-only { display: none !important; }
.nf-brand { display: flex; align-items: center; gap: .6rem; margin-left: .25rem; }
.nf-brand-lockup {
    display: inline-flex;
    align-items: center;
    flex: none;
    max-width: 100%;
    font-family: var(--nf-font-brand);
    line-height: 1;
    white-space: nowrap;
}
.nf-brand-name {
    display: inline-flex;
    align-items: center;
    font-size: 1em;
    font-weight: 700;
    letter-spacing: -.04em;
    color: var(--nf-brand-shell-on);
}
.nf-brand-cartorio {
    font-weight: 400;
    color: var(--nf-brand-shell-accent);
}
.nf-brand-ianr {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    align-self: center;
    gap: .06em;
    margin-left: .16em;
    padding-left: .14em;
    border-left: 2px solid var(--nf-ai-pending);
    font-size: max(.46875rem, .3em);
    font-weight: 700;
    letter-spacing: .06em;
    line-height: 1;
}
.nf-brand-ia { color: var(--nf-ai-pending); }
.nf-brand-nr { color: var(--nf-brand-shell-accent); }
.nf-brand-compact {
    width: 2.375rem;
    height: 2.375rem;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .12rem;
    border-radius: var(--nf-radius-sm);
    background: var(--nf-brand-shell);
    color: var(--nf-brand-shell-on);
}
.nf-brand-sc {
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -.02em;
}
.nf-brand-compact-ia {
    color: var(--nf-ai-pending);
    font-size: .46875rem;
    font-weight: 700;
    letter-spacing: .06em;
}
.nf-brand-mark {
    max-width: 250px;
    align-self: flex-start;
    font-size: 1.35rem;
}
/* Tracking: Tahoma ja e compacta. Os valores negativos aqui eram para apertar a Schibsted
   Grotesk; mantidos como estavam, as letras do wordmark encostam. */
.nf-brand-word {
    font-family: var(--nf-font-display);
    font-weight: 700; font-size: 1.3rem; letter-spacing: -.01em; color: var(--nf-shell-on);
}
/* Barra escura -> acento claro; barra colorida -> branco translucido (ver --nf-shell-accent). */
.nf-flow { color: var(--nf-shell-accent); }
.nf-user {
    font-size: .82rem; color: var(--nf-shell-muted); margin-right: .75rem;
    font-variant: small-caps; letter-spacing: .02em;
}

/* --------------------------------------------------------------------------
   DRAWER
   -------------------------------------------------------------------------- */
.nf-drawer {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--nf-shell) 70%, var(--nf-black)) transparent;
}
.nf-drawer::-webkit-scrollbar { width: 5px; }
.nf-drawer::-webkit-scrollbar-track { background: transparent; }
.nf-drawer::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--nf-shell) 70%, var(--nf-black)); border-radius: 999px; }
.nf-drawer::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--nf-shell) 55%, var(--nf-black)); }
.nf-drawer-foot {
    margin-top: auto; padding: 1rem 1.25rem;
    font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
    color: var(--nf-shell-muted); display: flex; align-items: center; gap: .5rem;
    border-top: 1px solid var(--nf-shell-border);
}
.nf-seal-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--nf-gold); box-shadow: 0 0 0 3px var(--nf-gold-soft);
}

.nf-user-strip {
    display: flex;
    align-items: center;
    gap: .4rem;
    min-height: 1.5rem;
    padding: .15rem 1rem;
    background: color-mix(in srgb, var(--nf-shell) 92%, var(--nf-shell-on));
    color: var(--nf-shell-muted);
    border-bottom: 1px solid var(--nf-shell-border);
    font-size: .7rem;
    line-height: 1.2;
}
.nf-user-strip-text { max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nf-user-strip-sep { opacity: .5; }

/* Menus superiores usam o top layer do Popover API; assim nao sao recortados pelo
   trilho horizontal quando a janela fica estreita. */
.nf-headernav {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}
.nf-headernav::-webkit-scrollbar { display: none; }
.nf-headernav-track { display: flex; align-items: center; gap: .15rem; min-width: max-content; }
.nf-headernav[data-overflow-start="true"] { box-shadow: inset 16px 0 14px -14px var(--nf-shell-on); }
.nf-headernav[data-overflow-end="true"] { background-image: linear-gradient(90deg, transparent calc(100% - 20px), color-mix(in srgb, var(--nf-shell) 16%, var(--nf-shell-on))); }
.nf-hn-dropdown { display: inline-flex; }
.nf-hn-trigger {
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .35rem .6rem;
    border: 0;
    border-radius: var(--nf-radius-xs);
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: .8125rem;
    white-space: nowrap;
    cursor: pointer;
}
.nf-hn-trigger:hover,
.nf-hn-trigger[aria-expanded="true"] { background: var(--nf-shell-hover); }
.nf-hn-arrow { font-size: .6rem; transition: transform .15s ease; }
.nf-hn-trigger[aria-expanded="true"] .nf-hn-arrow { transform: rotate(180deg); }
.nf-hn-menu[popover] {
    position: fixed;
    inset: unset;
    width: max-content;
    min-width: 13rem;
    max-width: min(24rem, calc(100vw - 1rem));
    margin: 0;
    padding: .35rem;
    overflow-y: auto;
    border: 1px solid var(--nf-line);
    border-radius: var(--nf-radius-sm);
    background: var(--nf-surface);
    color: var(--nf-ink);
    box-shadow: var(--nf-shadow);
}
.nf-hn-menu[hidden] { display: none; }
.nf-dropdown-item,
.nf-noti-item-wrap {
    width: 100%;
    display: flex;
    box-sizing: border-box;
    padding: .55rem .7rem;
    border: 0;
    border-radius: var(--nf-radius-xs);
    background: transparent;
    color: var(--nf-ink);
    font: inherit;
    font-size: .8125rem;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.nf-dropdown-item:hover,
.nf-dropdown-item:focus,
.nf-noti-item-wrap:hover,
.nf-noti-item-wrap:focus { background: var(--nf-action-soft); text-decoration: none; }


/* --------------------------------------------------------------------------
   SELETOR DE COMPETENCIA
   -------------------------------------------------------------------------- */
.nf-competency-strip {
    width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box;
    min-height: 52px; padding: .55rem 1rem; display: flex; align-items: center;
    gap: .55rem; flex-wrap: wrap; background: var(--nf-surface);
    border-bottom: 1px solid var(--nf-action-line);
}
.nf-competency-label {
    color: var(--nf-muted); font-family: var(--nf-font-mono); font-size: .68rem;
    letter-spacing: .14em; text-transform: uppercase; margin-right: .25rem;
}
.nf-competency-disabled { display: inline-flex; cursor: not-allowed; }
.nf-competency-status {
    margin-left: .45rem; font-size: .62rem; letter-spacing: .06em; text-transform: uppercase;
}
.nf-competency-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
    padding: .3rem .75rem;
    border: 1px solid var(--nf-action-line);
    border-radius: 999px;
    color: var(--nf-action);
    font-size: .82rem;
    font-weight: 650;
    text-decoration: none;
}
.nf-competency-link:hover { background: var(--nf-action-soft); text-decoration: none; }

@media (max-width: 900px) {
    .nf-menu-toggle-compact-only { display: inline-flex !important; }
    .nf-headernav { display: none; }
    .nf-appbar-centered { grid-template-columns: max-content minmax(0, 1fr) max-content; }
    .nf-header-brand .nf-brand-mark { max-width: 9rem; font-size: 1.15rem; }
    .nf-user, .nf-logout-text { display: none !important; }
}

@media (max-width: 520px) {
    .nf-layout > .nf-appbar { padding-inline: .55rem; }
    .nf-header-brand .nf-brand-mark { max-width: 7.5rem; font-size: 1rem; }
    .nf-competency-strip { padding-inline: .75rem; }
}

/* --------------------------------------------------------------------------
   LOGIN — cartao de duas faces (tinta + papel), centralizado
   -------------------------------------------------------------------------- */
.nf-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    box-sizing: border-box;
}
.nf-login * { box-sizing: border-box; }

.nf-auth {
    width: min(920px, 100%);
    display: flex;
    min-height: 540px;
    background: var(--nf-surface);
    border: 1px solid var(--nf-line);
    border-radius: 22px;
    box-shadow: 0 30px 70px var(--nf-auth-shadow);
    overflow: hidden;
    animation: nf-rise .55s ease both;
}

/* face escura da marca. Usa --nf-shell (nao --nf-ink): a tinta inverte no modo escuro
   e deixaria esta face clara com o texto claro por cima. */
.nf-auth-brand {
    flex: 0 0 45%;
    position: relative;
    overflow: hidden;
    background: var(--nf-brand-shell);
    color: var(--nf-brand-shell-on);
    padding: 3rem 2.6rem;
    display: flex;
    flex-direction: column;
}
.nf-auth-brand::after {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(620px 420px at 12% 0%,
        color-mix(in srgb, var(--nf-brand-action) 42%, transparent), transparent 62%);
    pointer-events: none;
}
.nf-auth-brandtop { position: relative; z-index: 1; }
.nf-auth-mark { max-width: 100%; align-self: flex-start; font-size: 2rem; }
.nf-auth-word {
    font-family: var(--nf-font-display);
    font-weight: 700; font-size: 1.85rem; letter-spacing: -.01em; line-height: 1.16;
    margin: 1rem 0 0;
}
.nf-auth-word:focus-visible {
    outline: 3px solid var(--nf-focus);
    outline-offset: .35rem;
    border-radius: var(--nf-radius-xs);
}
.nf-auth-tag {
    color: var(--nf-brand-shell-muted); max-width: 28ch; line-height: 1.6; font-size: .98rem; margin: .8rem 0 0;
}
.nf-auth-seal {
    position: absolute; right: -54px; bottom: -54px;
    width: 240px; height: 240px; opacity: .92; z-index: 1;
}
.nf-seal-spin { transform-origin: 100px 100px; animation: nf-spin 38s linear infinite; }

/* face branca (formulario) */
.nf-auth-form {
    flex: 1; min-width: 0;
    background: var(--nf-surface);
    padding: 2.6rem 2.8rem;
    display: flex; flex-direction: column; justify-content: center;
}
.nf-login-eyebrow {
    margin: 0; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
    color: var(--nf-gold); font-weight: 700;
}
.nf-login-title {
    font-family: var(--nf-font-display);
    font-weight: 700; font-size: 2rem; letter-spacing: normal; margin: .25rem 0 1.3rem;
}
/* Erro nao segue a skin: vermelho de falha e semantica, e no modo escuro o fundo
   claro fixo cegaria. Derivado de --nf-err, que ja existe nos dois modos. */
.nf-login-erro {
    background: color-mix(in srgb, var(--nf-err) 12%, var(--nf-surface));
    color: var(--nf-err);
    border: 1px solid color-mix(in srgb, var(--nf-err) 35%, transparent);
    border-radius: var(--nf-radius-xs);
    padding: .6rem .8rem; font-size: .82rem; margin-bottom: 1rem;
}
.nf-login-sucesso {
    background: color-mix(in srgb, #2e7d32 12%, var(--nf-surface));
    color: #2e7d32;
    border: 1px solid color-mix(in srgb, #2e7d32 35%, transparent);
    border-radius: var(--nf-radius-xs);
    padding: .6rem .8rem; font-size: .82rem; margin-bottom: 1rem;
}
.nf-login-link {
    display: block; margin-top: .8rem; font-size: .82rem;
    color: var(--nf-brand-action-text); text-decoration: none; text-align: right;
}
.nf-login-link:hover { text-decoration: underline; }
.nf-login-link-back { text-align: left; margin-top: 1.2rem; }
.nf-field-label {
    display: block; font-size: .76rem; font-weight: 700;
    color: var(--nf-muted); margin: .85rem 0 .35rem; letter-spacing: .01em;
}
.nf-field {
    width: 100%; padding: .7rem .85rem;
    border: 1px solid var(--nf-line); border-radius: var(--nf-radius-sm);
    background: var(--nf-paper);
    font-family: var(--nf-font-sans); font-size: 1rem; color: var(--nf-ink);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.nf-field-mono { font-family: var(--nf-font-mono); letter-spacing: .02em; }
.nf-field::placeholder { color: var(--nf-400); }
.nf-field:focus {
    outline: none; border-color: var(--nf-brand-action); background: var(--nf-surface);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--nf-brand-action) 22%, transparent);
}
.nf-field-hint { margin: .35rem 0 0; font-size: .72rem; color: var(--nf-muted); }
.nf-login-btn {
    width: 100%; margin-top: 1.4rem;
    display: flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .8rem; border: 0; cursor: pointer; border-radius: var(--nf-radius-sm);
    background: var(--nf-brand-action); color: var(--nf-brand-action-on);
    font-family: var(--nf-font-sans); font-weight: 700; font-size: 1rem;
    transition: transform .08s ease, background .15s, box-shadow .2s;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--nf-brand-action) 28%, transparent);
}
/* Clareia o azul fixo da acao no hover para preservar o contraste com a tinta navy. */
.nf-login-btn:hover { background: color-mix(in srgb, var(--nf-brand-action) 85%, var(--nf-brand-shell-on)); }
.nf-login-btn:active { transform: translateY(1px); }
.nf-login-btn svg { transition: transform .2s ease; }
.nf-login-btn:hover svg { transform: translateX(3px); }
.nf-login-foot {
    margin-top: 1.4rem; font-size: .74rem; letter-spacing: .04em;
    color: var(--nf-muted); font-family: var(--nf-font-mono);
}

/* responsivo: empilha, marca vira faixa superior compacta */
@media (max-width: 760px) {
    .nf-auth { flex-direction: column; min-height: 0; }
    .nf-auth-brand { flex: none; padding: 1.6rem 1.8rem; }
    .nf-auth-tag { display: none; }
    .nf-auth-seal { width: 150px; height: 150px; right: -40px; bottom: -40px; }
    .nf-auth-form { padding: 1.8rem; }
}

/* --------------------------------------------------------------------------
   POLIMENTO DE COMPONENTES
   -------------------------------------------------------------------------- */
/* Exclusivo para conteúdo produzido por IA que ainda aguarda validação humana. */
.nf-ai-pending {
    background: color-mix(in srgb, var(--nf-ai-pending) 9%, var(--nf-surface));
    border-left: 3px solid var(--nf-ai-pending) !important;
}

/* --------------------------------------------------------------------------
   PAGINA "EM BREVE"
   -------------------------------------------------------------------------- */
.nf-soon { max-width: 560px; margin: 4vh auto 0; text-align: center; animation: nf-rise .5s ease both; }
.nf-soon-seal {
    width: 92px; height: 92px; margin: 0 auto 1.4rem;
    display: grid; place-items: center; border-radius: 50%;
    color: var(--nf-gold); background: var(--nf-gold-soft);
    border: 2px solid var(--nf-gold);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--nf-gold) 8%, transparent);
}
.nf-soon-eyebrow {
    margin: 0 0 .25rem; font-size: .72rem; letter-spacing: .16em;
    text-transform: uppercase; color: var(--nf-gold); font-weight: 700;
}
.nf-soon-desc { color: var(--nf-muted); max-width: 46ch; margin: 0 auto; }

/* --------------------------------------------------------------------------
   GUIA DE EMOLUMENTOS (imprimivel)
   -------------------------------------------------------------------------- */
.guia { min-height: 100vh; padding: 24px; display: flex; flex-direction: column; align-items: center; }
.guia-print-btn {
    align-self: flex-end; margin-bottom: 14px; cursor: pointer;
    border: 0; border-radius: var(--nf-radius-sm); padding: .6rem 1.1rem;
    background: var(--nf-accent); color: var(--nf-on-action); font-family: var(--nf-font-sans); font-weight: 700;
}
.guia-doc {
    width: 100%; max-width: 720px; background: var(--nf-doc-paper);
    border: 1px solid var(--nf-line); border-radius: 14px; box-shadow: var(--nf-shadow);
    padding: 40px 48px; color: var(--nf-doc-ink);
}
.guia-head { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid var(--nf-gold); padding-bottom: 16px; }
/* Quadrado escuro do cabecalho da guia. O BrandMark vai dentro SEM caixa propria — este
   elemento ja e a caixa — e herda o branco via currentColor. */
.guia-mark {
    width: 46px; height: 46px; border-radius: 12px;
    background: var(--nf-brand-shell); color: var(--nf-brand-shell-on);
    display: grid; place-items: center;
}
.guia-mark img { width: 32px; height: 32px; object-fit: contain; }
.guia-serventia { font-family: var(--nf-font-display); font-weight: 700; font-size: 1.15rem; }
.guia-cns { color: var(--nf-muted); font-size: .8rem; font-family: var(--nf-font-mono); }
.guia-titulo { font-family: var(--nf-font-display); font-weight: 700; font-size: 1.5rem; margin: 22px 0 16px; }
.guia-titulo:focus-visible {
    outline: 3px solid var(--nf-focus);
    outline-offset: .35rem;
    border-radius: var(--nf-radius-xs);
}
.guia-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; margin-bottom: 22px; }
.guia-meta > div { display: flex; flex-direction: column; }
.guia-meta span { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--nf-muted); }
.guia-tabela { width: 100%; border-collapse: collapse; }
.guia-tabela th, .guia-tabela td { padding: 9px 6px; border-bottom: 1px solid var(--nf-line); font-size: .92rem; }
.guia-tabela thead th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--nf-muted); }
.guia-tabela .r { text-align: right; }
.guia-tabela tfoot td { border-bottom: 0; border-top: 2px solid var(--nf-ink); padding-top: 12px; font-size: 1.05rem; }
.guia-vazio { color: var(--nf-muted); text-align: center; padding: 16px; }
.guia-rodape { margin-top: 26px; font-size: .72rem; color: var(--nf-muted); line-height: 1.5; }
@media print {
    body { background-image: none; }
    .guia { padding: 0; }
    .guia-print-btn { display: none; }
    .guia-doc { border: 0; box-shadow: none; border-radius: 0; max-width: none; padding: 0; }
}

/* --------------------------------------------------------------------------
   FORM LABELS, HELPERS E ALERTS (Fase 2 — DevExpress)
   -------------------------------------------------------------------------- */
.nf-label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    margin-bottom: .25rem;
    color: var(--nf-ink);
}
.nf-helper {
    display: block;
    font-size: .72rem;
    color: var(--nf-muted);
    margin-top: .25rem;
}
.nf-alert {
    border-radius: var(--nf-radius-xs);
    padding: .7rem 1rem;
    font-size: .88rem;
    margin: .5rem 0;
    display: flex;
    align-items: flex-start;
    gap: .5rem;
}
.nf-alert-success {
    background: color-mix(in srgb, var(--nf-ok) 12%, var(--nf-surface));
    color: var(--nf-ok);
    border: 1px solid color-mix(in srgb, var(--nf-ok) 35%, transparent);
}
.nf-alert-warning {
    background: color-mix(in srgb, var(--nf-warn) 12%, var(--nf-surface));
    color: var(--nf-warn);
    border: 1px solid color-mix(in srgb, var(--nf-warn) 35%, transparent);
}
.nf-alert-error {
    background: color-mix(in srgb, var(--nf-err) 12%, var(--nf-surface));
    color: var(--nf-err);
    border: 1px solid color-mix(in srgb, var(--nf-err) 35%, transparent);
}
.nf-alert-info {
    background: color-mix(in srgb, var(--nf-action) 10%, var(--nf-surface));
    color: var(--nf-action);
    border: 1px solid color-mix(in srgb, var(--nf-action) 30%, transparent);
}
.nf-alert-normal {
    background: var(--nf-surface);
    color: var(--nf-ink);
    border: 1px solid var(--nf-line);
}

.nf-file-input {
    display: block;
    font-size: .88rem;
    margin: .25rem 0;
    color: var(--nf-ink);
}
.nf-file-input::file-selector-button {
    padding: .45rem .9rem;
    border: 1px solid var(--nf-line);
    border-radius: var(--nf-radius-xs);
    background: var(--nf-surface);
    color: var(--nf-action);
    font-weight: 600;
    font-size: .82rem;
    cursor: pointer;
    margin-right: .6rem;
    transition: background .15s, border-color .15s;
}
.nf-file-input::file-selector-button:hover {
    background: color-mix(in srgb, var(--nf-action) 10%, var(--nf-surface));
    border-color: var(--nf-action);
}

/* Label wrapper para InputFile oculto + botao visivel como trigger */
.nf-file-label { position: relative; display: inline-block; cursor: pointer; }
.nf-file-label:focus-within {
    outline: 3px solid var(--nf-focus);
    outline-offset: 2px;
}
.nf-file-hidden { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 1; }

/* --------------------------------------------------------------------------
   CABECALHOS, CAMPOS E NOTIFICACOES REUTILIZAVEIS
   -------------------------------------------------------------------------- */
.nf-page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    scroll-margin-top: 5rem;
}
.nf-page-heading:focus-visible {
    outline: 3px solid var(--nf-focus);
    outline-offset: .35rem;
    border-radius: var(--nf-radius-xs);
}
.nf-page-heading-copy { min-width: 0; }
.nf-page-heading h1 {
    margin: 0;
    font-family: var(--nf-font-display);
    font-size: clamp(1.55rem, 1.25rem + 1vw, 2.25rem);
    line-height: 1.12;
    letter-spacing: -.02em;
}
.nf-page-eyebrow {
    margin: 0 0 .3rem;
    color: var(--nf-gold);
    font-size: .7rem;
    font-weight: 750;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.nf-page-subtitle { max-width: 68ch; margin: .45rem 0 0; color: var(--nf-muted); }
.nf-page-actions { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
.nf-form-field { min-width: 0; }
.nf-required { color: var(--nf-err); }
.nf-field-error { display: block; margin-top: .25rem; color: var(--nf-err); font-size: .75rem; }

.nf-notification-dropdown { position: relative; }
.nf-notification-trigger { padding-inline: .45rem; }
.nf-notification-menu { min-width: min(22rem, calc(100vw - 1rem)) !important; }
.nf-badge-wrapper { position: relative; display: inline-flex; }
.nf-badge-wrapper[data-visible="true"]::after {
    content: attr(data-count);
    position: absolute;
    top: -.55rem;
    right: -.7rem;
    min-width: 1rem;
    height: 1rem;
    display: grid;
    place-items: center;
    padding-inline: .15rem;
    border: 2px solid var(--nf-shell);
    border-radius: 999px;
    background: var(--nf-err);
    color: var(--nf-brand-shell-on);
    font-size: .58rem;
    font-weight: 800;
    line-height: 1;
}
.nf-noti-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .35rem .55rem; }
.nf-noti-head h2 { margin: 0; }
.nf-noti-mark-all {
    border: 0;
    background: transparent;
    color: var(--nf-action);
    font: inherit;
    font-size: .75rem;
    font-weight: 650;
    cursor: pointer;
}
.nf-noti-empty { padding: .75rem; }
.nf-noti-empty p { margin: 0; }
.nf-noti-item-wrap { white-space: normal; }
.nf-noti-item { display: flex; flex-direction: column; gap: .15rem; width: 100%; line-height: 1.25; }
.nf-noti-msg { white-space: normal; }
.nf-noti-unread { border-left: 3px solid var(--nf-action); padding-left: .55rem; }
.nf-noti-all { justify-content: center; color: var(--nf-action); font-weight: 650; }

@media (max-width: 640px) {
    .nf-page-heading { flex-direction: column; }
    .nf-page-actions { width: 100%; justify-content: flex-start; }
}

/* --------------------------------------------------------------------------
   WORKSPACE DE ATOS — quadro como leitura do fluxo, sem ordem manual
   -------------------------------------------------------------------------- */
.nf-view-switch {
    display: inline-flex;
    padding: .2rem;
    border: 1px solid var(--nf-line);
    border-radius: var(--nf-radius-sm);
    background: var(--nf-mist);
}
.nf-view-switch-button {
    min-height: 44px;
    padding: .55rem .9rem;
    border: 0;
    border-radius: var(--nf-radius-xs);
    background: transparent;
    color: var(--nf-ink);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    touch-action: manipulation;
}
.nf-view-switch-button.is-active {
    background: var(--nf-surface);
    color: var(--nf-action);
    box-shadow: var(--nf-shadow);
}
.nf-view-switch-button:focus-visible,
.nf-kanban-card button:focus-visible,
.nf-kanban-card a:focus-visible {
    outline: 3px solid var(--nf-focus);
    outline-offset: 2px;
}
.nf-kanban-scroll {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin-top: 1rem;
    padding: .15rem .1rem .65rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
}
.nf-kanban-scroll:focus-visible {
    outline: 3px solid var(--nf-focus);
    outline-offset: 2px;
    border-radius: var(--nf-radius-xs);
}
.nf-kanban-board {
    display: grid;
    grid-template-columns: repeat(5, clamp(16rem, 22vw, 20rem));
    gap: .75rem;
    width: max-content;
    align-items: start;
}
.nf-kanban-column {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: .7rem;
    border: 1px solid var(--nf-line);
    border-top: 4px solid var(--nf-action);
    border-radius: var(--nf-radius-sm);
    background: var(--nf-mist);
}
.nf-kanban-column[data-kanban-status="AguardandoAssinatura"] { border-top-color: var(--nf-warn); }
.nf-kanban-column[data-kanban-status="Lavrado"] { border-top-color: var(--nf-ok); }
.nf-kanban-column[data-kanban-status="Cancelado"] { border-top-color: var(--nf-err); }
.nf-kanban-column-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .6rem;
}
.nf-kanban-column-head h3 { margin: 0; font-size: .9rem; line-height: 1.25; }
.nf-kanban-count {
    min-width: 1.7rem;
    padding: .15rem .4rem;
    border-radius: 999px;
    background: var(--nf-surface);
    color: var(--nf-muted);
    text-align: center;
    font-size: .75rem;
    font-weight: 700;
}
.nf-kanban-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    background: transparent;
}
.nf-kanban-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: .8rem;
    border: 1px solid var(--nf-line);
    border-left: 3px solid var(--nf-action);
    border-radius: var(--nf-radius-xs);
    background: var(--nf-surface);
    box-shadow: 0 1px 3px rgba(18, 22, 27, .08);
}
.nf-kanban-card[aria-busy="true"] { opacity: .68; }
.nf-kanban-card-head,
.nf-kanban-meta,
.nf-kanban-confirm-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}
.nf-kanban-protocolo { color: var(--nf-action); font-family: var(--nf-font-mono); font-weight: 750; }
.nf-kanban-natureza { margin: .4rem 0 .55rem; color: var(--nf-ink); font-weight: 650; }
.nf-kanban-meta { color: var(--nf-muted); font-size: .75rem; }
.nf-kanban-saving { color: var(--nf-action); font-size: .72rem; font-weight: 700; }
.nf-kanban-move { width: 100%; min-height: 44px; margin-top: .7rem; touch-action: manipulation; }
.nf-kanban-confirm { display: grid; gap: .55rem; margin-top: .7rem; padding-top: .65rem; border-top: 1px solid var(--nf-line); }
.nf-kanban-confirm-actions { justify-content: flex-start; flex-wrap: wrap; }
.nf-kanban-confirm-actions .btn { min-height: 44px; touch-action: manipulation; }
.nf-kanban-empty { margin: .5rem; color: var(--nf-muted); font-size: .8rem; text-align: center; }

@media (max-width: 640px) {
    .nf-kanban-board { grid-template-columns: repeat(5, min(82vw, 18rem)); }
}

.nf-b2-workspace, .nf-b2-filter, .nf-b2-saved-views, .nf-dynamic-form { min-width: 0; max-width: 100%; box-sizing: border-box; }
.nf-b2-saved-views { display: grid; gap: .75rem; margin-block: 1rem; padding: 1rem; border: 1px solid var(--nf-line); border-radius: var(--nf-radius-sm); background: var(--nf-surface); }
.nf-b2-saved-views-fields, .nf-b2-saved-views-actions, .nf-b2-filter-actions { display: flex; align-items: end; gap: .5rem; flex-wrap: wrap; }
.nf-b2-saved-view-field { display: grid; gap: .25rem; min-width: min(100%, 14rem); flex: 1 1 14rem; }
.nf-b2-saved-view-field > select, .nf-b2-saved-view-field > input { min-width: 0; max-width: 100%; }
.nf-b2-saved-views-status { min-height: 1.25rem; }
.nf-b2-dialog-backdrop { position: fixed; inset: 0; z-index: 1300; display: grid; place-items: center; padding: 1rem; background: color-mix(in srgb, var(--nf-ink) 45%, transparent); touch-action: none; }
.nf-b2-dialog { width: min(100%, 34rem); max-height: calc(100dvh - 2rem); overflow: auto; min-width: 0; padding: .75rem; border: 1px solid var(--nf-line); border-radius: var(--nf-radius-sm); background: var(--nf-surface); color: var(--nf-ink); }
.nf-b2-filter { display: grid; gap: .75rem; margin-block: 1rem; padding: 1rem; border: 1px solid var(--nf-line); border-radius: var(--nf-radius-sm); background: var(--nf-surface); }
.nf-b2-filter > legend { padding-inline: .35rem; color: var(--nf-ink); font-size: 1rem; font-weight: 600; }
.nf-b2-filter-clause { display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(10rem, 1fr) minmax(12rem, 1.25fr) auto; gap: .75rem; align-items: end; min-width: 0; padding: .75rem; background: var(--nf-mist); border-radius: var(--nf-radius-xs); }
.nf-b2-filter-field { display: grid; gap: .3rem; min-width: 0; }
.nf-b2-filter-clause-actions { display: flex; align-items: end; }
.nf-b2-filter :is(select, input), .nf-b2-saved-views :is(select, input) { box-sizing: border-box; min-width: 0; min-height: 44px; padding: .55rem .7rem; border: 1px solid var(--nf-line); border-radius: var(--nf-radius-xs); background: var(--nf-surface); color: var(--nf-ink); font: inherit; }
.nf-b2-filter :is(select, input):focus-visible, .nf-b2-saved-views :is(select, input):focus-visible { outline: 3px solid var(--nf-focus); outline-offset: 2px; }
.nf-b2-filter :is(select, input):disabled, .nf-b2-saved-views :is(select, input):disabled { background: var(--nf-mist); color: var(--nf-muted); cursor: not-allowed; }
.nf-b2-filter :is(.btn), .nf-b2-saved-views :is(.btn) { min-height: 44px; }
.nf-dynamic-field { min-width: 0; padding: .6rem; background: var(--nf-mist); border-radius: var(--nf-radius-xs); }
.nf-b2-filter-actions { padding: 0 .6rem .6rem; }
.nf-atos-status { display: inline-flex; align-items: center; padding: .2rem .6rem; border: 1px solid var(--nf-line); border-radius: 999px; background: var(--nf-mist); color: var(--nf-ink); font-size: .75rem; font-weight: 600; }
.nf-atos-grid-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.nf-atos-grid-scroll:focus-visible { outline: 3px solid var(--nf-focus); outline-offset: 2px; border-radius: var(--nf-radius-sm); }
.nf-atos-grid { min-width: 46rem; }
.nf-dynamic-form { display: grid; gap: .8rem; }
.nf-dynamic-field.is-invalid :is(input, textarea, [role="checkbox"], .dxbl-editor) { outline: 2px solid var(--nf-err); outline-offset: 1px; }

@media (max-width: 640px) {
    .nf-b2-saved-view-field,
    .nf-b2-saved-views-actions,
    .nf-b2-filter-actions { flex: 1 1 100%; width: 100%; min-width: 0; }
    .nf-b2-filter-clause { grid-template-columns: minmax(0, 1fr); }
    .nf-b2-filter-clause-actions > .btn { width: 100%; }
}

/* --------------------------------------------------------------------------
   ANIMACOES
   -------------------------------------------------------------------------- */
@keyframes nf-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes nf-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
    .nf-seal-spin, .nf-auth { animation: none !important; }
}
.nf-custom-field-list { display: grid; gap: .75rem; margin-block: 1rem; }
.nf-custom-field-item { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: .75rem; border: 1px solid var(--nf-line); border-radius: var(--nf-radius-sm); }
.nf-custom-field-editor { max-width: 64rem; }
.nf-dynamic-form { display: grid; gap: 1rem; min-width: 0; }
.nf-dynamic-field { display: grid; gap: .25rem; min-width: 0; }
.nf-dynamic-field > * { max-width: 100%; }
