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

    body {
      font-family: 'IBM Plex Sans', sans-serif;
      background: #0d0d14;
      color: #fff;
      min-height: 100vh
    }

    /* ── Header ────────────────────────────── */
    .hdr {
      height: 58px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 24px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
      position: sticky;
      top: 0;
      background: rgba(13, 13, 20, 0.95);
      backdrop-filter: blur(12px);
      z-index: 100
    }

    .brand {
      font-family: 'Syne', sans-serif;
      font-size: 1.1rem;
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 10px
    }

    .brand-pill {
      background: linear-gradient(135deg, #7c3aed, #5b21b6);
      border-radius: 6px;
      padding: 3px 10px;
      font-size: 0.72rem;
      letter-spacing: .08em;
      text-transform: uppercase
    }

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

    .hdr-email {
      color: rgba(255, 255, 255, 0.5);
      font-size: 0.82rem
    }

    .hdr-link {
      color: #60a5fa;
      text-decoration: none;
      font-size: 0.85rem;
      padding: 5px 12px;
      border: 1px solid rgba(96, 165, 250, 0.3);
      border-radius: 6px;
      transition: all 0.2s
    }

    .hdr-link:hover {
      background: rgba(96, 165, 250, 0.1);
      border-color: #60a5fa
    }

    .logout-btn {
      background: none;
      border: 1px solid rgba(255, 255, 255, 0.15);
      color: rgba(255, 255, 255, 0.5);
      padding: 5px 12px;
      border-radius: 6px;
      font-size: 0.82rem;
      cursor: pointer;
      transition: all 0.2s
    }

    .logout-btn:hover {
      border-color: #dc2626;
      color: #f87171
    }

    /* ── Main Wrapper ──────────────────────── */
    .wrap {
      max-width: 1100px;
      margin: 0 auto;
      padding: 28px 20px 60px
    }

    .page-title {
      font-family: 'Syne', sans-serif;
      font-size: 1.8rem;
      font-weight: 800;
      margin-bottom: 6px
    }

    .page-sub {
      color: rgba(255, 255, 255, 0.4);
      font-size: 0.88rem;
      margin-bottom: 28px
    }

    /* ── Stats Row ─────────────────────────── */
    .stats-row {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
      gap: 14px;
      margin-bottom: 32px
    }

    .stat-card {
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 14px;
      padding: 20px;
      position: relative;
      overflow: hidden;
      transition: border-color 0.3s, transform 0.2s
    }

    .stat-card:hover {
      border-color: rgba(124, 58, 237, 0.4);
      transform: translateY(-2px)
    }

    .stat-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 3px;
      background: linear-gradient(90deg, #7c3aed, #a78bfa);
      opacity: 0.7
    }

    .stat-card .num {
      font-family: 'Syne', sans-serif;
      font-size: 2rem;
      font-weight: 800;
      background: linear-gradient(135deg, #a78bfa, #60a5fa);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text
    }

    .stat-card .lbl {
      font-size: 0.74rem;
      color: rgba(255, 255, 255, 0.45);
      text-transform: uppercase;
      letter-spacing: .06em;
      margin-top: 4px
    }

    /* ── Section Headers ───────────────────── */
    .section-hdr {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 16px;
      flex-wrap: wrap;
      gap: 12px
    }

    .section-title {
      font-family: 'Syne', sans-serif;
      font-size: 1.2rem;
      font-weight: 700
    }

    /* ── Test History Table & Mobile Cards ─── */
    .history-card {
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 16px;
      overflow: hidden;
      margin-bottom: 32px;
      position: relative;
    }

    .history-table-wrap {
      width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }

    .history-table {
      width: 100%;
      min-width: 720px;
      border-collapse: collapse;
    }

    .history-table thead th {
      text-align: left;
      padding: 14px 16px;
      font-size: 0.74rem;
      font-weight: 600;
      color: rgba(255, 255, 255, 0.4);
      text-transform: uppercase;
      letter-spacing: .06em;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(255, 255, 255, 0.02);
      white-space: nowrap;
    }

    .history-table tbody tr {
      cursor: pointer;
      transition: background 0.15s;
    }

    .history-table tbody tr:hover {
      background: rgba(124, 58, 237, 0.08);
    }

    .history-table td {
      padding: 14px 16px;
      font-size: 0.88rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.04);
      white-space: nowrap;
    }

    .history-table .topic-cell {
      font-weight: 600;
      white-space: normal;
      min-width: 140px;
    }

    /* Native Mobile Cards for Test Reports */
    .history-mobile-cards {
      display: none;
      flex-direction: column;
      gap: 12px;
      padding: 12px;
    }

    .report-mobile-card {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 14px;
      padding: 14px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      transition: all 0.2s ease;
    }

    .report-mobile-card:hover {
      border-color: rgba(96, 165, 250, 0.35);
      background: rgba(255, 255, 255, 0.05);
    }

    .report-mobile-card.selected {
      border-color: #2563eb;
      background: rgba(37, 99, 235, 0.12);
    }

    .report-card-top {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
    }

    .report-card-title-group {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      flex: 1;
    }

    .report-card-title {
      font-family: 'Syne', sans-serif;
      font-size: 1.02rem;
      font-weight: 700;
      color: #fff;
      line-height: 1.3;
    }

    .report-card-band {
      font-family: 'IBM Plex Mono', monospace;
      font-weight: 700;
      color: #34d399;
      font-size: 0.95rem;
      background: rgba(5, 150, 105, 0.15);
      border: 1px solid rgba(5, 150, 105, 0.3);
      padding: 4px 10px;
      border-radius: 8px;
      white-space: nowrap;
    }

    .report-card-meta {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 8px;
      padding: 8px 12px;
      background: rgba(255, 255, 255, 0.03);
      border-radius: 8px;
    }

    .report-card-date {
      color: rgba(255, 255, 255, 0.55);
      font-size: 0.8rem;
    }

    .report-card-scores {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .report-card-actions {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin-top: 2px;
    }

    .report-card-btn {
      padding: 9px 12px;
      border-radius: 10px;
      font-size: 0.85rem;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      text-align: center;
      border: 1px solid rgba(255, 255, 255, 0.15);
      background: rgba(255, 255, 255, 0.05);
      color: #fff;
      transition: all 0.2s;
      min-height: 40px;
    }

    .report-card-btn.primary {
      background: #059669;
      border-color: #059669;
    }

    .report-card-btn:hover {
      filter: brightness(1.15);
    }

    .score-pill {
      display: inline-block;
      padding: 3px 10px;
      border-radius: 100px;
      font-size: 0.78rem;
      font-weight: 600;
    }

    .score-pill.high { background: rgba(5, 150, 105, 0.15); color: #6ee7b7; border: 1px solid rgba(5, 150, 105, 0.3); }
    .score-pill.mid { background: rgba(217, 119, 6, 0.15); color: #fbbf24; border: 1px solid rgba(217, 119, 6, 0.3); }
    .score-pill.low { background: rgba(220, 38, 38, 0.15); color: #f87171; border: 1px solid rgba(220, 38, 38, 0.3); }

    .grade-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      border-radius: 8px;
      font-size: 0.82rem;
      font-weight: 700;
      font-family: 'Syne', sans-serif
    }

    .grade-badge.a { background: rgba(5, 150, 105, 0.2); color: #6ee7b7 }
    .grade-badge.b { background: rgba(96, 165, 250, 0.2); color: #93c5fd }
    .grade-badge.c { background: rgba(217, 119, 6, 0.2); color: #fbbf24 }
    .grade-badge.d { background: rgba(220, 38, 38, 0.2); color: #f87171 }

    .check-col { width: 40px; text-align: center }
    .check-col input[type="checkbox"] {
      width: 16px;
      height: 16px;
      accent-color: #7c3aed;
      cursor: pointer
    }

    /* ── Combined Report Controls ──────────── */
    .combine-bar {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap
    }

    .btn {
      padding: 9px 18px;
      border-radius: 8px;
      font-family: inherit;
      font-size: 0.85rem;
      font-weight: 600;
      cursor: pointer;
      border: none;
      transition: all 0.2s;
      display: inline-flex;
      align-items: center;
      gap: 6px
    }

    .btn-primary {
      background: linear-gradient(135deg, #7c3aed, #5b21b6);
      color: #fff
    }

    .btn-primary:hover {
      transform: translateY(-1px);
      box-shadow: 0 6px 20px rgba(124, 58, 237, 0.35)
    }

    .btn-primary:disabled {
      opacity: 0.4;
      cursor: not-allowed;
      transform: none;
      box-shadow: none
    }

    .btn-outline {
      background: none;
      border: 1px solid rgba(255, 255, 255, 0.15);
      color: rgba(255, 255, 255, 0.7)
    }

    .btn-outline:hover {
      border-color: #7c3aed;
      color: #fff
    }

    .btn-green {
      background: linear-gradient(135deg, #059669, #047857);
      color: #fff
    }

    .btn-green:hover {
      transform: translateY(-1px);
      box-shadow: 0 6px 20px rgba(5, 150, 105, 0.35)
    }

    .selected-count {
      font-size: 0.82rem;
      color: rgba(255, 255, 255, 0.45)
    }

    /* ── Combined Report Card ──────────────── */
    .combined-report {
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(124, 58, 237, 0.3);
      border-radius: 16px;
      padding: 28px;
      margin-bottom: 32px;
      animation: fadeSlide 0.4s ease
    }

    @keyframes fadeSlide {
      from { opacity: 0; transform: translateY(16px) }
      to { opacity: 1; transform: translateY(0) }
    }

    .combined-report .report-title {
      font-family: 'Syne', sans-serif;
      font-size: 1.3rem;
      font-weight: 700;
      margin-bottom: 4px
    }

    .combined-report .report-sub {
      font-size: 0.82rem;
      color: rgba(255, 255, 255, 0.4);
      margin-bottom: 20px
    }

    .combined-stats {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
      gap: 12px;
      margin-bottom: 24px
    }

    .cstat {
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.06);
      border-radius: 10px;
      padding: 14px;
      text-align: center
    }

    .cstat .cn {
      font-family: 'Syne', sans-serif;
      font-size: 1.5rem;
      font-weight: 800
    }

    .cstat .cn.green { color: #6ee7b7 }
    .cstat .cn.red { color: #f87171 }
    .cstat .cn.amber { color: #fbbf24 }
    .cstat .cn.blue { color: #93c5fd }
    .cstat .cn.purple { color: #a78bfa }

    .cstat .cl {
      font-size: 0.72rem;
      color: rgba(255, 255, 255, 0.4);
      text-transform: uppercase;
      letter-spacing: .05em;
      margin-top: 3px
    }

    .charts-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
      margin-bottom: 24px
    }

    .chart-box {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.06);
      border-radius: 12px;
      padding: 20px
    }

    .chart-box h4 {
      font-family: 'Syne', sans-serif;
      font-size: 0.9rem;
      font-weight: 700;
      margin-bottom: 14px;
      color: rgba(255, 255, 255, 0.8)
    }

    /* ── Topic Breakdown Table ─────────────── */
    .topic-breakdown {
      width: 100%;
      border-collapse: collapse;
      margin-top: 8px
    }

    .topic-breakdown th {
      text-align: left;
      padding: 10px 12px;
      font-size: 0.72rem;
      font-weight: 600;
      color: rgba(255, 255, 255, 0.4);
      text-transform: uppercase;
      letter-spacing: .05em;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06)
    }

    .topic-breakdown td {
      padding: 10px 12px;
      font-size: 0.84rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.03)
    }

    .perf-bar {
      height: 6px;
      border-radius: 3px;
      background: rgba(255, 255, 255, 0.08);
      overflow: hidden;
      min-width: 80px
    }

    .perf-bar-fill {
      height: 100%;
      border-radius: 3px;
      transition: width 0.6s ease
    }

    /* ── Modal (Individual Test Detail) ────── */
    .modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.7);
      backdrop-filter: blur(6px);
      z-index: 200;
      align-items: center;
      justify-content: center;
      padding: 20px
    }

    .modal-overlay.open {
      display: flex
    }

    .modal-box {
      background: #13131e;
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 20px;
      padding: 28px;
      max-width: 700px;
      width: 100%;
      max-height: 85vh;
      overflow-y: auto;
      animation: fadeSlide 0.3s ease
    }

    .modal-box::-webkit-scrollbar { width: 6px }
    .modal-box::-webkit-scrollbar-track { background: transparent }
    .modal-box::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px }

    .modal-hdr {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 20px
    }

    .modal-hdr h3 {
      font-family: 'Syne', sans-serif;
      font-size: 1.1rem;
      font-weight: 700
    }

    .modal-close {
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid rgba(255, 255, 255, 0.1);
      color: #fff;
      width: 32px;
      height: 32px;
      border-radius: 8px;
      cursor: pointer;
      font-size: 1rem;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.15s
    }

    .modal-close:hover {
      background: rgba(220, 38, 38, 0.2);
      border-color: rgba(220, 38, 38, 0.4)
    }

    .modal-stats {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 10px;
      margin-bottom: 20px
    }

    .modal-stat {
      text-align: center;
      padding: 12px;
      background: rgba(255, 255, 255, 0.03);
      border-radius: 10px;
      border: 1px solid rgba(255, 255, 255, 0.06)
    }

    .modal-stat .ms-num {
      font-family: 'Syne', sans-serif;
      font-size: 1.3rem;
      font-weight: 800
    }

    .modal-stat .ms-lbl {
      font-size: 0.7rem;
      color: rgba(255, 255, 255, 0.4);
      text-transform: uppercase;
      letter-spacing: .04em;
      margin-top: 2px
    }

    .modal-chart-wrap {
      margin-bottom: 20px;
      max-width: 260px;
      margin-left: auto;
      margin-right: auto
    }

    .q-review-hdr {
      font-family: 'Syne', sans-serif;
      font-size: 0.95rem;
      font-weight: 700;
      margin-bottom: 12px;
      padding-bottom: 8px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08)
    }

    .q-item {
      padding: 10px 0;
      border-bottom: 1px solid rgba(255, 255, 255, 0.04);
      font-size: 0.84rem
    }

    .q-item .q-id {
      font-weight: 600;
      margin-right: 6px
    }

    .q-item .q-status {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 4px;
      font-size: 0.72rem;
      font-weight: 600;
      margin-left: 6px
    }

    .q-status.correct { background: rgba(5,150,105,0.15); color: #6ee7b7 }
    .q-status.wrong { background: rgba(220,38,38,0.15); color: #f87171 }
    .q-status.unattempted { background: rgba(217,119,6,0.15); color: #fbbf24 }

    .q-detail {
      margin-top: 4px;
      font-size: 0.8rem;
      color: rgba(255, 255, 255, 0.5)
    }

    .q-card {
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid rgba(255, 255, 255, 0.06);
      border-radius: 12px;
      padding: 16px;
      margin-bottom: 16px;
      text-align: left;
    }
    .q-card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
    }
    .q-card-text {
      font-size: 0.9rem;
      line-height: 1.5;
      color: rgba(255, 255, 255, 0.9);
      margin-bottom: 12px;
      white-space: pre-wrap;
      text-align: left;
    }
    .q-image-container {
      text-align: center;
      margin-bottom: 14px;
      background: rgba(255, 255, 255, 0.02);
      border-radius: 8px;
      padding: 10px;
      border: 1px dashed rgba(255, 255, 255, 0.1);
    }
    .q-image-container img {
      max-width: 100%;
      height: auto;
      border-radius: 4px;
    }
    .q-card-opts {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-bottom: 12px;
    }
    .q-card-opt {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 8px;
      font-size: 0.85rem;
      transition: all 0.2s;
      text-align: left;
    }
    .q-card-opt-letter {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.1);
      font-weight: 600;
      font-size: 0.75rem;
      flex-shrink: 0;
    }
    .q-card-opt.correct {
      border-color: #059669;
      background: rgba(5, 150, 105, 0.1);
      color: #6ee7b7;
    }
    .q-card-opt.correct .q-card-opt-letter {
      background: #059669;
      color: #fff;
    }
    .q-card-opt.wrong-chosen {
      border-color: #dc2626;
      background: rgba(220, 38, 38, 0.1);
      color: #f87171;
    }
    .q-card-opt.wrong-chosen .q-card-opt-letter {
      background: #dc2626;
      color: #fff;
    }
    .q-card-exp {
      background: rgba(124, 58, 237, 0.05);
      border-left: 3px solid #7c3aed;
      padding: 10px 14px;
      border-radius: 0 8px 8px 0;
      font-size: 0.8rem;
      color: #c084fc;
      line-height: 1.4;
      text-align: left;
    }

    /* ── Empty / Loading ───────────────────── */
    .empty-state {
      text-align: center;
      padding: 60px 20px;
      color: rgba(255, 255, 255, 0.35)
    }

    .empty-state .empty-icon {
      font-size: 3rem;
      margin-bottom: 12px
    }

    .empty-state h3 {
      font-family: 'Syne', sans-serif;
      color: rgba(255, 255, 255, 0.6);
      margin-bottom: 8px
    }

    .loading-spinner {
      text-align: center;
      padding: 60px;
      color: rgba(255, 255, 255, 0.4)
    }

    .loading-spinner::after {
      content: '';
      display: inline-block;
      width: 28px;
      height: 28px;
      border: 3px solid rgba(124, 58, 237, 0.2);
      border-top-color: #7c3aed;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
      margin-top: 12px
    }

    @keyframes spin {
      to { transform: rotate(360deg) }
    }

    /* Portal Switcher */
    .portal-switcher {
      display: flex;
      gap: 12px;
      margin: 10px 0 24px 0;
      background: rgba(255, 255, 255, 0.03);
      padding: 6px;
      border-radius: 12px;
      border: 1px solid rgba(255, 255, 255, 0.08);
      width: fit-content;
      flex-wrap: wrap;
    }
    .portal-btn {
      background: transparent;
      border: none;
      color: rgba(255, 255, 255, 0.6);
      padding: 10px 24px;
      border-radius: 8px;
      font-family: 'Syne', sans-serif;
      font-size: 0.95rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .portal-btn.active {
      background: #1a56db;
      color: #fff;
      box-shadow: 0 4px 15px rgba(26, 86, 219, 0.4);
    }
    .portal-btn:hover:not(.active) {
      background: rgba(255, 255, 255, 0.06);
      color: #fff;
    }
    .tmua-locked-box {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 20px;
      padding: 40px 20px;
      text-align: center;
      max-width: 550px;
      margin: 30px auto;
    }
    .tmua-test-card {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 14px;
      padding: 18px;
      margin-bottom: 14px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      cursor: pointer;
      transition: all 0.2s;
    }
    .tmua-test-card:hover {
      border-color: rgba(255, 255, 255, 0.2);
      transform: translateY(-2px);
    }

    /* ── Responsive Media Queries ──────────── */
    @media (max-width: 768px) {
      .charts-grid { grid-template-columns: 1fr; gap: 16px; }
      .modal-stats { grid-template-columns: repeat(2, 1fr); }
      .history-table-wrap { display: none !important; }
      .history-mobile-cards { display: flex !important; }
      .hdr { padding: 0 14px; min-height: 56px; }
      .page-title { font-size: 1.4rem; }
      .wrap { padding: 18px 14px 40px; }
      .stat-card .num { font-size: 1.5rem; }
      .portal-switcher { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
      .portal-btn { justify-content: center; padding: 10px 10px; font-size: 0.85rem; }
      .tmua-test-card { flex-direction: column; align-items: flex-start; gap: 10px; }
      .tmua-test-card > div:last-child { width: 100%; text-align: right; }
    }

    @media (max-width: 480px) {
      .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
      .hdr-email { display: none; }
      .portal-switcher { grid-template-columns: 1fr 1fr; }
      .brand { font-size: 0.95rem; }
      .stat-card { padding: 14px; }
    }

