/* Honorarios Médicos - Configuración de Costos
   Estilos aislados del módulo para no alterar el Reporte Gerencial. */
:root {
    --hm-teal: #35b6b4;
    --hm-teal-dark: #087f83;
    --hm-teal-soft: #e8f7f6;
    --hm-navy: #16375f;
    --hm-muted: #7185a2;
    --hm-border: #dce6f1;
    --hm-bg: #ffffff;
    --hm-shadow: 0 2px 10px rgba(23, 55, 95, .055);
}
.main-content.hm-main {
    padding: 28px 30px 36px;
    min-width: 0;
    color: var(--hm-navy);
    font-family: 'Poppins', sans-serif;
}
.hm-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 26px;
}
.hm-page-header h1 {
    margin: 0 0 5px;
    color: #102f57;
    font-size: clamp(22px, 2vw, 30px);
    line-height: 1.25;
    font-weight: 600;
}
.hm-page-header p {
    margin: 0;
    color: var(--hm-muted);
    font-size: 14px;
}
.hm-header-tag {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 14px 18px;
    border-radius: 12px;
    background: var(--hm-teal-soft);
    color: var(--hm-teal-dark);
    font-size: 13px;
    font-weight: 500;
}
.hm-tabs {
    display: flex;
    width: min(100%, 530px);
    margin-bottom: 20px;
    border: 1px solid var(--hm-border);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
.hm-tab {
    display: inline-flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 54px;
    padding: 12px 18px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: #fff;
    color: var(--hm-navy);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}
.hm-tab.active {
    color: var(--hm-teal-dark);
    background: var(--hm-teal-soft);
    border-bottom-color: var(--hm-teal);
    font-weight: 600;
}
.hm-filter-card, .hm-table-card {
    border: 1px solid var(--hm-border);
    border-radius: 13px;
    background: var(--hm-bg);
    box-shadow: var(--hm-shadow);
}
.hm-filter-card { padding: 20px; margin-bottom: 22px; }
.hm-filters {
    display: grid;
    grid-template-columns: minmax(155px, 1fr) minmax(155px, 1fr) minmax(170px, 1fr) minmax(190px, 1.15fr) auto;
    gap: 14px;
    align-items: end;
}
/* Respeta el atributo hidden aunque el componente tenga display:flex. */
.hm-main [hidden],
.hm-modal-grid [hidden] {
    display: none !important;
}

.hm-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    color: var(--hm-navy);
    font-size: 13px;
    font-weight: 500;
}
.hm-field > span { line-height: 1.3; }
.hm-field input, .hm-field select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 13px;
    border: 1px solid #d1deed;
    border-radius: 8px;
    background: #fff;
    color: #263f62;
    font: inherit;
    font-weight: 400;
    outline: none;
}
.hm-field input:focus, .hm-field select:focus {
    border-color: var(--hm-teal);
    box-shadow: 0 0 0 3px rgba(53,182,180,.13);
}
.hm-field small { color: var(--hm-muted); font-size: 11px; font-weight: 400; }
.hm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    padding: 0 17px;
    border-radius: 9px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: .15s ease;
}
.hm-btn-primary {
    border: 1px solid var(--hm-teal);
    color: #fff;
    background: var(--hm-teal);
}
.hm-btn-primary:hover { background: #25a8a7; }
.hm-btn-outline {
    border: 1px solid var(--hm-teal);
    color: var(--hm-teal-dark);
    background: #fff;
}
.hm-btn-outline:hover { background: var(--hm-teal-soft); }
.hm-btn-ghost { border: 1px solid var(--hm-border); color: #526783; background: #fff; }
.hm-filter-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
}
.hm-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 8px 13px;
    border-radius: 8px;
    background: #edf6ff;
    color: #24558a;
    font-size: 12px;
}
.hm-info svg { flex-shrink: 0; color: #277ec5; }
.hm-table-card { overflow: hidden; }
.hm-table-wrap { width: 100%; overflow-x: auto; }
.hm-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}
.hm-table th {
    padding: 17px 15px;
    border-bottom: 1px solid var(--hm-border);
    background: #f8fafc;
    color: #234368;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}
.hm-table td {
    padding: 7px 15px;
    border-bottom: 1px solid #e7edf5;
    color: #274466;
    vertical-align: middle;
}
.hm-table tbody tr:last-child td { border-bottom: 0; }
.hm-table .hm-empty-row td {
    padding: 52px 20px;
    text-align: center;
}
.hm-empty-row td > * { display: block; margin: 0 auto 10px; }
.hm-empty-row svg { width: 28px; height: 28px; color: #91a5bc; }
.hm-empty-row strong { font-size: 14px; font-weight: 600; }
.hm-empty-row span { max-width: 480px; color: var(--hm-muted); font-size: 12px; }
.hm-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-top: 1px solid var(--hm-border);
    color: #536c8a;
    font-size: 12px;
}
.hm-pagination { display: flex; gap: 5px; }
.hm-pagination button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    border: 1px solid #e0e8f1;
    border-radius: 8px;
    background: #fff;
    color: #3c5676;
}
.hm-pagination button.current {
    border-color: var(--hm-teal);
    background: var(--hm-teal);
    color: #fff;
}
.hm-pagination button:disabled { opacity: .45; }
.hm-modal-backdrop {
    position: fixed;
    z-index: 9999;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(12, 31, 54, .45);
}
.hm-modal-backdrop.open { display: flex; }
.hm-modal {
    width: min(720px, 100%);
    max-height: min(90vh, 850px);
    overflow: auto;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 18px 60px rgba(12,31,54,.22);
}
.hm-modal-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 23px 25px;
    border-bottom: 1px solid var(--hm-border);
}
.hm-modal-header h2 { margin: 0 0 5px; font-size: 20px; color: #102f57; }
.hm-modal-header p { margin: 0; color: var(--hm-muted); font-size: 12px; }
.hm-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--hm-border);
    border-radius: 8px;
    background: #fff;
    color: #4e6480;
    cursor: pointer;
}
.hm-modal form { padding: 22px 25px 24px; }
.hm-modal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.hm-modal-grid [hidden] { display: none !important; }
.hm-check-field { display: flex; align-items: center; gap: 10px; align-self: center; font-size: 13px; color: var(--hm-navy); }
.hm-check-field input { width: 17px; height: 17px; accent-color: var(--hm-teal); }
.hm-modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--hm-border); }
.hm-form-note { margin: 13px 0 0; color: var(--hm-muted); font-size: 11px; text-align: right; }
@media (max-width: 1200px) {
    .hm-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hm-filter-footer { align-items: stretch; }
    .hm-info { flex: 1; }
}
@media (max-width: 700px) {
    .main-content.hm-main { padding: 20px 14px 28px; }
    .hm-page-header { flex-direction: column; }
    .hm-header-tag { display: none; }
    .hm-tabs { width: 100%; }
    .hm-tab { padding: 10px 8px; gap: 7px; font-size: 12px; }
    .hm-filters { grid-template-columns: 1fr; }
    .hm-filter-footer { flex-direction: column; }
    .hm-filter-footer .hm-btn { width: 100%; }
    .hm-table-footer { align-items: flex-start; flex-direction: column; }
    .hm-modal-grid { grid-template-columns: 1fr; }
    .hm-modal-header, .hm-modal form { padding-left: 17px; padding-right: 17px; }
}

/* Acciones y estados conectados al CRUD */
.hm-row-actions{display:flex;align-items:center;gap:6px;white-space:nowrap}
.hm-icon-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid #d9e0e8;border-radius:8px;background:#fff;color:#344054;cursor:pointer}
.hm-icon-btn:hover{background:#f3f6fa;border-color:#b8c4d3}
.hm-icon-btn.danger{color:#b42318}
.hm-icon-btn.danger:hover{background:#fff1f0;border-color:#f2b8b5}
.hm-status{display:inline-flex;align-items:center;border-radius:999px;padding:4px 9px;font-size:12px;font-weight:600;white-space:nowrap}
.hm-status.active{background:#e8f7ee;color:#167647}
.hm-status.inactive{background:#f2f4f7;color:#667085}
.hm-row-actions button:disabled{opacity:.5;cursor:not-allowed}

/* Iconos de acciones dibujados localmente: no dependen de que Lucide cargue. */
.hm-row-actions { min-width: 76px; }
.hm-icon-btn { flex: 0 0 34px; width: 34px; height: 34px; padding: 0; }
.hm-icon-btn .hm-action-svg {
    display: block;
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.hm-icon-btn:not(.danger) { color: #087f83; }
.hm-icon-btn.danger { color: #b42318; }
.hm-icon-btn:focus-visible { outline: 3px solid rgba(53,182,180,.28); outline-offset: 2px; }


/* Correcciones de interacción del modal */
.hm-modal-backdrop {
    z-index: 99999;
    isolation: isolate;
}
.hm-modal {
    position: relative;
    z-index: 1;
    pointer-events: auto;
}
.hm-modal-header {
    align-items: flex-start;
}
.hm-modal-close {
    flex: 0 0 38px;
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
    font-family: Arial, sans-serif;
    font-size: 28px;
    font-weight: 400;
    line-height: 1;
    color: #526783;
    visibility: visible;
    opacity: 1;
}
.hm-modal-close span {
    display: block;
    transform: translateY(-1px);
}
.hm-modal-close:hover {
    color: #b42318;
    border-color: #f2b8b5;
    background: #fff1f0;
}
.hm-modal input,
.hm-modal select,
.hm-modal button {
    pointer-events: auto;
}


/* Mensaje de sistema propio: centrado y sin el encabezado del navegador/localidad. */
.hm-system-message-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(12, 31, 54, .48);
    backdrop-filter: blur(2px);
}
.hm-system-message-backdrop.open { display: flex; }
.hm-system-message {
    box-sizing: border-box;
    width: min(420px, 100%);
    padding: 30px 30px 26px;
    border: 1px solid var(--hm-border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 22px 70px rgba(12, 31, 54, .24);
    text-align: center;
    animation: hm-message-appear .16s ease-out;
}
.hm-system-message-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    margin: 0 auto 15px;
    border-radius: 50%;
    background: var(--hm-teal-soft);
    color: var(--hm-teal-dark);
}
.hm-system-message-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hm-system-message h2 { margin: 0 0 10px; color: #102f57; font-size: 20px; font-weight: 600; }
.hm-system-message p { margin: 0 0 24px; color: #536c8a; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.hm-system-message .hm-btn { min-width: 120px; }
@keyframes hm-message-appear { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (prefers-reduced-motion: reduce) { .hm-system-message { animation: none; } }


/* Selector de paquetes con búsqueda integrada; estilos aislados del módulo. */
.hm-package-field { position: relative; }
.hm-package-field #formServicioSearch { box-sizing: border-box; width: 100%; min-width: 0; height: 44px; padding: 0 13px; border: 1px solid #d1deed; border-radius: 8px; background: #fff; color: #263f62; font: inherit; font-weight: 400; outline: none; }
.hm-package-field #formServicioSearch:focus { border-color: var(--hm-teal); box-shadow: 0 0 0 3px rgba(53,182,180,.13); }
.hm-package-options { position: absolute; z-index: 100010; top: calc(100% - 25px); left: 0; right: 0; max-height: 260px; overflow-y: auto; border: 1px solid #d1deed; border-radius: 9px; background: #fff; box-shadow: 0 12px 28px rgba(22,55,95,.16); }
.hm-package-options[hidden] { display: none !important; }
.hm-package-option { display: block; width: 100%; padding: 11px 13px; border: 0; border-bottom: 1px solid #eef2f7; background: #fff; color: #263f62; text-align: left; font: inherit; font-size: 12px; cursor: pointer; overflow-wrap: anywhere; }
.hm-package-option:last-child { border-bottom: 0; }
.hm-package-option:hover, .hm-package-option.highlighted { background: var(--hm-teal-soft); color: var(--hm-teal-dark); }
.hm-package-empty { padding: 14px; color: var(--hm-muted); font-size: 12px; }
.hm-visually-hidden-select { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
