/*
|--------------------------------------------------------------------------
| Variables
|--------------------------------------------------------------------------
|
| Colores y medidas comunes. Los colores de marca son los de siempre:
| teal #00a9b5 / #008ba1 y azul marino #053446.
|
*/
:root {
    --brand: #00a9b5;
    --brand-dark: #008ba1;
    --brand-darker: #007389;
    --brand-deep: #053446;
    --brand-soft: #e6f6f8;
    --brand-ring: rgba(0, 169, 181, 0.25);

    --bg: #eef2f4;
    --surface: #ffffff;
    --text: #2b3a42;
    --muted: #6b7c85;
    --border: #e2e8eb;
    --border-strong: #cfd9de;

    --danger: #cf1f2f;
    --danger-soft: #fdecee;
    --success: #17a35f;
    --warning: #c26a00;
    --warning-soft: #fff4e0;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(16, 40, 48, 0.06);
    --shadow: 0 1px 2px rgba(16, 40, 48, 0.05), 0 4px 16px rgba(16, 40, 48, 0.06);
    --shadow-lg: 0 8px 30px rgba(5, 52, 70, 0.25);

    --sidebar-width: 240px;
}

* {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
    -webkit-text-size-adjust: 100%;
}

input:focus,
select:focus {
    outline: none;
}

button:focus {
    outline: none;
}

button::-moz-focus-inner {
    border: 0;
}

abbr {
    cursor: help;
}

.text-align-center {
    text-align: center;
}

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

/*
| Iconos (Phosphor, SVG inline: App\Support\Icon). Heredan el color y el tamaño del texto
| (currentColor, 1em); los modificadores fijan un color de estado.
*/
.icon {
    display: inline-block;
    flex-shrink: 0;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: currentColor;
}

/*
| Envoltorio <i>@icon('x')</i>. Según la zona hace de casilla (ancho, fondo, borde, círculo...) o solo
| separa el icono del texto; su font-size manda sobre el tamaño del SVG (1em). Es lo que antes
| aportaba Font Awesome a .fas: sin cursiva y con line-height 1.
*/
i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: -0.125em;
    font-style: normal;
    line-height: 1;
}

/* El glifo de Phosphor ocupa menos del cuadrado em que el de Font Awesome: se compensa aquí, para
   todos los iconos envueltos en <i>, en vez de retocar el font-size de cada zona. El corazón grande
   del título (40 px, peso Regular) ya se veía bien y se queda en 1em. */
i .icon {
    width: 1.2em;
    height: 1.2em;
}

.app-title i .icon {
    width: 1em;
    height: 1em;
}

.icon--ok {
    color: var(--success);
}

.icon--danger {
    color: var(--danger);
}

.icon--warning {
    color: var(--warning);
}

.document-type {
    width: 116px;
}

.edit-link {
    margin-left: 2px;
    color: var(--brand-dark);
    text-decoration: none;
}

.edit-link:hover,
.edit-link:active {
    color: var(--brand-darker);
}

body {
    background-color: var(--bg);
    margin: 0;
    font-size: 15px;
    color: var(--text);
}

.browser-support-message {
    background-color: #fff;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0 50px;
}

.browser-support-message p {
    position: relative;
    top: 50%;
    bottom: 50%;
    margin: auto;
    text-align: center;
}

/*
|--------------------------------------------------------------------------
| Login
|--------------------------------------------------------------------------
*/
.login-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    opacity: 0;
    -webkit-transition: opacity 1s;
    transition: opacity 1s;
    -webkit-transition-delay: 0.5s;
    transition-delay: 0.5s;
}

.logo {
    margin: 48px 16px 24px 16px;
}

.logo a {
    text-decoration: none;
}

.logo img {
    display: block;
    width: 250px;
    max-width: 100%;
    margin: auto;
}

.app-title {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 8px 16px;
    margin-bottom: 16px;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--brand-deep);
}

.app-title span {
    text-align: center;
}

.app-title i {
    padding: 12px;
    font-size: 40px;
    color: var(--brand);
}

.login-form-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}

.login-form-wrapper form {
    background-color: var(--surface);
    box-sizing: border-box;
    width: 100%;
    max-width: 360px;
    margin: 4px 16px 32px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    color: var(--text);
    box-shadow: var(--shadow-lg);
}

.login-form-wrapper .form-title {
    background-color: var(--brand);
    padding: 16px 20px;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.login-form-wrapper .field {
    display: flex;
    flex-direction: column;
    padding: 0 20px;
    margin-bottom: 16px;
    color: var(--text);
}

.login-form-wrapper .field label {
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    -webkit-transition: color 0.2s;
    transition: color 0.2s;
}

.login-form-wrapper .field:focus-within label {
    color: var(--brand-dark);
}

.login-form-wrapper .input {
    display: flex;
}

.login-form-wrapper .input i {
    background-color: var(--brand-soft);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    box-sizing: border-box;
    width: 42px;
    border: 1px solid var(--border-strong);
    border-right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: var(--brand-dark);
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
}

.login-form-wrapper .input input {
    background-color: #fff;
    width: calc(100% - 42px);
    padding: 11px 12px;
    margin: 0;
    border: 1px solid var(--border-strong);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    box-sizing: border-box;
    font-size: 14px;
    color: var(--text);
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
}

.login-form-wrapper .input input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.login-form-wrapper .input input:-moz-submit-invalid,
.login-form-wrapper .input input:invalid {
    box-shadow: none;
}

.login-form-wrapper .input input:focus:invalid {
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.login-error {
    background-color: var(--danger-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin: 0 20px 16px 20px;
    border: 1px solid #f5c6cb;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--danger);
}

.login-error-close {
    display: flex;
    align-items: center;
    padding: 2px;
    margin-left: 8px;
    cursor: pointer;
}

.login-form-wrapper .submit {
    display: flex;
    justify-content: flex-end;
    padding: 4px 20px 20px 20px;
}

.login-form-wrapper .submit input {
    background-color: var(--brand-dark);
    min-height: 40px;
    padding: 10px 22px;
    margin: 0;
    border: 0;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    -webkit-transition: background-color 0.2s;
    transition: background-color 0.2s;
}

.login-form-wrapper .submit input:hover {
    background-color: var(--brand-darker);
}

.login-form-wrapper .submit input:focus {
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.login-form-wrapper .submit input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/*
|--------------------------------------------------------------------------
| Mensajes (errores de validación y avisos de éxito)
|--------------------------------------------------------------------------
*/
.messages {
    position: fixed;
    left: var(--sidebar-width);
    bottom: 24px;
    max-width: calc(100% - var(--sidebar-width) - 32px);
    margin: 0 16px;
    z-index: 9999;
}

.messages.errors {
    background-color: var(--danger);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.messages-header {
    background-color: rgba(0, 0, 0, 0.12);
    display: block;
    padding: 10px 12px;
    padding-right: 36px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.messages-scroll {
    max-height: 300px;
    overflow-y: auto;
}

.message {
    display: flex;
    align-items: center;
    padding: 6px;
    margin-top: 16px;
    border-radius: var(--radius-sm);
    color: #fff;
}

.message-success {
    background-color: var(--success);
    box-shadow: var(--shadow-lg);
}

.message-error {
    position: relative;
    padding: 8px 6px;
    margin-top: 0px;
    border-radius: 0;
}

.message-error:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.messages.errors .messages-close {
    position: absolute;
    top: 0;
    right: 0px;
    width: 12px;
    height: 12px;
    padding: 6px;
    font-size: 12px;
    text-align: center;
    cursor: pointer;
    color: #fff;
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
}

.messages.errors .messages-close:hover {
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--danger);
}

.messages.errors .message-close {
    position: absolute;
    padding: 2px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
}

.messages.errors .message:hover .message-close {
    opacity: 1;
}

.messages.errors .message-close:hover {
    color: white;
}

.message-close {
    position: absolute;
    right: 8px;
    padding: 2px;
    cursor: pointer;
}

.message-close:hover {
    color: white;
}

.message-icon {
    margin: 4px;
    font-size: 24px;
}

/* Botones de cerrar (spans con un icono dentro): centran el icono y no heredan el estilo del texto */
.messages-close,
.message-close {
    display: flex;
    align-items: center;
    justify-content: center;
}

.message span:not(.message-close) {
    padding-right: 32px;
    margin: 4px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
}

.message ul {
    width: 100%;
    font-size: 12px;
    text-align: left;
}

/*
|--------------------------------------------------------------------------
| Sidebar del administrador (escritorio y tablet)
|--------------------------------------------------------------------------
|
| Los enlaces de navegación son hijos directos de .admin-sidebar-links; el
| enlace del logo está dentro de .admin-sidebar-logo y no recibe esos estilos.
|
*/
.admin-sidebar-wrapper {
    background-color: var(--brand);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    overflow-x: hidden;
    overflow-y: auto;
    box-shadow: 2px 0 14px rgba(5, 52, 70, 0.14);
    z-index: 10;
}

.admin-sidebar-logo {
    background-color: var(--brand-deep);
    padding: 28px 0px;
}

.admin-sidebar-logo a {
    display: block;
    text-decoration: none;
}

.admin-sidebar-logo img {
    opacity: 0.9;
    -webkit-transition: opacity 0.3s;
    transition: opacity 0.3s;
}

.admin-sidebar-logo .logo-responsive {
    display: none;
    width: 40px;
    padding: 10px;
}

.admin-sidebar-logo .logo-not-responsive {
    display: block;
    width: 210px;
    padding: 0px 20px 0px 10px;
}

.admin-sidebar-logo a:hover img {
    opacity: 1;
}

.admin-sidebar-links {
    padding-bottom: 12px;
}

.admin-sidebar-links > a {
    display: flex;
    align-items: center;
    margin: 6px 12px 0 12px;
    border-radius: 10px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.94);
    -webkit-transition: background-color 0.15s, color 0.15s;
    transition: background-color 0.15s, color 0.15s;
}

.admin-sidebar-links > a:first-of-type {
    margin-top: 14px;
}

.admin-sidebar-links > a:not(.active-link):hover {
    background-color: rgba(255, 255, 255, 0.16);
}

.admin-sidebar-links > a.active-link {
    background-color: #fff;
    color: var(--brand-dark);
    box-shadow: 0 2px 8px rgba(5, 52, 70, 0.18);
}

.admin-sidebar-links > a i {
    flex-shrink: 0;
    width: 44px;
    padding: 14px 0;
    text-align: center;
    font-size: 17px;
}

.admin-sidebar-links > a span {
    padding: 14px 16px 14px 0;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
}

/*
|--------------------------------------------------------------------------
| Barra superior del administrador (móvil)
|--------------------------------------------------------------------------
|
| OJO: toggleNav() calcula el alto del menú sumando el offsetHeight de los
| hijos de .links, que no incluye márgenes. No poner márgenes verticales ahí.
|
*/
.admin-responsive-sidebar-wrapper {
    background-color: var(--brand);
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    box-shadow: 0 2px 12px rgba(5, 52, 70, 0.25);
    z-index: 99999991;
}

.admin-responsive-sidebar-logo {
    background-color: var(--brand-deep);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0px;
}

.admin-responsive-sidebar-logo a {
    margin-left: 16px;
}

.admin-responsive-sidebar-logo img {
    display: block;
    height: 45px;
    opacity: 0.9;
    -webkit-transition: opacity 0.3s;
    transition: opacity 0.3s;
}

.admin-responsive-sidebar-logo a:hover img {
    opacity: 1;
}

.admin-responsive-sidebar-logo .nav-toggler {
    padding: 8px 14px;
    margin-right: 4px;
    font-size: 24px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    cursor: pointer;
    -webkit-transition: color 0.2s;
    transition: color 0.2s;
}

.admin-responsive-sidebar-logo .nav-toggler:hover {
    color: rgba(255, 255, 255, 1);
}

.admin-responsive-sidebar-wrapper .links {
    max-height: 0;
    overflow: hidden;
    -webkit-transition: all 0.5s;
    transition: all 0.5s;
}

.admin-responsive-sidebar-wrapper .links a {
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    text-decoration: none;
    color: rgba(255, 255, 255, 0.95);
    -webkit-transition: background-color 0.15s;
    transition: background-color 0.15s;
}

.admin-responsive-sidebar-wrapper .links a:not(.active-link):hover,
.admin-responsive-sidebar-wrapper .links a:not(.active-link):active {
    background-color: rgba(255, 255, 255, 0.14);
}

.admin-responsive-sidebar-wrapper .links a.active-link {
    background-color: var(--brand-dark);
}

.admin-responsive-sidebar-wrapper .links form a:hover {
    background-color: rgba(207, 31, 47, 0.92);
}

.admin-responsive-sidebar-wrapper .links a i {
    flex-shrink: 0;
    width: 48px;
    padding: 16px 4px;
    text-align: center;
    font-size: 18px;
}

.admin-responsive-sidebar-wrapper .links a span {
    padding: 16px 40px 16px 0px;
    font-weight: 500;
}

/*
|--------------------------------------------------------------------------
| Contenido del administrador
|--------------------------------------------------------------------------
*/
.admin-content-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    min-height: 100vh;
    padding: 56px 32px 32px 32px;
    margin-left: var(--sidebar-width);
}

.admin-content-wrapper.list {
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 80px 32px 32px 32px;
}

/*
|--------------------------------------------------------------------------
| Paginación
|--------------------------------------------------------------------------
*/
.pagination-links {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

.pagination-links ul {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding: 0;
    margin-top: 5px;
    list-style-type: none;
}

.pagination-links li {
    margin: 10px 2px 0 2px;
}

.pagination-links li .page-link {
    background-color: var(--surface);
    display: block;
    box-sizing: border-box;
    min-width: 36px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--brand-dark);
    text-align: center;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
}

.pagination-links li .page-link:hover {
    background-color: var(--brand-soft);
    border-color: var(--brand);
}

.pagination-links li.active .page-link,
.pagination-links li .page-link:active {
    background-color: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}

.pagination-links li.disabled .page-link {
    background-color: transparent;
    border-color: var(--border);
    color: #a7b4ba;
}

/*
|--------------------------------------------------------------------------
| Menú de usuario (arriba a la derecha)
|--------------------------------------------------------------------------
*/
.user-pill {
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 7;
    -webkit-animation: user-pill-in 0.35s ease-out both;
    animation: user-pill-in 0.35s ease-out both;
}

/* La píldora de cristal (disparador) */
.user-pill-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    box-sizing: border-box;
    height: 44px;
    margin: 0;
    padding: 5px 14px 5px 5px;
    background-color: rgba(255, 255, 255, 0.78);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    backdrop-filter: blur(12px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    box-shadow: 0 6px 24px rgba(5, 52, 70, 0.14), 0 1px 2px rgba(5, 52, 70, 0.08);
    color: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-transition: background-color 0.2s, box-shadow 0.2s;
    transition: background-color 0.2s, box-shadow 0.2s;
}

/* Sin desenfoque de fondo el cristal se vería transparente sobre el contenido: se vuelve opaco */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .user-pill-trigger {
        background-color: var(--surface);
        border-color: var(--border);
    }
}

.user-pill-trigger:hover,
.user-pill.is-open .user-pill-trigger {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 28px rgba(5, 52, 70, 0.18), 0 1px 2px rgba(5, 52, 70, 0.08);
}

/* El outline global de button:focus está desactivado: el aro de foco va explícito */
.user-pill-trigger:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--brand-ring), 0 6px 24px rgba(5, 52, 70, 0.14);
}

.user-pill-avatar {
    background: linear-gradient(135deg, var(--brand), var(--brand-deep));
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 3px rgba(5, 52, 70, 0.3);
    -webkit-user-select: none;
    user-select: none;
}

.user-pill-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    line-height: 1.25;
}

.user-pill-name {
    max-width: 160px;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-pill-role {
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 500;
}

.user-pill-chevron {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 10px;
    -webkit-transition: transform 0.2s, color 0.2s;
    transition: transform 0.2s, color 0.2s;
}

/* Menú desplegable */
.user-pill-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-sizing: border-box;
    min-width: 100%;
    width: max-content;
    padding: 6px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 12px 32px rgba(5, 52, 70, 0.18), 0 2px 6px rgba(5, 52, 70, 0.08);
    opacity: 0;
    visibility: hidden;
    -webkit-transform: translateY(-6px) scale(0.98);
    transform: translateY(-6px) scale(0.98);
    -webkit-transform-origin: top right;
    transform-origin: top right;
    -webkit-transition: opacity 0.18s, transform 0.18s, visibility 0s linear 0.18s;
    transition: opacity 0.18s, transform 0.18s, visibility 0s linear 0.18s;
}

/* Puente invisible sobre el hueco de 8px: sin él el :hover se pierde al bajar el ratón al menú */
.user-pill-menu::before {
    content: "";
    position: absolute;
    top: -10px;
    right: 0;
    left: 0;
    height: 10px;
}

/*
| Abierto: por clic/teclado (.is-open) y, solo en equipos con ratón, con el :hover.
| visibility oculta el menú a los lectores y al tabulador mientras está cerrado.
*/
.user-pill.is-open .user-pill-menu {
    opacity: 1;
    visibility: visible;
    -webkit-transform: none;
    transform: none;
    -webkit-transition-delay: 0s;
    transition-delay: 0s;
}

.user-pill.is-open .user-pill-chevron {
    color: var(--brand-dark);
    -webkit-transform: rotate(180deg);
    transform: rotate(180deg);
}

@media (hover: hover) {
    .user-pill:not(.suppress-hover):hover .user-pill-menu {
        opacity: 1;
        visibility: visible;
        -webkit-transform: none;
        transform: none;
        -webkit-transition-delay: 0s;
        transition-delay: 0s;
    }

    .user-pill:not(.suppress-hover):hover .user-pill-chevron {
        color: var(--brand-dark);
        -webkit-transform: rotate(180deg);
        transform: rotate(180deg);
    }
}

.user-pill-menu form {
    display: block;
    margin: 0;
}

.user-pill-item {
    display: flex;
    align-items: center;
    gap: 10px;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 7px 14px 7px 7px;
    background-color: transparent;
    border: 0;
    border-radius: 999px;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    -webkit-transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
    transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.user-pill-item i {
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    background-color: var(--brand-soft);
    border-radius: 50%;
    color: var(--brand-dark);
    font-size: 13px;
    -webkit-transition: background-color 0.15s, color 0.15s;
    transition: background-color 0.15s, color 0.15s;
}

.user-pill-item:hover,
.user-pill-item:focus-visible {
    background-color: var(--brand-soft);
    color: var(--brand-darker);
}

.user-pill-item:hover i,
.user-pill-item:focus-visible i {
    background-color: var(--brand-dark);
    color: #fff;
}

.user-pill-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.user-pill-settings:hover i .icon {
    -webkit-animation: cog-rotation 2s infinite linear;
    animation: cog-rotation 2s infinite linear;
}

.user-pill-logout i {
    background-color: var(--danger-soft);
    color: var(--danger);
}

.user-pill-logout:hover,
.user-pill-logout:focus-visible {
    background-color: var(--danger-soft);
    color: var(--danger);
}

.user-pill-logout:hover i,
.user-pill-logout:focus-visible i {
    background-color: var(--danger);
    color: #fff;
}

.user-pill-logout:focus-visible {
    box-shadow: 0 0 0 3px rgba(207, 31, 47, 0.25);
}

@-webkit-keyframes user-pill-in {
    from {
        opacity: 0;
        -webkit-transform: translateY(-8px);
    }
    to {
        opacity: 1;
        -webkit-transform: translateY(0);
    }
}

@keyframes user-pill-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .user-pill,
    .user-pill-settings:hover i .icon {
        -webkit-animation: none;
        animation: none;
    }

    .user-pill-menu,
    .user-pill-chevron,
    .user-pill-trigger,
    .user-pill-item {
        -webkit-transition: none;
        transition: none;
    }
}

@-webkit-keyframes cog-rotation {
    from {
        -webkit-transform: rotate(0deg);
    }
    to {
        -webkit-transform: rotate(359deg);
    }
}

@keyframes cog-rotation {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(359deg);
    }
}

/*
|--------------------------------------------------------------------------
| Migas de pan
|--------------------------------------------------------------------------
*/
.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 0 0 16px 0;
    font-size: 13px;
}

.breadcrumbs a {
    background-color: var(--surface);
    padding: 6px 12px;
    margin: 2px 8px 2px 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--brand-dark);
    text-decoration: none;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
}

.breadcrumbs a:hover {
    background-color: var(--brand-soft);
    border-color: var(--brand);
}

.breadcrumbs a:active {
    background-color: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}

.breadcrumbs span {
    margin: 2px 8px 2px 0;
    font-weight: 600;
    color: var(--muted);
}

.admin-content-wrapper.list .window {
    width: 100%;
    min-width: 215.5px;
}

/*
|--------------------------------------------------------------------------
| Filtros
|--------------------------------------------------------------------------
*/
.filter-wrapper {
    /* Alto común de las celdas del filtro (texto, select y fecha) y del botón de aplicar */
    --filter-control-height: 34px;

    background-color: var(--surface);
    display: flex;
    align-items: center;
    box-sizing: border-box;
    max-width: 100%;
    min-width: 215.5px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.filter-title {
    padding: 8px 12px 8px 2px;
}

.filter-title i {
    font-size: 18px;
    color: var(--brand);
}

.filter {
    padding: 0;
}

.filter form {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter .field {
    margin-right: 12px;
    margin-bottom: 4px;
}

.filter form label,
.filter form input,
.filter form select {
    display: block;
    box-sizing: border-box;
    width: 140px;
    font-size: 13px;
}

.filter form input::-webkit-input-placeholder {
    /* Chrome/Opera/Safari */
    color: #9aa7ae;
}

.filter form input::placeholder {
    color: #9aa7ae;
}

.filter form input[type="date"] {
    padding: 6px 10px;
}

.filter form label {
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

.filter form input,
.filter form select {
    background-color: #fff;
    height: var(--filter-control-height);
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    -webkit-transition: border-color 0.2s, box-shadow 0.2s;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter form input:focus,
.filter form select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.filter form select {
    width: 150px;
}

.filter .field {
    position: relative;
}

.apply-filter {
    background-color: var(--brand-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    /* Alineado con la fila de los inputs (su borde inferior), no centrado respecto a etiquetas + inputs.
       El margin-bottom iguala el de .filter .field, que es lo que separa el input del fondo del formulario. */
    align-self: flex-end;
    width: var(--filter-control-height);
    height: var(--filter-control-height);
    margin-left: 8px;
    margin-bottom: 4px;
    border-radius: var(--radius-sm);
    font-size: 17px;
    cursor: pointer;
    color: #fff;
    -webkit-transition: background-color 0.2s;
    transition: background-color 0.2s;
}

.apply-filter:hover {
    background-color: var(--brand-darker);
}

/*
|--------------------------------------------------------------------------
| Tarjetas (window)
|--------------------------------------------------------------------------
*/
.window {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.window-title {
    padding: 16px 20px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.window-title::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 1em;
    margin-right: 10px;
    border-radius: 2px;
    background-color: var(--brand);
    vertical-align: -0.15em;
}

.window-title small {
    margin-left: 6px;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}

.window-content {
    padding: 16px 20px 20px 20px;
}

/*
|--------------------------------------------------------------------------
| Botones de acción y orden
|--------------------------------------------------------------------------
*/
.table-options {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
}

.table-options .add-link {
    margin-right: 12px;
    margin-bottom: 12px;
}

.add-link a {
    background-color: var(--brand-dark);
    display: inline-block;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    -webkit-transition: background-color 0.2s;
    transition: background-color 0.2s;
}

.add-link a:hover {
    background-color: var(--brand-darker);
}

.add-link a:active {
    background-color: var(--brand-deep);
}

.add-link a i {
    margin-right: 4px;
    font-size: 12px;
}

.order-input {
    background-color: #fff;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 8px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
    font-size: 12px;
}

.order-input label {
    background-color: var(--brand-soft);
    padding: 8px 10px;
    color: var(--brand-dark);
    font-weight: 500;
    text-decoration: none;
}

.order-input label i {
    margin-right: 4px;
}

.order-input select {
    background-color: #fff;
    padding: 7px 4px;
    border: 0;
    font-size: 12px;
    color: var(--text);
}

/*
|--------------------------------------------------------------------------
| Ventana de opciones de importación
|--------------------------------------------------------------------------
|
| main.js la muestra con display + opacity y la oculta tras 500 ms, por eso
| la transición de opacidad dura 0.5s.
|
*/
.import-options-wrapper {
    background-color: rgba(5, 52, 70, 0.6);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999995;
    opacity: 0;
    cursor: pointer;
    -webkit-transition: opacity 0.5s;
    transition: opacity 0.5s;
}

.import-options {
    background-color: rgba(255, 255, 255, 1);
    position: relative;
    box-sizing: border-box;
    width: 360px;
    max-width: calc(100% - 20px);
    max-height: calc(100% - 20px);
    margin: 10px;
    border-radius: 14px;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 99999996;
    cursor: auto;
    box-shadow: var(--shadow-lg);
}

.import-options .close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.18);
    font-size: 13px;
    cursor: pointer;
    color: #fff;
    z-index: 99999997;
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
}

.import-options .close:hover {
    background-color: rgba(255, 255, 255, 1);
    color: var(--brand-dark);
}

/* toggleImportOptions solo cierra si el clic cae en el propio .close (e.target === e.currentTarget):
   el icono no debe capturar el clic */
.import-options .close .icon {
    pointer-events: none;
}

.import-options h1 {
    background-color: var(--brand);
    padding: 18px 56px 18px 20px;
    color: #fff;
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
}

.import-options h1 i {
    margin-right: 8px;
}

.import-options h2 {
    margin: 16px 20px 10px 20px;
    padding-bottom: 6px;
    color: var(--brand-dark);
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
}

.import-options .import-input {
    display: flex;
    margin: 0 20px 10px 20px;
}

.import-options label {
    background-color: var(--brand-soft);
    box-sizing: border-box;
    flex: 0 0 140px;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 500;
}

.import-options .input {
    background-color: #fff;
    box-sizing: border-box;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    box-shadow: none;
    color: var(--text);
    font-size: 14px;
    text-align: center;
}

.import-options .input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.import-options input::-webkit-input-placeholder {
    /* Chrome/Opera/Safari */
    color: #9aa7ae;
}

.import-options input::placeholder {
    color: #9aa7ae;
}

.import-options .file-input {
    background-color: var(--brand-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    padding: 12px 14px;
    border: 1px dashed var(--brand);
    border-radius: var(--radius-sm);
    box-shadow: none;
    color: var(--brand-dark);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    -webkit-transition: background-color 0.2s;
    transition: background-color 0.2s;
}

.import-options .file-input span {
    min-width: 0;
    margin-right: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.import-options button {
    background-color: var(--brand-dark);
    display: block;
    width: calc(100% - 40px);
    padding: 14px 0;
    margin: 20px auto 20px auto;
    border: 0;
    border-radius: 10px;
    color: rgba(255, 255, 255, 1);
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    -webkit-transition: background-color 0.2s;
    transition: background-color 0.2s;
}

.import-options button:hover {
    background-color: var(--brand-darker);
}

.import-options .file-input:hover {
    background-color: #d3eef1;
}

.import-options button:active {
    background-color: var(--brand-deep);
}

.import-options button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.import-options button .wait {
    display: none;
    justify-content: center;
    align-items: center;
    font-size: 14px;
}

.import-options button .wait i {
    margin-left: 8px;
    font-size: 18px;
    -webkit-animation: spinner-rotation 1s infinite linear;
    animation: spinner-rotation 1s infinite linear;
}

@-webkit-keyframes spinner-rotation {
    from {
        -webkit-transform: rotate(0deg);
    }
    to {
        -webkit-transform: rotate(359deg);
    }
}

@keyframes spinner-rotation {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(359deg);
    }
}

/*
|--------------------------------------------------------------------------
| Google tables
|--------------------------------------------------------------------------
|
| Estilos para las tablas de Google. Cuando no caben, la tabla se desplaza
| en horizontal dentro de su contenedor y no la página.
|
*/
.scroll-table {
    max-height: 30em !important;
    overflow-y: auto !important;
}

#table,
#table2 {
    width: 100%;
    /* En las vistas de rol el contenedor es flex: sin esto no encoge por debajo de la tabla */
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#table .google-visualization-table-table,
#table2 .google-visualization-table-table {
    min-width: 640px;
    border-collapse: collapse;
    font-family: inherit;
    font-size: 13px;
}

#table .google-visualization-table-th,
#table2 .google-visualization-table-th {
    background-image: none;
    background-color: #f3f8f9;
    padding: 10px 8px;
    border: 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
}

#table .google-visualization-table-sortind,
#table2 .google-visualization-table-sortind {
    color: var(--brand-dark);
}

#table .google-visualization-table-tr-even td,
#table2 .google-visualization-table-tr-even td,
#table .google-visualization-table-tr-odd td,
#table2 .google-visualization-table-tr-odd td {
    background-color: transparent;
}

#table .google-visualization-table-tr-over td,
#table2 .google-visualization-table-tr-over td,
#table .google-visualization-table-tr-over,
#table2 .google-visualization-table-tr-over {
    background-color: var(--brand-soft);
}

#table .google-visualization-table-tr-sel td,
#table2 .google-visualization-table-tr-sel td,
#table .google-visualization-table-tr-sel,
#table2 .google-visualization-table-tr-sel {
    background-color: #d3eef1;
}

#table .google-visualization-table-td,
#table2 .google-visualization-table-td {
    padding: 10px 8px;
    border: 0;
    border-bottom: 1px solid #edf1f3;
    color: var(--text);
}

#table .number-of-customers,
#table2 .number-of-customers {
    width: 170px;
    min-width: 170px;
    text-align: center;
}

#table .number-col,
#table2 .number-col {
    width: 130px;
    min-width: 110px;
    text-align: center;
}

#table .options,
#table2 .options {
    width: 170px;
    min-width: 170px;
}

/* Enlaces de las celdas (Enlace, Ver...) */
#table .google-visualization-table-td a,
#table2 .google-visualization-table-td a {
    color: var(--brand-dark);
    font-weight: 500;
    text-decoration: none;
}

#table .google-visualization-table-td a:hover,
#table2 .google-visualization-table-td a:hover {
    color: var(--brand-deep);
    text-decoration: underline;
}

#table form,
#table2 form {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

#table .link,
#table2 .link {
    text-align: center;
}

#table .link a i,
#table2 .link a i {
    font-size: 12px;
}

#table form a,
#table form button,
#table2 form a,
#table2 form button {
    background-color: transparent;
    padding: 4px 0;
    margin: 0 4px;
    border: none;
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

#table form i,
#table2 form i {
    font-size: 13px;
}

#table form a:hover,
#table2 form a:hover {
    color: var(--brand-deep);
}

#table form button,
#table2 form button {
    color: var(--muted);
}

#table form button:hover,
#table2 form button:hover {
    color: var(--danger);
}

/*
| Google envuelve la tabla en un div con su propio scroll, tan alto como toda la tabla: su barra
| horizontal quedaba al final de la lista, fuera de la vista. Se deja un único contenedor con scroll
| (#table), cuyas barras sí se ven.
*/
#table .google-visualization-table > div,
#table2 .google-visualization-table > div {
    overflow: visible !important;
}

/*
| Con muchas columnas la tabla desplaza en horizontal: en pantallas anchas la columna de
| acciones se queda fija a la derecha para que siempre se pueda pulsar.
*/
@media (min-width: 887px) {
    #table .options,
    #table2 .options {
        position: sticky;
        right: 0;
        z-index: 1;
        box-shadow: -8px 0 8px -8px rgba(5, 52, 70, 0.2);
    }

    /* Las cabeceras de Google llevan z-index: 10 */
    #table th.options,
    #table2 th.options {
        z-index: 11;
    }

    #table .google-visualization-table-tr-even .options,
    #table2 .google-visualization-table-tr-even .options {
        background-color: #fff;
    }

    #table .google-visualization-table-tr-odd .options,
    #table2 .google-visualization-table-tr-odd .options {
        background-color: #fafafa;
    }

    #table .google-visualization-table-tr-over .options,
    #table2 .google-visualization-table-tr-over .options {
        background-color: var(--brand-soft);
    }

    #table .google-visualization-table-tr-sel .options,
    #table2 .google-visualization-table-tr-sel .options {
        background-color: #d3eef1;
    }
}

/*
|
|
|--------------------------------------------------------------------------
| Fin de Google tables
|--------------------------------------------------------------------------
*/

/*
|--------------------------------------------------------------------------
| Formularios de administración
|--------------------------------------------------------------------------
*/
.admin-content-wrapper.form .window {
    width: 100%;
    max-width: 360px;
}

.admin-content-wrapper.bigger-form .window {
    width: 100%;
    max-width: 560px;
}

.admin-form .form-section {
    margin-bottom: 8px;
}

.admin-form .form-section .title {
    margin: 4px 0 14px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
    color: var(--brand-dark);
}

.admin-form .form-section .fields {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
}

.admin-form .form-section .field {
    width: 48%;
}

.admin-form .field {
    position: relative;
    margin-bottom: 16px;
}

.admin-form .field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    -webkit-transition: color 0.2s;
    transition: color 0.2s;
}

.admin-form .input {
    display: flex;
}

.admin-form .input i {
    background-color: var(--brand-soft);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    box-sizing: border-box;
    width: 40px;
    border: 1px solid var(--border-strong);
    border-right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    text-align: center;
    font-size: 14px;
    color: var(--brand-dark);
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
}

.admin-form .input input,
.admin-form .input select,
.admin-form .input span {
    background-color: #fff;
    width: calc(100% - 40px);
    padding: 10px 12px;
    margin: 0;
    border: 1px solid var(--border-strong);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    box-sizing: border-box;
    font-size: 14px;
    color: var(--text);
    -webkit-transition: border-color 0.2s, box-shadow 0.2s;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.admin-form .input input:focus,
.admin-form .input select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.admin-form .input ::-webkit-input-placeholder {
    /* Chrome/Opera/Safari */
    color: #9aa7ae;
}

.admin-form .input ::placeholder {
    color: #9aa7ae;
}

.admin-form .input.disabled {
    cursor: not-allowed;
}

.input.disabled .file-input {
    cursor: not-allowed;
    pointer-events: none;
    background-color: #eef1f3 !important;
    color: #9aa7ae !important;
}

.admin-form .input.disabled i,
.admin-form .input.disabled input {
    background-color: #eef1f3 !important;
    border-color: var(--border-strong) !important;
    color: #9aa7ae !important;
    pointer-events: none !important;
}

/* Campo inválido: main.js pone la clase .invalid en el .field */
.admin-form .field.invalid label {
    color: var(--danger);
}

.admin-form .field.invalid .input input {
    background-color: var(--danger-soft);
    border-color: var(--danger);
    color: var(--danger);
}

.admin-form .field.invalid .input input:focus {
    box-shadow: 0 0 0 3px rgba(207, 31, 47, 0.2);
}

.admin-form .field.invalid .input > i {
    background-color: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.admin-form .input .invalid-icon {
    position: absolute;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    height: 38px;
    cursor: help;
    z-index: 100;
}

.admin-form .input .invalid-icon i {
    background-color: transparent !important;
    width: auto;
    padding: 0 12px;
    border: 0 !important;
    color: var(--danger) !important;
    font-size: 13px !important;
}

.admin-form .input input:-moz-submit-invalid,
.admin-form .input input:invalid,
.admin-form .input select:-moz-submit-invalid,
.admin-form .input select:invalid {
    box-shadow: none;
}

.admin-form .input input:focus:invalid,
.admin-form .input select:focus:invalid {
    box-shadow: 0 0 0 3px var(--brand-ring);
}

/*
|--------------------------------------------------------------------------
| Desplegables de autocompletado (clientes / asesores)
|--------------------------------------------------------------------------
*/
.filter .consultants-input,
.filter .customers-input {
    background-color: #fff;
    position: absolute;
    margin-top: 2px;
    width: 100%;
    min-width: 160px;
    max-height: 180px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.admin-form .consultants-input,
.admin-form .customers-input {
    background-color: #fff;
    position: absolute;
    width: calc(100% - 40px);
    margin-top: 2px;
    margin-left: 40px;
    max-height: 180px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.filter .consultants-input:empty,
.filter .customers-input:empty,
.admin-form .consultants-input:empty,
.admin-form .customers-input:empty,
.consultant-filter .customers-input:empty,
.customer-filter .customers-input:empty {
    display: none;
}

.filter .consultants-input div,
.filter .customers-input div,
.admin-form .consultants-input div,
.admin-form .customers-input div {
    background-color: #fff;
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    -webkit-transition: background-color 0.2s;
    transition: background-color 0.2s;
}

.filter .consultants-input div:last-child,
.filter .customers-input div:last-child,
.admin-form .consultants-input div:last-child,
.admin-form .customers-input div:last-child {
    border-bottom: 0;
}

.filter .consultants-input div:hover,
.filter .customers-input div:hover,
.admin-form .consultants-input div:hover,
.admin-form .customers-input div:hover {
    background-color: var(--brand-soft);
}

.admin-form .input input[type="file"] {
    display: none;
}

.admin-form .file-input {
    background-color: #fff;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    max-width: calc(100% - 40px);
    border: 1px solid var(--border-strong);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    -webkit-transition: background-color 0.2s;
    transition: background-color 0.2s;
}

.admin-form .file-input:hover {
    background-color: var(--brand-soft);
}

.admin-form .file-input:active {
    background-color: #d3eef1;
}

.admin-form .file-input i {
    background-color: transparent;
    width: auto;
    padding: 0 12px;
    border: none;
    border-radius: 0;
    color: var(--brand-dark);
}

.admin-form .file-input span {
    background-color: transparent;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    border: none;
    border-radius: 0;
    font-size: 14px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.admin-form .submit {
    margin-top: 28px;
    text-align: right;
    font-size: 13px;
}

.admin-form .submit a,
.admin-form .submit input {
    display: inline-block;
    box-sizing: border-box;
    height: 40px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    vertical-align: middle;
    cursor: pointer;
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
}

.admin-form .submit a {
    background-color: #fff;
    margin-right: 8px;
    border: 1px solid var(--border-strong);
    color: var(--text);
    text-decoration: none;
}

.admin-form .submit a:hover {
    background-color: var(--bg);
}

.admin-form .submit input {
    background-color: var(--brand-dark);
    border: 1px solid var(--brand-dark);
    color: #fff;
}

.admin-form .submit input:hover {
    background-color: var(--brand-darker);
    border-color: var(--brand-darker);
}

.admin-form .submit input:focus {
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.admin-form .submit input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.admin-form .submit .skip-validation {
    width: fit-content;
    margin-bottom: 0;
    text-align: left;
}

.admin-form .submit .skip-validation label {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    margin-bottom: 0;
    font-weight: 500;
    cursor: pointer;
}

.admin-form .submit .skip-validation .input {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    margin-bottom: 0;
}

.admin-form .submit .skip-validation input[type="checkbox"] {
    width: 18px;
    height: 18px;
    padding: 0;
    margin-right: 8px;
}

.admin-form .submit .skip-validation abbr {
    text-decoration: underline dotted;
    cursor: help;
}

.admin-form .note {
    margin-top: 16px;
    text-align: right;
    font-size: 11px;
    color: var(--muted);
}

/*
|--------------------------------------------------------------------------
| Vistas de cliente, asesor y trabajador
|--------------------------------------------------------------------------
*/
.user-content-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 56px);
    margin: 56px 8px 0px 8px;
}

.user-content-wrapper.customer {
    justify-content: flex-start;
}

.user-content-wrapper img {
    width: 100%;
    max-width: 340px;
    margin-bottom: 28px;
}

.user-content-wrapper.customer img {
    margin-bottom: 36px;
}

.user-content-wrapper .window {
    width: 100%;
    max-width: 500px;
    margin-bottom: 32px;
}

.user-content-wrapper.customer .window {
    width: 100%;
    max-width: 1200px;
    margin-bottom: 32px;
}

.user-content-wrapper .window-title i {
    margin-right: 8px;
    color: var(--brand);
}

.window-section {
    margin-bottom: 20px;
}

.window-section .title {
    margin-bottom: 14px;
    padding-bottom: 6px;
    color: var(--brand-dark);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.window-section .content {
    display: flex;
    flex-wrap: wrap;
    color: var(--text);
}

/*
| Datos de solo lectura (ficha): filas planas etiqueta -> valor, sin caja ni fondo, separadas por una
| línea fina. A propósito no se parecen a los controles de los filtros (.customer-filter: etiqueta
| turquesa + input con borde) para que nadie los tome por campos editables.
*/
.window-section .content .field {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    /* Misma altura con texto, badge de aptitud o "No disponible" */
    min-height: 40px;
    border-bottom: 1px solid var(--border);
}

.window-section .content .field:last-child {
    border-bottom: 0;
}

.window-section .content .field label {
    display: inline-block;
    min-width: 150px;
    padding: 10px 16px 10px 0;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.window-section .content .field span {
    display: inline-block;
    padding: 10px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.window-section .content .field a {
    font-size: 13px;
    color: var(--brand-dark);
}

.window-section .content .field a i {
    margin-left: 4px;
}

.worker-filter {
    display: flex;
    margin-bottom: 12px;
}

.worker-filter label {
    background-color: var(--brand-soft);
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--brand-dark);
}

.worker-filter select {
    background-color: #fff;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border-strong);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    text-align: center;
    color: var(--text);
}

.worker-filter select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.consultant-filter,
.customer-filter {
    display: flex;
    flex-wrap: wrap;
}

.consultant-filter-field,
.customer-filter-field {
    display: flex;
    margin-bottom: 8px;
    margin-right: 8px;
}

.consultant-filter label,
.customer-filter label {
    background-color: var(--brand-soft);
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--brand-dark);
}

.consultant-filter input,
.customer-filter input {
    background-color: #fff;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    margin: 0;
    font-size: 13px;
    border: 1px solid var(--border-strong);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text);
    -webkit-transition: border-color 0.2s, box-shadow 0.2s;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.consultant-filter input:focus,
.customer-filter input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.consultant-filter input[type="date"],
.customer-filter input[type="date"] {
    text-align: center;
}

.consultant-filter .consultant-filter,
.customer-filter .customer-filter {
    display: flex;
    position: relative;
}

.consultant-filter .customer-input-wrapper,
.consultant-filter .customer-input,
.customer-filter .customer-input {
    display: flex;
    position: relative;
}

.consultant-filter .customers-input {
    background-color: #fff;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    min-width: 200px;
    margin-top: 2px;
    max-height: 180px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.consultant-filter .customers-input div,
.customer-filter .customers-input div {
    background-color: #fff;
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    -webkit-transition: background-color 0.2s;
    transition: background-color 0.2s;
}

.consultant-filter .customers-input div:hover,
.customer-filter .customers-input div:hover {
    background-color: var(--brand-soft);
}

.consultant-filter input[type="text"],
.customer-filter input[type="text"] {
    max-width: 130px;
}

.consultant-filter ::-webkit-input-placeholder,
.customer-filter ::-webkit-input-placeholder {
    /* Chrome/Opera/Safari */
    color: #9aa7ae;
}

.consultant-filter ::placeholder,
.customer-filter ::placeholder {
    color: #9aa7ae;
}

.consultant-filter input[type="submit"],
.customer-filter input[type="submit"] {
    background-color: var(--brand-dark);
    padding: 8px 18px;
    border: 1px solid var(--brand-dark);
    border-radius: var(--radius-sm);
    color: #fff;
    font-weight: 500;
    cursor: pointer;
    -webkit-transition: background-color 0.2s;
    transition: background-color 0.2s;
}

.consultant-filter input[type="submit"]:hover,
.customer-filter input[type="submit"]:hover {
    background-color: var(--brand-darker);
    border-color: var(--brand-darker);
}

.consultant-filter input[type="submit"]:active,
.customer-filter input[type="submit"]:active {
    background-color: var(--brand-deep);
}

/*
|--------------------------------------------------------------------------
| Inicio del administrador (estadísticas)
|--------------------------------------------------------------------------
*/
.admin-content-wrapper.dashboard {
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding-top: 68px;
}

.admin-content-wrapper.dashboard > * {
    box-sizing: border-box;
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.dashboard-heading {
    margin-bottom: 4px;
}

.dashboard-title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    color: var(--brand-deep);
}

.dashboard-subtitle {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: var(--muted);
}

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
}

.dashboard-actions .add-link {
    margin: 4px 8px 4px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-gap: 16px;
    gap: 16px;
    margin-bottom: 16px;
}

.stat-card {
    background-color: var(--surface);
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    grid-column-gap: 10px;
    align-items: center;
    padding: 16px 18px 18px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-icon {
    background-color: var(--brand-soft);
    display: flex;
    justify-content: center;
    align-items: center;
    grid-column: 1;
    grid-row: 1;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 16px;
    color: var(--brand);
}

/* El cuerpo no genera caja: etiqueta, valor y pie son celdas de la rejilla de la tarjeta */
.stat-body {
    display: contents;
}

.stat-label {
    grid-column: 2;
    grid-row: 1;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.25;
    color: var(--muted);
}

.stat-value {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 10px 0 8px 0;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--brand-deep);
}

.stat-footer {
    grid-column: 1 / -1;
    grid-row: 3;
    font-size: 12px;
    color: var(--muted);
}

.stat-delta {
    display: inline-block;
    padding: 2px 8px;
    margin-right: 6px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.stat-delta-up {
    background-color: #e3f6ec;
    color: #11803f;
}

.stat-delta-down {
    background-color: var(--danger-soft);
    color: var(--danger);
}

.stat-delta-flat,
.stat-delta-none {
    background-color: #eef2f4;
    color: var(--muted);
}

.stat-link {
    color: var(--brand-dark);
    font-weight: 600;
    text-decoration: none;
}

.stat-link:hover {
    color: var(--brand-deep);
}

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

.dashboard-card.wide {
    grid-column: span 2;
}

.dashboard-card.full {
    grid-column: 1 / -1;
}

.dashboard-card .window-content {
    padding-top: 12px;
}

.chart {
    width: 100%;
    min-height: 260px;
}

.chart.chart-donut {
    min-height: 220px;
}

.chart-legend {
    padding: 0;
    margin: 8px 0 0 0;
    list-style: none;
}

.chart-legend li {
    display: flex;
    align-items: center;
    padding: 6px 0;
    border-top: 1px solid var(--border);
    font-size: 13px;
}

.legend-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    margin-right: 10px;
    border-radius: 50%;
}

.legend-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-legend strong {
    margin-left: 12px;
    color: var(--brand-deep);
}

.chart-empty {
    padding: 48px 8px;
    margin: 0;
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}

.rank-list {
    padding: 0;
    margin: 0;
    list-style: none;
}

.rank-list li {
    margin-bottom: 16px;
}

.rank-list li:last-child {
    margin-bottom: 0;
}

.rank-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
}

.rank-name {
    min-width: 0;
    margin-right: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.rank-total {
    font-weight: 700;
    color: var(--brand-deep);
}

.rank-bar {
    height: 8px;
    border-radius: 4px;
    background-color: #edf2f4;
    overflow: hidden;
}

.rank-bar span {
    display: block;
    height: 100%;
    border-radius: 4px;
    background-color: var(--brand);
}

.latest-list {
    padding: 0;
    margin: 0;
    list-style: none;
}

.latest-list li + li {
    border-top: 1px solid var(--border);
}

.latest-list a {
    display: flex;
    align-items: center;
    padding: 12px 8px;
    border-radius: var(--radius-sm);
    color: inherit;
    text-decoration: none;
    -webkit-transition: background-color 0.2s;
    transition: background-color 0.2s;
}

.latest-list a:hover {
    background-color: var(--brand-soft);
}

/*
| Marca de aptitud (App\Support\AptBadge): el icono del tipo (si lo tiene) o su letra, siempre con
| el color del tipo. Sin modificador es la versión de tablas y ficha; --lg es la del dashboard.
*/
.apt-badge {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    vertical-align: middle;
    line-height: 1;
    font-weight: 700;
}

.apt-badge .icon {
    width: 20px;
    height: 20px;
}

.apt-badge--lg {
    flex-shrink: 0;
    box-sizing: border-box;
    width: 34px;
    height: 34px;
    margin-right: 12px;
    font-size: 14px;
}

.apt-badge--lg:not(.apt-badge--icon) {
    border: 2px solid currentColor;
    border-radius: 50%;
}

.apt-badge--lg .icon {
    width: 30px;
    height: 30px;
}

/* En la ficha el valor ya lleva el padding del resto de campos (.field span); el icono a 18 px
   deja la fila con la misma altura que las demás */
.window-section .content .field .apt-badge {
    display: inline-flex;
}

.window-section .content .field .apt-badge .icon {
    width: 18px;
    height: 18px;
}

/* Documento ausente: cruz roja y el texto en gris (el color solo no basta como señal) */
.doc-missing {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--muted);
}

.doc-missing .icon {
    width: 16px;
    height: 16px;
}

/* .field span fuerza display:inline-block y un padding que aquí sobran (anularía el gap) */
.window-section .content .field .doc-missing {
    display: inline-flex;
    vertical-align: middle;
    padding: 0;
    font-size: 13px;
    font-weight: 500;
}

/* Visto / no visto (check verde o cruz roja) en las tablas de cliente y asesor */
.seen-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.seen-mark .icon {
    width: 18px;
    height: 18px;
}

.latest-main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.latest-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.latest-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--muted);
}

.latest-date {
    margin-left: 12px;
    font-size: 12px;
    white-space: nowrap;
    color: var(--muted);
}

/*
|--------------------------------------------------------------------------
| Responsive
|--------------------------------------------------------------------------
|
| Escritorio: sidebar completa (240px).
| Tablet (446 - 886px): sidebar solo con iconos (60px).
| Móvil (hasta 445px): barra superior con menú desplegable.
|
| La anchura de la sidebar sale de --sidebar-width, que también usan el
| margen del contenido y la posición de los mensajes.
|
*/
@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .dashboard-card.wide,
    .dashboard-card.full {
        grid-column: auto;
    }
}

@media (min-width: 446px) and (max-width: 886px) {
    :root {
        --sidebar-width: 60px;
    }

    .admin-sidebar-logo {
        padding: 0;
    }

    .admin-sidebar-logo .logo-not-responsive {
        display: none;
    }

    .admin-sidebar-logo .logo-responsive {
        display: block;
    }

    .admin-sidebar-links > a {
        margin-left: 8px;
        margin-right: 8px;
    }

    .admin-sidebar-links > a span {
        display: none;
    }

    .admin-content-wrapper {
        padding-left: 20px;
        padding-right: 20px;
    }

    .admin-content-wrapper.list {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 540px) {
    .admin-form .form-section .field {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 445px) {
    :root {
        --sidebar-width: 0px;
    }

    .app-title {
        font-size: 22px;
    }

    .admin-sidebar-wrapper {
        display: none;
    }

    .admin-responsive-sidebar-wrapper {
        display: block;
    }

    /* La barra superior fija mide unos 61px */
    .admin-content-wrapper,
    .admin-content-wrapper.list,
    .admin-content-wrapper.dashboard {
        padding: 80px 12px 24px 12px;
    }

    /* El admin ya tiene "Configurar cuenta" y "Salir" en el desplegable de la barra superior */
    .user-pill--admin {
        display: none;
    }

    .user-pill {
        right: 12px;
    }

    .user-pill-role {
        display: none;
    }

    .user-pill-name {
        max-width: 110px;
    }

    .messages {
        bottom: 16px;
        margin: 0 12px;
        max-width: calc(100% - 24px);
    }

    .window-title {
        padding: 14px 16px;
        font-size: 16px;
    }

    .window-content {
        padding: 14px 16px 16px 16px;
    }

    .filter-wrapper {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .filter-title {
        display: none;
    }

    .filter-wrapper .filter {
        width: 100%;
        padding: 0;
    }

    .filter form {
        display: block;
    }

    .filter form .field {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .filter form label,
    .filter form input,
    .filter form select {
        width: 100%;
    }

    /* En móvil los campos de 16 px llevan su altura natural */
    .filter form input,
    .filter form select {
        height: auto;
    }

    .apply-filter {
        width: 100%;
        height: 44px;
        margin: 4px 0 0 0;
        font-size: 15px;
        font-weight: 600;
    }

    .apply-filter i {
        margin-right: 8px;
        font-size: 18px;
    }

    .apply-filter::after {
        content: "Aplicar filtros";
    }

    /* iOS hace zoom al enfocar campos con menos de 16px */
    .filter form input,
    .filter form select,
    .admin-form .input input,
    .admin-form .input select,
    .admin-form .input span,
    .admin-form .file-input span,
    .login-form-wrapper .input input,
    .import-options .input,
    .consultant-filter input,
    .customer-filter input,
    .worker-filter select,
    .order-input select {
        font-size: 16px;
    }

    .pagination-links li .page-link {
        min-width: 40px;
        padding: 11px 12px;
    }

    .add-link a {
        padding: 11px 14px;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .window-section .content > div {
        width: 100%;
        margin-right: 0 !important;
    }

    .window-section .content .field {
        flex-direction: column;
    }

    /* Apilado, el valor se alinea a la izquierda (si no, el badge de aptitud se estira y se centra) */
    .window-section .content .field {
        align-items: flex-start;
    }

    .window-section .content .field label {
        width: 100%;
        padding: 10px 0 0;
    }

    .window-section .content .field span {
        padding-top: 2px;
    }

    .window-section .content .field label,
    .window-section .content .field span {
        box-sizing: border-box;
    }

    .consultant-filter-field,
    .customer-filter-field {
        width: 100%;
        margin-right: 0;
    }

    /* El tamaño intrínseco de los inputs (~170px) impide que el formulario encoja:
       se parte de ancho 0 y se reparte el sitio con flex */
    .consultant-filter,
    .customer-filter {
        width: 100%;
        min-width: 0;
    }

    .consultant-filter-field,
    .customer-filter-field {
        min-width: 0;
    }

    .consultant-filter input,
    .customer-filter input {
        flex: 1 1 0;
        width: 0;
        min-width: 0;
    }

    .consultant-filter input[type="text"],
    .customer-filter input[type="text"] {
        max-width: none;
    }

    .consultant-filter .customer-input,
    .customer-filter .customer-input {
        width: 100%;
    }

    .consultant-filter-field.customer-input-wrapper {
        width: 100%;
    }

    .consultant-filter input[type="submit"],
    .customer-filter input[type="submit"] {
        width: 100%;
        padding: 11px 18px;
    }

    .latest-date {
        display: none;
    }

    .import-options label {
        flex-basis: 110px;
    }
}

@media (min-width: 360px) and (max-width: 445px) {
    .filter form {
        display: flex;
        justify-content: space-between;
    }

    .filter form .field {
        width: calc(50% - 5px);
    }

    /* Un campo ocupa media fila; el desplegable de autocompletado sale a todo el ancho del filtro */
    .filter .consultants-input,
    .filter .customers-input {
        min-width: 180px;
    }
}

.tinytext-success {
    color: var(--success);
    position: absolute;
    bottom: -14px;
    font-size: 10px;
}

.admin-form input.disabled {
    background-color: #eef1f3;
    border-color: var(--border-strong);
    cursor: default;
}


/* quitar cosas de la paginacion, mejor esto que crear vistas creo yo */
.page-item:first-child, /* Oculta "Previous" */
.page-item:last-child { /* Oculta "Next" */
    display: none !important;
}

.small.text-muted { /* Oculta el "Showing..." */
    display: none !important;
}
