*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #1a56db;
    --primary-dark: #1e429f;
    --sidebar-bg: #1e2a3a;
    --sidebar-hover: #2d3f55;
    --sidebar-active: #1a56db;
    --text: #111928;
    --text-muted: #6b7280;
    --bg: #f3f4f6;
    --white: #ffffff;
    --border: #e5e7eb;
    --danger: #f05252;
    --success: #0e9f6e;
    --blue: #1a56db;
    --green: #0e9f6e;
    --purple: #7e3af2;
    --orange: #ff5a1f;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

body { font-family: 'Segoe UI', system-ui, sans-serif; color: var(--text); background: var(--bg); }

/* ── LOGIN ─────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: #f7fafc;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr);
}

.login-hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    color: white;
    overflow: hidden;
    background:
        linear-gradient(120deg, rgba(8, 24, 43, .97) 0%, rgba(12, 65, 78, .86) 48%, rgba(15, 118, 110, .34) 100%),
        url('../imgs/pexels-ai25studioai-5214962.jpg') center / cover no-repeat;
}

.login-hero-content {
    width: min(680px, 100%);
    padding: clamp(2rem, 5vw, 4.5rem);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 3rem;
    position: relative;
    z-index: 1;
}

.login-brand {
    display: inline-flex;
    align-items: center;
    width: min(260px, 100%);
}

.login-brand-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    backdrop-filter: blur(10px);
}

.login-brand-mark img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
}

.login-brand-logo {
    width: 100%;
    max-height: 76px;
    object-fit: contain;
    object-position: left center;
    display: block;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,.32));
}

.login-hero-copy { max-width: 610px; }
.login-kicker {
    display: inline-block;
    margin-bottom: 1rem;
    color: #b9f3df;
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.login-hero-copy h1 {
    font-size: clamp(1.85rem, 3.8vw, 3.4rem);
    line-height: 1.02;
    font-weight: 400;
    margin-bottom: 1.25rem;
}

.login-hero-copy p {
    max-width: 540px;
    color: rgba(255,255,255,.82);
    font-size: 1.05rem;
    line-height: 1.65;
}

.login-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .8rem;
}

.login-feature-grid div {
    min-height: 120px;
    padding: 1rem;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 8px;
    background: rgba(255,255,255,.1);
    backdrop-filter: blur(12px);
}

.login-feature-grid strong {
    display: block;
    margin-bottom: .45rem;
    color: #ffffff;
    font-size: .92rem;
}

.login-feature-grid span {
    display: block;
    color: rgba(255,255,255,.72);
    font-size: .78rem;
    line-height: 1.45;
}

.login-panel {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.25rem, 4vw, 3rem);
    background:
        linear-gradient(180deg, rgba(255,255,255,.96), rgba(246,249,252,.98)),
        radial-gradient(circle at 84% 12%, rgba(20, 184, 166, .16), transparent 30%);
}

.login-container { width: 100%; max-width: 430px; }

.login-card {
    background: var(--white);
    border: 1px solid rgba(17, 25, 40, .08);
    border-radius: 8px;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    box-shadow: 0 24px 80px rgba(15, 23, 42, .12);
}

.login-header { margin-bottom: 2rem; }

.login-logo {
    width: 210px; height: auto;
    background: transparent;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    margin-bottom: 1.35rem;
    box-shadow: none;
}
.login-logo img {
    width: 100%;
    max-height: 96px;
    object-fit: contain;
    object-position: left center;
    display: block;
}

.login-header h2 { font-size: 1.85rem; font-weight: 750; color: var(--text); }
.login-header p  { font-size: .94rem; color: var(--text-muted); margin-top: .35rem; }

.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 650; margin-bottom: .45rem; color: #374151; }
.form-group input,
.form-group select {
    width: 100%; padding: .78rem .95rem;
    border: 1px solid #d7dee8; border-radius: 8px;
    font-size: .95rem; outline: none; transition: border-color .2s;
    background: #fbfdff;
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus { border-color: #0f766e; box-shadow: 0 0 0 4px rgba(15,118,110,.12); background: white; }

.input-password { position: relative; }
.input-password input { padding-right: 2.75rem; width: 100%; }
.toggle-password {
    position: absolute; top: 50%; right: .5rem;
    transform: translateY(-50%);
    background: transparent; border: none;
    padding: .35rem; cursor: pointer;
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    transition: color .15s, background .15s;
}
.toggle-password:hover { color: var(--primary); background: rgba(26,86,219,.08); }
.toggle-password svg { width: 18px; height: 18px; }

.btn-login {
    width: 100%; padding: .85rem;
    background: #1a56db; color: white;
    border: none; border-radius: 8px;
    font-size: 1rem; font-weight: 600; cursor: pointer;
    transition: background .2s, transform .2s, box-shadow .2s;
    box-shadow: 0 12px 26px rgba(26,86,219,.24);
}
.btn-login:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 16px 32px rgba(26,86,219,.28); }

.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .875rem; }
.alert-error { background: #fde8e8; color: #c81e1e; border: 1px solid #f8b4b4; }

@media (max-width: 1020px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-hero {
        min-height: 48vh;
        background:
            linear-gradient(90deg, rgba(12, 37, 57, .94) 0%, rgba(12, 37, 57, .72) 58%, rgba(12, 37, 57, .32) 100%),
            url('../imgs/pexels-ai25studioai-5214962.jpg') center / cover no-repeat;
    }

    .login-panel {
        min-height: auto;
    }
}

@media (max-width: 720px) {
    .login-hero {
        min-height: auto;
    }

    .login-hero-content {
        padding: 1.5rem;
        gap: 2rem;
    }

    .login-hero-copy h1 {
        font-size: 1.85rem;
    }

    .login-hero-copy p {
        font-size: .95rem;
    }

    .login-feature-grid {
        grid-template-columns: 1fr;
    }

    .login-feature-grid div {
        min-height: auto;
    }

    .login-panel {
        padding: 1rem;
    }
}

/* ── LAYOUT DASHBOARD ───────────────────────────────────── */
.dashboard-page { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px; min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    display: flex; align-items: center; gap: .75rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-header svg { width: 28px; height: 28px; stroke: white; }
.sidebar-header span { font-size: 1.2rem; font-weight: 700; color: white; }

.sidebar-nav { flex: 1; padding: 1rem .75rem; display: flex; flex-direction: column; gap: .25rem; overflow-y: auto; min-height: 0; }

.nav-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .65rem 1rem; border-radius: var(--radius);
    color: rgba(255,255,255,.65); text-decoration: none;
    font-size: .9rem; transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover  { background: var(--sidebar-hover); color: white; }
.nav-item.active { background: var(--sidebar-active); color: white; }
.nav-item-disabled { cursor: not-allowed; opacity: .65; }
.nav-item-disabled:hover { background: transparent; color: rgba(255,255,255,.65); }

.sidebar-footer {
    padding: 1rem .75rem;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex; align-items: center; gap: .75rem;
}
.user-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--primary); color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .95rem; flex-shrink: 0;
}
.user-details { flex: 1; min-width: 0; }
.user-name  { display: block; font-size: .875rem; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { display: block; font-size: .75rem; color: rgba(255,255,255,.5); }

.btn-logout {
    padding: .4rem; border-radius: 8px;
    color: rgba(255,255,255,.5); text-decoration: none;
    background: transparent; border: 0; cursor: pointer;
    transition: color .15s, background .15s;
}
.btn-logout:hover { color: var(--danger); background: rgba(240,82,82,.1); }
.btn-logout svg { width: 18px; height: 18px; display: block; }

/* ── MAIN CONTENT ───────────────────────────────────────── */
.main-content { margin-left: 260px; flex: 1; padding: 2rem; min-height: 100vh; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 2rem;
}
.topbar h2 { font-size: 1.5rem; font-weight: 700; }

.badge {
    padding: .3rem .85rem; border-radius: 999px;
    font-size: .8rem; font-weight: 600;
}
.badge-admin     { background: #e0e7ff; color: #3730a3; }
.badge-superadmin { background: #fee2e2; color: #991b1b; }
.badge-recepcion { background: #d1fae5; color: #065f46; }
.badge-enfermero { background: #fef3c7; color: #92400e; }
.badge-medico    { background: #ede9fe; color: #5b21b6; }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white); border-radius: var(--radius);
    padding: 1.5rem; display: flex; align-items: center; gap: 1rem;
    box-shadow: var(--shadow);
}
.stat-icon {
    width: 52px; height: 52px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; stroke: white; }
.stat-blue   { background: var(--blue); }
.stat-green  { background: var(--green); }
.stat-purple { background: var(--purple); }
.stat-orange { background: var(--orange); }

.stat-value { display: block; font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-label { display: block; font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }

.welcome-card {
    background: var(--white); border-radius: var(--radius);
    padding: 1.75rem; box-shadow: var(--shadow);
}
.welcome-card h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: .5rem; }
.welcome-card p  { color: var(--text-muted); font-size: .9rem; }

/* DASHBOARD REFINEMENT */
.dashboard-page {
    background: #f6f8fb;
}

.sidebar {
    background: linear-gradient(180deg, #08182b 0%, #102a3c 48%, #0c3a6b 100%);
    border-right: 1px solid rgba(255,255,255,.06);
}

.sidebar-header {
    margin: .75rem .65rem .35rem;
    padding: .85rem .65rem;
    gap: .8rem;
    background:
        linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.9)),
        rgba(255,255,255,.76);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 8px;
    box-shadow: inset 0 0 22px rgba(15, 79, 77, .1), 0 10px 22px rgba(0,0,0,.08);
    backdrop-filter: blur(4px);
}

.sidebar-brand-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #0f766e;
    box-shadow: 0 10px 26px rgba(15, 118, 110, .28);
}

.sidebar-brand-mark img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    display: block;
}

.sidebar-brand-text {
    min-width: 0;
    width: 100%;
}

.sidebar-brand-text span {
    display: block;
    color: white;
    font-size: 1rem;
    font-weight: 750;
}

.sidebar-brand-text small {
    display: block;
    margin-top: .45rem;
    color: #4b5563;
    font-size: .72rem;
    font-weight: 650;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-brand-logo {
    width: min(224px, 100%);
    max-height: 76px;
    object-fit: contain;
    object-position: center;
    display: block;
    margin: 0 auto;
    filter: none;
}

.sidebar-header > svg {
    display: none;
}

.nav-section {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: .65rem .25rem .2rem;
    padding: 0 .75rem;
    color: rgba(255,255,255,.28);
    font-size: .65rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.nav-section::before {
    content: '';
    width: 14px;
    height: 1px;
    background: rgba(255,255,255,.18);
    flex-shrink: 0;
}

.nav-item {
    position: relative;
    min-height: 42px;
    border-radius: 8px;
}

.nav-item small {
    margin-left: auto;
    padding: .12rem .4rem;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.48);
    font-size: .68rem;
}

.nav-counter {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 .35rem;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.nav-counter-yellow {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 .35rem;
    border-radius: 999px;
    background: #fff;
    color: #1a56db;
    border: 1px solid rgba(26, 86, 219, .22);
    font-size: .68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.nav-counter-soft {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 .34rem;
    border-radius: 999px;
    background: rgba(255,255,255,.9);
    color: #1a56db;
    border: 1px solid rgba(26, 86, 219, .18);
    font-size: .64rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.nav-item.active {
    background: rgba(26, 86, 219, .95);
    box-shadow: 0 10px 24px rgba(26, 86, 219, .22);
}

.nav-dropdown {
    display: grid;
    gap: .25rem;
}

.nav-dropdown summary {
    list-style: none;
    cursor: pointer;
}

.nav-dropdown summary::-webkit-details-marker {
    display: none;
}

.nav-dropdown-toggle {
    width: 100%;
}

.nav-chevron {
    margin-left: auto;
    width: 15px;
    height: 15px;
    transition: transform .15s;
}

.nav-dropdown[open] .nav-chevron {
    transform: rotate(180deg);
}

.nav-dropdown[open] > summary {
    background: rgba(255,255,255,.08);
    color: white;
    border-radius: var(--radius) var(--radius) 4px 4px;
}

.nav-submenu {
    display: grid;
    gap: .15rem;
    margin-left: .85rem;
    padding: .4rem .4rem .45rem .85rem;
    border-left: 2px solid rgba(26, 86, 219, .55);
    background: rgba(0,0,0,.18);
    border-radius: 0 6px 6px 0;
    margin-top: .1rem;
}

.nav-subitem {
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .7rem;
    border-radius: 6px;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    font-size: .82rem;
    transition: background .15s, color .15s;
}

.nav-subitem:hover {
    background: rgba(255,255,255,.1);
    color: white;
}

.nav-subitem.active {
    background: rgba(26, 86, 219, .35);
    color: white;
    font-weight: 700;
}

.nav-subitem small {
    margin-left: auto;
    padding: .1rem .35rem;
    border-radius: 999px;
    background: rgba(255,255,255,.86);
    color: #1a56db;
    font-size: .64rem;
    font-weight: 800;
}

.nav-subitem-disabled {
    cursor: not-allowed;
    opacity: .65;
}

.nav-subitem-disabled:hover {
    background: transparent;
    color: rgba(255,255,255,.65);
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }

.sidebar-footer {
    padding: .75rem;
    background: rgba(255,255,255,.03);
}

.sidebar-dev-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem .75rem;
    border-radius: 8px;
    text-decoration: none;
    transition: background .15s;
}
.sidebar-dev-link:hover { background: rgba(255,255,255,.06); }
.sidebar-dev-link svg {
    width: 14px; height: 14px;
    flex-shrink: 0;
    stroke: rgba(255,255,255,.35);
    transition: stroke .15s;
}
.sidebar-dev-link:hover svg { stroke: rgba(255,255,255,.6); }
.sidebar-dev-info { min-width: 0; }
.sidebar-dev-name {
    display: block;
    font-size: .8rem;
    font-weight: 650;
    color: rgba(255,255,255,.55);
    transition: color .15s;
}
.sidebar-dev-link:hover .sidebar-dev-name { color: rgba(255,255,255,.85); }
.sidebar-dev-desc {
    display: block;
    margin-top: .1rem;
    font-size: .7rem;
    color: rgba(255,255,255,.28);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-avatar {
    border-radius: 10px;
    background: #1a56db;
}

.main-content {
    padding: 2rem 2.25rem;
    padding-top: calc(52px + 1.75rem);
}

.topbar {
    align-items: flex-start;
    gap: 1rem;
}

.topbar-kicker,
.panel-kicker {
    display: block;
    margin-bottom: .25rem;
    color: #0f766e;
    font-size: .75rem;
    font-weight: 750;
    text-transform: uppercase;
}

.topbar h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 760;
    color: #111928;
}

.topbar p {
    margin: .25rem 0 0;
    color: var(--text-muted);
    font-size: .9rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn-outline-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 34px;
    padding: .35rem .8rem;
    border: 1px solid #cfd8e3;
    border-radius: 8px;
    background: white;
    color: #4b5563;
    font-size: .84rem;
    font-weight: 650;
    text-decoration: none;
}

.btn-outline-action:disabled {
    opacity: .7;
    cursor: not-allowed;
}

.dashboard-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    border: 1px solid #e5eaf1;
    border-radius: 8px;
    padding: 1.15rem;
    align-items: flex-start;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 8px;
}

.stat-icon svg {
    width: 22px;
    height: 22px;
}

.stat-value {
    font-size: 1.6rem;
}

.stat-label {
    color: #374151;
    font-size: .86rem;
    font-weight: 650;
}

.stat-hint {
    display: block;
    margin-top: .35rem;
    color: var(--text-muted);
    font-size: .75rem;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
    gap: 1.25rem;
}

.dashboard-panel {
    min-height: 320px;
    background: white;
    border: 1px solid #e5eaf1;
    border-radius: 8px;
    padding: 1.35rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.panel-header h2 {
    margin: 0;
    color: #111928;
    font-size: 1.05rem;
    font-weight: 750;
}

.panel-helper {
    display: block;
    margin-top: .25rem;
    color: var(--text-muted);
    font-size: .78rem;
}

.panel-count {
    padding: .22rem .6rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: .76rem;
    font-weight: 700;
}

.table-toolbar {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 1rem;
}

.table-search {
    position: relative;
    width: min(100%, 420px);
}

.table-search svg {
    position: absolute;
    top: 50%;
    left: .85rem;
    width: 17px;
    height: 17px;
    color: #64748b;
    pointer-events: none;
    transform: translateY(-50%);
}

.table-search input {
    width: 100%;
    min-height: 40px;
    padding: .6rem .85rem .6rem 2.5rem;
    border: 1px solid #d7dee8;
    border-radius: 8px;
    background: #fbfdff;
    color: var(--text);
    font: inherit;
    font-size: .88rem;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.table-search input:focus {
    border-color: #0f766e;
    box-shadow: 0 0 0 4px rgba(15,118,110,.12);
    background: white;
}

.carro-inventory-toolbar {
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.carro-inventory-toolbar .table-search {
    flex: 0 1 420px;
}

.btn-carro-devolucion,
.btn-primary-action.btn-carro-devolucion,
.btn-submit-devolucion,
.btn-primary-action.btn-submit-devolucion {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
    box-shadow: 0 10px 20px rgba(220, 38, 38, .2);
}

.btn-carro-devolucion:hover,
.btn-primary-action.btn-carro-devolucion:hover,
.btn-submit-devolucion:hover,
.btn-primary-action.btn-submit-devolucion:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

.btn-carro-exchange,
.btn-primary-action.btn-carro-exchange {
    min-height: 42px;
    justify-content: center;
    background: #ea580c;
    border-color: #ea580c;
    color: #fff;
    box-shadow: 0 10px 20px rgba(234, 88, 12, .22);
}

.btn-carro-exchange:hover,
.btn-primary-action.btn-carro-exchange:hover {
    background: #c2410c;
    border-color: #c2410c;
    color: #fff;
}

.carros-toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .85rem;
    align-items: center;
    margin: 0 0 1rem;
}

.carros-toolbar .table-search {
    width: 100%;
}

.carros-product-search-button {
    width: 75%;
    min-height: 42px;
    justify-content: center;
    justify-self: center;
}

.carros-product-search-button {
    background: #0f766e;
    border-color: #0f766e;
    color: #fff;
    box-shadow: 0 10px 20px rgba(15, 118, 110, .18);
}

.carros-product-search-button:hover {
    background: #115e59;
    border-color: #115e59;
    color: #fff;
}

.carros-toolbar-action {
    display: flex;
    justify-content: center;
}

.carros-toolbar-action .btn-primary-action {
    width: 75%;
    min-height: 42px;
    justify-content: center;
}

.intercambio-help {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
    border-radius: 8px;
    padding: .75rem .9rem;
    font-size: .86rem;
    font-weight: 700;
}

.intercambio-product-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 140px 140px 42px;
    gap: .75rem;
    align-items: end;
    padding: .75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    margin-bottom: .75rem;
}

.intercambio-empty {
    padding: 1rem;
}

.product-modal-search {
    width: min(100%, 520px);
}

.product-results-table .product-carro-list {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.product-carro-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .28rem .5rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: .76rem;
    font-weight: 600;
}

.product-carro-pill strong {
    color: #0f766e;
    font-weight: 800;
}

.requisiciones-date-toolbar {
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(140px, 170px) minmax(140px, 170px) minmax(132px, 150px) minmax(128px, 150px) minmax(170px, auto);
    gap: .85rem;
    align-items: end;
    margin: 0 0 1rem;
}

.requisiciones-almacen-toolbar {
    grid-template-columns: minmax(300px, 380px) minmax(140px, 170px) minmax(140px, 170px) minmax(132px, 150px) minmax(128px, 150px);
}

.entradas-date-toolbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: .75rem;
    align-items: end;
    margin: 0 0 1rem;
}
.entradas-date-toolbar [data-table-search] .table-search {
    width: 100%;
}
.entradas-date-toolbar .form-group {
    margin: 0;
}
.entradas-date-toolbar .form-group input {
    padding: .6rem .75rem;
    min-height: 40px;
    font-size: .88rem;
}
.entradas-date-toolbar .btn-primary-action,
.entradas-date-toolbar .btn-outline-action {
    width: 100%;
    min-height: 40px;
    justify-content: center;
}

.requisiciones-date-toolbar .form-group {
    margin: 0;
}

.requisiciones-date-toolbar .form-group input {
    min-height: 42px;
    padding-top: .55rem;
    padding-bottom: .55rem;
}

.requisiciones-search-box .table-search {
    width: 100%;
}

.requisiciones-search-action {
    min-height: 42px;
    justify-content: center;
}

.requisiciones-latest-action {
    background: #111827;
    border-color: #111827;
    color: #fff;
    min-height: 42px;
    justify-content: center;
    white-space: nowrap;
}

.requisiciones-latest-action:hover {
    background: #1f2937;
    border-color: #1f2937;
    color: #fff;
}

.requisiciones-new-action {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-left: 1.5rem;
    border: 1px solid #FF00FF;
    border-radius: 8px;
    background: #FF00FF;
    color: #fff;
    min-height: 42px;
    padding: .58rem .9rem;
    font-size: .88rem;
    font-weight: 800;
    justify-content: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.requisiciones-new-action:hover {
    background: #d600d6;
    border-color: #d600d6;
}

.btn-require-missing {
    min-height: 40px;
    background: #0f766e;
    box-shadow: 0 12px 24px rgba(15,118,110,.22);
    white-space: nowrap;
}

.btn-require-missing:hover {
    background: #115e59;
    box-shadow: 0 16px 30px rgba(15,118,110,.28);
}

.btn-require-missing.btn-release-blocked {
    background: #e8f7f4;
    color: #0f766e;
    border: 1px solid #99d7ce;
    box-shadow: none;
}

.table-empty-filter {
    min-height: 220px;
}

.empty-state {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px dashed #cfd8e3;
    border-radius: 8px;
    background: #f9fbfd;
    padding: 1.5rem;
}

.empty-icon {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #e6f5f2;
    color: #0f766e;
    margin-bottom: 1rem;
}

.empty-icon svg {
    width: 25px;
    height: 25px;
}

.empty-state h3 {
    margin: 0 0 .45rem;
    font-size: 1rem;
    font-weight: 750;
    color: #111928;
}

.empty-state p {
    max-width: 420px;
    margin: 0;
    color: var(--text-muted);
    font-size: .88rem;
    line-height: 1.55;
}

.activity-list {
    display: grid;
    gap: .9rem;
}

.activity-item {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr);
    gap: .75rem;
    padding-bottom: .9rem;
    border-bottom: 1px solid #eef2f7;
}

.activity-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.activity-item strong {
    display: block;
    color: #111928;
    font-size: .88rem;
    margin-bottom: .2rem;
}

.activity-item p {
    margin: 0;
    color: var(--text-muted);
    font-size: .8rem;
    line-height: 1.45;
}

.activity-dot {
    width: 9px;
    height: 9px;
    margin-top: .28rem;
    border-radius: 50%;
    background: #cbd5e1;
}

.activity-green { background: #0e9f6e; }
.activity-blue { background: #1a56db; }
.activity-item.muted { opacity: .82; }

/* ── MENUBAR ─────────────────────────────────────────────── */
.menubar {
    position: fixed;
    top: 0; left: 260px; right: 0;
    height: 52px;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: #ffffff;
    border-bottom: 1px solid #e5eaf1;
    box-shadow: 0 1px 4px rgba(15,23,42,.05);
}
.menubar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.menubar-session {
    display: flex;
    align-items: center;
    gap: .35rem;
    color: var(--text-muted);
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
}
.menubar-session svg { width: 13px; height: 13px; flex-shrink: 0; }
.menubar-sep { opacity: .45; }

.menubar-user {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .3rem .55rem .3rem .4rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #dde3eb;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.menubar-user:hover { background: #cdd5df; border-color: #c2cad5; }
.menubar-avatar {
    width: 28px; height: 28px;
    min-width: 28px; max-width: 28px;
    min-height: 28px; max-height: 28px;
    border-radius: 6px;
    background: var(--primary);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8rem;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}
.menubar-avatar img {
    display: block;
    position: absolute;
    inset: 0;
    width: 28px !important;
    height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
    object-fit: cover;
    object-position: center;
    border-radius: inherit;
}
.menubar-user-info {
    display: flex; align-items: center; gap: .45rem;
}
.menubar-user-name {
    font-size: .85rem; font-weight: 600; color: var(--text);
    white-space: nowrap;
}
.menubar-chevron {
    width: 14px; height: 14px;
    color: var(--text-muted);
    transition: transform .15s;
    flex-shrink: 0;
}
.menubar-user[aria-expanded="true"] .menubar-chevron { transform: rotate(180deg); }

.menubar-user-menu {
    min-width: 210px;
    padding: .3rem;
    border: 1px solid #e5eaf1;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15,23,42,.1);
}
.menubar-user-header {
    padding: .45rem .75rem .4rem;
}
.menubar-user-header span {
    display: block;
    font-size: .76rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.menubar-user-menu .dropdown-item {
    display: flex; align-items: center; gap: .5rem;
    padding: .55rem .7rem;
    border-radius: 6px;
    color: var(--text);
    font-size: .85rem;
    cursor: pointer;
    transition: background .12s;
}
.menubar-user-menu .dropdown-item:hover { background: #f3f4f6; }
.menubar-user-menu .dropdown-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.menubar-user-menu .dropdown-item-logout { color: var(--danger); }
.menubar-user-menu .dropdown-item-logout:hover { background: #fde8e8; color: var(--danger); }
.menubar-user-menu .dropdown-divider { margin: .25rem .2rem; }

/* ── TEMAS ───────────────────────────────────────────────── */
.temas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
}
.tema-card {
    border: 2px solid #e5eaf1;
    border-radius: 10px;
    overflow: hidden;
    background: white;
    transition: border-color .18s, box-shadow .18s;
}
.tema-card:hover { border-color: #c0cad6; box-shadow: 0 6px 18px rgba(15,23,42,.08); }
.tema-card-activo { border-color: var(--primary) !important; box-shadow: 0 0 0 3px rgba(26,86,219,.12); }

.tema-preview {
    display: flex;
    height: 110px;
    background: #f6f8fb;
}
.tema-preview-sidebar {
    width: 38%;
    display: flex;
    flex-direction: column;
    padding: .5rem .35rem;
    gap: .3rem;
}
.tema-preview-logo {
    height: 10px;
    border-radius: 4px;
    background: rgba(255,255,255,.25);
    margin-bottom: .2rem;
}
.tema-preview-nav { display: flex; flex-direction: column; gap: .2rem; }
.tema-preview-nav-item { height: 7px; border-radius: 3px; opacity: .7; }
.tema-preview-nav-active { opacity: 1; }
.tema-preview-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: .4rem .45rem;
    gap: .35rem;
}
.tema-preview-topbar { height: 10px; border-radius: 3px; background: #e5eaf1; }
.tema-preview-body { display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.tema-preview-card { flex: 1; border-radius: 4px; background: white; border: 1px solid #e5eaf1; }
.tema-preview-btn { height: 10px; width: 55%; border-radius: 3px; align-self: flex-end; }

.tema-card-footer {
    padding: .7rem .85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    border-top: 1px solid #f0f4f8;
}
.tema-card-info { display: flex; align-items: center; gap: .45rem; }
.tema-card-nombre { font-size: .88rem; font-weight: 650; color: var(--text); }
.tema-badge-activo {
    padding: .15rem .45rem;
    border-radius: 999px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: .7rem;
    font-weight: 700;
}
.btn-tema-aplicar {
    padding: .28rem .65rem;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s, border-color .12s;
    white-space: nowrap;
}
.btn-tema-aplicar:hover { background: #f3f4f6; border-color: #9ca3af; }
/* ── FORMULARIO MÉDICO ───────────────────────────────────── */
.medico-toggle-wrap {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: .55rem .9rem;
    border-radius: 8px;
    background: #1a56db;
    box-shadow: 0 6px 18px rgba(26,86,219,.28);
    width: fit-content;
    align-self: start;
}
.medico-toggle-label {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .85rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    white-space: nowrap;
}
.medico-toggle-label svg { width: 15px; height: 15px; stroke: #ffffff; }
.medico-toggle-wrap .form-check-input {
    width: 2.2em;
    height: 1.1em;
    cursor: pointer;
    border-color: rgba(255,255,255,.5);
    background-color: rgba(255,255,255,.2);
}
.medico-toggle-wrap .form-check-input:checked {
    background-color: #ffffff;
    border-color: #ffffff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%231a56db'/%3e%3c/svg%3e");
}
.medico-toggle-wrap .form-check-input:focus { box-shadow: 0 0 0 3px rgba(255,255,255,.3); }
.datos-medico-section {
    padding: 1rem;
    border: 1px dashed #c6d2e0;
    border-radius: 8px;
    background: #f8fafc;
}

.temas-seccion-label {
    margin: 0 0 .75rem;
    color: var(--text-muted);
    font-size: .75rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.users-panel {
    min-height: 420px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 820px;
}

.data-table th,
.data-table td {
    padding: .9rem .85rem;
    border-bottom: 1px solid #eef2f7;
    text-align: left;
    vertical-align: middle;
    font-size: .86rem;
}

.data-table--compact th,
.data-table--compact td { padding: .35rem .65rem; }

.data-table th {
    color: #64748b;
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    background: #f8fafc;
}

.data-table tbody tr:hover {
    background: #fbfdff;
}

.table-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 210px;
}

.table-avatar {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #e6f5f2;
    color: #0f766e;
    font-size: .84rem;
    font-weight: 800;
    flex-shrink: 0;
}

.table-user strong {
    display: block;
    color: #111928;
    font-size: .9rem;
}

.table-user small {
    display: block;
    margin-top: .12rem;
    color: #94a3b8;
    font-size: .72rem;
}

.role-pill,
.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: .18rem .55rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 750;
    white-space: nowrap;
}

.role-pill {
    background: #eef2ff;
    color: #3730a3;
}

.status-active {
    background: #d1fae5;
    color: #065f46;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.status-draft {
    background: #e0f2fe;
    color: #075985;
}

.company-panel {
    min-height: 520px;
}

.settings-form {
    display: grid;
    gap: 1rem;
}

.form-grid {
    display: grid;
    gap: 1rem;
}

.form-grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.settings-form .form-group {
    margin-bottom: 0;
}

.company-logo-section {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e5eaf1;
    border-radius: 8px;
    background: #f9fbfd;
}

.company-logo-preview {
    width: 104px;
    aspect-ratio: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #d7dee8;
    border-radius: 8px;
    background: white;
    color: #0f766e;
}

.company-logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: .5rem;
}

.company-logo-placeholder {
    width: 34px;
    height: 34px;
}

.form-help {
    display: block;
    margin-top: .4rem;
    color: var(--text-muted);
    font-size: .76rem;
}
.select-empty-hint a {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 600;
}
.select-empty-hint a:hover { color: var(--primary-dark); }
.form-group select:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

.settings-form textarea {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    padding: .78rem .95rem;
    border: 1px solid #d7dee8;
    border-radius: 8px;
    background: #fbfdff;
    color: var(--text);
    font: inherit;
    font-size: .95rem;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.settings-form textarea:focus,
.settings-form input:focus {
    border-color: #0f766e;
    box-shadow: 0 0 0 4px rgba(15,118,110,.12);
    background: white;
}

.settings-form input[readonly] {
    background: #f1f5f9;
    color: #64748b;
    cursor: default;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: .25rem;
}

.btn-primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 38px;
    padding: .55rem 1rem;
    border: 0;
    border-radius: 8px;
    background: #1a56db;
    color: white;
    text-decoration: none;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 26px rgba(26,86,219,.2);
    transition: background .15s, transform .15s, box-shadow .15s;
}

.btn-primary-action:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(26,86,219,.25);
}

.btn-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
    justify-content: flex-end;
}

.inline-form {
    margin: 0;
}

.btn-table-action {
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid #e5eaf1;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, border-color .12s, color .12s;
}
.btn-table-action svg { width: 13px; height: 13px; }
.btn-table-text {
    width: auto;
    min-width: 72px;
    padding: 0 .6rem;
    font-size: .76rem;
    font-weight: 700;
    gap: .35rem;
}
.btn-table-mini-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}
.btn-view  { color: #0f766e; }
.btn-view:hover  { background: #f0fdf9; border-color: #99f6e4; }
.btn-action-teal   { background:#0f766e; border-color:#0f766e; color:#fff; }
.btn-action-teal:hover   { background:#0d9488; border-color:#0d9488; color:#fff; }
.btn-action-blue   { background:#2563eb; border-color:#2563eb; color:#fff; }
.btn-action-blue:hover   { background:#1d4ed8; border-color:#1d4ed8; color:#fff; }
.btn-action-indigo { background:#7c3aed; border-color:#7c3aed; color:#fff; }
.btn-action-indigo:hover { background:#6d28d9; border-color:#6d28d9; color:#fff; }
.btn-action-gray   { background:#e5e7eb; border-color:#e5e7eb; color:#9ca3af; cursor:not-allowed; }
.btn-action-account { background:#32CD32; border-color:#32CD32; color:#000; }
.btn-action-account:hover { background:#28b428; border-color:#28b428; color:#000; }
.ingresos-page .ingreso-account-cell {
    position: relative;
    width: 112px;
    min-width: 112px;
    padding: 0;
}
.ingresos-page .ingreso-account-cell .btn-action-account {
    position: absolute;
    inset: .3rem .6rem;
    min-width: 0;
    width: auto;
    height: auto;
    min-height: 30px;
    border: 0;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .12);
}
.ingresos-page .data-table th,
.ingresos-page .data-table td {
    padding-top: .55rem;
    padding-bottom: .55rem;
}
.ingresos-page .table-avatar {
    width: 34px;
    height: 34px;
}
.ingresos-page .table-user {
    gap: .55rem;
}
.ingresos-page .table-actions {
    gap: .45rem;
}
.ingresos-page .table-actions .btn-table-action {
    height: 32px;
    min-height: 32px;
    border: 0;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .12);
    transition: background .12s, color .12s, transform .12s, box-shadow .12s;
}
.ingresos-page .table-actions .btn-table-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, .18);
}
.ingresos-page .table-actions .btn-table-action:active {
    transform: translateY(0);
}
.ingresos-page .table-actions .btn-action-blue {
    width: 38px;
}
.ingresos-page .table-actions .btn-table-text {
    min-width: 88px;
    padding: 0 .8rem;
    font-size: .78rem;
}
.btn-requisicion-carro {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
    text-decoration: none;
}
.btn-requisicion-carro:hover {
    background: #15803d;
    border-color: #15803d;
    color: #fff;
    text-decoration: none;
}
.btn-edit  { color: #3b82f6; }
.btn-edit:hover  { background: #eff6ff; border-color: #bfdbfe; }
.btn-delete { color: var(--danger); }
.btn-delete:hover { background: #fde8e8; border-color: #fca5a5; }
/* ── Desglose impuesto (sección header del modal) ───────── */
.desglose-impuesto-fields {
    margin-top: .5rem;
    padding: .6rem .75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.req { color: #dc2626; font-size: .8rem; }

/* ── Toggle IVA ─────────────────────────────────────────── */
.entrada-toggle-field {
    display: flex;
}

.entrada-iva-toggle {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-width: 0;
    cursor: pointer;
    user-select: none;
}
.entrada-iva-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}
.iva-toggle-track {
    position: relative;
    flex-shrink: 0;
    width: 38px; height: 22px;
    background: #475569;
    border: 1.5px solid #334155;
    border-radius: 22px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08);
    transition: background .2s, border-color .2s;
}
.iva-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 14px; height: 14px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.28);
    transition: transform .2s;
}
.entrada-iva-toggle input:checked ~ .iva-toggle-track {
    background: #1e40af;
    border-color: #1e3a8a;
}
.entrada-iva-toggle input:checked ~ .iva-toggle-track::after {
    background: #fff;
    transform: translateX(16px);
}

#editar-entrada-modal .iva-toggle-track {
    background: #334155;
    border-color: #1e293b;
}

#editar-entrada-modal .entrada-iva-toggle input:checked ~ .iva-toggle-track {
    background: #1e40af;
    border-color: #1e3a8a;
}

.iva-toggle-text {
    display: block;
    min-width: 0;
    color: var(--text-main);
    font-size: .85rem;
    font-weight: 500;
    line-height: 1.25;
}
.iva-pct { color: var(--text-muted); font-size: .78rem; font-weight: 400; }

/* ── Desglose IVA por renglón ────────────────────────────── */
.entrada-iva-breakdown {
    display: none;
    gap: .4rem;
    font-size: .74rem;
    margin-top: .2rem;
    padding: .25rem .5rem;
    background: #eff6ff;
    border-left: 2px solid #93c5fd;
    border-radius: 0 4px 4px 0;
    grid-column: 3 / span 1;
}
.bd-neto  { color: #1e40af; font-weight: 600; }
.bd-sep   { color: #94a3b8; }
.bd-iva   { color: #64748b; }

.btn-pdf { color: #7c3aed; text-decoration: none; }
.btn-pdf:hover { background: #f5f3ff; border-color: #c4b5fd; color: #6d28d9; }

.entrada-pdf-body {
    height: min(78vh, 760px);
    padding: 0;
    background: #0f172a;
}

.entrada-pdf-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.btn-release-entry {
    background: #fef08a;
    border-color: #fde047;
    color: #15803d;
}
.btn-release-entry:hover {
    background: #fde047;
    border-color: #facc15;
    color: #15803d;
}

.btn-release-entry.btn-loading {
    gap: .35rem;
    cursor: wait;
    opacity: .82;
}

.btn-release-entry.btn-loading::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-release-blocked {
    background: #dcfce7;
    border-color: #86efac;
    color: #16a34a;
    cursor: default;
    pointer-events: none;
}

.empleado-detalle-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .85rem 1.5rem;
}
.empleado-detalle-full { grid-column: 1 / -1; }
.empleado-detalle-item { display: flex; flex-direction: column; gap: .2rem; }
.empleado-detalle-label {
    font-size: .72rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}
.empleado-detalle-val {
    font-size: .9rem;
    color: var(--text);
    font-weight: 500;
}

.rooms-table {
    min-width: 760px;
}

.table-icon {
    width: 18px;
    height: 18px;
}

.empty-state-icon {
    width: 25px;
    height: 25px;
}

.app-modal {
    border: 0;
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, .22);
}

.app-modal .modal-header,
.app-modal .modal-footer {
    border-color: #eef2f7;
}

.app-modal .modal-title {
    color: #111928;
    font-size: 1.05rem;
    font-weight: 750;
}

#producto-modal .modal-body,
#producto-edit-modal .modal-body {
    padding-top: .85rem;
    padding-bottom: .85rem;
}

#producto-modal .settings-form,
#producto-edit-modal .settings-form,
#producto-modal .form-grid,
#producto-edit-modal .form-grid {
    gap: .72rem;
}

#producto-modal .form-group label,
#producto-edit-modal .form-group label {
    margin-bottom: .28rem;
    font-size: .8rem;
}

#producto-modal .form-group input,
#producto-modal .form-group select,
#producto-edit-modal .form-group input,
#producto-edit-modal .form-group select {
    padding: .55rem .72rem;
    font-size: .88rem;
    border-radius: 7px;
}

#producto-modal .settings-form textarea,
#producto-edit-modal .settings-form textarea {
    min-height: 72px;
    padding: .55rem .72rem;
    font-size: .88rem;
    border-radius: 7px;
}

#producto-modal .form-help,
#producto-edit-modal .form-help {
    margin-top: .28rem;
    font-size: .72rem;
}

.entrada-header-grid {
    align-items: end;
}

.entrada-items-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    color: var(--text);
    font-size: .9rem;
    font-weight: 750;
}

.entrada-items-title {
    display: grid;
    gap: .18rem;
    min-width: 0;
}

.entrada-items-title small {
    color: var(--text-muted);
    font-size: .74rem;
    font-weight: 500;
    line-height: 1.3;
}

.entrada-items {
    display: grid;
    gap: .7rem;
    margin-top: .7rem;
}

.entrada-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: end;
    padding: .65rem .75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fbfdff;
}
.entrada-product-summary {
    width: 100%;
}
.entrada-row .form-group {
    min-width: 0;
    flex-shrink: 0;
}
.entrada-row .btn-table-action {
    align-self: flex-end;
}
.entrada-tax-group {
    display: contents;
}
.entrada-tax-group .form-group {
    min-width: 0;
}
.entrada-impuesto-display,
.entrada-costo-total-display {
    background: #f1f5f9 !important;
    color: #475569 !important;
    cursor: default;
}

.entrada-caducidad-group.entrada-caducidad-required label::after {
    content: " *";
    color: #dc2626;
}

.entrada-caducidad-input[readonly] {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

.entrada-row .form-group label {
    margin-bottom: .2rem;
    font-size: .72rem;
}

.entrada-row .form-group input,
.entrada-row .form-group select {
    width: 100%;
    padding: .45rem .55rem;
    font-size: .84rem;
    border-radius: 6px;
}

#productos-selector-modal {
    z-index: 1070;
}

.entrada-selected-items {
    max-height: min(38vh, 360px);
    overflow: auto;
    padding-right: .15rem;
}

.entrada-empty-products {
    padding: .9rem 1rem;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: .86rem;
}

.entrada-product-summary {
    display: grid;
    gap: .2rem;
    align-self: center;
    min-width: 0;
}

.entrada-product-name {
    overflow: hidden;
    color: var(--text);
    font-size: .86rem;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entrada-product-stock {
    color: var(--text-muted);
    font-size: .74rem;
}

.entrada-price-warning {
    display: block;
    margin-top: .35rem;
    color: #dc2626;
    font-size: .70rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
}

.entrada-search {
    margin-bottom: .9rem;
}

#productos-selector-modal .entrada-search {
    background: #fff;
    flex: 0 0 auto;
    padding: 0 0 .75rem;
}

#productos-selector-modal .modal-body {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 190px);
    overflow: hidden;
}

#productos-selector-modal .producto-selector-list {
    overflow-y: auto;
    padding-right: .25rem;
}

.producto-selector-list {
    display: grid;
    gap: .45rem;
}

.producto-selector-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 116px;
    gap: .65rem;
    align-items: center;
    min-height: 44px;
    padding: .55rem .65rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
}

.producto-selector-row:hover {
    border-color: #bfdbfe;
    background: #f8fbff;
}

.producto-check {
    display: flex;
    align-items: center;
    justify-content: center;
}

.producto-check input {
    width: 18px;
    height: 18px;
}

.producto-selector-name {
    overflow: hidden;
    color: var(--text);
    font-size: .86rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.producto-selector-stock {
    color: #0f172a;
    font-size: .8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.error-page {
    min-height: 100vh;
    background:
        linear-gradient(120deg, rgba(8, 24, 43, .96), rgba(15, 79, 77, .9)),
        url('../imgs/pexels-ai25studioai-5214962.jpg') center / cover no-repeat;
}

.error-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.error-panel {
    width: min(520px, 100%);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 8px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 24px 80px rgba(0,0,0,.22);
    text-align: center;
}

.error-mark {
    color: #0f766e;
    font-size: 4rem;
    line-height: 1;
    font-weight: 850;
}

.error-panel h1 {
    margin: .8rem 0 .5rem;
    color: #111928;
    font-size: 1.6rem;
    font-weight: 760;
}

.error-panel p {
    margin: 0 auto 1.35rem;
    max-width: 360px;
    color: var(--text-muted);
    font-size: .94rem;
    line-height: 1.55;
}

.stock-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .85rem;
    margin-bottom: 1rem;
}

.stock-summary-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    padding: .95rem 1rem;
    box-shadow: var(--shadow-sm);
}

.stock-summary-card span {
    display: block;
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 750;
    text-transform: uppercase;
}

.stock-summary-card strong {
    display: block;
    margin-top: .2rem;
    color: var(--text-main);
    font-size: 1.45rem;
    font-weight: 820;
    font-variant-numeric: tabular-nums;
}

.stock-summary-ok {
    border-color: #bbf7d0;
}

.stock-summary-low {
    border-color: #fde68a;
}

.stock-summary-empty {
    border-color: #fecaca;
}

.stock-filters {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(160px, 200px) minmax(170px, 220px);
    gap: .85rem;
    margin-bottom: 1rem;
}

.stock-table td {
    vertical-align: middle;
}

.stock-qty {
    color: #0f172a;
    font-size: .95rem;
    font-weight: 820;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.stock-status {
    display: inline-flex;
    align-items: center;
    min-width: 86px;
    justify-content: center;
    border-radius: 999px;
    padding: .28rem .62rem;
    font-size: .72rem;
    font-weight: 800;
}

.stock-status-ok {
    background: #dcfce7;
    color: #166534;
}

.stock-status-bajo {
    background: #fef3c7;
    color: #92400e;
}

.stock-status-sin_stock {
    background: #fee2e2;
    color: #991b1b;
}

.stock-detail-table td {
    font-size: .84rem;
    vertical-align: middle;
}

.stock-modal-empty {
    display: none;
    margin-top: 1rem;
}

@media (max-width: 980px) {
    .sidebar {
        position: static;
        width: 100%;
        min-height: auto;
    }

    .dashboard-page {
        display: block;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        align-items: flex-start;
    }

    .nav-dropdown {
        min-width: 220px;
    }

    .nav-submenu {
        margin-left: .5rem;
    }

    .sidebar-footer {
        display: none;
    }

    .menubar {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 1.25rem;
        padding-top: calc(52px + 1rem);
    }

    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .stock-summary-grid,
    .stock-filters {
        grid-template-columns: 1fr;
    }

    .carros-toolbar {
        grid-template-columns: 1fr;
    }

    .carros-product-search-button,
    .carros-toolbar-action .btn-primary-action {
        width: 100%;
    }

    .carros-toolbar-action {
        justify-content: center;
    }

    .intercambio-product-row {
        grid-template-columns: 1fr;
    }

    .requisiciones-date-toolbar {
        grid-template-columns: minmax(180px, 1fr) minmax(130px, 1fr) minmax(130px, 1fr);
    }

    .requisiciones-almacen-toolbar {
        grid-template-columns: minmax(180px, 1fr) minmax(130px, 1fr) minmax(130px, 1fr);
    }

    .requisiciones-search-action,
    .requisiciones-latest-action,
    .requisiciones-new-action {
        width: 100%;
    }

    .form-grid-two,
    .form-grid-three,
    .form-grid-four {
        grid-template-columns: 1fr;
    }

    .company-logo-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .topbar {
        flex-direction: column;
    }

    .topbar-actions {
        justify-content: flex-start;
    }

    .requisiciones-date-toolbar {
        grid-template-columns: 1fr;
    }

    .dashboard-summary {
        grid-template-columns: 1fr;
    }

    .sidebar-header {
        padding: 1rem;
    }
}

/* Dashboard operativo */
.dashboard-agenda-list { display: grid; gap: .6rem; }
.dashboard-agenda-item { display: grid; grid-template-columns: 12px 54px 1fr auto; align-items: center; gap: .7rem; padding: .75rem; color: inherit; text-decoration: none; border: 1px solid #e5e7eb; border-radius: 10px; }
.dashboard-agenda-item:hover { background: #f8fafc; border-color: #bfdbfe; }
.dashboard-agenda-item small { color: #64748b; }

/* Historial clínico */
.clinical-layout, .cash-layout { display: grid; grid-template-columns: minmax(300px, .85fr) minmax(420px, 1.35fr); gap: 1.25rem; margin-top: 1.25rem; align-items: start; }
.clinical-form-panel { position: sticky; top: 1rem; }
.clinical-alert { border-left: 4px solid #dc2626; background: #fff7f7; }
.vitals-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, 1fr); gap: .75rem; }
.clinical-timeline { display: grid; gap: 1rem; }
.clinical-note { border: 1px solid #dbe3ee; border-left: 4px solid #2563eb; padding: 1rem; border-radius: 10px; background: #fff; }
.clinical-note.is-cancelled { opacity: .7; border-left-color: #94a3b8; background: #f8fafc; }
.clinical-note-head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.clinical-note-head > div { display: flex; gap: .65rem; align-items: center; }
.clinical-type { padding: .2rem .55rem; background: #dbeafe; color: #1e40af; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.clinical-block { margin-top: .8rem; padding: .75rem; background: #f8fafc; border-radius: 8px; }
.clinical-block p { margin: .3rem 0 0; }
.clinical-vitals { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.clinical-vitals span { background: #ecfeff; color: #155e75; padding: .3rem .55rem; border-radius: 6px; font-size: .82rem; }
.clinical-cancel-form { display: flex; gap: .5rem; margin-top: .9rem; }
.clinical-cancel-form input { flex: 1; }
.clinical-cancelled { margin-top: .8rem; color: #991b1b; font-weight: 600; }

/* Caja */
.cash-summary { grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.cash-summary .stat-card { min-height: 88px; padding: .85rem 1rem; }
.cash-summary .stat-value { font-size: 1.4rem; }
.cash-open-panel { width: min(100%, 720px); }
.cash-open-panel, .cash-layout .dashboard-panel { padding: 1rem 1.15rem; }
.cash-open-panel .panel-header, .cash-layout .panel-header { margin-bottom: .85rem; }
.cash-open-form { grid-template-columns: 180px minmax(260px, 1fr); max-width: 650px; gap: .75rem 1rem; align-items: end; }
.cash-layout { grid-template-columns: minmax(500px, 1.15fr) minmax(350px, .85fr); gap: 1rem; margin-top: 1rem; }
.cash-page .cash-layout > .dashboard-panel + .dashboard-panel { margin-top: 0; }
.cash-page .cash-open-form .form-group,
.cash-page .cash-movement-form .form-group,
.cash-page .cash-close-form .form-group { margin-bottom: 0; }
.cash-movement-form { grid-template-columns: repeat(2, minmax(170px, 240px)); gap: .75rem 1rem; align-items: end; }
.cash-close-form { grid-template-columns: 180px minmax(200px, 1fr); gap: .75rem 1rem; align-items: end; }
.cash-open-form .form-group-full,
.cash-movement-form .form-group-full,
.cash-close-form .form-group-full { grid-column: 1 / -1; }
.cash-page input[name="fondo_inicial"],
.cash-page input[name="monto"],
.cash-page input[name="efectivo_contado"] { max-width: 180px; }
.cash-page select[name="tipo"],
.cash-page select[name="metodo_pago"] { max-width: 240px; }
.cash-page input[name="referencia"] { max-width: 240px; }
.cash-page input[name="concepto"] { max-width: 496px; }
.cash-open-form .btn-primary-action,
.cash-movement-form .btn-primary-action,
.cash-close-form .btn-primary-action { width: auto; justify-self: start; }
.cash-methods { display: grid; gap: .55rem; margin-bottom: 1rem; }
.cash-methods div { display: flex; justify-content: space-between; padding: .6rem .75rem; background: #f8fafc; border-radius: 8px; }
.cash-close-form { border-top: 1px solid #e5e7eb; padding-top: 1rem; }
.cash-difference { color: #b91c1c; font-weight: 700; }
.cash-page .dashboard-panel + .dashboard-panel { margin-top: 1.25rem; }
.cash-history-section { overflow: hidden; }
.cash-history-filters { display: flex; align-items: flex-end; gap: .75rem; padding: 1rem 1.15rem; margin-bottom: 1.35rem; background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%); border: 1px solid #dbe3ee; border-radius: 12px; }
.cash-filter-label { align-self: center; display: flex; align-items: center; gap: .5rem; padding-right: .95rem; margin-right: .15rem; border-right: 1px solid #cbd5e1; color: #334155; font-size: .88rem; font-weight: 700; white-space: nowrap; }
.cash-filter-label i { color: #1e40af; font-size: 1rem; }
.cash-history-filters .form-group { flex: 0 1 205px; margin: 0; }
.cash-history-filters .form-group label { margin-bottom: .35rem; color: #475569; font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .035em; }
.cash-history-filters input[type="date"] { width: 100%; min-height: 42px; background: #fff; border-color: #cbd5e1; }
.cash-range-separator { align-self: flex-end; display: grid; place-items: center; width: 28px; height: 42px; color: #94a3b8; }
.cash-history-actions { display: flex; gap: .55rem; align-items: center; margin-left: .15rem; }
.cash-history-actions .btn-primary-action, .cash-history-actions .btn-outline-action { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding-inline: 1rem; white-space: nowrap; }
.cash-history-table-wrap { margin-inline: -.15rem; padding: .15rem; }
.cash-history-table { min-width: 1080px; border-collapse: separate; border-spacing: 0; }
.cash-history-table thead th { padding: .9rem 1rem; background: #f1f5f9; color: #475569; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .035em; border-top: 1px solid #dbe3ee; border-bottom: 1px solid #cbd5e1; white-space: nowrap; }
.cash-history-table thead th:first-child { border-left: 1px solid #dbe3ee; border-top-left-radius: 10px; }
.cash-history-table thead th:last-child { border-right: 1px solid #dbe3ee; border-top-right-radius: 10px; }
.cash-history-table tbody td { padding: 1rem; vertical-align: middle; color: #334155; border-bottom: 1px solid #e2e8f0; background: #fff; white-space: nowrap; }
.cash-history-table tbody tr:hover td { background: #f8fbff; }
.cash-history-table tbody tr:last-child td:first-child { border-bottom-left-radius: 10px; }
.cash-history-table tbody tr:last-child td:last-child { border-bottom-right-radius: 10px; }
.cash-money { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.cash-balanced { color: #047857 !important; }
.cash-state { display: inline-flex; align-items: center; justify-content: center; min-width: 76px; padding: .32rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 750; }
.cash-state-cerrado { color: #475569; background: #e2e8f0; }
.cash-state-abierto { color: #047857; background: #d1fae5; }
.cash-history-table .js-corte-pdf { min-height: 36px; padding: .45rem .75rem; white-space: nowrap; }

@media (max-width: 980px) {
    .clinical-layout, .cash-layout { grid-template-columns: 1fr; }
    .cash-summary { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
    .clinical-form-panel { position: static; }
    .vitals-grid { grid-template-columns: repeat(2, 1fr); }
    .cash-history-filters { flex-wrap: wrap; }
    .cash-filter-label { flex-basis: 100%; border-right: 0; border-bottom: 1px solid #cbd5e1; padding: 0 0 .7rem; margin: 0 0 .1rem; }
    .cash-history-filters .form-group { flex: 1 1 190px; }
    .cash-history-actions { flex: 1 0 auto; }
}

@media (max-width: 640px) {
    .dashboard-agenda-item { grid-template-columns: 12px 48px 1fr; }
    .dashboard-agenda-item small { grid-column: 3; }
    .vitals-grid { grid-template-columns: 1fr; }
    .clinical-note-head, .clinical-cancel-form { flex-direction: column; }
    .cash-history-filters { align-items: stretch; }
    .cash-history-filters .form-group { flex-basis: 100%; }
    .cash-range-separator { display: none; }
    .cash-history-actions { width: 100%; margin: .15rem 0 0; }
    .cash-history-actions > * { flex: 1; }
    .cash-summary,
    .cash-open-form,
    .cash-movement-form,
    .cash-close-form { grid-template-columns: 1fr; }
    .cash-open-form .form-group-full,
    .cash-movement-form .form-group-full,
    .cash-close-form .form-group-full { grid-column: auto; }
    .cash-page input[name="fondo_inicial"],
    .cash-page input[name="monto"],
    .cash-page input[name="efectivo_contado"],
    .cash-page select[name="tipo"],
    .cash-page select[name="metodo_pago"],
    .cash-page input[name="referencia"],
    .cash-page input[name="concepto"] { max-width: none; }
}
