/* Gestão ISO — identidade visual aprovada no mockup
 *
 * Navegação (aprovada na revisão de responsividade):
 *   < 768 px   celular   : menu em gaveta (☰), topo compacto
 *   768–1439   tablet/notebook : trilho de ícones (76 px) por padrão
 *   ≥ 1440     desktop   : menu expandido (264 px) por padrão
 * O usuário pode alternar trilho/expandido (≥ 768); a escolha fica no localStorage.
 */
:root {
    --app-ground: #f3f5f8;
    --app-surface: #ffffff;
    --app-border: #dde3ec;
    --app-border-soft: #eef1f5;
    --app-border-strong: #c5cedb;
    --app-text: #18212f;
    --app-muted: #5a6679;
    --app-nav: #14213d;
    --app-nav-active: #22355c;
    --app-nav-hover: #1b2b4d;
    --app-nav-text: #dfe6f1;
    --app-nav-muted: #8d9bb5;
    --app-primary: #1f4e8c;
    --app-primary-hover: #163a69;
    --app-accent: #2f6fd1;
    --app-focus: #6ea8ff;
    --ok-bg: #dff3e6; --ok-fg: #1d6b3a;
    --warn-bg: #fdf0d5; --warn-fg: #7a4a00;
    --bad-bg: #fbe3e1; --bad-fg: #9b1c13;
    --na-bg: #eceff3; --na-fg: #475569;
    --info-bg: #e8f0fb; --info-fg: #163a69;

    --nav-w: 264px;
    --rail-w: 76px;
    --topbar-h: 60px;

    --bs-body-font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --bs-body-color: var(--app-text);
    --bs-body-bg: var(--app-ground);
    --bs-border-color: var(--app-border);
    --bs-link-color-rgb: 31, 78, 140;
    --bs-link-hover-color-rgb: 22, 58, 105;
}

body { background: var(--app-ground); color: var(--app-text); }
.font-mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
:focus-visible { outline: 3px solid var(--app-focus); outline-offset: 2px; }

.skip-link {
    position: absolute; left: 12px; top: -60px; z-index: 2000; padding: 10px 16px; border-radius: 8px;
    background: #fff; color: var(--app-primary); font-weight: 600; box-shadow: 0 6px 16px rgba(0,0,0,.2);
}
.skip-link:focus { top: 12px; }

/* ---------- Botões e formulários ---------- */
.btn-primary {
    --bs-btn-bg: var(--app-primary); --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary-hover); --bs-btn-hover-border-color: var(--app-primary-hover);
    --bs-btn-active-bg: var(--app-primary-hover); --bs-btn-active-border-color: var(--app-primary-hover);
    --bs-btn-disabled-bg: var(--app-primary); --bs-btn-disabled-border-color: var(--app-primary);
}
.btn-outline-primary {
    --bs-btn-color: var(--app-primary); --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary); --bs-btn-hover-border-color: var(--app-primary);
}
.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; }
.btn-sm { min-height: 36px; }
.btn-link { text-decoration: none; }
.form-control, .form-select { min-height: 44px; border-color: var(--app-border-strong); border-radius: 8px; background-color: #fff; }
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: #eef1f5; }
input[type=file].form-control { padding-top: 9px; }
.form-label { font-size: .8125rem; font-weight: 600; color: #475569; }
.form-check-input { width: 1.15em; height: 1.15em; }
.has-error .form-control, .has-error .form-select { border-color: #b42318; }
textarea.form-control { min-height: 88px; }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-nav {
    position: sticky; top: 0; height: 100vh; flex: none; width: var(--nav-w);
    background: var(--app-nav); color: var(--app-nav-text);
    display: flex; flex-direction: column; padding: 16px 12px 12px; overflow: hidden;
    transition: width .18s ease;
    z-index: 1040;
}
.app-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 18px; color: #fff; text-decoration: none; min-height: 52px; }
.app-brand:hover { color: #fff; }
.app-brand-mark {
    width: 36px; height: 36px; flex: none; border-radius: 8px; background: var(--app-accent); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .78rem;
}
.app-brand-text { display: flex; flex-direction: column; white-space: nowrap; line-height: 1.25; }
.app-brand-text small { font-size: 12px; color: #a9b6cc; }

.nav-section + .nav-section { margin-top: 6px; }
.nav-group-toggle {
    width: 100%; display: flex; align-items: center; justify-content: space-between; min-height: 36px;
    padding: 0 12px; border: 0; background: none; color: var(--app-nav-muted);
    font-size: 11px; letter-spacing: .08em; text-transform: uppercase; border-radius: 6px;
}
.nav-group-toggle:hover { color: #fff; }
.nav-group-toggle .bi { transition: transform .15s; }
.nav-group-toggle[aria-expanded="false"] .bi { transform: rotate(-90deg); }
.nav-divider { display: none; height: 1px; margin: 8px 12px; background: #2a3b5f; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-list[hidden] { display: none; }
.nav-item-link {
    position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px;
    border-radius: 8px; color: var(--app-nav-text); text-decoration: none; font-size: 14px;
}
.nav-item-link .bi { width: 20px; flex: none; text-align: center; font-size: 1.05rem; }
.nav-item-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item-link:hover { background: var(--app-nav-hover); color: #fff; }
.nav-item-link.active { background: var(--app-nav-active); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--app-focus); }
.nav-badge {
    margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; text-align: center;
    background: #f0b43c; color: #14213d; font-size: 12px; font-weight: 700;
}
.nav-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; margin: 0 -4px; padding: 0 4px 12px; scrollbar-width: thin; scrollbar-color: #2a3b5f transparent; }
@media (max-height: 760px) and (min-width: 768px) {
    .nav-item-link { min-height: 40px; }
    .app-brand { padding-bottom: 10px; }
    .nav-group-toggle { min-height: 32px; }
}
.nav-collapse-btn {
    flex: none; margin-top: 8px;
    display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px;
    background: var(--app-nav-hover); color: var(--app-nav-text); font-size: 13px; width: 100%;
}
.nav-collapse-btn:hover { color: #fff; }
.nav-close { display: none; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
    position: sticky; top: 0; z-index: 1030; height: var(--topbar-h); flex: none;
    display: flex; align-items: center; gap: 12px; padding: 0 28px;
    background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--app-border);
}
.topbar-menu-btn { display: none; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; color: var(--app-muted); margin: 0; padding: 0; list-style: none; }
.breadcrumbs li { white-space: nowrap; }
.breadcrumbs li:last-child { overflow: hidden; text-overflow: ellipsis; color: var(--app-text); font-weight: 600; }
.breadcrumbs li + li::before { content: "›"; margin-right: 8px; color: var(--app-nav-muted); }
.breadcrumbs a { color: var(--app-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--app-primary); text-decoration: underline; }
.topbar-title { display: none; min-width: 0; line-height: 1.2; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-trigger {
    display: flex; align-items: center; gap: 10px; min-height: 42px; width: 340px; padding: 0 12px;
    border: 1px solid var(--app-border); border-radius: 8px; background: #f8fafc; color: var(--app-muted); font-size: 14px; text-align: left;
}
.search-trigger:hover { border-color: var(--app-border-strong); }
.search-trigger kbd { margin-left: auto; padding: 2px 6px; border-radius: 4px; background: #fff; border: 1px solid var(--app-border); color: var(--app-muted); font-size: 11px; }
.user-btn { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 8px; border: 1px solid transparent; border-radius: 8px; background: none; }
.user-btn:hover, .user-btn[aria-expanded="true"] { border-color: var(--app-border); background: #f8fafc; }
.user-avatar {
    width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--app-nav-active); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; text-align: left; }
.user-meta small { color: var(--app-muted); font-size: 12px; }
.dropdown-menu { border-color: var(--app-border); border-radius: 10px; box-shadow: 0 12px 32px rgba(20,33,61,.14); padding: 6px; }
.dropdown-item { min-height: 42px; display: flex; align-items: center; gap: 10px; border-radius: 6px; }

.app-content { flex: 1; min-width: 0; padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.app-content > * { min-width: 0; }
.nav-backdrop { display: none; }

/* Trilho (menu recolhido) — tablet/notebook por padrão, ou escolha do usuário */
html[data-nav="rail"] .app-nav { width: var(--rail-w); padding-left: 10px; padding-right: 10px; }
html[data-nav="rail"] .app-brand { justify-content: center; padding-left: 0; padding-right: 0; }
html[data-nav="rail"] .app-brand-text,
html[data-nav="rail"] .nav-item-label,
html[data-nav="rail"] .nav-group-toggle,
html[data-nav="rail"] .nav-collapse-btn span { display: none; }
html[data-nav="rail"] .nav-divider { display: block; }
html[data-nav="rail"] .nav-list[hidden] { display: flex; }
html[data-nav="rail"] .nav-item-link { justify-content: center; padding: 0; }
html[data-nav="rail"] .nav-badge {
    position: absolute; top: 6px; right: 8px; min-width: 0; width: 9px; height: 9px; padding: 0; font-size: 0;
}
html[data-nav="rail"] .nav-collapse-btn { justify-content: center; padding: 0; }
html[data-nav="rail"] .nav-collapse-btn .bi { transform: rotate(180deg); }
/* Rótulo flutuante no trilho */
html[data-nav="rail"] .nav-item-link:hover::after,
html[data-nav="rail"] .nav-item-link:focus-visible::after {
    content: attr(data-label); position: fixed; left: calc(var(--rail-w) + 6px); transform: translateY(0);
    padding: 7px 12px; border-radius: 6px; background: #0b1530; color: #fff; font-size: 13px; font-weight: 500;
    white-space: nowrap; box-shadow: 0 6px 16px rgba(0,0,0,.25); pointer-events: none; z-index: 1100;
}

/* Celular: gaveta */
@media (max-width: 767.98px) {
    .app-nav {
        position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100%;
        transform: translateX(-105%); transition: transform .2s ease; box-shadow: 8px 0 24px rgba(0,0,0,.3);
    }
    html[data-nav] .app-nav { width: min(300px, 86vw); padding: 14px 12px; }
    html[data-nav] .app-brand-text, html[data-nav] .nav-item-label { display: flex; }
    html[data-nav] .nav-item-label { display: block; }
    html[data-nav] .nav-group-toggle { display: flex; }
    html[data-nav] .nav-divider { display: none; }
    html[data-nav] .nav-item-link { justify-content: flex-start; padding: 0 12px; min-height: 46px; }
    html[data-nav] .nav-badge { position: static; width: auto; height: auto; padding: 1px 7px; font-size: 12px; min-width: 22px; }
    html[data-nav] .nav-item-link:hover::after { content: none; }
    html[data-nav] .nav-list[hidden] { display: none; }
    .nav-collapse-btn { display: none; }
    .nav-close { display: inline-flex; margin-left: auto; color: #fff; }
    .app-brand { padding-right: 0; }
    body.nav-open .app-nav { transform: none; }
    body.nav-open { overflow: hidden; }
    body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(10,18,36,.5); }
    .app-topbar { padding: 0 6px 0 4px; gap: 4px; background: var(--app-nav); border-bottom-color: var(--app-nav); color: #fff; }
    .topbar-menu-btn { display: inline-flex; color: #fff; }
    .breadcrumbs, .app-topbar > nav { display: none; }
    .topbar-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
    .topbar-title small { color: #a9b6cc; font-size: 11px; }
    .topbar-title strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .search-trigger { width: 44px; padding: 0; justify-content: center; background: none; border: 0; color: #fff; }
    .search-trigger .search-text, .search-trigger kbd { display: none; }
    .user-meta, .user-btn .bi-chevron-down { display: none; }
    .user-btn:hover, .user-btn[aria-expanded="true"] { background: none; border-color: transparent; }
    .user-avatar { background: var(--app-accent); }
    .app-content { padding: 14px 12px 88px; gap: 14px; }
}
@media (min-width: 768px) and (max-width: 1199.98px) {
    .search-trigger { width: 44px; padding: 0; justify-content: center; }
    .search-trigger .search-text, .search-trigger kbd { display: none; }
    .user-meta { display: none; }
    .app-content { padding: 22px 20px; }
    .app-topbar { padding: 0 20px; }
}

/* ---------- Cabeçalho de página ---------- */
/* “‹ Voltar” só no celular: nas telas maiores o caminho (breadcrumb) já aparece no topo */
@media (min-width: 768px) { .back-link { display: none; } }
.page-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 16px; }
.page-header h1 { margin: 2px 0 0; font-size: 1.65rem; font-weight: 700; }
.page-kicker { font-size: 13px; color: var(--app-muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 767.98px) {
    .page-header h1 { font-size: 1.35rem; }
    .page-header { align-items: flex-start; }
    .page-header .page-kicker { display: none; }
}

.card-app { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 10px; padding: 22px; min-width: 0; }
.card-app h2 { font-size: 1.1rem; margin: 0 0 14px; }
.kpi .kpi-label { font-size: 13px; color: var(--app-muted); }
.kpi .kpi-value { font-size: 2.1rem; font-weight: 700; margin-top: 2px; }
@media (max-width: 767.98px) { .card-app { padding: 16px; } }

/* ---------- Tabelas ---------- */
.table-wrap { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 10px; overflow: hidden; min-width: 0; }
.table-wrap .table-responsive { margin: 0; }
.table-app { margin: 0; font-size: 14px; --bs-table-hover-bg: #f3f7fd; --bs-table-hover-color: var(--app-text); }
.table-app thead th {
    background: #f8fafc; color: var(--app-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
    font-weight: 600; white-space: nowrap; border-bottom-color: var(--app-border); position: sticky; top: 0;
}
.table-app thead th a.sort { color: inherit; text-decoration: none; }
.table-app td, .table-app th { padding: 11px 14px; vertical-align: middle; border-bottom-color: var(--app-border-soft); }
.table-app td.cell-wide { min-width: 220px; max-width: 360px; }
@media (max-width: 991.98px) { .table-app td.cell-wide { min-width: 150px; } }
.cell-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cell-sub { display: block; font-size: 12px; color: var(--app-muted); }
.table-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--app-border-soft); font-size: 13px; color: var(--app-muted); }
.table-footer .pagination { margin: 0; }
.table-footer .page-link { min-width: 40px; min-height: 40px; display: flex; align-items: center; justify-content: center; }
.table-footer .form-select { min-height: 36px; width: auto; display: inline-block; padding-top: 4px; padding-bottom: 4px; }
.actions { white-space: nowrap; text-align: right; }
.actions a, .actions .btn-link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 8px; font-size: 13px; font-weight: 600; text-decoration: none; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; }

/* Lista em cartões (celular) — provedores e usuários */
.card-list { display: none; flex-direction: column; gap: 10px; }
.list-card {
    display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 10px;
    background: var(--app-surface); border: 1px solid var(--app-border); color: var(--app-text); text-decoration: none;
}
.list-card:hover { border-color: var(--app-border-strong); color: var(--app-text); }
.list-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.list-card-head strong { font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-card-line { font-size: 13px; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-card-foot { font-size: 12px; color: var(--app-muted); }
@media (max-width: 767.98px) {
    .has-card-list .table-wrap .table-responsive { display: none; }
    .has-card-list .card-list { display: flex; }
    .has-card-list .table-wrap { background: none; border: 0; overflow: visible; }
    .has-card-list .table-footer { border: 1px solid var(--app-border); border-radius: 10px; background: var(--app-surface); margin-top: 10px; }
}
.fab {
    display: none; position: fixed; right: 16px; bottom: 20px; z-index: 1020; width: 56px; height: 56px; border-radius: 50%;
    align-items: center; justify-content: center; background: var(--app-primary); color: #fff; font-size: 26px;
    box-shadow: 0 8px 20px rgba(20,33,61,.3); text-decoration: none;
}
.fab:hover { color: #fff; background: var(--app-primary-hover); }
@media (max-width: 767.98px) { .fab { display: inline-flex; } }

/* ---------- Status ---------- */
.badge-status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge-bad { background: var(--bad-bg); color: var(--bad-fg); }
.badge-na { background: var(--na-bg); color: var(--na-fg); }
.badge-info { background: var(--info-bg); color: var(--info-fg); }

/* ---------- Filtros ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters > div { flex: 1 1 170px; min-width: 0; }
.filters > div.grow { flex: 2 1 260px; }
.filters .mb-3 { margin-bottom: 0 !important; }
.filter-bar { display: flex; gap: 8px; align-items: center; }
.filter-bar .form-control { flex: 1; }
.filter-toggle { display: none; }
@media (max-width: 767.98px) {
    .filter-toggle { display: inline-flex; }
    .filters-panel.offcanvas-md { border-radius: 16px 16px 0 0; max-height: 85vh; }
    .filters-panel .filters > div { flex-basis: 100%; }
}
@media (min-width: 768px) {
    .filters-panel .offcanvas-header { display: none; }
}

/* ---------- Ações fixas em formulários longos ---------- */
.form-actions-sticky {
    position: sticky; bottom: 0; z-index: 1010; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px;
    margin: 0 -28px -28px; padding: 12px 28px; background: rgba(255,255,255,.97); border-top: 1px solid var(--app-border);
    box-shadow: 0 -6px 16px rgba(20,33,61,.06);
}
.form-actions-sticky.dirty { background: #fff8eb; border-top-color: #f0d49a; }
.form-actions-sticky .status-text { font-size: 14px; color: var(--app-muted); }
@media (max-width: 1199.98px) { .form-actions-sticky { margin: 0 -20px -22px; padding: 12px 20px; } }
@media (max-width: 767.98px) {
    .form-actions-sticky { margin: 0 -12px -88px; padding: 10px 12px; }
    .form-actions-sticky .btn { flex: 1 1 auto; }
}

/* ---------- Matriz de permissões ---------- */
.perm-area { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 10px; overflow: hidden; }
.perm-area + .perm-area { margin-top: 12px; }
.perm-area > summary {
    list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
    min-height: 52px; padding: 0 16px; background: #f8fafc; cursor: pointer; font-weight: 600;
}
.perm-area > summary::-webkit-details-marker { display: none; }
.perm-area > summary .bi { transition: transform .15s; margin-right: 6px; }
.perm-area:not([open]) > summary .bi { transform: rotate(-90deg); }
.perm-area-count { font-size: 13px; font-weight: 400; color: var(--app-muted); }
.perm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.perm-table th, .perm-table td { border-top: 1px solid var(--app-border-soft); padding: 4px 8px; }
.perm-table thead th { color: var(--app-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; text-align: center; padding: 8px; border-top: 0; }
.perm-table thead th:first-child, .perm-table tbody th { text-align: left; padding-left: 16px; }
.perm-table td.perm-cell { text-align: center; width: 76px; }
.perm-cell label { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; cursor: pointer; }
.perm-cell input { width: 18px; height: 18px; margin: 0; }
.perm-none { color: var(--app-border-strong); }
.perm-extra { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 16px 6px 8px !important; }
.perm-chip { position: relative; display: inline-flex; }
.perm-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.perm-chip span {
    display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px; border-radius: 999px;
    border: 1px dashed var(--app-border-strong); color: #475569; font-size: 13px; cursor: pointer; user-select: none;
}
.perm-chip span::before { content: "+"; font-weight: 700; }
.perm-chip input:checked + span { background: var(--info-bg); color: var(--info-fg); border: 1px solid #9dbbe6; }
.perm-chip input:checked + span::before { content: "✓"; }
.perm-chip input:focus-visible + span { outline: 3px solid var(--app-focus); outline-offset: 2px; }
.perm-chip input:disabled + span, .perm-cell input:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 767.98px) {
    .perm-table thead { display: none; }
    .perm-table tr { display: block; border-top: 1px solid var(--app-border-soft); padding: 8px 0; }
    .perm-table tbody th { display: block; border: 0; padding: 4px 16px; }
    .perm-table td.perm-cell { display: inline-block; width: auto; border: 0; }
    .perm-table td.perm-cell[data-label]::after { content: attr(data-label); font-size: 12px; color: var(--app-muted); margin-right: 8px; }
    .perm-table td.perm-cell.is-empty { display: none; }
    .perm-table td.perm-extra { display: flex; border: 0; padding-left: 16px !important; }
}

/* ---------- Busca (Ctrl+K) ---------- */
.search-modal .modal-dialog { max-width: 640px; margin-top: 10vh; }
.search-modal .modal-content { border-radius: 12px; overflow: hidden; border: 0; box-shadow: 0 24px 64px rgba(10,18,36,.35); }
.search-modal .search-input-wrap { display: flex; align-items: center; gap: 10px; padding: 6px 14px; border-bottom: 1px solid var(--app-border); }
.search-modal .search-input-wrap input { border: 0; box-shadow: none; font-size: 17px; min-height: 52px; }
.search-results { list-style: none; margin: 0; padding: 6px; max-height: 60vh; overflow-y: auto; }
.search-results .group { padding: 10px 10px 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--app-muted); }
.search-results a {
    display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 10px; border-radius: 8px;
    color: var(--app-text); text-decoration: none;
}
.search-results a .bi { width: 22px; text-align: center; color: var(--app-muted); }
.search-results a small { display: block; color: var(--app-muted); font-size: 12px; }
.search-results a.active, .search-results a:hover { background: var(--info-bg); }
.search-empty { padding: 24px; text-align: center; color: var(--app-muted); }
.search-hint { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--app-border); font-size: 12px; color: var(--app-muted); background: #f8fafc; }
@media (max-width: 767.98px) {
    .search-modal .modal-dialog { margin: 0; max-width: none; height: 100%; }
    .search-modal .modal-content { height: 100%; border-radius: 0; }
    .search-results { max-height: none; flex: 1; }
}

.search-modal input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }
.perm-key { font-size: 12px; color: var(--app-muted); font-family: "IBM Plex Mono", ui-monospace, monospace; }

/* ---------- Login ---------- */
.login-shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.login-aside {
    flex: 1 1 420px; background: var(--app-nav); color: var(--app-nav-text); padding: 56px;
    display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
}
.login-aside .login-hero { margin-block: auto; }
.login-aside h1 { color: #fff; font-size: 2.25rem; font-weight: 700; line-height: 1.2; max-width: 460px; }
.login-aside p { color: #c3cde0; font-size: 1rem; line-height: 1.6; max-width: 460px; }
.login-modules { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-direction: column; gap: 16px; max-width: 460px; }
.login-modules li { display: flex; gap: 14px; align-items: flex-start; }
.login-modules .bi { flex: none; width: 38px; height: 38px; border-radius: 8px; background: var(--app-nav-active); color: #9ec5ff; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.login-modules strong { display: block; color: #fff; font-size: 15px; }
.login-modules span { display: block; color: #a9b6cc; font-size: 13.5px; line-height: 1.45; }
.password-group .password-toggle { display: inline-flex; align-items: center; gap: 6px; min-width: 104px; border-color: var(--app-border-strong); color: #475569; font-size: 14px; }
.password-group .password-toggle:hover { background: #f3f5f8; color: var(--app-text); }
.password-group .password-toggle[aria-pressed="true"] { color: var(--app-primary); }
.password-group .form-control { border-right: 0; }
.login-supplier { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--info-bg); color: var(--info-fg); font-size: 13px; line-height: 1.5; }
.login-supplier .bi { font-size: 1.15rem; line-height: 1.2; }
@media (max-height: 720px) and (min-width: 768px) {
    .login-main { padding: 16px; }
    .login-card { padding: 22px 28px; }
    .login-card img { height: 34px !important; margin-bottom: 14px !important; }
    .login-card .mb-4 { margin-bottom: 14px !important; }
    .login-card .mb-3 { margin-bottom: 10px !important; }
    .login-aside { padding: 32px 48px; }
    .login-aside h1 { font-size: 1.85rem; }
    .login-modules { margin-top: 18px; gap: 10px; }
}
.login-main { flex: 1 1 480px; display: flex; align-items: center; justify-content: center; padding: 48px 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 12px; padding: 36px; }
@media (max-width: 767.98px) {
    .login-shell { flex-direction: column; flex-wrap: nowrap; }
    .login-aside { flex: none; padding: 16px; flex-direction: row; align-items: center; }
    .login-aside .login-hero { display: none; }
    .login-main { flex: 1; align-items: flex-start; padding: 20px 12px; }
    .login-card { padding: 22px; }
}

/* ---------- Formato 7 ---------- */
.f7-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.f7-card {
    display: flex; flex-direction: column; min-height: 74px; padding: 12px 16px; border-radius: 10px;
    background: var(--app-surface); border: 1px solid var(--app-border); color: var(--app-text); text-decoration: none;
}
.f7-card:hover { border-color: var(--app-primary); color: var(--app-text); }
.f7-card.active { outline: 2px solid var(--app-primary); outline-offset: -1px; }
.f7-card-label { font-size: 13px; opacity: .9; }
.f7-card-value { font-size: 1.65rem; font-weight: 700; line-height: 1.2; }
.f7-card-ok { color: var(--ok-fg); }
.f7-card-warn { background: #fff8eb; border-color: #f0d49a; color: var(--warn-fg); }
.f7-card-bad { background: #fdeeee; border-color: #efb9b5; color: var(--bad-fg); }
.f7-card-info { color: var(--info-fg); }
@media (max-width: 767.98px) {
    /* Cartões viram “chips” roláveis */
    .f7-cards { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 4px; scrollbar-width: none; }
    .f7-card { flex: none; min-height: 40px; padding: 0 12px; border-radius: 999px; flex-direction: row; align-items: center; gap: 6px; }
    .f7-card-label { font-size: 13px; }
    .f7-card-value { font-size: 14px; }
    .f7-card.active { background: var(--app-primary); color: #fff; outline: 0; border-color: var(--app-primary); }
}
.f7-kpi-warn { background: #fff8eb; border-color: #f0d49a; }
.f7-tabs { border-bottom-color: var(--app-border); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.f7-tabs .nav-link { min-height: 44px; display: flex; align-items: center; color: #475569; white-space: nowrap; }
.f7-tabs .nav-link.active { color: var(--app-primary); font-weight: 600; }
.f7-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.f7-steps li {
    display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-radius: 999px;
    background: var(--app-surface); border: 1px solid var(--app-border); color: #475569; font-size: 14px;
}
.f7-steps li.current { background: var(--app-primary); border-color: var(--app-primary); color: #fff; font-weight: 600; }
.f7-step-dot {
    width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; background: var(--na-bg); color: #475569;
}
.f7-steps li.current .f7-step-dot { background: #fff; color: var(--app-primary); }
.f7-steps li.done .f7-step-dot { background: var(--ok-fg); color: #fff; }
.f7-flow { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.f7-flow li { padding-left: 22px; position: relative; color: #475569; }
.f7-flow li::before { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--na-bg); border: 1px solid var(--app-border-strong); }
.f7-flow li.done::before { background: var(--ok-fg); border-color: var(--ok-fg); }
.f7-flow li.current { color: var(--app-text); font-weight: 600; }
.f7-flow li.current::before { background: var(--warn-fg); border-color: var(--warn-fg); }

.audit-json { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-word; margin: 0; }
.alert { border-radius: 10px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}

/* Links em tabelas e cartões: sem sublinhado até o hover */
.search-trigger, .search-trigger:hover { text-decoration: none; }
.table-app a, .list-card { text-decoration: none; }
.table-app a:hover { text-decoration: underline; }
.table-app td.fw-semibold a { font-weight: 600; }

/* Topo: o caminho encolhe com reticências; busca e usuário nunca quebram linha */
.app-topbar > nav { flex: 1 1 auto; min-width: 0; }
.breadcrumbs { overflow: hidden; }
.breadcrumbs li { flex: none; }
.breadcrumbs li:last-child { flex: 0 1 auto; min-width: 0; }
.topbar-actions { flex: none; }
@media (min-width: 1200px) { .search-trigger { width: clamp(220px, 24vw, 340px); } }
.search-trigger { white-space: nowrap; }
.search-trigger .search-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.search-trigger kbd { flex: none; white-space: nowrap; }
.user-meta strong, .user-meta small { white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1439.98px) {
    html[data-nav="expanded"] .user-meta { display: none; }
}

/* Tablet: tabela com colunas prioritárias em largura fixa (Status sempre visível) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .table-prio { table-layout: fixed; }
    .table-prio .w-name { width: 40%; }
    .table-prio .w-cert { width: 24%; }
    .table-prio .w-due { width: 17%; }
    .table-prio .w-status { width: 19%; }
    .table-prio td { overflow: hidden; text-overflow: ellipsis; }
    .table-prio .badge-status { white-space: normal; }
}
