    /* SISTEMA DE DISEÑO ESTÁNDAR SAAS (CLARO POR DEFECTO / OSCURO SUAVE) */
    :root, body, body.theme-light {
      --bg: #f8fafc;
      --bg-wash: #f8fafc;
      --header-bg: #ffffff;
      --header-border: #e2e8f0;
      --theme-card: #ffffff;
      --theme-border: #e2e8f0;
      --theme-border-subtle: #f1f5f9;
      --theme-primary: #2563eb;
      --theme-primary-hover: #1d4ed8;
      --theme-primary-shadow: rgba(37, 99, 235, 0.16);
      --theme-accent: #0284c7;
      --theme-accent-bg: rgba(2, 132, 199, 0.08);
      --theme-text: #0f172a;
      --theme-text-muted: #64748b;
      --theme-input-bg: #ffffff;
      --theme-pill-bg: #f1f5f9;
      --theme-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 8px 24px -4px rgba(0, 0, 0, 0.04);
      --theme-sidebar-bg: #ffffff;
      --theme-sidebar-border: #e2e8f0;
      --theme-sidebar-footer-bg: #f8fafc;
      --theme-topbar-bg: rgba(255, 255, 255, 0.96);
      --theme-active-item-bg: #eff6ff;
      --theme-active-item-border: #bfdbfe;
      --theme-canvas-bg: #f8fafc;
      --theme-dropdown-shadow: 0 12px 32px -4px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
      --text: #0f172a;
      --text-muted: #64748b;
      --text-dim: #94a3b8;
      --border: #e2e8f0;
      --border-light: #cbd5e1;
      --border-focus: #2563eb;
      --primary: #2563eb;
      --primary-hover: #1d4ed8;
      --cyan: #0284c7;
      --cyan-bg: rgba(2, 132, 199, 0.08);
      --emerald: #059669;
      --emerald-bg: rgba(5, 150, 105, 0.08);
      --amber: #d97706;
      --amber-bg: rgba(217, 119, 6, 0.08);
      --rose: #dc2626;
      --font-serif: -apple-system-ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;
      --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
      --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
      --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
      --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
      --shadow-lg: 0 10px 24px rgba(0,0,0,0.08);
    }

    body.theme-dark {
      --bg: #0f172a;
      --bg-wash: #0f172a;
      --header-bg: #1e293b;
      --header-border: #334155;
      --theme-card: #1e293b;
      --theme-border: #334155;
      --theme-border-subtle: #1e293b;
      --theme-primary: #3b82f6;
      --theme-primary-hover: #2563eb;
      --theme-primary-shadow: rgba(59, 130, 246, 0.25);
      --theme-accent: #38bdf8;
      --theme-accent-bg: rgba(56, 189, 248, 0.12);
      --theme-text: #f8fafc;
      --theme-text-muted: #94a3b8;
      --theme-input-bg: #0f172a;
      --theme-pill-bg: #334155;
      --theme-card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
      --theme-sidebar-bg: #1e293b;
      --theme-sidebar-border: #334155;
      --theme-sidebar-footer-bg: #0f172a;
      --theme-topbar-bg: rgba(30, 41, 59, 0.92);
      --theme-active-item-bg: rgba(56, 189, 248, 0.12);
      --theme-active-item-border: rgba(56, 189, 248, 0.3);
      --theme-canvas-bg: #0f172a;
      --theme-dropdown-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.5);
      --text: #f8fafc;
      --text-muted: #94a3b8;
      --text-dim: #64748b;
      --border: #334155;
      --border-light: #475569;
      --border-focus: #38bdf8;
      --primary: #3b82f6;
      --primary-hover: #2563eb;
      --cyan: #38bdf8;
      --cyan-bg: rgba(56, 189, 248, 0.12);
      --emerald: #10b981;
      --emerald-bg: rgba(16, 185, 129, 0.12);
      --amber: #f59e0b;
      --amber-bg: rgba(245, 158, 11, 0.12);
      --rose: #ef4444;
      --rose-bg: rgba(239, 68, 68, 0.12);
      --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
      --shadow-md: 0 4px 14px rgba(0,0,0,0.4);
      --shadow-lg: 0 12px 28px rgba(0,0,0,0.5);
    }

    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html {
      -webkit-text-size-adjust: 100%;
      text-size-adjust: 100%;
    }
    html, body {
      overflow-x: hidden;
      width: 100%;
    }
    html.has-active-session,
    html.has-active-session body {
      height: 100%;
      height: 100dvh;
      max-height: 100%;
      max-height: 100dvh;
      overflow: hidden;
    }
    html.preload-no-transition *,
    html.preload-no-transition *::before,
    html.preload-no-transition *::after {
      -webkit-transition: none !important;
      -moz-transition: none !important;
      -o-transition: none !important;
      -ms-transition: none !important;
      transition: none !important;
    }
    body {
      background-color: var(--bg);
      background-image: var(--bg-wash);
      background-attachment: fixed;
      color: var(--text);
      font-family: var(--font-sans);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      text-rendering: optimizeLegibility;
      font-synthesis: none;
      transition: background-color 0.4s ease, color 0.4s ease;
    }

    /* SVG Utilities */
    .icon {
      display: inline-block;
      vertical-align: middle;
      flex-shrink: 0;
    }
    .spin {
      animation: spin 1s linear infinite;
    }
    @keyframes spin {
      from { transform: rotate(0deg); }
      to { transform: rotate(360deg); }
    }

    /* Pulse Dot Utility */
    .pulse-dot {
      width: 7px;
      height: 7px;
      background: var(--emerald);
      border-radius: 50%;
      box-shadow: 0 0 8px var(--emerald);
      flex-shrink: 0;
    }

    /* VIEW 1: AUTH CONTAINER (MINIMALISTA Y CENTRADO) */
    #view-login {
      max-width: 440px;
      width: 100%;
      margin: 0 auto;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      padding: 24px 16px;
      box-sizing: border-box;
      position: relative;
      animation: authFadeIn 0.25s ease-out;
    }
    body.is-login-view #view-login {
      display: flex !important;
    }
    body.is-login-view #view-dashboard {
      display: none !important;
    }

    /* Si el usuario tiene sesión activa, mostrar el dashboard directamente como cualquier web estándar */
    html.has-active-session #view-login {
      display: none !important;
    }
    html.has-active-session body.is-login-view #view-login {
      display: none !important;
    }
    html.has-active-session #view-dashboard {
      display: flex !important;
    }
    .auth-brand-center {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 12px;
      margin-bottom: 22px;
      text-decoration: none;
      transition: transform 0.2s ease;
    }
    .auth-brand-center:hover {
      transform: translateY(-2px);
    }
    .auth-brand-center .auth-brand-logo,
    .auth-brand-center img {
      width: 58px !important;
      height: 52px !important;
      max-width: 58px !important;
      max-height: 52px !important;
      object-fit: contain !important;
      display: block;
      transition: transform 0.2s ease;
    }
    .auth-brand-center:hover .auth-brand-logo,
    .auth-brand-center:hover img {
      transform: scale(1.05);
    }
    .auth-brand-center .brand-icon-box {
      display: contents;
      background: transparent !important;
      border: none !important;
      box-shadow: none !important;
      padding: 0 !important;
    }
    .auth-brand-name {
      font-family: var(--font-sans);
      font-size: 28px;
      font-weight: 800;
      letter-spacing: -0.025em;
      color: var(--theme-text);
      line-height: 1;
      display: inline-flex;
      align-items: center;
    }
    .auth-brand-name .brand-tec {
      color: #43a0b9;
    }
    @media (max-width: 600px) {
      main {
        padding: 6px 12px 20px;
      }
    }

    /* Botón de alternancia de tema (Sol / Luna) - Estilo sutil y limpio */
    .btn-theme-toggle {
      width: 36px;
      height: 36px;
      border-radius: 9px;
      background: var(--theme-card);
      border: 1px solid var(--theme-border) !important;
      outline: none !important;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
      color: var(--theme-text-muted);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
      flex-shrink: 0;
    }
    .btn-theme-toggle:hover {
      background: var(--theme-pill-bg);
      color: var(--theme-text);
      border-color: #94a3b8 !important;
      transform: scale(1.04);
    }
    body.theme-dark .btn-theme-toggle {
      background: var(--theme-card);
      border-color: var(--theme-border) !important;
    }
    body.theme-dark .btn-theme-toggle:hover {
      background: rgba(255, 255, 255, 0.08);
      color: #fff;
    }
    .btn-theme-toggle svg {
      width: 17px;
      height: 17px;
    }

    /* Reglas por defecto: Modo Claro asumido de entrada (previene duplicidad visual) */
    .icon-theme-sun { display: none !important; }
    .icon-theme-moon { display: block !important; }
    .logo-for-dark { display: none !important; }
    .logo-for-light { display: block !important; }

    /* En Tema Claro explícito */
    body.theme-light .icon-theme-sun,
    html.theme-light .icon-theme-sun { display: none !important; }
    body.theme-light .icon-theme-moon,
    html.theme-light .icon-theme-moon { display: block !important; }
    body.theme-light .logo-for-dark,
    html.theme-light .logo-for-dark { display: none !important; }
    body.theme-light .logo-for-light,
    html.theme-light .logo-for-light { display: block !important; }

    /* En Tema Oscuro explícito */
    body.theme-dark .icon-theme-sun,
    html.theme-dark .icon-theme-sun { display: block !important; }
    body.theme-dark .icon-theme-moon,
    html.theme-dark .icon-theme-moon { display: none !important; }
    body.theme-dark .logo-for-light,
    html.theme-dark .logo-for-light { display: none !important; }
    body.theme-dark .logo-for-dark,
    html.theme-dark .logo-for-dark { display: block !important; }
    #view-login::before {
      content: '';
      position: absolute;
      top: -20px;
      left: 50%;
      transform: translateX(-50%);
      width: min(320px, 80vw);
      height: 160px;
      background: radial-gradient(circle, var(--theme-primary-shadow) 0%, transparent 70%);
      filter: blur(30px);
      z-index: 0;
      pointer-events: none;
    }
    .auth-box {
      width: 100%;
      box-sizing: border-box;
      position: relative;
      z-index: 1;
      text-align: left;
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 16px;
      padding: 22px 24px 18px;
      box-shadow: var(--theme-card-shadow);
      transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    @media (max-width: 520px) {
      .auth-box {
        padding: 18px 16px 16px;
        border-radius: 14px;
      }
    }

    /* Pastilla superior de selección */
    .auth-pill-bar {
      display: flex;
      width: 100%;
      max-width: 100%;
      box-sizing: border-box;
      background: var(--theme-pill-bg);
      border: 1px solid var(--theme-border);
      border-radius: 9px;
      padding: 3px;
      margin-bottom: 14px;
      gap: 3px;
    }
    .auth-pill-btn {
      flex: 1;
      text-align: center;
      background: transparent;
      border: none;
      color: var(--theme-text-muted);
      padding: 7px 12px;
      font-size: 13px;
      font-weight: 600;
      border-radius: 7px;
      cursor: pointer;
      transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
      font-family: var(--font-sans);
      letter-spacing: -0.01em;
      white-space: nowrap;
    }
    .auth-pill-btn:hover {
      color: var(--theme-text);
    }
    .auth-pill-btn.active {
      background: var(--theme-card);
      color: var(--theme-primary);
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
      font-weight: 700;
    }

    /* Cabecera de la tarjeta */
    .auth-card-header {
      margin-bottom: 20px;
      text-align: center;
    }
    .auth-title {
      font-family: var(--font-sans);
      font-size: 21px;
      font-weight: 800;
      color: var(--theme-text);
      margin: 0;
      letter-spacing: -0.025em;
      line-height: 1.35;
      text-align: center;
      text-wrap: balance;
    }
    @media (max-width: 520px) {
      .auth-title {
        font-size: 19px;
      }
    }
    .auth-subtitle {
      display: none !important;
    }
    .auth-time-badge {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 3px 8px;
      background: var(--theme-pill-bg);
      border: 1px solid var(--theme-border);
      border-radius: 999px;
      font-size: 11px;
      font-weight: 600;
      color: var(--theme-primary);
      white-space: nowrap;
      flex-shrink: 0;
    }

    /* Grilla de 2 columnas para escritorio (Nombre/Apellido y Contraseñas) */
    .auth-grid-2 {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-bottom: 10px;
    }
    .auth-grid-2 > div {
      min-width: 0;
    }
    @media (max-width: 480px) {
      .auth-grid-2 {
        grid-template-columns: 1fr;
        gap: 10px;
      }
    }

    /* Campos de entrada compactos y minimalistas */
    .auth-field {
      margin-bottom: 10px;
      text-align: left;
    }
    .auth-label {
      display: block;
      font-size: 12px;
      font-weight: 600;
      color: var(--theme-text);
      margin-bottom: 4px;
      letter-spacing: -0.01em;
    }
    .auth-input {
      width: 100%;
      max-width: 100%;
      box-sizing: border-box;
      min-width: 0;
      background: var(--theme-input-bg);
      border: 1px solid var(--theme-border);
      border-radius: 8px;
      padding: 8px 11px;
      color: var(--theme-text);
      font-size: 13.5px;
      font-family: var(--font-sans);
      transition: all 0.15s ease;
      height: 38px;
    }
    .auth-input::placeholder {
      color: #94a3b8;
    }
    .auth-input:focus {
      outline: none;
      border-color: var(--theme-primary);
      box-shadow: 0 0 0 3px var(--theme-primary-shadow);
      background: var(--theme-card);
    }
    .auth-hint {
      font-size: 11px;
      color: var(--theme-text-muted);
      margin-top: 3px;
      line-height: 1.35;
    }

    /* Input Contraseña con Botón de Ojito */
    .auth-pwd-container {
      position: relative;
      width: 100%;
      box-sizing: border-box;
    }
    .auth-pwd-container .auth-input {
      width: 100%;
      padding-right: 40px;
      box-sizing: border-box;
    }
    .auth-btn-ver {
      position: absolute;
      right: 6px;
      top: 50%;
      transform: translateY(-50%);
      background: transparent;
      border: none;
      color: var(--theme-text-muted);
      cursor: pointer;
      padding: 5px;
      border-radius: 6px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: color 0.15s, background 0.15s;
    }
    .auth-btn-ver:hover {
      color: var(--theme-primary);
      background: var(--theme-pill-bg);
    }
    .auth-btn-ver:active {
      transform: translateY(-50%) scale(0.94);
    }

    /* Botón Submit */
    .auth-btn-submit {
      width: 100%;
      background: var(--theme-primary);
      color: #ffffff;
      border: none;
      border-radius: 8px;
      padding: 9px 16px;
      font-size: 13.5px;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
      min-height: 40px;
      height: 40px;
      font-family: var(--font-sans);
      margin-top: 6px;
      box-shadow: 0 3px 10px var(--theme-primary-shadow);
      letter-spacing: -0.01em;
    }
    .auth-btn-submit:hover:not(:disabled) {
      background: var(--theme-primary-hover);
      transform: translateY(-1px);
      box-shadow: 0 5px 14px var(--theme-primary-shadow);
    }
    .auth-btn-submit:active:not(:disabled) {
      transform: translateY(0);
    }
    .auth-btn-submit:disabled {
      opacity: 0.6;
      cursor: not-allowed;
      box-shadow: none;
    }

    /* Divisor "o" */
    .auth-divider-o {
      display: flex;
      align-items: center;
      text-align: center;
      margin: 10px 0;
      color: var(--theme-text-muted);
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      font-weight: 500;
    }
    .auth-divider-o::before, .auth-divider-o::after {
      content: '';
      flex: 1;
      border-bottom: 1px solid var(--theme-border);
    }
    .auth-divider-o span {
      padding: 0 10px;
    }

    /* Contenedor y Botón Google */
    .google-auth-container {
      width: 100%;
      min-height: 40px;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      margin-top: 2px;
    }
    .google-native-wrapper {
      width: 100%;
      min-height: 40px;
      height: 40px;
      display: flex;
      justify-content: center;
      align-items: center;
      border-radius: 8px;
    }
    .google-native-wrapper iframe {
      border-radius: 8px !important;
      color-scheme: normal;
    }
    .auth-btn-google {
      width: 100%;
      background: var(--theme-card);
      color: var(--theme-text);
      border: 1px solid var(--theme-border);
      border-radius: 8px;
      padding: 8px 14px;
      font-size: 13.5px;
      font-weight: 500;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      min-height: 40px;
      height: 40px;
      transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
      font-family: var(--font-sans);
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }
    .auth-btn-google:hover:not(:disabled) {
      background: var(--theme-pill-bg);
      border-color: #94a3b8;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    }
    .auth-btn-google:active:not(:disabled) {
      transform: translateY(0);
    }

    /* Enlaces de cambio y notas */
    .auth-link-text {
      margin-top: 10px;
      font-size: 12px;
      color: var(--theme-text-muted);
      text-align: center;
    }
    .auth-link-text a {
      color: var(--theme-primary);
      font-weight: 600;
      text-decoration: none;
      margin-left: 4px;
      cursor: pointer;
    }
    .auth-link-text a:hover {
      text-decoration: underline;
    }

    .auth-direct-key-link {
      margin-top: 8px;
      text-align: center;
    }
    .auth-alt-link {
      color: var(--theme-primary);
      text-decoration: none;
      font-size: 11.5px;
      font-weight: 500;
      cursor: pointer;
      transition: color 0.15s;
      display: inline-block;
    }
    .auth-alt-link:hover {
      text-decoration: underline;
    }

    /* Disclaimer Legal */
    .auth-legal-disclaimer {
      margin-top: 10px;
      padding-top: 8px;
      border-top: 1px solid var(--theme-border-subtle);
      font-size: 10px;
      color: #94a3b8;
      line-height: 1.35;
      text-align: center;
    }
    .auth-legal-disclaimer a {
      color: var(--theme-text-muted);
      text-decoration: underline;
    }

    .user-avatar-top {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      object-fit: cover;
      border: 1.5px solid var(--theme-primary);
    }
    .user-avatar-initials {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--theme-primary), var(--cyan));
      color: #fff;
      font-size: 11px;
      font-weight: 700;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    /* VIEW 2: DASHBOARD (SHELL: SIDEBAR IZQUIERDO + LIENZO DERECHO) */
    #view-dashboard {
      display: none;
      width: 100%;
      height: 100vh;
      height: 100dvh;
      max-height: 100vh;
      max-height: 100dvh;
      min-height: 100vh;
      box-sizing: border-box;
      position: relative;
      overflow: hidden !important;
    }
    .app-shell {
      display: flex;
      width: 100%;
      height: 100vh;
      height: 100dvh;
      max-height: 100vh;
      max-height: 100dvh;
      position: relative;
      background: var(--theme-canvas-bg);
      color: var(--theme-text);
      overflow: hidden !important;
    }

    /* MENÚ LATERAL (SIDEBAR) */
    .app-sidebar {
      width: 260px;
      min-width: 260px;
      max-width: 260px;
      background: var(--theme-sidebar-bg);
      border-right: 1px solid var(--theme-sidebar-border);
      display: flex;
      flex-direction: column;
      height: 100%;
      max-height: 100%;
      position: relative;
      top: 0;
      z-index: 45;
      transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                  min-width 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                  max-width 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                  transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                  opacity 0.2s ease,
                  padding 0.25s ease;
      overflow: hidden;
      user-select: none;
      box-sizing: border-box;
      flex-shrink: 0;
    }

    /* Estado Colapsado del Sidebar */
    .app-shell.sidebar-collapsed .app-sidebar {
      width: 0 !important;
      min-width: 0 !important;
      max-width: 0 !important;
      padding: 0 !important;
      border-right: none !important;
      opacity: 0 !important;
      pointer-events: none !important;
    }

    /* Cabecera del Sidebar */
    .sidebar-header {
      padding: 0 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid var(--theme-border-subtle);
      height: 60px;
      min-height: 60px;
      max-height: 60px;
      flex-shrink: 0;
      box-sizing: border-box;
      gap: 10px;
    }
    .sidebar-brand {
      display: flex;
      align-items: center;
      gap: 9px;
      text-decoration: none;
      color: var(--theme-text);
      min-width: 0;
    }
    .sidebar-brand .brand-icon-box {
      width: 28px !important;
      height: 28px !important;
      max-width: 28px !important;
      max-height: 28px !important;
      background: transparent;
      border: none;
      box-shadow: none;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      overflow: hidden;
    }
    .sidebar-brand .brand-icon-box img {
      width: 28px !important;
      height: 28px !important;
      max-width: 28px !important;
      max-height: 28px !important;
      object-fit: contain !important;
      display: block;
    }
    .sidebar-brand .brand-text {
      display: flex;
      flex-direction: column;
      line-height: 1.15;
    }
    .sidebar-brand .brand-text h2 {
      font-family: var(--font-serif);
      font-size: 16.5px;
      font-weight: 700;
      color: var(--theme-text);
      letter-spacing: -0.015em;
      margin: 0;
    }
    .sidebar-brand .brand-text span {
      font-size: 9px;
      font-weight: 600;
      color: var(--theme-primary);
      text-transform: uppercase;
      letter-spacing: 0.6px;
    }

    /* Botón de alternar / colapsar Sidebar */
    .btn-sidebar-toggle {
      background: transparent;
      border: 1px solid transparent;
      color: var(--theme-text-muted);
      width: 32px;
      height: 32px;
      border-radius: 6px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.15s ease;
      flex-shrink: 0;
    }
    .btn-sidebar-toggle svg {
      pointer-events: none;
    }
    .btn-sidebar-toggle:hover {
      background: var(--theme-pill-bg);
      color: var(--theme-text);
      border-color: var(--theme-border);
    }

    /* Botón colapsar menú en sidebar header */
    .btn-sidebar-toggle {
      pointer-events: auto;
    }

    /* Navegación dentro del Sidebar */
    .sidebar-nav {
      flex: 1;
      overflow-y: auto;
      padding: 12px 10px;
      display: flex;
      flex-direction: column;
      gap: 3px;
      scrollbar-width: thin;
    }
    .nav-group-title {
      font-size: 10px;
      font-weight: 700;
      color: var(--theme-text-muted);
      text-transform: uppercase;
      letter-spacing: 0.8px;
      padding: 10px 10px 4px;
    }

    /* Botones de pestaña en el Sidebar */
    .app-sidebar .tab-btn {
      width: 100%;
      text-align: left;
      background: transparent;
      border: 1px solid transparent;
      border-radius: 8px;
      padding: 8px 12px;
      color: var(--theme-text-muted);
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 9px;
      transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
      box-sizing: border-box;
      min-height: 38px;
      font-family: var(--font-sans);
    }
    .app-sidebar .tab-btn:hover {
      background: var(--theme-pill-bg);
      color: var(--theme-text);
    }
    .app-sidebar .tab-btn.active {
      background: var(--theme-active-item-bg);
      color: var(--theme-primary);
      border-color: var(--theme-active-item-border);
      font-weight: 600;
    }
    .app-sidebar .tab-btn .tab-label {
      flex: 1;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .app-sidebar .tab-btn .tab-badge-pill {
      font-size: 10px;
      padding: 2px 6px;
      border-radius: 999px;
      background: var(--theme-pill-bg);
      color: var(--theme-text-muted);
      font-weight: 600;
    }
    .app-sidebar .tab-btn.active .tab-badge-pill {
      background: var(--theme-primary-shadow);
      color: var(--theme-primary);
    }
    .app-sidebar .tab-btn .pill-cyan {
      background: var(--cyan-bg);
      color: var(--cyan);
      border: 1px solid rgba(56, 189, 248, 0.25);
    }
    .app-sidebar .tab-btn .pill-amber {
      background: rgba(245, 158, 11, 0.15);
      color: #d97706;
      border: 1px solid rgba(245, 158, 11, 0.3);
    }
    .app-sidebar .tab-btn .pill-purple {
      background: rgba(147, 51, 234, 0.15);
      color: #9333ea;
      border: 1px solid rgba(147, 51, 234, 0.3);
    }
    .btn-mod-switch {
      background: transparent;
      border: 1px solid transparent;
      border-radius: 8px;
      padding: 7px 14px;
      font-size: 12.5px;
      font-weight: 600;
      color: var(--theme-text-muted);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 7px;
      transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
      font-family: var(--font-sans);
    }
    .btn-mod-switch:hover {
      color: var(--theme-text);
      background: rgba(0, 0, 0, 0.04);
    }
    body.theme-dark .btn-mod-switch:hover {
      background: rgba(255, 255, 255, 0.06);
    }
    .btn-mod-switch.active {
      background: var(--theme-card);
      color: var(--theme-primary);
      border-color: var(--theme-border);
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
      font-weight: 700;
    }
    body.theme-dark .btn-mod-switch.active {
      background: #1e293b;
      color: #38bdf8;
      border-color: #334155;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    /* Pie del Sidebar */
    .sidebar-footer {
      padding: 10px 12px;
      border-top: 1px solid var(--theme-border-subtle);
      background: var(--theme-sidebar-footer-bg);
      flex-shrink: 0;
    }
    .sidebar-user-card {
      display: flex;
      align-items: center;
      gap: 9px;
      padding: 6px 8px;
      border-radius: 8px;
      cursor: pointer;
      transition: background 0.15s ease;
    }
    .sidebar-user-card:hover {
      background: var(--theme-pill-bg);
    }
    .sidebar-user-info {
      display: flex;
      flex-direction: column;
      line-height: 1.2;
      overflow: hidden;
    }
    .sidebar-user-name {
      font-size: 12.5px;
      font-weight: 600;
      color: var(--theme-text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .sidebar-user-sub {
      font-size: 11px;
      color: var(--theme-text-muted);
    }
    .btn-sidebar-logout {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      border-radius: 8px;
      border: 1px solid var(--theme-border);
      background: transparent;
      color: var(--theme-text-muted);
      cursor: pointer;
      flex-shrink: 0;
      transition: all 0.15s ease;
    }
    .btn-sidebar-logout:hover {
      background: rgba(239, 68, 68, 0.12);
      color: #ef4444;
      border-color: rgba(239, 68, 68, 0.3);
    }

    /* LIENZO DERECHO (WORKSPACE CANVAS) - COLUMNA 2 */
    .app-canvas {
      flex: 1 1 0%;
      display: flex;
      flex-direction: column;
      min-width: 0;
      min-height: 0;
      height: 100%;
      max-height: 100%;
      background: var(--theme-canvas-bg);
      overflow: hidden !important;
      position: relative;
    }

    /* Topbar Slim del Lienzo - Fija y 100% estática fuera del área de scroll */
    .canvas-topbar {
      position: relative !important;
      top: 0 !important;
      height: 60px;
      min-height: 60px;
      max-height: 60px;
      flex-shrink: 0;
      padding: 0 24px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid var(--theme-border-subtle);
      background: var(--theme-topbar-bg);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      z-index: 40;
      box-sizing: border-box;
      transform: translateZ(0);
      -webkit-transform: translateZ(0);
      backface-visibility: hidden;
      -webkit-backface-visibility: hidden;
    }
    .canvas-topbar-left {
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 0;
      flex: 1;
      overflow: hidden;
    }
    #btn-expand-sidebar {
      display: none;
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      color: var(--theme-text);
      width: 36px;
      height: 36px;
      border-radius: 8px;
      box-shadow: var(--shadow-sm);
      cursor: pointer;
      align-items: center;
      justify-content: center;
      transition: all 0.15s ease;
      flex-shrink: 0;
    }
    .app-shell.sidebar-collapsed #btn-expand-sidebar {
      display: inline-flex !important;
    }
    .app-shell.sidebar-collapsed #btn-expand-sidebar:hover {
      background: var(--theme-pill-bg);
      border-color: var(--theme-primary);
      color: var(--theme-primary);
    }
    .app-shell.sidebar-collapsed .icon-desktop-expand {
      display: block !important;
      width: 18px !important;
      height: 18px !important;
    }
    .icon-hamburger {
      display: none;
    }
    .icon-desktop-expand {
      display: block;
    }
    .mobile-menu-text {
      display: none;
    }
    .icon-close-mobile {
      display: none;
    }
    .icon-collapse-desktop {
      display: block;
    }
    .canvas-breadcrumbs {
      display: flex;
      align-items: center;
      gap: 7px;
      font-size: 13px;
      min-width: 0;
      flex: 1;
      overflow: hidden;
    }
    .crumb-root {
      font-weight: 500;
      color: var(--theme-text-muted);
      flex-shrink: 0;
    }
    .crumb-sep {
      color: var(--theme-border);
      font-size: 12px;
      flex-shrink: 0;
    }
    .crumb-active {
      font-weight: 600;
      color: var(--theme-text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      min-width: 0;
    }

    .canvas-topbar-right {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    /* Menú Dropdown del Avatar Superior Derecho */
    .user-dropdown-container {
      position: relative;
    }
    .user-dropdown-trigger {
      display: flex;
      align-items: center;
      gap: 6px;
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      padding: 3px 8px 3px 4px;
      border-radius: 999px;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .user-dropdown-trigger:hover {
      border-color: var(--theme-primary);
      box-shadow: 0 2px 8px var(--theme-primary-shadow);
    }
    .chevron-icon {
      color: var(--theme-text-muted);
      transition: transform 0.2s ease;
    }
    .user-dropdown-container.open .chevron-icon {
      transform: rotate(180deg);
    }
    /* Botón Directo de Cerrar Sesión en Topbar */
    .btn-topbar-logout {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      color: var(--theme-text-muted);
      cursor: pointer;
      transition: all 0.18s ease;
      flex-shrink: 0;
    }
    .btn-topbar-logout:hover {
      background: #fef2f2;
      color: #ef4444;
      border-color: #fecaca;
      transform: scale(1.05);
    }
    [data-theme="dark"] .btn-topbar-logout:hover,
    .theme-dark .btn-topbar-logout:hover {
      background: rgba(239, 68, 68, 0.15);
      color: #f87171;
      border-color: rgba(239, 68, 68, 0.3);
    }

    .user-dropdown-menu {
      display: none;
      position: absolute;
      top: calc(100% + 8px);
      right: 0;
      width: 270px;
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 14px;
      box-shadow: var(--theme-dropdown-shadow);
      padding: 12px;
      z-index: 1000;
      animation: dropdownFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
      box-sizing: border-box;
    }
    @keyframes dropdownFadeIn {
      from { opacity: 0; transform: translateY(-4px) scale(0.98); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }
    .user-dropdown-container.open .user-dropdown-menu {
      display: block !important;
    }
    .dropdown-user-header {
      display: flex;
      align-items: center;
      gap: 11px;
      padding: 4px 6px 10px;
    }
    .user-avatar-initials.lg {
      width: 36px;
      height: 36px;
      font-size: 13.5px;
    }
    .dropdown-user-details {
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .dropdown-name {
      font-size: 13.5px;
      font-weight: 700;
      color: var(--theme-text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .dropdown-email {
      font-size: 11px;
      color: var(--theme-text-muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .dropdown-status-badge {
      display: flex;
      align-items: center;
      gap: 6px;
      background: var(--emerald-bg);
      border: 1px solid rgba(16, 185, 129, 0.25);
      color: #34d399;
      padding: 5px 10px;
      border-radius: 8px;
      font-size: 11.5px;
      font-weight: 600;
      margin: 4px 0 8px;
    }
    body.theme-light .dropdown-status-badge {
      background: rgba(16, 185, 129, 0.1);
      color: #059669;
    }
    .dropdown-sep {
      height: 1px;
      background: var(--theme-border-subtle);
      margin: 6px 0;
    }
    .dropdown-actions {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .dropdown-action-btn {
      width: 100%;
      text-align: left;
      background: transparent;
      border: none;
      padding: 8px 10px;
      border-radius: 8px;
      color: var(--theme-text);
      font-size: 12.5px;
      font-weight: 500;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 9px;
      transition: background 0.15s ease;
      font-family: var(--font-sans);
    }
    .dropdown-action-btn:hover {
      background: var(--theme-pill-bg);
      color: var(--theme-primary);
    }
    .dropdown-action-btn.logout-action {
      color: var(--rose);
    }
    .dropdown-action-btn.logout-action:hover {
      background: var(--rose-bg);
      color: var(--rose);
    }

    /* Contenido del Lienzo (Scrollable e Independiente del Menú y de la Cabecera) */
    .canvas-content {
      flex: 1 1 0% !important;
      min-height: 0 !important;
      height: 100% !important;
      max-height: none !important;
      overflow-y: auto !important;
      overflow-x: hidden !important;
      overscroll-behavior-y: contain;
      touch-action: pan-y;
      -webkit-overflow-scrolling: touch;
      scrollbar-gutter: stable;
      scrollbar-width: thin;
      scrollbar-color: #94a3b8 rgba(0, 0, 0, 0.05);
      padding: 24px 28px 120px;
      max-width: 100%;
      width: 100%;
      margin: 0 auto;
      box-sizing: border-box;
    }
    .app-canvas::-webkit-scrollbar,
    .canvas-content::-webkit-scrollbar,
    .sidebar-nav::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }
    .app-canvas::-webkit-scrollbar-track,
    .canvas-content::-webkit-scrollbar-track,
    .sidebar-nav::-webkit-scrollbar-track {
      background: rgba(0, 0, 0, 0.05);
      border-radius: 999px;
    }
    body.theme-dark .app-canvas::-webkit-scrollbar-track,
    body.theme-dark .canvas-content::-webkit-scrollbar-track,
    body.theme-dark .sidebar-nav::-webkit-scrollbar-track {
      background: rgba(255, 255, 255, 0.04);
    }
    .app-canvas::-webkit-scrollbar-thumb,
    .canvas-content::-webkit-scrollbar-thumb,
    .sidebar-nav::-webkit-scrollbar-thumb {
      background: rgba(148, 163, 184, 0.65);
      border-radius: 999px;
      border: 2px solid transparent;
      background-clip: padding-box;
    }
    body.theme-dark .app-canvas::-webkit-scrollbar-thumb,
    body.theme-dark .canvas-content::-webkit-scrollbar-thumb,
    body.theme-dark .sidebar-nav::-webkit-scrollbar-thumb {
      background: rgba(100, 116, 139, 0.75);
    }
    .app-canvas::-webkit-scrollbar-thumb:hover,
    .canvas-content::-webkit-scrollbar-thumb:hover,
    .sidebar-nav::-webkit-scrollbar-thumb:hover {
      background: rgba(71, 85, 105, 0.9);
    }
    body.theme-dark .app-canvas::-webkit-scrollbar-thumb:hover,
    body.theme-dark .canvas-content::-webkit-scrollbar-thumb:hover,
    body.theme-dark .sidebar-nav::-webkit-scrollbar-thumb:hover {
      background: rgba(148, 163, 184, 0.95);
    }

    /* Barra de Selector de Modalidades (Segmented Control) */
    .modality-switcher-bar {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-bottom: 20px;
      padding: 5px;
      background: var(--theme-pill-bg);
      border-radius: 12px;
      border: 1px solid var(--theme-border);
      flex-wrap: wrap;
    }

    /* Drawer Móvil / Tablet y Backdrop */
    .sidebar-backdrop {
      display: none;
    }
    @media (max-width: 850px) {
      .app-sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 290px !important;
        min-width: 290px !important;
        max-width: 85vw !important;
        height: 100% !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        z-index: 9999 !important;
        transform: translateX(-100%) !important;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.5) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
      }
      .app-shell.sidebar-mobile-open .app-sidebar {
        transform: translateX(0) !important;
      }
      .app-shell.sidebar-collapsed .app-sidebar {
        width: 290px !important;
        min-width: 290px !important;
        max-width: 85vw !important;
        opacity: 1 !important;
        pointer-events: auto !important;
      }
      .app-shell.sidebar-collapsed.sidebar-mobile-open .app-sidebar {
        transform: translateX(0) !important;
      }
      .sidebar-backdrop {
        display: none;
        position: fixed !important;
        inset: 0 !important;
        background: rgba(0, 0, 0, 0.65) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        backdrop-filter: blur(4px) !important;
        z-index: 9990 !important;
      }
      .app-shell.sidebar-mobile-open .sidebar-backdrop {
        display: block !important;
      }
      #btn-expand-sidebar {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 !important;
        background: var(--theme-card) !important;
        border: 1px solid var(--theme-border) !important;
        color: var(--theme-text) !important;
        padding: 0 !important;
        width: 38px !important;
        min-width: 38px !important;
        max-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
        border-radius: 9px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
        cursor: pointer !important;
        z-index: 35 !important;
        flex-shrink: 0 !important;
      }
      #btn-expand-sidebar:active {
        transform: scale(0.94);
        background: var(--theme-pill-bg) !important;
      }
      .icon-hamburger {
        display: block !important;
      }
      .icon-desktop-expand {
        display: none !important;
      }
      .mobile-menu-text {
        display: none !important;
      }
      .icon-close-mobile {
        display: block !important;
      }
      .icon-collapse-desktop {
        display: none !important;
      }
      #btn-collapse-sidebar {
        width: 36px !important;
        height: 36px !important;
        background: var(--theme-pill-bg) !important;
        border: 1px solid var(--theme-border) !important;
        border-radius: 8px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: var(--theme-text) !important;
      }
      .canvas-topbar {
        position: relative !important;
        top: 0 !important;
        flex-shrink: 0 !important;
        padding: 0 12px !important;
        height: 56px !important;
        min-height: 56px !important;
        max-height: 56px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
        box-sizing: border-box !important;
        z-index: 40 !important;
      }
      .canvas-topbar-left {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        flex: 1 !important;
        min-width: 0 !important;
        overflow: hidden !important;
      }
      .canvas-breadcrumbs {
        display: flex !important;
        align-items: center !important;
        min-width: 0 !important;
        flex: 1 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
      }
      .canvas-breadcrumbs .crumb-root,
      .canvas-breadcrumbs .crumb-sep {
        display: none !important;
      }
      .canvas-breadcrumbs .crumb-active {
        font-size: 14px !important;
        font-weight: 700 !important;
        color: var(--theme-text) !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        min-width: 0 !important;
        max-width: 100% !important;
        display: block !important;
      }
      .canvas-topbar-right {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
      }
      .canvas-topbar-right .btn-theme-toggle {
        width: 34px !important;
        height: 34px !important;
        flex-shrink: 0 !important;
      }
      .canvas-topbar-right .btn-topbar-logout {
        width: 34px !important;
        height: 34px !important;
        flex-shrink: 0 !important;
      }
      .canvas-topbar-right .user-dropdown-trigger {
        padding: 2px 7px 2px 3px !important;
        gap: 4px !important;
        flex-shrink: 0 !important;
      }
      .canvas-content {
        padding: 14px 12px 100px !important;
        min-height: 0 !important;
        height: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
      }
      .modality-switcher-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 6px 6px;
      }
      .modality-switcher-bar::-webkit-scrollbar {
        display: none;
      }
      .btn-mod-switch {
        white-space: nowrap;
        flex-shrink: 0;
        font-size: 12px;
        padding: 6px 12px;
      }
    }

    /* Widgets de Pasos (Primeros Pasos) */
    .step-card {
      position: relative;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      min-height: 155px;
    }
    .step-num {
      position: absolute;
      top: 14px;
      right: 14px;
      font-size: 10.5px;
      font-weight: 700;
      color: var(--cyan);
      background: var(--cyan-bg);
      border: 1px solid rgba(56, 189, 248, 0.25);
      padding: 2px 8px;
      border-radius: 999px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .btn-secondary-link {
      background: transparent;
      border: 1px solid var(--theme-border);
      color: var(--cyan);
      font-size: 12.5px;
      font-weight: 600;
      padding: 7px 12px;
      border-radius: 7px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      align-self: flex-start;
      margin-top: 8px;
      transition: all 0.15s ease;
      font-family: var(--font-sans);
    }
    .btn-secondary-link:hover {
      background: var(--cyan-bg);
      border-color: var(--cyan);
    }

    /* Grid de prompts interactivos */
    .prompt-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
      gap: 12px;
      margin-top: 14px;
    }
    .prompt-box {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--theme-border);
      border-radius: 10px;
      padding: 14px;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      gap: 10px;
      transition: all 0.2s ease;
    }
    body.theme-light .prompt-box {
      background: #ffffff;
      border-color: #e2e8f0;
    }
    .prompt-box:hover {
      border-color: var(--cyan);
      background: var(--theme-pill-bg);
      transform: translateY(-1px);
    }
    .prompt-text {
      font-size: 12.5px;
      color: var(--theme-text);
      line-height: 1.5;
      font-style: italic;
    }
    .prompt-copy-hint {
      font-size: 11px;
      font-weight: 600;
      color: var(--cyan);
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }

    /* Grid de estadísticas de Licencia */
    .lic-stats-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
      gap: 16px;
      margin-top: 18px;
    }
    .lic-stat-card {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--theme-border);
      border-radius: 12px;
      padding: 20px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    body.theme-light .lic-stat-card {
      background: #ffffff;
      border-color: #e2e8f0;
    }
    .lic-stat-card.highlight {
      border-color: rgba(56, 189, 248, 0.4);
      background: linear-gradient(135deg, rgba(56, 189, 248, 0.08) 0%, rgba(37, 99, 235, 0.04) 100%);
    }
    .lic-stat-label {
      font-size: 11.5px;
      font-weight: 600;
      color: var(--theme-text-muted);
      text-transform: uppercase;
      letter-spacing: 0.6px;
    }
    .lic-stat-value {
      font-size: 32px;
      font-weight: 800;
      color: var(--theme-text);
      line-height: 1.1;
      display: flex;
      align-items: baseline;
      gap: 6px;
    }
    .lic-stat-value.sm {
      font-size: 18px;
      font-weight: 700;
      color: var(--cyan);
    }
    .lic-stat-unit {
      font-size: 14px;
      font-weight: 600;
      color: var(--theme-text-muted);
    }
    .lic-progress-track {
      height: 6px;
      background: rgba(255, 255, 255, 0.08);
      border-radius: 999px;
      overflow: hidden;
      margin: 4px 0;
    }
    body.theme-light .lic-progress-track {
      background: #e2e8f0;
    }
    .lic-progress-bar {
      height: 100%;
      background: linear-gradient(90deg, #10b981, #38bdf8);
      border-radius: 999px;
      transition: width 0.4s ease;
    }
    .lic-stat-key {
      font-family: var(--font-mono);
      font-size: 13.5px;
      color: var(--cyan);
      word-break: break-all;
      background: rgba(0, 0, 0, 0.2);
      padding: 6px 10px;
      border-radius: 6px;
      border: 1px solid var(--theme-border-subtle);
    }
    .lic-stat-sub {
      font-size: 11.5px;
      color: var(--theme-text-muted);
      line-height: 1.4;
    }
    .btn-copy-sm {
      background: transparent;
      border: 1px solid var(--theme-border);
      color: var(--theme-text);
      font-size: 11.5px;
      font-weight: 500;
      padding: 5px 10px;
      border-radius: 6px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 5px;
      align-self: flex-start;
      transition: all 0.15s ease;
    }
    .btn-copy-sm:hover {
      background: var(--theme-pill-bg);
      border-color: var(--cyan);
      color: var(--cyan);
    }

    /* Contenidos de Pestañas */
    .tab-content {
      display: none;
      width: 100%;
      height: auto !important;
      min-height: 0;
      max-height: none !important;
      overflow: visible !important;
      animation: fadeIn 0.2s ease-out;
    }
    .tab-content.active {
      display: block !important;
      width: 100%;
      height: auto !important;
      max-height: none !important;
      overflow: visible !important;
    }
    #tab-bitacora-metodologica {
      width: 100%;
      height: auto !important;
      max-height: none !important;
      overflow: visible !important;
      box-sizing: border-box;
    }
    #tab-bitacora-metodologica.active {
      display: block !important;
      height: auto !important;
      max-height: none !important;
      overflow: visible !important;
    }
    #tab-progreso-tesis,
    #tab-progreso-articulo,
    #tab-progreso-revision,
    #tab-progreso-suficiencia,
    #tab-progreso-informe {
      width: 100%;
      height: auto !important;
      max-height: none !important;
      overflow: visible !important;
      box-sizing: border-box;
    }
    #tab-progreso-tesis.active,
    #tab-progreso-articulo.active,
    #tab-progreso-revision.active,
    #tab-progreso-suficiencia.active,
    #tab-progreso-informe.active {
      display: block !important;
      height: auto !important;
      max-height: none !important;
      overflow: visible !important;
    }

    /* Modalidades bloqueadas por RBAC */
    .btn-mod-switch.modality-blocked,
    .btn-tab-bitacora-mod.modality-blocked,
    .app-sidebar .tab-btn.modality-blocked {
      opacity: 0.45 !important;
      cursor: not-allowed !important;
      filter: grayscale(0.7) !important;
      position: relative !important;
      pointer-events: auto !important;
    }
    .btn-mod-switch.modality-blocked:hover,
    .btn-tab-bitacora-mod.modality-blocked:hover {
      background: var(--theme-card) !important;
      border-color: var(--rose) !important;
      color: var(--rose) !important;
    }
    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(4px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* Cards & Containers */
    .card {
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 6px;
      padding: 26px 28px;
      margin-bottom: 22px;
      box-shadow: var(--theme-card-shadow);
      transition: all 0.2s ease;
    }
    .card h3 {
      font-family: var(--font-serif);
      font-size: 21px;
      font-weight: 700;
      color: var(--theme-text);
      margin-bottom: 8px;
      display: flex;
      align-items: center;
      gap: 10px;
      letter-spacing: -0.01em;
    }
    .card p.desc {
      font-size: 13.5px;
      color: var(--theme-text-muted);
      line-height: 1.6;
      margin-bottom: 20px;
    }
    @media (max-width: 640px) {
      .card {
        padding: 18px 14px;
        border-radius: 6px;
        margin-bottom: 16px;
      }
      .card h3 {
        font-size: 18px;
      }
    }

    /* Copy Box for MCP URL */
    .copy-box {
      display: flex;
      gap: 8px;
      margin-bottom: 24px;
    }
    .copy-input {
      flex: 1;
      background: var(--theme-input-bg);
      border: 1px solid var(--theme-border);
      border-radius: 8px;
      padding: 12px 16px;
      color: var(--theme-text);
      font-size: 13px;
      font-family: var(--font-mono);
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .copy-input:focus {
      border-color: var(--theme-primary);
      box-shadow: 0 0 0 3px var(--theme-primary-shadow);
    }
    .btn-copy {
      background: #2563eb;
      color: #fff;
      border: none;
      padding: 0 20px;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      transition: all 0.2s;
      min-height: 44px;
      box-shadow: 0 2px 8px rgba(37,99,235,0.25);
    }
    .btn-copy:hover {
      background: #1d4ed8;
      transform: translateY(-1px);
    }

    /* Responsive Grids */
    .grid-2 {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
    }
    @media (max-width: 768px) {
      .grid-2 { grid-template-columns: 1fr; }
    }
    .grid-3 {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 16px;
    }
    @media (max-width: 960px) {
      .grid-3 { grid-template-columns: 1fr; }
    }
    .subcard {
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 12px;
      padding: 20px;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .subcard:hover {
      border-color: var(--theme-primary);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    }
    .subcard h4 {
      font-size: 14.5px;
      font-weight: 700;
      color: var(--theme-text);
      margin-bottom: 10px;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .subcard ol, .subcard ul {
      margin-left: 20px;
      font-size: 13px;
      color: var(--theme-text-muted);
      line-height: 1.65;
    }
    .subcard li {
      margin-bottom: 6px;
    }

    /* Alerts */
    .alert {
      padding: 15px 18px;
      border-radius: 9px;
      font-size: 13.5px;
      line-height: 1.55;
      margin-bottom: 20px;
      display: flex;
      align-items: flex-start;
      gap: 12px;
    }
    .alert-ok {
      background: var(--emerald-bg);
      border: 1px solid rgba(16,185,129,0.3);
      color: var(--emerald);
    }
    .alert-amber {
      background: var(--amber-bg);
      border: 1px solid rgba(245,158,11,0.3);
      color: var(--amber);
    }
    .alert-err {
      background: var(--rose-bg);
      border: 1px solid rgba(239,68,68,0.3);
      color: var(--rose);
    }

    /* Forms in Dashboard */
    .dash-form label {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 13px;
      font-weight: 600;
      color: var(--theme-text);
      margin-bottom: 7px;
    }
    .dash-form input[type="text"],
    .dash-form input[type="password"] {
      width: 100%;
      background: var(--theme-input-bg);
      border: 1px solid var(--theme-border);
      border-radius: 8px;
      padding: 11px 14px;
      color: var(--theme-text);
      font-size: 14px;
      font-family: var(--font-mono);
      margin-bottom: 16px;
      transition: all 0.2s;
    }
    .dash-form input:focus {
      outline: none;
      border-color: var(--theme-primary);
      box-shadow: 0 0 0 3px var(--theme-primary-shadow);
    }
    .btn-action {
      background: linear-gradient(135deg, #059669, #047857);
      color: #fff;
      border: none;
      padding: 12px 22px;
      border-radius: 8px;
      font-size: 13.5px;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      transition: all 0.2s;
      min-height: 44px;
      box-shadow: 0 2px 8px rgba(5,150,105,0.25);
    }
    .btn-action:hover:not(:disabled) {
      background: linear-gradient(135deg, #047857, #065f46);
      transform: translateY(-1px);
    }
    .btn-action:disabled {
      opacity: 0.65;
      cursor: not-allowed;
    }
    .btn-danger-outline {
      background: transparent;
      border: 1px solid #ef4444;
      color: #ef4444;
      padding: 10px 18px;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: all 0.2s;
      min-height: 42px;
    }
    .btn-danger-outline:hover {
      background: rgba(239,68,68,0.1);
      border-color: #dc2626;
    }

    /* Drag & Drop File Upload Area */
    .dropzone-box {
      border: 2px dashed var(--theme-border);
      border-radius: 10px;
      padding: 24px;
      background: var(--theme-pill-bg);
      margin-bottom: 16px;
      transition: all 0.2s;
      text-align: center;
      cursor: pointer;
    }
    .dropzone-box:hover, .dropzone-box.dragover {
      border-color: var(--theme-primary);
      background: var(--theme-active-item-bg);
    }
    .dropzone-box .label-title {
      font-size: 13.5px;
      font-weight: 600;
      color: var(--theme-text);
      margin-bottom: 4px;
    }
    .dropzone-box .label-desc {
      font-size: 12px;
      color: var(--theme-text-muted);
      margin-bottom: 12px;
    }
    .dropzone-box input[type="file"] {
      font-size: 13px;
      color: var(--theme-text-muted);
    }

    /* ==========================================================================
       CANVA DE LAS 9 FASES DE LA INVESTIGACIÓN (CANVA VIEW)
       ========================================================================== */
    .card-progreso-wrapper {
      padding: 24px;
      border-radius: 12px;
    }
    @media (max-width: 768px) {
      .card-progreso-wrapper {
        padding: 16px;
      }
    }

    /* Banner Ejecutivo de la Investigación (Dashboard) */
    .proy-executive-banner {
      background: linear-gradient(135deg, rgba(2, 132, 199, 0.07) 0%, rgba(99, 102, 241, 0.06) 100%);
      border: 1px solid rgba(2, 132, 199, 0.22);
      border-radius: 12px;
      padding: 16px 20px;
      margin-bottom: 20px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    }
    body.theme-dark .proy-executive-banner {
      background: linear-gradient(135deg, rgba(2, 132, 199, 0.12) 0%, rgba(99, 102, 241, 0.09) 100%);
      border-color: rgba(2, 132, 199, 0.32);
    }
    .proy-banner-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 10px;
    }
    .proy-banner-tags {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 8px;
    }
    .proy-tag {
      font-size: 11.5px;
      padding: 3px 9px;
      border-radius: 6px;
      font-weight: 600;
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }
    .proy-tag-uni {
      background: rgba(2, 132, 199, 0.12);
      color: #0284c7;
      border: 1px solid rgba(2, 132, 199, 0.25);
      font-weight: 700;
    }
    body.theme-dark .proy-tag-uni {
      color: #38bdf8;
    }
    .proy-tag-meta {
      color: var(--theme-text-muted);
      font-size: 11.5px;
    }
    .btn-banner-edit {
      background: transparent;
      border: 1px solid rgba(99, 102, 241, 0.3);
      color: #6366f1;
      padding: 5px 12px;
      border-radius: 7px;
      font-size: 11.5px;
      font-weight: 700;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 5px;
      transition: all 0.16s ease;
    }
    .btn-banner-edit:hover {
      background: rgba(99, 102, 241, 0.1);
      border-color: #6366f1;
    }
    .proy-banner-title {
      font-family: var(--font-sans);
      font-size: 15.5px;
      font-weight: 700;
      color: var(--theme-text);
      line-height: 1.4;
      margin: 0;
      letter-spacing: -0.01em;
    }

    /* Toolbar Canva */
    .canva-toolbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 14px;
      margin-bottom: 16px;
      padding-bottom: 14px;
      border-bottom: 1px solid var(--theme-border-subtle);
    }
    .canva-toolbar-left {
      display: flex;
      flex-direction: column;
      gap: 3px;
    }
    .canva-toolbar-title {
      margin: 0;
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 16px;
      font-weight: 700;
      color: var(--theme-text);
    }
    .canva-toolbar-subtitle {
      font-size: 12px;
      color: var(--theme-text-muted);
    }
    .canva-toolbar-right {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }
    .btn-action-secondary {
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      color: var(--theme-text);
      padding: 7px 13px;
      border-radius: 8px;
      font-weight: 600;
      font-size: 12px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: all 0.15s ease;
      font-family: var(--font-sans);
    }
    .btn-action-secondary:hover {
      background: var(--theme-pill-bg);
      border-color: #94a3b8;
    }
    .btn-action-emerald {
      background: #10b981;
      border: 1px solid #059669;
      color: #ffffff;
      padding: 7px 14px;
      border-radius: 8px;
      font-weight: 700;
      font-size: 12px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      box-shadow: 0 1px 3px rgba(16, 185, 129, 0.25);
      transition: all 0.16s ease;
      font-family: var(--font-sans);
    }
    .btn-action-emerald:hover {
      background: #059669;
      box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
      transform: translateY(-1px);
    }
    .canva-view-toggle {
      display: inline-flex;
      background: var(--theme-pill-bg);
      border: 1px solid var(--theme-border);
      border-radius: 9px;
      padding: 3px;
      gap: 3px;
    }
    .canva-toggle-btn {
      background: transparent;
      border: none;
      color: var(--theme-text-muted);
      padding: 6px 12px;
      font-size: 12px;
      font-weight: 600;
      border-radius: 6px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: all 0.15s ease;
      font-family: var(--font-sans);
    }
    .canva-toggle-btn.active {
      background: var(--theme-card);
      color: var(--theme-primary);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
      font-weight: 700;
    }
    .canva-board-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 16px;
      margin-top: 14px;
    }
    @media (max-width: 1100px) {
      .canva-board-grid {
        grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
        gap: 14px;
      }
    }
    @media (max-width: 640px) {
      .canva-board-grid {
        grid-template-columns: 1fr;
        gap: 12px;
      }
    }
    .canva-col {
      background: var(--theme-pill-bg);
      border: 1px solid var(--theme-border);
      border-radius: 10px;
      padding: 14px 12px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .canva-col-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 2px 4px 10px;
      border-bottom: 1px dashed var(--theme-border);
    }
    .canva-col-title {
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.6px;
      display: flex;
      align-items: center;
      gap: 7px;
    }
    .canva-col-badge {
      font-size: 10px;
      font-weight: 700;
      padding: 2px 8px;
      border-radius: 5px;
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      color: var(--theme-text-muted);
    }
    .canva-card {
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 8px;
      padding: 14px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
      transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
      display: flex;
      flex-direction: column;
      gap: 9px;
      position: relative;
      overflow: hidden;
      cursor: pointer;
    }
    .canva-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 3px;
      background: transparent;
      transition: background 0.2s ease;
    }
    .canva-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 20px -3px rgba(15, 23, 42, 0.08);
      border-color: #94a3b8;
    }
    body.theme-dark .canva-card:hover {
      box-shadow: 0 10px 24px -3px rgba(0, 0, 0, 0.4);
      border-color: #64748b;
    }
    .canva-card:active {
      transform: scale(0.99);
    }
    .canva-card.current {
      border: 1.5px solid #0284c7;
      background: var(--theme-active-item-bg);
      box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
    }
    .canva-card.current::before {
      background: linear-gradient(90deg, #0284c7, #38bdf8);
    }
    .canva-card.completed {
      border-color: rgba(16, 185, 129, 0.4);
    }
    .canva-card.completed::before {
      background: #10b981;
    }
    .canva-card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .canva-card-num {
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 700;
      color: var(--theme-primary);
      background: var(--theme-pill-bg);
      padding: 3px 8px;
      border-radius: 5px;
      border: 1px solid var(--theme-border);
      letter-spacing: 0.3px;
    }
    .canva-card.current .canva-card-num {
      background: #0284c7;
      color: #ffffff;
      border-color: #0284c7;
    }
    .canva-card-badge {
      font-size: 10px;
      font-weight: 700;
      padding: 3px 9px;
      border-radius: 999px;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .badge-canva-current {
      background: rgba(2, 132, 199, 0.12);
      color: #0284c7;
      border: 1px solid rgba(2, 132, 199, 0.3);
    }
    .badge-canva-done {
      background: rgba(16, 185, 129, 0.12);
      color: #10b981;
      border: 1px solid rgba(16, 185, 129, 0.3);
    }
    .badge-canva-pending {
      background: var(--theme-pill-bg);
      color: var(--theme-text-muted);
      border: 1px solid var(--theme-border);
    }
    .canva-card-hover-hint {
      font-size: 10px;
      font-weight: 700;
      color: var(--theme-primary);
      opacity: 0;
      transform: translateY(2px);
      transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
      display: inline-flex;
      align-items: center;
      gap: 3px;
    }
    .canva-card:hover .canva-card-hover-hint {
      opacity: 1;
      transform: translateY(0);
    }
    .canva-card-body {
      display: flex;
      align-items: flex-start;
      gap: 11px;
    }
    .canva-card-icon {
      width: 34px;
      height: 34px;
      border-radius: 8px;
      background: var(--theme-pill-bg);
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--theme-primary);
      flex-shrink: 0;
      border: 1px solid var(--theme-border);
      transition: transform 0.2s ease;
    }
    .canva-card:hover .canva-card-icon {
      transform: scale(1.05);
    }
    .canva-card.current .canva-card-icon {
      background: #0284c7;
      color: #fff;
      border-color: #0284c7;
    }
    .canva-card-info {
      flex: 1;
      min-width: 0;
    }
    .canva-card-title {
      font-family: var(--font-sans);
      font-size: 13px;
      font-weight: 700;
      color: var(--theme-text);
      line-height: 1.35;
      margin-bottom: 2px;
    }
    .canva-card-key {
      font-family: var(--font-mono);
      font-size: 10px;
      color: var(--theme-text-muted);
      letter-spacing: 0.2px;
    }
    .canva-card-desc {
      font-size: 11.5px;
      color: var(--theme-text-muted);
      line-height: 1.45;
      margin: 0;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .canva-card-deliverable {
      font-size: 11px;
      color: var(--theme-text);
      background: var(--theme-pill-bg);
      padding: 6px 9px;
      border-radius: 6px;
      border: 1px solid var(--theme-border-subtle);
      display: flex;
      align-items: flex-start;
      gap: 7px;
      line-height: 1.35;
      margin-top: 3px;
    }
    .canva-card-w-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 17px;
      height: 17px;
      background: linear-gradient(135deg, #1e40af, #2563eb);
      color: #ffffff;
      font-weight: 800;
      font-size: 9.5px;
      border-radius: 4px;
      flex-shrink: 0;
      font-family: var(--font-sans);
      margin-top: 1px;
    }
    .canva-card-deliverable-label {
      color: #10b981;
      font-weight: 700;
      font-size: 11px;
      flex-shrink: 0;
    }
    .canva-card-deliverable-val {
      color: var(--theme-text-muted);
      font-size: 11px;
      line-height: 1.35;
      word-break: break-word;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .canva-card-actions {
      display: flex;
      align-items: center;
      gap: 5px;
      margin-top: 4px;
      padding-top: 9px;
      border-top: 1px solid var(--theme-border-subtle);
      flex-wrap: wrap;
    }
    .btn-canva-act {
      flex: 1;
      min-width: 70px;
      font-size: 11px;
      font-weight: 600;
      padding: 5px 8px;
      border-radius: 6px;
      border: 1px solid var(--theme-border);
      background: var(--theme-card);
      color: var(--theme-text);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      transition: all 0.16s ease;
      font-family: var(--font-sans);
    }
    .btn-canva-act:hover {
      background: var(--theme-pill-bg);
      border-color: #94a3b8;
    }
    .btn-canva-act:active {
      transform: scale(0.96);
    }
    .btn-canva-act.primary {
      background: #0284c7;
      color: #fff;
      border-color: #0284c7;
      font-weight: 700;
    }
    .btn-canva-act.primary:hover {
      background: #0369a1;
      border-color: #0369a1;
    }
    .btn-canva-act.done {
      background: rgba(16, 185, 129, 0.1);
      color: #10b981;
      border-color: rgba(16, 185, 129, 0.3);
      font-weight: 700;
    }
    .btn-canva-act.done:hover {
      background: #10b981;
      color: #fff;
    }
    .btn-canva-act.bitacora {
      background: rgba(147, 51, 234, 0.08);
      color: #9333ea;
      border-color: rgba(147, 51, 234, 0.25);
      font-weight: 600;
    }
    .btn-canva-act.bitacora:hover {
      background: #9333ea;
      color: #fff;
    }
    .canva-board-footer {
      margin-top: 28px;
      padding-top: 18px;
      border-top: 1px solid var(--theme-border-subtle);
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 12px;
    }
    .canva-footer-hint {
      display: flex;
      align-items: center;
      gap: 7px;
      font-size: 12px;
      color: var(--theme-text-muted);
    }

    /* Vista Lista Tradicional Mejorada */
    .list-etapa-group {
      margin-bottom: 22px;
    }
    .list-etapa-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 9px 16px;
      background: var(--theme-pill-bg);
      border-radius: 9px;
      margin-bottom: 12px;
      border: 1px solid var(--theme-border-subtle);
    }
    .phase-row {
      display: flex;
      align-items: flex-start;
      gap: 16px;
      padding: 16px 20px;
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 12px;
      margin-bottom: 12px;
      transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
      cursor: pointer;
      position: relative;
    }
    .phase-row:hover {
      border-color: #94a3b8;
      box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
      transform: translateY(-2px);
    }
    body.theme-dark .phase-row:hover {
      border-color: #64748b;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }
    .phase-row.current {
      border: 1.5px solid var(--theme-primary);
      background: var(--theme-active-item-bg);
      box-shadow: 0 0 0 2px var(--theme-primary-shadow);
    }
    .phase-row.completed {
      border-color: rgba(16, 185, 129, 0.4);
    }
    .phase-list-badge-col {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
      padding-top: 2px;
    }
    .phase-index {
      width: 34px;
      height: 34px;
      border-radius: 9px;
      background: var(--theme-pill-bg);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 11.5px;
      font-weight: 800;
      color: var(--theme-primary);
      font-family: var(--font-mono);
      border: 1px solid var(--theme-border);
    }
    .phase-list-icon {
      color: var(--theme-text-muted);
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .phase-body {
      flex: 1;
      min-width: 0;
    }
    .phase-row-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 4px;
      flex-wrap: wrap;
    }
    .phase-heading {
      font-size: 14px;
      font-weight: 700;
      color: var(--theme-text);
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }
    .phase-list-desc {
      font-size: 12.5px;
      color: var(--theme-text-muted);
      margin: 4px 0 8px 0;
      line-height: 1.45;
    }
    .phase-list-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
      padding-top: 2px;
    }
    @media (max-width: 768px) {
      .phase-row {
        flex-direction: column;
        align-items: stretch;
      }
      .phase-list-actions {
        margin-top: 10px;
        justify-content: flex-end;
      }
    }
    .badge {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 4px 10px;
      border-radius: 6px;
      font-size: 11.5px;
      font-weight: 600;
    }
    .badge-done { background: var(--emerald-bg); color: var(--emerald); }
    .badge-current { background: var(--theme-active-item-bg); color: var(--theme-primary); }
    .badge-pending { background: var(--theme-pill-bg); color: var(--theme-text-muted); }
    .badge-amber { background: var(--amber-bg); color: var(--amber); }

    /* Progress bar */
    .progress-track {
      background: var(--theme-pill-bg);
      border-radius: 10px;
      height: 10px;
      overflow: hidden;
      margin-bottom: 8px;
    }
    .progress-fill {
      background: linear-gradient(90deg, #2563eb, #38bdf8);
      height: 100%;
      width: 0%;
      transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    /* ==========================================================================
       MODAL DE BITÁCORA METODOLÓGICA Y SIMULADOR DE JURADO (OPCIÓN 2)
       ========================================================================== */
    .bitacora-modal-backdrop {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(15, 23, 42, 0.75);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      z-index: 10000;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 18px;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .bitacora-modal-backdrop.active {
      opacity: 1;
      pointer-events: auto;
    }
    .bitacora-modal-dialog {
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 18px;
      width: 100%;
      max-width: 960px;
      max-height: 88vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
      overflow: hidden;
      transform: scale(0.96) translateY(12px);
      transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .bitacora-modal-backdrop.active .bitacora-modal-dialog {
      transform: scale(1) translateY(0);
    }
    .bitacora-modal-header {
      padding: 18px 24px;
      background: var(--theme-pill-bg);
      border-bottom: 1px solid var(--theme-border-subtle);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      flex-shrink: 0;
    }
    .bitacora-header-left {
      display: flex;
      align-items: center;
      gap: 14px;
      min-width: 0;
    }
    .bitacora-pill-fase {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      padding: 4px 10px;
      border-radius: 6px;
      background: linear-gradient(135deg, #0284c7, #2563eb);
      color: #fff;
      letter-spacing: 0.5px;
      flex-shrink: 0;
    }
    .bitacora-title {
      font-size: 17px;
      font-weight: 700;
      color: var(--theme-text);
      margin: 0;
      line-height: 1.25;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .bitacora-sub {
      font-size: 12px;
      color: var(--theme-text-muted);
      margin-top: 2px;
    }
    .bitacora-header-right {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-shrink: 0;
    }
    .bitacora-status-chip {
      font-size: 11.5px;
      font-weight: 600;
      padding: 4px 10px;
      border-radius: 6px;
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      color: var(--theme-text-muted);
    }
    .bitacora-status-chip.done {
      background: rgba(16, 185, 129, 0.12);
      color: #10b981;
      border-color: rgba(16, 185, 129, 0.25);
    }
    .bitacora-status-chip.draft {
      background: rgba(2, 132, 199, 0.12);
      color: #0284c7;
      border-color: rgba(2, 132, 199, 0.25);
    }
    .bitacora-btn-close {
      width: 32px;
      height: 32px;
      border-radius: 8px;
      border: 1px solid var(--theme-border);
      background: var(--theme-card);
      color: var(--theme-text-muted);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      font-weight: bold;
      transition: all 0.15s ease;
    }
    .bitacora-btn-close:hover {
      background: rgba(239, 68, 68, 0.1);
      color: #ef4444;
      border-color: rgba(239, 68, 68, 0.3);
    }
    .bitacora-nav-tabs {
      display: flex;
      padding: 0 24px;
      background: var(--theme-card);
      border-bottom: 1px solid var(--theme-border);
      gap: 8px;
      flex-shrink: 0;
    }
    .bitacora-tab-btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 12px 16px;
      border: none;
      background: transparent;
      color: var(--theme-text-muted);
      font-size: 13.5px;
      font-weight: 600;
      cursor: pointer;
      border-bottom: 2px solid transparent;
      transition: all 0.15s ease;
      font-family: var(--font-sans);
    }
    .bitacora-tab-btn:hover {
      color: var(--theme-text);
    }
    .bitacora-tab-btn.active {
      color: var(--theme-primary);
      border-bottom-color: var(--theme-primary);
      font-weight: 700;
    }
    .bitacora-modal-body {
      padding: 24px;
      overflow-y: auto !important;
      -webkit-overflow-scrolling: touch;
      flex: 1 1 0%;
      min-height: 0;
    }
    .bitacora-doc-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 10px;
      padding: 10px 14px;
      background: var(--theme-pill-bg);
      border: 1px solid var(--theme-border-subtle);
      border-radius: 8px;
      margin-bottom: 16px;
    }
    .bitacora-doc-meta {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 12.5px;
      color: var(--theme-text-muted);
    }
    .bitacora-btn-action {
      font-size: 12px;
      font-weight: 600;
      padding: 6px 12px;
      border-radius: 6px;
      border: 1px solid var(--theme-border);
      background: var(--theme-card);
      color: var(--theme-text);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: all 0.15s ease;
    }
    .bitacora-btn-action:hover {
      background: var(--theme-primary);
      color: #fff;
      border-color: var(--theme-primary);
    }
    .bitacora-academic-reading {
      background: var(--theme-card);
      border: 1px solid var(--theme-border-subtle);
      border-radius: 14px;
      padding: 28px 32px;
      font-family: var(--font-serif);
      font-size: 17.5px;
      line-height: 1.85;
      color: var(--theme-text);
      max-height: 52vh;
      overflow-y: auto;
      box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    }
    .bitacora-p-block {
      margin-bottom: 20px;
      position: relative;
      text-align: justify;
    }
    .bitacora-p-block:last-child {
      margin-bottom: 0;
    }
    .bitacora-p-tag {
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 700;
      color: var(--theme-primary);
      background: var(--theme-pill-bg);
      padding: 2px 7px;
      border-radius: 5px;
      margin-right: 10px;
      vertical-align: baseline;
      border: 1px solid var(--theme-border);
      user-select: none;
      letter-spacing: 0.5px;
    }

    /* Simulador de Jurado (Card de Blindaje Metodológico) */
    .jury-simulator-card {
      background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, rgba(245, 158, 11, 0.03) 100%);
      border: 1px solid rgba(239, 68, 68, 0.22);
      border-radius: 14px;
      padding: 22px;
      margin-bottom: 22px;
      box-shadow: 0 6px 20px -4px rgba(239, 68, 68, 0.06);
      position: relative;
      overflow: hidden;
    }
    .jury-simulator-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 4px;
      height: 100%;
      background: linear-gradient(180deg, #ef4444, #f59e0b);
    }
    .jury-simulator-badge {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      font-size: 11px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.7px;
      color: #ef4444;
      background: rgba(239, 68, 68, 0.1);
      border: 1px solid rgba(239, 68, 68, 0.25);
      padding: 4px 10px;
      border-radius: 6px;
      margin-bottom: 16px;
    }
    .jury-qa-grid {
      display: flex;
      flex-direction: column;
      gap: 14px;
    }
    .jury-q-box {
      background: var(--theme-card);
      border-left: 4px solid #ef4444;
      border-radius: 10px;
      padding: 16px 18px;
      border-top: 1px solid var(--theme-border-subtle);
      border-right: 1px solid var(--theme-border-subtle);
      border-bottom: 1px solid var(--theme-border-subtle);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
      transition: all 0.2s ease;
    }
    .jury-q-box:hover {
      box-shadow: 0 4px 14px rgba(239, 68, 68, 0.08);
    }
    .jury-q-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      font-size: 12.5px;
      color: #ef4444;
      font-weight: 700;
      margin-bottom: 8px;
    }
    .jury-q-content {
      font-size: 14.5px;
      font-weight: 600;
      color: var(--theme-text);
      line-height: 1.55;
      margin: 0;
    }
    .jury-a-box {
      background: var(--theme-card);
      border-left: 4px solid #10b981;
      border-radius: 10px;
      padding: 16px 18px;
      border-top: 1px solid var(--theme-border-subtle);
      border-right: 1px solid var(--theme-border-subtle);
      border-bottom: 1px solid var(--theme-border-subtle);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
      transition: all 0.2s ease;
    }
    .jury-a-box:hover {
      box-shadow: 0 4px 14px rgba(16, 185, 129, 0.08);
    }
    .jury-a-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      font-size: 12.5px;
      color: #10b981;
      font-weight: 700;
      margin-bottom: 8px;
    }
    .jury-a-content {
      font-size: 14px;
      color: var(--theme-text);
      line-height: 1.65;
      margin: 0;
    }
    .btn-copy-jury {
      background: var(--theme-pill-bg);
      border: 1px solid var(--theme-border);
      border-radius: 6px;
      padding: 3px 8px;
      font-size: 11px;
      font-weight: 600;
      color: var(--theme-text-muted);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      transition: all 0.15s ease;
      font-family: var(--font-sans);
    }
    .btn-copy-jury:hover {
      background: var(--theme-card);
      color: var(--theme-text);
      border-color: #94a3b8;
    }
    .btn-copy-jury:active {
      transform: scale(0.96);
    }
    .jury-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      display: inline-block;
    }
    .jury-dot.red { background: #ef4444; }
    .jury-dot.green { background: #10b981; }
    .bitacora-grid-details {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
    }
    @media (max-width: 768px) {
      .bitacora-grid-details {
        grid-template-columns: 1fr;
      }
    }
    .bitacora-card-info {
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 12px;
      padding: 18px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
      transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
    }
    .bitacora-card-info:hover {
      transform: translateY(-2px);
      border-color: #94a3b8;
      box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    }
    .bitacora-card-info-header {
      display: flex;
      align-items: center;
      gap: 9px;
      color: var(--theme-primary);
      margin-bottom: 10px;
    }
    .bitacora-card-info-header h4 {
      font-size: 13.5px;
      font-weight: 700;
      color: var(--theme-text);
      margin: 0;
      letter-spacing: -0.01em;
    }
    .bitacora-card-info-p {
      font-size: 13px;
      color: var(--theme-text-muted);
      line-height: 1.6;
      margin: 0;
    }
    .bitacora-chips-container,
    .bitacora-citas-container {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 6px;
    }
    .bitacora-source-chip {
      font-size: 12px;
      padding: 4px 10px;
      border-radius: 6px;
      background: var(--theme-pill-bg);
      border: 1px solid var(--theme-border);
      color: var(--theme-text);
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: all 0.15s ease;
    }
    .bitacora-source-chip:hover {
      border-color: var(--theme-primary);
      background: var(--theme-active-item-bg);
    }
    /* ESTILOS LÓGICA Y CRITERIO (CAJA BLANCA METODOLÓGICA) */
    .criterio-logico-wrapper {
      display: flex;
      flex-direction: column;
      gap: 20px;
      padding: 4px 2px;
    }
    .criterio-card-por-que {
      background: linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(99, 102, 241, 0.03));
      border: 1px solid rgba(37, 99, 235, 0.22);
      border-radius: 12px;
      padding: 18px 20px;
      box-shadow: var(--shadow-sm);
    }
    .criterio-card-header-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 11px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.6px;
      color: var(--theme-primary);
      margin-bottom: 8px;
    }
    .criterio-por-que-title {
      font-size: 15px;
      font-weight: 700;
      color: var(--theme-text);
      margin-bottom: 8px;
      line-height: 1.35;
    }
    .criterio-card-por-que-p {
      font-size: 14px;
      line-height: 1.65;
      color: var(--theme-text);
      font-weight: 400;
      margin: 0;
      opacity: 0.95;
    }
    .criterio-seccion {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .criterio-seccion-header {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12.5px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.6px;
      color: var(--theme-text);
      margin-bottom: 2px;
    }
    .criterio-seccion-icon {
      font-size: 16px;
      line-height: 1;
      display: inline-flex;
      align-items: center;
    }
    .formula-piezas-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
      gap: 12px;
    }
    .formula-pieza-card {
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 10px;
      padding: 14px 16px;
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
      position: relative;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      gap: 6px;
      box-shadow: var(--shadow-sm);
    }
    .formula-pieza-card:hover {
      border-color: var(--theme-primary);
      transform: translateY(-2px);
      box-shadow: var(--shadow-md);
    }
    .formula-pieza-badge {
      font-size: 11px;
      font-weight: 700;
      padding: 3px 9px;
      border-radius: 6px;
      display: inline-flex;
      align-self: flex-start;
      letter-spacing: 0.3px;
    }
    .formula-pieza-val {
      font-size: 13.5px;
      font-weight: 700;
      color: var(--theme-text);
      line-height: 1.4;
    }
    .formula-pieza-det {
      font-size: 12.5px;
      color: var(--theme-text-muted);
      line-height: 1.5;
      margin: 0;
    }
    .pasos-secuencia-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .paso-secuencia-item {
      display: flex;
      align-items: flex-start;
      gap: 14px;
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 10px;
      padding: 14px 18px;
      transition: all 0.2s ease;
      box-shadow: var(--shadow-sm);
    }
    .paso-secuencia-item:hover {
      border-color: var(--theme-primary);
      box-shadow: var(--shadow-md);
    }
    .paso-num-circle {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      background: var(--theme-primary);
      color: #ffffff;
      font-size: 12px;
      font-weight: 800;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      margin-top: 1px;
      box-shadow: 0 2px 4px var(--theme-primary-shadow);
    }
    .paso-content {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .paso-titulo {
      font-size: 13.5px;
      font-weight: 700;
      color: var(--theme-text);
      line-height: 1.35;
    }
    .paso-detalle {
      font-size: 13px;
      color: var(--theme-text-muted);
      line-height: 1.5;
    }
    .paso-criterio {
      font-size: 12px;
      color: var(--theme-accent);
      background: var(--theme-accent-bg);
      border-left: 3px solid var(--theme-accent);
      padding: 4px 8px;
      border-radius: 4px;
      margin-top: 4px;
    }
    .paso-criterio-label {
      font-weight: 700;
    }
    .bitacora-spinner {
      width: 36px;
      height: 36px;
      border: 3px solid rgba(2, 132, 199, 0.2);
      border-top-color: var(--theme-primary);
      border-radius: 50%;
      animation: bitacora-spin 0.8s linear infinite;
    }
    /* ==========================================================================
       GESTIÓN DE USUARIOS Y PERMISOS (PANEL ROOT SAAS)
       ========================================================================== */
    .admin-kpi-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
      gap: 14px;
      margin-bottom: 22px;
    }
    .admin-kpi-card {
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 12px;
      padding: 16px 18px;
      display: flex;
      flex-direction: column;
      gap: 6px;
      transition: all 0.2s ease;
    }
    .admin-kpi-card:hover {
      border-color: var(--theme-primary);
      box-shadow: 0 4px 16px var(--theme-primary-shadow);
    }
    .admin-kpi-label {
      font-size: 11.5px;
      font-weight: 700;
      color: var(--theme-text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .admin-kpi-value {
      font-size: 24px;
      font-weight: 800;
      color: var(--theme-text);
      line-height: 1.15;
      letter-spacing: -0.02em;
    }
    .admin-kpi-sub {
      font-size: 12px;
      color: var(--theme-text-muted);
    }

    .admin-toolbar-wrap {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 14px;
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 12px;
      padding: 14px 18px;
      margin-bottom: 18px;
    }
    .admin-toolbar-left {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      flex: 1;
      min-width: 260px;
    }
    .admin-search-box {
      position: relative;
      flex: 1;
      max-width: 380px;
      min-width: 220px;
    }
    .admin-search-box svg {
      position: absolute;
      left: 12px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--theme-text-muted);
      pointer-events: none;
    }
    .admin-search-input {
      width: 100%;
      padding: 9px 14px 9px 36px;
      font-size: 13px;
      border: 1px solid var(--theme-border);
      border-radius: 8px;
      background: var(--theme-pill-bg);
      color: var(--theme-text);
      outline: none;
      transition: all 0.15s ease;
    }
    .admin-search-input:focus {
      border-color: var(--theme-primary);
      background: var(--theme-card);
      box-shadow: 0 0 0 3px var(--theme-primary-shadow);
    }
    .admin-filters-group {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }
    .admin-filter-pill {
      background: var(--theme-pill-bg);
      border: 1px solid var(--theme-border);
      color: var(--theme-text-muted);
      font-size: 12px;
      font-weight: 600;
      padding: 6px 12px;
      border-radius: 20px;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .admin-filter-pill:hover {
      color: var(--theme-text);
      border-color: var(--theme-primary);
    }
    .admin-filter-pill.active {
      background: var(--theme-primary);
      color: #ffffff;
      border-color: var(--theme-primary);
    }

    .admin-table-container {
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 14px;
      overflow-x: auto;
      box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    }
    .admin-users-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 13px;
      text-align: left;
    }
    .admin-users-table th {
      padding: 10px 14px;
      background: var(--theme-pill-bg);
      border-bottom: 1px solid var(--theme-border);
      color: var(--theme-text-muted);
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      white-space: nowrap;
    }
    .admin-users-table td {
      padding: 12px 14px;
      border-bottom: 1px solid var(--theme-border-subtle);
      vertical-align: middle;
      color: var(--theme-text);
    }
    .admin-users-table tr:hover td {
      background: var(--theme-active-item-bg);
    }
    .admin-users-table tr:last-child td {
      border-bottom: none;
    }

    .admin-user-cell {
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 200px;
    }
    .admin-user-avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      object-fit: cover;
      border: 1px solid var(--theme-border);
      flex-shrink: 0;
    }
    .admin-user-avatar-initials {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: linear-gradient(135deg, #0284c7, #2563eb);
      color: #ffffff;
      font-weight: 700;
      font-size: 13px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .admin-user-names {
      display: flex;
      flex-direction: column;
      gap: 1px;
    }
    .admin-name {
      font-weight: 700;
      color: var(--theme-text);
      font-size: 13.5px;
      line-height: 1.25;
    }
    .admin-email {
      font-size: 12px;
      color: var(--theme-text-muted);
      line-height: 1.2;
    }

    .auth-pill {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: 10.5px;
      font-weight: 600;
      padding: 2px 7px;
      border-radius: 4px;
      background: var(--theme-pill-bg);
      border: 1px solid var(--theme-border);
      color: var(--theme-text-muted);
    }
    .auth-pill.google {
      background: rgba(66, 133, 244, 0.08);
      border-color: rgba(66, 133, 244, 0.25);
      color: #1a73e8;
    }

    .badge-role {
      display: inline-block;
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.3px;
    }
    .badge-role.role-root {
      background: linear-gradient(135deg, #7c3aed, #9333ea);
      color: #ffffff;
      box-shadow: 0 2px 6px rgba(124, 58, 237, 0.25);
    }
    .badge-role.role-admin {
      background: rgba(37, 99, 235, 0.12);
      border: 1px solid rgba(37, 99, 235, 0.25);
      color: #2563eb;
    }
    .badge-role.role-user {
      background: var(--theme-pill-bg);
      border: 1px solid var(--theme-border);
      color: var(--theme-text-muted);
    }

    .license-code-preview {
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-size: 11.5px;
      background: var(--theme-pill-bg);
      border: 1px solid var(--theme-border);
      padding: 2px 6px;
      border-radius: 4px;
      color: var(--theme-primary);
      cursor: pointer;
      user-select: all;
    }
    .license-code-preview:hover {
      border-color: var(--theme-primary);
      text-decoration: underline;
    }

    .badge-status {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      font-size: 11px;
      font-weight: 700;
      padding: 2px 8px;
      border-radius: 12px;
    }
    .badge-status.status-active {
      background: rgba(16, 185, 129, 0.12);
      border: 1px solid rgba(16, 185, 129, 0.25);
      color: #059669;
    }
    .badge-status.status-expired {
      background: rgba(239, 68, 68, 0.12);
      border: 1px solid rgba(239, 68, 68, 0.25);
      color: #dc2626;
    }
    .badge-status.status-suspended {
      background: rgba(245, 158, 11, 0.12);
      border: 1px solid rgba(245, 158, 11, 0.25);
      color: #d97706;
    }
    .status-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: currentColor;
    }

    .days-pill {
      font-size: 10.5px;
      font-weight: 600;
      padding: 2px 7px;
      border-radius: 10px;
    }
    .days-pill.green { background: rgba(16, 185, 129, 0.12); color: #059669; }
    .days-pill.orange { background: rgba(245, 158, 11, 0.12); color: #d97706; }
    .days-pill.red { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
    .days-pill.purple { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }

    .module-pills-wrap {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      max-width: 250px;
    }
    .module-chip {
      font-size: 10.5px;
      font-weight: 600;
      padding: 2px 7px;
      border-radius: 4px;
      white-space: nowrap;
    }
    .module-chip.mod-tesis { background: rgba(37, 99, 235, 0.1); color: #2563eb; border: 1px solid rgba(37, 99, 235, 0.2); }
    .module-chip.mod-articulo { background: rgba(14, 165, 233, 0.1); color: #0284c7; border: 1px solid rgba(14, 165, 233, 0.2); }
    .module-chip.mod-revision { background: rgba(168, 85, 247, 0.1); color: #9333ea; border: 1px solid rgba(168, 85, 247, 0.2); }
    .module-chip.mod-suficiencia { background: rgba(245, 158, 11, 0.1); color: #d97706; border: 1px solid rgba(245, 158, 11, 0.2); }
    .module-chip.mod-informe { background: rgba(16, 185, 129, 0.1); color: #059669; border: 1px solid rgba(16, 185, 129, 0.2); }
    .module-chip.mod-generic { background: var(--theme-pill-bg); color: var(--theme-text-muted); border: 1px solid var(--theme-border); }

    .conn-icon {
      width: 20px;
      height: 20px;
      border-radius: 4px;
      font-size: 10px;
      font-weight: 800;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: var(--theme-pill-bg);
      border: 1px solid var(--theme-border);
      color: var(--theme-text-muted);
    }
    .conn-icon.connected {
      background: rgba(16, 185, 129, 0.12);
      border-color: rgba(16, 185, 129, 0.3);
      color: #059669;
    }

    .admin-row-actions {
      display: flex;
      align-items: center;
      gap: 5px;
      white-space: nowrap;
    }
    .btn-micro {
      padding: 4px 8px;
      font-size: 11.5px;
      font-weight: 600;
      border-radius: 6px;
      border: 1px solid var(--theme-border);
      background: var(--theme-card);
      color: var(--theme-text);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      transition: all 0.15s ease;
    }
    .btn-micro:hover {
      border-color: var(--theme-primary);
      background: var(--theme-active-item-bg);
    }
    .btn-micro.primary {
      background: var(--theme-primary);
      color: #ffffff;
      border-color: var(--theme-primary);
    }
    .btn-micro.primary:hover {
      background: var(--theme-primary-hover);
    }
    .btn-micro.warning {
      color: #d97706;
      border-color: rgba(245, 158, 11, 0.3);
      background: rgba(245, 158, 11, 0.08);
    }
    .btn-micro.warning:hover {
      background: rgba(245, 158, 11, 0.16);
    }
    .btn-micro.success {
      color: #059669;
      border-color: rgba(16, 185, 129, 0.3);
      background: rgba(16, 185, 129, 0.08);
    }
    .btn-micro.success:hover {
      background: rgba(16, 185, 129, 0.16);
    }
    .btn-micro.danger {
      color: #dc2626;
      border-color: rgba(239, 68, 68, 0.25);
      background: rgba(239, 68, 68, 0.06);
    }
    .btn-micro.danger:hover {
      background: rgba(239, 68, 68, 0.14);
    }

    /* Modales de Gestión de Usuarios */
    .admin-modal-backdrop {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(15, 23, 42, 0.7);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      z-index: 10005;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 18px;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s ease;
    }
    .admin-modal-backdrop.active {
      opacity: 1;
      pointer-events: auto;
    }
    .admin-modal-dialog {
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 16px;
      width: 100%;
      max-width: 620px;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
      overflow: hidden;
      transform: scale(0.96) translateY(10px);
      transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .admin-modal-backdrop.active .admin-modal-dialog {
      transform: scale(1) translateY(0);
    }
    .admin-modal-header {
      padding: 16px 22px;
      background: var(--theme-pill-bg);
      border-bottom: 1px solid var(--theme-border-subtle);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .admin-modal-body {
      padding: 22px;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 16px;
    }
    .admin-modal-footer {
      padding: 14px 22px;
      background: var(--theme-pill-bg);
      border-top: 1px solid var(--theme-border-subtle);
      display: flex;
      justify-content: flex-end;
      gap: 10px;
    }
    .admin-form-group {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .admin-form-group label {
      font-size: 12px;
      font-weight: 700;
      color: var(--theme-text-muted);
      text-transform: uppercase;
      letter-spacing: 0.4px;
    }
    .admin-form-group input,
    .admin-form-group select {
      padding: 9px 12px;
      border: 1px solid var(--theme-border);
      border-radius: 8px;
      background: var(--theme-card);
      color: var(--theme-text);
      font-size: 13.5px;
      outline: none;
      transition: border 0.15s ease;
    }
    .admin-form-group input:focus,
    .admin-form-group select:focus {
      border-color: var(--theme-primary);
      box-shadow: 0 0 0 3px var(--theme-primary-shadow);
    }
    .admin-modules-checklist {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
      background: var(--theme-pill-bg);
      border: 1px solid var(--theme-border-subtle);
      padding: 12px;
      border-radius: 10px;
    }
    .admin-module-item {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      padding: 8px 10px;
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .admin-module-item:hover {
      border-color: var(--theme-primary);
    }
    .admin-module-item input[type="checkbox"] {
      margin-top: 2px;
      accent-color: var(--theme-primary);
      width: 16px;
      height: 16px;
      cursor: pointer;
    }
    .admin-module-info {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .admin-module-title {
      font-size: 13px;
      font-weight: 700;
      color: var(--theme-text);
    }
    .admin-module-desc {
      font-size: 11.5px;
      color: var(--theme-text-muted);
      line-height: 1.35;
    }

    /* ==========================================================================
       EXPEDIENTE DOCUMENTARIO POR PESTAÑAS (MODULAR & MOBILE-FIRST)
       ========================================================================== */
    .expediente-container {
      width: 100%;
    }

    .expediente-nav-tabs {
      display: flex;
      gap: 6px;
      padding: 6px;
      background: var(--theme-pill-bg, rgba(0, 0, 0, 0.03));
      border: 1px solid var(--theme-border);
      border-radius: 12px;
      margin-bottom: 20px;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    .expediente-nav-tabs::-webkit-scrollbar {
      display: none;
    }

    .expediente-tab-btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 9px 16px;
      border-radius: 8px;
      border: 1px solid transparent;
      background: transparent;
      color: var(--theme-text-muted);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
      white-space: nowrap;
      flex-shrink: 0;
      user-select: none;
    }
    .expediente-tab-btn:hover {
      color: var(--theme-text);
      background: rgba(255, 255, 255, 0.04);
    }
    .expediente-tab-btn.active {
      background: var(--theme-card);
      color: var(--theme-primary, #0284c7);
      border-color: var(--theme-border);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
      font-weight: 700;
    }

    .expediente-tab-badge {
      display: inline-flex;
      align-items: center;
      padding: 2px 8px;
      border-radius: 999px;
      font-size: 11px;
      font-weight: 700;
      background: var(--theme-pill-bg, rgba(0, 0, 0, 0.05));
      border: 1px solid var(--theme-border);
      color: var(--theme-text-muted);
    }
    .expediente-tab-btn.active .expediente-tab-badge {
      background: rgba(2, 132, 199, 0.1);
      border-color: rgba(2, 132, 199, 0.25);
      color: var(--theme-primary, #0284c7);
    }

    .expediente-panel {
      display: none;
    }
    .expediente-panel.active {
      display: block;
      animation: expFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }
    @keyframes expFadeIn {
      from { opacity: 0; transform: translateY(4px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .exp-panel-header {
      margin-bottom: 16px;
    }
    .exp-panel-title {
      font-size: 15px;
      font-weight: 700;
      color: var(--theme-text);
      margin: 0 0 4px 0;
    }
    .exp-panel-desc {
      font-size: 12.5px;
      color: var(--theme-text-muted);
      margin: 0;
      line-height: 1.45;
    }

    .exp-slot-card {
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      border-radius: 12px;
      padding: 20px 22px;
      margin-bottom: 16px;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }
    .exp-slot-card:hover {
      border-color: rgba(2, 132, 199, 0.35);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    }

    .exp-slot-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
      margin-bottom: 14px;
    }
    .exp-slot-title-wrap {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .exp-slot-icon-box {
      width: 36px;
      height: 36px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(2, 132, 199, 0.08);
      color: var(--theme-primary, #0284c7);
      flex-shrink: 0;
    }
    .exp-slot-icon-box.purple {
      background: rgba(139, 92, 246, 0.08);
      color: #8b5cf6;
    }
    .exp-slot-icon-box.green {
      background: rgba(16, 185, 129, 0.08);
      color: #10b981;
    }
    .exp-slot-icon-box.amber {
      background: rgba(245, 158, 11, 0.08);
      color: #f59e0b;
    }

    .exp-slot-title {
      font-size: 14.5px;
      font-weight: 700;
      color: var(--theme-text);
      margin: 0;
    }

    .exp-slot-body {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 16px;
      padding: 14px 16px;
      background: var(--theme-bg, #f8fafc);
      border: 1px solid var(--theme-border);
      border-radius: 10px;
    }

    .exp-slot-file-info {
      display: flex;
      align-items: center;
      gap: 12px;
      overflow: hidden;
      min-width: 0;
    }
    .exp-slot-file-icon {
      width: 38px;
      height: 38px;
      border-radius: 8px;
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--theme-text);
      flex-shrink: 0;
    }
    .exp-slot-file-texts {
      overflow: hidden;
      min-width: 0;
    }
    .exp-slot-filename {
      font-size: 13.5px;
      font-weight: 700;
      color: var(--theme-text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .exp-slot-meta {
      font-size: 12px;
      color: var(--theme-text-muted);
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 3px;
      flex-wrap: wrap;
    }

    .exp-slot-actions {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .exp-slot-empty {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 24px 20px;
      background: var(--theme-bg, #f8fafc);
      border: 1px dashed var(--theme-border);
      border-radius: 10px;
      text-align: center;
      transition: all 0.2s ease;
    }
    .exp-slot-empty:hover {
      border-color: var(--theme-primary, #0284c7);
      background: rgba(2, 132, 199, 0.02);
    }
    .exp-slot-empty-icon {
      width: 44px;
      height: 44px;
      border-radius: 10px;
      background: var(--theme-card);
      border: 1px solid var(--theme-border);
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--theme-text-muted);
      margin-bottom: 10px;
    }
    .exp-slot-empty-title {
      font-size: 13.5px;
      font-weight: 600;
      color: var(--theme-text);
      margin-bottom: 4px;
    }
    .exp-slot-empty-desc {
      font-size: 12px;
      color: var(--theme-text-muted);
      margin-bottom: 14px;
      max-width: 380px;
    }

    .exp-history-card {
      margin-top: 14px;
      background: var(--theme-bg, #f8fafc);
      border: 1px solid var(--theme-border);
      border-radius: 10px;
      overflow: hidden;
    }
    .exp-history-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 14px;
      background: var(--theme-card);
      border-bottom: 1px solid var(--theme-border);
      font-size: 12.5px;
      font-weight: 700;
      color: var(--theme-text);
      cursor: pointer;
    }
    .exp-history-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 14px;
      border-bottom: 1px solid var(--theme-border);
      font-size: 12px;
      gap: 12px;
      flex-wrap: wrap;
    }
    .exp-history-row:last-child {
      border-bottom: none;
    }

    @media (max-width: 640px) {
      .expediente-nav-tabs {
        padding: 4px;
        gap: 4px;
        border-radius: 10px;
      }
      .expediente-tab-btn {
        padding: 8px 12px;
        font-size: 12px;
        gap: 6px;
      }
      .exp-slot-card {
        padding: 16px 14px;
      }
      .exp-slot-body {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
      }
      .exp-slot-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
        gap: 6px;
      }
      .exp-slot-actions .btn-canva-act {
        width: 100%;
        justify-content: center;
        padding: 10px 8px;
        min-height: 42px;
        font-size: 12px;
      }
    }

    /* ==========================================================================
       BIBLIOTECA CIENTÍFICA: SUB-PESTAÑAS ERGONÓMICAS (FASE 2)
       ========================================================================== */
    .biblioteca-container {
      width: 100%;
    }

    .biblioteca-nav-tabs {
      display: flex;
      gap: 6px;
      padding: 6px;
      background: var(--theme-pill-bg, rgba(0, 0, 0, 0.03));
      border: 1px solid var(--theme-border);
      border-radius: 12px;
      margin-bottom: 20px;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    .biblioteca-nav-tabs::-webkit-scrollbar {
      display: none;
    }

    .biblioteca-tab-btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 9px 16px;
      border-radius: 8px;
      border: 1px solid transparent;
      background: transparent;
      color: var(--theme-text-muted);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
      white-space: nowrap;
      flex-shrink: 0;
      user-select: none;
    }
    .biblioteca-tab-btn:hover {
      color: var(--theme-text);
      background: rgba(255, 255, 255, 0.04);
    }
    .biblioteca-tab-btn.active {
      background: var(--theme-card);
      color: var(--theme-primary, #0284c7);
      border-color: var(--theme-border);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
      font-weight: 700;
    }

    .biblioteca-tab-badge {
      display: inline-flex;
      align-items: center;
      padding: 2px 8px;
      border-radius: 999px;
      font-size: 11px;
      font-weight: 700;
      background: var(--theme-pill-bg, rgba(0, 0, 0, 0.05));
      border: 1px solid var(--theme-border);
      color: var(--theme-text-muted);
      transition: all 0.2s ease;
    }
    .biblioteca-tab-btn.active .biblioteca-tab-badge {
      background: rgba(2, 132, 199, 0.1);
      border-color: rgba(2, 132, 199, 0.25);
      color: var(--theme-primary, #0284c7);
    }

    .biblioteca-panel {
      display: none;
    }
    .biblioteca-panel.active {
      display: block;
      animation: biblioFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }
    @keyframes biblioFadeIn {
      from { opacity: 0; transform: translateY(4px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .biblio-panel-header {
      margin-bottom: 16px;
    }
    .biblio-panel-title {
      font-size: 15px;
      font-weight: 700;
      color: var(--theme-text);
      margin: 0 0 4px 0;
    }
    .biblio-panel-desc {
      font-size: 12.5px;
      color: var(--theme-text-muted);
      margin: 0;
    }

    @media (max-width: 640px) {
      .biblioteca-nav-tabs {
        padding: 4px;
        gap: 4px;
        border-radius: 10px;
      }
      .biblioteca-tab-btn {
        padding: 8px 12px;
        font-size: 12px;
        gap: 6px;
      }
    }
