:root {
    --xb-navy-950: #0b1c2c;
    --xb-navy-900: #102a40;
    --xb-navy-800: #173b56;
    --xb-navy-700: #24506f;

    --xb-cyan-500: #19b7c6;
    --xb-cyan-600: #0f93a1;
    --xb-cyan-100: #dff4f6;
    --xb-cyan-50: #edf9fa;

    --xb-page: #edf3f7;
    --xb-surface: #ffffff;
    --xb-surface-soft: #f6f9fb;

    --xb-text: #152838;
    --xb-muted: #667d8e;
    --xb-subtle: #879aa7;
    --xb-border: #dbe6ed;

    --xb-success: #2f9e6f;
    --xb-success-bg: #e4f5ed;
    --xb-warning: #a56916;
    --xb-warning-bg: #fff4d9;
    --xb-danger: #b42318;
    --xb-danger-bg: #feeceb;

    --xb-radius-sm: 10px;
    --xb-radius-md: 14px;
    --xb-radius-lg: 18px;
    --xb-radius-xl: 22px;

    --xb-shadow-card: 0 10px 30px rgba(20, 54, 76, 0.07);
    --xb-shadow-hover: 0 16px 36px rgba(20, 54, 76, 0.12);
}

.xb-shell-page,
.xb-shell-page * {
    box-sizing: border-box;
}

body.xb-shell-page {
    margin: 0;
    min-width: 320px;
    background: var(--xb-page);
    color: var(--xb-text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

.xb-svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.xb-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.xb-shell {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    min-height: 100vh;
}

.xb-sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    padding: 20px 14px 16px;
    background:
        radial-gradient(
            circle at 30% 0%,
            rgba(25, 183, 198, 0.16),
            transparent 29%
        ),
        linear-gradient(180deg, var(--xb-navy-950), #071521);
    color: #eaf3f7;
}

.xb-sidebar-header {
    padding: 2px 7px 20px;
}

.xb-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: inherit;
    text-decoration: none;
}

.xb-brand-logo {
    width: 43px;
    height: 43px;
    flex: 0 0 auto;
    object-fit: contain;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.96);
}

.xb-brand strong {
    display: block;
    font-size: 17px;
    letter-spacing: 0.045em;
}

.xb-brand small {
    display: block;
    margin-top: 2px;
    color: #8fa9b8;
    font-size: 10px;
}

.xb-sidebar-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 17px;
}

.xb-nav-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.xb-nav-section-title {
    margin: 0 11px 5px;
    color: #6f8a9c;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.xb-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 12px;
    color: #b9cad5;
    text-decoration: none;
    transition:
        background 160ms ease,
        color 160ms ease,
        transform 160ms ease;
}

.xb-nav-link:hover {
    background: rgba(92, 224, 231, 0.09);
    color: #ffffff;
}

.xb-nav-link.is-active {
    background: rgba(92, 224, 231, 0.14);
    color: #ffffff;
}

.xb-nav-link.is-active::before {
    position: absolute;
    top: 9px;
    bottom: 9px;
    left: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #5ce0e7;
    content: "";
}

.xb-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding: 13px 10px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.xb-user-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
    background: var(--xb-cyan-100);
    color: var(--xb-cyan-600);
    font-size: 14px;
    font-weight: 800;
}

.xb-user-details {
    min-width: 0;
}

.xb-user-details strong,
.xb-topbar-user-copy strong {
    display: block;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xb-user-details span,
.xb-topbar-user-copy span {
    display: block;
    margin-top: 1px;
    color: #829aaa;
    font-size: 11px;
    text-transform: capitalize;
}

.xb-user-details small {
    display: block;
    overflow: hidden;
    margin-top: 3px;
    color: #668296;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xb-sidebar-overlay {
    display: none;
}

.xb-workspace {
    min-width: 0;
}

.xb-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 10px 25px;
    border-bottom: 1px solid rgba(207, 222, 232, 0.9);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
}

.xb-topbar-left,
.xb-topbar-actions,
.xb-topbar-user {
    display: flex;
    align-items: center;
}

.xb-topbar-left {
    min-width: 0;
    gap: 12px;
}

.xb-topbar-actions {
    gap: 13px;
}

.xb-topbar-user {
    gap: 9px;
}

.xb-topbar-context span {
    display: block;
    color: var(--xb-muted);
    font-size: 11px;
}

.xb-topbar-context strong {
    display: block;
    margin-top: 1px;
    color: var(--xb-navy-950);
    font-size: 13px;
}

.xb-menu-button {
    display: none;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--xb-border);
    border-radius: 12px;
    background: var(--xb-surface);
    color: var(--xb-navy-700);
    cursor: pointer;
}

.xb-mobile-brand {
    display: none;
    align-items: center;
    gap: 8px;
    color: var(--xb-navy-950);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-decoration: none;
}

.xb-mobile-brand img {
    width: 35px;
    height: 35px;
    object-fit: contain;
}

.xb-logout-button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border: 1px solid var(--xb-border);
    border-radius: 11px;
    background: var(--xb-surface);
    color: var(--xb-muted);
    font-family: inherit;
    font-weight: 650;
    cursor: pointer;
}

.xb-logout-button:hover {
    border-color: #efc7c3;
    background: var(--xb-danger-bg);
    color: var(--xb-danger);
}

.xb-content.container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 28px 30px 42px;
}

.xb-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 30px 24px;
    color: var(--xb-subtle);
    font-size: 12px;
}

/* Encabezados */

.xb-shell-page .dashboard-header,
.xb-shell-page .admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.xb-shell-page .dashboard-header h1,
.xb-shell-page .admin-header h1,
.xb-shell-page .admin-section > h1 {
    margin: 0;
    color: var(--xb-navy-950);
    font-size: clamp(26px, 3vw, 36px);
    letter-spacing: -0.035em;
}

.xb-shell-page .dashboard-header p,
.xb-shell-page .admin-header p {
    margin: 7px 0 0;
    color: var(--xb-muted);
    line-height: 1.55;
}

.xb-shell-page .admin-header.compact {
    align-items: center;
    margin-bottom: 18px;
}

.xb-shell-page .admin-header.compact h2 {
    margin: 0;
    color: var(--xb-navy-950);
}

/* Tarjetas */

.xb-shell-page .card,
.xb-shell-page .table-card,
.xb-shell-page .form-card {
    border: 1px solid var(--xb-border);
    border-radius: var(--xb-radius-lg);
    background: var(--xb-surface);
    box-shadow: var(--xb-shadow-card);
}

.xb-shell-page .card {
    padding: 22px;
}

.xb-shell-page .table-card,
.xb-shell-page .form-card {
    padding: 24px;
}

.xb-shell-page .card h2,
.xb-shell-page .card h3 {
    color: var(--xb-navy-950);
}

.xb-shell-page .card p {
    color: var(--xb-muted);
    line-height: 1.5;
}

.xb-shell-page .card-link {
    color: inherit;
    text-decoration: none;
    transition:
        transform 170ms ease,
        border-color 170ms ease,
        box-shadow 170ms ease;
}

.xb-shell-page .card-link:hover {
    transform: translateY(-3px);
    border-color: #a7dce1;
    box-shadow: var(--xb-shadow-hover);
}

/* Rejillas */

.xb-shell-page .cards,
.xb-shell-page .dashboard-grid,
.xb-shell-page .dashboard-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 17px;
}

.xb-shell-page .dashboard-main-panel {
    margin: 0;
}

.xb-shell-page .dashboard-logo-center {
    display: none;
}

.xb-shell-page .dashboard-big-number {
    margin: 10px 0 5px;
    color: var(--xb-cyan-600);
    font-size: clamp(34px, 5vw, 52px);
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1;
}

/* Botones */

.xb-shell-page .xb-btn,
.xb-shell-page .primary-link-button,
.xb-shell-page .link-button,
.xb-shell-page .small-link,
.xb-shell-page .small-button,
.xb-shell-page .form-actions button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 15px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

.xb-shell-page .xb-btn-primary,
.xb-shell-page .primary-link-button,
.xb-shell-page .form-actions button {
    border-color: var(--xb-cyan-500);
    background: linear-gradient(135deg, #39ccd5, var(--xb-cyan-500));
    color: #06212a;
    box-shadow: 0 8px 18px rgba(25, 183, 198, 0.16);
}

.xb-shell-page .xb-btn-primary:hover,
.xb-shell-page .primary-link-button:hover,
.xb-shell-page .form-actions button:hover {
    filter: brightness(1.035);
}

.xb-shell-page .xb-btn-secondary,
.xb-shell-page .link-button,
.xb-shell-page .small-link,
.xb-shell-page .small-button {
    border-color: var(--xb-border);
    background: var(--xb-surface-soft);
    color: var(--xb-navy-700);
}

.xb-shell-page .xb-btn-secondary:hover,
.xb-shell-page .link-button:hover,
.xb-shell-page .small-link:hover,
.xb-shell-page .small-button:hover {
    border-color: #b9d6e0;
    background: var(--xb-cyan-50);
}

.xb-shell-page .xb-btn-small {
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 9px;
    font-size: 12px;
}

.xb-shell-page .admin-actions,
.xb-shell-page .actions-row,
.xb-shell-page .form-actions,
.xb-shell-page .page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
}

/* Formularios */

.xb-shell-page .admin-form {
    gap: 20px;
}

.xb-shell-page .admin-form label {
    color: var(--xb-text);
    font-size: 14px;
    font-weight: 650;
}

.xb-shell-page .admin-form input,
.xb-shell-page .admin-form select,
.xb-shell-page .admin-form textarea,
.xb-shell-page input[type="text"],
.xb-shell-page input[type="email"],
.xb-shell-page input[type="password"],
.xb-shell-page input[type="number"],
.xb-shell-page input[type="date"],
.xb-shell-page select,
.xb-shell-page textarea {
    max-width: 100%;
    border: 1px solid #cbdbe4;
    border-radius: 11px;
    background: #ffffff;
    color: var(--xb-text);
    font-family: inherit;
}

.xb-shell-page .admin-form input:focus,
.xb-shell-page .admin-form select:focus,
.xb-shell-page .admin-form textarea:focus,
.xb-shell-page input:focus,
.xb-shell-page select:focus,
.xb-shell-page textarea:focus {
    border-color: var(--xb-cyan-500);
    outline: 3px solid rgba(25, 183, 198, 0.13);
}

/* Tablas */

.xb-shell-page .admin-table,
.xb-shell-page .table-card table {
    width: 100%;
    border-collapse: collapse;
}

.xb-shell-page .admin-table th,
.xb-shell-page .table-card th {
    padding: 12px;
    border-bottom: 1px solid var(--xb-border);
    color: var(--xb-muted);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.025em;
    text-align: left;
    text-transform: uppercase;
}

.xb-shell-page .admin-table td,
.xb-shell-page .table-card td {
    padding: 14px 12px;
    border-bottom: 1px solid #e7eef2;
    color: var(--xb-text);
    vertical-align: top;
}

.xb-shell-page .admin-table tbody tr:hover,
.xb-shell-page .table-card tbody tr:hover {
    background: #f8fbfc;
}

/* Estados */

.xb-shell-page .badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 750;
}

.xb-shell-page .badge-ok {
    background: var(--xb-success-bg);
    color: var(--xb-success);
}

.xb-shell-page .badge-warning {
    background: var(--xb-warning-bg);
    color: var(--xb-warning);
}

.xb-shell-page .badge-muted {
    background: #e8eef2;
    color: #526b7c;
}

.xb-shell-page .badge-danger,
.xb-shell-page .small-button.danger {
    background: var(--xb-danger-bg);
    color: var(--xb-danger);
}

/* Dashboard principal */

.xb-dashboard-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(250px, 0.55fr);
    gap: 18px;
    margin-bottom: 25px;
}

.xb-dashboard-welcome,
.xb-dashboard-profile {
    border: 1px solid var(--xb-border);
    border-radius: var(--xb-radius-xl);
    background: var(--xb-surface);
    box-shadow: var(--xb-shadow-card);
}

.xb-dashboard-welcome {
    position: relative;
    min-height: 235px;
    overflow: hidden;
    padding: 31px;
    background:
        linear-gradient(
            115deg,
            rgba(255, 255, 255, 0.98),
            rgba(236, 248, 250, 0.98)
        );
}

.xb-dashboard-welcome::after {
    position: absolute;
    right: -85px;
    bottom: -120px;
    width: 330px;
    height: 330px;
    border: 1px solid rgba(25, 183, 198, 0.22);
    border-radius: 50%;
    box-shadow:
        0 0 0 38px rgba(25, 183, 198, 0.04),
        0 0 0 84px rgba(25, 183, 198, 0.02);
    content: "";
}

.xb-eyebrow {
    position: relative;
    z-index: 1;
    color: var(--xb-cyan-600);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.115em;
    text-transform: uppercase;
}

.xb-dashboard-welcome h1 {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 8px 0 10px;
    color: var(--xb-navy-950);
    font-size: clamp(30px, 4.3vw, 46px);
    letter-spacing: -0.045em;
    line-height: 1.08;
}

.xb-dashboard-welcome p {
    position: relative;
    z-index: 1;
    max-width: 690px;
    margin: 0;
    color: var(--xb-muted);
    line-height: 1.6;
}

.xb-dashboard-hero-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 23px;
}

.xb-dashboard-profile {
    padding: 23px;
}

.xb-dashboard-profile h2 {
    margin: 0 0 18px;
    color: var(--xb-navy-950);
    font-size: 16px;
}

.xb-profile-list {
    display: grid;
    gap: 13px;
}

.xb-profile-row {
    padding-bottom: 12px;
    border-bottom: 1px solid #e8eef2;
}

.xb-profile-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.xb-profile-row span {
    display: block;
    color: var(--xb-subtle);
    font-size: 11px;
}

.xb-profile-row strong {
    display: block;
    margin-top: 3px;
    color: var(--xb-navy-950);
    font-size: 14px;
}

.xb-section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 14px;
}

.xb-section-heading h2 {
    margin: 0;
    color: var(--xb-navy-950);
    font-size: 20px;
}

.xb-section-heading p {
    margin: 4px 0 0;
    color: var(--xb-muted);
    font-size: 13px;
}

.xb-dashboard-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.xb-dashboard-card {
    position: relative;
    min-height: 185px;
    padding: 21px;
    border: 1px solid var(--xb-border);
    border-radius: var(--xb-radius-lg);
    background: var(--xb-surface);
    color: inherit;
    text-decoration: none;
    box-shadow: var(--xb-shadow-card);
    transition:
        transform 170ms ease,
        border-color 170ms ease,
        box-shadow 170ms ease;
}

.xb-dashboard-card:hover {
    transform: translateY(-3px);
    border-color: #9edce2;
    box-shadow: var(--xb-shadow-hover);
}

.xb-dashboard-card-icon {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 14px;
    background: var(--xb-cyan-50);
    color: var(--xb-cyan-600);
}

.xb-dashboard-card h3 {
    margin: 14px 0 6px;
    color: var(--xb-navy-950);
    font-size: 16px;
}

.xb-dashboard-card p {
    margin: 0;
    color: var(--xb-muted);
    font-size: 13px;
    line-height: 1.5;
}

.xb-card-arrow {
    position: absolute;
    right: 18px;
    bottom: 17px;
    color: var(--xb-cyan-600);
    font-size: 19px;
    font-weight: 800;
}

.xb-card-status {
    position: absolute;
    top: 17px;
    right: 17px;
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--xb-warning-bg);
    color: var(--xb-warning);
    font-size: 11px;
    font-weight: 750;
}

/* Tablet */

@media (max-width: 1100px) and (min-width: 821px) {
    .xb-shell {
        grid-template-columns: 84px minmax(0, 1fr);
    }

    .xb-sidebar {
        padding-right: 10px;
        padding-left: 10px;
    }

    .xb-sidebar-copy,
    .xb-nav-section-title {
        display: none;
    }

    .xb-brand,
    .xb-nav-link,
    .xb-sidebar-user {
        justify-content: center;
    }

    .xb-nav-link {
        padding-right: 10px;
        padding-left: 10px;
    }

    .xb-brand-logo {
        width: 45px;
        height: 45px;
    }

    .xb-dashboard-card-grid,
    .xb-shell-page .cards,
    .xb-shell-page .dashboard-grid,
    .xb-shell-page .dashboard-actions-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Móvil */

@media (max-width: 820px) {
    .xb-shell {
        display: block;
    }

    .xb-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(82vw, 290px);
        height: 100vh;
        transform: translateX(-105%);
        box-shadow: 20px 0 50px rgba(2, 15, 24, 0.28);
        transition: transform 200ms ease;
    }

    body.xb-sidebar-open {
        overflow: hidden;
    }

    body.xb-sidebar-open .xb-sidebar {
        transform: translateX(0);
    }

    .xb-sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 45;
        display: block;
        visibility: hidden;
        border: 0;
        background: rgba(4, 17, 27, 0.52);
        opacity: 0;
        pointer-events: none;
        transition:
            opacity 180ms ease,
            visibility 180ms ease;
    }

    body.xb-sidebar-open .xb-sidebar-overlay {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }

    .xb-topbar {
        min-height: 64px;
        padding: 9px 14px;
    }

    .xb-menu-button,
    .xb-mobile-brand {
        display: inline-flex;
    }

    .xb-topbar-context,
    .xb-topbar-user-copy {
        display: none;
    }

    .xb-content.container {
        padding: 20px 15px 32px;
    }

    .xb-footer {
        flex-direction: column;
        padding: 16px 15px 24px;
    }

    .xb-dashboard-hero {
        grid-template-columns: 1fr;
    }

    .xb-dashboard-welcome {
        min-height: auto;
        padding: 23px;
    }

    .xb-dashboard-profile {
        padding: 20px;
    }

    .xb-dashboard-card-grid,
    .xb-shell-page .cards,
    .xb-shell-page .dashboard-grid,
    .xb-shell-page .dashboard-actions-grid {
        grid-template-columns: 1fr;
    }

    .xb-shell-page .dashboard-header,
    .xb-shell-page .admin-header,
    .xb-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .xb-shell-page .card,
    .xb-shell-page .table-card,
    .xb-shell-page .form-card {
        padding: 18px;
        border-radius: 16px;
    }

    .xb-shell-page .card,
    .xb-shell-page .table-card {
        overflow-x: auto;
    }

    .xb-shell-page .admin-table,
    .xb-shell-page .table-card table {
        min-width: 680px;
    }

    .xb-shell-page .admin-actions,
    .xb-shell-page .page-actions {
        width: 100%;
    }

    .xb-shell-page .admin-actions .xb-btn,
    .xb-shell-page .page-actions .xb-btn {
        flex: 1 1 auto;
    }
}

@media (max-width: 480px) {
    .xb-topbar-user {
        display: none;
    }

    .xb-logout-button span {
        display: none;
    }

    .xb-logout-button {
        width: 42px;
        padding: 8px;
    }

    .xb-dashboard-welcome h1 {
        font-size: 31px;
    }

    .xb-dashboard-hero-actions {
        flex-direction: column;
    }

    .xb-dashboard-hero-actions .xb-btn {
        width: 100%;
    }
}
