/* ============================================================
   Farmácia hospitalar — módulo único (out/2026) — grupo MEDICAMENTOS (prefixo fhm-).
   Lista de Medicamentos, cadastro em modal, ficha, Categorias, Fabricantes, Kits de Aplicação,
   Fornecedores da farmácia e Parâmetros. Complementa mc-modulo.css (tokens --p-* do .mm/.mm-layer,
   claro e escuro). Sem media query de largura: a escala (mc-scale.js) cuida de 1366–1920.
   ============================================================ */

/* ---- Lista ---- */
.fhm-busca { max-width: 460px; }
.fhm-tbl .fhm-col-sel { width: 38px; }
.fhm .fhm-chk, .mm-layer .fhm-chk { width: 16px; height: 16px; accent-color: var(--p-blue-light); cursor: pointer; vertical-align: middle; }
.fhm-tbl tbody tr.sel td { background: var(--p-blue-soft); }
.fhm-tbl tbody tr.inativo td { opacity: .62; }
.fhm-tbl tbody tr.inativo:hover td { opacity: .9; }
.fhm-nome { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-weight: 700; color: var(--p-ink); line-height: 1.3; }
.fhm-conc { font-weight: 600; color: var(--p-muted); }
.fhm-sub { font-size: .66rem; font-weight: 600; color: var(--p-faint); margin-top: 2px; line-height: 1.4; }
.fhm-cods .mm-mono { font-size: .7rem; color: var(--p-text); display: flex; align-items: center; gap: 4px; }
.fhm-cods .mm-mono i { color: var(--p-faint); }
.fhm-tbl .acoes { width: 120px; }
.fhm-tbl .acoes .prmd-iconbtn { display: inline-flex; }

.fhm-selbar { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fhm-selbar-n {
    display: inline-flex; align-items: center; gap: 6px; margin-right: 4px;
    font-size: .72rem; font-weight: 800; color: var(--p-blue);
}
.fhm-selbar-n i { font-size: 16px; }
.fhm-pager { gap: 4px; }
.fhm-pager .mm-btn.xs:not(.icon) { min-width: 28px; justify-content: center; }
.fhm-alerta-lista { align-items: center; }

.fhm-lote-opts { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* ---- Cadastro (modal) ---- */
.fhm-classes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fhm-conf { gap: 8px; }
.fhm-previa {
    background: var(--p-surface); border: 1px solid var(--p-border); border-radius: 12px;
    padding: 11px 13px; box-shadow: var(--p-shadow-sm);
}
.fhm-previa-lbl { font-size: .58rem; font-weight: 800; letter-spacing: .9px; text-transform: uppercase; color: var(--p-faint); margin-bottom: 4px; }
.fhm-previa-nome { font-size: .9rem; font-weight: 800; color: var(--p-ink); line-height: 1.3; }
.fhm-previa-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.fhm-previa-chips:empty { display: none; }

.fhm-aviso {
    display: flex; align-items: flex-start; gap: 7px; padding: 7px 10px; border-radius: 10px;
    font-size: .7rem; font-weight: 600; line-height: 1.45; border: 1px solid;
}
.fhm-aviso i { font-size: 15px; flex: none; margin-top: 1px; }
.fhm-aviso.ok { background: var(--p-green-soft); border-color: var(--p-green-line); color: var(--p-green); }
.fhm-aviso.erro { background: var(--p-red-soft); border-color: var(--p-red-line); color: var(--p-red); }
.fhm-aviso.aviso { background: var(--p-orange-soft); border-color: var(--p-orange-line); color: var(--p-orange); }
.fhm-aviso.info { background: var(--p-surface); border-color: var(--p-border); color: var(--p-muted); }
.fhm-dup-tit { margin-top: 6px; }
.fhm-dup {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px;
    background: var(--p-yellow-soft); border: 1px solid var(--p-yellow-line);
}
.fhm-dup.bloq { background: var(--p-red-soft); border-color: var(--p-red-line); }
.fhm-dup-nome { font-size: .74rem; font-weight: 800; color: var(--p-ink); display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }

/* ---- Ficha ---- */
/* .mm-mmain é coluna flex com altura fixa: sem isto a tabela (overflow:auto) encolhia até sumir */
:is(.fhm-ficha, .fhm-cad, .fhm-kitmodal, .fhm-fornficha) .mm-mmain > *,
:is(.fhm-ficha, .fhm-cad, .fhm-kitmodal, .fhm-fornficha) .mm-mlist-body > * { flex-shrink: 0; }
.fhm-ficha .prmd-side { width: 300px; }
.fhm-dl { display: flex; flex-direction: column; gap: 6px; }
.fhm-dl:empty { display: none; }
.fhm-dl-l { display: flex; flex-direction: column; gap: 0; }
.fhm-dl-r { font-size: .58rem; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--p-faint); }
.fhm-dl-v { font-size: .76rem; font-weight: 600; color: var(--p-ink); line-height: 1.4; word-break: break-word; }
.fhm-ficha-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fhm-ficha-kpis .prmd-vval small { font-size: .62rem; font-weight: 700; color: var(--p-faint); }
.fhm-vazio-mini {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px;
    background: var(--p-soft); border: 1px dashed var(--p-border-strong); color: var(--p-muted);
    font-size: .72rem; font-weight: 600; line-height: 1.45;
}
.fhm-vazio-mini i { font-size: 17px; color: var(--p-faint); flex: none; }
.fhm-locais { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.fhm-local { background: var(--p-surface); border: 1px solid var(--p-border); border-radius: 12px; padding: 9px 11px; display: flex; flex-direction: column; gap: 5px; }
.fhm-local-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: .76rem; font-weight: 700; }
.fhm-local-top b { color: var(--p-ink); font-size: .9rem; font-variant-numeric: tabular-nums; }
.fhm-ficha-tbl { border: 1px solid var(--p-border); border-radius: 12px; max-height: 330px; }
.fhm-ficha-tbl .mm-tbl td, .fhm-ficha-tbl .mm-tbl th { padding: 7px 10px; }
.fhm-ficha-tbl tr.fhm-zerado td { opacity: .55; }
.fhm-movs { padding: 2px 0; }
.fhm-preco { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--p-surface); border: 1px solid var(--p-border); border-radius: 10px; }
.fhm-preco-v { font-size: .8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.fhm-mt { margin-top: 10px; }
a.fhm-kitref {
    display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 10px;
    background: var(--p-surface); border: 1px solid var(--p-border); color: var(--p-text); font-size: .74rem; font-weight: 700;
}
a.fhm-kitref > i:first-child { font-size: 17px; color: var(--p-blue); }
a.fhm-kitref:hover { border-color: var(--p-blue-line); background: var(--p-blue-soft); color: var(--p-text); }

/* ---- Cadastros simples (categorias, fabricantes, fornecedores) ---- */
.fhm-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.fhm-barra { display: flex; align-items: center; gap: 8px; }
.fhm-barra .mm-progress { flex: 1; min-width: 60px; }
.fhm-barra b { font-size: .74rem; color: var(--p-ink); font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }

/* ---- Kits ---- */
.fhm-kits { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.fhm-kit {
    background: var(--p-surface); border: 1px solid var(--p-border); border-radius: 14px; box-shadow: var(--p-shadow-sm);
    padding: 13px 14px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; text-align: left;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.fhm-kit:hover { border-color: var(--p-blue-line); box-shadow: var(--p-shadow); transform: translateY(-1px); }
.fhm-kit.inativo { opacity: .6; }
.fhm-kit-top { display: flex; align-items: flex-start; gap: 10px; }
.fhm-kit-ico {
    width: 36px; height: 36px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center;
    background: var(--p-blue-soft); color: var(--p-blue); font-size: 18px;
}
.fhm-kit-nome { font-size: .84rem; font-weight: 800; color: var(--p-ink); line-height: 1.3; }
.fhm-kit-itens { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; background: var(--p-soft); border-radius: 10px; }
.fhm-kit-item { font-size: .7rem; font-weight: 600; color: var(--p-text); display: flex; gap: 6px; }
.fhm-kit-item b { color: var(--p-ink); font-variant-numeric: tabular-nums; min-width: 34px; }
.fhm-kit-rod { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fhm-kit-rod .mm-flex1 { min-width: 0; }

.fhm-kit-busca { position: relative; }
.fhm-kit-res {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
    background: var(--p-surface); border: 1px solid var(--p-border); border-radius: 12px; box-shadow: var(--p-shadow-lg);
    max-height: 300px; overflow-y: auto; padding: 4px;
}
.fhm-kit-res button {
    width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: none; border-radius: 8px;
    background: transparent; text-align: left; font-size: .76rem; font-weight: 700; color: var(--p-ink);
}
.fhm-kit-res button:hover, .fhm-kit-res button.sel { background: var(--p-blue-soft); color: var(--p-blue); }
.fhm-kit-res button .fhm-sub { margin: 0 0 0 auto; }
.fhm-kit-res-vazio { padding: 10px; font-size: .72rem; color: var(--p-faint); text-align: center; }
.fhm-itens-tbl td { padding: 6px 8px !important; }
.fhm-itens-tbl .prmd-field.sm { height: 32px; }
.fhm-qtd { width: 82px; text-align: right; }
.fhm-ordem { display: flex; flex-direction: column; gap: 0; }
.fhm-ordem .prmd-iconbtn { width: 22px; height: 16px; font-size: 13px; }
.fhm-principal {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
    background: var(--p-blue-soft); border: 1px solid var(--p-blue-line-soft);
}
.fhm-principal i { font-size: 20px; color: var(--p-blue); }
.fhm-principal .mm-flex1 { font-size: .8rem; font-weight: 800; color: var(--p-ink); }

/* ---- Parâmetros ---- */
.fhm-param { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--p-border-soft); }
.fhm-param:last-child { border-bottom: 0; }
.fhm-param-txt { flex: 1; min-width: 0; }
.fhm-param-tit { font-size: .8rem; font-weight: 800; color: var(--p-ink); }
.fhm-param-sub { font-size: .7rem; font-weight: 500; color: var(--p-muted); margin-top: 2px; line-height: 1.45; }
.fhm-param-campo { width: 180px; flex: none; }
.fhm-param-campo .prmd-field { width: 100%; }
.fhm-exemplo { font-family: var(--p-mono); font-size: .68rem; color: var(--p-blue); margin-top: 4px; }

@media print {
    .fhm-selbar, .fhm-pager, .fhm-alerta-lista { display: none !important; }
}
