:root,
html[data-theme="light"] {
    --primary: #1588d1;
    --primary-dark: #0c5ca8;
    --secondary: #0f172a;

    --sadi-blue: #1588d1;
    --sadi-blue-dark: #0c5ca8;
    --sadi-blue-soft: rgba(21, 136, 209, 0.12);

    --sadi-green: #7ed321;
    --sadi-green-dark: #5fb117;
    --sadi-green-soft: rgba(126, 211, 33, 0.14);

    --bg-main: #f4fbff;
    --bg-card: #ffffff;
    --bg-soft: #eef7fb;
    --bg-topbar: rgba(255, 255, 255, 0.94);

    --text-main: #18324a;
    --text-soft: #5d7388;
    --text-sidebar-soft: rgba(255, 255, 255, 0.76);

    --border-soft: #d9e8f2;
    --shadow-soft: 0 10px 30px rgba(16, 55, 92, 0.08);

    --sidebar-bg: linear-gradient(180deg, #0b3f71 0%, #082746 100%);
    --sidebar-width: 238px;
    --sidebar-collapsed-width: 84px;

    --radius-xl: 18px;
    --radius-lg: 14px;
}

html[data-theme="dark"] {
    --primary: #4cb2ee;
    --primary-dark: #1588d1;
    --secondary: #e5f3fb;

    --sadi-blue: #4cb2ee;
    --sadi-blue-dark: #1588d1;
    --sadi-blue-soft: rgba(76, 178, 238, 0.14);

    --sadi-green: #9eea40;
    --sadi-green-dark: #7ed321;
    --sadi-green-soft: rgba(158, 234, 64, 0.12);

    --bg-main: #07131f;
    --bg-card: #0e1d2c;
    --bg-soft: #13283b;
    --bg-topbar: rgba(14, 29, 44, 0.94);

    --text-main: #f1f8fc;
    --text-soft: #a8bfd0;
    --text-sidebar-soft: rgba(255, 255, 255, 0.74);

    --border-soft: #20384d;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.22);

    --sidebar-bg: linear-gradient(180deg, #071929 0%, #04111d 100%);
}

* {
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
}

body.dashboard-body {
    margin: 0;
    background: linear-gradient(180deg, #f4fbff 0%, #edf7fc 100%);
    color: var(--text-main);
    font-family: "Inter", "Segoe UI", sans-serif;
    transition: background 0.25s ease, color 0.25s ease;
}

html[data-theme="dark"] body.dashboard-body {
    background: linear-gradient(180deg, #07131f 0%, #0a1826 100%);
}

.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    padding: 1rem 0.85rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1050;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.28s ease, transform 0.28s ease, padding 0.28s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
    margin: 8px 0;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.28);
    background-clip: content-box;
}

/* AJUSTE: se elimina la barra superior que aparecía arriba del logo */
.sidebar::before,
.sidebar::after {
    content: "";
    position: sticky;
    left: 0;
    right: 0;
    display: block;
    height: 14px;
    z-index: 1;
    pointer-events: none;
}

.sidebar::before {
    display: none;
    top: 0;
    background: none;
}

.sidebar::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(8, 39, 70, 0.98), rgba(8, 39, 70, 0));
}

html[data-theme="dark"] .sidebar::before {
    display: none;
    background: none;
}

html[data-theme="dark"] .sidebar::after {
    background: linear-gradient(to top, rgba(4, 17, 29, 0.98), rgba(4, 17, 29, 0));
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.35rem;
    padding: 0.15rem 0.2rem 0.35rem;
    position: relative;
    z-index: 3;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    color: #fff;
    overflow: hidden;
    min-width: 0;
    padding: 0.2rem 0.1rem;
    transition: transform 0.2s ease;
    flex: 1;
}

.sidebar-brand strong {
    font-size: 1.1rem;
    line-height: 1.1;
    display: block;
}

.sidebar-brand small {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    margin-top: 0.12rem;
}

.brand-mark {
    position: relative;
    width: 46px;
    height: 46px;
    min-width: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 26px rgba(21, 136, 209, 0.24);
}

.brand-mark-bg {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--sadi-blue) 15%, var(--sadi-green) 100%);
}

.brand-mark i {
    position: relative;
    z-index: 1;
    color: #fff;
    font-size: 1.15rem;
}

.brand-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-name {
    display: block;
    font-size: 1.22rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.brand-tagline {
    display: block;
    margin-top: 0.18rem;
    font-size: 0.78rem;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-collapse-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transition: 0.2s ease;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    display: inline-flex;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    padding-bottom: 1rem;
}

.brand-logo-image-wrap {
    width: 46px;
    height: 46px;
    min-width: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: rgba(255,255,255,0.06);
    overflow: hidden;
}

.brand-logo-image {
    width: 100%;
    height: auto;
    max-height: 64px;
    object-fit: contain;
}

.menu-title {
    font-size: 0.74rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.46);
    margin-top: 1.15rem;
    margin-bottom: 0.5rem;
    padding: 0 0.9rem;
    letter-spacing: 0.08em;
    font-weight: 800;
}

.menu-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    padding: 0.86rem 0.95rem;
    border-radius: 15px;
    transition: background 0.22s ease, transform 0.18s ease, color 0.2s ease, box-shadow 0.22s ease;
    font-weight: 600;
    overflow: hidden;
    min-width: 0;
    min-height: 48px;
}

.menu-link::before {
    content: "";
    position: absolute;
    left: 0.35rem;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 4px;
    height: 60%;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--sadi-green), var(--sadi-blue));
    transition: transform 0.2s ease;
}

.menu-link i {
    font-size: 1.05rem;
    min-width: 20px;
    text-align: center;
    transition: transform 0.2s ease, color 0.2s ease;
}

.menu-text {
    display: inline-block;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-link:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
    transform: translateX(2px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.menu-link:hover::before,
.menu-link.active::before {
    transform: translateY(-50%) scaleY(1);
}

.menu-link:hover i {
    transform: scale(1.08);
    color: #b8f36a;
}

.menu-link.active {
    background: linear-gradient(90deg, rgba(21, 136, 209, 0.22), rgba(126, 211, 33, 0.10));
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(126, 211, 33, 0.12);
}

.menu-link.active i {
    color: #b8f36a;
}

.has-submenu {
    justify-content: space-between;
}

.has-submenu > span {
    min-width: 0;
}

.submenu-arrow {
    font-size: 0.85rem;
    opacity: 0.85;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.has-submenu:hover .submenu-arrow {
    opacity: 1;
}

.has-submenu[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

.submenu-wrapper {
    padding-left: 0.55rem;
    margin-top: 0.22rem;
    margin-bottom: 0.5rem;
    margin-left: 0.95rem;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.submenu-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.74);
    padding: 0.68rem 0.85rem;
    margin: 0.18rem 0 0.18rem 0.35rem;
    border-radius: 12px;
    font-size: 0.93rem;
    font-weight: 500;
    min-height: 42px;
    transition: background 0.2s ease, color 0.2s ease, transform 0.18s ease;
}

.submenu-link i {
    font-size: 0.95rem;
    opacity: 0.8;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.submenu-link span {
    line-height: 1.2;
}

.submenu-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(2px);
}

.submenu-link:hover i {
    transform: scale(1.08);
    opacity: 1;
}

.submenu-link.active {
    background: rgba(21, 136, 209, 0.16);
    color: #ffffff;
}

.main-panel {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.28s ease, width 0.28s ease;
}

.topbar {
    min-height: 72px;
    background: var(--bg-topbar);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    flex-wrap: wrap;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
}

.topbar-right {
    margin-left: auto;
}

.page-heading {
    min-width: 0;
}

.page-title {
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.page-subtitle,
.text-muted,
small.text-muted {
    color: var(--text-soft) !important;
}

.icon-btn,
.menu-toggle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s ease;
    cursor: pointer;
}

.icon-btn:hover,
.menu-toggle:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.profile-chip {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 0.32rem 0.75rem 0.32rem 0.38rem;
    min-width: 0;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sadi-blue), var(--sadi-green));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.profile-text {
    min-width: 0;
}

.profile-dropdown .dropdown-toggle::after {
    display: none;
}

.profile-chip-btn {
    cursor: pointer;
    transition: 0.2s ease;
}

.profile-chip-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.profile-menu {
    min-width: 240px;
    border-radius: 16px;
    padding: 0.5rem 0;
    background: var(--bg-card);
    border: 1px solid var(--border-soft) !important;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    color: var(--text-main);
}

.profile-menu-item:hover {
    background: var(--bg-soft);
    color: var(--text-main);
}

.profile-avatar-sm {
    width: 34px;
    height: 34px;
    min-width: 34px;
    font-size: 0.9rem;
}

.content-area {
    padding: 1rem;
    min-width: 0;
}

.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    padding: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.25s ease, border-color 0.25s ease;
}

.floating-card:hover {
    transform: translateY(-2px);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-height: 92px;
    padding: 0.95rem 1rem;
}

.stat-icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    transition: transform 0.2s ease;
}

.dashboard-card:hover .stat-icon {
    transform: scale(1.04);
}

.bg-soft-primary {
    background: var(--sadi-blue-soft);
    color: var(--sadi-blue);
}

.bg-soft-success {
    background: var(--sadi-green-soft);
    color: var(--sadi-green-dark);
}

.bg-soft-warning {
    background: rgba(245, 158, 11, 0.14);
    color: #f59e0b;
}

.bg-soft-danger {
    background: rgba(239, 68, 68, 0.13);
    color: #ef4444;
}

.stat-label {
    margin-bottom: 0.2rem;
    color: var(--text-soft);
    font-size: 0.88rem;
}

.stat-value {
    margin-bottom: 0.12rem;
    font-weight: 800;
    font-size: 1.55rem;
    color: var(--text-main);
    line-height: 1.1;
}

.alert-modern {
    border: none;
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 36, 58, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: 0.2s ease;
    z-index: 1040;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

.fade-in-content {
    animation: fadeSlideIn 0.35s ease;
}

/* Formularios CRUD */
.form-control,
.form-select,
.input-group-text,
textarea {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-soft);
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.2s ease;
}

.form-control::placeholder,
textarea::placeholder {
    color: var(--text-soft);
    opacity: 0.85;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
    background: var(--bg-card);
    color: var(--text-main);
    border-color: rgba(21, 136, 209, 0.45);
    box-shadow: 0 0 0 0.2rem rgba(21, 136, 209, 0.14);
}

.form-label {
    color: var(--text-main);
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .input-group-text,
html[data-theme="dark"] textarea {
    background: #102233;
    color: #f1f8fc;
    border-color: #284156;
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #8ea8bb;
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] textarea:focus {
    background: #102233;
    color: #ffffff;
    border-color: #4cb2ee;
    box-shadow: 0 0 0 0.2rem rgba(76, 178, 238, 0.16);
}

html[data-theme="dark"] .border-top {
    border-color: var(--border-soft) !important;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Catálogo visual SaDi */
.sadi-hero {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(126, 211, 33, 0.16), transparent 28%),
        radial-gradient(circle at bottom left, rgba(21, 136, 209, 0.18), transparent 30%),
        linear-gradient(135deg, rgba(21, 136, 209, 0.04), rgba(126, 211, 33, 0.05)),
        var(--bg-card);
    border: 1px solid rgba(21, 136, 209, 0.10);
}

.sadi-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(21, 136, 209, 0.14), rgba(126, 211, 33, 0.16));
    color: var(--sadi-blue-dark);
    font-size: 0.85rem;
    font-weight: 700;
}

.sadi-btn-primary {
    background: linear-gradient(90deg, var(--sadi-blue), var(--sadi-green));
    border: none;
    color: #fff;
    box-shadow: 0 8px 22px rgba(21, 136, 209, 0.22);
}

.sadi-btn-primary:hover {
    background: linear-gradient(90deg, var(--sadi-blue-dark), var(--sadi-green-dark));
    color: #fff;
    transform: translateY(-1px);
}

.sadi-btn-soft {
    background: var(--sadi-blue-soft);
    border: 1px solid rgba(21, 136, 209, 0.16);
    color: var(--sadi-blue-dark);
}

.sadi-btn-soft:hover {
    background: rgba(21, 136, 209, 0.18);
    color: var(--sadi-blue-dark);
}

.sadi-btn-outline {
    border: 1px solid rgba(21, 136, 209, 0.22);
    color: var(--sadi-blue-dark);
    background: transparent;
}

.sadi-btn-outline:hover {
    background: rgba(21, 136, 209, 0.08);
    color: var(--sadi-blue-dark);
}

.plan-card {
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    padding: 1.2rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.plan-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.10);
}

.plan-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    border-radius: 22px 0 0 22px;
}

.plan-card-blue::before {
    background: linear-gradient(180deg, var(--sadi-blue), var(--sadi-blue-dark));
}

.plan-card-green::before {
    background: linear-gradient(180deg, var(--sadi-green), var(--sadi-green-dark));
}

.plan-card-icon {
    width: 54px;
    height: 54px;
    min-width: 54px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.plan-card-icon.blue {
    background: var(--sadi-blue-soft);
    color: var(--sadi-blue);
}

.plan-card-icon.green {
    background: var(--sadi-green-soft);
    color: var(--sadi-green-dark);
}

.plan-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.42rem 0.82rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.plan-pill.blue {
    background: var(--sadi-blue-soft);
    color: var(--sadi-blue-dark);
}

.plan-pill.green {
    background: var(--sadi-green-soft);
    color: var(--sadi-green-dark);
}

.plan-price-wrap {
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(21, 136, 209, 0.04), rgba(126, 211, 33, 0.05));
    border: 1px solid rgba(21, 136, 209, 0.08);
}

.plan-price {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
}

.plan-description {
    color: var(--text-soft);
    line-height: 1.55;
    min-height: 70px;
}

.empty-state {
    max-width: 460px;
    margin: 0 auto;
}

.empty-state-icon {
    width: 74px;
    height: 74px;
    margin: 0 auto;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(21, 136, 209, 0.12), rgba(126, 211, 33, 0.14));
    color: var(--sadi-blue);
    font-size: 1.9rem;
}

.tooltip-inner {
    background: #0b243a;
    color: #fff;
    font-size: 0.85rem;
    padding: 0.45rem 0.65rem;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(11, 36, 58, 0.18);
}

.tooltip.bs-tooltip-end .tooltip-arrow::before {
    border-right-color: #0b243a;
}

.tooltip.bs-tooltip-start .tooltip-arrow::before {
    border-left-color: #0b243a;
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
    border-top-color: #0b243a;
}

.tooltip.bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: #0b243a;
}

/* Dark refinements */
html[data-theme="dark"] .dashboard-card,
html[data-theme="dark"] .profile-chip,
html[data-theme="dark"] .icon-btn,
html[data-theme="dark"] .menu-toggle,
html[data-theme="dark"] .profile-menu {
    color: #e5f3fb;
}

html[data-theme="dark"] .dashboard-card h1,
html[data-theme="dark"] .dashboard-card h2,
html[data-theme="dark"] .dashboard-card h3,
html[data-theme="dark"] .dashboard-card h4,
html[data-theme="dark"] .dashboard-card h5,
html[data-theme="dark"] .dashboard-card h6,
html[data-theme="dark"] .dashboard-card strong {
    color: #f8fdff !important;
}

html[data-theme="dark"] .dashboard-card p,
html[data-theme="dark"] .dashboard-card span,
html[data-theme="dark"] .dashboard-card small,
html[data-theme="dark"] .dashboard-card li,
html[data-theme="dark"] .dashboard-card td,
html[data-theme="dark"] .dashboard-card th {
    color: #c7d8e5;
}

html[data-theme="dark"] .sadi-hero {
    background:
        radial-gradient(circle at top right, rgba(126, 211, 33, 0.12), transparent 28%),
        radial-gradient(circle at bottom left, rgba(21, 136, 209, 0.15), transparent 30%),
        linear-gradient(135deg, rgba(21, 136, 209, 0.05), rgba(126, 211, 33, 0.04)),
        var(--bg-card);
    border-color: rgba(96, 165, 250, 0.10);
}

html[data-theme="dark"] .sadi-badge {
    background: linear-gradient(90deg, rgba(21, 136, 209, 0.16), rgba(126, 211, 33, 0.14));
    color: #d8f4ff;
}

html[data-theme="dark"] .sadi-btn-soft {
    background: rgba(21, 136, 209, 0.12);
    border-color: rgba(21, 136, 209, 0.16);
    color: #d8f4ff;
}

html[data-theme="dark"] .sadi-btn-soft:hover {
    background: rgba(21, 136, 209, 0.18);
    color: #ffffff;
}

html[data-theme="dark"] .sadi-btn-outline {
    border-color: rgba(96, 165, 250, 0.18);
    color: #d8f4ff;
}

html[data-theme="dark"] .sadi-btn-outline:hover {
    background: rgba(96, 165, 250, 0.10);
    color: #ffffff;
}

html[data-theme="dark"] .plan-price-wrap {
    background: linear-gradient(135deg, rgba(21, 136, 209, 0.08), rgba(126, 211, 33, 0.06));
    border-color: rgba(96, 165, 250, 0.10);
}

/* Collapsed desktop */
.dashboard-wrapper.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    padding-left: 0.6rem;
    padding-right: 0.6rem;
}

.dashboard-wrapper.sidebar-collapsed .main-panel {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

.dashboard-wrapper.sidebar-collapsed .brand-text,
.dashboard-wrapper.sidebar-collapsed .menu-title,
.dashboard-wrapper.sidebar-collapsed .menu-text,
.dashboard-wrapper.sidebar-collapsed .submenu-wrapper,
.dashboard-wrapper.sidebar-collapsed .submenu-arrow {
    display: none !important;
}

.dashboard-wrapper.sidebar-collapsed .sidebar-header {
    justify-content: center;
}

.dashboard-wrapper.sidebar-collapsed .menu-link {
    justify-content: center;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.dashboard-wrapper.sidebar-collapsed .has-submenu {
    justify-content: center;
}

.menu-toggle {
    display: none !important;
}

.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(126, 211, 33, 0.12), transparent 22%),
        radial-gradient(circle at bottom left, rgba(21, 136, 209, 0.14), transparent 24%),
        linear-gradient(180deg, var(--bg-main) 0%, var(--bg-soft) 100%);
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-container {
    width: 100%;
    max-width: 1100px;
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 28px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.auth-panel {
    padding: 2rem;
}

.auth-panel-brand {
    background:
        radial-gradient(circle at top right, rgba(126, 211, 33, 0.12), transparent 25%),
        radial-gradient(circle at bottom left, rgba(21, 136, 209, 0.14), transparent 26%),
        linear-gradient(135deg, rgba(21, 136, 209, 0.05), rgba(126, 211, 33, 0.05)),
        var(--bg-soft);
    border-right: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    padding-top: 2.5rem;
}

.auth-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 1.5rem;
}

.auth-brand img {
    max-width: 280px;
    width: 70%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.auth-title,
.auth-description,
.auth-benefits {
    width: 100%;
    max-width: 520px;
}

.auth-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 1rem;
    line-height: 1.15;
}

.auth-description {
    color: var(--text-soft);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.auth-benefits {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.auth-benefit {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text-main);
    font-weight: 500;
}

.auth-benefit i {
    color: var(--sadi-green);
}

.auth-form-header {
    margin-bottom: 1.5rem;
}

.auth-form-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.4rem;
}

.auth-form-subtitle {
    color: var(--text-soft);
    margin-bottom: 0;
}

.auth-input {
    min-height: 48px;
    border-radius: 14px;
}

.auth-check {
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: var(--bg-soft);
}

.auth-submit-btn {
    min-height: 48px;
    border-radius: 14px;
    font-weight: 700;
}

.auth-footer {
    margin-top: 1.25rem;
    text-align: center;
}

.auth-link {
    color: var(--sadi-blue);
    font-weight: 700;
    text-decoration: none;
    margin-left: 0.25rem;
}

.auth-link:hover {
    color: var(--sadi-blue-dark);
    text-decoration: underline;
}

.table-brand-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    color: var(--sadi-blue);
    font-size: 1rem;
}

.sadi-mini-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    color: var(--text-soft);
    font-weight: 600;
    font-size: 0.9rem;
}

.sadi-action-btn {
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 12px;
    padding: 0.45rem 0.7rem;
}

.sadi-action-btn:hover {
    background: var(--bg-soft);
    color: var(--text-main);
}

.sadi-dropdown-menu {
    border-radius: 16px;
    padding: 0.5rem 0;
    min-width: 220px;
}

.empty-state-wrap {
    max-width: 420px;
    margin: 0 auto;
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--text-soft);
    display: block;
    margin-bottom: 1rem;
}

.min-w-0 {
    min-width: 0;
}

.form-section-header {
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 1rem;
}

.sadi-form-section {
    position: relative;
}

.section-title-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    margin-bottom: 1.25rem;
}

.section-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.sadi-field-card {
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    padding: 1rem;
    height: 100%;
}

.sadi-input {
    min-height: 46px;
    border-radius: 14px;
}

.sadi-help-card {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1rem;
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    background: var(--bg-soft);
}

.sadi-help-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 12px;
    background: rgba(21, 136, 209, 0.10);
    color: var(--sadi-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.sadi-summary-box {
    padding: 1rem 1rem 1rem 1.1rem;
    border-radius: 18px;
    border: 1px dashed var(--border-soft);
    background: rgba(126, 211, 33, 0.06);
}

[data-theme="dark"] {
    --bs-body-bg: #0f172a;
    --bs-body-color: #e2e8f0;
    --bs-border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .doctor-page .table-doctors thead th {
    color: #94a3b8;
}



/* Responsive */
@media (max-width: 991.98px) {
    .menu-toggle {
        display: inline-flex !important;
    }

    .sidebar-collapse-btn {
        display: none !important;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 270px;
        max-width: 85vw;
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-panel {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .dashboard-wrapper.sidebar-collapsed .sidebar {
        width: 270px;
        max-width: 85vw;
    }

    .dashboard-wrapper.sidebar-collapsed .main-panel {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .topbar {
        padding: 0.75rem 1rem;
    }

    .topbar-right {
        gap: 0.55rem;
    }

    .profile-text {
        display: none;
    }

    .profile-menu {
        min-width: 220px;
    }

    .auth-container {
        grid-template-columns: 1fr;
    }

    .auth-panel-brand {
        border-right: none;
        border-bottom: 1px solid var(--border-soft);
    }
}

@media (max-width: 767.98px) {
    .topbar {
        min-height: auto;
        padding: 0.75rem 0.85rem;
    }

    .topbar-left,
    .topbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .topbar-right {
        margin-left: 0;
    }

    .page-title {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }

    .content-area {
        padding: 0.9rem;
    }

    .dashboard-card {
        padding: 0.95rem;
        border-radius: 16px;
    }

    .icon-btn,
    .menu-toggle {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }

    .auth-shell {
        padding: 1rem 0.75rem;
    }

    .auth-panel {
        padding: 1.25rem;
    }

    .auth-title {
        font-size: 1.5rem;
    }

    .auth-form-title {
        font-size: 1.3rem;
    }

    .auth-container {
        border-radius: 20px;
    }

    .sadi-field-card,
    .sadi-help-card,
    .sadi-summary-box {
        border-radius: 16px;
    }
}

/* =========================================================
   SADI UI KIT · MÓDULO MÉDICO
   Reutilizable para new / edit / show / index
========================================================= */

.sadi-page {
    --sadi-card-radius: 1.4rem;
    --sadi-soft-radius: 1rem;
    --sadi-shadow-soft: 0 10px 25px rgba(15, 23, 42, 0.05);
    --sadi-shadow-soft-lg: 0 12px 28px rgba(15, 23, 42, 0.06);
}

/* HERO */
.sadi-hero-card {
    border-radius: 1.6rem;
}

.sadi-hero-mini-card {
    border-radius: 1rem;
    border: 1px solid var(--border-soft);
    background: rgba(21, 136, 209, 0.04);
    padding: .95rem 1rem;
    height: 100%;
}

.sadi-hero-mini-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-soft);
    font-weight: 700;
    margin-bottom: .25rem;
}

.sadi-hero-mini-value {
    font-size: .98rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.25;
    word-break: break-word;
}

/* FORM CARDS */
.sadi-form-card {
    border-radius: 1.4rem;
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    box-shadow: var(--sadi-shadow-soft);
    height: 100%;
    overflow: hidden;
}

.sadi-form-card-header {
    padding: 1.25rem 1.4rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    background: linear-gradient(to bottom, rgba(21, 136, 209, .03), transparent);
}

.sadi-form-card-body {
    padding: 1.4rem;
}

.sadi-section-icon {
    width: 48px;
    height: 48px;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.sadi-section-icon.primary-soft {
    background: rgba(21, 136, 209, .10);
    color: var(--sadi-blue);
    border: 1px solid rgba(21, 136, 209, .14);
}

.sadi-section-icon.success-soft {
    background: rgba(126, 211, 33, .12);
    color: var(--sadi-green-dark);
    border: 1px solid rgba(126, 211, 33, .18);
}

/* FIELD WRAPS */
.sadi-field-wrap {
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: 1rem;
    padding: 1rem;
    height: 100%;
}

.sadi-field-wrap.field-readonly {
    background: rgba(108, 117, 125, .06);
    opacity: .96;
}

.sadi-field-wrap label {
    font-weight: 700;
    margin-bottom: .5rem;
    color: var(--text-main);
}

.sadi-field-help {
    margin-top: .45rem;
    font-size: .82rem;
    color: var(--text-soft);
}

.sadi-form-errors,
.sadi-form-errors .invalid-feedback,
.sadi-form-errors .form-error-message {
    display: block;
    margin-top: .45rem;
    font-size: .82rem;
    color: #dc3545;
}

/* PROFILE / SHOW */
.sadi-profile-card,
.sadi-info-card,
.sadi-tabs-card,
.sadi-list-card {
    border-radius: 1.45rem;
    border: 1px solid var(--border-soft);
    box-shadow: var(--sadi-shadow-soft-lg);
    background: var(--bg-card);
    overflow: hidden;
}

.sadi-profile-card {
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
}

.sadi-profile-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 135px;
    background: linear-gradient(to bottom, rgba(21, 136, 209, .08), transparent);
    pointer-events: none;
}

.sadi-profile-avatar-lg {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--sadi-blue), #00b4d8);
    box-shadow: 0 16px 30px rgba(21, 136, 209, .22);
}

.sadi-status-indicator {
    position: absolute;
    bottom: 6px;
    right: 4px;
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #22c55e;
}

.sadi-contact-item,
.sadi-detail-card,
.sadi-specialty-card {
    border-radius: 1rem;
    border: 1px solid var(--border-soft);
    background: var(--bg-soft);
}

.sadi-contact-item {
    display: flex;
    align-items: flex-start;
    gap: .9rem;
    padding: .95rem 1rem;
}

.sadi-detail-card {
    padding: 1rem 1.1rem;
    height: 100%;
}

.sadi-detail-card.primary-soft {
    background: rgba(21, 136, 209, .08);
    border-color: rgba(21, 136, 209, .12);
}

.sadi-specialty-card {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: .9rem;
    height: 100%;
    background: var(--bg-card);
}

/* TABS */
.sadi-tabs-header {
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    background: linear-gradient(to bottom, rgba(21, 136, 209, .03), transparent);
}

.sadi-pills {
    gap: .6rem;
}

.sadi-pills .nav-link {
    border-radius: .9rem;
    padding: .78rem 1.2rem;
    color: var(--text-soft);
    font-weight: 700;
    border: 1px solid transparent;
    transition: all .25s ease;
}

.sadi-pills .nav-link:hover {
    background-color: rgba(21, 136, 209, .06);
    color: var(--sadi-blue);
}

.sadi-pills .nav-link.active {
    background-color: var(--sadi-blue) !important;
    color: #fff !important;
    box-shadow: 0 10px 18px rgba(21, 136, 209, .18);
}

.sadi-tab-content {
    padding: 1.5rem;
}

/* LIST / TABLE */
.sadi-content-card-header {
    padding: 1.35rem 1.4rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    background: linear-gradient(to bottom, rgba(21, 136, 209, .03), transparent);
}

.sadi-toolbar-wrap {
    padding: 1rem 1.4rem;
    border-bottom: 1px solid var(--border-soft);
    background: var(--bg-soft);
}

.sadi-toolbar-chip {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem .9rem;
    border-radius: 999px;
    font-size: .84rem;
    font-weight: 600;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    color: var(--text-soft);
}

.sadi-table thead th {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-soft);
    white-space: nowrap;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.sadi-table tbody tr {
    transition: all .2s ease;
}

.sadi-table tbody tr:hover {
    background: rgba(21, 136, 209, .03);
}

/* SPECIALTY DYNAMIC ITEMS */
.sadi-specialty-item {
    border: 1px solid var(--border-soft);
    border-radius: 1rem;
    background: var(--bg-soft);
    padding: 1rem;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
    transition: all .2s ease;
}

.sadi-specialty-item:hover {
    border-color: rgba(21, 136, 209, .18);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

.sadi-specialties-empty-note {
    border: 1px dashed var(--border-soft);
    border-radius: 1rem;
    padding: 1rem;
    background: rgba(21, 136, 209, .03);
    color: var(--text-soft);
    font-size: .85rem;
}

/* EMPTY STATES */
.sadi-empty-state {
    border: 1px dashed var(--border-soft);
    border-radius: 1.5rem;
    padding: 2rem 1.5rem;
    background: linear-gradient(to bottom, rgba(21, 136, 209, .03), transparent);
}

/* DARK MODE */
html[data-theme="dark"] .sadi-hero-mini-card {
    background: rgba(76, 178, 238, .10);
    border-color: rgba(76, 178, 238, .18);
}

html[data-theme="dark"] .sadi-hero-mini-label,
html[data-theme="dark"] .sadi-field-help,
html[data-theme="dark"] .sadi-toolbar-chip,
html[data-theme="dark"] .sadi-table thead th {
    color: #94a3b8;
}

html[data-theme="dark"] .sadi-hero-mini-value {
    color: #f8fafc;
}

html[data-theme="dark"] .sadi-form-card,
html[data-theme="dark"] .sadi-profile-card,
html[data-theme="dark"] .sadi-info-card,
html[data-theme="dark"] .sadi-tabs-card,
html[data-theme="dark"] .sadi-list-card {
    background: #162033;
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 12px 30px rgba(0,0,0,0.22);
}

html[data-theme="dark"] .sadi-form-card-header,
html[data-theme="dark"] .sadi-tabs-header,
html[data-theme="dark"] .sadi-content-card-header {
    border-bottom-color: rgba(255,255,255,0.08);
    background: linear-gradient(to bottom, rgba(76, 178, 238, .12), rgba(255,255,255,.01));
}

html[data-theme="dark"] .sadi-field-wrap,
html[data-theme="dark"] .sadi-contact-item,
html[data-theme="dark"] .sadi-detail-card,
html[data-theme="dark"] .sadi-specialty-item,
html[data-theme="dark"] .sadi-specialty-card,
html[data-theme="dark"] .sadi-toolbar-wrap {
    background: #0b1324;
    border-color: rgba(255,255,255,0.08);
}

html[data-theme="dark"] .sadi-field-wrap.field-readonly {
    background: rgba(148, 163, 184, .08);
}

html[data-theme="dark"] .sadi-detail-card.primary-soft {
    background: rgba(76, 178, 238, .12);
    border-color: rgba(76, 178, 238, .18);
}

html[data-theme="dark"] .sadi-specialties-empty-note,
html[data-theme="dark"] .sadi-empty-state {
    background: rgba(76, 178, 238, .08);
    border-color: rgba(255,255,255,0.08);
    color: #94a3b8;
}

html[data-theme="dark"] .sadi-form-errors {
    color: #fda4af;
}

html[data-theme="dark"] .sadi-pills .nav-link {
    color: #b8c7da;
}

html[data-theme="dark"] .sadi-pills .nav-link:hover {
    background: rgba(76, 178, 238, .10);
    color: #dbeafe;
}

html[data-theme="dark"] .sadi-table {
    background: #0b1324;
    color: #e2e8f0;
}

html[data-theme="dark"] .sadi-table thead,
html[data-theme="dark"] .sadi-table thead tr,
html[data-theme="dark"] .sadi-table thead th {
    background: #0b1324 !important;
}

html[data-theme="dark"] .sadi-table tbody tr {
    background: #0b1324;
    border-color: rgba(255,255,255,0.06);
}

html[data-theme="dark"] .sadi-table tbody tr:hover {
    background: rgba(76, 178, 238, .10);
}

/* MOBILE */
@media (max-width: 991.98px) {
    .sadi-hero-card,
    .sadi-form-card,
    .sadi-profile-card,
    .sadi-info-card,
    .sadi-tabs-card,
    .sadi-list-card {
        border-radius: 1.25rem;
    }

    .sadi-form-card-body,
    .sadi-tabs-header,
    .sadi-tab-content,
    .sadi-content-card-header,
    .sadi-toolbar-wrap {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 767.98px) {
    .sadi-specialty-item {
        padding: .9rem;
    }
}
