/* =============================================================================
   HelpRex Agent - navegacao e Configuracoes (folha 44 ADM-P0-NAV, plano 3.3,
   D.0.6, D.0.11, D.0.12 e D.4 passos 2, 3, 5, 6, 7 e 9).

   Contrato visual: prototipo aprovado "Navegacao e Configuracoes" de 24/09
   (docs/design-reference/claude-design-2026-09-24/, telas 01 a 10) com os ajustes
   de PROTOTIPOS-APROVADOS.md; o que ele nao desenha segue o desenho de 17/09
   (hx.css). hx.css nao e tocado (D.0.11): a emenda vive aqui.

   Tipografia do CSS novo (D.0.12): minimo de 11,5 px e peso ate 600. Onde o
   prototipo desenhou 9,5 ou 10,5 px (rotulos de grupo, "Depende de permissao",
   atalho Ctrl K), o valor sobe para o piso. Os contadores continuam com o
   .hx-rail-item-count de hx.css.

   Nenhuma regra daqui poe transform, filter, contain ou will-change em ancestral
   do conteudo das paginas: os modais da Importacao sao position:fixed.
   ============================================================================= */

/* ----- barra lateral: rodape (Enviar feedback, Buscar, Notificacoes) e menu da conta ----- */
.hx-rail-tools { flex: none; border-top: 1px solid #3A342E; padding: 8px 8px 6px; }
.hx-rail-tools .hx-rail-item:hover,
.hx-rail-body .hx-rail-item:not(.is-active):not(.is-unavailable):hover { background: #3A342E; color: #F7F3EE; }
.hx-rail-kbd {
    flex: none;
    font-family: var(--hx-mono);
    font-size: 11.5px;
    line-height: 1.2;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid #4A423A;
    background: transparent;
    color: #C3BBB1;
    white-space: nowrap;
}
.hx-rail-notify-count { background: var(--hx-accent); color: var(--hx-accent-ink); }
.hx-rail-foot a.lang-item { text-decoration: none; }
.hx-rail-foot a.lang-item:hover { text-decoration: none; opacity: 1; }

/* ----- moldura de Configuracoes: menu interno + pagina ----- */
.hx-main > .hx-settings { flex: 1; min-height: 0; }
.hx-settings { display: flex; min-width: 0; min-height: 0; }

.hx-settings-nav {
    width: 208px;
    flex: none;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--hx-surface);
    border-right: 1px solid var(--hx-line);
}
.hx-settings-nav-head { flex: none; display: grid; gap: 8px; padding: 12px 10px 8px; }
.hx-settings-nav-title {
    display: flex;
    align-items: center;
    min-height: 32px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--hx-ink);
    text-decoration: none;
}
.hx-settings-nav-title:hover { background: var(--hx-sunken); color: var(--hx-ink); text-decoration: none; opacity: 1; }
.hx-settings-nav-title.is-home { background: var(--hx-sunken); box-shadow: inset 2px 0 0 var(--hx-accent); }
.hx-settings-nav-search {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    min-height: 32px;
    padding: 4px 9px;
    border: 1px solid var(--hx-line);
    border-radius: 6px;
    background: var(--hx-paper);
    font-family: inherit;
    font-size: 12px;
    color: var(--hx-ink3);
    text-align: left;
    cursor: pointer;
}
.hx-settings-nav-search:hover { border-color: var(--hx-line2); }
.hx-settings-nav-search svg { flex: none; color: var(--hx-mute); }
.hx-settings-nav-search-label { flex: 1; min-width: 0; line-height: 1.25; }
.hx-kbd {
    flex: none;
    font-family: var(--hx-mono);
    font-size: 11.5px;
    line-height: 1.2;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid var(--hx-line);
    background: var(--hx-surface);
    color: var(--hx-ink3);
    white-space: nowrap;
}

.hx-settings-nav-body { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 8px 16px; }
.hx-settings-nav-divider { height: 1px; background: var(--hx-line); margin: 10px 6px 4px; }
.hx-settings-group + .hx-settings-group { margin-top: 4px; }
.hx-settings-group-head {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0 6px;
    border-radius: 5px;
    list-style: none;
    cursor: pointer;
    font-family: var(--hx-mono);
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hx-mute);
}
.hx-settings-group-head::-webkit-details-marker { display: none; }
.hx-settings-group-head::marker { content: ""; }
.hx-settings-group-head:hover { color: var(--hx-ink); background: var(--hx-paper); }
.hx-settings-group.is-current > .hx-settings-group-head { color: var(--hx-ink); }
.hx-settings-group-chevron { flex: none; color: var(--hx-faint); transition: transform .12s ease; }
.hx-settings-group[open] > .hx-settings-group-head .hx-settings-group-chevron { transform: rotate(90deg); }
.hx-settings-group-items { list-style: none; margin: 0; padding: 2px 0 4px; }
.hx-settings-group-items > li { margin: 0; padding: 0; }

.hx-settings-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 32px;
    padding: 6px 10px 6px 14px;
    margin-bottom: 1px;
    border-radius: 6px;
    font-size: 12.5px;
    line-height: 1.3;
    font-weight: 400;
    color: var(--hx-ink2);
    text-decoration: none;
}
a.hx-settings-item:hover { background: var(--hx-sunken); color: var(--hx-ink2); text-decoration: none; opacity: 1; }
.hx-settings-item.is-current {
    border-radius: 0 6px 6px 0;
    background: var(--hx-sunken);
    box-shadow: inset 2px 0 0 var(--hx-accent);
    font-weight: 600;
    color: var(--hx-ink);
}
.hx-settings-item-label { flex: 1; min-width: 0; }
.hx-settings-item.is-locked { cursor: not-allowed; padding-top: 5px; padding-bottom: 5px; }
.hx-settings-item.is-locked .hx-settings-item-name { display: block; color: var(--hx-mute); font-weight: 400; }
.hx-settings-item-note { display: block; margin-top: 1px; font-size: 11.5px; color: var(--hx-faint); font-weight: 400; }
.hx-settings-lock { flex: none; color: var(--hx-faint); }
.hx-settings-ro {
    flex: none;
    font-family: var(--hx-mono);
    font-size: 11.5px;
    line-height: 1.3;
    padding: 0 4px;
    border: 1px solid var(--hx-line);
    border-radius: 3px;
    color: var(--hx-ink3);
    font-weight: 400;
}

.hx-settings-page { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--hx-paper); }
.hx-settings-page > .hx-topbar { padding: 0 24px; background: var(--hx-surface); }
.hx-settings-page > .hx-topbar-tabs { padding: 0 24px; background: var(--hx-surface); }
.hx-settings-crumb { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hx-settings-crumb a { color: var(--hx-ink3); text-decoration: none; }
.hx-settings-crumb a:hover { color: var(--hx-brand-deep); text-decoration: underline; opacity: 1; }
.hx-settings-crumb [aria-current="page"] { color: var(--hx-ink3); }
.hx-settings-crumb-sep { color: var(--hx-faint); }

.hx-settings-tab {
    flex: none;
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 12px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--hx-mute);
    white-space: nowrap;
    text-decoration: none;
}
.hx-settings-tab:hover { color: var(--hx-ink); text-decoration: none; opacity: 1; }
.hx-settings-tab.is-active { font-weight: 600; color: var(--hx-ink); border-bottom-color: var(--hx-accent); }

.hx-settings-nav-toggle {
    display: none;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-left: -6px;
    border: 1px solid var(--hx-line);
    border-radius: 6px;
    background: var(--hx-surface);
    color: var(--hx-ink3);
    cursor: pointer;
}
.hx-settings-nav-toggle:hover { border-color: var(--hx-line2); color: var(--hx-ink); }

/* O corpo que rola: a barra e as abas ficam fora dele (D.0.10). */
.hx-settings-body { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 28px 40px; }
.hx-settings-body:focus { outline: none; }
.hx-settings-body.is-hx-shell { padding: 0; display: flex; flex-direction: column; }
.hx-settings-lead { margin: 0 0 16px; max-width: 720px; }
.hx-settings-body.is-hx-shell > .hx-settings-lead { padding: 16px 24px 0; margin: 0; }
.hx-settings-readonly {
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: 620px;
    margin: 0 0 16px;
    padding: 9px 12px;
    border: 1px solid var(--hx-line);
    border-radius: 7px;
    background: var(--hx-sunken);
    font-size: 12.5px;
    color: var(--hx-ink2);
}
.hx-settings-readonly svg { flex: none; color: var(--hx-ink3); }
.hx-settings-body.is-hx-shell > .hx-settings-readonly { margin: 16px 24px 0; }

/* Contencoes de largura (D.0.6). Rolar dentro de tabela ou cartao e permitido. */
.hx-settings-body .card { overflow-x: auto; }
[data-settings-page="Import-Index"] .two-col { grid-template-columns: minmax(0, 1fr); }
[data-settings-page="Import-Job"] table,
[data-settings-page="Import-StatusMappings"] table { display: block; max-width: 100%; overflow-x: auto; }

@media (max-width: 1439px) {
    .hx-settings-nav { width: 184px; }
    .hx-settings-body { padding: 20px 20px 32px; }
    .hx-settings-page > .hx-topbar,
    .hx-settings-page > .hx-topbar-tabs { padding: 0 20px; }
    .hx-settings-body.is-hx-shell > .hx-settings-lead { padding: 16px 20px 0; }
    .hx-settings-body.is-hx-shell > .hx-settings-readonly { margin: 16px 20px 0; }
}
@media (min-width: 761px) and (max-width: 1439px) {
    [data-settings-page="Settings-BusinessHours"] :is(.days-header, .day-row) {
        grid-template-columns: 110px 160px minmax(220px, 1fr) 170px;
    }
}

/* Gaveta abaixo de 1280 px (C3.1): o menu sai do fluxo e abre por cima, pelo botao da barra. */
@media (max-width: 1279px) {
    .hx-settings-nav-toggle { display: inline-flex; }
    .hx-settings-nav {
        display: none;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 206px;
        z-index: 25;
        width: 260px;
        box-shadow: 0 18px 48px rgba(35, 31, 28, .18);
    }
    .hx-settings-nav.is-open { display: flex; }
    /* Acesso negado dentro da moldura (08b): sem barra nao ha botao da gaveta, e o menu fica no fluxo. */
    .hx-settings-nav[data-settings-nav-denied] { display: flex; position: static; width: 184px; box-shadow: none; }
}

/* ----- pagina inicial de Configuracoes (prototipo 03) ----- */
.hx-settings-home { max-width: 1120px; }
.hx-settings-home-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 620px;
    height: 44px;
    padding: 0 14px;
    margin: 0 0 18px;
    border: 1px solid var(--hx-line2);
    border-radius: 8px;
    background: var(--hx-surface);
    font-family: inherit;
    font-size: 13.5px;
    color: var(--hx-ink3);
    cursor: pointer;
}
.hx-settings-home-search:hover { border-color: var(--hx-brand); }
.hx-settings-home-search svg { flex: none; color: var(--hx-mute); }
.hx-settings-home-search-label { flex: 1; text-align: left; }
.hx-settings-home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.hx-settings-card {
    background: var(--hx-surface);
    border: 1px solid var(--hx-line);
    border-radius: 10px;
    padding: 14px 16px 10px;
    min-width: 0;
}
.hx-settings-card.is-platform { background: #FBF9F6; border-style: dashed; border-color: var(--hx-line2); }
.hx-legacy .hx-settings-card-title,
.hx-settings-card-title { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.35; letter-spacing: normal; color: var(--hx-ink); }
.hx-legacy .hx-settings-card-desc,
.hx-settings-card-desc { margin: 3px 0 10px; font-size: 12.5px; line-height: 1.5; color: var(--hx-ink3); }
.hx-settings-card-items { list-style: none; margin: 0; padding: 6px 0 0; border-top: 1px solid #F0EBE4; }
.hx-settings-card-items > li { margin: 0; padding: 0; }
.hx-settings-card-link {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 4px 6px;
    margin: 0 -6px;
    border-radius: 5px;
    font-size: 12.5px;
    line-height: 1.35;
    color: var(--hx-ink2);
    text-decoration: none;
}
a.hx-settings-card-link:hover { background: var(--hx-sunken); color: var(--hx-brand-deep); text-decoration: none; opacity: 1; }
.hx-settings-card-link.is-locked { color: var(--hx-mute); cursor: not-allowed; }
.hx-settings-card-label { flex: 1; min-width: 0; }
.hx-settings-card-chevron { color: var(--hx-faint); }
.hx-settings-locked-note { flex: none; font-size: 11.5px; color: var(--hx-faint); white-space: nowrap; }
.hx-legacy .hx-settings-home-note,
.hx-settings-home-note { margin: 20px 0 0; padding-top: 14px; border-top: 1px solid var(--hx-line); font-size: 12.5px; color: var(--hx-ink3); }
@media (max-width: 1439px) {
    .hx-settings-home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ----- Meu perfil (prototipo 07; conteudo segue a producao) ----- */
.hx-myprofile { display: grid; gap: 16px; max-width: 668px; }
.hx-myprofile .card-head h2 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--hx-ink); }
.hx-myprofile-data { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px 14px; margin: 0; }
.hx-myprofile-data dt { font-size: 12.5px; color: var(--hx-ink3); }
.hx-myprofile-data dd { margin: 0; font-size: 13px; color: var(--hx-ink2); overflow-wrap: anywhere; }
.hx-myprofile-languages { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; }
.hx-myprofile-language { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 12px; border: 1px solid var(--hx-line); border-radius: 7px; background: var(--hx-surface); }
.hx-myprofile-language label { margin: 0; font-size: 13px; color: var(--hx-ink); cursor: pointer; }
.hx-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ----- acesso negado (prototipo 08b): um unico h1 no estado ----- */
.hx-state.is-denied.hx-denied {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 40px 24px;
}
.hx-denied-box { max-width: 460px; text-align: center; }
.hx-denied .hx-state-icon { color: var(--hx-ink3); }
.hx-legacy h1.hx-state-title,
.hx-denied h1.hx-state-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.015em;
    color: var(--hx-ink);
}
.hx-state.is-denied.hx-denied .hx-state-text { max-width: none; margin: 0 0 20px; font-size: 13.5px; line-height: 1.6; color: var(--hx-ink3); }
.hx-denied-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.hx-denied-actions a {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 14px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
}
.hx-denied-actions a:hover { text-decoration: none; opacity: 1; }
.hx-denied-primary { background: var(--hx-ink); color: var(--hx-paper); font-weight: 600; border: 1px solid var(--hx-ink); }
.hx-denied-primary:hover { background: var(--hx-ink2); color: var(--hx-paper); }
.hx-denied-secondary { background: var(--hx-surface); color: var(--hx-ink); border: 1px solid var(--hx-line2); }
.hx-denied-secondary:hover { border-color: var(--hx-ink); color: var(--hx-ink); }

/* ----- paleta Ctrl+K (prototipo 09) ----- */
.hx-cmd {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 92px;
}
.hx-cmd[hidden] { display: none; }
.hx-cmd-backdrop { position: absolute; inset: 0; background: rgba(35, 31, 28, .42); }
.hx-cmd-dialog {
    position: relative;
    width: 640px;
    max-width: calc(100% - 48px);
    background: var(--hx-surface);
    border-radius: 12px;
    box-shadow: 0 24px 64px rgba(35, 31, 28, .28);
    overflow: hidden;
    animation: hx-fade .14s ease-out;
}
.hx-cmd-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    margin: 0;
}
.hx-cmd-field { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border-bottom: 1px solid var(--hx-line); color: var(--hx-ink3); }
.hx-cmd-field svg { flex: none; }
.hx-cmd :is(input, select, textarea) {
    height: auto;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    font-family: inherit;
    line-height: normal;
    color: inherit;
    transition: none;
    -webkit-appearance: none;
    appearance: none;
}
.hx-cmd :is(input, select, textarea):focus { box-shadow: none; outline: none; }
.hx-cmd .hx-cmd-input { flex: 1; min-width: 0; font-size: 15px; color: var(--hx-ink); }
.hx-cmd .hx-cmd-input::placeholder { color: var(--hx-faint); }
.hx-cmd .hx-cmd-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.hx-cmd-esc {
    flex: none;
    font-family: var(--hx-mono);
    font-size: 11.5px;
    line-height: 1.2;
    padding: 1px 5px;
    border: 1px solid var(--hx-line);
    border-radius: 4px;
    background: none;
    color: var(--hx-ink3);
    cursor: pointer;
}
.hx-cmd-results { max-height: 430px; overflow-y: auto; padding: 4px 0 8px; }
.hx-cmd-section-label {
    padding: 12px 16px 6px;
    font-family: var(--hx-mono);
    font-size: 11.5px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hx-ink3);
}
.hx-cmd-row {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    width: 100%;
    min-height: 48px;
    padding: 7px 16px;
    text-align: left;
    text-decoration: none;
    color: var(--hx-ink);
}
a.hx-cmd-row:hover, .hx-cmd-row.is-active { background: var(--hx-sunken); box-shadow: inset 2px 0 0 var(--hx-accent); text-decoration: none; opacity: 1; }
.hx-cmd-row-title { display: block; font-size: 13px; font-weight: 500; color: var(--hx-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-cmd-row.is-active .hx-cmd-row-title { font-weight: 600; }
.hx-cmd-row-sub { display: block; font-size: 12px; color: var(--hx-ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-cmd-status { padding: 22px 18px; font-size: 13px; color: var(--hx-ink3); }
.hx-cmd-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    border-top: 1px solid var(--hx-line);
    background: var(--hx-paper);
    font-size: 11.5px;
    color: var(--hx-ink3);
}
.hx-cmd-foot-note { margin-left: auto; }

/* ----- sino (P6): painel de notificacoes ----- */
.hx-notify {
    position: fixed;
    left: 214px;
    bottom: 60px;
    z-index: 30;
    width: 372px;
    max-width: calc(100vw - 230px);
    background: var(--hx-surface);
    border: 1px solid var(--hx-line);
    border-radius: 10px;
    box-shadow: 0 18px 44px rgba(35, 31, 28, .20);
    overflow: hidden;
    animation: hx-fade .14s ease-out;
}
.hx-notify[hidden] { display: none; }
.hx-notify-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid #EFEAE3; }
.hx-notify-title { margin: 0; font-size: 13.5px; font-weight: 600; line-height: 1.3; letter-spacing: normal; color: var(--hx-ink); }
.hx-notify-list { max-height: 420px; overflow-y: auto; font-size: 13px; color: var(--hx-ink3); }
.hx-notify-list:not(:has(.hx-notify-item)) { padding: 16px 14px; }
.hx-notify-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    border-bottom: 1px solid #F3EFE9;
    background: var(--hx-surface);
    text-decoration: none;
    color: var(--hx-ink);
}
.hx-notify-item:hover { background: var(--hx-paper); text-decoration: none; opacity: 1; }
.hx-notify-dot { flex: none; width: 7px; height: 7px; margin-top: 6px; border-radius: 999px; border: 1px solid var(--hx-line2); }
.hx-notify-item.is-unread .hx-notify-dot { border: none; background: var(--hx-accent); }
.hx-notify-body { flex: 1; min-width: 0; }
.hx-notify-kind { display: block; font-size: 13px; font-weight: 400; color: var(--hx-ink); }
.hx-notify-item.is-unread .hx-notify-kind { font-weight: 600; }
.hx-notify-ticket { display: block; margin-top: 2px; font-size: 12px; color: var(--hx-ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
