    :root {
      --bg: #0f172a;
      --bg-alt: #111827;
      --panel: rgba(15,23,42,0.96);
      --panel-2: rgba(15,23,42,0.98);
      --header-bg: radial-gradient(circle at top left, #1e293b, #020617);
      --page-bg: radial-gradient(circle at top left, #1e293b, #020617);
      --card: #1f2933;
      --ppm-blue: #005EB8;
      --ppm-gray: #939598;
      --accent: var(--ppm-blue);
      --accent-soft: rgba(0, 94, 184, 0.15);
      --text: #ffffff;
      --muted: #cbd5e1;
      --danger: #f97373;
      --success: #34d399;
      --border: #374151;
      --radius: 8px;
      --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    body {
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      background: var(--page-bg);
      color: var(--text);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      padding: 16px;
    }

    .app-shell {
      max-width: 1100px;
      margin: 0 auto;
      background: linear-gradient(145deg, var(--panel), var(--panel-2));
      border-radius: 16px;
      box-shadow: var(--shadow);
      border: 1px solid rgba(148, 163, 184, 0.15);
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    header {
      padding: 20px 24px 12px;
      border-bottom: 1px solid var(--border);
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      align-items: center;
      justify-content: space-between;
      background: var(--header-bg);
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .brand-icon {
      width: 32px;
      height: 32px;
      border-radius: 12px;
      background: radial-gradient(circle at 30% 20%, #4f46e5, #0ea5e9);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      font-weight: 700;
      color: white;
      box-shadow: 0 0 0 1px rgba(15,23,42,0.8), 0 8px 20px rgba(59,130,246,0.6);
    }

    .brand-text h1 {
      font-size: 18px;
      font-weight: 600;
    }

    .brand-text p {
      font-size: 12px;
      color: var(--muted);
    }

    .status-pill {
      padding: 6px 10px;
      border-radius: 999px;
      background: rgba(22, 163, 74, 0.1);
      border: 1px solid rgba(34, 197, 94, 0.4);
      font-size: 11px;
      display: flex;
      align-items: center;
      gap: 6px;
      color: var(--muted);
    }

    .status-pill span {
      font-size: 16px;
    }

    nav.tabs {
      display: flex;
      align-items: center;
      gap: 4px;
      padding: 4px 12px;
      border-bottom: 1px solid var(--border);
      background: linear-gradient(to right, rgba(15,23,42,0.96), rgba(15,23,42,0.98));
    }

    .tab {
      border: none;
      background: transparent;
      padding: 6px 10px;
      font-size: 13px;
      color: var(--muted);
      cursor: pointer;
      border-radius: 999px;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: background 0.15s ease, color 0.15s ease, transform 0.05s ease;
    }

    .tab-icon {
      font-size: 14px;
    }

    .tab.active {
      background: var(--accent-soft);
      color: var(--text);
      
    }

    .tab:hover {
      background: rgba(15, 23, 42, 0.8);
      color: #e5e7eb;
    }

    main {
      display: flex;
      flex: 1;
      min-height: 0;
    }

    .sidebar {
      width: 230px;
      border-right: 1px solid var(--border);
      padding: 16px 16px 20px;
      background: radial-gradient(circle at top, rgba(30, 64, 175, 0.12), transparent);
      display: none;
    }

    .sidebar h3 {
      font-size: 13px;
      margin-bottom: 8px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }

    .filter-group {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin-bottom: 20px;
    }

    /* Sidebar category tree nesting */
    .subchips {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin-left: 14px;
      margin-top: 6px;
      margin-bottom: 6px;
    }

    .chip.subchip {
      font-size: 11px;
      padding: 5px 10px;
    }

    .chip {
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.4);
      padding: 6px 10px;
      font-size: 12px;
      background: rgba(15, 23, 42, 0.8);
      color: var(--muted);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    }

    .chip span.count {
      font-size: 10px;
      opacity: 0.8;
    }

    .chip.active {
      background: var(--accent-soft);
      color: var(--text);
      border-color: var(--accent);
    }

    .content-area {
      flex: 1;
      padding: 16px 18px 20px;
      overflow-y: auto;
    }

/* PPM sidebar nav chips */
.sidebar .chip{
  background: var(--ppm-gray);
  color: #000000;
  border-color: rgba(0,0,0,0.18);
}
.sidebar .chip span.count{
  color: rgba(0,0,0,0.7);
}
.sidebar .chip:hover,
.sidebar .chip.active{
  background: var(--ppm-blue);
  color: #ffffff;
  border-color: var(--ppm-blue);
}
.sidebar .chip:hover span.count,
.sidebar .chip.active span.count{
  color: rgba(255,255,255,0.85);
}


    .tab-content {
      display: none;
    }

    .tab-content.active {
      display: block;
    }

    .view-header {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 12px;
    }

    .view-header h2 {
      font-size: 16px;
      font-weight: 600;
    }

    .view-header p {
      font-size: 12px;
      color: var(--muted);
    }

    .course-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
      gap: 12px;
    }

    .course-card {
      background: radial-gradient(circle at top left, #111827, #020617);
      border-radius: var(--radius);
      padding: 12px;
      border: 1px solid rgba(55, 65, 81, 0.9);
      box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
      display: flex;
      flex-direction: column;
      gap: 8px;
      position: relative;
      overflow: hidden;
    }

    .course-card::before {
      content: "";
      position: absolute;
      inset: 0;
      background: radial-gradient(circle at top right, rgba(59,130,246,0.16), transparent 55%);
      opacity: 0.9;
      pointer-events: none;
    }

    .course-card > * {
      position: relative;
      z-index: 1;
    }

    .course-title {
      font-size: 14px;
      font-weight: 600;
    }

    .course-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      font-size: 11px;
      color: var(--muted);
    }
.course-tags{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.tag-pill{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.65);
  font-size: 11px;
  color: var(--muted);
}
.tag-pill .tag-icon{
  font-size: 12px;
}


    .badge {
      padding: 3px 7px;
      border-radius: 999px;
      background: rgba(15, 23, 42, 0.9);
      border: 1px solid rgba(148, 163, 184, 0.4);
    }

    .badge.pass {
      border-color: rgba(52, 211, 153, 0.7);
      color: #a7f3d0;
    }

    .badge.fail {
      border-color: rgba(248, 113, 113, 0.7);
      color: #fecaca;
    }

    .course-desc {
      font-size: 12px;
      color: var(--muted);
      line-height: 1.5;
      min-height: 32px;
    }

    .course-actions {
      display: flex;
      justify-content: flex-start;
      align-items: center;
      margin-top: 4px;
      gap: 12px;
    }

    .primary-btn,
    .ghost-btn,
    .small-btn {
      border-radius: 999px;
      border: none;
      padding: 6px 10px;
      font-size: 12px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      white-space: nowrap;
    }

    .primary-btn {
      background: linear-gradient(to right, #3b82f6, #0ea5e9);
      color: white;
      box-shadow: 0 0 0 1px rgba(15,23,42,0.7), 0 8px 16px rgba(37,99,235,0.6);
    }

    .primary-btn:hover {
      filter: brightness(1.05);
    }

    .ghost-btn {
      background: transparent;
      border: 1px solid rgba(148, 163, 184, 0.4);
      color: var(--muted);
    }

    .ghost-btn:hover {
      border-color: rgba(148, 163, 184, 0.8);
    }

    .small-text {
      font-size: 11px;
      color: var(--muted);
    }

    /* COURSE DETAIL LAYOUT + SECTION NAV */

    .course-detail-header {
      margin-bottom: 14px;
    }

    .course-detail-header h2 {
      font-size: 18px;
      margin-bottom: 4px;
    }

    .course-detail-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      font-size: 11px;
      color: var(--muted);
      margin-bottom: 6px;
    }

    .course-detail-layout {
      display: grid;
      grid-template-columns: minmax(44px, 260px) minmax(0, 1fr);
      gap: 12px;
      align-items: flex-start;
      margin-bottom: 12px;
    }
.course-detail-layout.section-nav-collapsed{
  grid-template-columns: 44px minmax(0, 1fr);
}


    .course-body {
      background: radial-gradient(circle at top left, #020617, #020617);
      border-radius: var(--radius);
      border: 1px solid var(--border);
      padding: 14px;
      height: calc(100vh - 280px);
      max-height: none;
      overflow-y: auto;
      font-size: 13px;
      line-height: 1.6;
      box-shadow: inset 0 0 0 1px rgba(15,23,42,0.9);
      position: relative;
    }

    .course-section {
      margin-bottom: 16px;
      padding-bottom: 12px;
      border-bottom: 1px dashed rgba(55, 65, 81, 0.9);
      display: grid;
      grid-template-columns: auto 1fr;
      column-gap: 10px;
      align-items: flex-start;
    }

    .course-section:last-of-type {
      border-bottom: none;
      padding-bottom: 4px;
    }

    .section-status {
      padding-top: 4px;
    }

    .section-check {
      width: 18px;
      height: 18px;
      border-radius: 999px;
      border: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 11px;
      color: var(--muted);
      background: rgba(15, 23, 42, 0.95);
      box-shadow: 0 2px 4px rgba(0,0,0,0.6);
    }

    .course-section.completed .section-check {
      border-color: var(--success);
      background: rgba(22, 163, 74, 0.28);
      color: #bbf7d0;
      box-shadow: 0 0 0 1px rgba(34,197,94,0.5), 0 0 14px rgba(34,197,94,0.35);
    }

    .section-content h3 {
      font-size: 13px;
      margin-bottom: 6px;
    }

    .section-content p {
      color: var(--muted);
      margin-bottom: 6px;
    }

    .section-content ul {
      padding-left: 18px;
      color: var(--muted);
      margin-bottom: 6px;
    }

    .section-content li {
      margin-bottom: 3px;
    }

    /* Nice space for images inside course sections */
    .section-content img {
      max-width: 100%;
      border-radius: 10px;
      margin: 8px 0;
      display: block;
      box-shadow: 0 8px 18px rgba(0,0,0,0.5);
    }

    .info-block {
      margin-top: 12px;
      padding: 10px;
      border-radius: var(--radius);
      background: rgba(30, 64, 175, 0.22);
      border: 1px solid rgba(59, 130, 246, 0.5);
      font-size: 12px;
      color: #bfdbfe;
    }

    .section-nav {
      font-size: 11px;
      background: rgba(15, 23, 42, 0.95);
      border-radius: 10px;
      border: 1px solid var(--border);
      padding: 10px;
      height: calc(100vh - 280px);
      max-height: none;
      overflow-y: auto;
      box-shadow: 0 8px 18px rgba(0,0,0,0.6);
      position: sticky;
      top: 4px;
    }
.section-nav-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.section-nav-toggle{
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: transparent;
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  cursor: pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.section-nav-toggle:hover{
  border-color: rgba(148, 163, 184, 0.85);
}
.section-nav.collapsed{
  padding: 8px 6px;
  overflow: hidden;
}
.section-nav.collapsed .section-nav-title,
.section-nav.collapsed .section-nav-list{
  display:none;
}
.section-nav.collapsed .section-nav-head{
  justify-content: center;
  margin-bottom: 0;
}


    .section-nav-title {
      text-transform: uppercase;
      letter-spacing: 0.08em;
      font-size: 10px;
      color: var(--muted);
      margin-bottom: 8px;
    }

    .section-nav-list {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .section-nav-item {
      border: none;
      background: transparent;
      width: 100%;
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 4px 6px;
      border-radius: 999px;
      cursor: pointer;
      color: var(--muted);
      transition: background 0.15s ease, color 0.15s ease, transform 0.05s ease;
    }

    .section-nav-item:hover {
      background: rgba(31, 41, 55, 0.9);
      color: #e5e7eb;
      transform: none;
    }

    .section-nav-bullet {
      width: 6px;
      height: 6px;
      border-radius: 999px;
      background: var(--border);
      flex-shrink: 0;
    }

    .section-nav-item-label {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      text-align: left;
    }

    .section-nav-item.active {
      background: var(--accent-soft);
      color: var(--text);
    }

    .section-nav-item.active .section-nav-bullet {
      background: var(--accent);
    }

    .section-nav-item.completed .section-nav-bullet {
      background: var(--success);
    }

    .quiz-container {
      margin-top: 4px;
      padding: 12px;
      border-radius: var(--radius);
      background: rgba(17, 24, 39, 0.9);
      border: 1px solid rgba(55, 65, 81, 0.9);
      box-shadow: 0 6px 14px rgba(0, 0, 0, 0.65);
    }

    .quiz-header {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 10px;
    }

    .quiz-header h3 {
      font-size: 14px;
    }

    .quiz-header p {
      font-size: 12px;
      color: var(--muted);
    }

    .question {
      margin-bottom: 10px;
      padding-bottom: 6px;
      border-bottom: 1px dashed rgba(55, 65, 81, 0.9);
    }

    .question:last-of-type {
      border-bottom: none;
    }

    .question-text {
      font-size: 13px;
      margin-bottom: 6px;
    }

    .options {
      display: flex;
      flex-direction: column;
      gap: 4px;
      font-size: 12px;
    }

    .options label {
      display: flex;
      gap: 6px;
      align-items: flex-start;
      cursor: pointer;
    }

    .options input[type="radio"] {
      margin-top: 2px;
    }

    .quiz-footer {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-top: 10px;
    }

    .quiz-result {
      font-size: 12px;
    }

    .quiz-result.success {
      color: var(--success);
    }

    .quiz-result.fail {
      color: var(--danger);
    }

    .back-link {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 12px;
      color: var(--muted);
      cursor: pointer;
      margin-bottom: 8px;
    }

    .back-link:hover {
      color: #e5e7eb;
    }

    .empty-state {
      padding: 16px;
      border-radius: var(--radius);
      border: 1px dashed rgba(75, 85, 99, 0.9);
      background: rgba(15, 23, 42, 0.9);
      font-size: 13px;
      color: var(--muted);
    }

    .empty-state strong {
      color: #e5e7eb;
    }

    footer {
      padding: 8px 16px;
      font-size: 10px;
      color: var(--muted);
      text-align: right;
      opacity: 0.9;
    }

    /* Light / dark theme variables override */
    
    body.theme-light {
      /* Token overrides so any var()-based colors stay readable in light mode */
      --bg: #e5e7eb;
      --panel: #ffffff;
      --sidebar: #f9fafb;
      --tile: #ffffff;
      --text: #111827;
      --muted: #4b5563;
      --muted2: #6b7280;
      --border: #d1d5db;
      --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
      --page-bg: #e5e7eb;
      --header-bg: #ffffff;
      --panel: #ffffff;
      --panel-2: #ffffff;

      background: var(--bg);
      color: var(--text);
    }
    
    body.theme-light .app-shell {
      background: #ffffff;
      border-color: #d1d5db;
      box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    }
    
    body.theme-light header {
      background: #ffffff;
    }
    
    body.theme-light .tabs {
      background: #f9fafb;
    }
    
    body.theme-light .tab {
      color: #4b5563;
    }
    
    body.theme-light .tab.active {
      background: #ffffff;
      color: #111827;
      border-color: #d1d5db;
    }
    
    body.theme-light .sidebar {
      background: #f9fafb;
      border-right-color: #e5e7eb;
    }
    
    body.theme-light .course-card {
      background: #ffffff;
      border-color: #e5e7eb;
      box-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
    }
    
    body.theme-light .course-card::before {
      display: none;
    }
    
    /* Use company blue/gray for primary buttons in light mode */
    body.theme-light .primary-btn {
      background: linear-gradient(to right, #0b4f6c, #2563eb);
      box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.6), 0 8px 16px rgba(15, 23, 42, 0.2);
    }
    /* Base badge variants */
    
    .badge.not-started {
      background: #facc15;
      border-color: #fbbf24;
      color: #1f2937;
    }
    
    .badge.in-progress {
      background: #e0f2fe;
      border-color: #93c5fd;
      color: #1d4ed8;
    }
    
    /* Light theme badge look */
    
    body.theme-light .badge {
      background: #f3f4f6;
      border-color: #e5e7eb;
      color: #4b5563;
    }
    
    body.theme-light .badge.pass {
      background: #ecfdf3;
      border-color: #4ade80;
      color: #166534;
    }
    
    body.theme-light .badge.fail {
      background: #fef2f2;
      border-color: #fecaca;
      color: #b91c1c;
    }

    .site-header-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    
    .site-header-bottom {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-top: 8px;
    }
    
    /* Logo sizing */
    .brand-icon img {
      display: block;
      height: 36px;
      width: auto;
    }
    
    body.theme-light .brand-icon {
      background: transparent;
      box-shadow: none;
    }
    
    /* Profile chip */
    
    .profile-chip {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 6px 10px;
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.6);
      background: rgba(15, 23, 42, 0.5);
      cursor: pointer;
      font-size: 12px;
    }
    
    body.theme-light .profile-chip {
      background: #f9fafb;
    }
    
    .profile-avatar {
      width: 26px;
      height: 26px;
      border-radius: 999px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-weight: 600;
      font-size: 12px;
      background: var(--accent-soft);
    }
    
    .profile-text {
      display: flex;
      flex-direction: column;
      line-height: 1.1;
    }
    
    .profile-text .name {
      font-weight: 600;
    }
    
    .profile-text .role {
      font-size: 11px;
      color: var(--muted);
    }

    .profile-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr);
      gap: 16px;
      margin-top: 12px;
    }
    
    .profile-card {
      border-radius: var(--radius);
      background: var(--card);
      padding: 16px;
      border: 1px solid var(--border);
    }
    
    body.theme-light .profile-card {
      background: #ffffff;
      border-color: #e5e7eb;
    }
    
    .form-field {
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-bottom: 10px;
      font-size: 13px;
    }
    
    .form-field label {
      font-weight: 500;
    }
    
    .form-field input {
      border-radius: 6px;
      padding: 6px 8px;
      border: 1px solid rgba(148, 163, 184, 0.7);
      background: transparent;
      color: inherit;
    }
.form-field select{
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  padding: 10px 12px;
  background: transparent;
  color: inherit;
  outline: none;
}
body.theme-light .form-field select{
  background: #f9fafb;
}
.checkbox-inline{
  display:flex;
  align-items:center;
  gap: 8px;
  font-size: 12px;
  margin-top: 8px;
  color: var(--muted);
}
.checkbox-inline input[type="checkbox"]{
  width: 14px;
  height: 14px;
}
body.theme-light .checkbox-inline{
  color: #6b7280;
}

    
    .profile-subsection {
      margin-top: 10px;
    }
    
    .profile-subsection h4 {
      font-size: 12px;
      margin-bottom: 4px;
    }
    
    .profile-list {
      list-style: disc;
      padding-left: 18px;
      margin: 6px 0 4px;
      font-size: 12px;
      color: var(--muted);
    }

    .secondary-btn {
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.7);
      padding: 6px 12px;
      font-size: 12px;
      cursor: pointer;
      background: transparent;
      color: inherit;
    }
    
    body.theme-light .secondary-btn {
      background: #f9fafb;
    }
    
    .table-wrapper {
      overflow-x: auto;
      margin-top: 12px;
    }
    
    .admin-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 12px;
    }
    
    .admin-table th,
    .admin-table td {
      border: 1px solid rgba(148, 163, 184, 0.5);
      padding: 6px 8px;
      text-align: left;
    }
    
    .admin-table th {
      background: rgba(15, 23, 42, 0.3);
    }
    
    body.theme-light .admin-table th {
      background: #f3f4f6;
    }

    .view-controls {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    
    .search-wrapper input {
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.7);
      padding: 6px 10px;
      font-size: 12px;
      width: 220px;
      background: transparent;
      color: inherit;
    }
    
    .department-filters {
      flex-direction: row;
      flex-wrap: wrap;
      margin-bottom: 12px;
    }
    
    .resources-block h3 {
      margin-bottom: 6px;
    }
    
    .resources-block h4 {
      font-size: 12px;
      margin: 8px 0 4px;
    }
    
    .resources-block ul {
      padding-left: 18px;
      margin: 4px 0;
      font-size: 12px;
    }
    
    .resource-video {
      margin-top: 8px;
    }
    
    .resource-video iframe {
      width: 100%;
      max-width: 100%;
      min-height: 220px;
      border-radius: 10px;
      border: none;
    }    

    .terms-modal {
      position: fixed;
      inset: 0;
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 40;
    }
    
    .terms-modal.open {
      display: flex;
    }
    
    .terms-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(15, 23, 42, 0.7);
    }
    
    .terms-dialog {
      position: relative;
      max-width: 560px;
      width: 100%;
      border-radius: 12px;
      padding: 20px 18px 16px;
      background: var(--card);
      border: 1px solid var(--border);
      box-shadow: var(--shadow);
    }
    
    body.theme-light .terms-dialog {
      background: #ffffff;
      border-color: #e5e7eb;
      box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
    }
    
    .terms-checkbox {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      margin-top: 10px;
    }
    
    .terms-actions {
      margin-top: 12px;
      text-align: right;
    }
    
    .site-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 11px;
      padding: 10px 16px 14px;
      border-top: 1px solid rgba(148, 163, 184, 0.4);
      color: var(--muted);
    }
    
    .corner-logo {
      position: fixed;
      bottom: 16px;
      left: 16px;
      z-index: 30;
    }
    
    .corner-logo img {
      display: block;
      height: 32px;
      width: auto;
      opacity: 0.9;
    }    

    @media (min-width: 880px) {
      .sidebar {
        display: block;
      }
    }

/* Tablet & mobile adjustments */
    @media (max-width: 768px) {
      header {
       padding: 12px 14px 10px;
      }

      .content-area {
        padding: 14px;
      }

  /* Hide the left sidebar on small screens */
      .sidebar {
        display: none;
      }

  /* Course layout becomes one column: content + section nav stacked */
      .course-detail-layout {
        grid-template-columns: minmax(0, 1fr);
      }

  /* Section nav moves on top of the content and scrolls with the page */
      .section-nav {
        position: static;
        max-height: none;
        order: -1;
        margin-bottom: 10px;
      }

  /* Let the course body grow naturally instead of fixed height */
      .course-body {
        max-height: 380px;
      }
    }

/* Extra-small phones (optional fine tuning) */
    @media (max-width: 480px) {
      header {
       flex-direction: column;
       align-items: flex-start;
       gap: 6px;
      }

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

      .course-card {
        padding: 10px;
      }

      nav.tabs {
        overflow-x: auto;
      }
    }

/* ============================================================
   PPM portal overrides & additions
   ============================================================ */

/* Keep the outer border/containers consistent across tabs */
.app-shell {
  height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
}

/* Ensure the main region always fills available height so interior
   panes scroll instead of the whole shell resizing */
main {
  flex: 1;
  min-height: 0;
}

/* Match logo height with profile chip/avatar */
.brand-icon img {
  height: 26px;
}

/* Bookmark button on course cards */
.course-actions {
  gap: 10px;
}

.bookmark-btn {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: transparent;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.bookmark-btn:hover {
  border-color: rgba(148, 163, 184, 0.8);
}

.bookmark-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

body.theme-light .bookmark-btn {
  background: #ffffff;
}

/* Sidebar collapse / expand */
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.sidebar-toggle {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: transparent;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  color: inherit;
}

.sidebar-toggle:hover {
  border-color: rgba(148, 163, 184, 0.9);
}

.sidebar.collapsed {
  width: 56px;
  padding: 12px 8px 12px;
}

.sidebar.collapsed .filter-group,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .sidebar-legend-title {
  display: none;
}

.sidebar.collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

/* Course section completion colors */
.course-section.not-started .section-check {
  border-color: #fbbf24;
  background: rgba(250, 204, 21, 0.25);
  color: #1f2937;
}

.course-section.in-progress .section-check {
  border-color: rgba(59, 130, 246, 0.7);
  background: rgba(59, 130, 246, 0.15);
  color: #bfdbfe;
}

/* Resource links */
.resources-block {
  margin-top: 10px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.4);
}

body.theme-light .resources-block {
  background: #f9fafb;
}

.resources-block a {
  color: inherit;
}

/* =========================================================
   FULLSCREEN + TOPBAR + AUTH PAGE (ADDED OVERRIDES)
   ========================================================= */

html,
body {
  height: 100%;
}

body {
  /* Fill the entire viewport (no centered "card" shell) */
  padding: 0 !important;
  margin: 0 !important;
  min-height: 0 !important;
  height: 100vh;
  overflow: hidden;
}

.app-shell {
  /* Make the portal fill the screen so content doesn't look like a small box */
  width: 100%;
  height: 100vh;
  max-width: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
}


.ppm-mark{
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--ppm-blue);
  color: #ffffff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 1px rgba(15,23,42,0.6), 0 10px 24px rgba(0,94,184,0.35);
}
.ppm-mark--small{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-size: 18px;
  box-shadow: 0 0 0 1px rgba(15,23,42,0.6), 0 10px 20px rgba(0,94,184,0.25);
}

/* Top bar layout (logo left of company name, title centered, status next to title, round profile photo) */
header.topbar {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(circle at top left, #1e293b, #020617);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.topbar-left {
  min-width: 1px;
}

.topbar-center {
  display: flex;
  justify-content: center;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.topbar-logo {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.topbar-title {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.topbar-name {
  font-size: 16px;
  font-weight: 700;
}

.topbar-subtitle {
  font-size: 11px;
  color: var(--muted);
}

.topbar-right {
  display: flex;
  justify-content: flex-end;
}
.profile-menu{
  position: relative;
  display: inline-flex;
}
.profile-dropdown{
  position: absolute;
  top: 48px;
  right: 0;
  min-width: 170px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.5);
  display: none;
  z-index: 60;
}
.profile-dropdown.open{
  display: block;
}
.profile-dropdown-item{
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.profile-dropdown-item:hover{
  background: rgba(0, 94, 184, 0.18);
}
body.theme-light .profile-dropdown{
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15,23,42,0.12);
}
body.theme-light .profile-dropdown-item{
  color: #111827;
}


.profile-round {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.5);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Make the avatar perfectly round and able to show either initials or photo */
.profile-round .profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  background: var(--ppm-blue);
  color: #ffffff;
}

body.theme-light header.topbar {
  background: #ffffff;
}

body.theme-light .profile-round {
  background: #f9fafb;
}

body.theme-light .topbar-subtitle {
  color: #6b7280;
}

/* Sidebar header with collapse button */
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.sidebar-toggle {
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: transparent;
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  cursor: pointer;
}

/* Collapsed sidebar state (app.js toggles .sidebar-collapsed on body) */
body.sidebar-collapsed .sidebar {
  width: 54px !important;
  padding: 12px 8px 12px;
}

body.sidebar-collapsed .sidebar h3,
body.sidebar-collapsed .sidebar .filter-group,
body.sidebar-collapsed .sidebar .sidebar-legend-title {
  display: none;
}

body.sidebar-collapsed .sidebar .sidebar-head {
  justify-content: center;
}

body.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

/* AUTH PAGES */
body.auth-page {
  overflow: auto;
  height: auto;
  min-height: 100vh;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 520px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.75);
  box-shadow: var(--shadow);
  padding: 18px 18px 14px;
}

body.theme-light .auth-card {
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.auth-card h1 {
  font-size: 18px;
  margin-bottom: 4px;
}

.auth-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
}

.auth-error {
  border: 1px solid rgba(248, 113, 113, 0.6);
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  padding: 10px;
  border-radius: 10px;
  font-size: 12px;
  margin-bottom: 12px;
}

body.theme-light .auth-error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.auth-form input {
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  padding: 10px 12px;
  background: transparent;
  color: inherit;
  outline: none;
}

body.theme-light .auth-form input {
  background: #f9fafb;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 520px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }
}

.auth-links {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.auth-links a {
  color: var(--accent);
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

.auth-footer {
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

/* ==========================================================
   MODERN TECH THEME ENHANCEMENTS + COURSE PLAYER
   ========================================================== */

body {
  position: relative;
  isolation: isolate;
}

/* Animated “tech” backdrop + subtle grid (kept behind app UI) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 600px at 10% 10%, rgba(56, 189, 248, 0.22), transparent 55%),
    radial-gradient(800px 560px at 90% 20%, rgba(34, 211, 238, 0.18), transparent 50%),
    radial-gradient(900px 650px at 60% 90%, rgba(167, 139, 250, 0.16), transparent 55%),
    linear-gradient(180deg, rgba(2, 6, 23, 0.92), rgba(2, 6, 23, 0.92));
  filter: saturate(1.15);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.14) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.18;
  mask-image: radial-gradient(circle at 40% 10%, #000 0%, transparent 70%);
}

body.theme-light::before {
  background:
    radial-gradient(900px 600px at 10% 10%, rgba(59, 130, 246, 0.16), transparent 55%),
    radial-gradient(800px 560px at 90% 20%, rgba(14, 165, 233, 0.14), transparent 50%),
    radial-gradient(900px 650px at 60% 90%, rgba(139, 92, 246, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(229, 231, 235, 0.85), rgba(229, 231, 235, 0.85));
}

body.theme-light::after {
  opacity: 0.10;
}

.app-shell {
  backdrop-filter: blur(10px);
}

/* Info block tone variants (used for course navigation feedback) */
.info-block.info {
  background: rgba(30, 64, 175, 0.22);
  border-color: rgba(59, 130, 246, 0.5);
  color: #bfdbfe;
}

.info-block.warn {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.55);
  color: #fde68a;
}

.info-block.success {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.55);
  color: #bbf7d0;
}

body.theme-light .info-block.warn {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.45);
  color: #7c2d12;
}

body.theme-light .info-block.success {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.45);
  color: #14532d;
}

/* Resource “pills” (inline viewing via modal) */
.resource-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.resource-pill {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(2, 6, 23, 0.55);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.05s ease, border-color 0.15s ease, background 0.15s ease;
}

body.theme-light .resource-pill {
  background: #ffffff;
  color: #111827;
  border-color: rgba(148, 163, 184, 0.55);
}

.resource-pill:hover {
  border-color: rgba(56, 189, 248, 0.75);
  background: rgba(56, 189, 248, 0.10);
}

.resource-pill:active {
  transform: translateY(1px);
}

.resource-pill-icon {
  width: 18px;
  text-align: center;
}

.resource-pill-action {
  opacity: 0.7;
  margin-left: 2px;
}

.resource-video video {
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #000;
}

/* In-app resource modal */
.resource-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.resource-modal.open {
  display: flex;
}

.resource-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(4px);
}

.resource-modal-dialog {
  position: relative;
  width: min(980px, 94vw);
  height: min(78vh, 720px);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.theme-light .resource-modal-dialog {
  background: rgba(255, 255, 255, 0.96);
}

.resource-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.resource-modal-title {
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.resource-modal-download {
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(2, 6, 23, 0.45);
}

body.theme-light .resource-modal-download {
  background: #ffffff;
  color: #111827;
}

.resource-modal-download:hover {
  border-color: rgba(56, 189, 248, 0.75);
}

.resource-modal-close {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.resource-modal-close:hover {
  border-color: rgba(56, 189, 248, 0.75);
  background: rgba(56, 189, 248, 0.10);
}

.resource-modal-body {
  flex: 1;
  padding: 12px;
}

.resource-modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.35);
}

.resource-modal-body img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
}

.resource-modal-foot {
  padding: 0 12px 12px;
}

.resource-modal-note {
  font-size: 12px;
  color: var(--muted);
}

/* Course stepper/player UI */
.course-player {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.course-player-head {
  position: sticky;
  top: 0;
  z-index: 6;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(10px);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

body.theme-light .course-player-head {
  background: rgba(255, 255, 255, 0.85);
}

.course-player-step-title {
  font-size: 13px;
  font-weight: 800;
}

.course-player-step-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.course-player-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}

.course-player-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.course-player-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.95), rgba(34, 211, 238, 0.92), rgba(167, 139, 250, 0.90));
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.28);
  transition: width 0.18s ease;
}

.course-player-progress-label {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

.course-player-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.course-section.course-section--single {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.course-player-footer {
  position: sticky;
  bottom: 0;
  z-index: 6;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(10px);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

body.theme-light .course-player-footer {
  background: rgba(255, 255, 255, 0.85);
}

.course-player-footer-info {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 0 10px;
}

.course-player-footer .primary-btn,
.course-player-footer .secondary-btn {
  min-width: 140px;
}

@media (max-width: 720px) {
  .course-player-progress {
    display: none;
  }
  .course-player-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .course-player-footer-info {
    padding: 6px 0 0;
  }
  .course-player-footer .primary-btn,
  .course-player-footer .secondary-btn {
    width: 100%;
  }
}

/* Section checkpoint (mini quiz between sections) */
.section-checkpoint {
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(17, 24, 39, 0.92);
  border: 1px solid rgba(55, 65, 81, 0.85);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.55);
}

body.theme-light .section-checkpoint {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.section-checkpoint-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.section-checkpoint-question {
  font-size: 13px;
  margin-bottom: 8px;
}

.section-checkpoint-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.section-checkpoint-options label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  cursor: pointer;
}

.section-checkpoint-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.section-checkpoint-result {
  font-size: 12px;
  color: var(--muted);
}

.section-checkpoint-result.success {
  color: #bbf7d0;
}

.section-checkpoint-result.fail {
  color: #fecaca;
}

body.theme-light .section-checkpoint-result.success {
  color: #14532d;
}

body.theme-light .section-checkpoint-result.fail {
  color: #7f1d1d;
}

/* Quiz lock note */
.quiz-lock-note {
  margin: 10px 0 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.14);
  color: #fde68a;
  font-size: 12px;
}

body.theme-light .quiz-lock-note {
  color: #7c2d12;
}


/* ==========================================================
   ELEGANT DYNAMIC UI LAYER
   ========================================================== */
/* ==========================================================
   ELEGANT DYNAMIC UI LAYER
   ========================================================== */

/* Slightly more refined typography + smoothing */
html, body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root {
  --glow: rgba(56, 189, 248, 0.28);
  --glow-strong: rgba(56, 189, 248, 0.48);
  --purple-glow: rgba(167, 139, 250, 0.22);
  --ring: rgba(148, 163, 184, 0.35);
}

/* Page entry */
body.page-ready .app-shell,
body.page-ready .auth-card {
  animation: ui-fade-up 520ms ease both;
}

@keyframes ui-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Cursor glow (desktop only; JS positions this) */
.cursor-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 240ms ease;
}

.cursor-glow::before {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 999px;
  transform: translate3d(var(--x, -9999px), var(--y, -9999px), 0);
  background: radial-gradient(circle at 30% 30%, var(--glow-strong), transparent 60%);
  filter: blur(4px);
  opacity: 0.95;
}

body.has-cursor-glow .cursor-glow { opacity: 1; }

/* Floating orbs (subtle motion) */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 999px;
  filter: blur(28px);
  opacity: 0.55;
  transform: translate3d(0,0,0);
  will-change: transform;
  mix-blend-mode: screen;
}

.bg-orb.orb-a {
  left: -140px;
  top: -160px;
  background: radial-gradient(circle at 30% 30%, rgba(34, 211, 238, 0.55), transparent 60%);
  animation: orb-float-a 14s ease-in-out infinite;
}

.bg-orb.orb-b {
  right: -220px;
  top: 10vh;
  background: radial-gradient(circle at 30% 30%, rgba(167, 139, 250, 0.42), transparent 60%);
  animation: orb-float-b 18s ease-in-out infinite;
}

.bg-orb.orb-c {
  left: 10vw;
  bottom: -220px;
  background: radial-gradient(circle at 30% 30%, rgba(56, 189, 248, 0.42), transparent 60%);
  animation: orb-float-c 16s ease-in-out infinite;
}

@keyframes orb-float-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(80px, 60px) scale(1.06); }
}
@keyframes orb-float-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-90px, 70px) scale(1.05); }
}
@keyframes orb-float-c {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, -80px) scale(1.07); }
}

/* Topbar gains subtle “glass” + scroll state */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  transition: transform 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.topbar.topbar-scrolled {
  background: rgba(2, 6, 23, 0.62);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
}

/* Tab content transitions */
.tab-content {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}

.tab-content.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Reveal utility (IntersectionObserver adds .reveal-in) */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  filter: blur(2px);
  transition: opacity 520ms cubic-bezier(.2,.9,.2,1), transform 520ms cubic-bezier(.2,.9,.2,1), filter 520ms ease;
  will-change: opacity, transform, filter;
}

.reveal.reveal-in {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* Course cards: more premium + interactive tilt */
.course-card {
  --lift: 0px;
  --tiltX: 0deg;
  --tiltY: 0deg;
  --mx: 50%;
  --my: 15%;
  transform: translateY(var(--lift)) perspective(900px) rotateX(var(--tiltX)) rotateY(var(--tiltY));
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.course-card::before {
  background: radial-gradient(circle at var(--mx) var(--my), rgba(56,189,248,0.22), transparent 55%);
}

.course-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, rgba(56,189,248,0.72), rgba(167,139,250,0.55), rgba(34,211,238,0.55));
  opacity: 0;
  transition: opacity 220ms ease;
  pointer-events: none;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
}

.course-card:hover {
  --lift: -6px;
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
}

.course-card:hover::after {
  opacity: 0.9;
}

.course-card:active {
  --lift: -2px;
}

/* Buttons: subtle “sheen” */
.primary-btn {
  position: relative;
  overflow: hidden;
  transition: transform 120ms ease, filter 180ms ease, box-shadow 180ms ease;
}

.primary-btn::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.35), transparent 55%);
  transform: translateX(-35%) rotate(15deg);
  opacity: 0;
  transition: opacity 220ms ease, transform 520ms ease;
}

.primary-btn:hover::before {
  opacity: 0.9;
  transform: translateX(0%) rotate(15deg);
}

.primary-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:active {
  transform: translateY(0px);
}

/* Course-card button states */
.primary-btn.btn-complete {
  background: linear-gradient(to right, #16a34a, #22c55e) !important;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.45), 0 8px 16px rgba(22, 163, 74, 0.35) !important;
}

.primary-btn.btn-retake {
  background: linear-gradient(to right, #dc2626, #f87171) !important;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.45), 0 8px 16px rgba(220, 38, 38, 0.35) !important;
}

.retake-callout {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(220, 38, 38, 0.12);
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  text-align: center;
}

body.theme-light .retake-callout {
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.08);
  color: rgba(17, 24, 39, 0.86);
}

/* Chips feel more tactile */
.chip {
  transition: transform 120ms ease, border-color 180ms ease, background 180ms ease;
}
.chip:hover { transform: translateY(-1px); }

/* Status pill progress ring (set via JS using --p 0..1) */
.status-pill {
  position: relative;
  padding-left: 34px;
}

.status-pill .status-ring {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  border-radius: 999px;
  background:
    conic-gradient(rgba(56,189,248,0.95) calc(var(--p, 0) * 1turn), rgba(148,163,184,0.22) 0);
  box-shadow: 0 0 0 1px rgba(148,163,184,0.30);
}

body.theme-light .status-pill .status-ring {
  box-shadow: 0 0 0 1px rgba(148,163,184,0.40);
}

/* Skeleton cards (optional) */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.skeleton-card {
  border-radius: var(--radius);
  border: 1px solid rgba(148,163,184,0.20);
  background: rgba(15, 23, 42, 0.55);
  padding: 12px;
  overflow: hidden;
  position: relative;
}
.skeleton-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton-line {
  height: 10px;
  border-radius: 6px;
  background: rgba(148,163,184,0.16);
  margin: 10px 0;
}
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w40 { width: 40%; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .bg-orb, body.page-ready .app-shell, body.page-ready .auth-card { animation: none !important; }
  .reveal { transition: none !important; opacity: 1 !important; transform: none !important; filter: none !important; }
  .course-card { transition: none !important; transform: none !important; }
  .cursor-glow { display: none !important; }
}


/* Gradient headlines + subtle motion accents */
/* Gradient headlines + subtle motion accents */
body.theme-dark .topbar-name,
body.theme-dark h1,
body.theme-dark h2 {
  background: linear-gradient(90deg, rgba(56,189,248,1), rgba(167,139,250,1));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.theme-light .topbar-name,
body.theme-light h1,
body.theme-light h2 {
  color: #0f172a;
}

.status-pill > span:first-child {
  text-shadow: 0 0 18px rgba(56,189,248,0.45);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.65; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.25); }
}

.status-pill > span:first-child {
  animation: pulse-dot 1.8s ease-in-out infinite;
}

body.theme-light .status-pill > span:first-child {
  animation: none;
}

.profile-round {
  transition: transform 160ms ease, box-shadow 220ms ease;
}
.profile-round:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 12px 24px rgba(0,0,0,0.35);
}

/* Slightly nicer inputs */
input[type="search"], input[type="email"], input[type="password"], input[type="text"], select, textarea {
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input[type="search"]:focus, input[type="email"]:focus, input[type="password"]:focus, input[type="text"]:focus, select:focus, textarea:focus {
  border-color: rgba(56,189,248,0.65);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.18);
}


/* ==========================================================
   VARONIS-INSPIRED “UNIVERSITY” THEME (dark frame + light shell)
   - Dark “space” background around a white content shell
   - Hero banner + blue gradient bar
   - Black tiles with blue icon rings (category + course cards)
   ========================================================== */

body.theme-dark {
  padding: 0;
  background: radial-gradient(circle at 20% 10%, rgba(11, 91, 211, 0.22), transparent 40%),
              radial-gradient(circle at 80% 30%, rgba(0, 229, 255, 0.16), transparent 45%),
              radial-gradient(circle at 50% 90%, rgba(167, 139, 250, 0.14), transparent 55%),
              #05070d;
  color: #0b1220;
}

body.theme-dark::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255,255,255,0.12) 1px, transparent 1.5px),
    radial-gradient(circle at 30% 80%, rgba(255,255,255,0.10) 1px, transparent 1.5px),
    radial-gradient(circle at 70% 35%, rgba(255,255,255,0.09) 1px, transparent 1.5px),
    radial-gradient(circle at 90% 70%, rgba(255,255,255,0.08) 1px, transparent 1.5px);
  background-size: 420px 420px, 520px 520px, 610px 610px, 700px 700px;
  mix-blend-mode: screen;
}

body.theme-dark::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.10) 0px, rgba(255,255,255,0.10) 1px, transparent 1px, transparent 240px);
}

body.theme-dark .app-shell {
  max-width: 1220px;
  margin: 22px auto;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62);
  color: #0b1220;

  /* Token override (light shell) */
  --text: #0b1220;
  --muted: #475569;
  --border: rgba(15, 23, 42, 0.14);
  --accent: #0b5bd3;
  --accent-soft: rgba(11, 91, 211, 0.12);
  --shadow: 0 18px 52px rgba(0, 0, 0, 0.20);
}

/* Topbar becomes white like the reference */
body.theme-dark .topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

body.theme-dark .topbar .ppm-mark {
  background: #0b5bd3;
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.6), 0 12px 26px rgba(11,91,211,0.22);
}

body.theme-dark .status-pill {
  background: rgba(11, 91, 211, 0.08);
  border-color: rgba(11, 91, 211, 0.28);
  color: rgba(2, 6, 23, 0.68);
}

/* Tabs: clean + minimal */
body.theme-dark nav.tabs {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

body.theme-dark .tab {
  color: rgba(2, 6, 23, 0.68);
}

body.theme-dark .tab:hover {
  background: rgba(11, 91, 211, 0.08);
  color: rgba(2, 6, 23, 0.88);
}

body.theme-dark .tab.active {
  background: rgba(11, 91, 211, 0.12);
  color: rgba(2, 6, 23, 0.92);
  border: 1px solid rgba(11, 91, 211, 0.22);
}

/* Hero banner */
.portal-hero {
  padding: 18px 24px 0;
  background: transparent;
}

.portal-hero-media {
  height: 210px;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.35), rgba(0,0,0,0.08)),
    radial-gradient(circle at 30% 20%, rgba(11, 91, 211, 0.40), transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(0, 229, 255, 0.26), transparent 55%),
    linear-gradient(135deg, #0b1220, #1f2937);
  background-size: cover;
  background-position: center;
}

/* If you add an image at assets/hero.jpg it will automatically be used. */
.portal-hero-media {
  background-image:
    linear-gradient(90deg, rgba(0,0,0,0.35), rgba(0,0,0,0.08)),
    url("hero.jpg"),
    radial-gradient(circle at 30% 20%, rgba(11, 91, 211, 0.40), transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(0, 229, 255, 0.26), transparent 55%),
    linear-gradient(135deg, #0b1220, #1f2937);
}

/* Blue gradient bar under hero */
.portal-accent-bar {
  height: 56px;
  margin: 16px 24px 0;
  border-radius: 2px;
  background: linear-gradient(180deg, #001a3d, #0b5bd3);
  box-shadow: 0 12px 34px rgba(11, 91, 211, 0.18);
}

/* “All Courses” header stacks like the reference */
#all-courses .view-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

#all-courses .view-header h2 {
  font-size: 16px;
}

.portal-search {
  width: min(980px, 100%);
  display: flex;
  align-items: stretch;
  gap: 0;
}

.portal-search input {
  flex: 1;
  border: 1px solid rgba(15, 23, 42, 0.20);
  border-right: none;
  border-radius: 2px 0 0 2px;
  padding: 12px 12px;
  font-size: 14px;
  outline: none;
  background: #ffffff;
  color: rgba(2,6,23,0.92);
}

.portal-search input::placeholder { color: rgba(2,6,23,0.46); }

.portal-search input:focus {
  box-shadow: 0 0 0 3px rgba(11, 91, 211, 0.15);
  border-color: rgba(11, 91, 211, 0.35);
}

.search-btn {
  border: 1px solid rgba(11, 91, 211, 0.70);
  background: #0b5bd3;
  color: #ffffff;
  padding: 0 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 0 2px 2px 0;
  cursor: pointer;
}

.search-btn:hover { filter: brightness(1.05); }
.search-btn:active { transform: translateY(1px); }

/* Category tiles like the reference */
.category-tiles-wrap {
  margin-top: 18px;
}

.section-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: rgba(2, 6, 23, 0.72);
  margin: 0 0 10px;
}

.category-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.category-tile {
  border: none;
  background: #05070d;
  color: #ffffff;
  padding: 22px 16px 20px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, filter 180ms ease;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
}

.category-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 25%, rgba(11, 91, 211, 0.18), transparent 55%);
  opacity: 0.9;
  pointer-events: none;
}

.category-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 58px rgba(0,0,0,0.45);
}

.category-tile.active {
  box-shadow: 0 0 0 2px rgba(11, 91, 211, 0.70), 0 22px 58px rgba(0,0,0,0.45);
}

.category-tile .cat-icon,
.course-icon-circle {
  width: 74px;
  height: 74px;
  border-radius: 999px;
  border: 2px solid rgba(11, 91, 211, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px;
  background: rgba(2, 6, 23, 0.75);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 12px 26px rgba(0,0,0,0.35);
  position: relative;
  z-index: 1;
}

.category-tile .cat-title {
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 14px;
  position: relative;
  z-index: 1;
}

.category-tile .cat-sub {
  text-align: center;
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.72);
  position: relative;
  z-index: 1;
}

/* Course grid becomes “tiles” */
body.theme-dark .course-grid {
  gap: 16px;
}

body.theme-dark .course-card {
  background: #05070d;
  --radius: 0px;
  border-radius: 0;
  border: 1px solid rgba(11, 91, 211, 0.35);
  box-shadow: 0 18px 46px rgba(0,0,0,0.35);
  align-items: center;
  text-align: center;
  padding: 22px 16px 16px;
  gap: 10px;
}

body.theme-dark .course-card::before {
  background: radial-gradient(circle at 30% 25%, rgba(11, 91, 211, 0.18), transparent 55%);
}

body.theme-dark .course-title {
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 14px;
  color: rgba(255,255,255,0.96);
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.20);
  color: rgba(255,255,255,0.75);
  font-size: 10px;
  letter-spacing: 0.02em;
  background: rgba(2, 6, 23, 0.6);
  white-space: nowrap;
}

body.theme-light .meta-pill {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.14);
  color: rgba(17, 24, 39, 0.72);
}

.meta-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  flex: 0 0 auto;
  opacity: 0.92;
}

.meta-icon.meter.meter-beginner { color: #22c55e; }
.meta-icon.meter.meter-intermediate { color: #eab308; }
.meta-icon.meter.meter-expert { color: #ef4444; }

body.theme-dark .course-meta {
  justify-content: center;
  color: rgba(255,255,255,0.75);
}

body.theme-dark .course-desc {
  color: rgba(255,255,255,0.78);
  font-size: 12px;
  line-height: 1.35;
  max-width: 44ch;
  margin: 0 auto;
}

/* Keep the card clean: tags appear only on hover */
body.theme-dark .course-tags { 
  display: none;
  justify-content: center;
}
body.theme-dark .course-card:hover .course-tags { display: flex; }

body.theme-dark .tag-pill {
  background: rgba(2, 6, 23, 0.65);
  color: rgba(255,255,255,0.78);
  border-color: rgba(255,255,255,0.16);
}

body.theme-dark .course-actions {
  width: 100%;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

body.theme-dark .course-actions .primary-btn {
  width: 100%;
  max-width: 230px;
  margin: 0 auto;
  background: #0b5bd3;
  border-color: rgba(11, 91, 211, 0.70);
}

body.theme-dark .bookmark-btn {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.86);
}

/* Auth pages: match light shell */
body.theme-dark.auth-page .auth-card {
  background: rgba(255, 255, 255, 0.96);
  color: rgba(2,6,23,0.92);
  border-color: rgba(15, 23, 42, 0.14);
}

body.theme-dark.auth-page .auth-subtitle,
body.theme-dark.auth-page label span {
  color: rgba(2, 6, 23, 0.62);
}

body.theme-dark.auth-page input,
body.theme-dark.auth-page select {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.18);
  color: rgba(2,6,23,0.92);
}

body.theme-dark.auth-page .auth-links a {
  color: rgba(11, 91, 211, 0.92);
}

@media (max-width: 760px) {
  .portal-hero { padding: 14px 14px 0; }
  .portal-accent-bar { margin: 14px 14px 0; }
  .portal-hero-media { height: 160px; }
  body.theme-dark .app-shell { margin: 10px; }
}

/* ==========================================================
   MONOCHROME OVERRIDES (Black / White only)
   - Removes colored accents (blues/purples)
   - Keeps the same layout but with grayscale styling
   ========================================================== */

/* Global: remove gradient headline coloring */
body.theme-dark .topbar-name,
body.theme-dark h1,
body.theme-dark h2 {
  /* Monochrome headline mode: keep it readable on dark surfaces */
  background: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
  color: var(--text) !important;
}

.status-pill > span:first-child {
  text-shadow: none !important;
  animation: none !important;
}

/* Dark theme = black frame + white shell */
body.theme-dark {
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,0.06), transparent 42%),
    radial-gradient(circle at 82% 30%, rgba(255,255,255,0.05), transparent 46%),
    radial-gradient(circle at 50% 92%, rgba(255,255,255,0.04), transparent 56%),
    #05070d !important;
}

body.theme-dark .app-shell {
  --accent: #111111 !important;
  --accent-soft: rgba(0, 0, 0, 0.08) !important;
}

body.theme-dark .topbar .ppm-mark {
  background: #111111 !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.6), 0 12px 26px rgba(0,0,0,0.20) !important;
}

body.theme-dark .status-pill {
  background: rgba(0, 0, 0, 0.06) !important;
  border-color: rgba(0, 0, 0, 0.18) !important;
}

body.theme-dark .tab:hover {
  background: rgba(0,0,0,0.06) !important;
}

body.theme-dark .tab.active {
  background: rgba(0,0,0,0.08) !important;
  border-color: rgba(0,0,0,0.18) !important;
}

/* Remove hero + accent visuals if present in any markup */
.portal-hero,
.portal-accent-bar {
  display: none !important;
}

/* Search bar button: monochrome */
.search-btn {
  background: #111111 !important;
  border-color: rgba(0, 0, 0, 0.70) !important;
}

.portal-search input:focus {
  box-shadow: 0 0 0 3px rgba(0,0,0,0.10) !important;
  border-color: rgba(0,0,0,0.35) !important;
}

/* Tile rings + highlights: grayscale */
.category-tile::before,
body.theme-dark .course-card::before {
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.10), transparent 55%) !important;
}

.category-tile.active {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.55), 0 22px 58px rgba(0,0,0,0.45) !important;
}

.category-tile .cat-icon,
.course-icon-circle {
  border-color: rgba(255,255,255,0.75) !important;
}

body.theme-dark .course-card {
  border-color: rgba(255,255,255,0.18) !important;
}

body.theme-dark .course-actions .primary-btn {
  background: #111111 !important;
  border-color: rgba(0,0,0,0.70) !important;
}

/* Auth link accents */
body.theme-dark.auth-page .auth-links a {
  color: var(--text) !important;
}

/* Light theme = clean white with black accents */
body.theme-light {
  background: #f4f4f5 !important;
}

body.theme-light .app-shell {
  --accent: #111111 !important;
  --accent-soft: rgba(0, 0, 0, 0.08) !important;
}

body.theme-light .primary-btn {
  background: #111111 !important;
  border-color: #111111 !important;
  color: #ffffff !important;
}

body.theme-light a {
  color: #111111 !important;
}

/* -------------------------------------------------------
   Final Quiz lock state + quiz result modal
   ------------------------------------------------------- */

.section-nav-item.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.section-nav-item.locked:hover {
  background: transparent;
  color: var(--muted);
}

.section-nav-item.locked .section-nav-bullet {
  background: rgba(148, 163, 184, 0.35);
}

.section-nav-item.failed .section-nav-bullet {
  background: var(--danger);
}

.quiz-result-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
}

.quiz-result-modal.open {
  display: flex;
}

.quiz-result-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(3px);
}

.quiz-result-dialog {
  position: relative;
  width: min(520px, 92vw);
  padding: 18px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 2;
}

.quiz-result-score {
  font-size: 22px;
  font-weight: 800;
  margin-top: 10px;
}

.quiz-result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}



/* ==========================================================
   THEME TOGGLE (SLIDING SWITCH)
   ========================================================== */

.theme-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.theme-toggle-icon {
  font-size: 12px;
  line-height: 1;
  opacity: 0.72;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.10);
  border: 1px solid rgba(15, 23, 42, 0.18);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 2px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.22);
  transition: transform 0.2s ease, background 0.2s ease;
}

.switch input:checked + .slider {
  background: rgba(2, 6, 23, 0.92);
  border-color: rgba(2, 6, 23, 0.92);
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
  background: #ffffff;
}

.switch input:focus-visible + .slider {
  outline: none;
  box-shadow: 0 0 0 3px rgba(11, 91, 211, 0.18);
}

.auth-card-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.profile-theme-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================
   THEME SURFACE SAFETY FIXES
   - Prevents dark text rendering on dark tiles when the shell is light
   ========================================================== */

body.theme-light {
  --card: #ffffff;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f3f4f6;
  --hover-bg: rgba(2, 6, 23, 0.06);
  --inset-bg: rgba(2, 6, 23, 0.04);
}

body.theme-dark .app-shell {
  /* Dark mode should remain dark throughout.
     These are intentionally *not* light shell overrides. */
}

/* Course detail surfaces */
.course-body {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--inset-bg);
}

.section-nav {
  background: var(--surface-2);
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
}

.section-nav-item:hover {
  background: var(--hover-bg);
  color: var(--text);
}

.section-check {
  background: var(--surface-3);
  color: var(--muted);
  box-shadow: 0 2px 4px rgba(0,0,0,0.10);
}

.quiz-container {
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: 0 6px 14px rgba(0,0,0,0.18);
}

.resources-block {
  background: var(--surface-2);
}

/* Sidebar chips */
.chip {
  background: var(--surface-2);
  color: var(--muted);
}

.chip:hover {
  background: var(--hover-bg);
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.7);
}

/* Tag pills on dark tiles */
body.theme-dark .course-card .tag-pill {
  background: rgba(2, 6, 23, 0.60);
  border-color: rgba(255,255,255,0.20);
  color: rgba(255,255,255,0.78);
}

/* Info blocks: default info tone needs readable text on a light shell */
body.theme-light .info-block.info {
  background: rgba(11, 91, 211, 0.10);
  border-color: rgba(11, 91, 211, 0.26);
  color: rgba(2, 6, 23, 0.82);
}


.chip.active {
  color: var(--text);
}

.tag-pill {
  background: var(--surface-2);
  color: var(--muted);
}


/* ==========================================================
   TEXT VISIBILITY FIXES (theme switching)
   ========================================================== */

/* Profile dropdown: must follow shell surfaces so text never disappears */
.profile-dropdown {
  background: var(--surface, rgba(15, 23, 42, 0.98));
  box-shadow: 0 18px 40px rgba(0,0,0,0.18);
}


/* Empty-state used in admin + other views should remain readable in both themes */
.empty-state {
  background: var(--surface-2, rgba(15, 23, 42, 0.90));
  border: 1px dashed var(--border, rgba(75, 85, 99, 0.90));
  color: var(--muted, #cbd5e1);
}

.empty-state strong {
  color: var(--text, #ffffff);
}

/* Hover color should not wash out on light theme */
.back-link:hover {
  color: var(--text, #ffffff);
}


/* ==========================================================
   FULL DARK THEME OVERRIDES
   - Ensure switching to dark mode updates the *entire* UI
     (no remaining light/white shell surfaces)
   ========================================================== */

body.theme-dark {
  /* Restore dark tokens in case an earlier section applied a light-shell style */
  --bg: #0f172a;
  --bg-alt: #111827;
  --panel: rgba(15,23,42,0.96);
  --panel-2: rgba(15,23,42,0.98);
  --header-bg: radial-gradient(circle at top left, #1e293b, #020617);
  --page-bg: radial-gradient(circle at top left, #1e293b, #020617);
  --text: #ffffff;
  --muted: #cbd5e1;
  --muted2: #94a3b8;
  --border: #374151;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);

  /* Unified surfaces used by course templates + dropdowns + modals */
  --surface: rgba(15,23,42,0.96);
  --surface-2: rgba(17,24,39,0.95);
  --surface-3: rgba(2,6,23,0.90);
  --hover-bg: rgba(255,255,255,0.06);
  --inset-bg: rgba(255,255,255,0.08);

  background: var(--page-bg);
  color: var(--text);
}

body.theme-dark .app-shell {
  background: linear-gradient(145deg, var(--panel), var(--panel-2));
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.15);
  box-shadow: var(--shadow);
}

body.theme-dark header.topbar,
body.theme-dark .topbar,
body.theme-dark nav.tabs,
body.theme-dark .tabs {
  background: var(--header-bg);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

body.theme-dark .tab {
  color: var(--muted);
}

body.theme-dark .tab.active {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.22);
}

/* Dark theme info blocks + badges should stay readable on dark surfaces */
body.theme-dark .info-block.info {
  background: rgba(0, 94, 184, 0.16);
  border-color: rgba(0, 94, 184, 0.30);
  color: rgba(255,255,255,0.92);
}

body.theme-dark .badge {
  background: rgba(255,255,255,0.06);
  border-color: rgba(148, 163, 184, 0.22);
  color: rgba(255,255,255,0.86);
}

body.theme-dark .status-pill {
  color: rgba(255,255,255,0.88);
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(255,255,255,0.06);
}

body.theme-dark .app-shell .badge {
  background: rgba(255,255,255,0.06);
  border-color: rgba(148, 163, 184, 0.22);
  color: rgba(255,255,255,0.86);
}

body.theme-dark.auth-page .auth-card {
  background: var(--surface);
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.22);
}

body.theme-dark.auth-page .auth-subtitle,
body.theme-dark.auth-page label span {
  color: var(--muted);
}

body.theme-dark.auth-page input,
body.theme-dark.auth-page select {
  background: var(--surface-2);
  border-color: rgba(148, 163, 184, 0.22);
  color: var(--text);
}


/* Dark theme: ensure portal search + section labels remain readable */
body.theme-dark .portal-search input {
  background: var(--surface-2);
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.22);
}

body.theme-dark .portal-search input::placeholder {
  color: var(--muted2);
}

body.theme-dark .section-label {
  color: var(--muted);
}



/* ==========================================================
   ENFORCED LIGHT THEME (separate file)
   Requirement: All text must be BLACK for visibility
   ========================================================== */

:root{
  --bg: #ffffff !important;
  --bg-alt: #f8fafc !important;
  --panel: #ffffff !important;
  --panel-2: #ffffff !important;
  --header-bg: #ffffff !important;
  --page-bg: #ffffff !important;
  --card: #ffffff !important;
  --text: #000000 !important;
  --muted: #000000 !important;
  --border: #e5e7eb !important;
  --shadow: 0 10px 30px rgba(0,0,0,0.08) !important;
}

body{
  background: #ffffff !important;
  color: #000000 !important;
}

/* Make sure ALL text is black */
body, body *{
  color: #000000 !important;
}

/* Ensure common surfaces are light so black text stays readable */
.app-shell,
header,
header.topbar,
nav.tabs,
.sidebar,
.content-area,
.course-body,
.section-nav,
.course-panel,
.course-card,
.profile-card,
.profile-dropdown,
.terms-dialog,
.terms-modal,
.modal-content,
.quiz-container,
.quiz-result-modal,
.auth-card,
.admin-card,
.admin-table,
table,
th,
td{
  background: #ffffff !important;
}

/* Inputs */
input, select, textarea{
  background: #ffffff !important;
  border-color: #e5e7eb !important;
}

/* Placeholders */
input::placeholder, textarea::placeholder{
  color: #000000 !important;
  opacity: 0.65;
}

/* Buttons - keep readable with black text */
.primary-btn, .secondary-btn, button{
  background: #e5e7eb !important;
  border-color: #d1d5db !important;
  box-shadow: none !important;
}

/* Badges + pills */
.badge, .status-pill, .tag-pill, .chip{
  background: #f3f4f6 !important;
  border-color: #e5e7eb !important;
}

/* Links */
a, a:visited, a:hover{
  color: #000000 !important;
}
