:root {
    /* Paleta Dental Estrella (logo: teal #20a090, cian #50c0d0, naranja #f0a000) */
    --primary: #1f8f84;
    --hover: #26a396;
    --accent: #50c0d0;
    --accent-soft: rgba(80, 192, 208, 0.22);
    --accent-warm: #f0a000;
    --btn-blue-1: #2aa89b;
    --btn-blue-2: #1f8f84;
    --btn-blue-3: #166b63;
    --bg-light: #f0f4f4;
    --panel-bg: #ffffff;
    --text: #142428;
    --text-muted: #6b8286;
    --line: #d9e5e6;
    --shadow: 0 4px 24px rgba(15, 53, 56, 0.10);
    --radius: 12px;
    --sidebar-w: 268px;

    /* Dashboard palette (alineada a la paleta de marca) */
    --dash-1a: #50c0d0;
    --dash-1b: #1f8f84;
    --dash-2a: #6b8286;
    --dash-2b: #d8eaea;
    --dash-3a: #2aa89b;
    --dash-3b: #cfd9d2;
    --dash-4a: #166b63;
    --dash-4b: #50c0d0;
    --dash-chart-1: #2aa89b;
    --dash-chart-2: #1f8f84;
    --dash-chart-3: #f0a000;
    --dash-grid: rgba(148, 163, 184, 0.25);

    /* Sidebar/nav: slate profundo (no compite con el teal del logo) */
    --nav-blue-1: #0f3538;
    --nav-blue-2: #0c2c2f;
    --nav-blue-3: #091f22;
    --dash-b1: #1f8f84;
    --dash-b2: #166b63;
    --dash-b3: #2aa89b;
    --dash-b4: #6b8286;
    --dash-b5: #50c0d0;
}

/* ===== Tema oscuro (modo noche) ===== */
html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="dark"] body {
    background: #0b1220;
}

html[data-theme="dark"] {
    --bg-light: #0b1220;
    --panel-bg: #0f172a;
    --text: rgba(226, 232, 240, 0.92);
    --text-muted: rgba(148, 163, 184, 0.95);
    --line: rgba(148, 163, 184, 0.16);
    --shadow: 0 8px 36px rgba(0, 0, 0, 0.45);

    --dash-grid: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .panel-elevated,
html[data-theme="dark"] .panel-grid {
    background: var(--panel-bg);
    border-color: var(--line);
}

html[data-theme="dark"] .topbar {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0.82) 100%);
    border-bottom-color: var(--line);
}

html[data-theme="dark"] .topbar-dropdown,
html[data-theme="dark"] .topbar-dropdown--wide {
    background: #0f172a;
    border-color: var(--line);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .topbar-dropdown-item {
    color: var(--text);
}
html[data-theme="dark"] .topbar-dropdown-item:hover {
    background: rgba(34, 195, 255, 0.10);
    color: #e2e8f0;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background: rgba(2, 6, 23, 0.35);
    color: var(--text);
    border-color: var(--line);
}

html[data-theme="dark"] .table-pro thead th {
    background: rgba(2, 6, 23, 0.35);
    border-bottom-color: var(--line);
    color: rgba(226, 232, 240, 0.8);
}
html[data-theme="dark"] .table-pro tbody td {
    border-bottom-color: rgba(148, 163, 184, 0.12);
}
html[data-theme="dark"] .table-pro tbody tr:hover {
    background: rgba(34, 195, 255, 0.06);
}

html[data-theme="dark"] .badge { background: rgba(34, 195, 255, 0.12); color: #cfefff; }
html[data-theme="dark"] .badge-warn { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
html[data-theme="dark"] .badge-ok { background: rgba(34, 197, 94, 0.14); color: #86efac; }
html[data-theme="dark"] .badge-info { background: rgba(59, 130, 246, 0.14); color: #93c5fd; }

html[data-theme="dark"] .kpi {
    border-color: rgba(148, 163, 184, 0.10);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.48);
}

html[data-theme="dark"] .kpi-badge {
    background: rgba(2, 6, 23, 0.24);
    border-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .dash-ranking {
    background:
        radial-gradient(520px 220px at 15% 0%, rgba(34, 195, 255, 0.08) 0%, rgba(34, 195, 255, 0) 55%),
        rgba(15, 23, 42, 0.35);
    border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] .dash-ranking-item {
    background: rgba(2, 6, 23, 0.28);
    border-color: rgba(148, 163, 184, 0.16);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .dash-rank-badge {
    background: rgba(148, 163, 184, 0.12);
    color: rgba(226, 232, 240, 0.92);
}

html[data-theme="dark"] .orbis-modal__box {
    background: #0f172a;
    border-color: var(--line);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
html[data-theme="dark"] .orbis-modal__text { color: rgba(226, 232, 240, 0.82); }

html[data-theme="dark"] .sidebar {
    background:
        radial-gradient(900px 520px at 20% 0%, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 55%),
        linear-gradient(180deg, #222c3e 0%, #1b2535 55%, #141c2a 100%);
    border-right-color: rgba(148, 163, 184, 0.10);
}

html[data-theme="dark"] .menu-link { border-color: rgba(148, 163, 184, 0.00); }
html[data-theme="dark"] .menu-link:hover { border-color: rgba(148, 163, 184, 0.14); }

html[data-theme="dark"] .auth-card { background: rgba(15, 23, 42, 0.84); border-color: rgba(148, 163, 184, 0.16); }
html[data-theme="dark"] .auth-input { background: rgba(2, 6, 23, 0.35); border-color: rgba(148, 163, 184, 0.16); }
html[data-theme="dark"] .auth-tagline, 
html[data-theme="dark"] .auth-subline { color: rgba(226, 232, 240, 0.78); }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, Segoe UI, sans-serif;
    color: var(--text);
    background: var(--bg-light);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Auth ---------- */
.auth-body {
    min-height: 100vh;
    margin: 0;
    position: relative;
    overflow-x: hidden;
}

.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: linear-gradient(145deg, var(--nav-blue-3) 0%, var(--nav-blue-2) 45%, var(--nav-blue-1) 100%);
}

.auth-bg-video,
.auth-bg-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-bg-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(38, 63, 72, 0.45) 0%, rgba(54, 90, 104, 0.65) 100%);
    z-index: 1;
}

.auth-shell {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem 4.25rem;
    gap: 1.25rem;
}

.auth-card {
    width: min(100%, 420px);
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem 1.6rem 1.6rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.auth-card--split {
    width: min(100%, 920px);
    padding: 0;
    overflow: hidden;
}

.auth-split {
    display: grid;
    grid-template-columns: 1fr 1.05fr;
    min-height: 520px;
}

.auth-split-left {
    position: relative;
    padding: 2.25rem 2.1rem;
    color: rgba(255, 255, 255, 0.96);
    background:
        radial-gradient(900px 520px at 20% 0%, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0) 55%),
        linear-gradient(180deg, var(--nav-blue-1) 0%, var(--nav-blue-2) 55%, var(--nav-blue-3) 100%);
}

.auth-split-left::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(520px 420px at 70% 30%, rgba(80, 192, 208, 0.22) 0%, rgba(80, 192, 208, 0) 55%),
        radial-gradient(380px 280px at 15% 85%, rgba(240, 160, 0, 0.12) 0%, rgba(240, 160, 0, 0) 60%);
    pointer-events: none;
}

.auth-split-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.4rem;
    padding: 0.65rem 0.85rem;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    width: fit-content;
    max-width: 100%;
}

.auth-split-brand img {
    max-width: 220px;
    width: 100%;
    height: auto;
    display: block;
}

.auth-split-lead {
    position: relative;
    z-index: 1;
    margin: 0.65rem 0 0.35rem;
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    text-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.auth-split-sub {
    position: relative;
    z-index: 1;
    margin: 0 0 1.6rem;
    max-width: 30ch;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.95rem;
    line-height: 1.55;
    text-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.auth-split-desc {
    position: relative;
    z-index: 1;
    margin: -0.9rem 0 1.6rem;
    max-width: 44ch;
    color: rgba(255, 255, 255, 0.94);
    font-size: 0.9rem;
    line-height: 1.55;
    text-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.auth-split-foot {
    position: absolute;
    left: 2.1rem;
    right: 2.1rem;
    bottom: 1.75rem;
    z-index: 1;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.82);
    font-weight: 700;
    font-size: 0.88rem;
}

.auth-split-right {
    padding: 2.05rem 2.1rem 2.1rem;
}

.auth-card--glass {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 8px 40px rgba(0, 30, 70, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.auth-login-logo {
    text-align: center;
    margin: 0 0 0.35rem;
}
.auth-login-logo img {
    max-width: min(100%, 200px);
    height: auto;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.auth-madeby {
    text-align: center;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 10px;
    z-index: 3;
    margin-top: 0;
    pointer-events: none;
}
.auth-madeby img {
    max-width: 130px;
    width: auto;
    height: auto;
    opacity: 0.95;
    filter: brightness(0) invert(1) drop-shadow(0 2px 10px rgba(0, 0, 0, 0.25));
}

@media (max-width: 880px) {
    .auth-card--split {
        width: min(100%, 520px);
    }
    .auth-split {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .auth-split-left {
        display: none;
    }
    .auth-split-foot {
        position: static;
        left: auto;
        right: auto;
        bottom: auto;
        margin-top: 1rem;
    }
    .auth-split-right {
        padding: 1.5rem 1.4rem 1.6rem;
    }
}

.auth-brand { margin: 0 0 0.75rem; text-align: center; }
.auth-brand img { max-width: min(100%, 260px); height: auto; display: block; margin: 0 auto; object-fit: contain; }
.auth-tagline { margin: 0 0 0.25rem; color: var(--text); font-size: 0.95rem; font-weight: 600; text-align: center; letter-spacing: -0.02em; }
.auth-subline { margin: 0 0 1.15rem; color: var(--text-muted); font-size: 0.82rem; text-align: center; line-height: 1.4; }
.auth-card h1 { margin: 0 0 .5rem; color: var(--primary); font-size: 1.35rem; font-weight: 700; }
.auth-card p { margin: 0 0 1rem; color: var(--text-muted); font-size: .9rem; }
.auth-card label { display: block; margin: .6rem 0 .3rem; font-weight: 600; font-size: .85rem; }
.auth-card input {
    width: 100%;
    border: 1px solid #cad5df;
    border-radius: 10px;
    padding: .7rem .85rem;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.auth-card input:focus {
    border-color: var(--hover);
    box-shadow: 0 0 0 3px rgba(34, 195, 255, 0.18);
}

/* Botones (global) — alineados al estilo del sidebar */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1rem;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: transform .14s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
    white-space: nowrap;
    user-select: none;
}

.btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.btn[disabled],
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-primary,
.btn.btn-primary {
    color: #fff;
    background: linear-gradient(180deg, var(--btn-blue-1) 0%, var(--btn-blue-2) 100%);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 26px rgba(29, 78, 216, 0.25);
}

.btn-primary:hover,
.btn.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(29, 78, 216, 0.32);
}

.btn-secondary,
.btn.btn-secondary {
    background: rgba(255, 255, 255, 0.92);
    color: var(--primary);
    border-color: rgba(148, 163, 184, 0.45);
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.06);
}

.btn-secondary:hover,
.btn.btn-secondary:hover {
    transform: translateY(-1px);
    border-color: rgba(29, 78, 216, 0.25);
    box-shadow: 0 12px 26px rgba(2, 6, 23, 0.08);
}

.btn-danger,
.btn.btn-danger {
    background: rgba(254, 242, 242, 0.96);
    color: #b91c1c;
    border-color: rgba(248, 113, 113, 0.45);
}

.btn-danger:hover,
.btn.btn-danger:hover {
    transform: translateY(-1px);
    background: rgba(254, 226, 226, 0.98);
    border-color: rgba(248, 113, 113, 0.65);
}

.link-muted { display: inline-block; margin-top: 1rem; color: var(--primary); text-decoration: none; font-weight: 500; font-size: .9rem; }

.auth-form { margin-top: 0.25rem; }

/* Login (estilo como captura) */
.auth-card--glass {
    border-radius: 18px;
    padding: 1.6rem 1.7rem 1.65rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.auth-input {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 1px solid rgba(203, 213, 225, 0.85);
    background: rgba(255, 255, 255, 0.78);
    border-radius: 12px;
    padding: 0.55rem 0.65rem;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.auth-input:focus-within {
    border-color: rgba(29, 78, 216, 0.35);
    box-shadow: 0 0 0 4px var(--accent-soft);
    background: rgba(255, 255, 255, 0.88);
}

.auth-input-ico {
    width: 18px;
    height: 18px;
    color: rgba(71, 85, 105, 0.9);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}
.auth-input-ico svg { width: 18px; height: 18px; }

.auth-input input {
    border: 0 !important;
    outline: none !important;
    padding: 0.2rem 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    margin: 0 !important;
}

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.8rem;
    font-size: 0.82rem;
}

/* Toggle modo noche en login */
.auth-check--theme {
    margin-left: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}
.auth-theme-ico {
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    color: rgba(226, 232, 240, 0.9);
}
.auth-check--theme [data-ico="moon"] { display: none; }
html[data-theme="dark"] .auth-check--theme [data-ico="sun"] { display: none; }
html[data-theme="dark"] .auth-check--theme [data-ico="moon"] { display: inline-grid; }

/* Toggle tema en menú usuario */
.topbar-theme-toggle {
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.topbar-theme-ico {
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    color: var(--primary);
}
html[data-theme="dark"] .topbar-theme-ico { color: rgba(226, 232, 240, 0.9); }

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #475569;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}
.auth-check input { width: 16px; height: 16px; accent-color: var(--btn-blue-2); }

.auth-link {
    color: var(--btn-blue-2);
    text-decoration: none;
    font-weight: 700;
}
.auth-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.auth-submit {
    width: 100%;
    margin-top: 1rem;
    padding: 0.78rem 1rem;
    border-radius: 12px;
}

.auth-field-group {
    margin-bottom: 0.15rem;
}

.auth-card .auth-form label {
    margin-top: 0.85rem;
}

.auth-card .auth-form label:first-of-type {
    margin-top: 0.35rem;
}

.auth-terms {
    margin: 1rem 0 0;
    padding: 0.75rem 0.85rem;
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.auth-terms summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary);
    list-style-position: outside;
}

.auth-terms[open] summary {
    margin-bottom: 0.5rem;
}

.auth-terms-dialog {
    border: none;
    border-radius: 14px;
    padding: 0;
    max-width: min(96vw, 520px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

.auth-terms-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
}

.auth-terms-dialog-inner {
    padding: 1.25rem 1.35rem;
    max-height: min(75vh, 520px);
    overflow-y: auto;
}

.auth-terms-dialog-inner h2 {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
    color: var(--primary);
}

.auth-terms-dialog-inner p {
    margin: 0 0 0.65rem;
    font-size: 0.88rem;
    color: #475569;
    line-height: 1.5;
}

.auth-terms-close {
    margin-top: 1rem;
}

.input-readonly {
    background: #f1f5f9 !important;
    color: #64748b !important;
    cursor: not-allowed;
}

.account-panel { margin-top: 1rem; }
.account-hint { margin: 0 0 1rem; font-size: 0.88rem; color: var(--text-muted); line-height: 1.45; }
.account-form { max-width: 640px; }

.manual-page { margin-top: 1rem; }
.manual-lead { font-size: 0.92rem; color: var(--text-muted); line-height: 1.5; margin: 0 0 1rem; }
.manual-list { margin: 0; padding-left: 1.2rem; line-height: 1.6; color: var(--text); }
.manual-foot { margin: 1.25rem 0 0; font-size: 0.85rem; color: var(--text-muted); }

.flash {
    border-radius: 10px;
    padding: .65rem .9rem;
    margin: .75rem 0;
    font-size: .88rem;
}
.flash.error { background: #fff0f0; color: #9b2c2c; border: 1px solid #f5c2c2; }
.flash.success { background: #ecfdf3; color: #166534; border: 1px solid #bbf7d0; }

/* ---------- Layout ---------- */
.layout { min-height: 100vh; display: flex; }

.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    min-height: 100vh;
    max-height: 100vh;
    /* Fondo azul grisáceo (similar a la referencia) */
    background:
        radial-gradient(900px 520px at 20% 0%, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 55%),
        linear-gradient(180deg, var(--nav-blue-1) 0%, var(--nav-blue-2) 55%, var(--nav-blue-3) 100%);
    color: rgba(226, 232, 240, 0.95);
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.9rem 0.75rem 0.9rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    z-index: 100;
    border-right: 1px solid rgba(148, 163, 184, 0.10);
    overflow: hidden;
    transition: width 280ms cubic-bezier(0.22, 1, 0.36, 1),
        padding 280ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.menu--main {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.55) transparent;
    padding-bottom: 0.35rem;
}
.menu--main::-webkit-scrollbar { width: 7px; }
.menu--main::-webkit-scrollbar-track { background: transparent; }
.menu--main::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.55);
    border-radius: 999px;
}
.menu--footer {
    flex-shrink: 0;
    margin-top: 0.5rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    gap: 4px;
}
.menu--footer .menu-link {
    border-radius: 12px;
}
.menu--footer .menu-link.active {
    background: rgba(34, 195, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(34, 195, 255, 0.22);
}

/* Logo: placa clara para que el teal/cian/naranja no se pierdan en el sidebar oscuro */
.brand {
    display: block;
    padding: 0.55rem 0.7rem;
    margin: 0 0 0.65rem;
    border-bottom: none;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.08);
    text-decoration: none;
    transition: opacity .2s, box-shadow .2s;
}
.brand:hover { opacity: 0.96; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22); }
.brand-img--full {
    display: block;
    width: 100%;
    height: auto;
    max-height: 64px;
    object-fit: contain;
    object-position: left center;
}
.brand-img--min {
    display: none;
    width: 48px;
    height: 48px;
    margin: 0 auto;
    object-fit: contain;
    object-position: center;
}
.sidebar.is-collapsed .brand {
    padding: 0.45rem;
}
.sidebar.is-collapsed .brand-img--full {
    display: none;
}
.sidebar.is-collapsed .brand-img--min {
    display: block;
}

.sidebar-top {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
}

.sidebar-collapse-btn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(226, 232, 240, 0.9);
    cursor: pointer;
    display: grid;
    place-items: center;
    margin-top: 2px;
    transition: background .18s, border-color .18s, transform .18s;
}
.sidebar-collapse-btn--inline {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    margin-top: 0;
}
.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(34, 195, 255, 0.30);
    transform: translateY(-1px);
}

.sidebar-tenant {
    margin: 0 0 0.35rem;
    padding: 0 0.15rem;
    min-height: 0;
}

.sidebar-tenant-name {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0.02em;
    color: rgba(226, 232, 240, 0.95);
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.sidebar.is-collapsed .sidebar-tenant {
    display: none;
}

.sidebar-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 0.75rem;
    padding: 0.55rem 0.65rem;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(255, 255, 255, 0.04);
}
.sidebar-search-ico {
    color: rgba(226, 232, 240, 0.72);
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
}
.sidebar-search input {
    border: 0;
    outline: none;
    background: transparent;
    color: rgba(226, 232, 240, 0.92);
    font: inherit;
    width: 100%;
    min-width: 0;
}
.sidebar-search input::placeholder {
    color: rgba(226, 232, 240, 0.55);
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 1px 1rem;
}

.menu-group {
    margin: 0;
    padding: 0;
    border: 0;
}

.menu-group > summary {
    list-style: none;
    cursor: pointer;
}

.menu-group > summary::-webkit-details-marker {
    display: none;
}

.menu-link--group .menu-chev {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    color: rgba(226, 232, 240, 0.72);
    transition: transform .18s ease, color .18s ease;
}

.menu-group[open] > summary .menu-chev {
    transform: rotate(90deg);
    color: rgba(226, 232, 240, 0.92);
}

.menu-sub {
    margin: 4px 0 6px;
    padding-left: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-left: 1px solid rgba(148, 163, 184, 0.14);
}

.menu-sublink {
    padding: 0.55rem 0.65rem;
    border-radius: 12px;
    font-size: 0.88rem;
}

.menu-ico--sub {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.menu-link {
    color: rgba(226, 232, 240, 0.86);
    text-decoration: none;
    padding: 0.65rem 0.75rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
    transition: background .22s ease, color .2s, transform .18s ease;
    border: 1px solid rgba(148, 163, 184, 0.0);
}

.menu-link::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: var(--accent);
    opacity: 0;
    transform: scaleY(0.6);
    transition: opacity .2s, transform .22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.menu-ico {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.10);
    color: rgba(226, 232, 240, 0.92);
    transition: background .2s, border-color .2s, transform .18s;
}
.menu-ico .nav-ico {
    width: 20px;
    height: 20px;
    opacity: 0.95;
}

.menu-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(226, 232, 240, 0.98);
    transform: translateX(2px);
    border-color: rgba(148, 163, 184, 0.14);
}

.menu-link.active {
    background: rgba(34, 195, 255, 0.10);
    color: rgba(226, 232, 240, 0.98);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(34, 195, 255, 0.16);
    transform: translateX(0);
    border-color: rgba(34, 195, 255, 0.20);
}

.menu-link.active::before {
    opacity: 1;
    transform: scaleY(1);
}

.menu-label { flex: 1; }

.logout {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    margin: 0.5rem 0.4rem 0;
    padding: 0.6rem 0.75rem;
    font-size: 0.88rem;
    border-radius: 8px;
    transition: background .2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
    width: 100%;
    text-align: left;
    box-sizing: border-box;
}
.logout:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.logout-ico {
    display: none;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.88);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    place-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.12);
}
.logout-ico .nav-ico {
    width: 20px;
    height: 20px;
}
.sidebar.is-collapsed .logout {
    justify-content: center;
    padding: 0.55rem;
    margin-left: 0.25rem;
    margin-right: 0.25rem;
}
.sidebar.is-collapsed .logout-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.sidebar.is-collapsed .logout-ico {
    display: grid;
}

/* Modal confirmar cierre de sesión (viewport; hijo de sidebar) */
.orbis-modal[hidden] {
    display: none !important;
}
.orbis-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}
.orbis-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    cursor: pointer;
}
.orbis-modal__box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 14px;
    padding: 1.35rem 1.5rem;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.18);
    border: 1px solid var(--line);
}
.orbis-modal__title {
    margin: 0 0 0.45rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}
.orbis-modal__text {
    margin: 0 0 1.2rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #334155;
}
.orbis-modal__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.6rem;
}

/* Hub de configuración (cuadrícula de tarjetas) */
.config-hub {
    width: 100%;
    max-width: none;
}
.config-hub__lede {
    margin: 0 0 1.15rem;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.5;
}
.config-tile-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    /* Misma anchura de columna en todo el ancho del contenido */
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    width: 100%;
}
.config-tile-grid > li {
    display: flex;
    min-width: 0;
    min-height: 0;
}
.config-tile,
.config-tile--soon {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.05rem 1.1rem;
    width: 100%;
    min-height: 0;
    /* Misma altura y anchura en todas las tarjetas */
    height: 12.5rem;
    max-height: 12.5rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 16px rgba(0, 23, 59, 0.06);
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
    box-sizing: border-box;
    overflow: hidden;
}
a.config-tile:hover {
    border-color: color-mix(in srgb, var(--primary) 32%, var(--line));
    box-shadow: 0 8px 24px rgba(0, 46, 107, 0.1);
    transform: translateY(-1px);
}
.config-tile--soon {
    cursor: default;
    opacity: 0.9;
    background: #f8fafc;
}
.config-tile__icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(0, 46, 107, 0.07);
    color: var(--primary);
}
.config-tile__icon .nav-ico {
    width: 20px;
    height: 20px;
    opacity: 0.9;
}
.config-tile__text {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.config-tile__title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-weight: 600;
    color: #0f172a;
    font-size: 0.92rem;
    line-height: 1.3;
    margin-bottom: 0.25rem;
}
.config-tile__badge {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.45rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    background: #e2e8f0;
    border-radius: 6px;
    vertical-align: 0.1em;
}
.config-tile__desc {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.4;
    margin-top: 0.1rem;
}

/* ===== Settings: módulos master-detail (Catálogos / Diseños / Recetas) ===== */
.settings-split {
    display: grid;
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.settings-side {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 16px;
    box-shadow: 0 14px 44px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    min-height: 520px;
    display: flex;
    flex-direction: column;
}
.settings-side__top { padding: 0.9rem 1rem 0.25rem; }
.settings-side__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem 0.6rem;
}
.settings-side__actions { display: inline-flex; gap: 0.5rem; align-items: center; }
.settings-side__title { font-weight: 800; color: var(--primary); font-size: 0.92rem; }
.settings-side__search { padding: 0 1rem 0.75rem; }
.settings-search {
    width: 100%;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(203, 213, 225, 0.85);
    background: #f8fafc;
    padding: 0.55rem 0.85rem;
    outline: none;
}
.settings-search:focus { border-color: var(--hover); box-shadow: 0 0 0 3px rgba(143, 211, 227, 0.22); }
.settings-list { padding: 0.1rem 0.65rem 0.75rem; overflow: auto; }
.settings-empty { padding: 1rem; color: var(--text-muted); font-size: 0.9rem; }
.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.72rem 0.8rem;
    border-radius: 14px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid transparent;
    background: rgba(248, 250, 252, 0.72);
    margin: 0.45rem 0;
    transition: background .18s, border-color .18s, transform .16s;
}
.settings-item:hover { background: rgba(143, 211, 227, 0.14); border-color: rgba(143, 211, 227, 0.30); transform: translateY(-1px); }
.settings-item.is-active { background: rgba(54, 90, 104, 0.10); border-color: rgba(54, 90, 104, 0.22); }
.settings-item__name { font-weight: 700; font-size: 0.9rem; }
.settings-item__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.55);
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.14);
    flex-shrink: 0;
}
.settings-item__dot.ok {
    background: rgba(34, 197, 94, 0.72);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.settings-main { padding: 1.1rem 1.1rem 1.2rem; min-height: 520px; }
.settings-main__head { margin-bottom: 0.75rem; }
.settings-main__head--row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.settings-h3 { margin: 0; color: var(--primary); font-size: 1.05rem; }
.settings-form input,
.settings-form select {
    width: 100%;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(203, 213, 225, 0.85);
    padding: 0.55rem 0.85rem;
    background: #fff;
    font: inherit;
    outline: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.settings-form input:focus,
.settings-form select:focus {
    border-color: var(--hover);
    box-shadow: 0 0 0 3px rgba(143, 211, 227, 0.22);
}
.settings-form select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(15, 23, 42, 0.55) 50%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.55) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 2.1rem;
}
.settings-form label {
    font-weight: 700;
    font-size: 0.85rem;
    color: rgba(15, 23, 42, 0.82);
}
.settings-form textarea { width: 100%; border: 1px solid rgba(203, 213, 225, 0.85); border-radius: 12px; padding: 0.65rem 0.85rem; font: inherit; background: #fff; }
.settings-form textarea:focus { outline: none; border-color: var(--hover); box-shadow: 0 0 0 3px rgba(143, 211, 227, 0.22); }
.settings-select { height: 42px; border-radius: 12px; border: 1px solid rgba(203, 213, 225, 0.85); padding: 0.55rem 0.85rem; background: #fff; font: inherit; }
.settings-select--sm { height: 38px; padding: 0.45rem 0.65rem; border-radius: 10px; }
.settings-row { display: flex; gap: 0.6rem; align-items: center; }
.settings-field { display: grid; gap: 0.35rem; }
.settings-label { font-weight: 700; color: var(--primary); font-size: 0.82rem; }
.settings-col-2 { grid-column: span 2; }
.settings-col-3 { grid-column: span 3; }
.settings-col-4 { grid-column: span 4; }

.settings-actions { margin-top: 0.9rem; display: flex; gap: 0.6rem; }
.settings-actions--right { justify-content: flex-end; }
.settings-actions--center { justify-content: center; }

.settings-switch { display: inline-flex; align-items: center; gap: 0.55rem; user-select: none; }
.settings-switch__label { font-weight: 700; font-size: 0.85rem; color: var(--text-muted); }
.settings-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.settings-switch__ui {
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.40);
    position: relative;
    transition: background .18s, border-color .18s;
}
.settings-switch__ui::after {
    content: "";
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 50%;
    left: 3px;
    transform: translateY(-50%);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.15);
    transition: left .18s;
}
.settings-switch input:checked + .settings-switch__ui {
    background: rgba(54, 90, 104, 0.78);
    border-color: rgba(54, 90, 104, 0.55);
}
.settings-switch input:checked + .settings-switch__ui::after { left: 23px; }

.settings-preview { margin: 0.9rem 0 0.95rem; }
.settings-preview__title { font-weight: 800; color: var(--primary); margin-bottom: 0.45rem; }
.settings-preview__box {
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 14px;
    padding: 0.9rem;
}
.design-preview { border-radius: 12px; overflow: hidden; border: 1px solid rgba(226, 232, 240, 0.92); background: #fff; }
.design-preview__bar { height: 12px; }
.design-preview__line { height: 10px; }
.design-preview__body { padding: 0.9rem; display: grid; grid-template-columns: 80px 1fr; gap: 0.8rem; align-items: center; }
.design-preview__logo { width: 80px; height: 56px; border-radius: 10px; border: 1px dashed rgba(148, 163, 184, 0.55); display: grid; place-items: center; color: var(--text-muted); font-weight: 700; overflow: hidden; }
.design-preview__logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.design-preview__text .muted { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.15rem; }

.settings-block { margin-top: 0.9rem; padding-top: 0.85rem; border-top: 1px solid rgba(226, 232, 240, 0.92); }
.settings-block__title { font-weight: 800; color: var(--primary); margin: 0 0 0.55rem; }

.settings-dialog::backdrop { background: rgba(15, 23, 42, 0.42); backdrop-filter: blur(2px); }
.settings-dialog { border: 0; padding: 0; background: transparent; }
.settings-dialog__box {
    width: min(92vw, 460px);
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
    padding: 1.1rem 1.1rem 1.15rem;
}
.settings-dialog__box h3 { margin: 0 0 0.75rem; color: var(--primary); }
.settings-dialog__box label { display: block; margin: 0.7rem 0 0.3rem; font-weight: 700; font-size: 0.85rem; }
.settings-dialog__box input { width: 100%; }
.settings-dialog__actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }

/* Recetas: items */
.rx-items { display: grid; gap: 0.75rem; }
.rx-item {
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 16px;
    padding: 0.95rem;
    background:
        radial-gradient(520px 120px at 12% 0%, rgba(143, 211, 227, 0.18) 0%, rgba(143, 211, 227, 0) 55%),
        rgba(255, 255, 255, 0.92);
    box-shadow:
        0 18px 44px rgba(15, 23, 42, 0.10),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.rx-item__top { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.rx-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; margin-top: 0.55rem; }
.rx-remove { border: 1px solid rgba(148, 163, 184, 0.25); background: rgba(255, 255, 255, 0.75); }
.rx-remove[disabled] { opacity: 0.5; cursor: not-allowed; }
.rx-item input,
.rx-item select,
.rx-item textarea {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(203, 213, 225, 0.88);
}
.rx-item textarea { min-height: 74px; }

@media (max-width: 1080px) {
    .settings-split { grid-template-columns: 1fr; }
    .settings-side { min-height: auto; }
    .settings-main { min-height: auto; }
}
@media (max-width: 640px) {
    .rx-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1200px) {
    .config-tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .config-tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
    .config-tile-grid { grid-template-columns: 1fr; }
    .config-tile,
    .config-tile--soon { height: auto; min-height: 11.5rem; max-height: none; }
}
.config-clinic-form h3 { margin-top: 0; }
p.module-back {
    margin: 0 0 0.9rem;
}

/* ---------- Usuarios (Configuración > Usuarios) ---------- */
.users-page {
    width: 100%;
}

.users-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0.85rem;
}

.users-bc-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
}
.users-bc-link:hover { color: var(--primary); }
.users-bc-sep { opacity: 0.6; }
.users-bc-cur { color: var(--primary); font-weight: 700; }

.users-layout {
    display: grid;
    grid-template-columns: minmax(420px, 0.98fr) minmax(0, 1.02fr);
    gap: 1.25rem;
    align-items: start;
}

.users-left-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.users-left-title,
.users-right-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.users-left-sub,
.users-right-sub {
    margin: 0.2rem 0 0;
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.users-search {
    position: relative;
    margin: 0.35rem 0 0.75rem;
}

.users-search input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.65rem 2.3rem 0.65rem 0.85rem;
    font: inherit;
    background: #fff;
}

.users-search-ico {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.55;
    pointer-events: none;
}

.users-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-height: min(74vh, 720px);
    overflow: auto;
    overflow-x: hidden;
}

.users-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.6rem;
    align-items: center;
}

.users-item-btn {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.82);
    border-radius: 16px;
    padding: 0.7rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    text-align: left;
    box-shadow: 0 14px 30px rgba(2, 6, 23, 0.05);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.users-toggle { flex-shrink: 0; }
.users-toggle .btn { white-space: nowrap; min-width: 96px; }

.users-right.is-hidden { display: none; }

.users-item-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(34, 195, 255, 0.28);
    box-shadow: 0 18px 44px rgba(2, 6, 23, 0.07);
}

.users-item-btn.is-selected {
    border-color: rgba(109, 40, 217, 0.45);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.12);
}

.users-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 900;
    color: var(--primary);
    background: radial-gradient(120px 70px at 30% 0%, rgba(34,195,255,0.22) 0%, rgba(34,195,255,0) 60%), #eef6ff;
    border: 1px solid rgba(34, 195, 255, 0.22);
    flex-shrink: 0;
    overflow: hidden;
}

.users-item-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.users-item-email {
    font-size: 0.86rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.users-item-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.users-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: #94a3b8;
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.12);
}
.users-dot.is-on { background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18); }
.users-dot.is-off { background: #94a3b8; }

.users-toggle { display: flex; justify-content: flex-end; }
.users-left-foot { margin-top: 0.75rem; font-size: 0.85rem; color: var(--text-muted); }

.users-right-head { margin-bottom: 0.65rem; }
.users-form.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.users-actions { display: flex; gap: 0.6rem; justify-content: flex-end; flex-wrap: wrap; }

@media (max-width: 1080px) {
    .users-layout { grid-template-columns: 1fr; }
    .users-list { max-height: none; }
}

@media (max-width: 560px) {
    .users-form.form-grid { grid-template-columns: 1fr; }
    .users-actions { justify-content: stretch; }
    .users-actions .btn { width: 100%; }
}

html[data-theme="dark"] .users-item-btn {
    background: rgba(15, 23, 42, 0.35);
    border-color: rgba(148, 163, 184, 0.16);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}
html[data-theme="dark"] .users-item-email { color: rgba(226, 232, 240, 0.92); }
html[data-theme="dark"] .users-avatar {
    background: radial-gradient(120px 70px at 30% 0%, rgba(34,195,255,0.18) 0%, rgba(34,195,255,0) 60%), rgba(2, 6, 23, 0.35);
    border-color: rgba(34, 195, 255, 0.18);
    color: rgba(226, 232, 240, 0.92);
}

/* Reportes: pestañas y exportación */
.reports-page { max-width: 1160px; }
.reports-page__head { margin-bottom: 1.1rem; }
.reports-page__title {
    margin: 0 0 0.4rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}
.reports-page__subtitle {
    margin: 0;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.5;
}
.reports-kpi--inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.2rem;
    padding: 0.85rem 1rem;
    background: #f1f5f9;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 1.2rem;
}
.reports-kpi__item { display: flex; flex-direction: column; gap: 0.15rem; }
.reports-kpi__label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; font-weight: 600; }
.reports-kpi__val { font-size: 1.05rem; font-weight: 700; color: #0f172a; }
.reports-layout {
    display: grid;
    grid-template-columns: minmax(200px, 250px) 1fr;
    gap: 1.25rem;
    align-items: start;
}
.reports-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0.4rem 0.45rem 0.6rem 0;
    position: sticky;
    top: 4.5rem;
}
.reports-tab {
    display: block;
    text-decoration: none;
    color: #334155;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    border: 1px solid transparent;
    background: #f1f5f9;
    transition: background 0.18s, border-color 0.18s;
}
.reports-tab:hover {
    background: #e2e8f0;
}
.reports-tab.is-active {
    background: #fff;
    border-color: var(--line);
    box-shadow: 0 4px 12px rgba(0, 46, 107, 0.08);
    color: var(--primary);
    font-weight: 600;
}
.reports-tab__label { display: block; font-size: 0.88rem; }
.reports-tab__hint { display: block; font-size: 0.72rem; color: #64748b; margin-top: 0.2rem; line-height: 1.3; }
.reports-tab.is-active .reports-tab__hint { color: #475569; }
.reports-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.1rem 1.15rem 1.25rem;
    box-shadow: 0 4px 20px rgba(0, 23, 59, 0.05);
}
.reports-panel__title {
    margin: 0 0 0.4rem;
    font-size: 1.1rem;
    color: #0f172a;
    font-weight: 700;
}
.reports-panel__lede { margin: 0 0 1rem; color: #64748b; font-size: 0.9rem; }
.report-export-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.9rem;
}
.report-export-card {
    display: flex;
    flex-direction: column;
    min-height: 9rem;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.95rem 1rem;
}
.report-export-card__title {
    margin: 0 0 0.45rem;
    font-size: 0.95rem;
    color: #0f172a;
    font-weight: 600;
}
.report-export-card__text {
    margin: 0;
    flex: 1;
    font-size: 0.84rem;
    color: #64748b;
    line-height: 1.45;
}
.report-export-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.9rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--line);
}
.report-export-card__fmt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; font-weight: 600; }

/* Modo colapsado (solo iconos), como el ejemplo */
.sidebar.is-collapsed {
    width: 86px;
    padding-left: 0.6rem;
    padding-right: 0.6rem;
}
.sidebar.is-collapsed .sidebar-search {
    padding: 0.55rem;
}
.sidebar.is-collapsed .sidebar-search input,
.sidebar.is-collapsed .menu-label {
    display: none;
}
.sidebar.is-collapsed .menu-chev,
.sidebar.is-collapsed .menu-sub {
    display: none;
}
.sidebar.is-collapsed .menu-link {
    justify-content: center;
    gap: 0;
    padding: 0.55rem;
}
.sidebar.is-collapsed .menu-ico {
    width: 42px;
    height: 42px;
}
.sidebar.is-collapsed + .main,
.sidebar.is-collapsed ~ .main {
    margin-left: 86px;
    width: calc(100% - 86px);
}

.main {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    padding: 0 1.25rem 2rem;
    min-height: 100vh;
    transition: margin-left 280ms cubic-bezier(0.22, 1, 0.36, 1),
        width 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.topbar {
    min-height: 58px;
    /* Solo apariencia: topbar más “premium” como referencia */
    background: linear-gradient(180deg, #eef3fb 0%, #ffffff 100%);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 1200;
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    width: calc(100% + 2.5rem);
    max-width: none;
    box-sizing: border-box;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.topbar--full .topbar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    flex-wrap: wrap;
}

.topbar-title {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    flex: 1;
    min-width: 120px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.topbar-pill {
    white-space: nowrap;
}

.topbar-pill--ico {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.topbar-pill--ico .nav-ico {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
}

.topbar-dropdown-wrap {
    position: relative;
}

.topbar-icon-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #f8fafc;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    transition: border-color 0.2s, background 0.2s;
}

.topbar-icon-btn:hover {
    border-color: var(--accent);
    background: #fff;
}

.topbar-bell-ico { line-height: 1; }

.topbar-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    line-height: 1;
}

.topbar-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    max-width: min(96vw, 280px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 46, 107, 0.12);
    padding: 0.35rem 0;
    z-index: 5000;
}

/* Asegura que el panel de notificaciones no quede "debajo" de calendarios con sticky/overflow */
#notifDropdownWrap {
    z-index: 6000;
}

.topbar-dropdown--wide {
    min-width: min(96vw, 340px);
    max-width: min(96vw, 380px);
    padding: 0;
    overflow: hidden;
}

.topbar-dropdown-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
    font-size: 0.88rem;
}

.btn-link {
    border: 0;
    background: none;
    color: var(--primary);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 0;
}

.btn-link:hover { color: var(--hover); }

.topbar-notif-list {
    max-height: min(60vh, 360px);
    overflow-y: auto;
    padding: 0.35rem 0;
}

.topbar-notif-empty {
    margin: 0;
    padding: 1rem 0.85rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.topbar-notif-item {
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.15s;
}

.topbar-notif-item:last-child { border-bottom: 0; }
.topbar-notif-item:hover { background: #f8fbff; }
.topbar-notif-item.is-unread {
    background: #eff6ff;
    border-left: 3px solid var(--accent);
    padding-left: calc(0.85rem - 3px);
}

.topbar-notif-item strong {
    display: block;
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 0.2rem;
}

.topbar-notif-when {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.topbar-notif-body {
    font-size: 0.8rem;
    color: #475569;
    line-height: 1.35;
}

.topbar-user-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem 0.35rem 0.35rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    font: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    max-width: min(100%, 260px);
}

.topbar-user-trigger:hover {
    border-color: #c5d4e3;
    box-shadow: 0 2px 10px rgba(0, 46, 107, 0.06);
}

.topbar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    overflow: hidden;
}

.orbis-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.topbar-user-trigger-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    text-align: left;
}

.topbar-user-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: lowercase;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-caret {
    color: var(--text-muted);
    font-size: 0.65rem;
    margin-left: 0.15rem;
    flex-shrink: 0;
}

.topbar-dropdown-item {
    display: block;
    padding: 0.55rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.15s;
}

.topbar-dropdown-item:hover {
    background: #f0f7ff;
    color: var(--primary);
}

.menu-toggle {
    display: none;
    border: 0;
    background: var(--bg-light);
    font-size: 1.25rem;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--primary);
}

/* ---------- Toolbar & buttons ---------- */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.toolbar-search {
    display: flex;
    flex: 1;
    min-width: 200px;
    gap: 0.5rem;
    align-items: stretch;
}

.toolbar-search input[type="search"],
.toolbar-search input[type="text"] {
    flex: 1;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.55rem 0.85rem;
    font: inherit;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: border-color .2s, box-shadow .2s;
}
.toolbar-search input:focus {
    outline: none;
    border-color: var(--hover);
    box-shadow: 0 0 0 3px rgba(34, 195, 255, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: transform .15s, box-shadow .2s, background .2s, border-color .2s;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(180deg, var(--btn-blue-1) 0%, var(--btn-blue-2) 100%);
    color: #fff;
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 10px rgba(43, 74, 85, 0.22);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(43, 74, 85, 0.28);
}

.btn-secondary {
    background: #fff;
    color: var(--primary);
    border-color: #c5d4e3;
}
.btn-secondary:hover {
    border-color: var(--hover);
    background: #f8fbff;
}

.btn-ghost {
    background: transparent;
    color: var(--primary);
    border-color: transparent;
    text-decoration: underline;
    text-underline-offset: 3px;
    box-shadow: none;
}
.btn-ghost:hover { color: var(--hover); }

.btn-danger {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}
.btn-danger:hover { background: #fee2e2; border-color: #f87171; color: #991b1b; }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.82rem; border-radius: 8px; }

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    color: var(--text-muted);
    transition: border-color .2s, color .2s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--primary); }

.inline-form { display: inline; margin: 0; padding: 0; }

/* ---------- Panels ---------- */
.panel-elevated {
    background: var(--panel-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow);
}

.panel-grid.panel-elevated { margin-top: 0.85rem; }

.panel-grid.panel-elevated:first-of-type { margin-top: 1rem; }

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.panel-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.panel-meta { font-size: 0.8rem; color: var(--text-muted); }

.panel-tools { display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; }

/* KPI */
.kpi-row {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
}

.kpi {
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    padding: 0.95rem 1rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    box-shadow: 0 14px 34px rgba(2, 6, 23, 0.16);
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    transition: transform 0.22s cubic-bezier(.2,.9,.2,1), box-shadow 0.22s ease, filter 0.22s ease;
}

.kpi-ico {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.kpi-ico svg { width: 22px; height: 22px; color: inherit; }

.kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    position: relative;
    z-index: 2;
}

.kpi-meta {
    position: relative;
    z-index: 2;
    min-width: 0;
}

.kpi-label {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.86);
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.2;
}

.kpi-value {
    font-size: 1.7rem;
    font-weight: 850;
    color: #fff;
    margin-top: 0.12rem;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1.05;
}

.kpi-sub {
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.25;
}

.kpi-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Sparkline decorativa (onda) */
.kpi::after {
    content: "";
    position: absolute;
    left: -10%;
    right: -10%;
    bottom: -18px;
    height: 62px;
    opacity: 0.38;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center bottom;
    pointer-events: none;
    filter: drop-shadow(0 10px 18px rgba(0,0,0,0.18));
}

.kpi::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(520px 140px at 20% 0%, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 55%);
    pointer-events: none;
    opacity: 0.9;
}

.kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 48px rgba(2, 6, 23, 0.20);
}

.kpi-blue { background: linear-gradient(135deg, var(--dash-b2) 0%, var(--dash-b5) 100%); }
.kpi-blue .kpi-ico { background: rgba(255, 255, 255, 0.18); color: #fff; }
.kpi-blue::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 120'%3E%3Cpath d='M0 78 C 60 22, 120 110, 180 64 S 300 18, 360 70 S 480 118, 600 44' fill='none' stroke='rgba(255,255,255,0.95)' stroke-width='6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.kpi-slate { background: linear-gradient(135deg, var(--nav-blue-1) 0%, var(--dash-b4) 60%, var(--dash-b5) 140%); }
.kpi-slate .kpi-ico { background: rgba(255, 255, 255, 0.18); color: #fff; }
.kpi-slate::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 120'%3E%3Cpath d='M0 84 C 80 38, 140 98, 220 52 S 360 14, 430 66 S 520 112, 600 58' fill='none' stroke='rgba(255,255,255,0.92)' stroke-width='6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.kpi-cyan { background: linear-gradient(135deg, var(--dash-b4) 0%, var(--dash-b3) 55%, var(--dash-b5) 140%); }
.kpi-cyan .kpi-ico { background: rgba(255, 255, 255, 0.18); color: #fff; }
.kpi-cyan::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 120'%3E%3Cpath d='M0 86 C 70 40, 130 92, 200 50 S 320 10, 390 60 S 520 112, 600 40' fill='none' stroke='rgba(255,255,255,0.92)' stroke-width='6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.kpi-gray { background: linear-gradient(135deg, var(--nav-blue-2) 0%, var(--dash-b2) 55%, var(--dash-b3) 150%); }
.kpi-gray .kpi-ico { background: rgba(255, 255, 255, 0.18); color: #fff; }
.kpi-gray::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 120'%3E%3Cpath d='M0 88 C 80 44, 160 110, 230 58 S 340 18, 420 70 S 520 118, 600 54' fill='none' stroke='rgba(255,255,255,0.92)' stroke-width='6' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Reveal animation */
.orbis-reveal {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
    transition: transform 0.24s cubic-bezier(.2,.9,.2,1), opacity 0.24s ease;
    transition-delay: var(--reveal-delay, 0ms);
    will-change: transform, opacity;
}

.orbis-reveal.is-in {
    opacity: 1;
    transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
    .orbis-reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    .kpi {
        transition: none !important;
    }
}

.grid-2 {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
}

.grid-2-tall { align-items: stretch; }

.chart-box {
    width: 100%;
    min-height: 180px;
    padding: 0.25rem 0;
}

.chart-box--tall {
    min-height: 260px;
    height: 280px;
}

canvas { max-width: 100%; display: block; }
#chartPatientsLine,
#chartAppointmentsBars {
    width: 100%;
    height: 260px;
}

.dash-stat-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.dash-stat-card {
    background:
        radial-gradient(520px 220px at 15% 0%, rgba(34, 195, 255, 0.10) 0%, rgba(34, 195, 255, 0) 55%),
        #fff;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 16px;
    padding: 0.95rem 1.05rem;
    box-shadow: 0 16px 36px rgba(2, 6, 23, 0.06);
    position: relative;
    overflow: hidden;
    transition: transform 0.22s cubic-bezier(.2,.9,.2,1), box-shadow 0.22s ease, border-color 0.22s ease;
}

.dash-stat-card-head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dash-stat-card-ico {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, 0.06);
    color: var(--primary);
    font-size: 0.95rem;
    flex-shrink: 0;
}

.dash-stat-card-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-stat-card-chip {
    flex: 0 0 auto;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    background: rgba(34, 195, 255, 0.10);
    border: 1px solid rgba(34, 195, 255, 0.18);
    color: #0b2f7a;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: none;
}

.dash-stat-card-value {
    font-size: 1.75rem;
    font-weight: 900;
    color: #0b2f7a;
    margin: 0.55rem 0 0;
    line-height: 1.05;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.dash-stat-card-foot {
    margin: 0.55rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.dash-stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 22px 52px rgba(2, 6, 23, 0.08);
    border-color: rgba(34, 195, 255, 0.28);
}

.dash-stat-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.55;
    background: radial-gradient(520px 160px at 80% 0%, rgba(37, 99, 235, 0.12) 0%, rgba(37, 99, 235, 0) 60%);
}

.dash-stat-card--total .dash-stat-card-ico { background: rgba(29, 78, 216, 0.10); color: #1d4ed8; }
.dash-stat-card--month .dash-stat-card-ico { background: rgba(2, 132, 199, 0.10); color: #0284c7; }
.dash-stat-card--soap .dash-stat-card-ico { background: rgba(14, 165, 233, 0.10); color: #0ea5e9; }
.dash-stat-card--completed .dash-stat-card-ico { background: rgba(37, 99, 235, 0.10); color: #2563eb; }

html[data-theme="dark"] .dash-stat-card {
    background:
        radial-gradient(520px 220px at 15% 0%, rgba(34, 195, 255, 0.08) 0%, rgba(34, 195, 255, 0) 55%),
        rgba(15, 23, 42, 0.35);
    border-color: rgba(148, 163, 184, 0.16);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .dash-stat-card-ico {
    background: rgba(148, 163, 184, 0.12);
    color: rgba(226, 232, 240, 0.92);
}

html[data-theme="dark"] .dash-stat-card-chip {
    background: rgba(34, 195, 255, 0.10);
    border-color: rgba(34, 195, 255, 0.16);
    color: rgba(226, 232, 240, 0.9);
}

html[data-theme="dark"] .dash-stat-card-value {
    color: rgba(226, 232, 240, 0.92);
}

.dash-trend {
    font-weight: 700;
}

.dash-trend--up { color: #16a34a; }
.dash-trend--down { color: #dc2626; }

.dash-chartjs-row {
    grid-template-columns: 1fr 1fr;
}

.dash-analytics-grid {
    margin-top: 1rem;
    grid-template-columns: 1.6fr 1fr;
    align-items: start;
}

.dash-analytics {
    margin-top: 0;
}

.dash-analytics-head {
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.dash-period-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-left: auto;
}

.dash-period-tab {
    border: 1px solid var(--line);
    background: #f8fafc;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
}

.dash-period-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.dash-period-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.dash-analytics-chart-wrap {
    min-height: 300px;
    height: 320px;
    position: relative;
}

#chartTrendBars {
    width: 100%;
    height: 300px;
}

.dash-ranking-title {
    margin: 0 0 0.65rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
}

.dash-ranking {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.85rem 0.9rem;
    background:
        radial-gradient(520px 220px at 15% 0%, rgba(34, 195, 255, 0.10) 0%, rgba(34, 195, 255, 0) 55%),
        var(--panel-bg);
}

.dash-ranking-card .dash-ranking {
    padding: 0.75rem 0.8rem;
}

.dash-ranking-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.dash-ranking-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    padding: 0.55rem 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.68);
    box-shadow: 0 10px 22px rgba(2, 6, 23, 0.06);
}

.dash-ranking-item:last-child { }

.dash-rank-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.08);
    color: #334155;
    font-weight: 800;
    font-size: 0.72rem;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.dash-rank-badge--top {
    background: linear-gradient(135deg, var(--dash-2a) 0%, var(--dash-1b) 100%);
    color: #fff;
}

.dash-rank-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.dash-rank-count {
    font-weight: 800;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.dash-ranking-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.25rem 0;
}

@media (max-width: 1100px) {
    .dash-stat-cards { grid-template-columns: repeat(2, 1fr); }
    .dash-chartjs-row { grid-template-columns: 1fr; }
    .dash-analytics-grid { grid-template-columns: 1fr; }
}

/* Team & map widgets */
.widget-team .team-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.team-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--line);
}
.team-item:last-child { border-bottom: 0; }

.team-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.team-meta { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.team-name { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.team-sub { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.team-empty { color: var(--text-muted); font-size: 0.9rem; padding: 0.5rem 0; }

.map-card { padding: 0.25rem 0; }
.map-visual { border-radius: 10px; overflow: hidden; margin-bottom: 0.75rem; }
.map-svg { width: 100%; height: auto; display: block; }
.map-stats {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.map-stat {
    flex: 1;
    min-width: 72px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    text-align: center;
}
.map-stat-label { display: block; font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.map-stat strong { font-size: 1.15rem; color: var(--primary); }
.map-foot { margin: 0.65rem 0 0; font-size: 0.78rem; color: var(--text-muted); }

/* Demografía */
.dash-demographics-head { flex-wrap: wrap; gap: 0.75rem; }
.dash-demographics-body {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
    gap: 1rem;
    margin-top: 0.75rem;
    align-items: start;
}
.dash-demographics-chart {
    min-height: 240px;
    height: 260px;
    position: relative;
}
#chartDemographics { width: 100%; height: 240px; }

.dash-demographics-kpis {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.75rem 0.8rem;
    background:
        radial-gradient(520px 220px at 15% 0%, rgba(34, 195, 255, 0.08) 0%, rgba(34, 195, 255, 0) 55%),
        var(--panel-bg);
}

.dash-demo-kpi {
    display: grid;
    grid-template-columns: 12px 1fr auto auto;
    gap: 0.55rem;
    align-items: center;
    font-size: 0.82rem;
    padding: 0.5rem 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.68);
    box-shadow: 0 10px 22px rgba(2, 6, 23, 0.05);
}
.dash-demo-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dash-demo-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; color: var(--text); }
.dash-demo-val { font-weight: 850; color: var(--primary); font-variant-numeric: tabular-nums; }
.dash-demo-pct { font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.dash-demographics-foot { margin: 0.75rem 0 0; font-size: 0.78rem; color: var(--text-muted); }

@media (max-width: 1100px) {
    .dash-demographics-body { grid-template-columns: 1fr; }
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.form-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.field-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.field input,
.field select,
.field textarea {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    font: inherit;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--hover);
    box-shadow: 0 0 0 3px rgba(34, 195, 255, 0.12);
}

.field-span-2 { grid-column: span 2; }

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    margin-top: 0.5rem;
}

/* Tables */
.table-wrap { overflow: auto; border-radius: 10px; border: 1px solid var(--line); }

.table-pro {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.table-pro thead th {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: #475569;
    text-align: left;
    padding: 0.75rem 0.8rem;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--line);
}

.table-pro tbody td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid #eef2f6;
    font-size: 0.9rem;
}

.table-pro tbody tr:nth-child(even) { background: #fafbfd; }
.table-pro tbody tr:hover { background: #f0f7ff; }

.table-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 1rem !important;
}

.th-actions { text-align: right; }
.actions-inline { display: flex; align-items: center; justify-content: flex-end; gap: 0.45rem; flex-wrap: wrap; }

/* Controles compactos dentro de tablas/acciones (evita selects “planos”) */
.actions-inline select,
.actions-inline input[type="number"],
.actions-inline input[type="text"] {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.45rem 0.65rem;
    font: inherit;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.actions-inline select:focus,
.actions-inline input[type="number"]:focus,
.actions-inline input[type="text"]:focus {
    outline: none;
    border-color: var(--hover);
    box-shadow: 0 0 0 3px rgba(34, 195, 255, 0.12);
}
.actions-inline select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23647569' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.55rem center;
    background-size: 18px 18px;
}
html[data-theme="dark"] .actions-inline select,
html[data-theme="dark"] .actions-inline input[type="number"],
html[data-theme="dark"] .actions-inline input[type="text"] {
    background: rgba(2, 6, 23, 0.35);
    border-color: rgba(148, 163, 184, 0.18);
    color: rgba(226, 232, 240, 0.92);
}
html[data-theme="dark"] .actions-inline select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* Paginación estándar (listados) */
.orbis-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.9) 0%, rgba(248, 250, 252, 0.55) 100%);
}
.orbis-pager__left {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}
.orbis-page {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #fff;
    color: #334155;
    font-weight: 800;
    font-size: 0.86rem;
    text-decoration: none;
    user-select: none;
    transition: transform .14s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
}
.orbis-page:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(43, 74, 85, 0.10); border-color: rgba(63, 114, 131, 0.35); }
.orbis-page.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 10px 26px rgba(43, 74, 85, 0.22);
}
.orbis-page--nav { font-size: 1.05rem; line-height: 1; }
.orbis-page.is-disabled { opacity: 0.45; pointer-events: none; }
.orbis-ellipsis { color: var(--text-muted); font-weight: 800; padding: 0 0.15rem; }

.orbis-pager__right { display: flex; align-items: center; gap: 0.5rem; }
.orbis-perpage { display: inline-flex; align-items: center; gap: 0.5rem; }
.orbis-perpage__label {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.orbis-perpage select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    padding: 0.5rem 2.1rem 0.5rem 0.75rem;
    font: inherit;
    font-weight: 800;
    background: #fff;
    color: #334155;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23647569' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 18px 18px;
    transition: border-color .2s, box-shadow .2s;
}
.orbis-perpage select:focus {
    outline: none;
    border-color: var(--hover);
    box-shadow: 0 0 0 3px rgba(34, 195, 255, 0.12);
}

html[data-theme="dark"] .orbis-pager {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.75) 0%, rgba(2, 6, 23, 0.55) 100%);
    border-bottom-color: rgba(148, 163, 184, 0.16);
}
html[data-theme="dark"] .orbis-page {
    background: rgba(2, 6, 23, 0.35);
    border-color: rgba(148, 163, 184, 0.18);
    color: rgba(226, 232, 240, 0.92);
}
html[data-theme="dark"] .orbis-page.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
html[data-theme="dark"] .orbis-perpage select {
    background: rgba(2, 6, 23, 0.35);
    border-color: rgba(148, 163, 184, 0.18);
    color: rgba(226, 232, 240, 0.92);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

@media (max-width: 640px) {
    .orbis-pager { align-items: flex-start; flex-direction: column; }
    .orbis-pager__right { width: 100%; justify-content: flex-end; }
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e8f4fc;
    color: var(--primary);
}

.badge-warn {
    background: #fef3c7;
    color: #92400e;
}

.badge-ok {
    background: #ecfdf3;
    color: #166534;
}

.badge-info {
    background: #eff6ff;
    color: #1d4ed8;
}

/* Auditoría */
.audit-filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1.2fr 1fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
    margin-top: 0.75rem;
}
.audit-filter-actions { display: flex; justify-content: flex-end; }
.audit-table .td-num { text-align: right; font-variant-numeric: tabular-nums; }
.audit-desc { max-width: 520px; }
.audit-ip { font-size: 0.82rem; color: #334155; background: #f1f5f9; padding: 0.15rem 0.35rem; border-radius: 6px; }

@media (max-width: 1080px) {
    .audit-filters {
        grid-template-columns: 1fr 1fr;
    }
    .audit-filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
    .audit-desc { max-width: none; }
}

.inv-row-low {
    background: #fffbeb;
}

/* Notifications */
.notifications-preview {
    margin-top: 1rem;
    padding: 1rem 1.1rem;
}

.notif-section-title {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #334a5f;
}

.notif-list { display: grid; gap: 0.55rem; }

.notif {
    border-left: 4px solid var(--accent);
    background: #f8fbfe;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.notif strong { color: #1f4b66; display: block; font-size: 0.88rem; }
.notif span { font-size: 0.82rem; color: var(--text-muted); }

/* ---------- Pacientes: toolbar, filtros, formulario colapsado ---------- */
.patients-toolbar-panel { margin-top: 1rem; }

.toolbar-rows {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.toolbar-row--actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.toolbar-row--import {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    padding-top: 0.5rem;
    border-top: 1px solid var(--line);
}

/* Toolbar unificada (acciones + Excel + export) */
.patients-toolbar {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem 1rem;
    flex-wrap: wrap;
}
.patients-toolbar--unified {
    align-items: center;
}
.patients-toolbar__left,
.patients-toolbar__right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    min-width: 0;
}
.patients-toolbar__right { margin-left: auto; }
.patients-toolbar__group {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.patients-toolbar__import-wrap {
    padding-left: 0.65rem;
    margin-left: 0.15rem;
    border-left: 1px solid var(--line);
}
.patients-toolbar__check {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

/* Import Excel compacto (barra superior) */
.patients-excel-import {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    padding: 0.35rem 0.55rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(248, 250, 252, 0.85);
}
.patients-excel-import__label {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 7.5rem;
}
.patients-excel-import__title {
    font-size: 0.78rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.02em;
}
.patients-excel-import__hint {
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.2;
}
.patients-excel-import__file {
    max-width: 200px;
    min-width: 0;
    flex: 1 1 140px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.38rem 0.5rem;
    font: inherit;
    font-size: 0.78rem;
    background: #fff;
}

.patients-filters { margin-top: 0.75rem; }

/* Filtros pacientes — diseño en bloques */
.patients-filters--pro .patients-filters__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--line);
}
.patients-filters--pro .patients-filters__intro { min-width: 0; flex: 1 1 220px; }
.patients-filters--pro .patients-filters__lede {
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
    max-width: 42rem;
}
.patients-filters--pro .patients-filters__body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.patients-filters--pro .patients-filters__search-block {
    width: 100%;
}
.patients-filters--pro .field--search-wide {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
}
.patients-filters__search-shell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.35rem 0.65rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(2, 6, 23, 0.04);
}
.patients-filters__search-shell:focus-within {
    border-color: rgba(0, 46, 107, 0.35);
    box-shadow: 0 0 0 3px rgba(0, 46, 107, 0.08);
}
.patients-filters__search-icon {
    font-size: 1rem;
    opacity: 0.45;
    user-select: none;
    flex-shrink: 0;
}
.patients-filters__search-input {
    flex: 1;
    min-width: 0;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0.4rem 0.15rem !important;
    font-size: 0.92rem;
}
.patients-filters__search-input:focus {
    outline: none;
}
.patients-filters--pro .patients-filters__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem 1rem;
    align-items: end;
}
@media (max-width: 960px) {
    .patients-filters--pro .patients-filters__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 520px) {
    .patients-filters--pro .patients-filters__grid {
        grid-template-columns: 1fr;
    }
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-top: 0.35rem;
}

.filters-grid .field.field-check {
    display: flex;
    align-items: center;
    min-height: 2.5rem;
}

.patients-list-panel { margin-top: 0.75rem; }

.patient-form-panel.is-collapsed {
    display: none !important;
}

.th-check,
.td-check {
    width: 40px;
    text-align: center;
}

.btn-check-label {
    cursor: pointer;
    gap: 0.35rem;
    margin: 0;
    font-weight: 600;
}

.chk-in-btn {
    margin: 0;
    accent-color: var(--primary);
}

@media (max-width: 1100px) {
    .patients-toolbar__import-wrap {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        width: 100%;
    }
    .patients-excel-import { width: 100%; }
    .patients-excel-import__file { max-width: none; }
    .patients-toolbar__right {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }
}

html[data-theme="dark"] .patients-excel-import {
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(148, 163, 184, 0.2);
}
html[data-theme="dark"] .patients-excel-import__title { color: rgba(226, 232, 240, 0.92); }
html[data-theme="dark"] .patients-excel-import__file {
    background: rgba(2, 6, 23, 0.35);
    border-color: rgba(148, 163, 184, 0.16);
    color: rgba(226, 232, 240, 0.92);
}
html[data-theme="dark"] .patients-filters__search-shell {
    background: rgba(2, 6, 23, 0.35);
    border-color: rgba(148, 163, 184, 0.16);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
}

/* Legacy */
.panel-grid:not(.panel-elevated) {
    margin-top: 0.9rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.9rem;
}

.btn-min {
    border: 1px solid #c8d4de;
    background: #fff;
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}

.btn-min:hover { border-color: var(--hover); color: var(--primary); }
.btn-min.danger:hover { border-color: #ff9a9a; color: #a34141; }

@media (max-width: 1080px) {
    .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
    .reports-layout { grid-template-columns: 1fr; }
    .reports-tabs {
        flex-direction: row;
        flex-wrap: wrap;
        position: static;
        padding: 0 0 0.5rem;
    }
    .reports-tab { flex: 1 1 45%; min-width: 140px; }
}

@media (max-width: 850px) {
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }

    /* Cuerpo a ancho completo: la regla .sidebar.is-collapsed + .main es más específica que .main; forzar en móvil */
    .main {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .topbar {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        /* Debe quedar por encima del contenido, pero por debajo del drawer */
        z-index: 1500;
    }

    /* Drawer: oculto salvo con .show (evita solapar el contenido al cargar) */
    .sidebar {
        width: min(92vw, 300px) !important;
        height: 100dvh;
        min-height: 0;
        /* En móvil, el drawer debe quedar por encima de la topbar para no tapar navegación */
        z-index: 1600;
        max-height: 100vh;
        max-height: 100dvh;
        overflow: hidden;
        -webkit-overflow-scrolling: touch;
    }
    .sidebar:not(.show) {
        transform: translate3d(-100%, 0, 0) !important;
        box-shadow: none;
        pointer-events: none;
    }
    .sidebar.show {
        transform: translate3d(0, 0, 0) !important;
        pointer-events: auto;
    }

    /* En pantalla pequeña, no usar sidebar estrecho colapsado al abrir el cajón */
    .sidebar.is-collapsed,
    .sidebar.is-collapsed.show {
        width: min(92vw, 300px) !important;
    }

    .menu--main {
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-inner {
        overflow-y: auto;
    }

    /* Evita scroll del cuerpo cuando el cajón está abierto (móvil) */
    html.orbis-nav-backdrop,
    body.orbis-nav-backdrop {
        overflow: hidden;
    }
    body.orbis-nav-backdrop::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.4);
        /* Backdrop entre topbar y sidebar */
        z-index: 1450;
        pointer-events: auto;
    }
}

@media (max-width: 560px) {
    .kpi-row { grid-template-columns: 1fr; }
    .topbar-title { font-size: 0.95rem; }
    .form-grid,
    .form-grid.compact { grid-template-columns: 1fr; }
    .field-span-2 { grid-column: span 1; }

    /* Dashboard: compactar KPI y evitar desbordes en móvil */
    .kpi-row { gap: 0.65rem; }
    .kpi { padding: 0.85rem 0.9rem 0.75rem; }
    .kpi-value { font-size: 1.55rem; }
    .kpi-sub { font-size: 0.76rem; }
    .kpi-badge { font-size: 0.7rem; padding: 0.24rem 0.5rem; max-width: 48vw; overflow: hidden; text-overflow: ellipsis; }

    /* El pseudo-elemento usaba -10% y puede “empujar” el ancho en algunos móviles */
    .kpi::after { left: 0; right: 0; opacity: 0.28; filter: none; }
}
