/* Shared styles for index.html (Basic training), onboarding.html (Onboarding) and troubleshooting.html (Troubleshooting training). */

  /* ── Reset & Base ── */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; }
  body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0F1B2D;
    color: #E8EDF3;
    font-size: 14px;
    line-height: 1.6;
  }

  /* ── CSS Variables ── */
  :root {
    --navy-deep:   #0F1B2D;
    --navy-mid:    #162338;
    --navy-light:  #1E3A5F;
    --bp-blue:     #00A8E8;
    --bp-blue-dim: #007db3;
    --accent-teal: #00D4C8;
    --surface:     #F8FAFC;
    --surface-2:   #EEF2F7;
    --text-dark:   #1A2332;
    --text-muted:  #5A6A7E;
    --border:      #D1DCE8;
    --success:     #10B981;
    --sidebar-w:   260px;
    --header-h:    64px;
  }

  /* ══════════════════════════════
     LOGIN PAGE
  ══════════════════════════════ */
  #login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy-deep);
    background-image:
      radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0,168,232,0.18) 0%, transparent 60%),
      repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(255,255,255,0.03) 39px, rgba(255,255,255,0.03) 40px),
      repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(255,255,255,0.03) 39px, rgba(255,255,255,0.03) 40px);
    position: relative;
    overflow: hidden;
  }
  #screen-deactivated {
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background: var(--navy-deep);
    background-image:
      radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0,168,232,0.18) 0%, transparent 60%),
      repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(255,255,255,0.03) 39px, rgba(255,255,255,0.03) 40px),
      repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(255,255,255,0.03) 39px, rgba(255,255,255,0.03) 40px);
    position: relative;
    overflow: hidden;
  }
  #login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,168,232,0.08) 0%, transparent 70%);
    top: -200px; left: -200px;
    pointer-events: none;
  }
  #login-page::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,212,200,0.06) 0%, transparent 70%);
    bottom: -100px; right: -100px;
    pointer-events: none;
  }

  .login-card {
    background: rgba(22, 35, 56, 0.92);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0,168,232,0.2);
    border-radius: 16px;
    padding: 48px 44px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04) inset;
  }
  .login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
  }
  .login-logo img {
    height: 32px;
    filter: brightness(0) invert(1);
    opacity: 0.95;
  }
  .login-logo .portal-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bp-blue);
  }
  .login-title {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    margin-bottom: 6px;
  }
  .login-subtitle {
    font-size: 13px;
    color: rgba(255,255,255,0.45);
    text-align: center;
    margin-bottom: 32px;
  }
  .form-group {
    margin-bottom: 18px;
  }
  .form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
    margin-bottom: 8px;
  }
  .form-group input {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 14px;
    color: #fff;
    font-family: inherit;
    transition: border-color 0.2s, background 0.2s;
    outline: none;
  }
  .form-group input::placeholder { color: rgba(255,255,255,0.25); }
  .form-group input:focus {
    border-color: var(--bp-blue);
    background: rgba(0,168,232,0.07);
  }
  .login-error {
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.4);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #fca5a5;
    margin-bottom: 16px;
    display: none;
  }
  .btn-login {
    width: 100%;
    background: linear-gradient(135deg, var(--bp-blue) 0%, #0090c8 100%);
    border: none;
    border-radius: 8px;
    padding: 13px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s, transform 0.15s;
    letter-spacing: 0.02em;
    margin-top: 8px;
  }
  .btn-login:hover { opacity: 0.9; transform: translateY(-1px); }
  .btn-login:active { transform: translateY(0); }
  .demo-hint {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: rgba(255,255,255,0.3);
  }
  .demo-hint code {
    background: rgba(255,255,255,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: rgba(255,255,255,0.5);
    font-size: 11px;
  }

  /* ══════════════════════════════
     PORTAL APP
  ══════════════════════════════ */
  #portal-app { display: none; height: 100vh; flex-direction: column; }

  /* ── Header ── */
  .header {
    height: var(--header-h);
    background: var(--navy-deep);
    border-bottom: 1px solid rgba(0,168,232,0.18);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 24px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
  }
  .header-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .header-logo img {
    height: 28px;
    filter: brightness(0) invert(1);
    opacity: 0.95;
  }
  .header-logo .divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.15);
    margin: 0 4px;
  }
  .header-logo .portal-name {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    transition: color 0.15s;
  }
  #header-logo-home-link:hover .portal-name {
    color: var(--bp-blue);
  }
  .header-nav {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }
  .nav-tab {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .nav-tab .tab-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
  }
  .nav-tab:hover {
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.1);
  }
  .nav-tab.active {
    color: #fff;
    background: rgba(0,168,232,0.15);
    border-color: var(--bp-blue);
  }
  .nav-tab.active .tab-num {
    background: var(--bp-blue);
  }
  .nav-tab.completed .tab-num {
    background: var(--success);
  }
  .header-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 5px 10px 5px 7px;
    cursor: pointer;
  }
  .user-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bp-blue), var(--accent-teal));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
  }
  .user-name { font-size: 12px; font-weight: 500; color: rgba(255,255,255,0.8); }
  .btn-logout {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 7px;
    padding: 6px 12px;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
  }
  .btn-logout:hover {
    border-color: rgba(239,68,68,0.5);
    color: #fca5a5;
    background: rgba(239,68,68,0.07);
  }

  /* ── Main Layout ── */
  .portal-body {
    flex: 1;
    display: flex;
    margin-top: var(--header-h);
    height: calc(100vh - var(--header-h));
    background: var(--surface);
  }

  /* ══════════════════════════════
     CLASS TENANT ALLOCATION (separate full-page section, students only —
     same pattern as #users-page for admins)
  ══════════════════════════════ */
  #class-tenant-page { display: none; flex-direction: column; background: var(--surface); overflow: hidden; height: 100vh; }
  #evaluation-page { display: none; flex-direction: column; background: var(--surface); overflow: hidden; height: 100vh; }
  #cert-explain-page { display: none; flex-direction: column; background: var(--surface); overflow: hidden; height: 100vh; }

  /* ══════════════════════════════
     WELCOME SCREEN
  ══════════════════════════════ */
  #screen-welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #F0F6FF 0%, var(--surface) 60%);
    padding: 40px;
  }
  .welcome-inner {
    max-width: 680px;
    text-align: center;
  }
  .welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(0,168,232,0.1);
    border: 1px solid rgba(0,168,232,0.25);
    border-radius: 100px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--bp-blue-dim);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 28px;
  }
  .welcome-badge .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--bp-blue);
    animation: pulse 2s ease-in-out infinite;
  }
  @keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
  }
  .welcome-title {
    font-size: 38px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
    margin-bottom: 18px;
    letter-spacing: -0.02em;
  }
  .welcome-title span { color: var(--bp-blue); }
  .welcome-desc {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 40px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
  }
  .welcome-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 44px;
  }
  .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }
  .stat-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1;
  }
  .stat-num span { color: var(--bp-blue); }
  .stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
  .stat-divider { width: 1px; background: var(--border); align-self: stretch; }
  .btn-start {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--bp-blue) 0%, #0090c8 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 15px 36px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    box-shadow: 0 6px 24px rgba(0,168,232,0.35);
  }
  .btn-start:hover { transform: translateY(-2px); box-shadow: 0 10px 32px rgba(0,168,232,0.4); }
  .btn-start .arrow { font-size: 18px; transition: transform 0.2s; }
  .btn-start:hover .arrow { transform: translateX(3px); }

  /* ══════════════════════════════
     DAY LAYOUT
  ══════════════════════════════ */
  .day-layout {
    display: none;
    flex: 1;
    overflow: hidden;
  }
  .day-layout.active-day { display: flex; }

  /* ── Sidebar ── */
  .day-sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--navy-deep);
    border-right: 1px solid rgba(0,168,232,0.12);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  .sidebar-day-header {
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .sidebar-day-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bp-blue);
    margin-bottom: 4px;
  }
  .sidebar-day-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
  }
  .sidebar-day-subtitle {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    margin-top: 2px;
  }
  .sidebar-progress {
    margin-top: 12px;
    height: 3px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
  }
  .sidebar-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--bp-blue), var(--accent-teal));
    border-radius: 2px;
    transition: width 0.4s ease;
  }
  .sidebar-sections { padding: 10px 0; flex: 1; }
  .sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
    padding: 12px 18px 6px;
  }
  .sidebar-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 18px 11px 14px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    position: relative;
  }
  .sidebar-item:hover {
    background: rgba(255,255,255,0.04);
    border-left-color: rgba(0,168,232,0.3);
  }
  .sidebar-item.active {
    background: rgba(0,168,232,0.1);
    border-left-color: var(--bp-blue);
  }
  .sidebar-item-num {
    flex-shrink: 0;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    margin-top: 1px;
    transition: all 0.2s;
  }
  .sidebar-item.active .sidebar-item-num {
    background: var(--bp-blue);
    color: #fff;
  }
  .sidebar-item-text {
    font-size: 13px;
    line-height: 1.4;
    color: rgba(255,255,255,0.55);
    transition: color 0.2s;
  }
  .sidebar-item.active .sidebar-item-text { color: rgba(255,255,255,0.92); }
  .sidebar-item:hover .sidebar-item-text { color: rgba(255,255,255,0.75); }

  /* Drag-and-drop subsection reordering (admin only) — see
     initSubsectionDragDrop(). Dragged item is dimmed in place; a thin
     teal line shows exactly where it will land, above or below whichever
     sibling the cursor is currently over. */
  .sidebar-item[draggable="true"] { cursor: grab; }
  .sidebar-item.dragging { opacity: 0.35; }
  .sidebar-item.drag-over-top { box-shadow: inset 0 2px 0 0 var(--accent-teal); }
  .sidebar-item.drag-over-bottom { box-shadow: inset 0 -2px 0 0 var(--accent-teal); }
  .tree-subsections.drag-over-empty { box-shadow: inset 0 0 0 1px var(--accent-teal); border-radius: 4px; }

  /* ── Day Content ── */
  .day-content {
    flex: 1;
    overflow-y: auto;
    background: var(--surface);
  }
  .day-content-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 32px 60px;
  }

  /* Progress tracker */
  .day-progress-bar {
    height: 3px;
    background: var(--surface-2);
    border-radius: 0;
    overflow: hidden;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .day-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--bp-blue), var(--accent-teal));
    width: 0%;
    transition: width 0.5s ease;
  }

  /* Section header */
  .section-header {
    margin-bottom: 24px;
  }
  .section-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bp-blue);
    margin-bottom: 6px;
  }
  .section-eyebrow .line {
    height: 1px;
    flex: 1;
    background: rgba(0,168,232,0.2);
  }
  .section-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.01em;
    margin-bottom: 6px;
  }
  .section-subtitle {
    font-size: 13px;
    color: var(--text-muted);
  }

  /* Video card */
  .card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  }
  .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: #FAFCFF;
  }
  .card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 7px;
  }
  .card-icon {
    width: 26px; height: 26px;
    border-radius: 6px;
    background: rgba(0,168,232,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
  }
  .card-tag {
    font-size: 11px;
    background: rgba(0,168,232,0.1);
    color: var(--bp-blue-dim);
    border-radius: 4px;
    padding: 2px 8px;
    font-weight: 600;
  }
  .card-body { padding: 18px; }

  /* Video */
  .video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
  }
  .video-wrapper iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
  }
  .video-wrapper video {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
    background: #000;
  }

  .video-wrapper.video-wrapper--link {
    padding-bottom: 0;
    height: auto;
  }
  /* Video link fallback (for embed-disabled videos) */
  .video-link-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #0a0a0a;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
  }
  .video-link-card img {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0.75;
    transition: opacity 0.2s;
  }
  .video-link-card:hover img { opacity: 0.55; }
  .video-play-btn {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .video-play-circle {
    width: 68px; height: 68px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  }
  .video-link-card:hover .video-play-circle {
    transform: scale(1.08);
    background: #fff;
  }
  .video-play-circle svg { margin-left: 4px; }
  .video-play-label {
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 100px;
    letter-spacing: 0.04em;
    backdrop-filter: blur(4px);
  }

  /* Chat widget area */
  .chat-area {
    min-height: 80px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 4px;
  }
  .chat-info {
    flex: 1;
  }
  .chat-info h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
  }
  .chat-info p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
  }
  .chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--success);
    margin-top: 6px;
  }
  .chat-status .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
  }

  /* Practical Tasks */
  .self-study-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
  }
  .self-study-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, #D97706, #F59E0B);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
  }
  .self-study-title-group h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
  }
  .self-study-title-group p {
    font-size: 12px;
    color: var(--text-muted);
  }
  .study-intro {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 18px;
    padding: 12px 14px;
    background: var(--surface-2);
    border-radius: 8px;
    border-left: 3px solid #F59E0B;
  }
  .checklist { list-style: none; }
  .checklist li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-dark);
    cursor: pointer;
    transition: color 0.15s;
  }
  .checklist li:last-child { border-bottom: none; }
  .checklist li:hover { color: var(--bp-blue-dim); }
  .check-box {
    width: 18px; height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
  }
  .checklist li.checked .check-box {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
    font-size: 10px;
  }
  .checklist li.checked span { text-decoration: line-through; color: var(--text-muted); }

  /* Hidden section content */
  .section-content { display: none; }
  .section-content.active { display: block; }


  /* Chat UI */
  .chat-area { flex-direction: column; align-items: stretch; min-height: auto; padding: 0; gap: 0; }
  .chat-messages {
    background: #F4F8FC;
    border: 1px solid var(--border);
    border-radius: 10px 10px 0 0;
    padding: 14px 14px 10px;
    min-height: 180px;
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .chat-messages::-webkit-scrollbar { width: 4px; }
  .chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
  .chat-msg {
    display: flex;
    gap: 8px;
    align-items: flex-start;
  }
  .chat-msg.user { flex-direction: row-reverse; }
  .chat-msg-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff;
  }
  .chat-msg.bot .chat-msg-avatar { background: linear-gradient(135deg, var(--bp-blue), var(--accent-teal)); }
  .chat-msg.user .chat-msg-avatar { background: linear-gradient(135deg, #D97706, #F59E0B); }
  .chat-msg > div:not(.chat-msg-avatar) { min-width: 0; max-width: 85%; }
  .chat-msg-bubble {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow: hidden;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
  }
  .chat-msg.bot .chat-msg-bubble {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text-dark);
    border-top-left-radius: 4px;
  }
  .chat-msg.user .chat-msg-bubble {
    background: var(--bp-blue);
    color: #fff;
    border-top-right-radius: 4px;
  }
  .chat-msg-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 3px;
    opacity: 0.7;
  }
  .chat-msg.user .chat-msg-time { text-align: right; }
  /* Rich (HTML/Markdown) content in bot answers: keep list markers, headings,
     code and tables inside the bubble instead of overflowing its edges. */
  .chat-msg-bubble ul, .chat-msg-bubble ol { margin: 6px 0; padding-left: 1.4em; list-style-position: outside; }
  .chat-msg-bubble ul { list-style-type: disc; }
  .chat-msg-bubble ol { list-style-type: decimal; }
  .chat-msg-bubble li { margin: 2px 0; }
  .chat-msg-bubble p { margin: 4px 0; }
  .chat-msg-bubble h1, .chat-msg-bubble h2, .chat-msg-bubble h3,
  .chat-msg-bubble h4, .chat-msg-bubble h5, .chat-msg-bubble h6 { font-size: 14px; margin: 6px 0 4px; line-height: 1.35; }
  .chat-msg-bubble > :first-child { margin-top: 0; }
  .chat-msg-bubble > :last-child { margin-bottom: 0; }
  .chat-msg-bubble pre { max-width: 100%; overflow-x: auto; white-space: pre-wrap; background: #F4F8FC; padding: 8px; border-radius: 6px; font-size: 12px; }
  .chat-msg-bubble table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
  .chat-msg-bubble td, .chat-msg-bubble th { border: 1px solid var(--border); padding: 4px 6px; }
  .chat-msg-bubble a { color: var(--bp-blue-dim); word-break: break-all; }
  .chat-msg-bubble img { max-width: 100%; height: auto; }
  .chat-typing {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
  }
  .chat-typing span {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--bp-blue);
    animation: typing-bounce 1.2s infinite;
  }
  .chat-typing span:nth-child(2) { animation-delay: 0.2s; }
  .chat-typing span:nth-child(3) { animation-delay: 0.4s; }
  @keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
  }
  .chat-input-row {
    display: flex;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    background: #fff;
  }
  .chat-input-row input {
    flex: 1;
    border: none;
    outline: none;
    padding: 11px 14px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-dark);
    background: transparent;
  }
  .chat-input-row input::placeholder { color: var(--text-muted); }
  .chat-send-btn {
    flex-shrink: 0;
    background: var(--bp-blue);
    border: none;
    padding: 10px 18px;
    cursor: pointer;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    display: flex; align-items: center; gap: 6px;
    transition: background 0.2s;
  }
  .chat-send-btn:hover { background: var(--bp-blue-dim); }
  .chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
  .chat-footer-info {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: var(--text-muted);
    margin-top: 8px;
    padding: 0 2px;
  }
  .chat-footer-info .bpo-status { flex: 1; min-width: 0; }
  .chat-export-btn {
    flex-shrink: 0; margin-left: auto;
    background: #fff; border: 1px solid var(--border); border-radius: 6px;
    padding: 4px 10px; font-size: 11px; font-weight: 600; font-family: inherit;
    color: var(--bp-blue-dim); cursor: pointer; transition: all .15s;
  }
  .chat-export-btn:hover { border-color: var(--bp-blue); color: var(--bp-blue); }
  .chat-export-btn:disabled { opacity: .5; cursor: wait; }
  .chat-footer-info .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
  }


  /* LANG */
  .video-lang-bar{display:flex;align-items:center;gap:8px;padding:8px 12px;background:#F0F6FF;border-bottom:1px solid var(--border);}
  .video-lang-label{font-size:11px;font-weight:600;color:var(--text-muted);text-transform:uppercase;letter-spacing:.08em;}
  .lang-btn{background:transparent;border:1px solid var(--border);border-radius:6px;padding:3px 10px;font-size:12px;font-weight:500;color:var(--text-muted);cursor:pointer;font-family:inherit;transition:all .15s;}
  .lang-btn:hover{border-color:var(--bp-blue);color:var(--bp-blue);}
  .lang-flag{width:16px;height:12px;vertical-align:-1px;margin-right:5px;border-radius:2px;box-shadow:0 0 0 1px rgba(0,0,0,.08);display:inline-block;}
  .lang-btn.active{background:var(--bp-blue);border-color:var(--bp-blue);color:#fff;}
  .video-wrapper-wrap{border:1px solid var(--border);border-radius:8px;overflow:hidden;}
  .video-wrapper-wrap .video-wrapper{border-radius:0;}
  /* QUICK BTNS */
  .chat-quick-btns{display:flex;flex-wrap:wrap;gap:8px;padding:10px 0 4px;}

  /* Bright Pattern "Ask BP Oracle" live chat — docked inline, one shared session */
  .bp-oracle-wrap {
    position: relative;
    min-height: 320px;
    display: flex;
    flex-direction: column;
  }
  .quick-btn{display:inline-flex;align-items:center;gap:6px;background:#F0F6FF;border:1px solid rgba(0,168,232,.3);border-radius:100px;padding:6px 14px;font-size:12px;font-weight:500;color:var(--bp-blue-dim);cursor:pointer;font-family:inherit;transition:all .2s;}
  .quick-btn:hover{background:var(--bp-blue);color:#fff;border-color:var(--bp-blue);}
  /* DOCS */
  .docs-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(90px,1fr));gap:14px;padding:4px 0 8px;}
  .doc-item{display:flex;flex-direction:column;align-items:center;gap:6px;cursor:pointer;text-decoration:none;}
  .doc-icon-wrap{width:72px;height:72px;border-radius:12px;display:flex;align-items:center;justify-content:center;font-size:30px;border:1px solid var(--border);background:#fff;transition:all .2s;position:relative;overflow:hidden;}
  .doc-icon-wrap:hover{border-color:var(--bp-blue);box-shadow:0 4px 14px rgba(0,168,232,.18);transform:translateY(-2px);}
  .doc-icon-wrap.add-btn{border:2px dashed var(--border);background:#FAFCFF;color:var(--text-muted);font-size:26px;}
  .doc-icon-wrap.add-btn:hover{border-color:var(--bp-blue);color:var(--bp-blue);}
  .doc-ext-badge{position:absolute;bottom:4px;right:4px;font-size:9px;font-weight:700;padding:1px 5px;border-radius:3px;text-transform:uppercase;letter-spacing:.04em;}
  .doc-ext-badge.pdf{background:#fee2e2;color:#dc2626;}
  .doc-ext-badge.link{background:#dbeafe;color:#2563eb;}
  .doc-name{font-size:11px;color:var(--text-dark);text-align:center;line-height:1.3;max-width:80px;word-break:break-word;}
  .docs-links-list{margin-top:12px;border-top:1px solid var(--border);padding-top:12px;}
  .docs-links-list h5{font-size:11px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:.08em;margin-bottom:8px;}
  .link-item{display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:7px;text-decoration:none;color:var(--bp-blue-dim);font-size:13px;font-weight:500;transition:background .15s;overflow:hidden;}
  .link-item span.link-icon{flex-shrink:0;}
  .link-item .link-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  .link-item:hover{background:#F0F6FF;}
  .add-link-row{display:flex;gap:8px;margin-top:10px;flex-wrap:wrap;}
  .add-link-row input{flex:1;min-width:140px;border:1px solid var(--border);border-radius:7px;padding:7px 10px;font-size:12px;font-family:inherit;color:var(--text-dark);outline:none;}
  .add-link-row input.link-title-input{flex:0 0 36%;}
  .add-link-row input:focus{border-color:var(--bp-blue);}
  .add-link-row .btn-add-link{background:var(--bp-blue);color:#fff;border:none;border-radius:7px;padding:7px 14px;font-size:12px;font-weight:600;cursor:pointer;font-family:inherit;}
  /* SECTION NAV BUTTONS */
  .section-nav-row{display:flex;justify-content:flex-end;gap:10px;margin-top:32px;padding-top:20px;border-top:1px solid var(--border);}
  .btn-next-section{display:inline-flex;align-items:center;gap:8px;background:linear-gradient(135deg,var(--bp-blue),#0090c8);color:#fff;border:none;border-radius:9px;padding:11px 22px;font-size:14px;font-weight:600;cursor:pointer;font-family:inherit;transition:all .2s;box-shadow:0 4px 14px rgba(0,168,232,.3);}
  .btn-next-section:hover{transform:translateY(-1px);box-shadow:0 6px 20px rgba(0,168,232,.4);}
  /* TREE SIDEBAR */
  .tree-day-group{margin-bottom:2px;}
  .tree-day-toggle{display:flex;align-items:center;gap:8px;padding:10px 14px;cursor:pointer;font-size:12px;font-weight:700;color:rgba(255,255,255,.7);letter-spacing:.03em;transition:background .15s;border-left:3px solid transparent;}
  .tree-day-toggle:hover{background:rgba(255,255,255,.04);}
  .tree-day-toggle.open{color:#fff;border-left-color:rgba(0,168,232,.4);}
  .tree-arrow{font-size:9px;transition:transform .2s;opacity:.6;margin-right:2px;}
  .tree-day-toggle.open .tree-arrow{transform:rotate(90deg);}
  .tree-day-icon{width:22px;height:22px;border-radius:50%;background:rgba(255,255,255,.1);display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;flex-shrink:0;}
  .tree-day-toggle.open .tree-day-icon{background:var(--bp-blue);color:#fff;}
  .tree-sections{display:none;}
  .tree-sections.open{display:block;}

  /* ── Section groups (Day → Section → Subsection tree level) ──
     Sits between .tree-day-group and the leaf .sidebar-item (Subsection)
     rows. Visually a smaller/indented echo of .tree-day-toggle so the
     hierarchy reads clearly without a whole new color language. */
  .tree-section-group{margin-left:8px;}
  .tree-section-toggle{display:flex;align-items:center;gap:7px;padding:8px 14px 8px 20px;cursor:pointer;font-size:12px;font-weight:600;color:rgba(255,255,255,.55);transition:background .15s;border-left:2px solid transparent;}
  .tree-section-toggle:hover{background:rgba(255,255,255,.03);}
  .tree-section-toggle.open{color:rgba(255,255,255,.85);border-left-color:rgba(0,168,232,.3);}
  .tree-arrow-sm{font-size:8px;transition:transform .2s;opacity:.55;margin-right:1px;}
  .tree-section-toggle.open .tree-arrow-sm{transform:rotate(90deg);}
  .tree-section-title{flex:1;}
  .tree-subsections{display:none;}
  .tree-subsections.open{display:block;}
  .tree-subsections .sidebar-item{padding-left:34px;}
  .sidebar-item-add{display:flex;align-items:center;gap:10px;padding:9px 18px 9px 34px;cursor:pointer;font-size:12px;color:rgba(255,255,255,.35);transition:color .2s;}
  .sidebar-item-add:hover{color:rgba(255,255,255,.7);}
  .add-section-group-btn{padding-left:20px;font-size:12px;font-weight:600;}
  /* RUN REPORT */
  .btn-run-report{background:linear-gradient(135deg,#10B981,#059669);border:none;border-radius:7px;padding:7px 14px;font-size:12px;font-weight:600;color:#fff;cursor:pointer;font-family:inherit;display:flex;align-items:center;gap:6px;transition:all .2s;}
  .btn-run-report:hover{opacity:.9;transform:translateY(-1px);}
  /* REPORT PAGE */
  #report-page{display:none;flex-direction:column;background:var(--surface);overflow:hidden;height:100vh;}
  #management-page{display:none;flex-direction:column;background:var(--surface);overflow:hidden;height:100vh;}
  .report-header{background:var(--navy-deep);padding:18px 28px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid rgba(0,168,232,.15);}
  .report-header h2{font-size:16px;font-weight:700;color:#fff;}
  .report-body{flex:1;overflow-y:auto;padding:24px 28px 48px;}
  .report-filters{display:flex;align-items:center;gap:10px;margin-bottom:22px;flex-wrap:wrap;}
  .filter-btn{background:#fff;border:1px solid var(--border);border-radius:7px;padding:7px 16px;font-size:13px;font-weight:500;color:var(--text-muted);cursor:pointer;font-family:inherit;transition:all .15s;}
  .filter-btn.active{background:var(--bp-blue);border-color:var(--bp-blue);color:#fff;}
  .filter-btn:hover:not(.active){border-color:var(--bp-blue);color:var(--bp-blue);}
  .report-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:16px;margin-bottom:24px;}
  .report-stat-card{background:#fff;border:1px solid var(--border);border-radius:12px;padding:18px 20px;}
  .rsc-label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--text-muted);margin-bottom:6px;}
  .rsc-val{font-size:28px;font-weight:800;color:var(--text-dark);}
  .rsc-sub{font-size:12px;color:var(--text-muted);margin-top:3px;}
  .report-card{background:#fff;border:1px solid var(--border);border-radius:12px;margin-bottom:20px;overflow:hidden;}
  .report-card-hdr{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;border-bottom:1px solid var(--border);background:#FAFCFF;}
  .report-card-hdr h3{font-size:14px;font-weight:700;color:var(--text-dark);}
  .report-card-body{padding:18px;}
  table.rt{width:100%;border-collapse:collapse;font-size:13px;}
  table.rt th{background:#F0F6FF;padding:10px 14px;text-align:left;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--text-muted);border-bottom:1px solid var(--border);}
  table.rt td{padding:10px 14px;border-bottom:1px solid #F0F4F8;color:var(--text-dark);vertical-align:middle;}
  table.rt tr:last-child td{border-bottom:none;}
  table.rt tr:hover td{background:#F8FBFF;cursor:pointer;}
  .badge-g{background:#D1FAE5;color:#065F46;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600;}
  .badge-b{background:#DBEAFE;color:#1E40AF;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600;}
  .badge-y{background:#FEF3C7;color:#92400E;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600;}
  .pmb{height:6px;background:#E2E8F0;border-radius:3px;overflow:hidden;min-width:80px;display:inline-block;vertical-align:middle;margin-left:8px;}
  .pmb-fill{height:100%;background:linear-gradient(90deg,var(--bp-blue),var(--accent-teal));border-radius:3px;}
  .lnk-u{color:var(--bp-blue-dim);cursor:pointer;text-decoration:underline;font-size:12px;}
  .btn-exp{background:var(--navy-deep);color:#fff;border:none;border-radius:7px;padding:6px 14px;font-size:12px;font-weight:600;cursor:pointer;font-family:inherit;display:flex;align-items:center;gap:5px;transition:opacity .2s;}
  .btn-exp:hover{opacity:.85;}
  .chart-area{display:flex;align-items:flex-end;gap:4px;height:120px;padding:8px 0 0;border-bottom:1px solid var(--border);margin-bottom:8px;}
  .c-bar-col{display:flex;flex-direction:column;align-items:center;flex:1;gap:4px;}
  .c-bar-grp{display:flex;align-items:flex-end;justify-content:center;gap:2px;height:100px;}
  .c-bar{width:18px;border-radius:3px 3px 0 0;transition:opacity .2s;cursor:pointer;}
  .c-bar:hover{opacity:.75;}
  .c-bar-lbl{font-size:10px;color:var(--text-muted);text-align:center;}
  .c-legend{display:flex;gap:14px;margin-top:6px;flex-wrap:wrap;}
  .c-leg-item{display:flex;align-items:center;gap:5px;font-size:11px;color:var(--text-muted);}
  .c-dot{width:10px;height:10px;border-radius:2px;}
  .modal-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:9999;align-items:center;justify-content:center;}
  .modal-overlay.open{display:flex;}
  /* Document viewer (Documentation card) */
  .doc-view-box{background:#fff;border-radius:12px;width:92vw;height:90vh;max-width:1200px;display:flex;flex-direction:column;overflow:hidden;box-shadow:0 20px 60px rgba(0,0,0,.35);}
  .doc-view-bar{display:flex;align-items:center;gap:8px;padding:10px 14px;border-bottom:1px solid var(--border);background:#F8FAFC;}
  .doc-view-title{flex:1;min-width:0;font-size:14px;font-weight:600;color:var(--text-dark);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  .doc-view-btn{border:1px solid var(--border);background:#fff;color:var(--text-dark);border-radius:8px;padding:7px 12px;font-size:13px;font-weight:600;cursor:pointer;font-family:inherit;white-space:nowrap;}
  .doc-view-btn:hover{border-color:var(--bp-blue);color:var(--bp-blue-dim);}
  .doc-view-btn.primary{background:var(--bp-blue);border-color:var(--bp-blue);color:#fff;}
  .doc-view-btn.primary:hover{filter:brightness(.95);color:#fff;}
  .doc-view-frame{flex:1;width:100%;border:none;background:#fff;}
  .doc-view-noprev{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--text-muted);font-size:14px;text-align:center;padding:24px;}
  .modal-box{background:#fff;border-radius:14px;padding:24px 28px;max-width:580px;width:90%;max-height:82vh;overflow-y:auto;box-shadow:0 20px 60px rgba(0,0,0,.3);}
  .modal-box h3{font-size:16px;font-weight:700;color:var(--text-dark);margin-bottom:14px;}
  .modal-close{float:right;background:none;border:none;font-size:20px;cursor:pointer;color:var(--text-muted);}
  .modal-q-list{list-style:none;}
  .modal-q-list li{padding:9px 0;border-bottom:1px solid var(--border);font-size:13px;color:var(--text-dark);}
  .modal-q-list li:last-child{border-bottom:none;}

  /* Scrollbar */
  .day-content::-webkit-scrollbar { width: 5px; }
  .day-content::-webkit-scrollbar-track { background: transparent; }
  .day-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
  .day-sidebar::-webkit-scrollbar { width: 4px; }
  .day-sidebar::-webkit-scrollbar-track { background: transparent; }
  .day-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

  /* Responsive */
  @media (max-width: 768px) {
    .header-nav { gap: 2px; }
    .nav-tab { padding: 6px 10px; font-size: 12px; }
    .welcome-title { font-size: 26px; }
    .welcome-stats { gap: 16px; }
    .day-sidebar { width: 200px; }
    .day-content-inner { padding: 18px 16px 40px; }
  }

  /* ── Role-based / Admin editing controls ── */
  .doc-item-wrap{position:relative;display:flex;flex-direction:column;}
  .doc-item-wrap .doc-del-btn{position:absolute;top:-6px;right:-6px;width:20px;height:20px;border-radius:50%;background:#EF4444;color:#fff;border:2px solid #fff;font-size:11px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;box-shadow:0 1px 4px rgba(0,0,0,.25);}
  .doc-item-wrap .doc-del-btn:hover{background:#DC2626;}
  .link-item-wrap{display:flex;align-items:center;gap:4px;}
  .link-item-wrap .link-item{flex:1;min-width:0;}
  .link-item-wrap .doc-del-btn{position:static;width:20px;height:20px;border-radius:50%;background:#EF4444;color:#fff;border:none;font-size:11px;cursor:pointer;flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:0;}
  .link-item-wrap .doc-del-btn:hover{background:#DC2626;}
  .link-item-wrap .doc-edit-btn{position:static;width:20px;height:20px;border-radius:50%;background:var(--bp-blue);color:#fff;border:none;font-size:10px;cursor:pointer;flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:0;}
  .link-item-wrap .doc-edit-btn:hover{background:var(--bp-blue-dim);}

  /* ── Users management page (reuses .report-header/.report-body/.report-card) ── */
  #users-page{display:none;flex-direction:column;background:var(--surface);overflow:hidden;height:100vh;}
  .nu-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:6px;}
  .nu-field{display:flex;flex-direction:column;gap:5px;}
  .nu-field label{font-size:12px;font-weight:600;color:var(--text-muted);}
  .nu-field input, .nu-field select{border:1px solid var(--border);border-radius:7px;padding:9px 12px;font-size:13px;font-family:inherit;color:var(--text-dark);outline:none;}
  .nu-field input:focus, .nu-field select:focus{border-color:var(--bp-blue);}
  .nu-field input:disabled{background:#F0F4F8;color:var(--text-muted);}
  .nu-hint{font-size:11px;color:var(--text-muted);margin-top:2px;}
  .nu-error{display:none;background:#FEF2F2;color:#B91C1C;border:1px solid #FCA5A5;border-radius:7px;padding:8px 12px;font-size:12px;font-weight:500;margin:10px 0;}
  .btn-create-user{background:var(--bp-blue);color:#fff;border:none;border-radius:7px;padding:10px 18px;font-size:13px;font-weight:600;cursor:pointer;font-family:inherit;margin-top:8px;}
  .btn-create-user:hover{opacity:.9;}
  .org-group{margin-bottom:22px;}
  .org-group-title{font-size:13px;font-weight:700;color:var(--text-dark);margin-bottom:8px;display:flex;align-items:center;gap:8px;}
  .org-count{background:#F0F6FF;color:var(--bp-blue-dim);font-size:11px;font-weight:600;padding:2px 8px;border-radius:10px;}
  .btn-del-user{background:#fff;border:1px solid #FCA5A5;color:#B91C1C;border-radius:6px;padding:5px 10px;font-size:11px;font-weight:600;cursor:pointer;font-family:inherit;}
  .btn-del-user:hover{background:#FEF2F2;}
  table.rt td input[type="checkbox"]{width:16px;height:16px;cursor:pointer;}
  .login-hint{font-size:11px;color:var(--text-muted);margin-top:5px;}
  .video-edit-btn{margin-left:auto;background:#F0F6FF;border:1px solid var(--bp-blue);color:var(--bp-blue-dim);border-radius:6px;padding:4px 10px;font-size:11px;font-weight:600;cursor:pointer;font-family:inherit;}
  .video-edit-btn:hover{background:var(--bp-blue);color:#fff;}
  .task-edit-btn{background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:13px;padding:2px 6px;flex-shrink:0;border-radius:5px;margin-left:auto;}
  .task-edit-btn:hover{background:#F0F6FF;color:var(--bp-blue-dim);}
  .checklist li span{flex:1;}
  .audit-tabs{display:flex;gap:8px;margin-bottom:16px;}
  .audit-status-active{color:#059669;font-weight:600;font-size:11px;}
  .audit-status-rolled{color:#B91C1C;font-weight:600;font-size:11px;}
  .btn-rollback{background:#fff;border:1px solid var(--bp-blue);color:var(--bp-blue-dim);border-radius:6px;padding:5px 10px;font-size:11px;font-weight:600;cursor:pointer;font-family:inherit;}
  .btn-rollback:hover{background:var(--bp-blue);color:#fff;}
  .btn-rollback:disabled{opacity:.4;cursor:not-allowed;background:#fff;color:var(--text-muted);border-color:var(--border);}
  .btn-change-pass{background:#fff;border:1px solid var(--border);color:var(--text-dark);border-radius:6px;padding:5px 10px;font-size:11px;font-weight:600;cursor:pointer;font-family:inherit;margin-right:6px;}
  .btn-change-pass:hover{border-color:var(--bp-blue);color:var(--bp-blue-dim);}

  /* Certification: Evaluate button + Completed/Not Completed badges */
  .btn-evaluate{background:#059669;border:1px solid #059669;color:#fff;border-radius:6px;padding:5px 10px;font-size:11px;font-weight:600;cursor:pointer;font-family:inherit;margin-right:6px;}
  .btn-evaluate:hover{background:#047857;border-color:#047857;}
  .cert-badge{border:none;border-radius:6px;padding:5px 10px;font-size:11px;font-weight:700;cursor:pointer;font-family:inherit;}
  .cert-badge-completed{background:#D1FAE5;color:#065F46;}
  .cert-badge-completed:hover{background:#A7F3D0;}
  .cert-badge-not-completed{background:#FEE2E2;color:#B91C1C;}
  .cert-badge-not-completed:hover{background:#FECACA;}

  /* Evaluation page (admin) */
  .cert-progress-summary{font-size:13px;font-weight:600;color:var(--text-dark);margin-bottom:16px;padding:12px 16px;background:#F0F6FF;border-radius:8px;display:flex;align-items:center;gap:10px;}
  .cert-progress-summary .cert-pct{font-size:20px;font-weight:800;color:var(--bp-blue-dim);}
  .cert-cat-row{display:flex;align-items:flex-start;gap:12px;padding:12px 0;border-bottom:1px solid var(--border);}
  .cert-cat-row:last-child{border-bottom:none;}
  .cert-cat-row input[type="checkbox"]{width:18px;height:18px;margin-top:2px;cursor:pointer;flex-shrink:0;}
  .cert-cat-main{flex:1;}
  .cert-cat-label{font-size:13px;font-weight:600;color:var(--text-dark);margin-bottom:6px;}
  .cert-cat-note{width:100%;min-height:44px;border:1px solid var(--border);border-radius:6px;padding:6px 8px;font-size:12px;font-family:inherit;resize:vertical;color:var(--text-dark);}
  .cert-cat-note::placeholder{color:var(--text-muted);}
  .cert-save-hint{font-size:11px;color:var(--text-muted);margin-top:3px;}

  /* Certification results modal (student view, no notes) */
  .cert-view-row{display:flex;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid var(--border);font-size:13px;color:var(--text-dark);}
  .cert-view-row:last-child{border-bottom:none;}
  .cert-view-icon-yes{color:#059669;font-weight:700;}
  .cert-view-icon-no{color:#B91C1C;font-weight:700;}

  /* Bulk delete */
  .bulk-actions-bar{display:none;align-items:center;gap:10px;flex-wrap:wrap;background:#F8FAFC;border:1px solid var(--border);border-radius:8px;padding:10px 14px;margin-bottom:14px;font-size:12px;font-weight:600;color:var(--text-dark);}
  .btn-make-active{background:#fff;border:1px solid #6EE7B7;color:#047857;border-radius:6px;padding:5px 10px;font-size:11px;font-weight:600;cursor:pointer;font-family:inherit;margin-right:6px;}
  .btn-make-active:hover{background:#ECFDF5;}
  .btn-make-inactive{background:#fff;border:1px solid #FCD34D;color:#B45309;border-radius:6px;padding:5px 10px;font-size:11px;font-weight:600;cursor:pointer;font-family:inherit;margin-right:6px;}
  .btn-make-inactive:hover{background:#FFFBEB;}
  .bulk-actions-bar .btn-make-active,.bulk-actions-bar .btn-make-inactive{padding:6px 14px;font-size:12px;margin-right:0;}
  .bulk-actions-bar.visible{display:flex;}
  .btn-bulk-delete{background:#B91C1C;border:none;color:#fff;border-radius:6px;padding:6px 14px;font-size:12px;font-weight:600;cursor:pointer;font-family:inherit;}
  .btn-bulk-delete:hover{background:#991B1B;}

  /* Learn more about certification (welcome screen link) */
  .btn-learn-more{background:none;border:1px solid var(--border);color:var(--text-muted);border-radius:8px;padding:10px 18px;font-size:13px;font-weight:600;cursor:pointer;font-family:inherit;margin-top:14px;}
  .btn-learn-more:hover{border-color:var(--bp-blue);color:var(--bp-blue-dim);}
  .cert-explain-step{display:flex;gap:16px;padding:18px 0;border-bottom:1px solid var(--border);}
  .cert-explain-step:last-child{border-bottom:none;}
  .cert-explain-num{width:36px;height:36px;border-radius:50%;background:var(--bp-blue);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:15px;flex-shrink:0;}
  .cert-explain-title{font-size:14px;font-weight:700;color:var(--text-dark);margin-bottom:4px;}
  .cert-explain-desc{font-size:13px;color:var(--text-muted);line-height:1.55;}
  .cert-explain-shot{border:1px solid var(--border);border-radius:8px;padding:10px;margin-top:10px;background:#F8FAFC;}
  /* ══════════════════════════════
     PORTALS (Basic training / Onboarding / Troubleshooting training)
  ══════════════════════════════ */
  /* Content of the portal that is NOT current is hidden purely by CSS, so
     the inline display:none used for soft-deleted items is never touched. */
  body:not([data-portal="onboarding"]) [data-portal="onboarding"],
  body:not([data-portal="troubleshooting"]) [data-portal="troubleshooting"] { display: none !important; }
  body:not([data-portal="training"]) .tree-day-group:not([data-portal]),
  body:not([data-portal="training"]) .day-layout:not([data-portal]),
  body:not([data-portal="training"]) .tree-day-group[data-portal="training"],
  body:not([data-portal="training"]) .day-layout[data-portal="training"] { display: none !important; }
  /* Onboarding and Troubleshooting training are "task portals" (same features). */
  body:not([data-portal="onboarding"]):not([data-portal="troubleshooting"]) .task-portal-only-ui,
  body:not([data-portal="onboarding"]):not([data-portal="troubleshooting"]) .onboarding-only-ui { display: none !important; }
  body[data-portal="onboarding"] .training-only-ui,
  body[data-portal="troubleshooting"] .training-only-ui { display: none !important; }

  #portal-chooser {
    min-height: 100vh; align-items: center; justify-content: center; padding: 24px 16px;
    background: var(--navy-deep);
    background-image:
      radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0,168,232,0.18) 0%, transparent 60%),
      repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(255,255,255,0.03) 39px, rgba(255,255,255,0.03) 40px),
      repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(255,255,255,0.03) 39px, rgba(255,255,255,0.03) 40px);
  }
  .pc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 22px; }
  .pc-card {
    text-align: left; background: rgba(255,255,255,0.04); border: 1px solid rgba(0,168,232,0.25); border-radius: 12px;
    padding: 20px; cursor: pointer; color: #E8EDF3; font-family: inherit; transition: all .18s;
  }
  .pc-card:hover { border-color: var(--bp-blue); background: rgba(0,168,232,0.10); transform: translateY(-2px); }
  .pc-card .pc-icon { font-size: 28px; margin-bottom: 8px; }
  .pc-card .pc-title { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 4px; }
  .pc-card .pc-desc { font-size: 12.5px; color: rgba(232,237,243,0.7); line-height: 1.5; }
  .pc-card .pc-go { margin-top: 12px; font-size: 12px; font-weight: 700; color: var(--bp-blue); }

  .btn-switch-portal { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.18); border-radius: 7px; padding: 7px 12px;
    font-size: 12px; font-weight: 600; color: #E8EDF3; cursor: pointer; font-family: inherit; }
  .btn-switch-portal:hover { border-color: var(--bp-blue); color: #fff; }

  #screen-welcome-ob {
    flex: 1; align-items: center; justify-content: center; padding: 40px;
    background: linear-gradient(160deg, #EFFCF8 0%, var(--surface) 60%);
    overflow-y: auto;
  }
  #screen-welcome-ob .welcome-inner { max-width: 760px; }
  #screen-welcome-ob .welcome-desc { max-width: 640px; text-align: left; }
  #screen-welcome-ob .welcome-desc p { margin: 0 0 10px; }
  .ob-text-edit-btn { font-size: 13px; vertical-align: middle; }
  .study-intro:empty, .task-general-desc:empty { display: none; }
  .welcome-title #ob-welcome-title { color: var(--text-dark); }
  #ob-welcome-title span { color: var(--bp-blue); }

  .ob-full-page { display: none; flex-direction: column; background: var(--surface); overflow: hidden; height: 100vh; }

  .portal-select-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
  .portal-select-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
  .portal-access-row { display: flex; gap: 16px; align-items: center; min-height: 38px; flex-wrap: wrap; }
  .portal-access-row label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-dark); cursor: pointer; }
  .portal-access-row input { width: 16px; height: 16px; }
  .portal-badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10.5px; font-weight: 700; margin: 1px 3px 1px 0; white-space: nowrap; }
  .portal-badge-training { background: #DBEAFE; color: #1E40AF; }
  .portal-badge-onboarding { background: #D1FAE5; color: #065F46; }
  .portal-badge-troubleshooting { background: #FEF3C7; color: #92400E; }
  .portal-badge-none { background: #F3F4F6; color: #6B7280; }

  .modal-box.modal-wide { max-width: 860px; }
  .ob-textarea { border: 1px solid var(--border); border-radius: 7px; padding: 9px 12px; font-size: 13px; font-family: inherit; color: var(--text-dark); resize: vertical; width: 100%; }
  .ob-textarea:focus { outline: none; border-color: var(--bp-blue); }
  .ob-textarea-internal { background: #FFFBEB; border-color: #FCD34D; }
  .ob-admin-only-note { display: inline-block; margin-left: 6px; background: #FEF3C7; color: #92400E; border-radius: 4px; padding: 1px 7px; font-size: 10.5px; font-weight: 700; }
  .ext-warn { background: #FEF3C7; border: 1px solid #FCD34D; color: #78350F; border-radius: 8px; padding: 12px 14px; font-size: 13px; line-height: 1.55; }
  .obem-status-row { display: flex; gap: 8px; flex-wrap: wrap; }
  .obem-opt { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 7px; padding: 7px 12px; font-size: 13px !important; font-weight: 600 !important; cursor: pointer; }
  .obem-opt input { width: auto !important; }
  .obem-completed { color: #065F46 !important; } .obem-needs_rework { color: #92400E !important; } .obem-not_completed { color: #B91C1C !important; }

  /* ── Rich text (rendered) ── */
  .ob-rich { font-size: 13.5px; color: var(--text-dark); line-height: 1.6; word-wrap: break-word; overflow-wrap: anywhere; }
  .ob-rich p { margin: 0 0 8px; }
  .ob-rich ul, .ob-rich ol { padding-left: 1.5em; margin: 0 0 8px; }
  .ob-rich h1, .ob-rich h2, .ob-rich h3, .ob-rich h4 { margin: 10px 0 6px; color: var(--text-dark); line-height: 1.3; }
  .ob-rich h1 { font-size: 20px; } .ob-rich h2 { font-size: 17px; } .ob-rich h3 { font-size: 15px; } .ob-rich h4 { font-size: 14px; }
  .ob-rich blockquote { border-left: 3px solid var(--bp-blue); margin: 6px 0 10px; padding: 4px 12px; color: var(--text-muted); background: #F8FAFC; }
  .ob-rich pre { background: #0F1B2D; color: #E8EDF3; border-radius: 7px; padding: 10px 12px; font-size: 12px; overflow-x: auto; white-space: pre-wrap; margin: 6px 0 10px; }
  .ob-rich code { background: #EEF2F7; border-radius: 4px; padding: 1px 5px; font-size: 12px; }
  .ob-rich pre code { background: none; padding: 0; }
  .ob-rich img { max-width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--border); margin: 6px 0; cursor: zoom-in; display: block; }
  .ob-rich a { color: var(--bp-blue-dim); }
  .ob-rich table { border-collapse: collapse; margin: 6px 0 10px; }
  .ob-rich td, .ob-rich th { border: 1px solid var(--border); padding: 4px 8px; }
  .ob-rich .cert-explain-step { text-align: left; }

  /* ── Rich text editor ── */
  .rte { position: relative; border: 1px solid var(--border); border-radius: 8px; background: #fff; overflow: hidden; }
  .rte:focus-within { border-color: var(--bp-blue); box-shadow: 0 0 0 3px rgba(0,168,232,0.12); }
  .rte-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 5px; background: #F8FAFC; border-bottom: 1px solid var(--border); }
  .rte-toolbar button { background: none; border: 1px solid transparent; border-radius: 5px; padding: 3px 8px; font-size: 12px; font-weight: 600; color: var(--text-dark); cursor: pointer; font-family: inherit; min-width: 28px; }
  .rte-toolbar button:hover { background: #fff; border-color: var(--border); }
  .rte-toolbar .rte-sep { width: 1px; background: var(--border); margin: 2px 4px; }
  .rte-area { min-height: 140px; max-height: 480px; overflow-y: auto; padding: 10px 12px; outline: none; }
  .rte-area:empty::before { content: attr(data-placeholder); color: #9AA8B8; }
  .rte-area img { cursor: pointer; }
  .rte-area img.rte-img-selected { outline: 2px solid var(--bp-blue); outline-offset: 1px; }
  /* image size bar + drag handle (shown on a clicked image in the editor) */
  .rte-imgbar { position: absolute; z-index: 5; display: none; gap: 2px; align-items: center; padding: 3px; background: rgba(15,23,42,0.88);
    border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
  .rte-imgbar button { background: none; border: 0; color: #fff; font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 4px; cursor: pointer; font-family: inherit; }
  .rte-imgbar button:hover { background: rgba(255,255,255,0.18); }
  .rte-imgbar-pct { color: #9FDCF5; font-size: 11px; font-weight: 700; padding: 0 6px; }
  .rte-img-handle { position: absolute; z-index: 5; display: none; width: 14px; height: 14px; background: var(--bp-blue); border: 2px solid #fff;
    border-radius: 3px; cursor: nwse-resize; box-shadow: 0 1px 4px rgba(0,0,0,0.3); touch-action: none; }
  .rte-status { font-size: 11px; color: var(--text-muted); padding: 3px 10px 5px; min-height: 18px; }

  /* ── Onboarding Practical Tasks ── */
  .ob-task-list { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
  .ob-task { border: 1px solid var(--border); border-radius: 10px; background: #fff; overflow: hidden; }
  .ob-task.ob-done { border-color: #A7F3D0; }
  .ob-task-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: #FAFCFF; border-bottom: 1px solid var(--border); cursor: pointer; flex-wrap: wrap; }
  .ob-task.collapsed .ob-task-head { border-bottom: none; }
  .ob-task.collapsed .ob-task-body { display: none; }
  .ob-task-caret { font-size: 10px; color: var(--text-muted); transition: transform .15s; }
  .ob-task:not(.collapsed) .ob-task-caret { transform: rotate(90deg); }
  .ob-task-num { background: var(--bp-blue); color: #fff; border-radius: 6px; padding: 2px 9px; font-size: 12px; font-weight: 700; white-space: nowrap; }
  .ob-task-title { font-size: 14px; font-weight: 700; color: var(--text-dark); flex: 1; min-width: 120px; }
  .ob-task-body { padding: 14px; }
  .ob-task-admin { display: flex; gap: 2px; }
  .ob-pill { border-radius: 100px; padding: 2px 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
  .ob-pill-none { background: #F3F4F6; color: #6B7280; }
  .ob-pill-done { background: #D1FAE5; color: #065F46; }
  .ob-pill-pending { background: #DBEAFE; color: #1E40AF; }
  .ob-pill-completed { background: #059669; color: #fff; }
  .ob-pill-needs_rework { background: #FEF3C7; color: #92400E; }
  .ob-pill-not_completed { background: #FEE2E2; color: #B91C1C; }
  .ob-subhead { font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin: 14px 0 6px; display: flex; align-items: center; gap: 8px; }
  .ob-files { display: flex; flex-direction: column; gap: 6px; }
  .ob-file { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 7px; padding: 6px 10px; font-size: 12.5px; background: #F8FAFC; }
  .ob-file-name { flex: 1; color: var(--bp-blue-dim); cursor: pointer; font-weight: 600; word-break: break-all; }
  .ob-file-name:hover { text-decoration: underline; }
  .ob-file-size { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
  .ob-file-del { background: none; border: none; color: #B91C1C; cursor: pointer; font-size: 13px; padding: 0 4px; }
  .ob-attach-btn { align-self: flex-start; background: #fff; border: 1px dashed var(--bp-blue); color: var(--bp-blue-dim); border-radius: 7px; padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
  .ob-attach-btn:hover { background: #F0F9FF; }
  .ob-attach-btn:disabled { opacity: .5; cursor: not-allowed; }
  .ob-muted { font-size: 12px; color: var(--text-muted); }
  .ob-answer { margin-top: 16px; border-top: 1px dashed var(--border); padding-top: 4px; }
  .ob-feedback { border-radius: 8px; padding: 10px 12px; margin: 8px 0 10px; font-size: 13px; }
  .ob-feedback-completed { background: #ECFDF5; border: 1px solid #A7F3D0; }
  .ob-feedback-needs_rework { background: #FFFBEB; border: 1px solid #FCD34D; }
  .ob-feedback-not_completed { background: #FEF2F2; border: 1px solid #FCA5A5; }
  .ob-feedback-pending { background: #EFF6FF; border: 1px solid #BFDBFE; }
  .ob-feedback-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; font-weight: 600; }
  .ob-answer-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
  .ob-done-toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--text-dark); user-select: none;
    border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; background: #fff; }
  .ob-done-toggle .check-box { margin-top: 0; }
  .ob-done-toggle.checked { border-color: #A7F3D0; background: #ECFDF5; }
  .ob-done-toggle.checked .check-box { background: var(--success); border-color: var(--success); color: #fff; font-size: 10px; }
  .ob-done-toggle:not(.checked) .check-box { color: transparent; }
  .ob-save-state { font-size: 11.5px; color: var(--text-muted); }
  .ob-admin-preview { margin-top: 14px; border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; font-size: 12px; color: var(--text-muted); background: #FAFCFF; }
  .ob-add-task-row { margin-top: 14px; }

  /* ── Onboarding status / evaluation tables ── */
  .obs-group { margin-bottom: 18px; }
  .obs-group-title { font-size: 14px; font-weight: 800; color: var(--text-dark); margin: 4px 0 8px; }
  .obs-sub-title { font-size: 12px; font-weight: 700; color: var(--text-muted); margin: 10px 0 6px; }
  .obs-comment { font-size: 12px; color: var(--text-dark); margin-top: 4px; white-space: pre-wrap; }
  .obs-comment-internal { background: #FFFBEB; border: 1px solid #FCD34D; border-radius: 6px; padding: 4px 8px; margin-top: 6px; }
  .obs-answer-box { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: #fff; margin: 6px 0; }
  .obs-detail-row td { background: #F8FAFC; }
  .obs-link { color: var(--bp-blue-dim); cursor: pointer; font-weight: 600; font-size: 12px; }
  .obs-link:hover { text-decoration: underline; }
  .img-zoom-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.82); z-index: 10050; display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 24px; }
  .img-zoom-overlay img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
  @media (max-width: 640px) {
    .nu-form-grid { grid-template-columns: 1fr; }
    .pc-grid { grid-template-columns: 1fr; }
  }
