/* ============================================================
   HP Obras — Design System
   Estrutura de menus e login com prefixo sv-;
   a identidade usa as cores da logo HP Eletricidade:
     azul #0F3A91 · laranja #F36C1F / #F59714 · amarelo #FDD028 / #FACC05
   Tipografia: Bricolage Grotesque (títulos/marca) · Public Sans (corpo)
   Documentação: DESIGN.md. CSS único: não duplicar estilo nas views.
   ============================================================ */
:root {
    /* Marca */
    --hp-azul: #0F3A91;
    --hp-azul-600: #1A4DB8;
    --hp-azul-700: #0B2F78;
    --hp-azul-900: #081F52;
    --hp-laranja: #F36C1F;
    --hp-laranja-500: #F59714;
    --hp-amarelo: #FDD028;
    --hp-amarelo-600: #FACC05;

    /* Semânticos */
    --hp-success: #1E8E5A;
    --hp-success-bg: #E3F4EB;
    --hp-warning: #9A5B00;
    --hp-warning-bg: #FFF1D6;
    --hp-danger: #B42318;
    --hp-danger-bg: #FDEBE9;
    --hp-info: #1A4DB8;
    --hp-info-bg: #E6EEFB;

    /* Neutros / superfícies */
    --hp-ink: #0B1B3A;
    --hp-text: #26344F;
    --hp-muted: #5B6883;
    --hp-line: #DFE5EF;
    --hp-bg: #EEF2F8;
    --hp-surface: #FFFFFF;
    --hp-surface-2: #F5F8FC;

    /* Forma */
    --hp-r-sm: 8px;
    --hp-r: 12px;
    --hp-r-lg: 16px;
    --hp-shadow: 0 1px 2px rgba(8,31,82,.05), 0 6px 20px rgba(8,31,82,.08);
    --hp-shadow-lg: 0 18px 48px rgba(8,31,82,.22);
    --hp-ring: 0 0 0 3px rgba(245,151,20,.38);
    --hp-ease: cubic-bezier(.22,.61,.36,1);

    /* Menu lateral */
    --hp-nav-0: #0F3A91;
    --hp-nav-1: #081F52;
    --hp-nav-fg: #C7D5F2;
}

* { box-sizing: border-box; }
/* Barra de rolagem única para toda a aplicação (UX-CONTRACT): tom médio, visível no fundo claro e no menu azul. */
html { -webkit-text-size-adjust: 100%; scrollbar-color: #9AA7BF transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #9AA7BF; border: 2px solid transparent; border-radius: 999px; background-clip: padding-box; }

.hp-body {
    margin: 0;
    font-family: "Public Sans", system-ui, "Segoe UI", sans-serif;
    background: var(--hp-bg);
    color: var(--hp-text);
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
h1, h2, h3, .hp-brand-name { font-family: "Bricolage Grotesque", "Public Sans", sans-serif; }
h1, h2, h3, p { margin-top: 0; }
a { color: var(--hp-azul-600); }
:focus-visible { outline: none; box-shadow: var(--hp-ring); border-radius: 4px; }
/* fieldset e select não podem crescer além do contêiner (opções longas alargavam a página no celular). */
fieldset { min-width: 0; }
select { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Ícones do sprite (_IconSprite): herdam a cor do texto */
.hp-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.hp-i { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Casca: menu lateral + conteúdo ===== */
.hp-shell { display: flex; min-height: 100vh; }
.hp-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ===== Menu lateral ===== */
.hp-sidebar {
    width: 264px; flex-shrink: 0;
    background: linear-gradient(185deg, var(--hp-nav-0), var(--hp-nav-1));
    color: var(--hp-nav-fg);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow: hidden;
    z-index: 30;
}
.hp-sidebar-header { flex-shrink: 0; padding: 8px 14px 12px; }
.hp-sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 14px 4px 12px; color: #fff; text-decoration: none; }
.hp-bolt { width: 34px; height: 42px; flex: none; filter: drop-shadow(0 2px 6px rgba(243,108,31,.35)); }
.hp-wordmark { display: flex; flex-direction: column; line-height: 1; }
.hp-brand-name { font-size: 22px; font-weight: 800; font-style: italic; letter-spacing: -.02em; color: #fff; display: inline-flex; align-items: center; gap: 4px; }
.hp-brand-name .hp-dots { display: inline-flex; align-items: flex-end; gap: 2px; margin-left: 2px; }
.hp-brand-name .hp-dots i { display: block; border-radius: 50%; background: var(--hp-laranja-500); }
.hp-brand-name .hp-dots i:first-child { width: 6px; height: 6px; margin-bottom: 9px; }
.hp-brand-name .hp-dots i:last-child { width: 9px; height: 9px; background: var(--hp-amarelo-600); margin-bottom: 3px; }
.hp-brand-sub { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(199,213,242,.75); margin-top: 5px; }
.hp-nav-search { position: relative; }
.hp-nav-search .hp-i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--hp-muted); pointer-events: none; }
.hp-nav-search input {
    width: 100%; padding: 9px 12px 9px 34px; border-radius: var(--hp-r-sm);
    border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.96);
    color: var(--hp-ink); font: inherit; font-size: 13px;
}
.hp-nav-search input:focus { outline: none; box-shadow: var(--hp-ring); }
.hp-sidebar-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 12px 22px; }
.hp-menu-group {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    padding: 16px 14px 6px; border: 0; background: none; cursor: pointer;
    font: 700 10.5px "Public Sans", sans-serif; text-transform: uppercase; letter-spacing: .12em;
    color: rgba(199,213,242,.62); border-radius: var(--hp-r-sm);
}
.hp-menu-group:hover { color: #fff; }
.hp-menu-group .hp-i { width: 14px; height: 14px; transition: transform .2s var(--hp-ease); }
.hp-menu-group[aria-expanded="false"] .hp-i { transform: rotate(-90deg); }
.hp-menu-section[hidden] { display: none; }
.hp-menu-item {
    position: relative; display: flex; align-items: center; gap: 11px;
    padding: 9px 14px; margin: 1px 0; min-height: 40px;
    color: var(--hp-nav-fg); text-decoration: none; font-size: 13.5px; font-weight: 500; line-height: 1.25;
    border-radius: var(--hp-r-sm); overflow: hidden;
    transition: background .18s var(--hp-ease), color .18s var(--hp-ease), transform .18s var(--hp-ease);
}
.hp-menu-item .hp-i { opacity: .85; }
.hp-menu-item:hover { background: rgba(255,255,255,.08); color: #fff; transform: translateX(2px); }
.hp-menu-item.is-active { background: linear-gradient(90deg, rgba(245,151,20,.28), rgba(245,151,20,.04)); color: #fff; }
.hp-menu-item.is-active::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--hp-amarelo); }
.hp-menu-item.is-active .hp-i { opacity: 1; color: var(--hp-amarelo); }
.hp-menu-item.is-hidden, .hp-menu-group.is-hidden { display: none; }
.hp-menu-empty { padding: 14px; font-size: 12.5px; color: rgba(199,213,242,.7); }
.hp-sidebar-foot { flex-shrink: 0; padding: 12px 18px 16px; border-top: 1px solid rgba(255,255,255,.1); font-size: 11.5px; color: rgba(199,213,242,.7); }

/* Menu recolhido em ícones (somente desktop; classe hp-rail no <html>, aplicada antes da pintura) */
@media (min-width: 861px) {
    .hp-rail .hp-sidebar { width: 68px; }
    .hp-rail .hp-wordmark, .hp-rail .hp-nav-search, .hp-rail .hp-menu-item span, .hp-rail .hp-sidebar-foot, .hp-rail .hp-menu-group { display: none; }
    .hp-rail .hp-sidebar-brand { justify-content: center; }
    .hp-rail .hp-menu-section, .hp-rail .hp-menu-section[hidden] { display: block; }
    .hp-rail .hp-menu-section + .hp-menu-section { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.1); }
    .hp-rail .hp-menu-item { justify-content: center; padding: 11px 0; }
    .hp-rail .hp-menu-item:hover { transform: none; }
    .hp-rail .hp-sidebar-scroll { padding: 4px 8px 22px; }
}

/* Atalho de teclado para o conteúdo e casca pública (páginas sem sessão) */
.hp-skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: var(--hp-r-sm); background: var(--hp-amarelo); color: var(--hp-ink); font-weight: 700; text-decoration: none; }
.hp-skip:focus { top: 12px; }
.hp-main:focus { outline: none; }
.hp-public { min-height: 100vh; display: flex; flex-direction: column; }
.hp-public-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 22px; background: linear-gradient(185deg, var(--hp-nav-0), var(--hp-nav-1)); }
.hp-public .hp-main { margin: 0 auto; }

/* ===== Barra superior ===== */
.hp-topbar {
    display: flex; align-items: center; gap: 12px;
    background: rgba(255,255,255,.9); backdrop-filter: saturate(160%) blur(8px); -webkit-backdrop-filter: saturate(160%) blur(8px);
    border-bottom: 1px solid var(--hp-line); padding: 10px 26px; min-height: 60px;
    position: sticky; top: 0; z-index: 20;
}
.hp-icon-btn {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 40px; height: 40px; border-radius: var(--hp-r-sm); border: 1px solid var(--hp-line);
    background: var(--hp-surface); color: var(--hp-azul); cursor: pointer;
    transition: all .15s var(--hp-ease);
}
.hp-icon-btn:hover { color: var(--hp-laranja); border-color: var(--hp-laranja-500); }
.hp-nav-toggle { display: none; }
.hp-env-badge { background: var(--hp-amarelo); color: #3A2A00; font-weight: 700; font-size: 11px; letter-spacing: .05em; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.hp-topbar-title { font-size: 13px; color: var(--hp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hp-user { margin-left: auto; display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 600; color: var(--hp-ink); min-width: 0; }
a.hp-user { text-decoration: none; min-height: 44px; padding: 0 8px; border-radius: var(--hp-r-sm); }
a.hp-user:hover { background: var(--hp-info-bg); }
.hp-user-key { color: var(--hp-muted); }
.hp-user-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.hp-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--hp-laranja-500), var(--hp-azul)); color: #fff; font-weight: 700; font-size: 13px;
}
.hp-logout-form { margin: 0; }
.hp-logout {
    display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
    background: none; border: 1px solid var(--hp-line); color: var(--hp-muted); cursor: pointer;
    font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: var(--hp-r-sm);
    transition: all .18s var(--hp-ease);
}
.hp-logout:hover { color: var(--hp-danger); border-color: #F2C4BF; background: var(--hp-danger-bg); }
.hp-drawer-backdrop { display: none; }

/* ===== Área principal ===== */
.hp-main { padding: 26px 30px 40px; flex: 1; width: 100%; max-width: 1360px; animation: hp-rise .35s var(--hp-ease) backwards; }
@keyframes hp-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hp-footer { padding: 0 30px 22px; font-size: 12px; color: var(--hp-muted); }

/* Cabeçalho de página (views usam .catalogue-intro / .intro) */
.catalogue-intro, .intro {
    display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px;
    margin-bottom: 20px;
}
.catalogue-intro > div, .intro > div:first-child { min-width: 0; }
.catalogue-intro h1, .intro h1 { margin: 0; color: var(--hp-ink); font-size: 26px; font-weight: 800; letter-spacing: -.015em; line-height: 1.15; }
.catalogue-intro h1 br, .intro h1 br { display: none; }
.catalogue-intro h1 em, .intro h1 em { font-style: normal; color: var(--hp-azul); }
.catalogue-intro > p { margin: 0; max-width: 520px; color: var(--hp-muted); font-size: 14px; }
.eyebrow { display: block; margin: 0 0 6px; color: var(--hp-laranja); font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
h2 { color: var(--hp-ink); font-size: 18px; font-weight: 700; margin-bottom: 0; }

/* ===== Cartões ===== */
.catalogue-panel, .status-panel, .form-panel {
    background: var(--hp-surface); border: 1px solid var(--hp-line); border-radius: var(--hp-r-lg);
    box-shadow: var(--hp-shadow); padding: 20px 22px; margin-bottom: 20px;
}
.form-panel { max-width: 960px; }
.catalogue-heading, .status-heading {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 18px;
    padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--hp-line);
}
.catalogue-heading .eyebrow, .status-heading .eyebrow { margin-bottom: 2px; }
.action-group { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }

/* ===== Botões ===== */
.module-action, .form-submit, .catalogue-search button, .hp-btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px;
    padding: 9px 16px; border: 0; border-radius: var(--hp-r-sm); cursor: pointer; text-decoration: none;
    background: linear-gradient(135deg, var(--hp-azul-600), var(--hp-azul)); color: #fff;
    font: 600 14px "Public Sans", sans-serif; white-space: nowrap;
    box-shadow: 0 2px 8px rgba(15,58,145,.28);
    transition: transform .16s var(--hp-ease), box-shadow .16s var(--hp-ease), filter .16s var(--hp-ease);
}
.module-action:hover, .form-submit:hover, .catalogue-search button:hover, .hp-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(15,58,145,.34); filter: brightness(1.06); color: #fff; }
.form-submit { min-width: 190px; }
.form-submit:disabled, .module-action[aria-disabled="true"] { opacity: .6; cursor: wait; transform: none; box-shadow: none; }
.hp-btn-accent {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
    padding: 12px 18px; border: 0; border-radius: var(--hp-r-sm); cursor: pointer; text-decoration: none;
    background: linear-gradient(135deg, var(--hp-amarelo), var(--hp-laranja-500)); color: var(--hp-ink);
    font: 700 15px "Public Sans", sans-serif; box-shadow: 0 4px 14px rgba(243,108,31,.32);
    transition: transform .16s var(--hp-ease), box-shadow .16s var(--hp-ease), filter .16s var(--hp-ease);
}
.hp-btn-accent:hover { transform: translateY(-1px); filter: brightness(1.04); box-shadow: 0 8px 20px rgba(243,108,31,.38); }
.back-link, .clear-link {
    display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px;
    border: 1px solid var(--hp-line); border-radius: var(--hp-r-sm); background: var(--hp-surface);
    color: var(--hp-text); font-weight: 600; font-size: 13.5px; text-decoration: none; white-space: nowrap;
    transition: all .16s var(--hp-ease);
}
.back-link:hover, .clear-link:hover { border-color: var(--hp-azul-600); color: var(--hp-azul-600); box-shadow: var(--hp-shadow); }
.table-action {
    display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 4px 10px;
    border-radius: var(--hp-r-sm); color: var(--hp-azul-600); font-weight: 700; font-size: 13px;
    text-decoration: none; white-space: nowrap; transition: background .15s var(--hp-ease);
}
.table-action:hover { background: var(--hp-info-bg); }
.table-action + .table-action { margin-left: 4px; }
.table-action.is-danger { color: var(--hp-danger); }
.module-action.is-danger { background: var(--hp-danger); border-color: var(--hp-danger); color: #fff; }
.status-message ul { margin: 6px 0 0 18px; }
.table-action.is-danger:hover { background: var(--hp-danger-bg); }
.row-actions { white-space: normal; }
/* Ações em linha: bloco flexível com espaço uniforme; todas com ícone, então têm a mesma altura. */
.hp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.hp-actions .table-action + .table-action { margin-left: 0; }
.catalogue-table td.row-actions { padding-left: 8px; padding-right: 10px; }
.row-actions .table-action { display: flex; width: max-content; padding: 4px 6px; }
.row-actions .table-action + .table-action { margin-left: 0; margin-top: 2px; }
.status-message .table-action { margin-left: 6px; }

/* ===== Busca / filtros ===== */
.catalogue-search { margin: 0 0 16px; }
.catalogue-search label { display: block; margin-bottom: 6px; color: var(--hp-muted); font-size: 12.5px; font-weight: 600; }
.search-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search-row input, .search-row select {
    flex: 1 1 260px; min-width: 0; max-width: 460px; min-height: 42px; padding: 9px 13px;
    border: 1px solid var(--hp-line); border-radius: var(--hp-r-sm); background: var(--hp-surface);
    color: var(--hp-ink); font: inherit; font-size: 14px;
}
.search-row input[type="date"] { flex: 0 0 auto; width: 170px; }
.search-row input:focus, .search-row select:focus { outline: none; border-color: var(--hp-laranja-500); box-shadow: var(--hp-ring); }
/* Filtros com vários campos (entradas): cada campo com rótulo próprio, em grade que empilha no celular */
.hp-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 12px; align-items: end; }
.hp-filters input, .hp-filters select { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--hp-line); border-radius: var(--hp-r-sm); background: var(--hp-surface); color: var(--hp-ink); font: inherit; font-size: 14px; }
.hp-filters input:focus, .hp-filters select:focus { outline: none; border-color: var(--hp-laranja-500); box-shadow: var(--hp-ring); }
.hp-filters-actions { display: flex; gap: 8px; align-items: center; }
.results-summary { margin: 12px 0 10px; color: var(--hp-muted); font-size: 13px; }

/* ===== Tabelas ===== */
.catalogue-table-wrap { overflow-x: auto; border: 1px solid var(--hp-line); border-radius: var(--hp-r-lg); background: var(--hp-surface); }
.catalogue-table { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0; background: var(--hp-surface); }
.catalogue-table.compact-table { min-width: 0; }
.catalogue-table th, .catalogue-table td { text-align: left; padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--hp-line); vertical-align: middle; }
.catalogue-table thead th { background: var(--hp-surface-2); color: var(--hp-muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.catalogue-table tbody tr { transition: background .12s ease; }
.catalogue-table tbody tr:hover { background: #F4F7FD; }
.catalogue-table tbody tr:last-child td { border-bottom: 0; }
.catalogue-table td strong, .catalogue-table td small { display: block; }
.catalogue-table td strong { color: var(--hp-ink); font-weight: 600; }
.catalogue-table td small { margin-top: 3px; color: var(--hp-muted); font-size: 12.5px; }
.catalogue-table td small.protected-account { color: var(--hp-danger); font-weight: 700; }
.catalogue-table .numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Tabelas largas (resumo financeiro, 9 colunas): células mais justas para caber sem rolagem no desktop. */
.catalogue-table.dense-table th, .catalogue-table.dense-table td { padding: 10px 10px; font-size: 13.5px; }
.catalogue-table.dense-table thead th { font-size: 10.5px; }
.catalogue-table .stock-alert { color: var(--hp-danger); font-weight: 800; }
.muted { color: var(--hp-muted); font-size: 12.5px; }

.catalogue-table tr.is-negative td { color: var(--hp-danger); }
.catalogue-table tr.is-negative td strong { color: var(--hp-danger); }

/* ===== Gráfico de barras (_BarChart) ===== */
.hp-bars { margin: 0; }
.hp-bars figcaption { margin-bottom: 10px; color: var(--hp-muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.hp-bars ol { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.hp-bars li { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr) auto; gap: 12px; align-items: center; font-size: 13.5px; }
.hp-bar-label { color: var(--hp-ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-bar-track { height: 14px; border-radius: 999px; background: var(--hp-surface-2); border: 1px solid var(--hp-line); overflow: hidden; }
.hp-bar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--hp-azul-600), var(--hp-azul)); }
.hp-bars li.is-laranja .hp-bar-fill { background: linear-gradient(90deg, var(--hp-amarelo), var(--hp-laranja)); }
.hp-bar-value { color: var(--hp-ink); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hp-bars-empty, .hp-bars-note { margin: 10px 0 0; color: var(--hp-muted); font-size: 13px; }
.cost-metrics + .hp-bars { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--hp-line); border-radius: var(--hp-r); }

/* ===== Mensagens ===== */
.status-message, .validation-summary {
    margin: 0 0 14px; padding: 11px 14px 11px 40px; border-radius: var(--hp-r);
    border: 1px solid transparent; font-size: 14px; font-weight: 600; position: relative;
}
.status-message::before, .validation-summary::before { position: absolute; left: 14px; top: 11px; font-weight: 800; }
.status-message.success { background: var(--hp-success-bg); color: #0F5F3A; border-color: #BFE5CF; }
.status-message.success::before { content: "✓"; }
.status-message.pending { background: var(--hp-info-bg); color: var(--hp-azul-700); border-color: #C9D8F5; }
.status-message.pending::before { content: "i"; }
.status-message.attention { background: var(--hp-warning-bg); color: #6E3F00; border-color: #F6D9A4; }
.status-message.attention::before { content: "!"; }
.validation-summary { background: var(--hp-danger-bg); color: #8A1C12; border-color: #F4C9C3; }
.validation-summary::before { content: "!"; }
.validation-summary.validation-summary-valid, .validation-summary:empty { display: none; }
.validation-summary ul { margin: 0; padding-left: 18px; }
.field-validation-error { color: var(--hp-danger); font-size: 12.5px; font-weight: 600; }
.field-validation-valid { display: none; }

/* ===== Formulários ===== */
.movement-form { display: grid; gap: 18px; margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.movement-form label { display: block; margin-bottom: 6px; color: var(--hp-muted); font-size: 12.5px; font-weight: 600; }
.movement-form input, .movement-form select, .movement-form textarea {
    width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--hp-line); border-radius: var(--hp-r-sm);
    background: var(--hp-surface); color: var(--hp-ink); font: inherit; font-size: 14.5px;
    transition: border-color .15s var(--hp-ease), box-shadow .15s var(--hp-ease);
}
.movement-form textarea { min-height: 96px; resize: vertical; }
.movement-form input:focus, .movement-form select:focus, .movement-form textarea:focus { outline: none; border-color: var(--hp-laranja-500); box-shadow: var(--hp-ring); }
.movement-form input[readonly] { background: var(--hp-surface-2); color: var(--hp-muted); }
.movement-form .input-validation-error { border-color: var(--hp-danger); }
.movement-form fieldset { margin: 0; padding: 16px; border: 1px solid var(--hp-line); border-radius: var(--hp-r); }
.movement-form legend { padding: 0 8px; color: var(--hp-muted); font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.field-help { margin: 6px 0 0; color: var(--hp-muted); font-size: 12.5px; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; padding-top: 4px; }
.permission-checklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; margin-top: 12px; }
.movement-form .permission-checklist label { display: flex; align-items: center; gap: 9px; margin: 0; min-height: 36px; color: var(--hp-ink); font-size: 13.5px; font-weight: 600; }
.movement-form .permission-checklist input[type="checkbox"] { width: 18px; min-width: 18px; min-height: 18px; margin: 0; padding: 0; accent-color: var(--hp-laranja); }
/* Permissões agrupadas pelo menu pai (_PermissionChecklist) */
.hp-perm { display: grid; gap: 12px; }
.hp-perm-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.hp-perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.movement-form .hp-perm-group { padding: 8px 14px 12px; background: var(--hp-surface-2); }
.movement-form .hp-perm-group legend { padding: 0 6px; font-size: 13.5px; letter-spacing: 0; text-transform: none; color: var(--hp-ink); }
.movement-form .hp-perm label { display: flex; align-items: center; gap: 9px; min-height: 40px; margin: 0; color: var(--hp-ink); font-size: 13.5px; font-weight: 600; }
.movement-form .hp-perm-group legend label { font-weight: 800; }
.movement-form .hp-perm input[type="checkbox"] { width: 20px; min-width: 20px; min-height: 20px; margin: 0; padding: 0; accent-color: var(--hp-laranja); }
.movement-form .checkbox-field { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 12px 0; font-weight: 600; cursor: pointer; }
.movement-form .checkbox-field input[type="checkbox"] { width: 20px; min-width: 20px; min-height: 20px; margin: 0; padding: 0; accent-color: var(--hp-laranja); }
.hp-perm code, .catalogue-table code { font: 600 11px ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--hp-muted); background: var(--hp-surface); border: 1px solid var(--hp-line); border-radius: 6px; padding: 1px 6px; }
.hp-perm label code { margin-left: auto; }
.hp-perm-warning { margin: 6px 0 0; font-size: 12.5px; font-weight: 600; color: var(--hp-warning); }
.password-field { display: flex; gap: 8px; }
.password-field input { flex: 1; }
.password-toggle {
    flex: none; min-height: 44px; padding: 0 14px; border: 1px solid var(--hp-line); border-radius: var(--hp-r-sm);
    background: var(--hp-surface); color: var(--hp-azul); font: 600 13px "Public Sans", sans-serif; cursor: pointer;
}
.password-toggle:hover { border-color: var(--hp-azul-600); }
.entry-source-form .search-row select { flex: 1 1 320px; width: auto; max-width: none; }
.entry-source-result { margin-top: 4px; }

/* ===== Grade de itens (movimentos e entradas; itens.js) ===== */
.hp-items { display: grid; gap: 12px; }
.hp-items[hidden], .hp-items [hidden] { display: none !important; }
.hp-items-picker { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 12px; align-items: end; padding: 14px; border-radius: var(--hp-r); background: var(--hp-surface-2); border: 1px solid var(--hp-line); }
.hp-items-picker.has-price { grid-template-columns: minmax(0, 1fr) 130px 150px auto; }
.hp-items-picker.is-tool { grid-template-columns: minmax(0, 1fr) auto; }
.hp-items-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.hp-items-buttons .module-action, .hp-items-buttons .back-link { min-height: 44px; }
.hp-combo { position: relative; min-width: 0; }
.hp-combo-box { position: relative; }
.hp-combo-box > .hp-i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--hp-muted); pointer-events: none; }
.movement-form .hp-combo-box input { padding-left: 36px; }
.hp-combo-list {
    position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
    max-height: min(340px, 50vh); overflow-y: auto; background: var(--hp-surface); border: 1px solid var(--hp-line);
    border-radius: var(--hp-r); box-shadow: var(--hp-shadow-lg);
}
.hp-combo-option { display: grid; gap: 2px; padding: 9px 11px; border-radius: var(--hp-r-sm); cursor: pointer; }
.hp-combo-option strong { color: var(--hp-ink); font-size: 13.5px; font-weight: 600; }
.hp-combo-option small { color: var(--hp-muted); font-size: 12px; }
.hp-combo-option small.is-zero { color: var(--hp-danger); }
.hp-combo-option:hover, .hp-combo-option[aria-selected="true"] { background: var(--hp-info-bg); }
.hp-combo-empty { padding: 10px 12px; color: var(--hp-muted); font-size: 13px; }
.hp-items-msg { margin: 0; padding: 9px 12px; border-radius: var(--hp-r-sm); font-size: 13.5px; font-weight: 600; }
.hp-items-msg.is-error { background: var(--hp-danger-bg); color: #8A1C12; }
.hp-items-msg.is-ok { background: var(--hp-success-bg); color: #0F5F3A; }
.hp-items-msg.is-info { background: var(--hp-info-bg); color: var(--hp-azul-700); }
.hp-items-undo { min-height: 32px; margin-left: 4px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; }
.hp-items-undo:hover { background: rgba(15,58,145,.08); }
.hp-items-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hp-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px 14px; padding: 10px 12px; border: 1px solid var(--hp-line); border-radius: var(--hp-r); background: var(--hp-surface); }
.hp-item.is-warning { border-color: #F2C4BF; background: #FFF8F7; }
.hp-item-main { min-width: 0; display: grid; gap: 2px; }
.hp-item-main strong { color: var(--hp-ink); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.hp-item-main small { color: var(--hp-muted); font-size: 12.5px; }
.hp-item-main .hp-item-alert { color: var(--hp-danger); font-weight: 700; }
.hp-item-qty { display: grid; justify-items: end; gap: 2px; text-align: right; font-variant-numeric: tabular-nums; }
.hp-item-qty b { color: var(--hp-ink); font-size: 15px; white-space: nowrap; }
.hp-item-qty small { color: var(--hp-muted); font-size: 12px; white-space: nowrap; }
.hp-item-actions { display: flex; gap: 6px; }
.hp-icon-btn.is-danger { color: var(--hp-danger); }
.hp-icon-btn.is-danger:hover { border-color: #F2C4BF; background: var(--hp-danger-bg); color: var(--hp-danger); }
.hp-items-empty { margin: 0; padding: 14px; border: 1px dashed var(--hp-line); border-radius: var(--hp-r); color: var(--hp-muted); text-align: center; font-size: 13.5px; }
.hp-items-sum { margin: 0; text-align: right; color: var(--hp-ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.hp-items-sum:empty { display: none; }

/* ===== Indicadores (KPI) ===== */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin: 0; }
.metric-grid > div {
    position: relative; overflow: hidden; padding: 16px 18px; background: var(--hp-surface);
    border: 1px solid var(--hp-line); border-radius: var(--hp-r-lg); box-shadow: var(--hp-shadow);
    container-type: inline-size;
}
.metric-grid > div::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--hp-azul); }
.metric-grid > div:nth-child(2n)::before { background: var(--hp-laranja-500); }
.metric-grid > div:nth-child(3n)::before { background: var(--hp-amarelo-600); }
.metric-grid dt { color: var(--hp-muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
/* O número acompanha a largura do cartão e só quebra no espaço ("R$" / "1.686.266,32"), nunca no meio. */
.metric-grid dd { margin: 6px 0 0; color: var(--hp-ink); font: 800 26px "Bricolage Grotesque", sans-serif; font-size: clamp(16px, 11.5cqi, 26px); line-height: 1.12; font-variant-numeric: tabular-nums; overflow-wrap: normal; word-break: normal; }
.metric-grid dd.metric-note { margin-top: 4px; font: 600 12px "Public Sans", sans-serif; color: var(--hp-muted); }
.status-panel .metric-grid { margin-top: 4px; }
.cost-metrics { margin-top: 12px; }

/* ===== Detalhes (dl) ===== */
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0 0 16px; border: 1px solid var(--hp-line); border-radius: var(--hp-r); overflow: hidden; }
.detail-grid div { padding: 12px 16px; border-bottom: 1px solid var(--hp-line); }
.detail-grid div:nth-child(odd) { border-right: 1px solid var(--hp-line); }
.detail-grid dt { color: var(--hp-muted); font-size: 12px; font-weight: 700; }
.detail-grid dd { margin: 4px 0 0; color: var(--hp-ink); overflow-wrap: anywhere; }

/* ===== Vazio / paginação ===== */
.empty-state { display: flex; align-items: center; gap: 16px; padding: 22px; border-radius: var(--hp-r); background: var(--hp-surface-2); border: 1px dashed var(--hp-line); color: var(--hp-muted); }
.empty-state span { color: var(--hp-laranja-500); font: 800 28px "Bricolage Grotesque", sans-serif; }
.empty-state p { margin: 0; max-width: 620px; }
.pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin-top: 14px; color: var(--hp-muted); font-size: 13.5px; }
.pagination > span:last-child { display: inline-flex; gap: 8px; }
.pagination a { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; border: 1px solid var(--hp-line); border-radius: var(--hp-r-sm); background: var(--hp-surface); color: var(--hp-azul); font-weight: 700; text-decoration: none; }
.pagination a:hover { border-color: var(--hp-azul-600); }

/* ===== Painel (Início) ===== */
.hp-welcome { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 20px; }
.hp-welcome h1 { margin: 0; color: var(--hp-ink); font-size: 26px; font-weight: 800; letter-spacing: -.015em; }
.hp-welcome p { margin: 4px 0 0; color: var(--hp-muted); }
.hp-panel-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.hp-panel-grid > .catalogue-panel { margin-bottom: 0; }
.hp-quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.hp-quick a {
    display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
    padding: 14px 16px; min-height: 72px; border: 1px solid var(--hp-line); border-radius: var(--hp-r-lg);
    background: var(--hp-surface); box-shadow: var(--hp-shadow); color: var(--hp-ink); text-decoration: none;
    transition: transform .16s var(--hp-ease), border-color .16s var(--hp-ease);
}
.hp-quick a:hover { transform: translateY(-2px); border-color: var(--hp-laranja-500); }
.hp-quick .hp-quick-ico { grid-row: 1 / 3; width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--hp-info-bg); color: var(--hp-azul); }
.hp-quick a:nth-child(3n+2) .hp-quick-ico { background: #FFF1E3; color: var(--hp-laranja); }
.hp-quick b { font-size: 14px; }
.hp-quick small { color: var(--hp-muted); font-size: 12px; line-height: 1.35; }
.hp-company { display: flex; flex-wrap: wrap; gap: 0 4px; }
.hp-company strong { color: var(--hp-ink); }
.hp-status-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; background: var(--hp-azul); color: #fff; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; box-shadow: 0 4px 14px rgba(15,58,145,.25); }
.hp-status-chip .hp-i { width: 15px; height: 15px; color: var(--hp-amarelo); }
.hp-kpis { margin-bottom: 20px; }
.hp-kpis dt { display: flex; align-items: center; gap: 7px; }
.hp-kpis dt .hp-i { width: 16px; height: 16px; color: var(--hp-azul-600); }
.hp-panel-grid { margin-bottom: 20px; }
.hp-panel-grid.is-single { grid-template-columns: 1fr; }
.hp-panel-alert { border-left: 4px solid var(--hp-danger); }
.hp-badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.hp-badge.is-in { background: var(--hp-success-bg); color: var(--hp-success); }
.hp-badge.is-out { background: var(--hp-danger-bg); color: var(--hp-danger); }
.hp-badge.is-neutral { background: var(--hp-info-bg); color: var(--hp-azul-700); }
.hp-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.hp-section-title h2 { font-size: 16px; }
.module-empty { margin-top: 12px; }

/* ===== Login ===== */
.hp-login-stage {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    background:
        radial-gradient(60% 70% at 10% 8%, rgba(26,77,184,.65), transparent 60%),
        radial-gradient(55% 60% at 92% 14%, rgba(245,151,20,.42), transparent 55%),
        radial-gradient(70% 70% at 78% 100%, rgba(253,208,40,.22), transparent 55%),
        var(--hp-azul-900);
}
.hp-login-card {
    display: grid; grid-template-columns: 1.08fr 1fr; width: 100%; max-width: 980px; min-height: 600px;
    border-radius: 24px; overflow: hidden; background: #fff;
    box-shadow: 0 30px 80px rgba(3,12,34,.5); animation: hp-rise .5s var(--hp-ease) both;
}
.hp-login-aside {
    position: relative; display: flex; flex-direction: column; gap: 20px; padding: 36px 36px 28px; color: #EAF0FB; overflow: hidden;
    background: linear-gradient(170deg, rgba(15,58,145,.80) 0%, rgba(11,47,120,.88) 45%, rgba(8,31,82,.96) 100%), url("../img/obra-login.jpg") 72% center / cover no-repeat;
}
.hp-login-aside::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: linear-gradient(90deg, var(--hp-laranja), var(--hp-amarelo)); }
.hp-login-aside > * { position: relative; }
.hp-login-logo { display: flex; align-items: center; gap: 14px; }
.hp-login-logo .hp-bolt { width: 54px; height: 66px; }
.hp-login-logo .hp-brand-name { font-size: 44px; }
.hp-login-logo .hp-brand-name .hp-dots i:first-child { width: 10px; height: 10px; margin-bottom: 18px; }
.hp-login-logo .hp-brand-name .hp-dots i:last-child { width: 16px; height: 16px; margin-bottom: 6px; }
.hp-login-logo .hp-brand-sub { font-size: 13px; letter-spacing: .06em; text-transform: none; font-style: italic; color: #EAF0FB; }
.hp-login-aside-title { margin: 8px 0 6px; color: #fff; font-size: 26px; font-weight: 800; line-height: 1.15; letter-spacing: -.01em; }
.hp-login-aside-sub { margin: 0; max-width: 40ch; opacity: .88; font-size: 14px; }
.hp-login-tiles { list-style: none; margin: auto 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hp-login-tiles li { display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); }
.hp-login-tiles .hp-i { grid-row: 1 / 3; width: 22px; height: 22px; color: var(--hp-amarelo); }
.hp-login-tiles b { font-size: 13.5px; color: #fff; line-height: 1.2; }
.hp-login-tiles span { font-size: 11.5px; opacity: .8; line-height: 1.3; }
.hp-login-aside-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.16); font-size: 12px; }
.hp-login-aside-foot span { display: inline-flex; align-items: center; gap: 5px; }
.hp-login-aside-foot .hp-i { width: 14px; height: 14px; color: var(--hp-amarelo); }
.hp-login-form { display: flex; flex-direction: column; justify-content: center; padding: 44px 44px 32px; background: #fff; }
.hp-login-brand-m { display: none; align-items: center; gap: 12px; margin: 0 0 22px; padding: 14px 16px; border-radius: 14px; background: linear-gradient(165deg, var(--hp-azul), var(--hp-azul-900)); }
.hp-login-brand-m .hp-bolt { width: 30px; height: 38px; }
.hp-login-eyebrow { color: var(--hp-laranja); font-weight: 700; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; }
.hp-login-form h1 { margin: 6px 0 4px; color: var(--hp-ink); font-size: 30px; font-weight: 800; letter-spacing: -.01em; }
.hp-login-sub { margin: 0 0 24px; color: var(--hp-muted); font-size: 14px; }
.hp-field { display: flex; flex-direction: column; margin-bottom: 14px; }
.hp-field label { margin-bottom: 6px; color: var(--hp-ink); font-size: 13px; font-weight: 600; }
.hp-input-ico { position: relative; display: flex; }
.hp-input-ico > .hp-i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--hp-muted); pointer-events: none; }
.hp-input-ico input {
    width: 100%; min-height: 48px; padding: 10px 12px 10px 42px; border: 1px solid var(--hp-line); border-radius: var(--hp-r-sm);
    background: #fff; color: var(--hp-ink); font: inherit; font-size: 16px;
}
.hp-input-ico input:focus { outline: none; border-color: var(--hp-laranja-500); box-shadow: var(--hp-ring); }
.hp-input-ico:focus-within > .hp-i { color: var(--hp-laranja); }
.hp-input-ico.has-action input { padding-right: 48px; }
.hp-input-action { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--hp-r-sm); background: none; color: var(--hp-muted); cursor: pointer; }
.hp-input-action:hover { color: var(--hp-azul); background: rgba(15,58,145,.08); }
.hp-hint { display: flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--hp-warning); }
.hp-hint[hidden] { display: none; }
.hp-hint .hp-i { width: 14px; height: 14px; }
.hp-login-error { margin: 0 0 14px; padding: 11px 14px; border-radius: var(--hp-r); background: var(--hp-danger-bg); color: #8A1C12; border: 1px solid #F4C9C3; font-weight: 600; font-size: 14px; }
.hp-login-btn { width: 100%; margin-top: 6px; }
.hp-remember { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0 0 12px; color: var(--hp-text); font-size: 14px; cursor: pointer; }
.hp-remember input { width: 18px; height: 18px; margin: 0; accent-color: var(--hp-laranja); }
.hp-login-help { margin: 16px 0 0; color: var(--hp-muted); font-size: 12.5px; line-height: 1.45; }
.hp-login-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; margin-top: 26px; font-size: 11.5px; color: var(--hp-muted); }

/* ===== Páginas de status ===== */
.hp-status-page { max-width: 640px; }

/* ===== Responsivo ===== */
@media (max-width: 1100px) {
    .hp-main { padding: 22px 20px 32px; }
    .hp-panel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    /* Menu vira gaveta (off-canvas), aberta pelo botão de menu da barra superior */
    .hp-sidebar {
        position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh; width: 280px; max-width: 86vw;
        transform: translateX(-100%); transition: transform .26s var(--hp-ease); z-index: 60;
        box-shadow: 4px 0 22px rgba(8,31,82,.25);
    }
    .hp-shell.is-drawer-open .hp-sidebar { transform: translateX(0); }
    .hp-drawer-backdrop { display: block; position: fixed; inset: 0; background: rgba(8,31,82,.5); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .26s var(--hp-ease); }
    .hp-shell.is-drawer-open .hp-drawer-backdrop { opacity: 1; pointer-events: auto; }
    .hp-rail-toggle { display: none; }
    .hp-nav-toggle { display: inline-flex; }
    .hp-topbar { padding: 8px 14px; gap: 8px; }
    .hp-topbar-title { display: none; }
    .hp-user-name { display: none; }
    .hp-logout span { display: none; }
    .form-grid, .permission-checklist, .detail-grid { grid-template-columns: 1fr; }
    .detail-grid div:nth-child(odd) { border-right: 0; }
    .hp-login-card { grid-template-columns: 1fr; max-width: 480px; min-height: 0; }
    .hp-login-aside { display: none; }
    .hp-login-form { padding: 26px 22px 22px; }
    .hp-login-brand-m { display: flex; }
    .hp-login-stage {
        align-items: flex-start; padding: 16px; padding-top: max(20px, 5vh);
        background: linear-gradient(180deg, rgba(15,58,145,.86), rgba(8,31,82,.95)), url("../img/obra-login.jpg") 70% center / cover no-repeat, var(--hp-azul-900);
    }
}
@media (max-width: 640px) {
    .hp-main { padding: 16px 12px 28px; }
    .hp-footer { padding: 0 12px 18px; }
    .catalogue-intro h1, .intro h1, .hp-welcome h1 { font-size: 22px; }
    .catalogue-panel, .status-panel, .form-panel { padding: 16px 14px; border-radius: var(--hp-r); }
    .catalogue-heading { flex-direction: column; align-items: stretch; }
    .action-group { flex-direction: column; align-items: stretch; }
    .action-group > *, .form-actions > *, .search-row > * { width: 100%; max-width: none; justify-content: center; }
    /* O status lido por leitores de tela continua com 1 px; sem isto ocupava a largura toda e empurrava a página. */
    .form-actions > .sr-only { width: 1px; }
    .form-actions { flex-direction: column; align-items: stretch; }
    .form-submit { min-width: 0; }
    .search-row input[type="date"] { width: 100%; }
    .hp-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .hp-filters > div:nth-child(n+3) { grid-column: 1 / -1; }
    .hp-filters input, .hp-filters select { font-size: 16px; }
    .hp-filters-actions > * { flex: 1 1 auto; justify-content: center; }
    .movement-form input, .movement-form select, .movement-form textarea, .search-row input, .search-row select { font-size: 16px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .metric-grid > div { padding: 13px 12px 13px 16px; }
    /* Números quebram só no espaço ("R$ 1.686.266,32" → "R$" / "1.686.266,32"), nunca no meio. */
    .metric-grid dd { font-size: clamp(15px, 12cqi, 21px); }
    .pagination { flex-direction: column; align-items: stretch; }
    .pagination > span:last-child a { flex: 1; justify-content: center; }

    .hp-items-picker, .hp-items-picker.has-price, .hp-items-picker.is-tool { grid-template-columns: 1fr 1fr; padding: 12px; }
    .hp-items-picker .hp-combo, .hp-items-picker .hp-items-buttons { grid-column: 1 / -1; }
    .hp-items-picker.is-tool .hp-items-buttons, .hp-items-picker:not(.has-price) .hp-items-qty { grid-column: 1 / -1; }
    .hp-items-buttons > * { flex: 1 1 auto; justify-content: center; }
    .hp-item { grid-template-columns: minmax(0, 1fr) auto; }
    .hp-item-qty { grid-column: 1; grid-row: 2; justify-items: start; text-align: left; }
    .hp-item-actions { grid-column: 2; grid-row: 1 / span 2; flex-direction: column; }
    .hp-combo-list { max-height: 45vh; }
    .hp-items-undo { min-height: 44px; }
    .hp-bars li { grid-template-columns: 1fr auto; row-gap: 4px; }
    .hp-bar-label { grid-column: 1 / -1; white-space: normal; }
    .results-summary .table-action, .status-message .table-action { min-height: 44px; }
    .movement-form .hp-perm label { min-height: 44px; }
    /* Tabelas viram cartões: app.js copia o cabeçalho de cada coluna para data-label */
    .catalogue-table-wrap.is-stacked { overflow: visible; border: 0; background: none; }
    .catalogue-table.is-stackable { min-width: 0; background: none; }
    .catalogue-table.is-stackable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
    .catalogue-table.is-stackable, .catalogue-table.is-stackable tbody, .catalogue-table.is-stackable tr, .catalogue-table.is-stackable td { display: block; width: 100%; }
    .catalogue-table.is-stackable tr { margin-bottom: 10px; padding: 6px 0; background: var(--hp-surface); border: 1px solid var(--hp-line); border-radius: var(--hp-r); box-shadow: var(--hp-shadow); }
    .catalogue-table.is-stackable tbody tr:hover { background: var(--hp-surface); }
    .catalogue-table.is-stackable td { display: grid; grid-template-columns: minmax(84px, 34%) minmax(0, 1fr); gap: 10px; align-items: baseline; justify-items: start; padding: 6px 14px; border: 0; text-align: left; white-space: normal; overflow-wrap: anywhere; }
    .catalogue-table.is-stackable td::before { content: attr(data-label); color: var(--hp-muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
    .catalogue-table.is-stackable td.is-actions, .catalogue-table.is-stackable td:not([data-label]), .catalogue-table.is-stackable td[data-label=""] { display: flex; flex-wrap: wrap; gap: 6px; }
    .catalogue-table.is-stackable td.is-actions::before, .catalogue-table.is-stackable td:not([data-label])::before, .catalogue-table.is-stackable td[data-label=""]::before { content: none; }
    .catalogue-table.is-stackable td.is-actions { padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--hp-line); }
    .catalogue-table.is-stackable td.is-actions .table-action { flex: 1 1 auto; justify-content: center; min-height: 44px; border: 1px solid var(--hp-line); }
    .catalogue-table.is-stackable td.is-actions .table-action + .table-action { margin-left: 0; }
    .catalogue-table.is-stackable td.is-actions .hp-actions { width: 100%; gap: 6px; }
    .catalogue-table.is-stackable .numeric { text-align: left; }
    .hp-login-form h1 { font-size: 26px; }
}
@media (max-width: 340px) {
    .metric-grid { grid-template-columns: 1fr; }
    .catalogue-table.is-stackable td { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ===== Avisos (SweetAlert2): janela de confirmação/erro e toast, no padrão da marca ===== */
.swal2-container { z-index: 2000; }
.hp-swal.swal2-popup { width: min(32rem, calc(100vw - 32px)); padding: 24px 22px 20px; border-radius: var(--hp-r); font-family: inherit; color: var(--hp-text); box-shadow: 0 20px 50px rgba(8,31,82,.22); }
.hp-swal .hp-swal-title { padding: 6px 0 0; color: var(--hp-ink); font-family: "Bricolage Grotesque", "Public Sans", sans-serif; font-size: 20px; font-weight: 800; line-height: 1.3; text-wrap: balance; }
.hp-swal .hp-swal-text { margin: 10px 0 0; padding: 0; color: var(--hp-text); font-size: 15px; line-height: 1.55; text-align: left; }
.hp-swal .hp-swal-text p { margin: 0 0 8px; }
.hp-swal .hp-swal-text ul { margin: 4px 0 0 18px; padding: 0; }
.hp-swal .hp-swal-text .status-message { margin: 0; }
.hp-swal-nome { font-weight: 700; color: var(--hp-ink); }
.hp-swal .hp-swal-actions { width: 100%; gap: 10px; margin-top: 20px; justify-content: flex-end; flex-wrap: wrap; }
.hp-swal .hp-swal-actions .module-action, .hp-swal .hp-swal-actions .back-link { min-height: 44px; margin: 0; cursor: pointer; font-size: 15px; }
.hp-swal .hp-swal-actions .module-action:focus-visible, .hp-swal .hp-swal-actions .back-link:focus-visible { outline: 3px solid var(--hp-laranja); outline-offset: 2px; }
.hp-swal .swal2-icon { margin: 4px auto 0; transform: scale(.82); }
.hp-swal-resumo { display: grid; gap: 0; margin: 4px 0 12px; border: 1px solid var(--hp-line); border-radius: var(--hp-r-sm); overflow: hidden; }
.hp-swal-resumo div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--hp-line); }
.hp-swal-resumo div:last-child { border-bottom: 0; }
.hp-swal-resumo dt { color: var(--hp-muted); font-weight: 600; }
.hp-swal-resumo dd { margin: 0; color: var(--hp-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.hp-swal-resumo .is-in dd { color: var(--hp-success); }
.hp-swal-resumo .is-out dd { color: var(--hp-danger); }
.hp-toast.swal2-popup.swal2-toast { padding: 12px 14px; border-radius: var(--hp-r); border-left: 4px solid var(--hp-success); font-family: inherit; box-shadow: var(--hp-shadow), 0 10px 30px rgba(8,31,82,.14); }
.hp-toast.swal2-popup.swal2-toast .swal2-title { margin: 0 6px; color: var(--hp-ink); font-size: 15px; font-weight: 600; line-height: 1.45; }
.hp-toast.swal2-popup.swal2-toast .swal2-timer-progress-bar { background: var(--hp-success); opacity: .55; }
.hp-toast.swal2-popup.swal2-toast .swal2-close { width: 32px; height: 32px; font-size: 22px; color: var(--hp-muted); }
@media (max-width: 860px) {
    .swal2-container.swal2-top-end { padding: 10px; }
    .hp-toast.swal2-popup.swal2-toast { width: calc(100vw - 20px); }
    .hp-swal .hp-swal-actions { flex-direction: column-reverse; }
    .hp-swal .hp-swal-actions .module-action, .hp-swal .hp-swal-actions .back-link { width: 100%; justify-content: center; }
}

/* ===== Auditoria: antes e depois ===== */
.hp-audit-diff th[scope="row"] { color: var(--hp-muted); font-weight: 700; font-size: 13px; white-space: nowrap; }
.hp-audit-diff td { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.hp-audit-diff tr.is-changed td, .hp-audit-diff tr.is-changed th { background: var(--hp-warning-bg); }
.hp-audit-diff tr.is-changed th[scope="row"] { color: var(--hp-warning); box-shadow: inset 3px 0 0 var(--hp-laranja); }
.hp-cell { display: block; }
.hp-cell-note { display: block; margin-top: 2px; color: var(--hp-muted); font-size: 12.5px; }
