/* =====================================================
   TaskManager - Fluent Design System
   ===================================================== */

:root {
    --tm-primary: #2A4668;
    --tm-primary-dark: #0F1A2C;
    --tm-primary-light: #9BBBD1;
    --tm-sidebar-width: 240px;
    --tm-sidebar-collapsed: 60px;
    --tm-topbar-height: 56px;
    --tm-sidebar-bg: #0F1A2C;
    --tm-sidebar-text: #c8cdd4;
    --tm-sidebar-hover: rgba(255,255,255,0.08);
    --tm-sidebar-active: rgba(42, 70, 104, 0.35);
    --tm-bg: #f3f4f6;
    --tm-card-bg: #ffffff;
    --tm-border: #e5e7eb;
    --tm-text: #1f2937;
    --tm-text-muted: #6b7280;
    --tm-radius: 8px;
    --tm-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --tm-shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);

    /* Paleta semántica (estados). Distinta de la paleta de marca
       (--tm-primary/dark/light): refleja intención funcional, no identidad. */
    --tm-danger-bg: #fee2e2; --tm-danger-fg: #991b1b; --tm-danger-fg-strong: #dc2626;
    --tm-warn-bg:   #fef3c7; --tm-warn-fg:   #92400e;
    --tm-info-bg:   #dbeafe; --tm-info-fg:   #1d4ed8;
    --tm-ok-bg:     #dcfce7; --tm-ok-fg:     #166534;          /* éxito / agenda activa */
    --tm-muted-bg:  #f3f4f6; --tm-muted-fg:  #6b7280;
    --tm-hover-bg:  #f9fafb;
    --tm-load-low:  #16a34a; --tm-load-ok:   #0284c7;
    --tm-load-high: #ca8a04; --tm-load-over: #dc2626;
}

/* -------- Reset & Base -------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--tm-bg); color: var(--tm-text); font-size: 14px; }

/* -------- Layout Shell -------- */
.tm-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    transition: all .25s ease;
}

/* -------- Sidebar -------- */
.tm-sidebar {
    width: var(--tm-sidebar-width);
    min-width: var(--tm-sidebar-width);
    background: var(--tm-sidebar-bg);
    display: flex;
    flex-direction: column;
    transition: width .25s ease, min-width .25s ease;
    overflow: hidden;
    z-index: 100;
}
.tm-layout.sidebar-collapsed .tm-sidebar {
    width: var(--tm-sidebar-collapsed);
    min-width: var(--tm-sidebar-collapsed);
}
.tm-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    height: var(--tm-topbar-height);
    background: var(--tm-card-bg);
    border-bottom: 1px solid var(--tm-border);
    box-shadow: var(--tm-shadow);
}
.tm-logo { display: flex; align-items: center; gap: 10px; overflow: hidden; flex: 1; min-width: 0; }
.tm-logo-icon { font-size: 20px; color: var(--tm-primary); flex-shrink: 0; }
.tm-logo-text { color: var(--tm-text); font-weight: 600; font-size: 15px; white-space: nowrap; display: flex; align-items: center; width: 90%; }
.tm-logo-text img { width: 90%; height: auto; aspect-ratio: auto; object-fit: contain; display: block; }
.tm-toggle-btn {
    background: none; border: none; color: var(--tm-text-muted);
    cursor: pointer; padding: 6px; border-radius: 6px; line-height: 1;
    flex-shrink: 0;
}
.tm-toggle-btn:hover { background: var(--tm-primary-light); }

/* Nav */
.tm-nav { padding: 12px 0; overflow-y: auto; flex: 1; }
.tm-nav-header {
    padding: 0 12px 12px;
}
.tm-nav-search {
    width: 100%;
}
.tm-nav-empty {
    padding: 8px 16px;
    color: var(--tm-text-muted);
    font-size: 12px;
}
.tm-sidebar-footer {
    flex-shrink: 0;
    padding: 8px 12px 10px;
    background: var(--tm-sidebar-bg);
}
.tm-sidebar-footer-separator {
    margin: 0 0 8px;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    opacity: 1;
}
.tm-sidebar-footer-versions {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tm-sidebar-footer-versions-collapsed {
    align-items: center;
    gap: 1px;
}
.tm-sidebar-footer-version-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 11px;
    letter-spacing: .03em;
    white-space: nowrap;
    overflow: hidden;
}
.tm-sidebar-footer-version-label {
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.35);
}
.tm-sidebar-footer-version {
    color: rgba(255, 255, 255, 0.65);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tm-sidebar-footer-versions-collapsed .tm-sidebar-footer-version {
    text-align: center;
}
.tm-sidebar-footer-version-loading {
    color: rgba(255, 255, 255, 0.25);
}
.tm-nav-section { margin-bottom: 4px; }
.tm-nav-section-title {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 16px; color: rgba(255,255,255,0.55);
    font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
    white-space: nowrap; overflow: hidden;
}
.tm-nav-section-toggle {
    width: 100%;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
}
.tm-nav-section-chevron { margin-left: auto; }
.tm-nav-section-favorites {
    margin: 0 8px 10px;
    border: 1px solid rgba(42, 70, 104, 0.45);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(42, 70, 104, 0.18), rgba(42, 70, 104, 0.08));
}
.tm-nav-section-favorites .tm-nav-section-title {
    color: #9BBBD1;
    font-weight: 600;
}
.tm-nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 16px; color: var(--tm-sidebar-text);
    text-decoration: none; border-radius: 0;
    transition: background .15s ease, color .15s ease;
    white-space: nowrap; overflow: hidden;
}
.tm-nav-item:hover { background: var(--tm-sidebar-hover); color: #fff; }
.tm-nav-item.active { background: var(--tm-sidebar-active); color: #fff; border-left: 3px solid var(--tm-primary); }
.tm-nav-item-group { cursor: default; opacity: .9; }
.tm-nav-item-group:hover { background: transparent; color: var(--tm-sidebar-text); }
.tm-nav-item-group {
    width: 100%;
    border: none;
    background: none;
    text-align: left;
}
.tm-nav-icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.tm-nav-label { font-size: 14px; }
.tm-nav-item-chevron { margin-left: auto; }
.tm-nav-item-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-right: 8px;
}
.tm-nav-item-row .tm-nav-item {
    flex: 1;
    min-width: 0;
}
.tm-nav-item-favorite {
    color: #e8f3ff;
    font-weight: 600;
    border-left: 3px solid rgba(155, 187, 209, 0.95);
}
.tm-nav-item-favorite:hover {
    background: rgba(42, 70, 104, 0.28);
    color: #fff;
}

.tm-nav-pin-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 260;
}

.tm-nav-pin-menu {
    position: fixed;
    z-index: 261;
    background: var(--tm-card-bg);
    border: 1px solid var(--tm-border);
    border-radius: 8px;
    box-shadow: var(--tm-shadow-md);
    padding: 6px;
    min-width: 190px;
}

.tm-nav-pin-menu-btn {
    width: 100%;
    text-align: left;
    color: var(--tm-text) !important;
}

.tm-nav-pin-menu-btn:hover {
    background: var(--tm-primary-light) !important;
}
.tm-nav-item.collapsed { justify-content: center; padding: 9px 0; }

/* -------- Main Area -------- */
.tm-main {
    flex: 1; display: flex; flex-direction: column;
    overflow: hidden; min-width: 0;
}

/* -------- Top Bar -------- */
.tm-topbar {
    height: var(--tm-topbar-height);
    background: var(--tm-card-bg);
    border-bottom: 1px solid var(--tm-border);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 12px;
    padding: 0 20px;
    flex-shrink: 0;
    box-shadow: var(--tm-shadow);
    z-index: 50;
}
.tm-topbar-left {
    display: flex;
    align-items: center;
    min-width: 0;
}
.tm-topbar-center {
    justify-self: center;
    min-width: 0;
}
.tm-topbar-right {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.tm-profile-select { min-width: 200px; }
.tm-mobile-menu-btn { display: none; margin-right: 8px; }
.tm-mobile-menu-btn .dx-icon.bi {
    font-family: bootstrap-icons !important;
    font-size: 1.25rem;
    color: var(--tm-text);
}

/* ── Remote profile selector ── */
.tm-remote-overlay {
    position: fixed; inset: 0; z-index: 199;
}
.tm-remote-selector {
    position: relative;
}
.tm-remote-badge {
    display: flex; align-items: center;
    background: var(--tm-hover-bg, rgba(0,0,0,.04));
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
    padding: 5px 10px;
    font-size: .85rem;
    white-space: nowrap;
    cursor: default;
    transition: background .15s;
}
.tm-remote-badge--clickable {
    cursor: pointer;
}
.tm-remote-badge--clickable:hover {
    background: var(--tm-primary-light);
    border-color: var(--tm-primary);
}
.tm-remote-badge-info { display: flex; align-items: center; flex-wrap: nowrap; }
.tm-remote-dropdown {
    position: absolute; top: calc(100% + 6px); right: 0;
    min-width: 240px; background: var(--tm-card-bg);
    border: 1px solid var(--tm-border); border-radius: var(--tm-radius);
    box-shadow: var(--tm-shadow-md); z-index: 200;
    overflow: hidden;
}
.tm-remote-dropdown-item {
    display: flex; align-items: center; width: 100%;
    padding: 8px 12px; border: none; background: none;
    cursor: pointer; transition: background .12s;
    border-bottom: 1px solid var(--tm-border);
}
.tm-remote-dropdown-item:last-child { border-bottom: none; }
.tm-remote-dropdown-item:hover { background: var(--tm-primary-light); }
.tm-remote-dropdown-item.active { background: rgba(42, 70, 104, .08); }
.tm-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #e5e7eb;
    border: 1px solid var(--tm-border);
}
.tm-user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tm-user-avatar-fallback {
    color: #374151;
    font-size: 12px;
    font-weight: 700;
}
.tm-user-avatar-sm {
    width: 32px;
    height: 32px;
}
.tm-user-avatar-sm .tm-user-avatar-fallback {
    font-size: 11px;
}
.tm-user-btn { font-weight: 500 !important; }
.tm-user-btn-avatar {
    padding: 0 !important;
}

.tm-user-btn-avatar .tm-user-avatar {
    border-color: transparent;
}
.tm-user-avatar-wrap {
    position: relative;
    display: inline-flex;
}
.tm-user-avatar-badge {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffc107;
    color: #1f2937;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    line-height: 1;
    border: 1.5px solid #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.15);
    pointer-events: none;
}
.tm-user-avatar-badge i { font-size: 9px; }
.tm-user-menu { min-width: 200px; }
.tm-menu-item { padding: 8px 16px !important; }

/* -------- Content -------- */
.tm-content {
    flex: 1; min-height: 0; overflow-y: auto; padding: 24px;
    background: var(--tm-bg);
}

.tm-content-ajustado {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: var(--tm-bg);
}

/* -------- Page scaffold --------
   Estructura común para todas las páginas:
     <main class="tm-content-ajustado">
       <div class="tm-page">
         <PageToolbar />     ← topbar-strip flush con los bordes de <main>
         <div class="tm-page-body">...contenido con cards, grids, etc...</div>
       </div>
     </main>
   El <main> no añade padding (sigue siendo 100% alto/ancho del área
   restante). El padding vive en .tm-page y se anula con margen negativo
   en el strip para que el toolbar quede flush con los bordes laterales
   y superior del área de contenido.

   Cadena flex para grids:
     .tm-page             → height:100% de <main>
     .tm-page-body        → flex:1, min-height:0  → toma el alto restante
     .tm-card-plain       → flex:1, min-height:0  → la card del grid estira
     .dxbl-grid           → flex:1, min-height:0  → el grid rellena y scrollea
   Sin min-height:0 en los niveles intermedios, el grid fuerza a los
   padres a crecer a su contenido real → scroll vertical enorme.
*/
.tm-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    height: 100%;
    background: var(--tm-bg);
}

.tm-page-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* Cards sin grid (stack estático de cards) NO deben encogerse: el body
   ya tiene overflow-y:auto y gestiona el scroll; si los items se
   encogen (flex-shrink:1 default) pierden altura, .tm-card-plain
   { overflow:hidden } recorta el contenido y el scrollbar no aparece.
   Regla corta específica para los hijos directos del body. La regla
   :has(.dxbl-grid) siguiente gana por especificidad para tarjetas con
   grid, donde sí queremos que se estiren. */
.tm-page-body > .tm-card-plain {
    flex-shrink: 0;
}

/* Card que envuelve un grid: estira para rellenar el body y permite que
   el grid scrollee internamente. Usamos :has() para no obligar a cada
   página a añadir un modifier class al card. */
.tm-page-body > .tm-card-plain:has(.dxbl-grid),
.tm-page-body > .tm-card-plain:has(.dxbl-scheduler) {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* Grid/scheduler dentro del body: rellena su contenedor con scroll
   interno, no empuja al <main>. */
.tm-page-body .dxbl-grid,
.tm-page-body .dxbl-scheduler {
    flex: 1 1 auto;
    min-height: 0;
}

/* Topbar-strip: la "fila superior" del usuario. Flush con los bordes
   superior y laterales del <main> (negativo margin rompe el padding del
   .tm-page). Fondo blanco, border-bottom tenue, padding interno. */
.tm-page-toolbar-strip {
    display: flex;
    align-items: center;
    gap: 8px 12px;
    flex-wrap: wrap;
    margin: -16px -16px 0;
    padding: 10px 16px;
    background: var(--tm-card-bg);
    border-bottom: 1px solid var(--tm-border);
    box-shadow: var(--tm-shadow);
    border-radius: var(--tm-radius) var(--tm-radius) 0 0;
}

/* Clusters dentro del strip: start (título + subtítulo), filters, end (acciones) */
.tm-strip-start {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex-shrink: 1;
}
.tm-strip-start .tm-strip-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--tm-text);
    margin: 0;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.tm-strip-start .tm-strip-title .tm-strip-accent {
    width: 4px;
    height: 4px;
    background: var(--tm-primary);
    display: inline-block;
    flex-shrink: 0;
}
.tm-strip-start .tm-strip-subtitle {
    font-size: 0.8rem;
    color: var(--tm-text-muted);
    margin: 0;
    line-height: 1.2;
}

.tm-strip-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}

/* Search box dentro de filters: ancho cómodo pero no se come la fila. */
.tm-strip-search {
    min-width: 200px;
    max-width: 320px;
    flex: 1 1 200px;
}
/* Combobox/DropDown dentro de filters: ancho fijo razonable. */
.tm-strip-filters .dxbl-combobox,
.tm-strip-filters .dxbl-select,
.tm-strip-filters .dxbl-date-edit {
    min-width: 180px;
    max-width: 240px;
}

.tm-strip-end {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
}

/* Separador visual entre clusters (lo usa BeginGroup=true en PageAccion) */
.tm-strip-separator {
    width: 1px;
    align-self: stretch;
    background: var(--tm-border);
    margin: 4px 4px;
    flex-shrink: 0;
}

/* En móvil: el strip mantiene wrap; el cluster end baja a una nueva fila. */
@media (max-width: 767.98px) {
    .tm-strip-end { margin-left: 0; }
    .tm-strip-separator { display: none; }
}

/* -------- Page Header -------- */
.tm-page-title { font-weight: 600; color: var(--tm-text); }

/* Module accent dot — same 4×4 signature as .tm-strip-accent, for detail
   pages whose header structure (back + breadcrumb + editable title) is too
   bespoke for <PageToolbar>. Use as: <h4 class="tm-page-title tm-page-title--accent" style="--tm-module-accent:#C2410C"> */
.tm-page-title--accent {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.tm-page-title--accent::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--tm-module-accent, var(--tm-primary));
    display: inline-block;
    flex-shrink: 0;
}

/* -------- DxToolbar como cabecera de página -------- */
.tm-page-toolbar {
    background: var(--tm-card-bg);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
    box-shadow: var(--tm-shadow);
    margin-bottom: 16px;
}
.tm-page-toolbar .tm-toolbar-combo { width: 140px; }
.tm-page-toolbar .tm-toolbar-search { width: 230px; }

/* -------- Stat Cards -------- */
.tm-stat-card {
    display: flex; align-items: center; gap: 16px;
    background: var(--tm-card-bg); border-radius: var(--tm-radius);
    padding: 20px; box-shadow: var(--tm-shadow); border: 1px solid var(--tm-border);
    transition: box-shadow .2s;
}
.tm-stat-card:hover { box-shadow: var(--tm-shadow-md); }
.tm-stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.tm-stat-primary .tm-stat-icon { background: var(--tm-info-bg);   color: #2563eb; }
.tm-stat-info    .tm-stat-icon { background: #e0f2fe;             color: #0284c7; }
.tm-stat-success .tm-stat-icon { background: var(--tm-ok-bg);     color: #16a34a; }
.tm-stat-warning .tm-stat-icon { background: #fef9c3;             color: #ca8a04; }
.tm-stat-danger  .tm-stat-icon { background: var(--tm-danger-bg); color: var(--tm-danger-fg-strong); }
.tm-stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.tm-stat-label { font-size: 13px; color: var(--tm-text-muted); margin-top: 2px; }

/* -------- Cards -------- */
.tm-card-plain {
    background: var(--tm-card-bg); border-radius: var(--tm-radius);
    border: 1px solid var(--tm-border); box-shadow: var(--tm-shadow);
    overflow: hidden;
}
.tm-card-plain-header {
    padding: 14px 18px; border-bottom: 1px solid var(--tm-border);
    background: #fafafa; font-weight: 600;
}

/* -------- Grid -------- */
.tm-grid { border: none !important; }
.tm-grid .dx-datagrid-headers { background: #f9fafb; }

/* Compact grid (detail pages – inside tm-card-plain) */
.tm-grid-compact td,
.tm-grid-compact .dxbl-grid-data-cell {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    font-size: 13px;
    line-height: 1.4;
}
.tm-grid-compact th,
.tm-grid-compact .dxbl-grid-header-cell {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
    font-size: 12px;
    font-weight: 600;
    background: #f9fafb;
}

/* Detail sub-grid (inside master-detail row) */
.tm-grid-detail td,
.tm-grid-detail .dxbl-grid-data-cell {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    font-size: 12px;
}
.tm-grid-detail th,
.tm-grid-detail .dxbl-grid-header-cell {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    font-size: 11px;
    font-weight: 600;
    background: #f3f4f6;
}
.tm-grid-detail { border: none !important; background: #fafafa; }

.tm-grid-row-actions {
    padding: 0 !important;
    min-width: 28px;
    color: var(--tm-text-muted, #6b7280);
}
.tm-grid-row-actions:hover { color: var(--tm-text, #111827); }
.tm-grid-row-actions-centered { display: inline-flex; justify-content: center; }

.tm-grid-name-link {
    color: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.tm-grid-name-link:hover {
    text-decoration: underline;
    color: var(--bs-primary, #0d6efd);
}

/* -------- Badges -------- */
.tm-badge {
    display: inline-flex; align-items: center; padding: 2px 10px;
    border-radius: 999px; font-size: 12px; font-weight: 500;
}
.tm-status-pending    { background: #fef3c7; color: #92400e; }
.tm-status-inprogress { background: #dbeafe; color: #1e40af; }
.tm-status-onhold     { background: #f3f4f6; color: #374151; }
.tm-status-completed  { background: #d1fae5; color: #065f46; }
.tm-status-cancelled  { background: #fee2e2; color: #991b1b; }
.tm-priority-low      { background: #f0fdf4; color: #15803d; }
.tm-priority-medium   { background: #fef9c3; color: #854d0e; }
.tm-priority-high     { background: #ffedd5; color: #9a3412; }
.tm-priority-critical { background: #fee2e2; color: #7f1d1d; }
.tm-badge-active      { background: #d1fae5; color: #065f46; }
.tm-badge-inactive    { background: #f3f4f6; color: #6b7280; }
.tm-badge-role        { background: var(--tm-primary-light); color: var(--tm-primary-dark); }

/* Variantes semánticas para badge inline (estado de inbox, contador de
   avisos, etc.). Conviven con .tm-stat-* .tm-stat-icon (línea ~591) que
   colorea el icono de las tarjetas KPI: aquí el color va en el propio
   badge, no en un descendiente .tm-stat-icon. */
.tm-badge.tm-stat-primary { background: var(--tm-info-bg);   color: var(--tm-info-fg); }
.tm-badge.tm-stat-info    { background: #e0f2fe;             color: #0369a1; }
.tm-badge.tm-stat-success { background: var(--tm-ok-bg);     color: var(--tm-ok-fg); }
.tm-badge.tm-stat-warning { background: var(--tm-warn-bg);   color: var(--tm-warn-fg); }
.tm-badge.tm-stat-danger  { background: var(--tm-danger-bg); color: var(--tm-danger-fg); }

/* -------- Login -------- */
.tm-empty-layout {
    min-height: 100vh; min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    min-width: 100vw;
}

.tm-login-bg {
    position: relative;
    min-height: 100vh; min-height: 100dvh;
    min-width: 100vw;
    display: flex; align-items: center; justify-content: center;
    padding: 24px 16px;
    overflow: hidden;
    background:
        radial-gradient(ellipse at top, #1a2c44 0%, #0F1A2C 60%, #060a14 100%);
    isolation: isolate;
}

.tm-login-glow {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    filter: blur(90px);
    opacity: 0.55;
    will-change: transform;
}
.tm-login-glow--1 {
    top: -12%; left: -8%;
    width: 480px; height: 480px;
    background: radial-gradient(circle, #2A4668 0%, transparent 70%);
    animation: tm-login-glow-drift-1 22s ease-in-out infinite;
}
.tm-login-glow--2 {
    bottom: -18%; right: -10%;
    width: 520px; height: 520px;
    background: radial-gradient(circle, #9BBBD1 0%, transparent 70%);
    animation: tm-login-glow-drift-2 28s ease-in-out infinite;
}
@keyframes tm-login-glow-drift-1 {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50%      { transform: translate3d(50px, 30px, 0) scale(1.06); }
}
@keyframes tm-login-glow-drift-2 {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50%      { transform: translate3d(-40px, -50px, 0) scale(1.08); }
}

.tm-login-grid {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
            mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

.tm-login-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    padding: 48px 44px 32px;
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfd 100%);
    box-shadow:
        0 30px 80px -20px rgba(0, 30, 80, 0.55),
        0 12px 32px -8px rgba(0, 30, 80, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    animation: tm-login-card-in 600ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.tm-login-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.15) 40%, transparent);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
}
@keyframes tm-login-card-in {
    0%   { opacity: 0; transform: translate3d(0, 16px, 0) scale(0.985); }
    100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

.tm-login-header { text-align: center; margin-bottom: 28px; }
.tm-login-icon {
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 22px;
}
.tm-login-icon img {
    max-width: 180px; width: 100%; height: auto; display: block;
}
.tm-login-title {
    font-size: 26px; font-weight: 700; letter-spacing: -0.02em;
    color: #0b1220; margin: 0 0 6px;
}
.tm-login-subtitle {
    font-size: 14px; color: #6b7280; margin: 0;
}

.tm-login-form { display: flex; flex-direction: column; gap: 14px; }
.tm-login-field { display: flex; flex-direction: column; }
.tm-login-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; margin-top: 2px;
}

.tm-login-error {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 10px;
    background: #fef2f2; color: #b91c1c;
    border: 1px solid #fecaca;
    font-size: 13px; line-height: 1.4;
}
.tm-login-error-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    background: #b91c1c; color: #fff;
    font-weight: 700; font-size: 12px; line-height: 1;
    flex: 0 0 20px;
}
.tm-login-success {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 10px;
    background: #ecfdf5; color: #047857;
    border: 1px solid #a7f3d0;
    font-size: 13px; line-height: 1.4;
}
.tm-login-success-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    background: #047857; color: #fff;
    font-weight: 700; font-size: 12px; line-height: 1;
    flex: 0 0 20px;
}
.tm-login-back {
    align-self: center;
    color: var(--tm-text-muted) !important;
    font-size: 13px;
    margin-top: -2px;
}
.tm-login-back:hover {
    color: var(--tm-primary) !important;
}

/* Input polish — estilo "borderless / surface" tipo Stripe/Linear.
   En reposo no hay reborde visible: el campo se diferencia por una
   superficie gris muy sutil. En focus aparece un borde fino de marca
   y un halo exterior suave. Se neutralizan los reborde y sombra
   internos que DevExpress Blazor aplica a sus wrappers. */
.tm-login-input,
.tm-login-input.dxbl-text-edit,
.tm-login-input .dxbl-text-edit,
.tm-login-input .dxbl-text-edit-container,
.tm-login-input .dxbl-input-wrapper,
.tm-login-input .dxbl-input,
.tm-login-input .dxbl-edit,
.tm-login-input .form-control,
.tm-login-input input.form-control,
.tm-login-input.form-control {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.tm-login-input {
    display: block;
    height: 46px;
    border-radius: 10px;
    background: #f3f5f9;
    border: 1px solid transparent !important;
    transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.tm-login-input:hover {
    background: #eaeef5;
}

.tm-login-input:focus-within,
.tm-login-input.is-focused {
    background: #ffffff;
    border-color: var(--tm-primary) !important;
    box-shadow: 0 0 0 4px rgba(42, 70, 104, 0.12);
}

.tm-login-input .form-control,
.tm-login-input input.form-control,
.tm-login-input.form-control {
    height: 100%;
    background: transparent !important;
    font-size: 14px;
    padding: 0 14px;
    color: var(--tm-text);
}

/* Validation messages (DataAnnotationsValidator) */
.tm-login-field .validation-message,
.tm-login-field .field-validation-error,
.validation-message {
    color: #dc2626;
    font-size: 12px;
    margin-top: 6px;
}

/* Submit button refinement */
.tm-login-submit {
    height: 46px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.01em;
    background: linear-gradient(180deg, #345a82 0%, #2A4668 100%) !important;
    border: none !important;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.18) inset,
        0 6px 16px -4px rgba(42, 70, 104, 0.5) !important;
    transition: transform 140ms ease, box-shadow 220ms ease, filter 200ms ease;
    margin-top: 6px;
}
.tm-login-submit:hover:not(:disabled) {
    transform: translate3d(0, -1px, 0);
    filter: brightness(1.05);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.18) inset,
        0 10px 22px -6px rgba(42, 70, 104, 0.6) !important;
}
.tm-login-submit:active:not(:disabled) {
    transform: translate3d(0, 0, 0) scale(0.99);
}

.tm-login-footer {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid #eef0f3;
    font-size: 12px;
    color: #9ca3af;
}
.tm-login-secure {
    display: inline-flex; align-items: center; gap: 6px;
}
.tm-login-secure-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
    animation: tm-login-pulse 2.4s ease-in-out infinite;
}
@keyframes tm-login-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.35); }
    50%      { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}
.tm-login-brand {
    font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
    color: #c5cad3;
}
.tm-login-help {
    color: #5a6478;
    font-size: 0.82rem;
    max-width: 60%;
    text-align: left;
    line-height: 1.35;
}
@media (max-width: 575.98px) {
    .tm-login-help { max-width: 100%; }
}

@media (max-width: 576px) {
    .tm-login-card {
        padding: 32px 20px 24px;
        border-radius: 16px;
    }
    .tm-login-title { font-size: 22px; }
    .tm-login-glow--1 { width: 320px; height: 320px; }
    .tm-login-glow--2 { width: 340px; height: 340px; }
    .tm-login-footer { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
    .tm-login-card,
    .tm-login-glow--1,
    .tm-login-glow--2,
    .tm-login-secure-dot {
        animation: none !important;
    }
    .tm-login-input .form-control,
    .tm-login-submit {
        transition: none !important;
    }
}

/* -------- Divider (legacy; re-enabled when OAuth buttons are wired) -------- */
.tm-divider {
    text-align: center; position: relative; margin: 20px 0;
    color: var(--tm-text-muted); font-size: 13px;
}
.tm-divider::before, .tm-divider::after {
    content: ''; position: absolute; top: 50%; width: 40%; height: 1px;
    background: var(--tm-border);
}
.tm-divider::before { left: 0; }
.tm-divider::after { right: 0; }

/* -------- Filtros en header de página --------
   .tm-filter-combo: combo de filtro que vive en la fila de acciones del header
   de una página. En un flex container el `width: 100%` del .w-100 no surte efecto,
   así que usamos flex-basis + min-width para que el combo se estire mientras
   deja sitio al spinner y a los botones. */
.tm-filter-combo {
    flex: 1 1 240px;
    min-width: 200px;
    max-width: 360px;
}
.tm-spinner-sm {
    width: 18px !important;
    height: 18px !important;
    flex: 0 0 auto;
}
.tm-spinner-sm .dxbl-wait-indicator-icon,
.tm-spinner-sm .dxbl-load-indicator {
    width: 18px !important;
    height: 18px !important;
}

/* -------- DxPopup responsive (móvil) --------
   DevExpress v25.2 markup:
     .dxbl-popup-portal > .dxbl-popup > [ .dxbl-popup-header? , <div body> , .dxbl-popup-buttons-area? ]
   El <div> del body no tiene clase, se selecciona por exclusión.
   Estrategia: popup a position:fixed inset:0 (fullscreen real) + header/footer
   sticky + body con max-height + overflow-y:auto. NO usar flex en el popup
   (choca con el layout interno de DevExpress) ni tocar la zona principal. */
.dxbl-popup-portal > .dxbl-popup > .dxbl-popup-buttons-area {
    flex-wrap: wrap !important;
    gap: 8px !important;
}

@media (max-width: 575.98px) {
    .dxbl-popup-portal > .dxbl-popup {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        height: 100dvh !important;
        max-width: 100vw !important;
        max-height: 100dvh !important;
        min-width: 0 !important;
        transform: none !important;
        margin: 0 !important;
        border-radius: 0 !important;
        overflow: hidden !important;
    }

    .dxbl-popup-portal > .dxbl-popup > .dxbl-popup-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 2 !important;
        background: inherit !important;
    }

    .dxbl-popup-portal > .dxbl-popup > .dxbl-popup-buttons-area {
        position: sticky !important;
        bottom: 0 !important;
        z-index: 2 !important;
        background: inherit !important;
    }

    .dxbl-popup-portal > .dxbl-popup > div:not(.dxbl-popup-header):not(.dxbl-popup-buttons-area) {
        max-height: calc(100dvh - 120px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }
}

@media (min-width: 576px) and (max-width: 991.98px) {
    .dxbl-popup-portal > .dxbl-popup {
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100vh - 24px) !important;
    }
}

/* Anidado: cuando un DxPopup abre otro DxPopup (ej. EmpresaDireccionesDialog),
   el inner en escritorio debe respetar el outer, no el viewport. En móvil ya
   queda fullscreen por la regla de arriba. */
.dxbl-popup-portal .dxbl-popup-portal > .dxbl-popup {
    max-width: calc(100% - 16px) !important;
    max-height: calc(100% - 16px) !important;
}

@media (max-width: 575.98px) {
    .dxbl-popup-portal .dxbl-popup-portal > .dxbl-popup {
        max-width: 100vw !important;
        max-height: 100dvh !important;
    }
}

/* Grids dentro de popups: scroll horizontal en lugar de desbordar el popup */
.dxbl-popup .dxbl-grid,
.dxbl-popup .dxbl-grid .dxbl-grid-root,
.dxbl-popup .remote-preview-grid-wrapper {
    max-width: 100% !important;
    overflow-x: auto !important;
}

/* Editor de Monaco dentro de popups */
.dxbl-popup .monaco-editor,
.dxbl-popup .monaco-editor .overflow-guard {
    max-width: 100% !important;
}

/* Inputs de formulario a ancho completo en popups estrechos */
.dxbl-popup input.dxbl-edit,
.dxbl-popup textarea.dxbl-edit,
.dxbl-popup .dxbl-text-edit,
.dxbl-popup .dxbl-combo-box,
.dxbl-popup .dxbl-spin-edit,
.dxbl-popup .dxbl-date-edit {
    max-width: 100% !important;
}

/* Form-layout dentro de popups: permitir wrap en viewports estrechos */
.dxbl-popup .dxbl-form-layout {
    min-width: 0 !important;
}

/* -------- RecursoEditDialog --------
   Card de edición de un recurso: firma visual (type chip) + form layout.
   Type chip: pequeña "spec card" arriba del form que muestra el icono y el
   color del TipoRecursoDef seleccionado. Si no hay tipo, estado neutro. */
.tm-rec-type-chip {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 10px;
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    margin-bottom: 16px;
    transition: background-color 160ms ease, border-color 160ms ease;
}
.tm-rec-type-chip__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--tm-rec-chip-tint, #FFFFFF);
    color: var(--tm-rec-chip-accent, #0F172A);
    font-size: 22px;
    line-height: 1;
    flex: 0 0 auto;
    border: 1px solid var(--tm-rec-chip-rule, #E2E8F0);
}
.tm-rec-type-chip__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}
.tm-rec-type-chip__eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748B;
    line-height: 1.2;
}
.tm-rec-type-chip__name {
    font-size: 14px;
    font-weight: 600;
    color: #0F172A;
    line-height: 1.3;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tm-rec-type-chip__counter {
    font-size: 12px;
    color: #64748B;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}
.tm-rec-type-chip--placeholder {
    background: transparent;
    border-style: dashed;
}
.tm-rec-type-chip--placeholder .tm-rec-type-chip__icon {
    background: #F8FAFC;
    color: #94A3B8;
}
.tm-rec-type-chip--placeholder .tm-rec-type-chip__name {
    color: #94A3B8;
    font-weight: 500;
}

/* Date+time editor en popups estrechos: el time spinner necesita ancho mínimo
   para que no se aplaste el selector de hora. */
.tm-rec-date-edit .dxbl-date-edit,
.tm-rec-date-edit .dxbl-input,
.tm-rec-date-edit {
    min-width: 0;
}
.tm-rec-date-edit .dxbl-date-edit__time-section,
.tm-rec-date-edit .dxbl-time-edit {
    min-width: 92px;
}

/* En desktop ancho, los campos del form aprovechan mejor el espacio: el
   popup pasa a max 960px. El chip crece ligeramente para anclar la vista. */
@media (min-width: 992px) {
    .tm-rec-type-chip { padding: 16px 18px; }
    .tm-rec-type-chip__icon { width: 44px; height: 44px; font-size: 24px; }
}

/* En móvil el chip sigue el fullscreen del popup: esquinas cuadradas para
   fundirse con el fondo. */
@media (max-width: 575.98px) {
    .tm-rec-type-chip {
        border-radius: 0;
        margin-left: -16px;
        margin-right: -16px;
        margin-bottom: 12px;
        padding: 12px 16px;
    }
}

/* -------- Date filter -------- */
.tm-date-filter { width: 140px; }

/* -------- Responsive (Bootstrap 5 breakpoints) --------
   - xs:  <576px   default
   - sm:  ≥576px
   - md:  ≥768px
   - lg:  ≥992px
   - xl:  ≥1200px
   - xxl: ≥1400px
   Mobile-first: las reglas dentro de cada bloque aplican EN ADICIÓN a las
   base. La grid del topbar y el comportamiento del sidebar se controlan
   aquí; el collapse/expand manual del usuario lo aplica Blazor vía
   .tm-layout.sidebar-collapsed (ya en :root).
*/

/* <768px (xs/sm): sidebar se convierte en drawer off-canvas.
   El hamburger button aparece y el overlay tapa el contenido. */
@media (max-width: 767.98px) {
    .tm-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        box-shadow: var(--tm-shadow-md);
    }
    .tm-layout.sidebar-open .tm-sidebar { transform: translateX(0); }

    .tm-mobile-menu-btn { display: inline-flex; }

    .tm-sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .35);
        z-index: 90;
    }

    .tm-topbar { padding: 0 12px; }
}

/* 768-991.98px (md): tablet portrait. El sidebar se queda visible (gestionado
   por Blazor: auto-colapsado en <1200px). El centro del topbar
   (time-entries) se oculta para hacer hueco a título + acciones. */
@media (min-width: 768px) and (max-width: 991.98px) {
    .tm-topbar-center { display: none; }
    .tm-topbar { padding: 0 16px; }
}

/* 992-1199.98px (lg): laptop pequeño. El topbar mantiene la grid completa
   (centro visible), pero si el sidebar se auto-colapsa en <1200px, libera
   los 60px de ancho. */

/* ≥1200px (xl/xxl): desktop estándar. El sidebar se expande por defecto. */
@media (min-width: 1200px) {
    .tm-topbar { padding: 0 20px; }
}

/* -------- Accessibility: focus-visible & reduced motion -------- */

/* Foco visible explícito en controles del layout. DevExpress ya da foco a sus
   botones, pero los <button> nativos del sidebar y los del topbar dependen del
   outline por defecto del navegador, que en dark mode es casi invisible. */
.tm-toggle-btn:focus-visible,
button.tm-mobile-menu-btn:focus-visible,
.tm-nav-section-toggle:focus-visible,
.tm-nav-item-group:focus-visible,
.tm-remote-badge:focus-visible,
.tm-remote-dropdown-item:focus-visible,
.tm-nav-pin-menu:focus-visible,
.tm-active-time-entry-toggle:focus-visible,
.tm-sidebar-overlay:focus-visible,
.tm-active-time-entry-menu-overlay:focus-visible,
.tm-nav-pin-menu-overlay:focus-visible {
    outline: 2px solid var(--tm-primary, #2A4668);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(42, 70, 104, 0.25);
}

/* Respetar prefers-reduced-motion: desactiva transiciones y animaciones no
   esenciales. Los usuarios que lo activen en el SO verán los toggles
   instantáneos, sin perder la información visual del cambio. */
@media (prefers-reduced-motion: reduce) {
    .tm-layout,
    .tm-sidebar,
    .tm-topbar,
    .tm-nav,
    .tm-nav-item,
    .tm-nav-section,
    .tm-nav-section-toggle,
    .tm-nav-item-chevron,
    .tm-remote-dropdown,
    .tm-remote-selector,
    .tm-active-time-entry,
    .tm-active-time-entry-menu,
    .tm-active-time-entry-toggle,
    .tm-nav-pin-menu,
    .tm-sidebar-footer,
    * {
        transition: none !important;
        animation: none !important;
        animation-duration: 0s !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}

/* -------- Blazor error UI (estándar de plantilla) -------- */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

/* -------- Scrollbar -------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* -------- PageAccionesBar: botón grande (icono + texto) -------- */
.tm-page-action-btn {
    min-height: 56px;
    min-width: 120px;
}

.tm-page-action-btn .dxbl-btn-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .2rem;
}

.tm-page-action-btn .dxbl-btn-text {
    white-space: normal;
    text-align: center;
    line-height: 1.1;
    font-size: .8rem;
}

/* -------- Custom Loading Spinner (loading-spinner.svg) -------- */
.dxbl-loading-panel-indicator,
.dxbl-wait-indicator {
    background-image: url('/loading-spinner.svg') !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;
    animation: none !important;
}

.dxbl-loading-panel-indicator svg,
.dxbl-wait-indicator svg {
    display: none !important;
}

.dxbl-loading-panel-indicator.dxbl-sm,
.dxbl-wait-indicator.dxbl-sm {
    width: 24px !important;
    height: 24px !important;
}

.dxbl-loading-panel-indicator.dxbl-md,
.dxbl-wait-indicator.dxbl-md,
.dxbl-loading-panel-indicator:not(.dxbl-sm):not(.dxbl-lg),
.dxbl-wait-indicator:not(.dxbl-sm):not(.dxbl-lg) {
    width: 32px !important;
    height: 32px !important;
}

.dxbl-loading-panel-indicator.dxbl-lg,
.dxbl-wait-indicator.dxbl-lg {
    width: 40px !important;
    height: 40px !important;
}

/* -------- Dashboard widgets (edit mode + drag/drop) -------- */
/* Contenedor que envuelve cada widget. En modo edición se vuelve
   draggable y muestra outline + handle. En modo normal, neutro. */
.tm-widget-wrapper {
    margin-bottom: 16px;
    position: relative;
    border-radius: var(--tm-radius);
    transition: outline .12s, transform .15s;
}
.tm-widget-wrapper:last-child { margin-bottom: 0; }

.tm-widget-wrapper.tm-widget-drop-over {
    outline: 2px dashed var(--tm-primary);
    outline-offset: 2px;
    background: rgba(42, 70, 104, 0.04);
}

.tm-widget {
    position: relative;
    transition: box-shadow .15s, transform .15s;
    /* Tamaño mínimo común a todos los widgets del dashboard para
       que ninguno quede "aplastado" cuando hay poco contenido. */
    min-width: 260px;
    min-height: 130px;
}

.tm-widget.tm-widget-editing {
    outline: 1.5px dashed rgba(42, 70, 104, 0.45);
    outline-offset: -2px;
}

.tm-widget.tm-widget-dragging {
    opacity: 0.6;
    transform: scale(0.99);
    box-shadow: var(--tm-shadow-md);
}

/* Acciones de edición: ↑↓ ×  + handle, en la esquina superior derecha */
.tm-widget-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--tm-border);
    border-radius: 6px;
    padding: 2px 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.tm-widget-btn {
    border: none;
    background: transparent;
    color: var(--tm-text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background .12s, color .12s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tm-widget-btn:hover:not(:disabled) {
    background: var(--tm-bg-soft, #f3f4f6);
    color: var(--tm-text);
}
.tm-widget-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.tm-widget-btn.tm-widget-btn-danger:hover:not(:disabled) {
    background: #fee2e2;
    color: #991b1b;
}

.tm-widget-handle {
    cursor: grab;
    color: var(--tm-text-muted);
    padding: 0 4px;
    user-select: none;
    font-size: 14px;
    -webkit-user-drag: element;
}
.tm-widget-handle:active { cursor: grabbing; }

/* En el strip de KPIs, las acciones se recolocan: chip compacto en la
   esquina derecha de la primera card, no por cada card. */
.row .tm-widget-actions { top: 4px; right: 4px; }

/* En móvil (<576 px) las acciones pasan a la esquina inferior
   izquierda del widget, más cómodas para dedo gordo y fuera del título. */
@media (max-width: 575.98px) {
    .tm-widget-actions {
        top: auto;
        bottom: 8px;
        right: 8px;
    }
    .tm-widget-handle {
        cursor: pointer; /* drag/drop nativo no es usable en touch */
    }
}

/* -------- Dashboard widgets: list items (avisos / inbox / pendientes) --------
   Bloque compartido por InboxRecientesWidget, AvisosEquipoWidget,
   AvisosPendientesWidget y AlertasCriticasWidget. Cualquier widget que
   renderice filas con icono a la izquierda + título + meta + estado/edad
   debería reutilizar estas clases para mantener la consistencia visual. */

/* Empty state compartido por todos los widgets del dashboard. */
.db-empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; padding: 24px 16px; color: var(--tm-text-muted); font-size: 13px;
}
.db-empty-state i { font-size: 28px; opacity: .4; }

/* Fila base: icono 30x30 a la izquierda, columna central flexible,
   columna derecha opcional (fecha / edad). */
.db-avisos-list { padding: 4px 0; }
.db-aviso-item {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 14px; border-bottom: 1px solid var(--tm-border);
    text-decoration: none; color: inherit;
    transition: background .12s;
}
.db-aviso-item:hover { background: var(--tm-hover-bg); }
.db-aviso-item:last-child { border-bottom: none; }
.db-aviso-icon {
    width: 30px; height: 30px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; flex-shrink: 0;
}
.db-aviso-icon-warn { background: var(--tm-warn-bg); color: var(--tm-warn-fg); }
.db-aviso-icon-danger { background: var(--tm-danger-bg); color: var(--tm-danger-fg-strong); }
.db-aviso-icon-info { background: var(--tm-info-bg); color: var(--tm-info-fg); }
.db-aviso-title {
    font-size: 13px; font-weight: 500; line-height: 1.25;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.db-aviso-meta { font-size: 11px; color: var(--tm-text-muted); line-height: 1.4; }

/* Sub-línea de fechas (creación, modificación, inicio previsto) usada
   por widgets que muestran más de un evento temporal por fila. Tamaño
   menor y opacidad baja para que no compita con título/meta. */
.db-aviso-dates {
    font-size: 10px; color: var(--tm-text-muted);
    display: flex; align-items: center; gap: 12px;
    line-height: 1.3; margin-top: 2px;
}
.db-aviso-dates span { display: inline-flex; align-items: center; white-space: nowrap; }
.db-aviso-dates i { opacity: .55; margin-right: 4px; font-size: 11px; }

/* Columna derecha opcional: arriba fecha (día bold + hora normal), abajo
   pill de antigüedad. space-between alinea la fecha con el título y la
   pill con la meta. */
.db-aviso-rightcol {
    align-self: stretch;
    display: flex; flex-direction: column; align-items: flex-end;
    justify-content: space-between; gap: 4px;
    flex-shrink: 0;
}
.db-aviso-date { font-size: 13px; color: var(--tm-text); white-space: nowrap; }
.db-aviso-date .db-aviso-time { font-weight: 400; }
.db-aviso-date .db-aviso-day { font-weight: 600; }

/* Pill de antigüedad estilo AlertasCriticasWidget: rojo >24h, ámbar >2h, gris. */
.db-aviso-age {
    font-size: 11px; font-weight: 600; white-space: nowrap;
    padding: 2px 8px; border-radius: 999px; flex-shrink: 0;
}
.db-aviso-age-danger { background: var(--tm-danger-bg); color: var(--tm-danger-fg); }
.db-aviso-age-warn { background: var(--tm-warn-bg); color: var(--tm-warn-fg); }
.db-aviso-age-muted { background: var(--tm-muted-bg); color: var(--tm-muted-fg); }

/* -------- Dashboard widgets: agenda rows (agenda / top-clientes / tiempo activo) --------
   Bloque compartido por AgendaHoyWidget, TopClientesWidget y TiempoActivoWidget.
   Variante de la fila base sin icono a la izquierda: usa un indicador
   vertical coloreado + contenido centrado. */
.db-agenda-list { padding: 4px 0; }
.db-agenda-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 16px; border-bottom: 1px solid var(--tm-border);
    transition: background .12s;
}
.db-agenda-item:last-child { border-bottom: none; }
.db-agenda-item:hover { background: var(--tm-hover-bg); }
.db-agenda-active { background: var(--tm-ok-bg) !important; }
.db-agenda-indicator { width: 4px; height: 36px; border-radius: 2px; flex-shrink: 0; }
.db-agenda-title {
    font-size: 13px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.db-agenda-meta { font-size: 11px; color: var(--tm-text-muted); }
.db-agenda-time { font-size: 12px; color: var(--tm-text-muted); white-space: nowrap; }

/* Título-enlace que abre el detalle del recurso enlazado desde cualquier
   widget (tarea, ticket, etc.). Hereda color y aplica subrayado solo en hover. */
.db-title-link { color: inherit; text-decoration: none; }
.db-title-link:hover { text-decoration: underline; }

/* -------- Dashboard widgets: carga del equipo (CargaEquipoWidget) --------
   Bloque único de CargaEquipoWidget. Lista de miembros con avatar, barra
   de utilización y porcentaje. Los colores de barra/porcentaje mapean a
   --tm-load-* (paleta semántica). */
.db-load-list { padding: 4px 0; }
.db-load-row {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 16px; border-bottom: 1px solid var(--tm-border);
}
.db-load-row:last-child { border-bottom: none; }
.db-load-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--tm-primary-light); color: var(--tm-primary-dark);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.db-load-body { flex: 1; min-width: 0; }
.db-load-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.db-load-name {
    font-size: 13px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.db-load-meta { font-size: 11px; color: var(--tm-text-muted); white-space: nowrap; }
.db-load-bar-wrap {
    height: 6px; background: var(--tm-muted-bg); border-radius: 3px;
    margin: 6px 0 4px; overflow: hidden;
}
.db-load-bar { height: 100%; transition: width .3s ease; }
.db-load-bar-low { background: var(--tm-load-low); }
.db-load-bar-ok { background: var(--tm-load-ok); }
.db-load-bar-high { background: var(--tm-load-high); }
.db-load-bar-over { background: var(--tm-load-over); }
.db-load-bottom { display: flex; justify-content: space-between; font-size: 11px; }
.db-load-hours { color: var(--tm-text-muted); }
.db-load-pct { font-weight: 600; font-variant-numeric: tabular-nums; }
.db-load-pct-low { color: var(--tm-muted-fg); }
.db-load-pct-ok { color: var(--tm-load-ok); }
.db-load-pct-high { color: var(--tm-load-high); }
.db-load-pct-over { color: var(--tm-load-over); }

/* -------- Utility: link pequeño (Ver todos, Ver más, mensajes de error) -------- */
.tm-link-sm { font-size: 13px; }

/* ── Verificación en dos pasos (2FA) ──────────────────────────────────── */
.tm-login-card--wide {
    max-width: 560px;
}

.tm-2fa-steps {
    padding-left: 1.2rem;
    color: var(--tm-text-muted, #4a5568);
}
.tm-2fa-steps li {
    margin-bottom: 0.4rem;
}

.tm-2fa-qr-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: #ffffff;
    border: 1px solid rgba(15, 26, 44, 0.08);
    border-radius: 12px;
    margin: 0 auto;
}
.tm-2fa-qr {
    width: 220px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tm-2fa-qr svg {
    width: 100%;
    height: 100%;
    display: block;
}

.tm-2fa-secret {
    display: block;
    padding: 0.6rem 0.8rem;
    background: rgba(15, 26, 44, 0.04);
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    user-select: all;
    word-break: break-all;
    margin-top: 0.4rem;
}

.tm-2fa-recovery-list,
.tm-2fa-recovery-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.tm-2fa-recovery-list {
    list-style: none;
    padding-left: 0;
    column-count: 2;
    column-gap: 1.5rem;
}
.tm-2fa-recovery-list li {
    margin-bottom: 0.3rem;
    break-inside: avoid;
}
.tm-2fa-recovery-code {
    padding: 0.2rem 0.4rem;
    background: rgba(155, 187, 209, 0.18);
    border-radius: 4px;
    color: var(--tm-primary-dark, #0F1A2C);
}

@media (max-width: 575.98px) {
    .tm-2fa-recovery-list {
        column-count: 1;
    }
    .tm-2fa-qr {
        width: 180px;
        height: 180px;
    }
}

.tm-2fa-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.tm-2fa-badge:hover {
    background: rgba(15, 26, 44, 0.04);
}
.tm-2fa-badge:focus-visible {
    outline: 2px solid rgba(42, 70, 104, 0.45);
    outline-offset: 2px;
}
.tm-2fa-badge--ok {
    color: var(--tm-primary, #2A4668);
    background: rgba(155, 187, 209, 0.18);
    border-color: rgba(155, 187, 209, 0.4);
}
.tm-2fa-badge--warn {
    color: #8a4a00;
    background: rgba(255, 200, 110, 0.22);
    border-color: rgba(255, 180, 80, 0.5);
}
.tm-2fa-badge__text {
    letter-spacing: 0.02em;
}
@media (max-width: 575.98px) {
    .tm-2fa-badge__text { display: none; }
    .tm-2fa-badge { padding: 6px; }
}
