/* ===== Google Fonts ===== */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");

/* ===== CSS Variables — LJPN Portal Estetica ===== */
:root {
    /* Paleta por defecto = tema "Menta Fresca" (debe coincidir con SPA_THEMES en js/ajustes.js)
       para que la primera pantalla pinte con el color correcto sin esperar a la API. */
    --primary: #4AAEA0;
    --primary-dark: #2E8A7C;
    --primary-rgb: 74, 174, 160;
    --primary-glow: rgba(74, 174, 160, 0.25);
    --gold: #80CEC5;
    --gold-rgb: 128, 206, 197;
    --gold-light: rgba(128, 206, 197, 0.12);
    --mauve: #B0E8E2;
    --mauve-light: rgba(176, 232, 226, 0.15);
    --teal: #4AAEA0;
    --teal-rgb: 74, 174, 160;
    --teal-light: rgba(74, 174, 160, 0.1);
    --carbon: #0A2028;
    --dark: #0A2028;
    --white: #ffffff;
    --bg: #EEF8F7;
    --bg-card: #ffffff;
    --bg-card-solid: #ffffff;
    --border: rgba(74, 174, 160, 0.18);
    --border-light: rgba(74, 174, 160, 0.08);
    --text: #0A2028;
    --text-secondary: #1E4A50;
    --text-muted: #1E4A50;
    --red: #ef4444;
    --red-rgb: 239, 68, 68;
    --green: #4AAEA0;
    --green-rgb: 74, 174, 160;
    --success-rgb: 74, 174, 160;
    --accent-rgb: 74, 174, 160;
    --sidebar-bg: linear-gradient(rgba(74, 174, 160, 0.45), rgba(74, 174, 160, 0.30)), url("img/sidebar_menta.png");
    --sidebar-bg-size: cover;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-w: 260px;
    --header-h: 64px;
}

/* ===== Reset ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    background:
        radial-gradient(at 0% 0%, rgba(var(--primary-rgb), 0.18) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(var(--gold-rgb), 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(var(--primary-rgb), 0.12) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(var(--teal-rgb), 0.10) 0px, transparent 50%);
    background-color: var(--bg);
    background-attachment: fixed;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

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

/* ===== Sidebar (Desktop) ===== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg, 
        linear-gradient(rgba(var(--primary-rgb), 0.88), rgba(var(--teal-rgb), 0.65)),
        url("img/sidebar.png")
    );
    background-size: var(--sidebar-bg-size, cover);
    background-position: center;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    transition: var(--transition);
    color: var(--white);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.sidebar-logo {
    padding: 1.5rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.logo-sidebar {
    width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: contain;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: rgb(255, 255, 255);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.nav-item .material-symbols-outlined {
    font-size: 1.25rem;
}

.sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--mauve));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-user-role {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-logout {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}

.sidebar-logout:hover {
    color: var(--red);
    background: rgba(var(--red-rgb), 0.1);
}

.sidebar-version {
    padding: 0 1.25rem 8px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 500;
    text-align: left;
    background: rgba(0, 0, 0, 0.2);
}

/* ===== Main Content Area ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    transition: var(--transition);
}

.page-login .main-content {
    margin-left: 0 !important;
}

/* ===== Bottom Nav (Mobile) ===== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--border);
    z-index: 50;
    padding: 6px 0 env(safe-area-inset-bottom, 8px);
}

.bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.bottom-nav .nav-item {
    flex-direction: column;
    font-size: 0.65rem;
    gap: 2px;
    padding: 6px 8px;
}

.bottom-nav .nav-item .material-symbols-outlined {
    font-size: 1.35rem;
}

/* ===== View Containers ===== */
.view {
    padding: 2rem;
    animation: viewFadeIn 0.4s ease;
}

@keyframes viewFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Login View ===== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    background: var(--bg);
}

/* Elegant background animated blobs */
.login-container::before,
.login-container::after {
    content: "";
    position: absolute;
    width: 50vw;
    height: 50vw;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 0;
    opacity: 0.25;
}

.login-container::before {
    background: var(--primary);
    top: -10%;
    left: -10%;
    animation: blob-move-1 25s infinite alternate ease-in-out;
}

.login-container::after {
    background: var(--gold);
    bottom: -10%;
    right: -10%;
    animation: blob-move-2 30s infinite alternate ease-in-out;
}

@keyframes blob-move-1 {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(100px, 50px) scale(1.1);
    }
}

@keyframes blob-move-2 {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(-100px, -80px) scale(1.2);
    }
}

.login-card {
    background:
        linear-gradient(rgba(var(--primary-rgb), 0.88), rgba(var(--teal-rgb), 0.65)),
        url("img/sidebar_menta.png");
    background-size: cover;
    background-position: center;
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
    padding: 3.5rem 3rem;
    max-width: 440px;
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 10;
    animation: cardEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-card-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 2.5rem;
}

/* Sin logo configurado: no dejar hueco */
.login-card-logo:has(.logo-login[hidden]) {
    margin-bottom: 0;
}

.sidebar-logo:has(.logo-sidebar[hidden]) {
    padding: 0;
}

.logo-login {
    height: 130px;
    max-width: 280px;
    width: auto;
    object-fit: contain;
    margin-bottom: 0.5rem;
    background: rgba(8, 26, 33, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 18px;
    padding: 12px 22px;
    box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.35);
}

.login-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 0.75rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.login-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 2rem;
    line-height: 1.6;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.login-divider {
    width: 40px;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--gold));
    border-radius: 10px;
    margin: 0 auto 1.5rem;
}

.pin-error {
    background: rgba(var(--red-rgb), 0.08);
    border: 1px solid rgba(var(--red-rgb), 0.2);
    color: var(--red);
    font-size: 0.8rem;
    padding: 10px 14px;
    border-radius: var(--radius-xs);
    margin-bottom: 1rem;
}

/* ===== Multi-Select Checkbox Dropdown ===== */
.multi-select {
    position: relative;
}

.ms-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--white);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.ms-trigger:hover {
    border-color: var(--primary);
}

.multi-select.open .ms-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--teal-light);
}

.ms-arrow {
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

.multi-select.open .ms-arrow {
    transform: rotate(180deg);
}

.ms-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.ms-pills:empty {
    display: none;
}

.ms-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--teal-light);
    color: var(--teal);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid rgba(var(--teal-rgb), 0.2);
}

.ms-pill-remove {
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.ms-pill-remove:hover {
    opacity: 1;
}

.ms-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 200;
    max-height: 200px;
    overflow-y: auto;
    padding: 6px 0;
    animation: msDropIn 0.2s ease;
}

.multi-select.open .ms-dropdown {
    display: block;
}

@keyframes msDropIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ms-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.15s;
}

.ms-option:hover {
    background: rgba(var(--teal-rgb), 0.06);
}

.ms-option input[type="checkbox"] {
    accent-color: var(--primary);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 999px;
    font-family: "Inter", sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 10px 15px -3px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px var(--primary-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline {
    background: var(--white);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg);
    color: var(--text);
    border-color: var(--primary);
}

.btn-danger-outline {
    background: transparent;
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.06);
}

.btn-confirmed {
    background: rgba(var(--success-rgb), 0.1);
    color: var(--green);
    border: 1px solid rgba(var(--success-rgb), 0.25);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.75rem;
}

.btn-full {
    width: 100%;
    padding: 14px 20px;
    justify-content: center;
}

.btn-icon {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.btn .material-symbols-outlined {
    font-size: 1.1rem;
}

/* ===== Form Inputs ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: "Inter", sans-serif;
    font-size: 0.85rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    transition: var(--transition);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* ===== Pre-Pago Checkbox ===== */
.prepago-check-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    user-select: none;
    transition: color 0.2s;
}

.prepago-check-label input[type="checkbox"] {
    display: none;
}

.prepago-check-box {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 5px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.prepago-check-box::after {
    content: "✓";
    font-size: 11px;
    font-weight: 700;
    color: var(--white);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.15s ease;
}

.prepago-check-label input[type="checkbox"]:checked ~ .prepago-check-box {
    background: var(--teal);
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(var(--teal-rgb), 0.2);
}

.prepago-check-label input[type="checkbox"]:checked ~ .prepago-check-box::after {
    opacity: 1;
    transform: scale(1);
}

.prepago-check-label input[type="checkbox"]:checked ~ span:last-child {
    color: var(--teal);
}

.prepago-check-label:hover .prepago-check-box {
    border-color: var(--teal);
}

/* Skin Evaluation Section */
.skin-fields-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 0.5rem 0;
    background: rgba(var(--primary-rgb, 180, 136, 100), 0.04);
    animation: slideDown 0.25s ease;
}

.skin-fields-section.hidden {
    display: none;
}

.skin-fields-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Skin Info in Detail Panel */
.dp-skin-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
    background: rgba(var(--primary-rgb, 180, 136, 100), 0.04);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* ===== Client Gallery ===== */
.clientes-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    min-height: calc(100vh - 4rem);
}

.clientes-gallery-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.clientes-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.clientes-toolbar .form-input {
    flex: 1;
    min-width: 250px;
    padding: 9px 14px;
    font-size: 0.8rem;
    background: var(--bg);
    border-color: var(--border);
    color: var(--text);
}

.clientes-toolbar .form-select {
    width: auto;
    padding: 9px 14px;
    font-size: 0.8rem;
    background: var(--bg);
    border-color: var(--border);
    color: var(--text);
}

#clientes-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    padding-right: 4px;
}

/* Tarjeta de cliente: avatar | nombre + teléfono · #id | estado.
   Las acciones aparecen en una fila compacta al seleccionar (siempre visibles en pantallas táctiles). */
.client-card {
    container-type: inline-size;
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
    row-gap: 10px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, background-color .2s;
}

.client-card:hover {
    border-color: rgba(var(--primary-rgb), 0.45);
    box-shadow: 0 6px 18px -10px rgba(var(--primary-rgb), 0.45);
}

.client-card.selected {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
    box-shadow: 0 8px 22px -12px rgba(var(--primary-rgb), 0.55);
}

.client-card.selected::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
}

.client-card.inactive .client-card-avatar { filter: grayscale(1); opacity: .6; }
.client-card.inactive .client-card-name { color: var(--text-muted); }

.client-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(var(--primary-rgb), 0.9), var(--primary-dark, var(--primary)));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: .03em;
    overflow: hidden;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.client-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.client-card-info { min-width: 0; }

.client-card-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.client-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
}

.client-card-phone { font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.client-card-id { flex-shrink: 0; opacity: .75; }
.client-card-id::before { content: "·"; margin-right: 6px; }

.client-card-status {
    align-self: start;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--green);
}

.client-card-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px rgba(var(--success-rgb), 0.15);
}

.client-card-status.inactive { color: var(--text-muted); }
.client-card-status.inactive::before { box-shadow: none; opacity: .6; }

.client-card-actions {
    grid-column: 2 / -1;
    display: none;
    align-items: center;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.client-card.selected .client-card-actions,
.client-card:focus-within .client-card-actions { display: flex; }

@media (hover: none) {
    .client-card-actions { display: flex; }
}

.client-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-card);
    font: inherit;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color .2s, border-color .2s, color .2s;
}

.client-card-btn .material-symbols-outlined { font-size: 16px; }
.client-card-btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-card-delete { margin-left: auto; width: 30px; padding: 0; justify-content: center; color: var(--text-muted); }
.btn-card-delete:hover { border-color: var(--red); color: var(--red); background: rgba(var(--red-rgb), 0.08); }

/* Tarjeta angosta (columna de clientes en tablet/plegables): el estado queda como punto
   y la fila de acciones usa todo el ancho para que no se corte. */
@container (max-width: 280px) {
    .client-card-status { font-size: 0; gap: 0; }
    .client-card-actions { grid-column: 1 / -1; }
    .client-card-id { display: none; }
}

.btn-icon-sm {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Client Detail Panel ===== */
#cliente-detail-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0;
    overflow: hidden;
    max-height: calc(100vh - 4rem);
    position: relative;
    display: flex;
    flex-direction: column;
}

#cliente-detail-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.dp-main-content {
    padding: 2rem;
    width: 100%;
}

/* Subtle glow accent on detail panel top */
#cliente-detail-panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg,
            transparent,
            var(--mauve),
            var(--gold),
            transparent);
    border-radius: 9999px;
}

.detail-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.detail-header .back-btn {
    position: absolute;
    top: 0;
    left: 0;
    display: none;
}

.detail-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--mauve));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 auto 1rem;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(196, 152, 164, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.4);
}

.detail-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 12px;
    border-radius: 999px;
}

.badge-active {
    background: rgba(var(--success-rgb), 0.12);
    color: var(--green);
}

.badge-inactive {
    background: rgba(var(--red-rgb), 0.12);
    color: var(--red);
}

.badge-cancelled {
    background: rgba(var(--red-rgb), 0.12);
    color: var(--red);
}

.detail-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1.5rem;
}

.detail-field {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.detail-field:hover {
    background: rgba(var(--gold-rgb), 0.03);
    border-color: rgba(var(--gold-rgb), 0.15);
}

.detail-field .material-symbols-outlined {
    color: var(--gold);
    font-size: 1.15rem;
    margin-top: 2px;
}

.detail-field small {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-field p {
    font-size: 0.85rem;
    color: var(--text);
    margin-top: 2px;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 1.5rem;
}

.detail-actions .btn {
    font-size: 0.75rem;
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.detail-actions .btn:hover {
    background: var(--bg);
    color: var(--text);
    border-color: var(--primary);
}

.detail-actions .btn-primary {
    background: var(--primary);
    color: var(--carbon);
    border-color: transparent;
    font-weight: 700;
}

/* ===== SECTION DIVIDER ===== */
.section-divider {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.section-divider h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--dark);
    font-size: 1.1rem;
}

/* ===== PROGRESS CHART CONTAINER ===== */
.chart-container {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    margin-bottom: 2rem;
    overflow: hidden;
}

.section-divider h4 .material-symbols-outlined {
    font-size: 1.1rem;
    color: var(--gold);
}

/* ===== Medidas ===== */
.medidas-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.medida-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.8rem;
}

.medida-fecha {
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    min-width: 140px;
}

.medida-values {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    flex: 1;
}

@media (max-width: 900px) {
    .medida-values {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px 8px;
    }
}

@media (max-width: 500px) {
    .medida-values {
        grid-template-columns: repeat(2, 1fr);
    }

    .medida-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

.cita-card-detail {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.cita-info-row {
    font-size: 0.8rem;
    padding: 4px 0;
    color: var(--text-secondary);
}

.cita-info-row strong {
    color: var(--text);
}

/* ===== Detail Panel Redesign (dp-) ===== */
.dp-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.dp-back {
    flex-shrink: 0;
}

.dp-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.dp-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dp-avatar span {
    color: var(--white);
    font-weight: 700;
    font-size: 1rem;
}

.dp-header-text {
    flex: 1;
    min-width: 0;
}

.dp-header-text h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.dp-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}

.dp-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.dp-btn-sm {
    font-size: 0.75rem !important;
    padding: 8px 14px !important;
    gap: 5px !important;
}

.dp-btn-sm .material-symbols-outlined {
    font-size: 1rem;
}

.dp-name-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.dp-client-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.dp-info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.dp-info-card {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    background: var(--white);
    transition: var(--transition);
}

.dp-info-card:hover {
    border-color: var(--gold);
    box-shadow: 0 2px 8px rgba(var(--gold-rgb), 0.05);
}

.dp-info-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 6px;
}

.dp-info-label .material-symbols-outlined {
    font-size: 0.85rem;
    color: var(--gold);
}

.dp-info-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}

/* Footer Links */
.dp-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 20px 0 8px;
    border-top: 1px solid var(--border-light);
    margin-top: 24px;
}

.dp-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.dp-footer-link:hover {
    color: var(--gold);
}

.dp-footer-link .material-symbols-outlined {
    font-size: 0.9rem;
}

.dp-footer-danger {
    color: var(--red) !important;
    opacity: 0.7;
}

.dp-footer-danger:hover {
    opacity: 1;
}

.dp-footer-dot {
    color: var(--text-muted);
    opacity: 0.3;
    font-size: 0.7rem;
}

/* ===== Cita del Día (cd-) ===== */
.cita-dia-section {
    margin-top: 4px;
    margin-bottom: 24px;
}

.cita-dia-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 0 12px 0;
    border-bottom: 2px solid var(--gold);
    margin-bottom: 16px;
}

.cita-dia-header h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    flex: 1;
}

.cita-dia-icon {
    color: var(--gold);
    font-size: 1.3rem;
}

.cita-dia-badges {
    display: flex;
    gap: 8px;
}

.cd-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.cd-edit-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}

.cd-edit-toggle .material-symbols-outlined {
    font-size: 1rem;
}

.cita-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 4px 12px;
    border-radius: 999px;
}

.cita-badge-pendiente {
    background: rgba(var(--gold-rgb), 0.12);
    color: var(--gold);
    border: 1px solid rgba(var(--gold-rgb), 0.3);
}

.cita-badge-finalizado {
    background: rgba(var(--success-rgb), 0.1);
    color: var(--green);
    border: 1px solid rgba(var(--success-rgb), 0.25);
}

.cita-badge-cancelado {
    background: rgba(var(--red-rgb), 0.1);
    color: var(--red);
    border: 1px solid rgba(var(--red-rgb), 0.25);
}

.cita-badge-pagado {
    background: rgba(var(--success-rgb), 0.1);
    color: var(--green);
    border: 1px solid rgba(var(--success-rgb), 0.25);
}

.cita-badge-no-pagado {
    background: rgba(var(--red-rgb), 0.08);
    color: var(--red);
    border: 1px solid rgba(var(--red-rgb), 0.2);
}

.cita-badge-prepago {
    background: rgba(var(--accent-rgb), 0.09);
    color: var(--primary);
    border: 1px solid rgba(var(--accent-rgb), 0.25);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Top row: Hora | Tratamientos | Monto */
.cd-grid-top {
    display: grid;
    grid-template-columns: 1.2fr 1.5fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

/* Bottom row: Personal | Oficina | Confirmación */
.cd-grid-bottom {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 0;
}

.cd-cell {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    background: var(--white);
    transition: var(--transition);
}

.cd-cell:hover {
    border-color: rgba(0, 0, 0, 0.1);
}

.cd-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.cd-label .material-symbols-outlined {
    font-size: 0.85rem;
    color: var(--gold);
}

.cd-cell-val {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.cd-muted {
    color: var(--text-muted) !important;
    font-style: italic;
}

/* Hora Cell — gold accent border */
.cd-hora-cell {
    border-left: 3px solid var(--gold);
    background: linear-gradient(135deg, rgba(var(--gold-rgb), 0.04), transparent);
    align-self: center;
}

.cd-hora-cell .cd-label {
    color: var(--gold);
}

.cd-hora-val {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
}

/* Treatment pills */
.cd-pills {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 16px;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 12px 16px;
    margin-top: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.5;
}

.cd-pill {
    display: flex;
    align-items: center;
    white-space: normal;
}

.cd-bullet {
    height: 14px;
    width: auto;
    margin: 0 6px;
    vertical-align: text-bottom;
}

/* Monto Cell */
.cd-monto-cell {
    align-self: center;
}

.cd-monto-val {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
}

.cd-empty-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.cd-edit-panel {
    margin-top: 16px;
    padding: 18px;
    background: linear-gradient(145deg,
            rgba(255, 255, 255, 0.94),
            rgba(255, 255, 255, 0.72));
    border: 1px solid var(--border-light);
    border-radius: 20px;
    box-shadow: 0 10px 28px -18px rgba(0, 0, 0, 0.12);
}

.cd-edit-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.cd-edit-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.cd-edit-subtitle {
    margin: 4px 0 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.cd-edit-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.cd-edit-grid .form-group {
    margin: 0;
}

.cd-edit-grid .form-label {
    margin-bottom: 8px;
}

.cd-edit-grid .ms-trigger {
    min-height: 52px;
}

.cd-monto-input {
    min-height: 52px;
    font-size: 1rem;
    font-weight: 700;
}

.cd-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.cd-payment-editor {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(240px, 1.4fr) minmax(160px, 0.8fr);
    gap: 12px;
    align-items: stretch;
}

.cd-pago-edit-input {
    min-height: 54px;
    font-size: 1rem;
    font-weight: 700;
}

.cd-payment-edit-actions {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.cd-payment-edit-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

/* Actions Row - Premium Glassmorphism */
.cd-actions {
    display: flex;
    align-items: stretch;
    gap: 16px;
    margin-top: 24px;
    padding: 20px;
    background: linear-gradient(145deg,
            rgba(255, 255, 255, 0.9),
            rgba(255, 255, 255, 0.4));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    box-shadow:
        0 10px 30px -10px rgba(0, 0, 0, 0.08),
        inset 0 2px 0 rgba(255, 255, 255, 0.8);
}

.btn-cita-finalizar {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 26px;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow:
        0 4px 15px var(--primary-glow),
        inset 0 -2px 0 rgba(0, 0, 0, 0.1);
}

.btn-cita-finalizar:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 25px var(--primary-glow),
        inset 0 -2px 0 rgba(0, 0, 0, 0.1);
    filter: brightness(1.05) saturate(1.1);
}

/* Custom Select for Payment - Premium */
.cd-pago-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
}

.cd-pago-custom {
    padding: 14px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    background: var(--white);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    user-select: none;
    height: 100%;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}

.cd-pago-custom:hover {
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.cd-pago-custom::after {
    content: "\e5cf";
    font-family: "Material Symbols Outlined";
    margin-left: auto;
    font-size: 1.25rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.cd-pago-options {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    transform: translateY(10px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.cd-pago-options.active {
    display: block;
    transform: translateY(0);
    opacity: 1;
    animation: slideUpFade 0.3s forwards;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cd-pago-option {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.cd-pago-option:hover {
    background: rgba(0, 0, 0, 0.03);
    padding-left: 24px;
    /* Subtle indent effect on hover */
}

.cd-pago-option img {
    height: 24px;
    width: auto;
    object-fit: contain;
}

.cd-pago-select {
    display: none;
}

.btn-cita-pagar {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 26px;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow:
        0 4px 15px var(--primary-glow),
        inset 0 -2px 0 rgba(0, 0, 0, 0.1);
}

.btn-cita-pagar:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 25px var(--primary-glow),
        inset 0 -2px 0 rgba(0, 0, 0, 0.1);
    filter: brightness(1.05) saturate(1.1);
}

.btn-cita-cancelar {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(var(--red-rgb), 0.24);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(254, 226, 226, 0.95), rgba(254, 242, 242, 0.98));
    color: #b91c1c;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 6px 18px rgba(var(--red-rgb), 0.08);
}

.btn-cita-cancelar:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--red-rgb), 0.35);
    box-shadow: 0 12px 24px rgba(239, 68, 68, 0.12);
}

.btn-cita-cancelar:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.cita-dia-done {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--green);
    background: rgba(var(--success-rgb), 0.06);
    border: 1px solid rgba(var(--success-rgb), 0.2);
    border-radius: var(--radius-sm);
}

.cita-dia-done-pago {
    color: var(--teal);
    background: rgba(var(--teal-rgb), 0.06);
    border-color: rgba(var(--teal-rgb), 0.2);
}

.cita-dia-done-cancel {
    color: var(--red);
    background: rgba(var(--red-rgb), 0.06);
    border-color: rgba(var(--red-rgb), 0.2);
}

.cd-pagado-icon {
    height: 18px;
    width: auto;
    object-fit: contain;
    margin-right: 6px;
}

.cita-dia-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.cita-dia-empty .material-symbols-outlined {
    font-size: 2rem;
    color: var(--text-muted);
    opacity: 0.5;
    margin-bottom: 8px;
}

.cita-dia-empty p {
    margin: 0;
    font-size: 0.85rem;
}

@media (max-width: 1100px) {
    .cd-edit-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Responsive: stack on mobile */
@media (max-width: 768px) {
    .dp-info-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dp-header-actions {
        display: none;
    }

    .cd-grid-top,
    .cd-grid-bottom {
        grid-template-columns: 1fr;
    }

    .cd-actions {
        flex-direction: column;
    }

    .cd-edit-grid {
        grid-template-columns: 1fr;
    }

    .cd-edit-actions {
        flex-direction: column;
    }

    .cd-payment-editor {
        grid-template-columns: 1fr;
    }

    .cd-payment-edit-actions {
        flex-direction: column;
    }

    .cita-dia-header {
        flex-wrap: wrap;
    }

    .cd-header-actions {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }
}

/* ===== Calendar (Premium Redesign) ===== */
#view-calendario {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.cal-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 28px;
    padding: 40px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.05);
}

#cal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

#cal-header h3 {
    font-size: 1.5rem;
    font-weight: 800;
    min-width: 250px;
    text-align: center;
    color: var(--dark);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#cal-header .btn-icon {
    background: var(--white);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    color: var(--teal);
    transition: all 0.3s ease;
}

#cal-header .btn-icon:hover {
    background: var(--teal);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(var(--teal-rgb), 0.3);
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.cal-weekday {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--teal);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 0;
    opacity: 0.8;
}

.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-day {
    background: var(--white);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    min-height: 110px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    position: relative;
    overflow: hidden;
}

.cal-day::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.8),
            rgba(255, 255, 255, 0));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cal-day:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.08);
    border-color: rgba(var(--teal-rgb), 0.3);
    z-index: 2;
}

.cal-day:hover::before {
    opacity: 1;
}

.cal-day.empty {
    background: transparent;
    border: none;
    box-shadow: none;
    cursor: default;
}

.cal-day.empty:hover {
    transform: none;
    box-shadow: none;
    z-index: 1;
}

.cal-day.today {
    border: 2px solid var(--teal);
    background: linear-gradient(145deg, var(--white), rgba(var(--teal-rgb), 0.05));
    box-shadow: 0 8px 25px rgba(var(--teal-rgb), 0.15);
}

.cal-day.today .cal-day-num {
    color: var(--white);
    background: var(--teal);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-top: -4px;
    margin-left: -4px;
    box-shadow: 0 4px 10px rgba(var(--teal-rgb), 0.4);
}

.cal-day-num {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: auto;
    position: relative;
    z-index: 1;
}

.cal-counts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: auto;
    position: relative;
    z-index: 1;
}

.cal-count {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    background: rgba(var(--primary-rgb), 0.10);
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.18);
}

.cal-count::before {
    content: attr(data-clinic);
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.7;
}

/* Eliminamos los nth-child de colores forzados para lograr armonía visual 
   y permitir que todas las localidades se vean puras y uniformes con el tema seleccionado */
.cal-count:nth-child(n) {
    background: rgba(var(--primary-rgb), 0.06);
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
}

.cal-day:hover .cal-count {
    transform: scale(1.02);
    filter: brightness(1.1);
}

/* ===== SMS Sync Badge ===== */
.sms-sync-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: smsBadgePulse 2s ease-in-out infinite;
    z-index: 5;
}

@keyframes smsBadgePulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    }

    50% {
        transform: scale(1.15);
        box-shadow: 0 4px 16px rgba(239, 68, 68, 0.6);
    }
}

/* ===== Agenda ===== */
.agenda-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.agenda-header h3 {
    flex: 1;
}

#agenda-date-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    text-transform: capitalize;
}

#agenda-date-input {
    display: none;
}

.agenda-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.agenda-filters .form-select {
    padding: 6px 12px;
    font-size: 0.8rem;
    width: auto;
}

.agenda-filters label {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    cursor: pointer;
}

.agenda-filters input[type="checkbox"] {
    accent-color: var(--primary);
}

#agenda-citas-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===== Agenda Row Cards ===== */
.agenda-row-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    transition: all 0.25s ease;
    cursor: default;
}

.agenda-row-card.cancelled {
    opacity: 0.6;
    background: rgba(250, 250, 250, 0.6);
}

.agenda-row-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(var(--teal-rgb), 0.3);
}

.arc-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    flex-shrink: 0;
    color: var(--teal);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    padding-right: 16px;
}

.arc-time strong {
    font-size: .90rem;
    font-weight: 800;
}

.arc-time small {
    font-size: 0.50rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--gold);
    margin-top: -2px;
}

.arc-client {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 180px;
    flex: 0 1 auto;
}

.arc-client img,
.arc-client .arc-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.arc-client .arc-avatar {
    background: rgba(var(--teal-rgb), 0.15);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.arc-client-info {
    display: flex;
    flex-direction: column;
}

.arc-client-info strong {
    font-size: 0.95rem;
    color: var(--dark);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.arc-client-info span {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.arc-client-info span .material-symbols-outlined {
    font-size: 0.9rem;
    color: var(--gold);
}

.arc-details {
    flex: 1;
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr;
    align-items: center;
    gap: 16px;
    border-left: 1px solid rgba(0, 0, 0, 0.06);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0 16px;
    min-width: 200px;
}

.arc-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.arc-col-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.arc-service {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
    color: var(--teal);
    font-weight: 700;
}

.arc-service .material-symbols-outlined {
    font-size: 1.1rem;
    color: var(--primary);
}

.arc-service-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    align-items: center;
    width: 100%;
}

.arc-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 1rem;
    color: var(--text);
    font-weight: 600;
}

.arc-info .material-symbols-outlined {
    font-size: 1.15rem;
    color: var(--primary-dark);
}

.arc-price {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
    justify-content: flex-end;
}

.arc-price .material-symbols-outlined {
    font-size: 1.15rem;
    color: var(--gold);
}

@media (max-width: 1150px) {
    .arc-service-text {
        max-width: 180px;
    }
}

.arc-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    min-width: 180px;
    flex: 0 1 auto;
}

.arc-badges .cita-badge,
.arc-badges span[style*="inline-flex"] {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.arc-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: 140px;
    flex-shrink: 0;
}

.arc-actions .btn-icon-action {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.arc-actions .btn-icon-action:hover {
    background: var(--bg-hover);
    color: var(--dark);
    border-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.arc-actions .btn-icon-action.confirm:hover {
    background: var(--green-light);
    color: var(--green);
    border-color: var(--green);
}

.arc-actions .btn-icon-action.confirm.active {
    background: var(--green);
    color: var(--white);
    border-color: var(--green);
}

.arc-actions .btn-icon-action.cancel:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
    border-color: var(--red);
}

.arc-actions .btn-icon-action.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
    border-color: var(--red);
}

/* Disabled state: locked when paid */
.arc-actions .btn-icon-action:disabled {
    opacity: 0.3;
    pointer-events: none;
    cursor: not-allowed;
}

/* Paid card visual indicator */
.agenda-row-card.arc-paid {
    border-left: 3px solid var(--green);
}

.arc-col-price {
    text-align: right;
    align-items: flex-end;
}

.arc-price strong {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
}

@media (max-width: 1150px) {
    .agenda-row-card {
        flex-wrap: wrap;
        gap: 12px;
    }

    .arc-details {
        border: none;
        padding: 0;
        flex-basis: 100%;
        order: 3;
    }

    .arc-badges {
        order: 2;
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        padding-top: 10px;
    }

    .arc-actions {
        order: 4;
        width: 100%;
        justify-content: flex-end;
    }

    .arc-time {
        border: none;
    }
}

/* ===== Modals ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100000;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.25s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(16px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 0;
}

.modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(var(--red-rgb), 0.1);
    color: var(--red);
    border-color: rgba(var(--red-rgb), 0.2);
}

.modal-body {
    padding: 1.25rem 1.5rem;
}

.modal-footer {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 5rem;
    right: 1.5rem;
    z-index: 200;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-family: "Inter", sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation:
        toastIn 0.3s ease,
        toastOut 0.3s ease 2.7s forwards;
}

.toast-success {
    background: var(--white);
    color: var(--green);
    border: 1px solid rgba(var(--success-rgb), 0.2);
}

.toast-error {
    background: var(--white);
    color: var(--red);
    border: 1px solid rgba(var(--red-rgb), 0.2);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateY(12px);
    }
}

/* ===== Loaders ===== */
.loader-sm {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2rem;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.spinner-sm {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Empty & Error States ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 0.75rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== Premium Animated Empty State ===== */
.premium-empty-state {
    position: relative;
    flex: 1;
    min-height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(-45deg,
            var(--bg) 0%,
            #ffffff 30%,
            rgba(196, 152, 164, 0.15) 70%,
            rgba(104, 177, 175, 0.15) 100%);
    background-size: 300% 300%;
    animation: premiumGradientBg 12s ease-in-out infinite;
}

@keyframes premiumGradientBg {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Smoke / blur blobs for organic premium feel */
.premium-empty-state::before,
.premium-empty-state::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    z-index: 0;
    pointer-events: none;
    animation: floatBlobs 12s infinite alternate ease-in-out;
    opacity: 0.8;
}

.premium-empty-state::before {
    width: 300px;
    height: 300px;
    background: rgba(196, 152, 164, 0.25);
    /* Mauve flow */
    top: -50px;
    left: -50px;
    animation-delay: -3s;
}

.premium-empty-state::after {
    width: 280px;
    height: 280px;
    background: rgba(104, 177, 175, 0.2);
    /* Teal flow */
    bottom: -50px;
    right: -50px;
    animation-duration: 15s;
}

@keyframes floatBlobs {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(60px, 40px) scale(1.2);
    }
}

.premium-empty-state>img {
    position: relative;
    z-index: 1;
    max-width: 290px;
    margin-bottom: 2.5rem;
    opacity: 0.95;
    filter: drop-shadow(0 20px 30px rgba(104, 177, 175, 0.12));
    animation: floatPremiumImg 6s ease-in-out infinite;
}

@keyframes floatPremiumImg {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-16px);
    }
}

.premium-empty-state>p {
    position: relative;
    z-index: 1;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

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

.text-error {
    color: var(--red);
    font-size: 0.8rem;
}

/* ===== Confirm Dialog ===== */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

.confirm-overlay.hidden {
    display: none !important;
}

.confirm-card {
    background: var(--white);
    border-radius: 16px;
    padding: 2rem 2.5rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(0, 0, 0, 0.05);
}

.confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

.confirm-icon .material-symbols-outlined {
    font-size: 32px;
    color: var(--red);
}

.confirm-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.confirm-message {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 1.5rem;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.confirm-actions .btn {
    min-width: 120px;
    padding: 10px 20px;
    font-weight: 600;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.btn-danger {
    background: linear-gradient(135deg, var(--red), #dc2626);
    color: #fff;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(248, 113, 113, 0.4);
}

/* ===== Hidden Utility ===== */
.hidden {
    display: none !important;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding-bottom: 80px;
    }

    .bottom-nav {
        display: block;
    }

    .clientes-layout {
        grid-template-columns: 1fr;
    }

    #cliente-detail-panel {
        position: fixed;
        inset: 0;
        z-index: 60;
        display: none;
        border-radius: 0;
        max-height: 100vh;
    }

    #cliente-detail-panel.visible {
        display: flex;
    }

    .detail-header .back-btn {
        display: flex;
    }

    .login-container {
        margin-left: 0;
    }

    .cal-day {
        min-height: 50px;
        padding: 4px;
    }

    .cal-day-num {
        font-size: 0.7rem;
    }

    .cal-count {
        font-size: 0.55rem;
        padding: 1px 4px;
    }
}

@media (max-width: 480px) {
    .view {
        padding: 1rem;
    }

    .agenda-header {
        gap: 0.5rem;
    }

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

/* ===== Asignar Citas ===== */
.asignar-header {
    margin-bottom: 24px;
}

.asignar-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 4px;
    letter-spacing: -0.5px;
}

.asignar-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.asignar-controls {
    margin-bottom: 24px;
}

.asignar-controls-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.asignar-layout {
    display: grid;
    grid-template-columns: minmax(280px, 30%) minmax(320px, 1fr) 240px;
    gap: 20px;
    min-height: 400px;
}

.asignar-gallery-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04);
    height: calc(100vh - 280px);
    min-height: 400px;
}

.asignar-gallery-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--white);
}

.asignar-gallery-header h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    flex: 1;
}

.asignar-count {
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(var(--gold-rgb), 0.15);
    color: var(--gold);
    padding: 4px 12px;
    border-radius: 999px;
}

.asignar-count-green {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
}

.asignar-gallery {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg);
}

.asignar-card {
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 16px;
    background: var(--white);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.asignar-card:hover {
    border-color: var(--gold);
    box-shadow: 0 8px 16px rgba(var(--gold-rgb), 0.08);
    transform: translateY(-2px);
}

.asignar-card.selected {
    border-color: var(--primary);
    background: #f0fdfa;
    /* Light teal bg */
    box-shadow:
        0 0 0 2px rgba(45, 212, 191, 0.3),
        0 8px 16px rgba(45, 212, 191, 0.1);
}

.asignar-card-assigned {
    cursor: default;
    border-left: 4px solid var(--primary);
}

.asignar-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.asignar-card-hora {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    background: rgba(var(--gold-rgb), 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

.asignar-card-clinica {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.asignar-card-personal-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--green);
    background: rgba(var(--success-rgb), 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

.asignar-card-nombre {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.asignar-card-detail-row {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 3px 0;
    display: flex;
    gap: 8px;
    align-items: center;
}

.asignar-detail-label {
    font-weight: 500;
    color: var(--text-muted);
    min-width: 85px;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
}

.asignar-detail-value {
    font-weight: 600;
    color: var(--text);
}

.asignar-card-bottom {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
}

.asignar-card-costo {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
}

.asignar-card-metodo {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ═══ Premium Assigned Cards ═══ */
.asignar-agenda-card {
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.92) 0%,
            rgba(248, 250, 252, 0.88) 100%);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-left: 3.5px solid var(--teal);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: stretch;
    flex-shrink: 0;
    gap: 14px;
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.03),
        0 1px 3px rgba(0, 0, 0, 0.02),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.asignar-agenda-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
            transparent,
            rgba(104, 176, 174, 0.25),
            transparent);
}

.asignar-agenda-card:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.06),
        0 4px 12px rgba(104, 176, 174, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border-color: rgba(var(--teal-rgb), 0.3);
    border-left-color: var(--teal);
}

/* ─ Time column ─ */
.aac-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    padding-right: 14px;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
}

.aac-time strong {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--teal);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.aac-time small {
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1px;
}

/* ─ Main content ─ */
.aac-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-width: 0;
    gap: 12px;
}

.aac-client-col {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.aac-service-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 100%;
    border-left: none;
    padding-left: 0;
}

.aac-service-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.aac-person-badge {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--white);
    background: linear-gradient(135deg, var(--teal) 0%, #3db8a6 100%);
    padding: 2px 8px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(104, 176, 174, 0.25);
}

/* ─ Right column ─ */
.aac-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    min-width: 75px;
    padding-left: 10px;
    border-left: 1px solid rgba(0, 0, 0, 0.04);
}

.aac-price {
    font-size: 1rem;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.5px;
}

.aac-right .btn-icon-action {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.aac-right .btn-icon-action:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    transform: scale(1.08);
}

.asignar-btn-borrar {
    margin-left: auto;
    color: var(--red) !important;
    border-color: rgba(248, 113, 113, 0.3) !important;
    font-size: 0.65rem !important;
    padding: 4px 10px !important;
}

.asignar-btn-borrar:hover {
    background: rgba(var(--red-rgb), 0.08) !important;
    border-color: var(--red) !important;
}

/* Revenue Summary Panel */
.asignar-summary-panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04);
}

.asignar-summary-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg);
}

.asignar-summary-header h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.asignar-summary-content {
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 16px;
}

.summary-metric {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.summary-metric-historic {
    background: rgba(var(--gold-rgb), 0.04);
    border-color: rgba(255, 191, 0, 0.2);
}

.summary-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-metric-historic .summary-label {
    color: var(--gold);
}

.summary-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

.summary-metric-historic .summary-value {
    color: var(--primary);
}

@media (max-width: 1150px) {
    .asignar-layout {
        grid-template-columns: 1fr 1fr;
    }

    .asignar-summary-panel {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .asignar-layout {
        grid-template-columns: 1fr;
    }

    .asignar-summary-panel {
        grid-column: span 1;
    }

    .asignar-gallery {
        max-height: 50vh;
    }
}

/* ===== Inventario Module — Professional Redesign ===== */

/* Header */
.inv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.inv-header-left h2 {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--carbon) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    margin: 0;
}

.inv-header-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 4px 0 0 0;
}

.inv-header-right {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* Premium Toggle Switch */
.inv-toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    background: rgba(255, 255, 255, 0.7);
    padding: 6px 14px 6px 6px;
    border-radius: 30px;
    border: 1px solid rgba(var(--teal-rgb), 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.inv-toggle-switch:hover {
    background: var(--white);
    box-shadow: 0 4px 12px rgba(104, 176, 174, 0.08);
    transform: translateY(-1px);
}

.inv-toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.inv-toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #e2e8f0;
    border-radius: 999px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.inv-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.inv-toggle-switch input:checked+.inv-toggle-slider {
    background: linear-gradient(135deg, var(--primary) 0%, #3db8a6 100%);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.inv-toggle-switch input:checked+.inv-toggle-slider::after {
    transform: translateX(20px);
}

.inv-toggle-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.3s;
}

.inv-toggle-switch input:checked~.inv-toggle-label {
    color: var(--primary);
}

/* Premium Search Box */
.inv-search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 30px;
    padding: 0 16px;
    height: 38px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.inv-search-box:focus-within {
    border-color: rgba(var(--teal-rgb), 0.4);
    box-shadow: 0 4px 14px rgba(104, 176, 174, 0.12),
        0 0 0 3px rgba(104, 176, 174, 0.1);
    transform: translateY(-1px);
}

.inv-search-icon {
    font-size: 1.15rem;
    color: #94a3b8;
    margin-right: 8px;
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.inv-search-box:focus-within .inv-search-icon {
    color: var(--primary);
}

.inv-search-input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--carbon);
    font-family: inherit;
}

.inv-search-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* Premium Header Button */
.inv-header-btn {
    border-radius: 30px;
    padding: 0 20px;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    background: linear-gradient(135deg, var(--primary) 0%, #3db8a6 100%);
    box-shadow: 0 4px 12px rgba(104, 176, 174, 0.25);
    border: none;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.inv-header-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(104, 176, 174, 0.35);
    background: linear-gradient(135deg, #3db8a6 0%, var(--primary) 100%);
}

.inv-header-btn .material-symbols-outlined {
    font-size: 1.1rem;
}

/* KPI Strip */
.inv-kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.inv-kpi-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

.inv-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.inv-kpi-icon {
    font-size: 1.6rem;
    background: rgba(104, 176, 174, 0.1);
    padding: 10px;
    border-radius: 12px;
    line-height: 1;
}

.inv-kpi-card:nth-child(2) .inv-kpi-icon {
    background: rgba(99, 102, 241, 0.1);
}

.inv-kpi-card:nth-child(3) .inv-kpi-icon {
    background: rgba(245, 158, 11, 0.1);
}

.inv-kpi-card.inv-kpi-alert .inv-kpi-icon {
    background: rgba(239, 68, 68, 0.1);
}

.inv-kpi-info {
    display: flex;
    flex-direction: column;
}

.inv-kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--carbon);
    line-height: 1.2;
}

.inv-kpi-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Product Grid */
.inv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    align-items: start;
    padding: 10px 0;
}

/* Product Cards */
.inventario-card-premium {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
}

.inventario-card-premium:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
    border-color: rgba(var(--teal-rgb), 0.3);
}

/* Image Wrapper */
.inv-img-wrapper {
    height: 180px;
    background: #ffffff;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
}

.inv-img-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.03), transparent);
    pointer-events: none;
    z-index: 1;
}

.inv-img-wrapper img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.inventario-card-premium:hover .inv-img-wrapper img {
    transform: scale(1.06);
}

/* Action Overlay */
.inv-actions-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.3s ease;
    z-index: 2;
}

.inventario-card-premium:hover .inv-actions-overlay {
    opacity: 1;
    transform: translateY(0);
}

.inv-btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.inv-btn-icon .material-symbols-outlined {
    font-size: 1rem;
}

.inv-btn-icon:hover {
    background: var(--white);
    transform: scale(1.1);
}

.inv-btn-icon.edit-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.inv-btn-icon.delete-btn:hover {
    color: var(--red);
    border-color: var(--red);
}

/* Card Content */
.inv-card-content {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.inv-title {
    margin: 0 0 4px 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--carbon);
    line-height: 1.3;
}

.inv-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 16px 0;
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Stock Grid */
.inv-stock-grid {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.stock-badge {
    flex: 1;
    background: rgba(var(--primary-rgb), 0.06);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
    transition: all 0.2s ease;
}

.stock-badge:hover {
    background: rgba(var(--primary-rgb), 0.12);
    border-color: rgba(var(--primary-rgb), 0.25);
}

.stock-badge.low-stock {
    /* Mantenemos el mismo fondo y borde para no romper la armonía visual */
    background: rgba(var(--primary-rgb), 0.06);
    border-color: rgba(var(--primary-rgb), 0.15);
}

.stock-badge.low-stock:hover {
    background: rgba(var(--primary-rgb), 0.12);
}

.stock-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--primary);
    opacity: 0.7;
    margin-bottom: 4px;
}

.stock-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.stock-badge.low-stock .stock-value {
    color: var(--red);
}

/* Low Stock Warning Pill */
.inv-low-stock-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--red);
    background: rgba(var(--red-rgb), 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 20px;
    padding: 3px 10px;
    margin-bottom: 12px;
}

.inv-low-stock-pill .material-symbols-outlined {
    font-size: 0.8rem;
}

/* Adjust Stock Button */
.btn-inventario-ajustar {
    width: 100%;
    padding: 11px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(104, 176, 174, 0.08), rgba(104, 176, 174, 0.02));
    border: 1px solid rgba(var(--teal-rgb), 0.2);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-inventario-ajustar:hover {
    background: linear-gradient(135deg, rgba(var(--teal-rgb), 0.15), rgba(104, 176, 174, 0.08));
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--teal-rgb), 0.15);
}

.btn-inventario-ajustar .material-symbols-outlined {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.btn-inventario-ajustar:hover .material-symbols-outlined {
    transform: rotate(180deg);
}

/* Responsive */
@media (max-width: 768px) {
    .inv-header {
        flex-direction: column;
    }

    .inv-header-right {
        width: 100%;
        justify-content: flex-start;
    }

    .inv-kpi-strip {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .inv-kpi-strip {
        grid-template-columns: 1fr;
    }

    .inv-grid {
        grid-template-columns: 1fr;
    }
}


/* ===== Contabilidad Module ===== */
.premium-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.conta-kpi-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.conta-kpi-card.glass {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.conta-kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.conta-kpi-icon .material-symbols-outlined {
    font-size: 28px;
}

.conta-kpi-content {
    flex: 1;
}

.conta-kpi-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.conta-kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    color: var(--dark);
}

.conta-tabs-header {
    background: #fcfcfc;
}

.conta-tab-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
}

.conta-tab-btn:hover {
    color: var(--primary);
    background: rgba(104, 117, 175, 0.03);
}

.conta-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: white;
}

/* Contabilidad Tables */
.conta-table-wrapper {
    overflow-x: auto;
}

.conta-table {
    width: 100%;
    border-collapse: collapse;
}

.conta-table th {
    text-align: left;
    padding: 12px 10px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    background: #fafafa;
}

.conta-table td {
    padding: 14px 10px;
    font-size: 0.85rem;
    border-bottom: 1px solid #f5f5f5;
    color: var(--text);
}

.conta-table tr:last-child td {
    border-bottom: none;
}

.conta-table tr:hover td {
    background: #fafafa;
}

.pnl-cat-row {
    background: #fdfdfd;
    font-weight: 700;
}

.pnl-sub-row {
    padding-left: 25px !important;
}

.conta-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-block;
}

.badge-ingreso {
    background: #e6f7f1;
    color: #10b981;
}

.badge-gasto {
    background: #fdf2f2;
    color: #ef4444;
}

.badge-pendiente {
    background: #fff9e6;
    color: #f59e0b;
}

@media (max-width: 768px) {
    .conta-kpi-grid {
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 480px) {
    .conta-kpi-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ===== Dashboard ===== */
.dash-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Greeting & KPIs */
.dash-greeting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    background: linear-gradient(135deg, rgba(104, 176, 174, 0.12), rgba(196, 152, 164, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    border-radius: 22px;
    padding: 28px 36px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
}

.dash-greeting-text h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--dark);
    margin: 0 0 4px;
}

.dash-greeting-text p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
    font-weight: 500;
}

.dash-name {
    background: linear-gradient(135deg, var(--teal), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dash-kpi-row {
    display: flex;
    gap: 16px;
}

.dash-kpi {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 16px 24px;
    text-align: center;
    min-width: 100px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.dash-kpi:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.dash-kpi-num {
    display: block;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--teal);
    line-height: 1;
}

.dash-kpi-warn .dash-kpi-num {
    color: var(--gold);
}

.dash-kpi-danger .dash-kpi-num {
    color: var(--red);
}

.dash-kpi-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Sections */
.dash-section {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(var(--primary-rgb), 0.14);
    border-radius: 22px;
    padding: 24px 28px;
    box-shadow: 0 8px 30px rgba(10, 32, 40, 0.07);
}

.dash-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dash-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dash-section-title .material-symbols-outlined {
    font-size: 1.4rem;
    color: var(--teal);
}

.dash-section-title h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--dark);
    margin: 0;
}

.dash-count {
    background: var(--teal);
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
}

.dash-count-warn {
    background: var(--gold);
}

.dash-count-danger {
    background: var(--red);
}

.dash-section-link {
    background: none;
    border: none;
    color: var(--teal);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    padding: 6px 12px;
    border-radius: 10px;
}

.dash-section-link:hover {
    background: rgba(104, 176, 174, 0.1);
    transform: translateX(3px);
}

.dash-section-link .material-symbols-outlined {
    font-size: 1rem;
}

/* Empty State */
.dash-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.dash-empty .material-symbols-outlined {
    font-size: 2.5rem;
    opacity: 0.4;
    margin-bottom: 8px;
    display: block;
}

.dash-empty p {
    font-size: 0.9rem;
    margin: 0;
}

/* Citas de Hoy Grid */
.dash-citas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
}

.dash-cita-card {
    background: #ffffff;
    border: 1px solid rgba(var(--primary-rgb), 0.16);
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    align-items: stretch;
    gap: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 3px 12px rgba(10, 32, 40, 0.06);
}

.dash-cita-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-color: rgba(var(--teal-rgb), 0.3);
}

.dash-cita-card.cancelled {
    opacity: 0.72;
    border-color: rgba(var(--red-rgb), 0.2);
    background: rgba(255, 250, 250, 0.88);
}

.dash-cita-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    flex-shrink: 0;
    min-width: 90px;
    padding-right: 14px;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
}

.dash-cita-hora {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--primary-dark);
    white-space: nowrap;
}

.dash-cita-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
}

.dash-cita-nombre {
    font-size: 0.92rem;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
}

.dash-cita-servicio {
    font-size: 0.8rem;
    color: #33565C;
    font-weight: 500;
}

.dash-cita-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
    max-width: 130px;
}

.dash-cita-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
}

.dash-cita-action {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    border: 1px solid rgba(104, 176, 174, 0.35);
    background: rgba(104, 176, 174, 0.08);
    color: var(--teal);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dash-cita-action:hover {
    background: rgba(104, 176, 174, 0.18);
    border-color: var(--teal);
    transform: scale(1.07);
}

.dash-cita-action.cancel {
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(var(--red-rgb), 0.08);
    color: var(--red);
}

.dash-cita-action.cancel:hover {
    background: rgba(248, 113, 113, 0.18);
    border-color: var(--red);
    transform: scale(1.07);
}

.dash-cita-action.confirm {
    border-color: rgba(22, 163, 74, 0.35);
    background: rgba(22, 163, 74, 0.08);
    color: #16a34a;
}

.dash-cita-action.confirm:hover {
    background: rgba(22, 163, 74, 0.18);
    border-color: #16a34a;
    transform: scale(1.07);
}

.dash-cita-action:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.dash-cita-clinica {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #256d62;
    background: rgba(var(--primary-rgb), 0.14);
    padding: 3px 8px;
    border-radius: 8px;
    white-space: nowrap;
}

.dash-cita-personal {
    font-size: 0.73rem;
    color: #55707a;
    display: flex;
    align-items: center;
    gap: 3px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.dash-cita-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.dash-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
}

.dash-badge-ok {
    background: rgba(var(--success-rgb), 0.12);
    color: var(--green);
}

.dash-badge-pend {
    background: rgba(180, 83, 9, 0.14);
    color: #9A3412;
}

.dash-badge-paid {
    background: rgba(var(--success-rgb), 0.1);
    color: var(--green);
}

.dash-badge-cancel {
    background: rgba(var(--red-rgb), 0.12);
    color: var(--red);
}

.dash-badge-reagendar {
    background: rgba(180, 83, 9, 0.14);
    color: #9A3412;
    white-space: nowrap;
}

.dash-section-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: -4px 0 10px;
}

/* Pendientes de Confirmar */
.dash-pendientes-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dash-pend-date-label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--primary-dark);
    padding: 12px 0 6px;
    border-top: 1px solid rgba(10, 32, 40, 0.08);
    margin-top: 6px;
}

.dash-pend-date-label:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

.dash-pend-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid rgba(var(--primary-rgb), 0.14);
    transition: all 0.2s ease;
}

.dash-pend-row:hover {
    border-color: rgba(var(--primary-rgb), 0.35);
    box-shadow: 0 4px 12px rgba(10, 32, 40, 0.07);
}

.dash-pend-time {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--primary-dark);
    min-width: 75px;
    white-space: nowrap;
}

.dash-pend-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dash-pend-info strong {
    font-size: 0.9rem;
    color: var(--dark);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-pend-info span {
    font-size: 0.76rem;
    color: #33565C;
}

.dash-pend-phone {
    font-size: 0.82rem;
    color: var(--dark);
    font-weight: 600;
    min-width: 120px;
    text-align: right;
}

.dash-btn-sms {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--teal), #4fa8a6);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(var(--teal-rgb), 0.3);
}

.dash-btn-sms:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(var(--teal-rgb), 0.4);
    filter: brightness(1.05);
}

.dash-btn-sms:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.dash-btn-sms .material-symbols-outlined {
    font-size: 1rem;
}

/* Acciones extra en Pendientes de Confirmar: reprogramar / cancelar */
.dash-pend-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dash-pend-action {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 10px;
    border: 1px solid rgba(var(--primary-rgb), 0.35);
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dash-pend-action:hover:not(:disabled) {
    background: rgba(var(--primary-rgb), 0.18);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.dash-pend-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.dash-pend-action.danger {
    border-color: rgba(var(--red-rgb), 0.35);
    background: rgba(var(--red-rgb), 0.08);
    color: var(--red);
}

.dash-pend-action.danger:hover:not(:disabled) {
    background: rgba(var(--red-rgb), 0.18);
    border-color: var(--red);
}

.dash-pend-action .material-symbols-outlined {
    font-size: 1.15rem;
}

/* Low Stock Inventory */
.dash-inv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.dash-inv-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(239, 68, 68, 0.12);
    border-left: 3px solid var(--red);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.03);
}

.dash-inv-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.dash-inv-card img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.dash-inv-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.dash-inv-info strong {
    font-size: 0.88rem;
    color: var(--dark);
    font-weight: 700;
}

.dash-inv-alert {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--red);
    font-weight: 600;
}

.dash-inv-alert .material-symbols-outlined {
    font-size: 0.9rem;
}

.dash-inv-alert small {
    color: var(--text-muted);
    font-weight: 500;
}

/* Dashboard Responsive */
@media (max-width: 768px) {
    .dash-container {
        padding: 16px;
        gap: 20px;
    }

    .dash-greeting {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px 24px;
    }

    .dash-kpi-row {
        width: 100%;
        justify-content: space-between;
    }

    .dash-kpi {
        flex: 1;
        padding: 12px 10px;
        min-width: auto;
    }

    .dash-kpi-num {
        font-size: 1.4rem;
    }

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

    .dash-pend-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .dash-pend-phone {
        display: none;
    }

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

/* ===================== STAFF VIEWS ===================== */
.mobile-only-staff {
    display: none !important;
}

@media (max-width: 768px) {
    .desktop-only-nav {
        display: none !important;
    }
}

.staff-view-header {
    margin-bottom: 20px;
}

.staff-view-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark);
    margin: 0;
}

.staff-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    max-width: 500px;
}

@media (max-width: 768px) {
    .staff-card {
        max-width: none;
    }
}

/* =========================================
   MOBILE RESPONSIVE DESIGN (GLOBAL)
   ========================================= */
@media (max-width: 768px) {

    /* --- Root & Layout Bounds --- */
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    .app-layout {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }

    /* --- Sidebar & Layout --- */
    .sidebar {
        transform: translateX(-100%) !important;
        width: 280px !important;
        /* slightly wider on mobile to fit touch targets */
        z-index: 9999 !important;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar.mobile-open {
        transform: translateX(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
        display: flex !important;
    }

    /* Evita que el menu empuje el usuario/boton de cerrar sesion fuera de la pantalla */
    .sidebar .sidebar-nav {
        flex: 0 1 auto !important;
        overflow-y: visible !important;
    }

    .sidebar .sidebar-logo {
        padding: 0.75rem !important;
        flex-shrink: 0;
    }

    .sidebar .logo-sidebar {
        max-height: 70px !important;
    }

    .sidebar .sidebar-user,
    .sidebar .sidebar-version {
        flex-shrink: 0;
    }

    .sidebar .sidebar-user {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-backdrop.active {
        display: block;
        opacity: 1;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        padding-top: 56px !important;
    }

    .mobile-only-staff {
        display: flex !important;
    }

    .view {
        padding: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    /* --- Dashboard Mobile Streamlined View --- */
    .dash-greeting,
    .dash-section:not(.dash-section-citas-hoy) {
        display: none !important;
    }

    .dash-container {
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        gap: 12px !important;
    }

    .dash-section {
        padding: 16px 14px !important;
        border-radius: 18px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin: 0 !important;
    }

    .dash-section-header {
        margin-bottom: 12px !important;
        padding-bottom: 10px !important;
    }

    .dash-citas-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* --- Dashboard Card Mobile Layout --- */
    .dash-cita-card {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 14px !important;
        gap: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
        border-radius: 14px !important;
    }

    .dash-cita-left {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 6px 10px !important;
        min-width: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 8px !important;
        border-right: none !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
        width: 100% !important;
    }

    .dash-cita-hora {
        font-size: 1.05rem !important;
        font-weight: 800 !important;
        margin-right: 4px !important;
    }

    .dash-cita-clinica {
        font-size: 0.68rem !important;
        padding: 2px 6px !important;
    }

    .dash-cita-personal {
        font-size: 0.72rem !important;
        margin-left: auto !important;
    }

    .dash-cita-badges {
        width: 100% !important;
        margin-top: 2px !important;
    }

    .dash-cita-body {
        width: 100% !important;
        min-width: 0 !important;
        padding: 2px 0 !important;
        gap: 4px !important;
    }

    .dash-cita-nombre {
        font-size: 0.95rem !important;
        font-weight: 700 !important;
        white-space: normal !important;
        word-break: break-word !important;
        line-height: 1.3 !important;
    }

    .dash-cita-servicio {
        font-size: 0.82rem !important;
        white-space: normal !important;
        word-break: break-word !important;
        color: var(--text-muted) !important;
    }

    .dash-cita-actions {
        flex-direction: row !important;
        justify-content: flex-end !important;
        align-self: flex-end !important;
        width: 100% !important;
        padding-top: 8px !important;
        border-top: 1px dashed rgba(0, 0, 0, 0.06) !important;
        gap: 8px !important;
    }

    .dash-cita-action {
        width: 38px !important;
        height: 38px !important;
        border-radius: 10px !important;
    }

    /* --- Hamburger Button --- */
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 12px;
        left: 16px;
        z-index: 900;
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: var(--white);
        border: 1px solid var(--border-light);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        color: var(--primary-dark);
        cursor: pointer;
        transition: var(--transition);
    }

    .hamburger-btn:active {
        transform: scale(0.95);
        background: var(--bg);
    }

    .hamburger-btn .material-symbols-outlined {
        font-size: 1.5rem;
    }

    /* Hide version info on mobile wrapper unless in menu */
    .sidebar-version {
        font-size: 0.75rem;
        padding: 16px;
    }

    .page-login .hamburger-btn {
        display: none;
    }

    /* --- General Touch Improvements --- */
    .btn,
    .nav-item,
    .ms-option,
    .dp-footer-link {
        min-height: 44px;
        /* Minimum touch target iOS */
    }

    /* --- Clientes View --- */
    .clientes-layout {
        grid-template-columns: 1fr;
        /* Stack columns */
        min-height: auto;
    }

    #cliente-detail-panel {
        max-height: none;
    }

    .dp-info-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns instead of 4 */
    }

    /* --- Cita del Día --- */
    .cd-grid-top {
        grid-template-columns: 1fr;
    }

    .cd-grid-bottom {
        grid-template-columns: 1fr;
    }

    .cd-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-cita-finalizar,
    .btn-cita-pagar {
        width: 100%;
        justify-content: center;
    }

    /* --- Agenda Cards --- */
    .agenda-row-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .arc-time {
        width: 100%;
        text-align: left;
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        padding-bottom: 8px;
    }

    .arc-details {
        flex-direction: column;
        /* Stack details vertically */
        gap: 8px;
    }

    .arc-badges {
        flex-wrap: wrap;
        /* Ensure badges don't overflow */
    }

    .arc-actions {
        width: 100%;
        justify-content: flex-end;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        padding-top: 12px;
        margin-top: 8px;
    }

    /* --- Modals & Medidas Form --- */
    .modal {
        max-width: calc(100% - 32px);
        margin: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
        /* Stack form rows (e.g. Medidas) */
    }
}

/* Hamburger hidden on desktop (a partir de 1025px, donde vuelve el sidebar fijo) */
@media (min-width: 1025px) {

    .hamburger-btn,
    .sidebar-backdrop {
        display: none !important;
    }
}

/* ===== CLIENT APPOINTMENT POPUP STYLES ===== */
.apt-card {
    background: #ffffff;
    border: 1px solid #eef2f6;
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.apt-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-color: var(--primary-glow);
    transform: translateY(-2px);
}

.apt-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.apt-date-box {
    display: flex;
    flex-direction: column;
}

.apt-date {
    font-weight: 700;
    color: var(--carbon);
    font-size: 0.95rem;
}

.apt-time {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
    margin-top: 2px;
}

.apt-status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.70rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-pendiente { background: #fff7ed; color: #c2410c; border: 1px solid #ffedd5; }
.status-confirmada { background: #f0fdf4; color: #15803d; border: 1px solid #dcfce7; }
.status-cancelada { background: #fef2f2; color: #b91c1c; border: 1px solid #fee2e2; }

.apt-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px;
    background: var(--bg);
    border-radius: 10px;
}

.apt-detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.apt-detail-label {
    font-size: 0.65rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
}

.apt-detail-value {
    font-size: 0.82rem;
    color: #334155;
    font-weight: 500;
}

.apt-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.apt-btn-action {
    flex: 1;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-apt-confirm {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #dcfce7;
}
.btn-apt-confirm:hover { background: #dcfce7; }

.btn-apt-unconfirm {
    background: #fff7ed;
    color: #d97706;
    border-color: #ffedd5;
}
.btn-apt-unconfirm:hover { background: #ffedd5; }

.btn-apt-cancel {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fee2e2;
}
.btn-apt-cancel:hover { background: #fee2e2; }

.btn-apt-edit {
    background: #eff6ff;
    color: #2563eb;
    border-color: #dbeafe;
}
.btn-apt-edit:hover { background: #dbeafe; }

/* ===== AJUSTES ===== */
.ajustes-wrapper {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ajustes-page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.ajustes-page-header-icon {
    width: 52px;
    height: 52px;
    background: rgba(var(--primary-rgb), 0.1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ajustes-page-header-icon .material-symbols-outlined {
    font-size: 1.6rem;
    color: var(--primary);
}

.ajustes-page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 3px;
    letter-spacing: -0.3px;
}

.ajustes-page-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* Section blocks */
.ajustes-block {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 0;
    border-bottom: 1px solid var(--border);
    padding: 2rem 0;
}

.ajustes-block:last-child { border-bottom: none; }

.ajustes-block-label {
    padding-right: 2rem;
    padding-top: 0.25rem;
}

.ajustes-block-label-icon {
    width: 38px;
    height: 38px;
    background: rgba(var(--primary-rgb), 0.08);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.ajustes-block-label-icon .material-symbols-outlined {
    font-size: 1.2rem;
    color: var(--primary);
}

.ajustes-block-label h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
}

.ajustes-block-label p {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.ajustes-block-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

/* Legacy compatibility — redirect old classes */
.ajustes-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Oficinas */
.oficinas-lista {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.oficina-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.9rem;
    font-weight: 500;
    color: var(--text);
    transition: border-color 0.15s;
}

.oficina-item:hover { border-color: var(--primary); }

.oficina-item .material-symbols-outlined {
    color: var(--primary);
    font-size: 1rem;
}

.oficina-nombre { flex: 1; font-size: 0.875rem; }

.oficina-add-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.ajustes-input {
    flex: 1;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.ajustes-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.btn-primary-sm {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.6rem 1rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}
.btn-primary-sm:hover { background: var(--primary-dark); }
.btn-primary-sm:active { transform: scale(0.98); }
.btn-primary-sm .material-symbols-outlined { font-size: 0.95rem; }

.btn-icon-sm {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background 0.15s;
    background: transparent;
    flex-shrink: 0;
}
.btn-icon-sm.danger { color: var(--red); }
.btn-icon-sm.danger:hover { background: rgba(239,68,68,0.1); }
.btn-icon-sm .material-symbols-outlined { font-size: 1rem; }

/* Themes */
.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

.theme-card {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.theme-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.theme-card.active {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.06);
    box-shadow: 0 0 0 1px var(--primary), var(--shadow-md);
}

.theme-preview {
    display: flex;
    gap: 5px;
    align-items: center;
    margin-bottom: 2px;
}

.theme-color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.theme-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.theme-nombre {
    font-size: 0.83rem;
    font-weight: 700;
    color: var(--text);
}

.theme-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.theme-check {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1rem;
    color: var(--primary);
    opacity: 0;
    transition: opacity 0.2s;
}
.theme-card.active .theme-check { opacity: 1; }

/* Logo / Favicon */
.logo-favicon-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 900px) {
    .ajustes-block {
        grid-template-columns: 1fr;
    }
    .ajustes-block-label {
        padding-right: 0;
        padding-bottom: 1rem;
    }
}

@media (max-width: 600px) {
    .logo-favicon-grid { grid-template-columns: 1fr; }
    .themes-grid { grid-template-columns: repeat(2, 1fr); }
    .serv-grid { grid-template-columns: 1fr !important; }
}

.logo-upload-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1.25rem;
    background: var(--bg);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s;
}
.logo-upload-card:hover { border-color: var(--primary); }

.upload-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
    text-align: center;
}

.logo-preview-box {
    width: 110px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    overflow: hidden;
}
.logo-preview-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.favicon-box { width: 72px; height: 72px; }

.btn-upload {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-upload:hover { background: var(--primary-dark); }
.btn-upload .material-symbols-outlined { font-size: 0.95rem; }

.upload-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 0;
    text-align: center;
}

/* ===== SERVICIOS AJUSTES ===== */
.serv-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.serv-categoria {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.serv-cat-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(var(--primary-rgb), 0.04);
}

.serv-cat-header .material-symbols-outlined {
    font-size: 1rem;
    color: var(--primary);
}

.serv-cat-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    flex: 1;
}

.serv-cat-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.1);
    border-radius: 99px;
    padding: 2px 8px;
}

.serv-lista {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
}

.serv-lista::-webkit-scrollbar { width: 4px; }
.serv-lista::-webkit-scrollbar-track { background: transparent; }
.serv-lista::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.serv-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 6px;
    padding: 0.38rem 0.5rem;
    font-size: 0.82rem;
    color: var(--text);
    transition: background 0.12s;
}

.serv-item:hover { background: var(--bg-card); }

.serv-item .material-symbols-outlined:first-child {
    font-size: 0.9rem;
    color: var(--border);
    cursor: grab;
    flex-shrink: 0;
}

.serv-nombre { flex: 1; line-height: 1.3; }

.serv-add-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.6rem;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.serv-add-row .ajustes-input {
    font-size: 0.8rem;
    padding: 0.45rem 0.7rem;
    background: var(--bg);
}

.serv-add-row .btn-primary-sm {
    padding: 0.45rem 0.7rem;
    font-size: 0.78rem;
}

/* Custom theme card */
.theme-card-custom .theme-custom-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--primary-rgb), 0.12);
    border-radius: 50%;
}
.theme-card-custom .theme-custom-icon .material-symbols-outlined {
    font-size: 1rem;
    color: var(--primary);
}
.theme-card-custom { border-style: dashed; }
.theme-card-custom:hover { border-style: solid; }
.theme-card-custom.active { border-style: solid; }

/* ===== CUSTOM COLOR EDITOR ===== */
.custom-colors-panel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.custom-colors-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(var(--primary-rgb), 0.04);
}

.custom-colors-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.custom-colors-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}

.btn-reset-colors {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s;
}
.btn-reset-colors:hover { border-color: var(--primary); color: var(--primary); }
.btn-reset-colors .material-symbols-outlined { font-size: 0.9rem; }

.custom-color-group {
    padding: 0.75rem 1.1rem;
    border-bottom: 1px solid var(--border-light);
}
.custom-color-group:last-child { border-bottom: none; }

.custom-color-group-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
}

.custom-color-fields {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.custom-color-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    transition: background 0.12s;
}
.custom-color-row:hover { background: var(--bg-card); }

.color-swatch-live {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 2px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
    transition: transform 0.15s;
}
.custom-color-row:hover .color-swatch-live { transform: scale(1.08); }

.color-field-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.color-field-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-field-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-picker-input {
    -webkit-appearance: none;
    appearance: none;
    width: 38px;
    height: 38px;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 2px;
    background: var(--bg-card);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s, transform 0.15s;
}
.color-picker-input:hover { border-color: var(--primary); transform: scale(1.05); }
.color-picker-input::-webkit-color-swatch-wrapper { padding: 0; border-radius: 4px; overflow: hidden; }
.color-picker-input::-webkit-color-swatch { border: none; border-radius: 4px; }

/* ===== QR CAMERA MODAL ===== */
.qr-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1200000;
}

.qr-modal-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1200001;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 440px;
    overflow: hidden;
    animation: qr-slide-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes qr-slide-in {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.qr-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
}

.qr-modal-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.qr-modal-icon {
    font-size: 1.75rem;
    color: var(--primary);
}

.qr-modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 2px;
}

.qr-modal-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
}

.qr-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    transition: background 0.15s;
    flex-shrink: 0;
}
.qr-close-btn:hover { background: var(--bg); }
.qr-close-btn .material-symbols-outlined { font-size: 1.1rem; }

.qr-modal-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* QR code wrapper with corner decorations */
.qr-code-wrapper {
    position: relative;
    padding: 12px;
    background: #fff;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: inline-block;
}

.qr-corner {
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: var(--primary);
    border-style: solid;
}
.qr-tl { top: 4px; left: 4px; border-width: 2px 0 0 2px; border-radius: 3px 0 0 0; }
.qr-tr { top: 4px; right: 4px; border-width: 2px 2px 0 0; border-radius: 0 3px 0 0; }
.qr-bl { bottom: 4px; left: 4px; border-width: 0 0 2px 2px; border-radius: 0 0 0 3px; }
.qr-br { bottom: 4px; right: 4px; border-width: 0 2px 2px 0; border-radius: 0 0 3px 0; }

/* Steps */
.qr-steps {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
}

.qr-step {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-xs);
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s;
}

.qr-step-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}

.qr-step.active {
    background: rgba(var(--primary-rgb), 0.07);
    color: var(--text);
}

.qr-step.active .qr-step-num {
    background: var(--primary);
    color: #fff;
}

.qr-step.done .qr-step-num {
    background: rgba(var(--success-rgb), 0.15);
    color: var(--green);
}

/* Status pill */
.qr-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    border-radius: 99px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--text-secondary);
    width: 100%;
    justify-content: center;
}

.qr-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.qr-status-waiting .qr-status-dot {
    background: #f59e0b;
    animation: qr-blink 1.2s ease-in-out infinite;
}

.qr-status-connected .qr-status-dot { background: #3b82f6; animation: qr-blink 0.8s ease-in-out infinite; }
.qr-status-received .qr-status-dot  { background: var(--green); animation: none; }
.qr-status-error .qr-status-dot     { background: var(--red); animation: none; }

@keyframes qr-blink {
    0%,100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

/* URL copy row */
.qr-url-copy {
    display: flex;
    gap: 0.4rem;
    width: 100%;
}

.qr-url-input {
    flex: 1;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    background: var(--bg);
    color: var(--text-muted);
    outline: none;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qr-copy-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--bg);
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}
.qr-copy-btn:hover { background: rgba(var(--primary-rgb), 0.08); }
.qr-copy-btn .material-symbols-outlined { font-size: 0.95rem; }

/* ===== Terminal & Device Authorization Styles ===== */
.device-auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.device-auth-box {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 24px;
    padding: 36px 30px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.6);
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.device-auth-icon {
    width: 68px;
    height: 68px;
    border-radius: 20px;
    background: linear-gradient(135deg, #eab308, #ca8a04);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    color: white;
    box-shadow: 0 10px 25px rgba(234, 179, 8, 0.3);
}

.device-auth-icon span {
    font-size: 36px;
}

.device-auth-title {
    color: #f8fafc;
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.device-auth-desc {
    color: #94a3b8;
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.device-auth-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    text-align: left;
    font-weight: 600;
}





/* ==========================================================================
   ===== RESPONSIVE v5.5 — Celulares, Tablets y Foldables (Galaxy Z Fold) ====
   Puntos de corte:
     <= 1280px  laptop pequeña / tablet horizontal
     <= 1024px  tablet: se oculta el sidebar y aparece la barra inferior
     <=  900px  Fold desplegado / tablet vertical / celular horizontal
     <=  640px  celular
     <=  400px  pantalla de portada del Fold / celular pequeño
   ========================================================================== */

/* --- Anti-desbordamiento horizontal global --- */
html, body { max-width: 100%; overflow-x: hidden; }
img, video, canvas, svg { max-width: 100%; height: auto; }
.view, .main-content { min-width: 0; }

/* --- Tablet horizontal / laptop pequeña --- */
@media (max-width: 1280px) {
    .view { padding: 1.5rem; }
    .asignar-layout { grid-template-columns: minmax(240px, 32%) minmax(280px, 1fr); }
    .asignar-summary-panel { grid-column: 1 / -1; }
    .clientes-layout { grid-template-columns: 260px 1fr; }
}

/* --- Tablet: sidebar fuera, barra inferior dentro --- */
@media (max-width: 1024px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
    .bottom-nav { display: block; }
    .login-container { margin-left: 0; }

    /* La barra inferior puede tener muchos items: se desliza en horizontal */
    .bottom-nav-inner {
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0 4px;
    }
    .bottom-nav-inner::-webkit-scrollbar { display: none; }
    .bottom-nav .nav-item { flex: 0 0 auto; min-width: 64px; min-height: 48px; }

    .asignar-layout { grid-template-columns: 1fr 1fr; }
    .asignar-summary-panel { grid-column: 1 / -1; }
    .dp-info-grid { grid-template-columns: repeat(2, 1fr); }
    .cd-edit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .inv-kpi-strip { grid-template-columns: repeat(2, 1fr); }
    .dp-main-content { padding: 1.5rem; }
}

/* --- Fold desplegado / tablet vertical / celular horizontal --- */
@media (max-width: 900px) {
    .view { padding: 1.25rem; }

    /* Encabezados y controles apilados */
    .agenda-header,
    .asignar-header,
    .inv-header,
    .ajustes-page-header { flex-wrap: wrap; gap: 0.75rem; }

    .agenda-filters,
    .asignar-controls-row,
    .clientes-toolbar { flex-wrap: wrap; }

    .agenda-filters > *,
    .asignar-controls-row > * { flex: 1 1 auto; min-width: 140px; }

    /* Tablas: deslizan en horizontal en vez de romper el layout */
    table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* El panel de detalle del cliente cubre la pantalla */
    #cliente-detail-panel { padding-bottom: env(safe-area-inset-bottom, 0px); }
    .dp-main-content { padding: 1.25rem; }

    /* Formularios de 2+ columnas escritos con estilos en línea */
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
}

/* --- Celular --- */
@media (max-width: 640px) {
    .view { padding: 1rem 0.85rem; }

    /* Modales a pantalla casi completa */
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .modal-header { position: sticky; top: 0; z-index: 5; background: var(--white); }
    .modal-body { padding: 1rem; }

    /* Una sola columna en todo lo que sea rejilla fija */
    .asignar-layout,
    .clientes-layout,
    .ajustes-block { grid-template-columns: 1fr !important; }
    .dp-info-grid,
    .cd-edit-grid,
    .inv-kpi-strip,
    .themes-grid { grid-template-columns: repeat(2, 1fr) !important; }

    .asignar-controls-row > *,
    .agenda-filters > * { min-width: 100%; }

    /* Objetivos táctiles cómodos */
    .btn, .btn-icon, .nav-item, select, input, textarea { min-height: 44px; }
    .btn-icon-sm { min-width: 36px; min-height: 36px; }

    /* Evita el zoom automático de iOS al enfocar un campo */
    input, select, textarea { font-size: 16px; }

    .dp-main-content { padding: 1rem; }
    .dp-header-actions { width: 100%; }
    .dp-header-actions .btn { flex: 1; }

    /* Calendario compacto */
    .cal-day { min-height: 42px; }
    .cal-weekdays > * { font-size: 0.65rem; }

    /* Tarjetas de agenda / asignar en vertical */
    .agenda-row-card,
    .asignar-agenda-card { flex-direction: column; align-items: stretch; gap: 0.6rem; }
    .aac-time { flex-direction: row; align-items: center; gap: 8px; }
}

/* --- Pantalla de portada del Fold / celular pequeño --- */
@media (max-width: 400px) {
    .view { padding: 0.75rem 0.6rem; }
    .dp-main-content, .modal-body { padding: 0.85rem; }

    .dp-info-grid,
    .cd-edit-grid,
    .inv-kpi-strip,
    .themes-grid,
    .medida-values { grid-template-columns: 1fr !important; }

    .bottom-nav .nav-item { min-width: 58px; font-size: 0.6rem; padding: 6px 4px; }
    .bottom-nav .nav-item .material-symbols-outlined { font-size: 1.2rem; }

    .dp-client-name { font-size: 1.15rem; }
    .cal-day { min-height: 36px; padding: 2px; }
    .cal-day-num { font-size: 0.62rem; }

}

/* --- Foldables desplegados: casi cuadrados y anchos --- */
@media (min-width: 641px) and (max-width: 1024px) and (min-aspect-ratio: 3/4) {
    .clientes-layout { grid-template-columns: 250px 1fr; }
    #cliente-detail-panel { position: static; display: flex; inset: auto; border-radius: var(--radius); max-height: calc(100vh - 4rem); }
    .dp-info-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- Dispositivos de doble pantalla (a ambos lados de la bisagra) --- */
@media (horizontal-viewport-segments: 2) {
    .clientes-layout,
    .asignar-layout { grid-template-columns: 1fr; }
    .modal { max-width: 92vw; }
}

/* --- Alturas muy bajas (Flip abierto a medias, celular horizontal) --- */
@media (max-height: 480px) and (orientation: landscape) {
    .modal { max-height: 96vh; }
    .bottom-nav { padding: 2px 0 env(safe-area-inset-bottom, 2px); }
    .bottom-nav .nav-item { min-height: 40px; font-size: 0.58rem; }
    .main-content { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
}

/* --- Zonas seguras (notch / isla dinámica) --- */
@supports (padding: max(0px)) {
    .main-content { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
}

/* ==========================================================================
   ===== RESPONSIVE v5.5 — Correcciones de desbordamiento ===================
   Causa raíz: los hijos de grid/flex tienen min-width:auto y no se encogen.
   ========================================================================== */

@media (max-width: 1024px) {
    /* Todo lo que viva dentro de una vista puede encogerse */
    .view,
    .view > *,
    .view [class*="-layout"] > *,
    .view [class*="-panel"],
    .view [class*="-grid"],
    .view [class*="-toolbar"],
    .view [class*="-header"],
    .modal-body > * { min-width: 0; max-width: 100%; }

    /* Filas de controles escritas con estilos en línea */
    .view [style*="display: flex"]:not([style*="flex-direction: column"]),
    .view [style*="display:flex"]:not([style*="flex-direction:column"]) { flex-wrap: wrap; }

    /* Anchos fijos en línea (buscadores, paneles) */
    .view [style*="width: 320px"],
    .view [style*="width:320px"],
    .view [style*="width: 300px"],
    .view [style*="width: 280px"],
    .view [style*="width: 240px"] { width: 100% !important; }

    /* Clientes */
    .clientes-layout > *,
    .clientes-gallery-panel,
    .clientes-toolbar,
    #clientes-grid,
    #cliente-detail-panel { min-width: 0; max-width: 100%; }
    .clientes-toolbar { flex-wrap: wrap; }
    .clientes-toolbar > input,
    .clientes-toolbar > .form-input { flex: 1 1 100%; }
    .clientes-toolbar > select,
    .clientes-toolbar > .form-select { flex: 1 1 auto; }

    /* Tarjeta de cliente: que el bloque de acciones no empuje */
    .client-card { min-width: 0; }
    .client-card-info { min-width: 0; overflow: hidden; }

    /* Ajustes */
    .ajustes-block > *,
    .ajustes-block-label,
    .ajustes-block-content,
    .oficinas-lista,
    .oficina-item,
    .oficina-add-row { min-width: 0; max-width: 100%; }
    .oficina-add-row { flex-wrap: wrap; }
    .oficina-add-row > input { flex: 1 1 100%; }

    /* Nómina y Contabilidad */
    .nomina-layout,
    .conta-layout { grid-template-columns: 1fr !important; }
    .nomina-history-panel,
    .nomina-main-panel,
    #nomina-empty-selection { min-width: 0; max-width: 100%; }
    .no-print { flex-wrap: wrap; }
    .no-print > .btn { flex: 1 1 auto; }

    /* Tiras de KPI escritas en línea */
    .view [style*="grid-template-columns: repeat(4"],
    .view [style*="grid-template-columns:repeat(4"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .view [style*="grid-template-columns: repeat(3"],
    .view [style*="grid-template-columns:repeat(3"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 400px) {
    .view [style*="grid-template-columns: repeat(4"],
    .view [style*="grid-template-columns:repeat(4"],
    .view [style*="grid-template-columns: repeat(3"],
    .view [style*="grid-template-columns:repeat(3"] { grid-template-columns: 1fr !important; }

    .client-card { padding: 10px 12px; column-gap: 10px; grid-template-columns: 38px minmax(0, 1fr) auto; }
    .client-card-avatar { width: 38px; height: 38px; }
}

/* --- Últimos ajustes finos para pantallas muy angostas --- */
@media (max-width: 1024px) {
    /* Rejillas con mínimo fijo (tarjetas de personal, etc.) */
    .view [style*="minmax(360px"],
    .view [style*="minmax(340px"],
    .view [style*="minmax(320px"],
    .view [style*="minmax(300px"],
    .view [style*="minmax(280px"] { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)) !important; }

    /* Calendario */
    .cal-container { padding: 1.25rem; border-radius: 20px; }
    #cal-header { gap: 0.75rem; margin-bottom: 1.25rem; padding-bottom: 1rem; }
    #cal-header h3 { min-width: 0; flex: 1; font-size: 1.05rem; letter-spacing: 0; }
}

@media (max-width: 640px) {
    .cal-container { padding: 0.85rem; border-radius: 16px; }
    #cal-header h3 { font-size: 0.95rem; }
    /* Tarjetas con relleno grande en línea */
    .view [style*="padding: 20px"] { padding: 14px !important; }
    .view [style*="padding: 24px"] { padding: 16px !important; }
}

@media (max-width: 640px) {
    .view [style*="minmax(360px"],
    .view [style*="minmax(340px"],
    .view [style*="minmax(320px"],
    .view [style*="minmax(300px"],
    .view [style*="minmax(280px"] { grid-template-columns: 1fr !important; }
}

/* --- Contenido de los modales en pantallas pequeñas --- */
@media (max-width: 640px) {
    /* Algunos modales no usan la clase .modal, sino un id que termina en -modal */
    .modal [style*="display: flex"]:not([style*="flex-direction: column"]),
    .modal [style*="display:flex"]:not([style*="flex-direction:column"]),
    [id$="-modal"] [style*="display: flex"]:not([style*="flex-direction: column"]),
    [id$="-modal"] [style*="display:flex"]:not([style*="flex-direction:column"]) { flex-wrap: wrap; }

    .modal [style*="flex-direction: row"],
    [id$="-modal"] [style*="flex-direction: row"] { flex-direction: column !important; align-items: stretch !important; }
    .modal [style*="flex-direction: row"] > *,
    [id$="-modal"] [style*="flex-direction: row"] > * { width: 100%; }

    /* Botonera de la foto de perfil: fila con botones que se encogen */
    #pers-photo-preview ~ div [style*="flex-wrap: wrap"],
    #cf-photo-preview ~ div [style*="flex-wrap: wrap"] { flex-direction: row !important; }
    [id$="-modal"] [style*="flex-wrap: wrap"] > button { flex: 1 1 auto; min-width: 0; }

    /* Tarjeta de foto de perfil: avatar arriba, botones abajo en fila */
    #pers-photo-preview,
    #cf-photo-preview { align-self: center; }
    #pers-photo-preview + div,
    #pers-photo-preview ~ div { align-items: stretch; text-align: center; }
    .modal [style*="flex-wrap: wrap"] > button { flex: 1 1 auto; min-width: 0; }

    /* Rejillas de 2 columnas dentro de modales */
    .modal [style*="grid-template-columns: 1fr 1fr"],
    .modal [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
    .modal [style*="grid-template-columns: repeat(2"],
    .modal [style*="grid-template-columns: repeat(3"],
    .modal [style*="grid-template-columns: repeat(4"] { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }

    .modal [style*="padding: 24px"] { padding: 14px !important; }
    .modal [style*="padding: 20px"] { padding: 12px !important; }
    .modal * { min-width: 0; }

    [id$="-modal"] [style*="grid-template-columns: 1fr 1fr"],
    [id$="-modal"] [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
    [id$="-modal"] [style*="padding: 24px"] { padding: 14px !important; }
    [id$="-modal"] [style*="padding: 20px"] { padding: 12px !important; }
    [id$="-modal"] * { min-width: 0; }
    /* Paneles de modal con ancho fijo escrito en linea */
    [id$="-modal"] [style*="width: 620px"],
    [id$="-modal"] [style*="width: 600px"],
    [id$="-modal"] [style*="width: 560px"],
    [id$="-modal"] [style*="width: 520px"],
    [id$="-modal"] [style*="width: 480px"] { width: 100% !important; max-width: 100% !important; }
    [id$="-modal"] { padding: 12px !important; }
}

/* --- Menu deslizable tambien en tablets (769px a 1024px) --- */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        width: 300px;
        z-index: 9999;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
        transition: transform 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
        display: flex !important;
        visibility: visible;
        opacity: 1;
    }
    .sidebar .sidebar-nav { flex: 0 1 auto; }
    .sidebar .sidebar-user,
    .sidebar .sidebar-version { flex-shrink: 0; }
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    .sidebar-backdrop.active { display: block; opacity: 1; }
    .hamburger-btn { display: flex; }
}

/* ===== Módulo Promociones ===== */
#view-promociones .promo-toolbar,
#view-contactos .promo-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  justify-content: space-between; margin: 16px 0 20px;
}
#view-promociones .promo-filters,
#view-contactos .promo-filters { display: flex; flex-wrap: wrap; gap: 8px; }
#view-promociones .promo-filter-btn,
#view-contactos .promo-filter-btn {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border, #e2e8f0);
  background: #fff; color: var(--text-muted, #64748b); font-weight: 600;
  font-size: .84rem; cursor: pointer; transition: all .15s;
}
#view-promociones .promo-filter-btn:hover,
#view-contactos .promo-filter-btn:hover { border-color: var(--primary, #14b8a6); }
#view-promociones .promo-filter-btn.active,
#view-contactos .promo-filter-btn.active {
  background: var(--primary, #14b8a6); border-color: var(--primary, #14b8a6); color: #fff;
}

.promo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.promo-card {
  background: #fff; border: 1px solid var(--border, #e2e8f0); border-radius: 16px;
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.promo-card-flyer { position: relative; background: #f1f5f9; aspect-ratio: 16 / 10; overflow: hidden; }
.promo-card-flyer img { width: 100%; height: 100%; object-fit: cover; display: block; }
.promo-badge {
  position: absolute; top: 10px; left: 10px; padding: 4px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 800; letter-spacing: .04em; color: #fff; text-transform: uppercase;
}
.promo-badge-borrador   { background: #94a3b8; }
.promo-badge-activa     { background: #16a34a; }
.promo-badge-pausada    { background: #d97706; }
.promo-badge-finalizada { background: #64748b; }

.promo-card-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.promo-card-name { font-size: 1rem; color: var(--text, #0f172a); line-height: 1.3; }
.promo-card-stats { display: flex; gap: 14px; font-size: .82rem; color: var(--text-muted, #64748b); }
.promo-card-stats span { display: inline-flex; align-items: center; gap: 4px; }
.promo-card-stats .material-symbols-outlined { font-size: 16px; }
.promo-card-dates { display: flex; flex-direction: column; gap: 2px; font-size: .76rem; color: var(--text-muted, #64748b); }
.promo-card-url {
  font-size: .76rem; color: var(--primary, #14b8a6); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.promo-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.promo-card-actions .btn { flex: 1 1 auto; }
.promo-card-actions .btn .material-symbols-outlined { font-size: 15px; }
.promo-card-actions .promo-del { flex: 0 0 auto; color: #dc2626; }

.promo-flyer-field { margin: 6px 0 4px; }
.promo-flyer-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.promo-switch { display: flex !important; align-items: center; gap: 8px; font-weight: 600 !important;
  font-size: .9rem; cursor: pointer; text-transform: none !important; letter-spacing: normal !important; }
.promo-switch input { width: auto; }

.promo-test-banner {
  display: flex; align-items: flex-start; gap: 8px; background: #fef3c7; color: #92400e;
  border: 1px solid #fcd34d; border-radius: 10px; padding: 10px 12px; font-size: .82rem;
  font-weight: 600; margin-bottom: 12px;
}
.promo-test-banner .material-symbols-outlined { font-size: 18px; }

.promo-phone-frame {
  width: 390px; max-width: 100%; height: 640px; margin: 0 auto;
  border: 10px solid #1e293b; border-radius: 32px; overflow: hidden; background: #000;
}
.promo-phone-frame iframe { width: 100%; height: 100%; border: 0; background: #fff; }

@media (max-width: 640px) {
  .promo-phone-frame { height: 70vh; }
}

/* =====================================================================
   Integración con el website (modelo Lumière)
   - Badge "Web" en citas reservadas desde el website (citas.Origen = 'Web')
   - Pantalla "Mensajes web" (tabla contactos_web)
   ===================================================================== */
.cita-badge-web,
.dash-badge-web {
    background: rgba(var(--primary-rgb, 46, 138, 124), 0.12);
    color: var(--primary-dark, #1F5F57);
    white-space: nowrap;
}

.nav-item .nav-badge {
    margin-left: auto;
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--gold, #C9A24B);
    color: #1c1c1c;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
}

.cw-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 24px;
}

.cw-card {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
    border-radius: 14px;
    padding: 16px 18px;
}

.cw-card.cw-new {
    border-left: 4px solid var(--gold, #C9A24B);
}

.cw-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.cw-head > div {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cw-name {
    font-size: 1rem;
    color: var(--text, #1c1c1c);
}

.cw-date {
    font-size: 0.78rem;
    color: var(--text-muted, #64748b);
}

.cw-msg {
    margin: 10px 0 8px;
    color: var(--text-secondary, #334155);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.cw-contact {
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
    overflow-wrap: anywhere;
}

.cw-contact a {
    color: var(--primary-dark, #1F5F57);
}

.cw-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.cw-actions .cw-del {
    margin-left: auto;
}

.cw-done {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    color: var(--green, #10b981);
    font-weight: 600;
}

.cw-done .material-symbols-outlined {
    font-size: 16px;
}

/* =====================================================================
   Evaluación facial (js/evaluacion_facial.js)
   Modal a pantalla completa: paciente | mapa del rostro | zona, resumen abajo.
   Usa las variables del tema elegido en Ajustes.
   ===================================================================== */
body.ef-open { overflow: hidden; }
.ef-modal {
    position: fixed; inset: 0; z-index: 1000500; overflow-y: auto;
    background: var(--bg, #f4f7f6); color: var(--text, #1c1c1c);
}
.ef-modal.hidden { display: none; }
.ef-shell { max-width: 1440px; margin: 0 auto; padding: 16px 20px 0; min-height: 100%; display: flex; flex-direction: column; gap: 14px; }
.ef-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--border, rgba(0,0,0,.08)); }
.ef-top h2 { margin: 0; font-size: 1.45rem; font-weight: 700; }
.ef-top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ef-icon-btn {
    display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
    border: 1px solid var(--border, rgba(0,0,0,.1)); background: var(--bg-card, #fff); color: var(--text, #1c1c1c); cursor: pointer;
}
.ef-icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.ef-date { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 12px; background: var(--bg-card, #fff); border: 1px solid var(--border, rgba(0,0,0,.1)); font-size: .9rem; font-weight: 600; }
.ef-date .material-symbols-outlined { font-size: 18px; color: var(--primary); }
.ef-date input { border: 0; background: transparent; font: inherit; color: inherit; }
.ef-badge { font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.ef-badge-ok { background: rgba(var(--success-rgb, 16,185,129), .14); color: var(--green, #059669); }
.ef-badge-draft { background: rgba(var(--gold-rgb, 212,175,55), .18); color: #8a6a14; }

.ef-body { display: grid; grid-template-columns: 290px minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.ef-left, .ef-center, .ef-right, .ef-summary {
    background: var(--bg-card, #fff); border: 1px solid var(--border, rgba(0,0,0,.08)); border-radius: 18px; padding: 16px;
}
.ef-h { margin: 0 0 12px; font-size: 1.02rem; font-weight: 700; }
.ef-muted { color: var(--text-muted, #64748b); font-size: .88rem; margin: 0; }
.ef-patient { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--border, rgba(0,0,0,.08)); }
.ef-patient strong { display: block; font-size: 1rem; }
.ef-patient span { font-size: .82rem; color: var(--text-muted, #64748b); }
.ef-avatar { width: 58px; height: 58px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; display: grid; place-items: center; background: rgba(var(--primary-rgb), .12); color: var(--primary); font-weight: 700; font-size: 1.1rem; }
.ef-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ef-fields { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 20px; }
.ef-fields label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 600; color: var(--text-secondary, #334155); }
.ef-fields label > span { display: inline-flex; align-items: center; gap: 6px; }
.ef-fields .material-symbols-outlined { font-size: 17px; color: var(--primary); }
.ef-fields select, .ef-fields input, .ef-right textarea, .ef-summary textarea {
    width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border, rgba(0,0,0,.12));
    background: var(--bg-card, #fff); font: inherit; font-size: .9rem; color: var(--text, #1c1c1c);
}
.ef-right textarea, .ef-summary textarea { resize: vertical; }
.ef-hist { display: flex; flex-direction: column; gap: 6px; }
.ef-hist-item, .ef-hist-new {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 8px 10px; border-radius: 12px;
    border: 1px solid var(--border, rgba(0,0,0,.08)); background: transparent; cursor: pointer; font: inherit; color: inherit; text-align: left;
}
.ef-hist-item.active { border-color: var(--primary); background: rgba(var(--primary-rgb), .08); }
.ef-hist-date { font-weight: 700; font-size: .88rem; }
.ef-hist-meta { font-size: .76rem; color: var(--text-muted, #64748b); }
.ef-hist-new { flex-direction: row; align-items: center; justify-content: center; color: var(--primary); font-weight: 600; border-style: dashed; }
.ef-por { margin-top: 12px; }

.ef-map-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ef-tabs { display: inline-flex; padding: 4px; border-radius: 12px; background: rgba(var(--primary-rgb), .07); }
.ef-tabs button { border: 0; background: transparent; padding: 8px 16px; border-radius: 9px; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; color: var(--text-secondary, #334155); }
.ef-tabs button.active { background: var(--bg-card, #fff); color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.ef-map-hint { font-size: .8rem; color: var(--text-muted, #64748b); }
.ef-map { display: flex; justify-content: center; }
.ef-svg { width: 100%; max-width: 470px; height: auto; display: block; }
.ef-svg-frontal, .ef-svg-lateral { max-width: 540px; border-radius: 14px; }
.ef-draw path, .ef-draw circle { fill: none; stroke: #7d8d89; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ef-draw .ef-hair { fill: rgba(125, 141, 137, .10); stroke-width: 1.2; }
.ef-zone {
    fill: rgba(var(--primary-rgb), .03); stroke: rgba(var(--primary-rgb), .7); stroke-width: 1.4; stroke-dasharray: 5 4;
    cursor: pointer; transition: fill .2s, stroke .2s; outline: none;
}
.ef-zone:hover, .ef-zone:focus-visible { fill: rgba(var(--primary-rgb), .16); stroke-dasharray: none; }
.ef-zone.has-data { fill: rgba(var(--primary-rgb), .18); stroke: var(--primary); stroke-dasharray: none; }
.ef-zone.has-data[data-grado="Severo"] { fill: rgba(var(--primary-rgb), .32); }
.ef-zone.has-data[data-grado="Leve"] { fill: rgba(var(--primary-rgb), .11); }
.ef-zone.selected { stroke: var(--text, #1c1c1c); stroke-width: 2.6; stroke-dasharray: none; fill: rgba(var(--primary-rgb), .24); }
.ef-label { font-weight: 600; fill: var(--text-secondary, #334155); text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 3px; }
.ef-sides { display: flex; justify-content: space-between; max-width: 540px; margin: 4px auto 0; font-size: .74rem; color: var(--text-muted, #64748b); }

.ef-zone-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ef-zone-head .ef-h { margin: 0; }
.ef-card { border: 1px solid var(--border, rgba(0,0,0,.08)); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.ef-card h4, .ef-summary h4 { margin: 0 0 10px; font-size: .9rem; font-weight: 700; }
.ef-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.ef-checks-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ef-checks-1 { grid-template-columns: 1fr; }
.ef-check { display: flex; align-items: flex-start; gap: 8px; font-size: .86rem; cursor: pointer; line-height: 1.3; }
.ef-modal .ef-check input { width: 17px; height: 17px; min-height: 0; margin: 1px 0 0; accent-color: var(--primary); flex: 0 0 auto; }
.ef-show-sm { display: none; }
.ef-segs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ef-seg, .ef-chip {
    padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border, rgba(0,0,0,.12)); background: var(--bg-card, #fff);
    font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; color: var(--text-secondary, #334155);
}
.ef-seg.active, .ef-chip.active { background: rgba(var(--primary-rgb), .14); border-color: var(--primary); color: var(--primary-dark, var(--primary)); }
.ef-photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ef-photo { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: #eee; }
.ef-photo img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.ef-photo-del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; cursor: pointer; }
.ef-photo-del .material-symbols-outlined { font-size: 16px; }
.ef-photo-add {
    position: relative; aspect-ratio: 4 / 3; border-radius: 10px; border: 1.5px dashed var(--border, rgba(0,0,0,.2)); display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 4px; font-size: .82rem; color: var(--text-muted, #64748b); cursor: pointer;
}
.ef-photo-add:hover { border-color: var(--primary); color: var(--primary); }
.ef-photo-add input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ef-zone-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ef-zone-list button { width: 100%; text-align: left; padding: 9px 11px; border-radius: 12px; border: 1px solid var(--border, rgba(0,0,0,.08)); background: transparent; cursor: pointer; font: inherit; color: inherit; }
.ef-zone-list button:hover { border-color: var(--primary); }
.ef-zone-list strong { display: block; font-size: .88rem; }
.ef-zone-list span { font-size: .8rem; color: var(--text-muted, #64748b); }

.ef-summary-grid { display: grid; grid-template-columns: 1.1fr 1.1fr .9fr; gap: 22px; }
.ef-summary-grid > div + div { border-left: 1px solid var(--border, rgba(0,0,0,.08)); padding-left: 22px; }
.ef-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.ef-h4-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ef-link { border: 0; background: none; color: var(--primary); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; padding: 0; }
.ef-summary textarea { margin-bottom: 14px; }

.ef-foot {
    position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    padding: 12px 0 16px; background: linear-gradient(to top, var(--bg, #f4f7f6) 75%, transparent);
}
.ef-foot-right { display: flex; gap: 8px; margin-left: auto; }
.ef-readonly input:disabled, .ef-readonly select:disabled, .ef-readonly textarea:disabled { background: transparent; color: var(--text, #1c1c1c); opacity: 1; }
.ef-readonly .ef-seg:disabled, .ef-readonly .ef-chip:disabled { cursor: default; }
.ef-readonly .ef-seg:not(.active):disabled, .ef-readonly .ef-chip:not(.active):disabled { opacity: .45; }

.ef-lightbox { position: fixed; inset: 0; z-index: 1000600; background: rgba(0,0,0,.82); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.ef-lightbox.hidden { display: none; }
.ef-lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

/* Botón en el formulario de cliente */
.ef-form-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 10px; padding: 12px; border-radius: 12px; background: rgba(var(--primary-rgb), .07); }
.ef-form-cta p { margin: 0; font-size: .84rem; color: var(--text-secondary, #334155); flex: 1 1 260px; }

/* Resumen en el panel de detalle del cliente */
#ef-resumen-cliente { margin-top: .6rem; }
.ef-cta-empty { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px; border-radius: 14px; border: 1.5px dashed rgba(var(--primary-rgb), .35); }
.ef-cta-empty > .material-symbols-outlined { font-size: 30px; color: var(--primary); }
.ef-cta-empty div { flex: 1 1 200px; display: flex; flex-direction: column; }
.ef-cta-empty div span { font-size: .82rem; color: var(--text-muted, #64748b); }
.ef-last { padding: 14px; border-radius: 14px; border: 1px solid var(--border, rgba(0,0,0,.08)); background: var(--bg-card, #fff); }
.ef-last-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ef-last-head strong { display: block; }
.ef-last-head span { font-size: .8rem; color: var(--text-muted, #64748b); }
.ef-last-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ef-last-list { margin: 10px 0 0; padding-left: 18px; font-size: .86rem; }
.ef-last-list li::marker { color: var(--primary); }
.ef-last-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ef-last-tags span { font-size: .76rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: rgba(var(--primary-rgb), .1); color: var(--primary-dark, var(--primary)); }
.ef-last-hist { margin-top: 10px; font-size: .85rem; }
.ef-last-hist summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.ef-last-hist button { display: flex; justify-content: space-between; gap: 10px; width: 100%; padding: 7px 0; border: 0; border-bottom: 1px solid var(--border, rgba(0,0,0,.06)); background: none; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.ef-last-hist button span:last-child { color: var(--text-muted, #64748b); font-size: .8rem; }

@media (max-width: 1180px) {
    .ef-body { grid-template-columns: 260px minmax(0, 1fr); }
    .ef-right { grid-column: 1 / -1; }
    .ef-summary-grid { grid-template-columns: 1fr 1fr; }
    .ef-summary-grid > div:nth-child(3) { grid-column: 1 / -1; border-left: 0; padding-left: 0; border-top: 1px solid var(--border, rgba(0,0,0,.08)); padding-top: 14px; }
    .ef-checks-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .ef-shell { padding: 10px 12px 0; }
    .ef-top h2 { font-size: 1.15rem; }
    .ef-top-actions { margin-left: 0; width: 100%; }
    .ef-body { grid-template-columns: minmax(0, 1fr); }
    .ef-center { order: -1; }
    .ef-tabs { display: flex; width: 100%; }
    .ef-tabs button { flex: 1 1 0; padding: 8px 6px; font-size: .8rem; }
    .ef-map-hint { display: none; }
    .ef-summary-grid { grid-template-columns: minmax(0, 1fr); }
    .ef-summary-grid > div + div { border-left: 0; padding-left: 0; border-top: 1px solid var(--border, rgba(0,0,0,.08)); padding-top: 14px; }
    .ef-checks-3, .ef-checks-1 { grid-template-columns: 1fr 1fr; }
    .ef-foot { flex-wrap: nowrap; gap: 8px; padding: 10px 0 12px; }
    .ef-foot-right { flex: 1 1 auto; }
    .ef-foot-right .btn { flex: 1 1 auto; }
    .ef-foot .ef-cancel, .ef-hide-sm { display: none; }
    .ef-show-sm { display: inline; }
}
