    :root {
      --primary: #10B981;
      --primary-dark: #059669;
      --primary-deep: #047857;
      --primary-soft: #D1FAE5;
      --primary-tint: #ECFDF5;
      --bg: #F2FBF6;
      --surface: #FFFFFF;
      --border: #C6F6D5;
      --text: #062E22;
      --muted: #3F6254;
      --warning: #F59E0B;
      --danger: #EF4444;
    }
    * { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
    body { background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.5; }
    a { text-decoration: none; color: inherit; }

    /* TOPBAR */
    .topbar {
      background: linear-gradient(135deg, #10B981 0%, #059669 60%, #047857 100%);
      color: #fff; padding: 14px 24px;
      display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
      box-shadow: 0 4px 20px rgba(5, 150, 105, 0.2);
      position: sticky; top: 0; z-index: 50;
    }
    .brand { display: flex; align-items: center; gap: 12px; }
    .brand-logo {
      width: 40px; height: 40px; border-radius: 12px;
      background: rgba(255,255,255,0.22); border: 1px solid rgba(255,255,255,0.35);
      display: flex; align-items: center; justify-content: center;
      font-weight: 900; font-size: 18px;
    }

    /* APP SHELL (SIDEBAR + PAGE CONTENT) */
    .app-shell {
      display: grid;
      grid-template-columns: 270px 1fr;
      min-height: calc(100vh - 68px);
    }

    /* GLOBAL SLEEK SCROLLBAR */
    @keyframes qrPulseGlow {
      0% { transform: scale(0.92); opacity: 0.6; }
      50% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 10px rgba(16,185,129,0.7); }
      100% { transform: scale(0.92); opacity: 0.6; }
    }
    .qr-pulse-dot {
      width: 9px;
      height: 9px;
      border-radius: 50%;
      background: #10B981;
      display: inline-block;
      animation: qrPulseGlow 1.8s infinite ease-in-out;
    }
    ::-webkit-scrollbar {
      width: 6px;
      height: 6px;
    }
    ::-webkit-scrollbar-track {
      background: transparent;
    }
    ::-webkit-scrollbar-thumb {
      background: rgba(16, 185, 129, 0.28);
      border-radius: 999px;
      transition: background 0.2s ease;
    }
    ::-webkit-scrollbar-thumb:hover {
      background: rgba(5, 150, 105, 0.65);
    }
    * {
      scrollbar-width: thin;
      scrollbar-color: rgba(16, 185, 129, 0.3) transparent;
    }

    /* SIDEBAR MENU (ALIGNED TO TOP, FIXED BOTTOM FOOTER) */
    .sidebar {
      background: #FFFFFF;
      border-right: 1.5px solid var(--border);
      padding: 0;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      position: fixed;
      top: 68px;
      left: 0;
      width: 270px;
      height: calc(100vh - 68px);
      z-index: 40;
      box-shadow: 2px 0 16px rgba(0, 0, 0, 0.02);
      overflow: hidden;
    }
    .sidebar-scrollable {
      flex: 1;
      overflow-y: auto;
      padding: 16px 14px 10px;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      gap: 0;
    }
    .sidebar-scrollable::-webkit-scrollbar {
      width: 5px;
    }
    .sidebar-scrollable::-webkit-scrollbar-thumb {
      background: rgba(16, 185, 129, 0.22);
      border-radius: 999px;
    }
    .sidebar-scrollable::-webkit-scrollbar-thumb:hover {
      background: rgba(5, 150, 105, 0.55);
    }

    #sidebarUserProfile {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px;
      background: var(--primary-tint);
      border: 1.5px solid var(--border);
      border-radius: 14px;
      margin-bottom: 12px;
      cursor: pointer;
      transition: all 0.16s ease;
      flex-shrink: 0;
    }
    #sidebarUserProfile:hover {
      background: #E6FBF0;
      border-color: #86EFAC;
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(5, 150, 105, 0.08);
    }
    #sidebarUserAvatar {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      background: #FFFFFF;
      border: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      flex-shrink: 0;
      overflow: hidden;
    }

    .sidebar-nav-container {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .nav-group-label {
      font-size: 10.5px;
      font-weight: 800;
      color: #64748B;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      padding: 10px 12px 4px;
      margin-top: 2px;
    }
    .nav-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 9.5px 13px;
      border-radius: 12px;
      font-size: 13.5px;
      font-weight: 700;
      color: #334155;
      cursor: pointer;
      transition: all 0.16s cubic-bezier(0.4, 0, 0.2, 1);
      margin-bottom: 3px;
      border: 1px solid transparent;
      user-select: none;
    }
    .nav-item-left {
      display: flex;
      align-items: center;
      gap: 11px;
    }
    .nav-item-left span:first-child {
      font-size: 16px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 22px;
    }
    .nav-item:hover {
      background: #F0FDF4;
      color: #047857;
      border-color: #D1FAE5;
      transform: translateX(3px);
    }
    .nav-item.active {
      background: linear-gradient(135deg, #10B981 0%, #059669 100%);
      color: #FFFFFF;
      font-weight: 800;
      box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28);
      border-color: transparent;
      transform: none;
    }
    .nav-item.active .nav-item-left span:first-child {
      filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
    }
    .nav-badge {
      font-size: 11px;
      font-weight: 800;
      padding: 2px 7.5px;
      border-radius: 999px;
      background: #D1FAE5;
      color: #065F46;
      transition: all 0.16s ease;
    }
    .nav-item.active .nav-badge {
      background: rgba(255, 255, 255, 0.28);
      color: #FFFFFF;
    }

    /* SIDEBAR FIXED BOTTOM FOOTER */
    .sidebar-footer {
      flex-shrink: 0;
      padding: 12px 14px 14px;
      border-top: 1px solid #E2E8F0;
      background: #FFFFFF;
    }
    .sidebar-code-box {
      background: linear-gradient(135deg, #ECFDF5 0%, #F0FDF4 100%);
      border: 1.5px solid #A7F3D0;
      border-radius: 14px;
      padding: 11px 13px;
      box-shadow: 0 2px 8px rgba(5, 150, 105, 0.05);
      transition: all 0.18s ease;
    }
    .sidebar-code-box:hover {
      border-color: #6EE7B7;
      box-shadow: 0 4px 12px rgba(5, 150, 105, 0.1);
    }

    /* MAIN PAGE AREA */
    .main-area {
      grid-column: 2;
      padding: 26px 30px 60px;
      max-width: 1180px;
      width: 100%;
      margin: 0 auto;
    }
    @media (max-width: 960px) {
      .app-shell { grid-template-columns: 1fr; }
      .sidebar {
        position: static;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1.5px solid var(--border);
        box-shadow: none;
      }
      .sidebar-scrollable {
        overflow-y: visible;
        max-height: none;
        padding: 14px 14px 6px;
      }
      .sidebar-footer {
        border-top: 1px solid var(--border);
        padding: 10px 14px 14px;
      }
      .main-area { grid-column: 1; }
    }
    @media (max-width: 768px) { .main-area { padding: 18px 14px 48px; } }

    .page-view { display: none; animation: fadeIn 0.16s ease; }
    .page-view.active { display: block; }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

    .page-header {
      display: flex; align-items: flex-start; justify-content: space-between;
      flex-wrap: wrap; gap: 14px; margin-bottom: 22px;
    }
    .page-title { font-size: 23px; font-weight: 900; color: var(--text); }
    .page-subtitle { font-size: 13.5px; color: var(--muted); margin-top: 2px; }

    /* CARDS & GRIDS */
    .card {
      background: var(--surface); border: 1.5px solid var(--border);
      border-radius: 18px; padding: 22px; margin-bottom: 18px;
      box-shadow: 0 4px 16px rgba(6, 46, 34, 0.03);
    }
    .stats-grid {
      display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
      gap: 16px; margin-bottom: 20px;
    }
    .stat-card {
      background: #fff; border: 1.5px solid var(--border); border-radius: 16px; padding: 18px 20px;
      display: flex; flex-direction: column; gap: 4px;
    }
    .stat-label { font-size: 12.5px; font-weight: 700; color: var(--muted); }
    .stat-value { font-size: 28px; font-weight: 900; color: var(--primary-deep); }
    .stat-meta { font-size: 12px; color: var(--muted); }

    .grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
    @media (max-width: 860px) { .grid-2col { grid-template-columns: 1fr; } }

    /* BUTTONS */
    .btn {
      display: inline-flex; align-items: center; justify-content: center; gap: 7px;
      padding: 10px 16px; border-radius: 11px; font-weight: 700; font-size: 13.5px;
      cursor: pointer; border: 1.5px solid transparent; transition: all 0.15s ease;
    }
    .btn:disabled { opacity: 0.6; cursor: not-allowed; }
    .btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
    .btn-primary {
      background: linear-gradient(135deg, #10B981, #059669);
      color: #fff; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
    }
    .btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35); }
    .btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
    .btn-outline:hover:not(:disabled) { background: var(--primary-tint); border-color: var(--primary); color: var(--primary-deep); }
    .btn-danger { background: #FEE2E2; color: #B91C1C; border-color: #FECACA; }
    .btn-danger:hover:not(:disabled) { background: #FECACA; }

    /* INPUTS */
    .input, select, textarea {
      width: 100%; padding: 10px 13px; border: 1.5px solid var(--border);
      border-radius: 11px; font-size: 14px; color: var(--text); background: #fff;
      transition: 0.15s;
    }
    .input:focus, select:focus, textarea:focus {
      outline: none; border-color: var(--primary);
      box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
    }
    label { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }

    /* SWITCH / CHECKBOX CARD */
    .setting-toggle {
      display: flex; align-items: center; justify-content: space-between; gap: 14px;
      padding: 13px 16px; border: 1.5px solid var(--border); border-radius: 13px;
      background: #FAFFFC; cursor: pointer; margin-bottom: 10px;
    }
    .setting-toggle:hover { border-color: var(--primary); background: var(--primary-tint); }
    .setting-toggle input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary-dark); cursor: pointer; }

    /* RICH TEXT TOOLBAR */
    .toolbar {
      display: flex; flex-wrap: wrap; gap: 6px; padding: 10px;
      background: var(--primary-tint); border: 1.5px solid var(--border);
      border-radius: 12px 12px 0 0; border-bottom: none;
    }
    .tool-btn {
      padding: 6px 11px; border-radius: 8px; border: 1px solid var(--border);
      background: #fff; font-size: 12.5px; font-weight: 700; color: var(--text); cursor: pointer;
    }
    .tool-btn:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-deep); }
    .harakat-bar {
      display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px;
      background: #E6F9EF; border-left: 1.5px solid var(--border); border-right: 1.5px solid var(--border);
    }
    .preview-box {
      margin-top: 10px; padding: 14px 16px; border-radius: 12px;
      background: #F7FDF9; border: 1.5px dashed #6EE7B7; min-height: 54px;
    }
    .rtl-text {
      direction: rtl; text-align: right; font-size: 23px; line-height: 2.0;
      font-family: "Traditional Arabic", "Amiri", "Scheherazade New", "Geeza Pro", serif;
    }

    /* TABLES & PILLS */
    .pill {
      display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
      font-size: 12px; font-weight: 700; background: var(--primary-soft); color: var(--primary-deep);
    }
    .pill { white-space: nowrap; }
    .pill-warn { background: #FEF3C7; color: #92400E; }
    .pill-batal { background: #F1F5F9; color: #475569; border: 1px solid #CBD5E1; }
    .pill-draft { background: #FEF3C7; color: #92400E; }
    .pill-danger { background: #FEE2E2; color: #B91C1C; }

    table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
    table.data-table th, table.data-table td {
      padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left;
    }
    table.data-table th {
      background: var(--primary-tint); font-weight: 800; color: var(--primary-deep);
      font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
    }
    table.data-table tr:hover td { background: #FAFFFC; }

    table.rich-table { border-collapse: collapse; width: 100%; margin: 8px 0; }
    table.rich-table th, table.rich-table td { border: 1px solid #A7F3D0; padding: 8px 12px; text-align: left; }
    table.rich-table th { background: var(--primary-soft); font-weight: 700; }

    .tabs { display: flex; gap: 6px; background: var(--primary-tint); padding: 5px; border-radius: 12px; margin-bottom: 18px; border: 1px solid var(--border); }
    .tab { flex: 1; text-align: center; padding: 9px 6px; border-radius: 9px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--muted); }
    .tab.active { background: var(--primary); color: #fff; }

    .q-card { padding: 16px; border: 1.5px solid var(--border); border-radius: 14px; background: #FAFFFC; }
    .q-card img, .preview-box img { max-width: 100%; max-height: 240px; border-radius: 10px; margin: 6px 0; border: 1px solid var(--border); }

    /* MODAL */
    .modal-backdrop {
      position: fixed; inset: 0; background: rgba(6, 46, 34, 0.45); backdrop-filter: blur(3px);
      display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
    }
    .modal-backdrop.open { display: flex; }
    .modal-card {
      background: #fff; border: 1.5px solid var(--border); border-radius: 20px;
      max-width: 680px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 24px;
      box-shadow: 0 20px 50px rgba(0,0,0,0.2);
      --mp: 24px; /* padding kartu; dipakai header agar menempel rapat di tepi atas saat digulir */
    }
    .modal-card[style*="padding:20px"] { --mp: 20px; }
    .modal-card[style*="padding:0"] { --mp: 0px; }
    /* Header modal (judul + tombol Tutup) selalu di paling atas walau isi modal digulir. */
    .modal-card > div:first-child[style*="justify-content:space-between"]:not([style*="background"]) {
      position: sticky; top: calc(-1 * var(--mp)); z-index: 20; background: #fff;
      margin-top: calc(-1 * var(--mp)); margin-left: calc(-1 * var(--mp)); margin-right: calc(-1 * var(--mp));
      padding: var(--mp) var(--mp) 10px;
      box-shadow: 0 10px 0 0 #fff;
    }

    /* GLOBAL PROGRESS BAR & LOADING OVERLAY */
    #globalTopProgressBar {
      position: fixed;
      top: 0;
      left: 0;
      height: 3px;
      width: 0%;
      background: linear-gradient(90deg, #10B981, #059669, #34D399);
      z-index: 999999;
      transition: width 0.25s ease, opacity 0.4s ease;
      box-shadow: 0 0 10px rgba(16, 185, 129, 0.7);
      pointer-events: none;
    }
    #globalPageLoader {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(255, 255, 255, 0.88);
      backdrop-filter: blur(5px);
      z-index: 99999;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      gap: 14px;
    }
    .loading-spinner-circle {
      width: 44px;
      height: 44px;
      border: 4px solid #E2E8F0;
      border-top-color: var(--primary);
      border-radius: 50%;
      animation: spinAnim 0.75s linear infinite;
    }
    .spinner-sm {
      display: inline-block;
      width: 13px;
      height: 13px;
      border: 2px solid rgba(255, 255, 255, 0.4);
      border-top-color: #ffffff;
      border-radius: 50%;
      animation: spinAnim 0.65s linear infinite;
      vertical-align: middle;
      margin-right: 6px;
    }
    .btn-outline .spinner-sm, .btn-danger .spinner-sm {
      border-color: rgba(6, 95, 70, 0.25);
      border-top-color: var(--primary-deep);
    }
    .btn-danger .spinner-sm {
      border-color: rgba(220, 38, 38, 0.3);
      border-top-color: #DC2626;
    }
    @keyframes spinAnim {
      to { transform: rotate(360deg); }
    }

    /* PASSWORD INPUT WITH EYE TOGGLE */
    .pw-field-wrap {
      position: relative;
      display: flex;
      align-items: center;
    }
    .pw-field-wrap .input {
      padding-right: 44px;
    }
    .pw-eye-btn {
      position: absolute;
      right: 8px;
      top: 50%;
      transform: translateY(-50%);
      width: 32px;
      height: 32px;
      border: none;
      background: transparent;
      color: var(--muted);
      border-radius: 8px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: all 0.15s ease;
    }
    .pw-eye-btn:hover {
      background: var(--primary-soft);
      color: var(--primary-deep);
    }
    .pw-eye-btn svg {
      width: 19px;
      height: 19px;
      stroke: currentColor;
      fill: none;
      stroke-width: 2;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    /* MEMBER AVATARS & BULK PHOTO STYLES */
    .member-avatar-circle {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      border: 1.5px solid #E2E8F0;
      background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
      position: relative;
      overflow: hidden;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    }
    .member-avatar-circle img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .member-avatar-circle .avatar-initials {
      font-size: 13.5px;
      font-weight: 800;
      color: #047857;
      user-select: none;
    }
    .avatar-clickable {
      cursor: pointer;
      transition: transform 0.15s ease, box-shadow 0.15s ease;
    }
    .avatar-clickable:hover {
      transform: scale(1.08);
      box-shadow: 0 0 0 2px var(--primary);
    }
    .avatar-overlay-cam {
      position: absolute;
      inset: 0;
      background: rgba(4, 120, 87, 0.72);
      display: none;
      align-items: center;
      justify-content: center;
      color: #ffffff;
      font-size: 13px;
      border-radius: 50%;
    }
    .avatar-clickable:hover .avatar-overlay-cam {
      display: flex;
    }
    .bulk-dropzone {
      border: 2px dashed #6EE7B7;
      border-radius: 16px;
      background: #F0FDF4;
      padding: 24px 16px;
      text-align: center;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .bulk-dropzone:hover, .bulk-dropzone.dragover {
      border-color: #059669;
      background: #ECFDF5;
      box-shadow: 0 4px 16px rgba(5, 150, 105, 0.12);
    }
    .bulk-stat-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 10px;
      border-radius: 8px;
      font-size: 12px;
      font-weight: 700;
    }
    .bulk-stat-pill.success {
      background: #DCFCE7;
      color: #15803D;
      border: 1px solid #86EFAC;
    }
    .bulk-stat-pill.warning {
      background: #FEF3C7;
      color: #B45309;
      border: 1px solid #FCD34D;
    }
    .bulk-stat-pill.danger {
      background: #FEE2E2;
      color: #B91C1C;
      border: 1px solid #FCA5A5;
    }
    .bulk-preview-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 8px 12px;
      border-bottom: 1px solid #F1F5F9;
      font-size: 12.5px;
    }
    .bulk-preview-item:last-child {
      border-bottom: none;
    }

    /* REORDER QUESTIONS MODAL ITEM STYLES */
    .reorder-q-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 9px 12px;
      background: #FFFFFF;
      border: 1.5px solid var(--border);
      border-radius: 10px;
      cursor: grab;
      user-select: none;
      transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
    }
    .reorder-q-item:hover {
      border-color: var(--primary);
      background: #F8FAFC;
    }
    .reorder-q-item.is-dragging {
      opacity: 0.45;
      border-style: dashed;
      border-color: var(--primary);
      background: #ECFDF5;
    }
    .reorder-q-item.drag-over {
      border-color: var(--primary-deep);
      background: #F0FDF4;
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
    }

    /* WYSIWYG LIVE STUDENT-VIEW QUESTION EDITOR & VISUAL MATH */
    .student-live-canvas {
      border: 2px solid var(--border);
      border-radius: 16px;
      background: #FFFFFF;
      overflow: hidden;
      box-shadow: 0 4px 16px rgba(6, 95, 70, 0.05);
    }
    .vis-editor {
      min-height: 105px;
      padding: 16px 18px;
      font-size: 15.5px;
      font-weight: 400;
      font-style: normal;
      line-height: 1.65;
      color: var(--text);
      outline: none;
      background: #FFFFFF;
    }
    .vis-editor:focus {
      background: #FCFFFD;
    }
    .vis-editor:empty:before,
    .vis-editor[data-is-empty="true"]:before,
    .stu-opt-editor[data-is-empty="true"]:before {
      content: attr(data-placeholder);
      color: #94A3B8;
      font-weight: 400;
      font-style: normal;
      pointer-events: none;
    }
    .vis-editor b, .vis-editor strong,
    .stu-opt-editor b, .stu-opt-editor strong {
      font-weight: 800;
    }
    .vis-editor i, .vis-editor em,
    .stu-opt-editor i, .stu-opt-editor em {
      font-style: italic;
    }
    .vis-editor u, .stu-opt-editor u {
      text-decoration: underline;
    }
    .vis-editor s, .vis-editor strike, .vis-editor del,
    .stu-opt-editor s, .stu-opt-editor strike, .stu-opt-editor del {
      text-decoration: line-through;
    }
    .vis-editor sup, .stu-opt-editor sup {
      vertical-align: super;
      font-size: 0.76em;
      line-height: 0;
    }
    .vis-editor sub, .stu-opt-editor sub {
      vertical-align: sub;
      font-size: 0.76em;
      line-height: 0;
    }
    .vis-editor ul, .vis-editor ol,
    .stu-opt-editor ul, .stu-opt-editor ol {
      padding-left: 26px;
      margin: 6px 0;
    }
    .vis-editor ul, .stu-opt-editor ul { list-style-type: disc; }
    .vis-editor ol, .stu-opt-editor ol { list-style-type: decimal; }
    .vis-editor li, .stu-opt-editor li { margin: 3px 0; }
    .vis-editor blockquote, .stu-opt-editor blockquote {
      border-left: 4px solid var(--primary);
      background: #F0FDF4;
      padding: 8px 14px;
      margin: 8px 0;
      border-radius: 0 8px 8px 0;
      font-style: italic;
      color: #064E3B;
    }
    .vis-editor hr, .stu-opt-editor hr {
      border: none;
      border-top: 2px solid #CBD5E1;
      margin: 12px 0;
    }
    .vis-editor img.ck-selected-img,
    .stu-opt-editor img.ck-selected-img {
      outline: 3px solid #2563EB;
      box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
      cursor: pointer;
    }
    .vis-frac {
      display: inline-flex;
      flex-direction: column;
      vertical-align: middle;
      text-align: center;
      margin: 0 4px;
      line-height: 1.15;
      font-weight: 600;
    }
    .vis-frac > .vis-num {
      border-bottom: 1.8px solid currentColor;
      padding: 0 5px 1px;
      min-width: 18px;
    }
    .vis-frac > .vis-den {
      padding: 1px 5px 0;
      min-width: 18px;
    }
    .vis-sqrt {
      display: inline-flex;
      align-items: stretch;
      vertical-align: middle;
      margin: 0 3px;
      font-weight: 600;
    }
    .vis-sqrt > .vis-rad-sym {
      font-size: 1.2em;
      line-height: 1;
      padding-right: 1px;
      user-select: none;
    }
    .vis-sqrt > .vis-rad {
      border-top: 1.8px solid currentColor;
      padding: 0 5px;
      min-width: 18px;
    }
    .vis-editor .vis-num:focus,
    .vis-editor .vis-den:focus,
    .vis-editor .vis-rad:focus,
    .stu-opt-editor .vis-num:focus,
    .stu-opt-editor .vis-den:focus,
    .stu-opt-editor .vis-rad:focus {
      background: #DCFCE7;
      border-radius: 3px;
      outline: none;
    }

    /* CKEDITOR 5 + MATHTYPE / CHEMTYPE RIBBON TOOLBAR */
    .ck-toolbar {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 4px;
      padding: 8px 12px;
      background: #F8FAFC;
      border-bottom: 1.5px solid #E2E8F0;
    }
    .ck-group {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      padding-right: 7px;
      margin-right: 4px;
      border-right: 1.5px solid #CBD5E1;
    }
    .ck-group:last-child {
      border-right: none;
      padding-right: 0;
      margin-right: 0;
    }
    .ck-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      min-width: 32px;
      height: 32px;
      padding: 0 8px;
      border-radius: 7px;
      border: 1px solid transparent;
      background: transparent;
      color: #1E293B;
      font-size: 13px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.12s ease;
      user-select: none;
    }
    .ck-btn:hover {
      background: #E2E8F0;
      border-color: #CBD5E1;
    }
    .ck-btn.active {
      background: #DBEAFE !important;
      color: #1D4ED8 !important;
      border-color: #3B82F6 !important;
      box-shadow: inset 0 -2.5px 0 #1D4ED8, 0 1px 4px rgba(37, 99, 235, 0.2);
    }
    .ck-context-bar {
      display: none;
      align-items: center;
      flex-wrap: wrap;
      gap: 6px;
      padding: 7px 12px;
      background: #EFF6FF;
      border-bottom: 1.5px solid #BFDBFE;
      font-size: 12px;
      font-weight: 700;
      color: #1E40AF;
    }
    .ck-select {
      height: 32px;
      padding: 0 8px;
      border-radius: 7px;
      border: 1px solid #CBD5E1;
      background: #FFFFFF;
      color: #1E293B;
      font-size: 12.5px;
      font-weight: 700;
      cursor: pointer;
    }
    .ck-mathtype-btn {
      background: linear-gradient(135deg, #EA580C 0%, #C2410C 100%);
      color: #FFFFFF !important;
      border: 1px solid #9A3412 !important;
      padding: 0 11px;
      font-weight: 800;
      box-shadow: 0 2px 6px rgba(234, 88, 12, 0.25);
    }
    .ck-mathtype-btn:hover {
      background: linear-gradient(135deg, #C2410C 0%, #9A3412 100%) !important;
      transform: translateY(-1px);
    }
    .ck-chemtype-btn {
      background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
      color: #FFFFFF !important;
      border: 1px solid #075985 !important;
      padding: 0 11px;
      font-weight: 800;
      box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
    }
    .ck-chemtype-btn:hover {
      background: linear-gradient(135deg, #0369A1 0%, #075985 100%) !important;
      transform: translateY(-1px);
    }
    .ck-color-wrap {
      position: relative;
      display: inline-flex;
      align-items: center;
    }
    .ck-color-input {
      position: absolute;
      inset: 0;
      opacity: 0;
      width: 100%;
      height: 100%;
      cursor: pointer;
    }

    /* CLICKABLE MATHTYPE EQUATION CHIP IN EDITOR */
    .mt-eq-chip {
      display: inline-flex;
      align-items: center;
      vertical-align: middle;
      padding: 3px 7px;
      margin: 1px 3px;
      border-radius: 7px;
      border: 1.5px solid transparent;
      background: #F8FAFC;
      cursor: pointer;
      user-select: none;
      transition: all 0.15s ease;
    }
    .mt-eq-chip:hover {
      background: #FFF7ED;
      border-color: #FB923C;
      box-shadow: 0 2px 8px rgba(234, 88, 12, 0.15);
    }
    .mt-eq-chip.selected-eq {
      background: #FFEDD5;
      border-color: #EA580C;
    }

    /* MATHTYPE & CHEMTYPE MODAL DIALOG */
    .mt-modal-header {
      background: linear-gradient(135deg, #EA580C 0%, #C2410C 100%);
      color: #FFFFFF;
      padding: 12px 18px;
      border-radius: 14px 14px 0 0;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .mt-modal-header.chem-mode {
      background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
    }
    .mt-tabs-bar {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      padding: 8px 12px 0;
      background: #F1F5F9;
      border-bottom: 1.5px solid #CBD5E1;
    }
    .mt-tab {
      padding: 8px 12px;
      border: 1.5px solid transparent;
      border-bottom: none;
      border-radius: 9px 9px 0 0;
      background: transparent;
      color: #475569;
      font-size: 12.5px;
      font-weight: 800;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .mt-tab:hover {
      background: #E2E8F0;
      color: #0F172A;
    }
    .mt-tab.active {
      background: #FFFFFF;
      color: #EA580C;
      border-color: #CBD5E1;
      margin-bottom: -1.5px;
      padding-bottom: 9.5px;
    }
    .mt-tab.chem-tab.active {
      color: #0284C7;
    }
    .mt-palette-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      padding: 12px 14px;
      background: #FFFFFF;
      border-bottom: 1.5px solid #E2E8F0;
      max-height: 210px;
      overflow-y: auto;
    }
    .mt-tpl-btn {
      min-width: 52px;
      min-height: 44px;
      padding: 6px 10px;
      border-radius: 8px;
      border: 1.5px solid #E2E8F0;
      background: #F8FAFC;
      color: #0F172A;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      display: inline-flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 2px;
      transition: all 0.12s ease;
    }
    .mt-tpl-btn:hover {
      background: #FFF7ED;
      border-color: #FB923C;
      transform: translateY(-1px);
      box-shadow: 0 3px 8px rgba(234, 88, 12, 0.12);
    }
    .mt-tpl-btn small {
      font-size: 10px;
      font-weight: 700;
      color: #64748B;
    }
    math-field {
      width: 100%;
      min-height: 92px;
      padding: 14px 18px;
      font-size: 24px;
      border-radius: 12px;
      border: 2px solid #94A3B8;
      background: #FFFFFF;
      color: #0F172A;
      outline: none;
    }
    math-field:focus-within {
      border-color: #EA580C;
      box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
    }

    /* STUDENT OPTION CARDS (DEFAULT PLAIN INPUT + TOGGLEABLE CKEDITOR MODE) */
    .stu-opt-card {
      display: flex;
      flex-direction: column;
      border: 2px solid var(--border);
      border-radius: 14px;
      background: #FFFFFF;
      overflow: hidden;
      transition: all 0.15s ease;
      box-shadow: 0 2px 8px rgba(6, 95, 70, 0.03);
    }
    .stu-opt-card.compact-mode {
      flex-direction: row;
      align-items: center;
      gap: 10px;
      padding: 8px 12px;
    }
    .stu-opt-card.is-correct {
      border-color: var(--primary-dark);
      background: #F8FFFC;
      box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
    }
    .stu-opt-plain-input {
      flex: 1;
      min-width: 160px;
      padding: 8px 12px;
      border: 1.5px solid #CBD5E1;
      border-radius: 9px;
      font-size: 14px;
      color: var(--text);
      background: #FFFFFF;
      outline: none;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }
    .stu-opt-plain-input:focus {
      border-color: var(--primary-dark);
      box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
    }
    .btn-toggle-editor {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 6px 10px;
      border-radius: 8px;
      border: 1.5px solid #CBD5E1;
      background: #F8FAFC;
      color: #1E293B;
      font-size: 12px;
      font-weight: 800;
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.15s ease;
      flex-shrink: 0;
    }
    .btn-toggle-editor:hover {
      border-color: var(--primary-dark);
      background: #ECFDF5;
      color: var(--primary-deep);
    }
    .btn-toggle-editor.active {
      background: #EEF2FF;
      border-color: #6366F1;
      color: #4338CA;
    }
    .btn-del-item {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 8px;
      border: 1.5px solid #FECACA;
      background: #FEF2F2;
      color: #EF4444;
      cursor: pointer;
      flex-shrink: 0;
      transition: all 0.15s ease;
    }
    .btn-del-item:hover {
      background: #FEE2E2;
      border-color: #F87171;
      color: #DC2626;
      box-shadow: 0 1px 3px rgba(239, 68, 68, 0.15);
    }
    .stu-opt-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 8px;
      padding: 8px 12px;
      background: #F1F5F9;
      border-bottom: 1px solid #CBD5E1;
    }
    .stu-opt-card.is-correct .stu-opt-header {
      background: #ECFDF5;
      border-bottom-color: #A7F3D0;
    }
    .opt-ck-toolbar {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 3px;
      padding: 6px 10px;
      background: #F8FAFC;
      border-bottom: 1.5px solid #E2E8F0;
    }
    .stu-opt-key-btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      user-select: none;
      flex-shrink: 0;
    }
    .stu-opt-letter {
      width: 30px;
      height: 30px;
      border-radius: 8px;
      background: #FFFFFF;
      border: 1.5px solid #94A3B8;
      color: var(--primary-deep);
      font-weight: 900;
      font-size: 13.5px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .stu-opt-card.is-correct .stu-opt-letter {
      background: var(--primary);
      border-color: var(--primary-dark);
      color: #FFFFFF;
    }
    .stu-opt-editor {
      width: 100%;
      min-height: 76px;
      padding: 12px 15px;
      background: #FFFFFF;
      font-size: 14.5px;
      font-weight: 400;
      font-style: normal;
      line-height: 1.55;
      color: var(--text);
      outline: none;
    }
    .stu-opt-editor:focus {
      background: #FCFFFD;
    }
    .stu-opt-editor:empty:before {
      content: attr(data-placeholder);
      color: #94A3B8;
      font-weight: 400;
      font-style: normal;
      pointer-events: none;
    }
    .stu-pts-box {
      display: flex;
      align-items: center;
      gap: 5px;
      background: #F8FAFC;
      border: 1.5px solid var(--border);
      padding: 4px 8px;
      border-radius: 9px;
      flex-shrink: 0;
    }
    .stu-pts-box span {
      font-size: 11px;
      font-weight: 800;
      color: var(--primary-deep);
      text-transform: uppercase;
    }
    .stu-pts-input {
      width: 52px;
      border: 1px solid #CBD5E1;
      border-radius: 6px;
      padding: 4px 6px;
      font-size: 13px;
      font-weight: 800;
      text-align: center;
      color: var(--text);
      background: #fff;
    }

    /* INTERACTIVE TABLE & MATCHING IN STUDENT VIEW */
    .stu-edit-table {
      width: 100%;
      border-collapse: collapse;
      background: #fff;
      border-radius: 12px;
      overflow: hidden;
      border: 1.5px solid var(--border);
    }
    .stu-edit-table th, .stu-edit-table td {
      border: 1px solid #CBEAD9;
      padding: 8px 10px;
      vertical-align: middle;
    }
    .stu-edit-table th {
      background: var(--primary-soft);
      color: var(--primary-deep);
      font-size: 12.5px;
      font-weight: 800;
      text-align: center;
    }
    .stu-match-row {
      display: grid;
      grid-template-columns: 1fr auto 1fr auto auto;
      gap: 10px;
      align-items: center;
      padding: 10px 12px;
      border: 1.5px solid var(--border);
      border-radius: 12px;
      background: #FFFFFF;
      margin-bottom: 8px;
    }
    @media (max-width: 720px) {
      .stu-match-row {
        grid-template-columns: 1fr;
      }
    }

    /* Multi-block matching connectors styling */
    .match-port {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: #FFFFFF;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      z-index: 20;
      transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.18s ease, background 0.18s ease;
      box-shadow: 0 1px 3px rgba(0,0,0,0.12);
      user-select: none;
      touch-action: none;
      flex-shrink: 0;
      position: relative;
    }
    .match-port::before {
      content: "";
      position: absolute;
      top: -6px;
      bottom: -6px;
      left: -6px;
      right: -6px;
      border-radius: 50%;
      cursor: pointer;
    }
    .match-port.port-out {
      border: 2.5px solid #2563EB;
      background: #EFF6FF;
      margin-left: auto;
    }
    .match-port.port-out:hover {
      transform: scale(1.22);
      background: #DBEAFE;
      border-color: #1D4ED8;
      box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
    }
    .match-port.port-in {
      border: 2.5px solid #059669;
      background: #ECFDF5;
      margin-right: 2px;
    }
    .match-port.port-in:hover {
      transform: scale(1.22);
      background: #D1FAE5;
      border-color: #047857;
      box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.25);
    }
    .match-port.active-source {
      transform: scale(1.26) !important;
      background: #2563EB !important;
      border-color: #1D4ED8 !important;
      box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.35) !important;
    }
    .match-port.active-source > div {
      background: #FFFFFF !important;
    }
    .match-port.valid-target {
      animation: pulsePortAnim 1.2s infinite;
      border-color: #10B981 !important;
      background: #ECFDF5 !important;
      box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.35) !important;
    }
    .match-port.dimmed {
      opacity: 0.35;
      filter: grayscale(0.6);
      cursor: not-allowed;
    }
    @keyframes pulsePortAnim {
      0% { transform: scale(1); box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4); }
      50% { transform: scale(1.2); box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.2); }
      100% { transform: scale(1); box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4); }
    }
    .match-port.port-in.drag-hover {
      transform: scale(1.3) !important;
      background: #10B981 !important;
      border-color: #047857 !important;
      box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.45) !important;
    }
    .match-line-bundle {
      transition: opacity 0.16s ease;
    }
    .match-connector-path {
      cursor: pointer;
      transition: stroke-width 0.15s ease, stroke 0.15s ease, filter 0.15s ease;
    }
    .match-line-del-btn {
      cursor: pointer;
    }
    .match-line-del-circle {
      transition: fill 0.15s ease, stroke 0.15s ease, filter 0.15s ease;
    }
    .match-line-del-btn:hover .match-line-del-circle {
      fill: #EF4444 !important;
      stroke: #B91C1C !important;
      filter: drop-shadow(0 2px 6px rgba(239, 68, 68, 0.5)) !important;
    }
    .match-line-del-cross {
      transition: stroke 0.15s ease;
    }
    .match-line-del-btn:hover .match-line-del-cross {
      stroke: #FFFFFF !important;
    }
    .match-block-card {
      flex: 1 1 300px;
      min-width: 280px;
      max-width: 460px;
      background: #FFFFFF;
      border: 1.5px solid #CBD5E1;
      border-radius: 14px;
      padding: 14px;
      box-shadow: 0 2px 6px -1px rgba(0,0,0,0.06);
      position: relative;
    }
    .match-item-row {
      position: relative;
      background: #F8FAFC;
      border: 1.5px solid #E2E8F0;
      border-radius: 10px;
      padding: 8px 10px;
      margin-bottom: 12px;
      display: flex;
      align-items: center;
      gap: 8px;
      box-shadow: 0 1px 2px rgba(0,0,0,0.04);
      transition: border-color 0.15s ease;
    }
    .match-item-row:hover {
      border-color: #94A3B8;
    }
    .match-item-preview {
      flex: 1;
      min-width: 0;
      padding: 6px 10px;
      cursor: pointer;
      font-size: 13px;
      line-height: 1.45;
      color: #1E293B;
      word-break: break-word;
      transition: all 0.15s ease;
      display: flex;
      align-items: center;
      min-height: 36px;
      border-radius: 6px;
    }
    .match-item-preview:hover {
      background: rgba(16, 185, 129, 0.08);
      color: var(--primary-deep);
    }
    .btn-edit-match-item {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 6px 10px;
      border-radius: 8px;
      border: 1.5px solid #CBD5E1;
      background: #FFFFFF;
      color: #1E293B;
      font-size: 12px;
      font-weight: 800;
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.15s ease;
      height: 34px;
    }
    .btn-edit-match-item:hover {
      border-color: var(--primary-dark);
      background: #ECFDF5;
      color: var(--primary-deep);
    }

    /* PRINT STYLES FOR REKAP NILAI & BERKAS ADMINISTRASI RESMI */
    @media print {
      body * {
        visibility: hidden !important;
      }
      #modalPrintReport, #modalPrintReport *,
      #modalPrintAdminDocs, #modalPrintAdminDocs * {
        visibility: visible !important;
      }
      #modalPrintReport, #modalPrintAdminDocs {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        width: 100vw !important;
        height: auto !important;
        background: #fff !important;
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: 999999 !important;
      }
      #modalPrintReport .modal-card,
      #modalPrintAdminDocs .modal-card {
        box-shadow: none !important;
        border: none !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        max-height: none !important;
      }
      .no-print {
        display: none !important;
      }
      @page {
        margin: 1.2cm;
        size: A4 portrait;
      }
      .page-break {
        page-break-after: always;
        break-after: page;
      }
    }

    /* TOASTIFY & SWEETALERT2 MODERN THEME */
    .toastify {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
      border-radius: 12px !important;
      font-weight: 700 !important;
      font-size: 13.5px !important;
      box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
      padding: 12px 20px !important;
      display: flex !important;
      align-items: center !important;
      gap: 8px !important;
      letter-spacing: -0.2px !important;
    }
    .swal2-popup {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
      border-radius: 18px !important;
      padding: 26px 22px !important;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    }
    .swal2-title {
      font-weight: 800 !important;
      color: #062E22 !important;
      font-size: 19px !important;
      margin-bottom: 8px !important;
    }
    .swal2-html-container {
      font-size: 13.5px !important;
      color: #3F6254 !important;
      line-height: 1.55 !important;
      margin-top: 6px !important;
    }
    .swal2-confirm {
      border-radius: 10px !important;
      font-weight: 800 !important;
      font-size: 13.5px !important;
      padding: 11px 22px !important;
      background: #059669 !important;
      box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3) !important;
    }
    .swal2-cancel {
      border-radius: 10px !important;
      font-weight: 700 !important;
      font-size: 13.5px !important;
      padding: 11px 20px !important;
      background: #64748B !important;
    }
  
    .cbt-audio-stimulus {
      user-select: none;
      margin: 10px 0;
      padding: 10px 14px;
      background: #F5F3FF;
      border: 1.5px solid #C4B5FD;
      border-radius: 12px;
      display: block;
      max-width: 100%;
      box-sizing: border-box;
    }
    .cbt-audio-stimulus audio {
      width: 100%;
      height: 36px;
      display: block;
      outline: none;
    }
  