:root {
      --bg-darkest: #0a0c10;
      --bg-body: #0d0f14;
      --bg-sidebar: #0e1117;
      --bg-card: #151821;
      --bg-card-hover: #1c212c;
      --border: #212631;
      --border-light: #2c3342;
      --text: #e6edf3;
      --text-muted: #8b949e;
      --text-dim: #5c6470;
      --accent-blue: #388bfd;
      --accent-blue-hover: #1f6feb;
      --green: #238636;
      --green-bright: #2ea043;
      --yellow: #d29922;
      --yellow-subtle: rgba(210, 153, 34, 0.15);
      --red: #f85149;
    }

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

    body {
      background-color: var(--bg-body);
      color: var(--text);
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      font-size: 13.5px;
      height: 100vh;
      overflow: hidden;
      display: flex;
    }

    /* Scrollbars */
    ::-webkit-scrollbar { width: 6px; height: 6px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: #262c38; border-radius: 4px; }
    ::-webkit-scrollbar-thumb:hover { background: #3b4455; }

    /* =========================================================
       VIEW 1: MULTI-SESSION SESSIONS LIST ("HỖ TRỢ")
       ========================================================= */
    #view-sessions-grid {
      display: flex;
      width: 100vw;
      height: 100vh;
      background: var(--bg-body);
    }

    /* Left Sidebar */
    .sidebar {
      width: 230px;
      background: var(--bg-sidebar);
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      flex-shrink: 0;
    }

    .brand-wrap {
      padding: 18px 20px;
      display: flex;
      align-items: center;
      gap: 10px;
      border-bottom: 1px solid var(--border);
    }

    .brand-logo-txt {
      font-size: 17px;
      font-weight: 800;
      color: #fff;
      letter-spacing: -0.5px;
    }

    .brand-seb-badge {
      font-size: 10px;
      font-weight: 700;
      padding: 2px 6px;
      border-radius: 4px;
      background: #1f6feb;
      color: #fff;
      letter-spacing: 0.5px;
    }

    .nav-list {
      list-style: none;
      padding: 16px 10px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      flex: 1;
    }

    .nav-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 9px 14px;
      border-radius: 8px;
      color: var(--text-muted);
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.15s ease;
      text-decoration: none;
    }

    .nav-item:hover {
      background: #161b24;
      color: #fff;
    }

    .nav-item.active {
      background: #1b2230;
      color: #58a6ff;
      font-weight: 600;
    }

    .nav-item.active::before {
      content: '';
      position: absolute;
      left: 0;
      width: 3px;
      height: 22px;
      background: #58a6ff;
      border-radius: 0 4px 4px 0;
    }

    /* Top User Bar */
    .sessions-main-wrap {
      flex: 1;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .top-user-nav {
      height: 52px;
      padding: 0 28px;
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 20px;
      border-bottom: 1px solid var(--border);
      background: var(--bg-sidebar);
    }

    .user-balance {
      font-size: 12.5px;
      color: var(--text-muted);
    }
    .user-balance strong {
      color: #e6edf3;
      font-family: 'JetBrains Mono', monospace;
    }

    .user-profile {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 13px;
      font-weight: 600;
      color: #e6edf3;
    }

    .user-avatar {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: #8957e5;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 13px;
      font-weight: 700;
      color: #fff;
    }

    .logout-btn {
      color: var(--text-muted);
      font-size: 12px;
      cursor: pointer;
      text-decoration: none;
    }
    .logout-btn:hover { color: #f85149; }

    /* Sessions Header & Filter Bar */
    .sessions-content {
      flex: 1;
      overflow-y: auto;
      padding: 24px 32px 60px 32px;
    }

    .content-header-title {
      font-size: 20px;
      font-weight: 700;
      color: #fff;
      letter-spacing: -0.3px;
    }

    .content-header-sub {
      font-size: 12.5px;
      color: var(--text-dim);
      margin-top: 3px;
      margin-bottom: 18px;
    }

    .filter-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 22px;
      flex-wrap: wrap;
    }

    .search-input-wrap {
      flex: 1;
      max-width: 420px;
      position: relative;
    }

    .search-input {
      width: 100%;
      background: #141822;
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 8px 12px 8px 36px;
      color: #e6edf3;
      font-size: 12.5px;
      outline: none;
      transition: border-color 0.15s;
    }
    .search-input:focus { border-color: #58a6ff; }

    .search-icon {
      position: absolute;
      left: 12px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--text-dim);
      pointer-events: none;
    }

    .filter-tabs {
      display: flex;
      background: #141822;
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 3px;
      gap: 3px;
    }

    .filter-tab {
      background: transparent;
      border: none;
      color: var(--text-muted);
      font-size: 12px;
      font-weight: 600;
      padding: 5px 14px;
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.15s;
    }

    .filter-tab.active {
      background: #212633;
      color: #fff;
    }

    .session-count-badge {
      color: var(--text-muted);
      font-size: 12px;
      font-weight: 500;
      background: #161b24;
      border: 1px solid var(--border);
      padding: 5px 12px;
      border-radius: 6px;
      white-space: nowrap;
    }

    /* Sessions Cards Grid */
    .sessions-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
      gap: 14px;
    }

    .session-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 15px 16px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      cursor: pointer;
      transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    }

    .session-card:hover {
      transform: translateY(-2px);
      border-color: #3b4456;
      background: var(--bg-card-hover);
    }

    .card-top-title {
      font-size: 13px;
      font-weight: 700;
      color: #e6edf3;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .card-tag-row {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .tag-status {
      display: inline-flex;
      align-items: center;
      padding: 2px 7px;
      border-radius: 4px;
      font-size: 10.5px;
      font-weight: 600;
      letter-spacing: 0.3px;
    }

    .tag-status.completed {
      background: rgba(46, 160, 67, 0.15);
      border: 1px solid rgba(46, 160, 67, 0.35);
      color: #3fb950;
    }

    .tag-status.waiting {
      background: var(--yellow-subtle);
      border: 1px solid rgba(210, 153, 34, 0.35);
      color: #e3b341;
    }

    .tag-subject {
      display: inline-flex;
      align-items: center;
      padding: 2px 6px;
      border-radius: 4px;
      font-size: 10px;
      font-weight: 700;
      background: #1f2533;
      color: #58a6ff;
      border: 1px solid #2d3546;
    }

    .card-info-row {
      font-size: 11.5px;
      color: var(--text-muted);
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    .card-info-row .id-dur {
      color: #8b949e;
      font-family: 'JetBrains Mono', monospace;
    }

    .card-info-row .customer {
      color: #c9d1d9;
      font-weight: 500;
    }

    .card-info-row .notes {
      color: var(--text-dim);
      font-size: 11px;
    }

    /* =========================================================
       VIEW 2: DEDICATED SUPPORTER WORKSPACE (AUTHENTIC EXAM VIEW)
       ========================================================= */
    :root {
      --ex-bg: #101010;
      --ex-panel: #161616;
      --ex-panel-2: #1c1c1c;
      --ex-line: #292929;
      --ex-line-soft: #232323;
      --ex-text: #e4e4e4;
      --ex-text-dim: #b6b6b6;
      --ex-muted: #808080;
      --ex-accent: #8fd3a8;
      --ex-accent-strong: #3f8f63;
      --topbar-h: 56px;
    }

    #view-supporter-workspace {
      display: none;
      width: 100vw;
      height: 100vh;
      flex-direction: column;
      background: var(--ex-bg);
      color: var(--ex-text);
      overflow: hidden;
      font-size: 14px;
      line-height: 1.6;
    }

    /* Topbar */
    .topbar {
      position: sticky;
      top: 0;
      z-index: 300;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      min-height: 56px;
      padding: 9px 18px;
      background: rgba(16,16,16,0.97);
      backdrop-filter: blur(14px);
      border-bottom: 1px solid var(--ex-line);
      flex-wrap: wrap;
    }

    .topbar-left {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
      flex: 1 1 280px;
    }

    .class-code {
      flex-shrink: 0;
      display: inline-flex;
      align-items: center;
      height: 26px;
      padding: 0 9px;
      border: 1px solid #333333;
      border-radius: 6px;
      background: #191919;
      color: #d6d6d6;
      font-size: 11.5px;
      font-weight: 600;
      letter-spacing: 0.02em;
    }

    .topbar-title {
      color: #9a9a9a;
      font-size: 12.5px;
      font-weight: 500;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 440px;
    }

    .status-chip {
      flex-shrink: 0;
      display: inline-flex;
      align-items: center;
      gap: 5px;
      height: 22px;
      padding: 0 8px;
      border-radius: 99px;
      font-size: 10.5px;
      font-weight: 600;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      border: 1px solid transparent;
    }
    .status-chip::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
    .status-idle { color: #8a8a8a; background: #1a1a1a; border-color: #2c2c2c; }
    .status-doing { color: #e0b062; background: rgba(224,176,98,0.08); border-color: rgba(224,176,98,0.3); }
    .status-done { color: #8fd3a8; background: rgba(143,211,168,0.08); border-color: rgba(143,211,168,0.3); }

    .topbar-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 7px;
      flex-wrap: wrap;
    }

    .tb-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      height: 32px;
      padding: 0 11px;
      background: #1a1a1a;
      border: 1px solid #2e2e2e;
      border-radius: 7px;
      color: #c9c9c9;
      font-family: inherit;
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s, color 0.15s;
      white-space: nowrap;
    }
    .tb-btn:hover { background: #222222; border-color: #454545; color: #ffffff; }
    .tb-btn:active { transform: translateY(1px); }
    .tb-btn-ghost { background: transparent; border-color: #353535; color: #a9a9a9; }

    .timer-box {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      height: 32px;
      padding: 0 11px;
      background: #171717;
      border: 1px solid #2d2d2d;
      border-radius: 7px;
    }
    .timer-title { font-size: 10px; font-weight: 600; color: #7c7c7c; text-transform: uppercase; letter-spacing: 0.08em; }
    .timer-val { font-size: 13px; font-weight: 600; color: #d8d8d8; font-family: 'Fira Code', Consolas, monospace; letter-spacing: 0.02em; }
    .timer-box.timer-warning { border-color: rgba(224,176,98,0.45) !important; background: rgba(224,176,98,0.08) !important; }
    .timer-box.timer-warning .timer-val { color: #e0b062 !important; }
    .timer-box.timer-danger { border-color: rgba(228,112,94,0.5) !important; background: rgba(228,112,94,0.1) !important; }
    .timer-box.timer-danger .timer-val { color: #e4705e !important; }

    /* 3-Column Workspace Layout */
    .exam-workspace-layout {
      flex: 1;
      display: grid;
      grid-template-columns: 280px minmax(0, 1fr) 240px;
      overflow: hidden;
      background: var(--ex-bg);
    }

    /* Left: Supporter Chat Column */
    .sp-chat-col {
      background: #0d0d0d;
      border-right: 1px solid var(--ex-line-soft);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      height: 100%;
    }

    .chat-top-header {
      padding: 12px 14px;
      border-bottom: 1px solid var(--ex-line-soft);
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: #111111;
    }

    .chat-msgs-stream {
      flex: 1;
      overflow-y: auto;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .chat-bubble {
      max-width: 88%;
      padding: 8px 12px;
      border-radius: 8px;
      font-size: 12.5px;
      line-height: 1.45;
      word-break: break-word;
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    .chat-bubble.mine,
    .chat-bubble.supporter {
      align-self: flex-end;
      background: #192b20;
      border: 1px solid #2f543e;
      color: #e4e4e4;
      border-bottom-right-radius: 2px;
    }

    .chat-bubble.theirs,
    .chat-bubble.client {
      align-self: flex-start;
      background: #181818;
      border: 1px solid #2c2c2c;
      color: #d6d6d6;
      border-bottom-left-radius: 2px;
    }

    .chat-bubble.system {
      align-self: center;
      background: rgba(255, 255, 255, 0.04);
      border: 1px dashed #30363d;
      color: #8b949e;
      font-size: 11px;
      text-align: center;
      border-radius: 6px;
      padding: 5px 12px;
      max-width: 95%;
    }

    .chat-sender-tag {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.02em;
      margin-bottom: 2px;
      display: flex;
      align-items: center;
      gap: 5px;
    }
    .chat-sender-tag.tag-client {
      color: #58a6ff;
    }
    .chat-sender-tag.tag-supporter {
      color: #3fb950;
    }
    .chat-sender-tag.tag-user {
      color: #79c0ff;
    }
    .chat-sender-tag.tag-me {
      color: #8fd3a8;
    }

    .chat-time-tag {
      font-size: 9.5px;
      color: #7a7a7a;
      align-self: flex-end;
    }

    .chat-bottom-inputs {
      padding: 10px;
      border-top: 1px solid var(--ex-line-soft);
      background: #111111;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .input-ans-bar, .input-msg-bar {
      display: flex;
      gap: 6px;
    }

    .input-ans-field, .input-msg-field {
      flex: 1;
      background: #161616;
      border: 1px solid #2e2e2e;
      color: #e4e4e4;
      font-size: 12.5px;
      padding: 6px 10px;
      border-radius: 6px;
      outline: none;
    }
    .input-ans-field {
      font-family: 'JetBrains Mono', Consolas, monospace;
      color: #8fd3a8;
    }
    .input-ans-field:focus, .input-msg-field:focus {
      border-color: #3f8f63;
    }

    /* Middle: Authentic Exam Main */
    .exam-main {
      overflow-y: auto;
      padding: 20px 30px 80px 30px;
      display: flex;
      flex-direction: column;
      background: var(--ex-bg);
      scroll-behavior: smooth;
    }

    .mode-bar {
      position: sticky;
      top: -20px;
      z-index: 100;
      background: var(--ex-bg);
      display: flex;
      align-items: center;
      gap: 14px;
      padding-top: 14px;
      padding-bottom: 8px;
      margin-top: -14px;
      margin-bottom: 8px;
    }
    .mode-tabs {
      flex: 1;
      display: flex;
      gap: 5px;
      padding: 4px;
      background: var(--ex-panel);
      border: 1px solid var(--ex-line);
      border-radius: 10px;
    }
    .mode-tab {
      flex: 1;
      height: 32px;
      padding: 0 14px;
      border: 0;
      border-radius: 6px;
      background: transparent;
      color: #858585;
      font-family: inherit;
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      cursor: pointer;
      transition: background 0.15s, color 0.15s;
    }
    .mode-tab:hover { background: #1d1d1d; color: #d0d0d0; }
    .mode-tab.active { background: #ececec; color: #121212; }

    .progress-line {
      height: 3px;
      margin-bottom: 0;
      background: #232323;
      border-radius: 99px;
      overflow: hidden;
    }
    .progress-bar-fill {
      height: 100%;
      width: 0%;
      background: var(--ex-accent);
      border-radius: 99px;
      transition: width 0.35s ease;
    }
    .progress-meta {
      display: flex;
      justify-content: flex-end;
      margin: 6px 0 16px 0;
      color: #8a8a8a;
      font-family: 'Fira Code', Consolas, monospace;
      font-size: 11px;
      font-weight: 600;
    }

    /* Authentic Question Cards */
    .q-card {
      background: var(--ex-panel);
      border: 1px solid var(--ex-line);
      border-left: 2px solid #2c3a32;
      border-radius: 10px;
      padding: 18px 22px;
      margin-bottom: 16px;
      scroll-margin-top: 20px;
      transition: border-color 0.2s, background 0.2s;
    }
    .q-card:hover {
      border-color: #343434;
      border-left-color: #3a4c40;
    }
    .q-card.q-answered {
      border-color: #31503e !important;
      border-left-color: var(--ex-accent-strong) !important;
    }
    .q-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 12px;
      flex-wrap: wrap;
    }
    .q-num {
      color: var(--ex-accent);
      font-size: 13px;
      font-weight: 650;
      letter-spacing: 0.02em;
    }
    .btn-copy-q {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: transparent;
      border: 1px solid #2e2e2e;
      border-radius: 6px;
      color: #8f8f8f;
      font-family: inherit;
      font-size: 10.5px;
      font-weight: 500;
      padding: 4px 9px;
      cursor: pointer;
      transition: all 0.15s;
    }
    .btn-copy-q:hover {
      background: #212121;
      border-color: #4a4a4a;
      color: #e8e8e8;
    }
    .btn-copy-q:active { transform: translateY(1px); }
    .q-type {
      background: #1b1b1b;
      border: 1px solid #2d2d2d;
      border-radius: 5px;
      color: #8a8a8a;
      font-size: 9.5px;
      font-weight: 600;
      letter-spacing: 0.07em;
      text-transform: uppercase;
      padding: 3px 8px;
    }
    .q-body {
      color: #d8d8d8;
      font-size: 14px;
      line-height: 1.75;
      margin-bottom: 16px;
      white-space: pre-wrap;
      word-break: break-word;
    }
    .q-body img {
      max-width: 100%;
      max-height: 380px;
      object-fit: contain;
      border-radius: 6px;
      margin: 10px auto;
      border: 1px solid #333333;
      background: #ffffff;
      padding: 4px;
      display: block;
    }

    /* Choices List & Item from exam_full_view.html */
    .choices-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 12px;
    }
    .choice-item {
      display: flex;
      align-items: center;
      gap: 12px;
      background: #131313;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      padding: 10px 14px;
      font-size: 13.5px;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s;
    }
    .choice-item:hover {
      background: #1a1a1a;
      border-color: #4b4b4b;
    }
    .choice-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 30px;
      height: 30px;
      padding: 0 6px;
      border-radius: 6px;
      background: transparent;
      border: 1px solid #363636;
      color: #c4c4c4;
      font-size: 12px;
      font-weight: 600;
      flex-shrink: 0;
    }
    .choice-text {
      flex: 1;
      min-width: 0;
      color: #d2d2d2;
      word-break: break-word;
    }
    .choice-item.is-selected {
      background: #ececec !important;
      border-color: #ececec !important;
      box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35) !important;
    }
    .choice-item.is-selected .choice-text,
    .choice-item.is-selected .choice-text * {
      color: #111111 !important;
    }
    .choice-item.is-selected .choice-badge {
      background: #141414 !important;
      border-color: #141414 !important;
      color: #ffffff !important;
    }

    /* Cloze / Input elements from exam_full_view.html */
    .cloze-grid {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-top: 12px;
    }
    .cloze-item {
      background: #141414;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      padding: 11px 13px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      transition: border-color 0.2s;
    }
    .cloze-item.is-filled {
      border-color: #3a654c !important;
    }
    .cloze-header-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .cloze-label {
      color: #b1b1b1;
      font-size: 11.5px;
      font-weight: 600;
    }
    .chosen-badge {
      color: #8fd3a8;
      background: rgba(143,211,168,0.08);
      border: 1px solid rgba(143,211,168,0.3);
      padding: 2px 7px;
      border-radius: 4px;
      font-size: 10.5px;
      font-weight: 600;
    }
    .cloze-select-active, .cloze-input-active {
      width: 100%;
      background: #181818;
      color: #e8e8e8;
      border: 1px solid #343434;
      border-radius: 6px;
      padding: 8px 11px;
      font-family: inherit;
      font-size: 13px;
    }
    .cloze-select-active:focus, .cloze-input-active:focus {
      border-color: #5d9d78;
      outline: none;
    }
    .cloze-options-wrap {
      display: flex;
      flex-wrap: wrap;
      gap: 7px;
    }
    .cloze-pill {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: #1a1a1a;
      border: 1px solid #343434;
      border-radius: 5px;
      padding: 3px 9px;
      color: #bcbcbc;
      font-size: 11.5px;
      cursor: pointer;
    }
    .cloze-pill:hover { background: #262626; color: #fff; }
    .cloze-pill.selected {
      background: #ececec !important;
      border-color: #ececec !important;
      color: #111111 !important;
      font-weight: 700;
    }

    .text-box {
      width: 100%;
      background: #171717;
      border: 1px solid #343434;
      border-radius: 7px;
      padding: 9px 12px;
      color: #e8e8e8;
      font-family: inherit;
      font-size: 13.5px;
    }
    .text-box:focus {
      border-color: #5d9d78;
      outline: none;
    }
    .essay-box {
      min-height: 140px;
      resize: vertical;
      line-height: 1.65;
    }

    /* Right: Authentic Sidebar from exam_full_view.html */
    .exam-sidebar {
      background: #0d0d0d;
      border-left: 1px solid var(--ex-line-soft);
      overflow-y: auto;
      padding: 16px 14px 24px 14px;
      height: 100%;
      display: flex;
      flex-direction: column;
      gap: 14px;
    }
    .side-block {
      padding-bottom: 14px;
    }
    .side-block + .side-block {
      border-top: 1px solid #202020;
      padding-top: 14px;
    }
    .side-label {
      color: #747474;
      font-size: 9.5px;
      font-weight: 700;
      letter-spacing: 0.16em;
      text-transform: uppercase;
    }
    .key-code {
      margin-top: 6px;
      color: #ededed;
      font-size: 13px;
      font-weight: 600;
      letter-spacing: 0.03em;
      word-break: break-word;
    }
    .key-row {
      display: flex;
      flex-direction: column;
      gap: 1px;
      margin-top: 9px;
    }
    .key-row span {
      color: #6b6b6b;
      font-size: 9px;
      font-weight: 600;
      letter-spacing: 0.12em;
      text-transform: uppercase;
    }
    .key-row strong {
      color: #c9c9c9;
      font-size: 11.5px;
      font-weight: 500;
      line-height: 1.45;
      word-break: break-word;
    }
    .side-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      color: #8c8c8c;
      font-size: 10.5px;
      font-weight: 600;
      letter-spacing: 0.06em;
      text-transform: uppercase;
    }
    .side-count {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 22px;
      height: 20px;
      padding: 0 6px;
      border-radius: 5px;
      background: #1c1c1c;
      border: 1px solid #2c2c2c;
      color: #bdbdbd;
      font-size: 10.5px;
    }
    .nav-pills {
      display: grid;
      grid-template-columns: repeat(5, minmax(0, 1fr));
      gap: 6px;
      margin-top: 11px;
    }
    .nav-pill {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      aspect-ratio: 1 / 1;
      border-radius: 6px;
      background: #181818;
      border: 1px solid #2b2b2b;
      color: #b3b3b3;
      text-decoration: none;
      font-size: 11.5px;
      font-weight: 500;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s, color 0.15s;
    }
    .nav-pill:hover {
      background: #212121;
      border-color: #4b4b4b;
      color: #ffffff;
    }
    .nav-pill.answered,
    .nav-pill.pill-answered {
      background: #2f6048 !important;
      border-color: #4b8a66 !important;
      color: #effff5 !important;
      font-weight: 600;
    }
    .side-legend {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 12px;
      color: #7b7b7b;
      font-size: 10.5px;
    }
    .legend-item { display: inline-flex; align-items: center; gap: 5px; }
    .dot { display: inline-block; width: 7px; height: 7px; border-radius: 2px; }
    .dot-answered { background: #3f7d59; border: 1px solid #5a9c77; }
    .dot-empty { background: #1c1c1c; border: 1px solid #3a3a3a; }

    #sp-toast {
      position: fixed;
      bottom: 24px;
      right: 24px;
      background: #17221b;
      border: 1px solid #2f4a39;
      color: #a8e6bd;
      font-size: 12.5px;
      font-weight: 600;
      padding: 9px 16px;
      border-radius: 8px;
      box-shadow: 0 8px 24px rgba(0,0,0,0.6);
      display: none;
    }

    /* Modal and Form Styles */
    .modal-overlay {
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0,0,0,0.85);
      backdrop-filter: blur(10px);
      z-index: 1000;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 16px;
    }
    .modal-card {
      background: #16181d;
      border: 1px solid #2d333f;
      border-radius: 12px;
      width: 100%;
      max-width: 440px;
      padding: 28px;
      box-shadow: 0 20px 40px rgba(0,0,0,0.6);
      display: flex;
      flex-direction: column;
      gap: 16px;
    }
    .modal-title {
      font-size: 18px;
      font-weight: 700;
      color: #fff;
    }
    .modal-sub {
      font-size: 12px;
      color: var(--text-dim);
      margin-top: -8px;
    }
    .form-group {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .form-label {
      font-size: 11.5px;
      font-weight: 600;
      color: #c9d1d9;
      letter-spacing: 0.3px;
    }
    .form-input, .form-select {
      background: #0d1117;
      border: 1px solid var(--border);
      border-radius: 6px;
      height: 38px;
      padding: 0 12px;
      color: #e6edf3;
      font-size: 13px;
      outline: none;
      transition: border-color 0.15s ease;
    }
    .form-input:focus, .form-select:focus {
      border-color: #58a6ff;
    }
    .btn-primary {
      background: #238636;
      border: 1px solid rgba(240,246,252,0.1);
      color: #fff;
      font-weight: 600;
      height: 40px;
      border-radius: 6px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      transition: background 0.15s ease;
    }
    .btn-primary:hover {
      background: #2ea043;
    }
    .btn-danger {
      background: rgba(248, 81, 73, 0.15);
      border: 1px solid rgba(248, 81, 73, 0.4);
      color: #f85149;
    }
    .btn-danger:hover {
      background: rgba(248, 81, 73, 0.3);
    }
    .badge-role {
      display: inline-flex;
      align-items: center;
      padding: 2px 7px;
      border-radius: 12px;
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .badge-role.admin {
      background: rgba(139, 92, 246, 0.2);
      border: 1px solid #8b5cf6;
      color: #c4b5fd;
    }
    .badge-role.seller {
      background: rgba(16, 185, 129, 0.2);
      border: 1px solid #10b981;
      color: #6ee7b7;
    }

    /* Admin-only items are hidden by default to prevent UI flicker */
    .admin-only-item {
      display: none !important;
    }
    body.is-admin .admin-only-item {
      display: block !important;
    }
    body.is-admin li.admin-only-item {
      display: list-item !important;
    }
    body.is-admin button.admin-only-item {
      display: inline-block !important;
    }
    body.is-admin div.admin-only-item {
      display: block !important;
    }

    /* Key Management Table */
    .table-responsive {
      width: 100%;
      overflow-x: auto;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: #0d1117;
    }
    .data-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 12.5px;
      text-align: left;
    }
    .data-table th {
      background: #161b22;
      padding: 11px 14px;
      font-weight: 600;
      color: #8b949e;
      border-bottom: 1px solid var(--border);
      white-space: nowrap;
    }
    .data-table td {
      padding: 10px 14px;
      border-bottom: 1px solid rgba(48, 54, 61, 0.5);
      color: #c9d1d9;
      white-space: nowrap;
    }
    .data-table tr:hover td {
      background: rgba(255,255,255,0.02);
    }
    .code-pill {
      font-family: 'JetBrains Mono', monospace;
      font-weight: 600;
      color: #58a6ff;
      background: rgba(56, 139, 253, 0.15);
      padding: 3px 8px;
      border-radius: 4px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }
    .code-pill:hover {
      background: rgba(56, 139, 253, 0.3);
    }

    /* Admin Stats Overview Cards */
    .admin-stats-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 16px;
      margin-bottom: 24px;
    }
    .stat-card {
      background: #141822;
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 16px 20px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      position: relative;
      overflow: hidden;
    }
    .stat-card::after {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 2px;
      background: linear-gradient(90deg, #388bfd, #8b5cf6);
    }
    .stat-title {
      font-size: 11px;
      font-weight: 600;
      color: var(--text-dim);
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .stat-val {
      font-size: 22px;
      font-weight: 800;
      color: #fff;
      font-family: 'JetBrains Mono', monospace;
    }
    .stat-sub {
      font-size: 11px;
      color: var(--text-muted);
    }

    /* Key Type Selector in Modal */
    .key-type-selector {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-top: 4px;
    }
    .key-type-card {
      background: #0d1117;
      border: 2px solid var(--border);
      border-radius: 8px;
      padding: 14px 12px;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      gap: 4px;
      transition: all 0.15s ease;
      text-align: center;
    }
    .key-type-card:hover {
      border-color: #388bfd;
      background: #141822;
    }
    .key-type-card.selected {
      border-color: #2ea043;
      background: rgba(46, 160, 67, 0.12);
    }
    .key-type-title {
      font-size: 13.5px;
      font-weight: 700;
      color: #fff;
    }
    .key-type-price {
      font-size: 15px;
      font-weight: 800;
      color: #8fd3a8;
      font-family: 'JetBrains Mono', monospace;
    }
    .key-type-desc {
      font-size: 11px;
      color: var(--text-dim);
    }

    /* =========================================================
       IMAGE & MATH FORMULA ENHANCEMENTS (AUTHENTIC EXAM RENDERING)
       ========================================================= */
    .exam-img-wrap {
      margin: 12px 0;
      text-align: center;
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid #282828;
      border-radius: 8px;
      padding: 10px;
      overflow: hidden;
    }
    .exam-img {
      max-width: 100%;
      max-height: 420px;
      object-fit: contain;
      border-radius: 6px;
      display: inline-block;
      background: #ffffff;
      padding: 4px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    }
    .exam-inline-img, .exam-math-img {
      display: inline-block;
      vertical-align: middle;
      max-height: 48px;
      margin: 0 4px;
      background: #ffffff;
      border-radius: 4px;
      padding: 2px 6px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }
    .choice-text img {
      max-height: 52px;
      vertical-align: middle;
      display: inline-block;
      background: #ffffff;
      border-radius: 4px;
      padding: 2px 6px;
      margin-left: 4px;
    }

    /* =========================================================
       KEY GATE LOGIN OVERLAY FOR USER SUPPORT ROOM
       ========================================================= */
    #view-key-gate {
      position: fixed;
      inset: 0;
      background: radial-gradient(circle at 50% 30%, #151a26 0%, #080a0f 70%);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 99999;
    }
    .key-gate-card {
      width: 440px;
      background: rgba(18, 22, 31, 0.95);
      border: 1px solid var(--border-light);
      border-radius: 12px;
      padding: 36px 32px;
      box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
      text-align: center;
    }
    .key-gate-brand {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      margin-bottom: 24px;
    }
    .key-gate-logo {
      font-size: 22px;
      font-weight: 800;
      letter-spacing: -0.5px;
      color: #fff;
    }
    .key-gate-badge {
      background: #1f6feb;
      color: #fff;
      font-size: 11px;
      font-weight: 700;
      padding: 3px 7px;
      border-radius: 4px;
      letter-spacing: 0.5px;
    }
    .key-gate-desc {
      font-size: 13px;
      color: var(--text-muted);
      margin-bottom: 24px;
      line-height: 1.5;
    }
    .key-gate-input-wrap {
      margin-bottom: 20px;
      position: relative;
    }
    .key-gate-input {
      width: 100%;
      padding: 14px 16px;
      background: #0d0f14;
      border: 1px solid var(--border-light);
      border-radius: 8px;
      color: #fff;
      font-family: 'JetBrains Mono', monospace;
      font-size: 14px;
      text-align: center;
      letter-spacing: 1.5px;
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .key-gate-input:focus {
      border-color: var(--accent-blue);
      box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.2);
    }
    .key-gate-btn {
      width: 100%;
      padding: 13px;
      background: var(--green);
      border: none;
      border-radius: 8px;
      color: #fff;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: background 0.2s, transform 0.1s;
    }
    .key-gate-btn:hover {
      background: var(--green-bright);
    }
    .key-gate-btn:active {
      transform: scale(0.98);
    }
    .key-gate-error {
      margin-top: 14px;
      font-size: 12.5px;
      color: var(--red);
      min-height: 18px;
    }

    /* Empty state waiting in room */
    .sp-empty-waiting {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 80px 20px;
      text-align: center;
      color: var(--text-muted);
    }
    .sp-waiting-spinner {
      width: 44px;
      height: 44px;
      border: 3px solid rgba(56, 139, 253, 0.15);
      border-top-color: #388bfd;
      border-radius: 50%;
      animation: spin 1s linear infinite;
      margin-bottom: 20px;
    }
    @keyframes spin {
      to { transform: rotate(360deg); }
    }
    .sp-waiting-txt {
      font-size: 17px;
      font-weight: 700;
      color: #fff;
      margin-bottom: 8px;
      letter-spacing: -0.3px;
    }
    .sp-waiting-sub {
      font-size: 13px;
      color: var(--text-dim);
      max-width: 360px;
      line-height: 1.5;
    }

    /* Exam Images & Formulas Styling */
    .exam-img-wrap {
      display: block;
      margin: 14px 0;
      text-align: left;
    }
    .exam-img {
      max-width: 100%;
      max-height: 520px;
      height: auto;
      border-radius: 8px;
      border: 1px solid #d0d7de;
      background: #ffffff;
      padding: 8px;
      cursor: zoom-in;
      transition: transform 0.15s, border-color 0.15s;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    }
    .exam-img:hover {
      transform: scale(1.015);
      border-color: #58a6ff;
    }
    .exam-inline-img {
      display: inline-block;
      vertical-align: middle;
      max-height: 52px;
      margin: 0 4px;
    }
    /* Formula & Math LaTeX Image Styling: Bright, Crisp, High Contrast White Background */
    img[src*="codecogs"],
    img[src*="svg.image"],
    img[src*="png.image"],
    img[src*="latex"],
    .exam-math-img,
    .exam-inline-img.exam-math-img,
    .q-body img.exam-math-img,
    .choice-text img.exam-math-img,
    .choice-text img {
      filter: none !important;
      background: #ffffff !important;
      border: 1px solid #d0d7de !important;
      border-radius: 6px !important;
      padding: 4px 10px !important;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15) !important;
      display: inline-block !important;
      vertical-align: middle !important;
      margin: 3px 5px !important;
      max-height: 60px !important;
      width: auto !important;
    }
    /* MathJax container if typeset */
    mjx-container,
    mjx-container[display="true"] {
      background: #ffffff !important;
      color: #000000 !important;
      border: 1px solid #d0d7de !important;
      border-radius: 6px !important;
      padding: 4px 10px !important;
      display: inline-block !important;
      vertical-align: middle !important;
      margin: 3px 5px !important;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15) !important;
    }
    mjx-container * {
      color: #000000 !important;
      fill: #000000 !important;
    }
    .session-card .card-info-row .seller-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      color: #c4b5fd;
      font-weight: 600;
      font-size: 11.5px;
    }