:root {
    --blue-900: #111c2b;
    --blue-800: #263342;
    --blue-700: #1f66bd;
    --blue-600: #2d76cf;
    --blue-100: #eaf3ff;
    --bg: #f4f6f9;
    --panel: #ffffff;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #d9e2ec;
    --danger: #dc3545;
    --warning: #ffc107;
    --dash-purple: #0f3d6e;
    --dash-purple-soft: #e8f1fb;
    --dash-text: #202533;
    --dash-muted: #a0a4ad;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    min-height: 100vh;
    background: #f7f8fb;
    color: var(--ink);
    font-family: "Inter", "Segoe UI", Arial, Helvetica, sans-serif;
    letter-spacing: 0;
}
body.modal-open {
    overflow: hidden;
}
.main-sidebar,
.main-sidebar *,
.content,
.content *,
.module-header,
.module-header *,
.data-card,
.data-card * {
    text-shadow: none !important;
}
.main-sidebar,
.main-sidebar * {
    font-family: Arial, Helvetica, sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.main-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: 278px;
    height: 100vh;
    overflow-y: scroll;
    scrollbar-gutter: stable;
    scrollbar-width: auto;
    scrollbar-color: #cbd5e1 transparent;
    background: #ffffff;
    color: #4b5563;
    border-radius: 0;
    box-shadow: 12px 0 30px rgba(31, 41, 55, .06);
    padding-bottom: 86px;
    transition: width .24s ease, transform .24s ease, box-shadow .18s ease;
}
.main-sidebar::-webkit-scrollbar { width: 12px; }
.main-sidebar::-webkit-scrollbar-track { background: transparent; }
.main-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}
.main-sidebar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 78px;
    padding: 18px 22px;
    border-bottom: 0;
    color: var(--dash-text);
}
.brand-link img {
    width: 34px;
    height: 34px;
    object-fit: cover;
    border-radius: 50%;
    background: #fff;
    border: 0;
}
.brand-link span { display: grid; gap: 2px; min-width: 0; }
.brand-link strong { font-size: 15px; line-height: 1; font-weight: 800; }
.brand-link small {
    color: var(--dash-muted);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}
.user-panel {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 10px 22px 16px;
    border-bottom: 0;
}
.user-avatar {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 43px;
    height: 43px;
    border-radius: 50%;
    background: linear-gradient(180deg, #dceafe, #a8c8f2);
    color: #2f5f98;
    font-weight: 800;
}
.user-panel div { min-width: 0; display: grid; gap: 3px; }
.user-panel strong {
    color: var(--dash-text);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-panel span { color: var(--dash-muted); font-size: 12px; }
.sidebar-search {
    position: relative;
    margin: 8px 16px 26px;
}
.sidebar-search input {
    width: 100%;
    min-height: 44px;
    padding: 10px 58px 10px 42px;
    border: 0;
    border-radius: 8px;
    background: #ffffff;
    color: var(--dash-text);
    box-shadow: 0 12px 28px rgba(31, 41, 55, .08);
}
.sidebar-search::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    border: 2px solid #9ca3af;
    border-radius: 50%;
}
.sidebar-search::after {
    content: "Ctrl+D";
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #c0c3ca;
    font-size: 12px;
}
.sidebar-search input::placeholder { color: #b7bbc3; }
.sidebar-nav { display: grid; gap: 6px; padding: 0 14px 18px; }
.nav-header {
    margin: 0 0 10px;
    color: #c0c3ca;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .2px;
    text-transform: none;
}
.nav-group {
    border-radius: 16px;
    transition: background .18s ease, box-shadow .18s ease;
}
.nav-group summary,
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 9px 12px;
    border-radius: 7px;
    color: #737782;
    cursor: pointer;
    list-style: none;
}
.nav-group summary::-webkit-details-marker { display: none; }
.menu-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: transparent;
    color: #8a8f98;
}
.menu-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}
.chevron {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-left: auto;
    fill: none;
    stroke: #a3a7af;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .22s ease, stroke .22s ease;
}
.nav-group[open] .chevron {
    transform: rotate(90deg);
    stroke: var(--dash-purple);
}
.nav-group summary > span:not(.menu-icon) {
    display: grid;
    min-width: 0;
}
.nav-group summary strong {
    color: var(--dash-text);
    font-size: 13px;
    line-height: 1.1;
    font-weight: 700;
}
.nav-group summary:hover,
.nav-group[open] summary,
.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--dash-purple-soft);
    color: var(--dash-purple);
    box-shadow: none;
}
.nav-group[open] {
    background: #ffffff;
    box-shadow: none;
}
.nav-group summary:hover .menu-icon,
.nav-group[open] summary .menu-icon {
    background: transparent;
    color: var(--dash-purple);
}
.nav-group summary:hover strong,
.nav-group[open] summary strong {
    color: var(--dash-purple);
}
.submenu {
    height: 0;
    opacity: 0;
    transform: translateY(-6px);
    overflow: hidden;
    background: #ffffff;
    border-radius: 0 0 14px 14px;
    transition: height .24s ease, opacity .2s ease, transform .24s ease;
}
.nav-group[open] .submenu {
    opacity: 1;
    transform: translateY(0);
}
.nav-group a {
    min-height: 34px;
    margin: 0 4px 0 8px;
    padding: 8px 10px;
    border-left: 0;
    border-radius: 12px;
    color: #7a7f89;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    opacity: .96;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.submenu-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border-radius: 7px;
    background: transparent;
    color: #8a8f98;
}
.submenu-icon svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}
.nav-group a:hover .submenu-icon,
.nav-group a.active .submenu-icon {
    background: transparent;
    color: var(--dash-purple);
}
.nav-group a:hover,
.nav-group a.active {
    border-left-color: transparent;
}
.nav-group a:first-of-type { margin-top: 7px; }
.nav-group a:last-of-type { margin-bottom: 8px; }
.nav-group:nth-of-type(n) .menu-icon { color: #6b7280; }
.nav-group[open] .menu-icon,
.nav-group summary:hover .menu-icon {
    color: var(--dash-purple);
}
.general-group {
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid #eef1f5;
}
.sidebar-logout {
    position: fixed;
    left: 22px;
    bottom: 18px;
    width: 234px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 43px;
    border: 1px solid #f1c7cf;
    border-radius: 8px;
    background: #fff4f6;
    color: #9f3448;
    font-weight: 700;
}
.sidebar-logout:hover {
    background: #ffe9ed;
    color: #8f2639;
}

.main {
    min-height: 100vh;
    margin-left: 278px;
    display: flex;
    flex-direction: column;
    transition: margin-left .22s ease;
}
.topbar {
    min-height: 58px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 0 22px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 6px rgba(15, 23, 42, .06);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-left a { color: #4b5563; font-size: 14px; }
.topbar-left a:hover { color: var(--blue-700); }
.icon-btn {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 32px;
    height: 32px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
}
.icon-btn:hover { background: var(--blue-100); color: var(--blue-800); }
.sidebar-toggle {
    gap: 4px;
}
.sidebar-toggle span {
    display: block;
    width: 17px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}
.sidebar-collapsed .main-sidebar {
    width: 86px;
}
.sidebar-collapsed .main {
    margin-left: 86px;
}
.sidebar-collapsed .brand-link,
.sidebar-collapsed .user-panel {
    justify-content: center;
    padding-left: 10px;
    padding-right: 10px;
}
.sidebar-collapsed .brand-link span,
.sidebar-collapsed .user-panel div,
.sidebar-collapsed .sidebar-search,
.sidebar-collapsed .nav-header,
.sidebar-collapsed .nav-group summary > span:not(.menu-icon),
.sidebar-collapsed .chevron,
.sidebar-collapsed .submenu,
.sidebar-collapsed .sidebar-logout {
    display: none;
}
.sidebar-collapsed .sidebar-nav {
    padding-left: 12px;
    padding-right: 12px;
}
.sidebar-collapsed .nav-group summary {
    justify-content: center;
    padding: 10px;
}
.sidebar-collapsed .menu-icon {
    width: 28px;
    height: 28px;
}
.sidebar-collapsed .nav-group[open] {
    background: transparent;
}
.has-badge::after {
    content: attr(data-badge);
    position: absolute;
    top: 1px;
    right: -3px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    line-height: 16px;
}
.has-badge.warn::after { background: var(--warning); color: #1f2937; }
.content { flex: 1; padding: 22px 26px; }
.footer {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 22px;
    background: var(--panel);
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}
.footer strong { color: var(--blue-700); }

h1 { margin: 0 0 18px; font-size: 28px; font-weight: 500; }
h2 { margin: 0 0 10px; font-size: 18px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stats article, .panel, .cards article {
    background: var(--panel);
    border: 1px solid var(--line);
    border-top: 3px solid var(--blue-600);
    border-radius: 4px;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}
.stats strong { display: block; font-size: 28px; color: var(--blue-700); }
.stats span, .cards p, .cards span, .panel p { color: var(--muted); }
.table-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 10px; }
.table-list a {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 3px solid var(--blue-600);
    border-radius: 4px;
}
.table-list a:hover { box-shadow: 0 6px 16px rgba(31, 102, 189, .14); }
.table-list span { color: var(--muted); white-space: nowrap; }
.scroll { overflow: auto; max-height: calc(100vh - 175px); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; background: #eef5ff; color: var(--blue-900); z-index: 1; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.cards article span {
    display: inline-flex;
    margin-top: 10px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--blue-100);
    color: var(--blue-800);
    font-size: 12px;
}

.module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.module-header h1 {
    margin-bottom: 4px;
    color: var(--dash-text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 22px;
    font-weight: 700;
    text-shadow: none;
}
.module-header p {
    margin: 0;
    color: var(--muted);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-shadow: none;
}
.quimicos-header {
    margin-top: 0;
    margin-bottom: 10px;
}
.quimicos-header h1 {
    margin: 0 0 2px;
}
.quimicos-header p {
    margin: 0;
}
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 18px;
    border: 0;
    border-radius: 7px;
    background: var(--dash-purple);
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: .3px;
    box-shadow: 0 8px 18px rgba(15, 61, 110, .18);
    cursor: pointer;
}
.btn-primary:hover {
    background: #0a2d52;
}
.data-card {
    background: #fff;
    border: 1px solid #edf0f5;
    border-radius: 12px;
    box-shadow: 0 14px 36px rgba(31, 41, 55, .08);
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
}
.alert-warning {
    margin: 14px 16px 0;
    padding: 11px 13px;
    border: 1px solid #fde68a;
    border-radius: 8px;
    background: #fffbeb;
    color: #92400e;
    font-size: 13px;
    font-weight: 700;
}
.alert-success {
    margin: 0 0 12px;
    padding: 11px 13px;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    background: #f0fdf4;
    color: #166534;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    font-weight: 700;
}
.data-card .alert-warning {
    margin: 14px 16px 0;
}
.module-header + .alert-warning {
    margin: 0 0 12px;
}
.live-search {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(260px, 420px);
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid #edf0f5;
    background: #fff;
}
.live-search label {
    color: #334155;
    font-size: 13px;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
}
.live-search input {
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fbfdff;
    color: #0f172a;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
}
.live-search input:focus {
    border-color: #0f3d6e;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(15, 61, 110, .10);
}
.table-responsive {
    width: 100%;
    overflow-x: auto;
}
.data-table {
    min-width: 980px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
}
.data-table th {
    position: static;
    background: #f8fafc;
    color: #4b5563;
    font-size: 12px;
    font-family: Arial, Helvetica, sans-serif;
    text-transform: uppercase;
    letter-spacing: .35px;
    padding-top: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
}
.data-table td {
    color: #374151;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    padding-top: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.data-table tbody.is-loading {
    opacity: .58;
    transition: opacity .18s ease;
}
.data-table tbody tr:hover {
    background: #f4f8fd;
}
.data-table .empty-row {
    padding: 22px;
    color: var(--muted);
    text-align: center;
    font-weight: 700;
}
.name-cell {
    font-weight: 400;
    color: #111827;
}
.actions-col {
    width: 110px;
    text-align: center;
}
.row-actions {
    text-align: center;
    white-space: nowrap;
}
.action-btn {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: #f8fafc;
    color: #64748b;
    transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.action-btn + .action-btn {
    margin-left: 4px;
}
.action-btn svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.action-btn:hover {
    transform: translateY(-1px);
}
.action-btn.edit:hover {
    background: #eef4ff;
    border-color: #bfdbfe;
    color: #2563eb;
}
.action-btn.delete:hover {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #e11d48;
}
.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-top: 1px solid #edf0f5;
    color: var(--muted);
    font-size: 13px;
    font-family: Arial, Helvetica, sans-serif;
}
.pagination-bar div {
    display: flex;
    gap: 8px;
}
.pagination-bar a,
.pagination-bar button {
    padding: 7px 10px;
    border: 0;
    border-radius: 6px;
    background: #f3f5f8;
    color: #4b5563;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.pagination-bar a:hover,
.pagination-bar button:hover:not(:disabled) {
    background: var(--dash-purple-soft);
    color: var(--dash-purple);
}
.pagination-bar button:disabled {
    opacity: .45;
    cursor: not-allowed;
}
.pagination-bar button:focus-visible {
    outline: 2px solid #f4c430;
    outline-offset: 2px;
}
.master-layout {
    display: grid;
    grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
    gap: 16px;
}
.master-layout-full {
    grid-template-columns: minmax(0, 1fr);
}
.master-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #edf0f5;
    color: #123b66;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
}
.master-card-header span {
    color: #64748b;
    font-size: 12px;
}
.master-form {
    display: grid;
    gap: 12px;
    padding: 16px;
}
.master-form label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: 700;
}
.master-form input,
.master-search select {
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fbfdff;
    color: #0f172a;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
}
.master-form input[readonly] {
    background: #f1f5f9;
    color: #64748b;
}
.master-modal-grid {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 14px;
}
.master-modal-grid label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}
.master-modal-grid label:last-child {
    grid-column: 1 / -1;
}
.master-modal-grid input {
    min-height: 40px;
    padding: 8px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    color: #0f172a;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    font-weight: 400;
}
.master-modal-grid input:focus {
    border-color: #0f3d6e;
    box-shadow: 0 0 0 3px rgba(15, 61, 110, .10);
    outline: 0;
}
.master-modal-grid input[readonly] {
    background: #f1f5f9;
    color: #64748b;
}
.master-modal-panel button:focus,
.master-modal-panel button:focus-visible,
.master-confirm button:focus,
.master-confirm button:focus-visible,
.master-success button:focus,
.master-success button:focus-visible {
    outline: 2px solid #facc15;
    outline-offset: 2px;
    box-shadow: none;
}
.master-success-panel p {
    margin-bottom: 18px;
    color: #0f172a;
    font-weight: 700;
}
.master-check-icon {
    animation: masterPop .22s ease-out both;
}
@keyframes masterPop {
    0% { transform: scale(.72); opacity: .3; }
    100% { transform: scale(1); opacity: 1; }
}
.master-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}
.master-search {
    grid-template-columns: minmax(70px, 110px) minmax(180px, 1fr) 145px auto auto;
}
.master-table {
    min-width: 680px;
}
.inline-delete {
    display: inline;
    margin: 0;
}
.inline-delete .action-btn {
    vertical-align: middle;
}
@media (max-width: 900px) {
    .master-layout {
        grid-template-columns: 1fr;
    }
    .master-search {
        grid-template-columns: 1fr;
    }
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 18px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    color: #475569;
    font-weight: 800;
    cursor: pointer;
}
.btn-secondary:hover {
    background: #f8fafc;
    color: #0f3d6e;
}
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(15, 23, 42, .54);
}
.modal-backdrop,
.modal-backdrop * {
    font-family: Arial, Helvetica, sans-serif;
    text-shadow: none !important;
}
.modal-backdrop.is-open {
    display: flex;
}
.modal-panel {
    width: min(1120px, 100%);
    max-height: min(92vh, 760px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .18);
}
.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px 16px;
    border-bottom: 1px solid #e5eaf1;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
}
.modal-header h2 {
    margin: 0;
    color: #123b66;
    font-size: 18px;
    font-weight: 700;
}
.modal-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}
.modal-close {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid #d8dee8;
    border-radius: 7px;
    background: #f8fafc;
    color: #64748b;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}
.modal-close:hover {
    background: #f8fafc;
    color: #0f3d6e;
}
.cq-form {
    display: flex;
    min-height: 0;
    margin: 0;
    gap: 0;
    text-align: left;
    flex-direction: column;
}
.modal-tabs {
    display: flex;
    gap: 6px;
    padding: 12px 18px 0;
    border-bottom: 1px solid #e5eaf1;
    background: #f8fafc;
    overflow-x: auto;
}
.modal-tabs button {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 7px 7px 0 0;
    background: #edf3f9;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.modal-tabs button.active {
    background: #fff;
    color: #0f3d6e;
    border-color: #dbe4ef;
}
.modal-body {
    min-height: 0;
    overflow: auto;
    padding: 20px;
    background: #fff;
}
.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
    padding: 16px;
    border: 1px solid #e5eaf1;
    border-radius: 10px;
    background: #fcfdff;
}
.form-grid {
    display: grid;
    gap: 15px;
    margin-bottom: 16px;
}
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.cq-form label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}
.cq-form input,
.cq-form select,
.cq-form textarea {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #fbfdff;
    color: #0f172a;
    font: inherit;
    font-size: 13px;
    outline: 0;
}
.cq-form textarea {
    min-height: 96px;
    resize: vertical;
}
.cq-form input:hover,
.cq-form select:hover,
.cq-form textarea:hover {
    border-color: #9fb2c8;
    background: #fff;
}
.cq-form input:focus,
.cq-form select:focus,
.cq-form textarea:focus {
    border-color: #0f3d6e;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(15, 61, 110, .10);
}
.cq-form .check-field {
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding-top: 21px;
}
.cq-form .check-field input {
    width: 17px;
    min-height: 17px;
    accent-color: #0f3d6e;
}
.cq-form .check-field span {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}
.period-field {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 54px) auto minmax(0, 1fr);
    align-items: center;
    min-height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #fbfdff;
    overflow: hidden;
}
.period-field:focus-within {
    border-color: #0f3d6e;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(15, 61, 110, .10);
}
.period-field input {
    min-height: 38px;
    padding: 8px 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none !important;
}
.period-field span {
    color: #0f67c1;
    font-weight: 900;
    text-align: center;
}
.period-field em {
    display: none;
    grid-column: 1 / -1;
    padding: 0 10px;
    color: #64748b;
    font-style: normal;
    font-weight: 700;
    line-height: 38px;
}
.period-field.is-disabled input,
.period-field.is-disabled span {
    display: none;
}
.period-field.is-disabled em {
    display: block;
}
.labor-period-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
    align-items: end;
}
.dni-lookup {
    position: relative;
    display: block;
}
.dni-lookup input {
    padding-right: 38px;
}
.dni-loader {
    position: absolute;
    top: 50%;
    right: 11px;
    width: 17px;
    height: 17px;
    margin-top: -9px;
    border: 2px solid #cfe0f2;
    border-top-color: #0f3d6e;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    animation: cq-spin .72s linear infinite;
}
.dni-lookup.is-loading .dni-loader {
    opacity: 1;
}
.dni-lookup.is-loading input {
    background: #f1f5f9;
    color: #475569;
    cursor: wait;
}
@keyframes cq-spin {
    to { transform: rotate(360deg); }
}
.transfer-preview {
    display: grid;
    grid-template-columns: .7fr 1fr 1fr .7fr 2fr 1fr;
    min-height: 190px;
    border: 1px solid #d8dee8;
    border-radius: 7px;
    background:
        linear-gradient(#eef2f7 0 36px, transparent 36px),
        repeating-linear-gradient(to bottom, transparent 0 35px, #e5e7eb 35px 36px);
    overflow: hidden;
}
.transfer-preview span {
    padding: 10px;
    border-right: 1px solid #d8dee8;
    color: #0f172a;
    font-size: 12px;
    font-weight: 800;
}
.transfer-preview span:last-child { border-right: 0; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid #e5eaf1;
    background: #f8fafc;
}
.wizard-modal {
    width: min(1040px, 100%);
    height: min(760px, 92vh);
}
.wizard-header {
    flex: 0 0 auto;
}
.wizard-form {
    height: 100%;
}
.wizard-progress {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 14px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e5eaf1;
}
.wizard-progress span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}
.wizard-progress span.active {
    border-color: #0f3d6e;
    background: #0f3d6e;
    color: #fff;
}
.wizard-window {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: #fff;
}
.wizard-track {
    display: flex;
    height: 100%;
    transition: transform .34s ease;
}
.wizard-step {
    flex: 0 0 100%;
    height: 100%;
    overflow: auto;
    padding: 20px;
}
.step-heading {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid #e5eaf1;
    border-radius: 10px;
    background: #fcfdff;
}
.step-heading h3 {
    margin: 0;
    color: #123b66;
    font-size: 17px;
    font-weight: 700;
}
.step-heading p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 13px;
}
.step-icon,
.btn-soft svg {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}
.step-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #e8f1fb;
    color: #0f3d6e;
}
.step-icon svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}
.btn-soft {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 38px;
    padding: 9px 14px;
    border: 1px solid #cfe0f2;
    border-radius: 7px;
    background: #f2f7fd;
    color: #0f3d6e;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.btn-soft:hover {
    background: #e8f1fb;
}
.btn-soft svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}
.inline-status {
    margin: 10px 0 0;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}
.wizard-actions {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 15px 18px;
    border-top: 1px solid #e5eaf1;
    background: #f8fafc;
}
.wizard-actions .btn-primary,
.wizard-actions .btn-secondary {
    min-width: 128px;
}
.wizard-actions .btn-primary:focus,
.wizard-actions .btn-secondary:focus,
.wizard-actions .btn-primary:focus-visible,
.wizard-actions .btn-secondary:focus-visible {
    outline: 2px solid #facc15;
    outline-offset: 2px;
    box-shadow: none;
}
.mini-grid {
    margin-top: 14px;
    border: 1px solid #e5eaf1;
    border-radius: 9px;
    overflow: auto;
    background: #fff;
}
.mini-grid p {
    margin: 0;
    padding: 24px;
    color: #64748b;
    text-align: center;
    font-size: 13px;
}
.mini-grid table {
    min-width: 720px;
}
.mini-grid th {
    position: static;
    background: #f3f7fb;
    color: #334155;
}
.grid-delete {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: #fff1f2;
    color: #be123c;
    cursor: pointer;
}
.grid-delete:hover {
    background: #ffe4e6;
}
.grid-delete svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
}
.autocomplete-wrap {
    position: relative;
    display: block;
}
.autocomplete-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 110;
    display: none;
    max-height: 188px;
    overflow-y: auto;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .13);
}
.autocomplete-list.is-open {
    display: grid;
}
.autocomplete-list button {
    min-height: 34px;
    padding: 8px 10px;
    border: 0;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
    color: #0f172a;
    text-align: left;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.autocomplete-list button:hover,
.autocomplete-list button.active {
    background: #e8f1fb;
    color: #0f3d6e;
}
.mini-modal,
.sweet-modal,
.confirm-mini {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, .42);
}
.mini-modal.is-open,
.sweet-modal.is-open,
.confirm-mini.is-open {
    display: flex;
}
.mini-panel,
.sweet-panel {
    width: min(620px, 100%);
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 20px 54px rgba(15, 23, 42, .22);
    font-family: Arial, Helvetica, sans-serif;
}
.mini-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 18px;
    border-bottom: 1px solid #e5eaf1;
    color: #123b66;
}
.mini-panel header button {
    width: 30px;
    height: 30px;
    border: 1px solid #d8dee8;
    border-radius: 7px;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
}
.mini-panel > .form-grid {
    padding: 18px;
    margin: 0;
}
.mini-panel footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid #e5eaf1;
    background: #f8fafc;
}
.transfer-fields.is-disabled {
    opacity: .55;
}
.medical-report {
    display: grid;
    gap: 14px;
    min-height: 520px;
    padding: 22px;
    border: 1px solid #e5eaf1;
    border-radius: 10px;
    background: #fff;
}
.medical-report section {
    padding-bottom: 12px;
    border-bottom: 1px solid #e5eaf1;
}
.medical-report section:last-child {
    border-bottom: 0;
}
.medical-report h4 {
    margin: 0 0 10px;
    color: #123b66;
    font-size: 15px;
    font-weight: 700;
}
.medical-report dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 18px;
    margin: 0;
}
.medical-report dl div {
    display: grid;
    gap: 3px;
}
.medical-report dt {
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.medical-report dd {
    margin: 0;
    color: #0f172a;
    font-size: 13px;
}
.sweet-panel {
    width: min(420px, 100%);
    padding: 26px;
    text-align: center;
}
.delete-confirm-panel {
    display: grid;
    gap: 12px;
}
.delete-confirm-panel label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
}
.delete-confirm-panel input {
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    color: #0f172a;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 4px;
    text-align: center;
}
.delete-pin {
    justify-self: center;
    min-width: 132px;
    padding: 10px 14px;
    border: 1px dashed #f4c430;
    border-radius: 9px;
    background: #fffbeb;
    color: #0f3d6e;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 7px;
}
.sweet-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: #e8f1fb;
    color: #0f3d6e;
}
.sweet-icon svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}
.sweet-panel h3 {
    margin: 0 0 8px;
    color: #123b66;
}
.sweet-panel p {
    margin: 0 0 18px;
    color: #64748b;
}
.sweet-panel div {
    display: flex;
    justify-content: center;
    gap: 10px;
}
.confirm-mini {
    z-index: 120;
    background: rgba(15, 23, 42, .36);
}
.confirm-mini > div {
    width: min(320px, 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 22px;
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 20px 54px rgba(15, 23, 42, .22);
}
.confirm-mini p {
    grid-column: 1 / -1;
    margin: 0 0 6px;
    color: #0f172a;
    text-align: center;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    font-weight: 700;
}
.confirm-mini.one-action > div {
    grid-template-columns: 1fr;
}
.mini-panel button:focus,
.mini-panel button:focus-visible,
.confirm-mini button:focus,
.confirm-mini button:focus-visible,
.sweet-panel button:focus,
.sweet-panel button:focus-visible {
    outline: 2px solid #facc15;
    outline-offset: 2px;
    box-shadow: none;
}

.auth-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 34px 16px;
    background: #f2f4f7;
    font-family: Arial, Helvetica, sans-serif;
}
.auth-main .content { width: 100%; padding: 0; }
.auth-main,
.auth-main * {
    font-family: Arial, Helvetica, sans-serif;
}
.login-shell {
    width: min(940px, 100%);
    min-height: 470px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: .95fr 1.05fr;
    overflow: hidden;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 46px rgba(17, 24, 39, .22);
}
.login-brand-panel {
    position: relative;
    min-height: 470px;
    display: grid;
    align-content: center;
    justify-items: center;
    padding: 44px 54px;
    color: #fff;
    text-align: center;
    background: linear-gradient(180deg, var(--blue-900), #1689e8);
}
.login-brand-panel::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: rgba(255,255,255,.55);
}
.login-brand-content {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 12px;
}
.login-brand-content span {
    font-size: 16px;
    font-weight: 600;
}
.login-brand-content img {
    width: 78px;
    height: 78px;
    object-fit: cover;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,.18);
}
.login-brand-content h1 {
    margin: 0;
    color: #fff;
    font-size: 26px;
    font-weight: 800;
}
.login-brand-content p {
    width: min(260px, 100%);
    margin: 10px 0 0;
    color: rgba(255,255,255,.82);
    font-size: 13px;
    line-height: 1.4;
}
.login-brand-footer {
    position: absolute;
    left: 42px;
    right: 72px;
    bottom: 22px;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    color: rgba(255,255,255,.78);
    font-size: 11px;
    text-transform: uppercase;
}
.login-panel {
    background: #fff;
    display: grid;
    align-content: center;
    padding: 42px 72px 42px 58px;
    text-align: center;
}
.login-logo {
    width: 58px;
    height: 58px;
    justify-self: center;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 12px;
}
.login-panel h2 {
    margin: 0 0 8px;
    color: #232b3a;
    font-size: 20px;
    font-weight: 700;
}
.login-panel p { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
form { display: grid; gap: 11px; margin-top: 8px; text-align: left; }
label { font-size: 13px; color: var(--muted); }
.line-input {
    position: relative;
    display: flex;
    align-items: center;
}
.line-input svg {
    position: absolute;
    right: 0;
    width: 17px;
    height: 17px;
    fill: #35aee2;
    pointer-events: none;
}
input {
    width: 100%;
    min-height: 34px;
    padding: 7px 26px 7px 0;
    border: 0;
    border-bottom: 1px solid #77c8e6;
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    outline: 0;
}
input:focus {
    border-color: var(--blue-700);
    box-shadow: none;
}
.checkline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 3px 0 8px;
    font-size: 12px;
}
.checkline input {
    width: 16px;
    min-height: 16px;
    accent-color: var(--blue-700);
}
.login-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 4px;
}
.login-actions button {
    min-width: 116px;
    min-height: 36px;
    border: 0;
    border-radius: 5px;
    padding: 8px 18px;
    background: linear-gradient(180deg, #1689e8, var(--blue-800));
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}
.login-actions button:hover { background: var(--blue-900); }
.login-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 92px;
    min-height: 34px;
    border: 1px solid #b8c2cc;
    border-radius: 5px;
    color: var(--muted);
    font-size: 13px;
}

button,
.btn-primary,
.btn-secondary,
.btn-soft,
.modal-panel button,
.confirm-mini button,
.sweet-panel button,
.wizard-actions button,
.mini-panel button,
.login-actions button,
.login-actions a {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    font-weight: 700;
}
.alert {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 4px;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    text-align: left;
}

@media (max-width: 860px) {
    .main-sidebar {
        inset: 0 auto 0 0;
        width: min(278px, 86vw);
        height: 100vh;
        border-radius: 0 18px 18px 0;
        transform: translateX(-110%);
        z-index: 40;
    }
    body.sidebar-collapsed .main-sidebar {
        width: min(278px, 86vw);
        transform: translateX(0);
    }
    body.sidebar-collapsed .brand-link span,
    body.sidebar-collapsed .user-panel div,
    body.sidebar-collapsed .nav-group summary > span:not(.menu-icon) { display: grid; }
    body.sidebar-collapsed .sidebar-search,
    body.sidebar-collapsed .nav-header { display: block; }
    body.sidebar-collapsed .chevron { display: block; }
    body.sidebar-collapsed .sidebar-logout { display: flex; }
    body.sidebar-collapsed .submenu { display: block; }
    body.sidebar-collapsed .brand-link,
    body.sidebar-collapsed .user-panel { justify-content: flex-start; padding-left: 22px; padding-right: 22px; }
    body.sidebar-collapsed .nav-group summary { justify-content: flex-start; padding: 9px 12px; }
    .sidebar-logout { position: fixed; width: calc(min(278px, 86vw) - 44px); }
    .main { margin-left: 0; }
    .topbar, .footer { flex-wrap: wrap; }
    .stats { grid-template-columns: 1fr; }
    .module-header { align-items: stretch; flex-direction: column; }
    .btn-primary { width: 100%; }
    .pagination-bar { align-items: flex-start; flex-direction: column; }
    .modal-backdrop {
        align-items: stretch;
        padding: 12px;
    }
    .modal-panel {
        max-height: calc(100vh - 24px);
    }
    .modal-header,
    .modal-actions {
        padding: 14px;
    }
    .modal-body {
        padding: 14px;
    }
    .modal-tabs {
        padding: 12px 14px 0;
    }
    .form-grid,
    .form-grid.cols-2,
    .form-grid.cols-3,
    .form-grid.cols-4 {
        grid-template-columns: 1fr;
    }
    .form-grid .span-2,
    .form-grid .span-3 {
        grid-column: span 1;
    }
    .transfer-preview {
        min-width: 720px;
    }
    .modal-actions {
        flex-direction: column-reverse;
    }
    .modal-actions .btn-primary,
    .modal-actions .btn-secondary {
        width: 100%;
    }
    .live-search {
        grid-template-columns: 1fr;
    }
    .wizard-modal {
        height: calc(100vh - 24px);
    }
    .wizard-step {
        padding: 14px;
    }
    .step-heading {
        align-items: flex-start;
    }
    .wizard-actions {
        padding: 12px;
        flex-direction: column;
    }
    .wizard-actions .btn-primary,
    .wizard-actions .btn-secondary {
        width: 100%;
    }
    .mini-panel footer,
    .sweet-panel div {
        flex-direction: column-reverse;
    }
    .medical-report {
        min-height: 0;
        padding: 16px;
    }
    .medical-report dl {
        grid-template-columns: 1fr;
    }
    .labor-period-row {
        grid-template-columns: 1fr;
    }
    .login-shell {
        width: min(360px, 100%);
        grid-template-columns: 1fr;
        min-height: 0;
    }
    .login-brand-panel {
        min-height: 210px;
        padding: 28px 28px 44px;
    }
    .login-brand-panel::after {
        inset: auto 0 0;
        width: 100%;
        height: 1px;
        background: rgba(255,255,255,.55);
    }
    .login-brand-content img {
        width: 62px;
        height: 62px;
    }
    .login-brand-content h1 { font-size: 22px; }
    .login-brand-content p { display: none; }
    .login-brand-footer {
        left: 24px;
        right: 24px;
        bottom: 14px;
    }
    .login-panel { padding: 42px 28px 30px; }
    .login-actions { justify-content: center; }
}
