    :root {
      color-scheme: dark;
      font-size: 14px;
      --button-text: #21192e;
      --bg: #1b1c1f;
      --panel: #202124;
      --panel-strong: #161719;
      --card: #27272c;
      --surface: #1b1c1f;
      --surface-hover: #27272c;
      --control: #303035;
      --input-bg: #1b1c1f;
      --overlay: rgba(2, 6, 23, 0.84);
      --border: #36373b;
      --text: #efeeeb;
      --muted: #a5a5a9;
      --heading-soft: #d7d4df;
      --cyan: #c5b4ec;
      --blue: #c5b4ec;
      --purple: #a5a5a9;
      --green: #a2c9ae;
      --red: #f0a8a5;
      --yellow: #d8ba8a;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }

    :root[data-theme="light"] {
      color-scheme: light;
      --bg: #f6f5f2;
      --panel: #ffffff;
      --panel-strong: #eeedeb;
      --card: #ffffff;
      --surface: #f2f1ee;
      --surface-hover: #e7e3ed;
      --control: #e6e5e2;
      --input-bg: #ffffff;
      --overlay: #f6f5f2;
      --border: #d4d2d6;
      --text: #252329;
      --muted: #68646e;
      --heading-soft: #4a4254;
      --cyan: #695284;
      --blue: #695284;
      --purple: #736780;
      --green: #34704b;
      --red: #a83c38;
      --yellow: #86642c;
      --button-text: #ffffff;
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      min-height: 100vh;
      background: var(--bg);
      color: var(--text);
    }

    body::before {
      display: none;
    }

    button,
    input,
    select,
    textarea {
      font: inherit;
    }

    .hidden {
      display: none !important;
    }

    .shell {
      width: 100%;
      margin: 0;
      padding: 0;
      position: relative;
      z-index: 1;
    }

    .topbar {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      z-index: 10;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      min-height: 72px;
      padding: 12px 24px;
      border: 0;
      border-bottom: 1px solid var(--border);
      border-radius: 0;
      background: var(--panel-strong);
      box-shadow: none;
    }

    .admin-layout {
      display: block;
      padding-top: 72px;
      align-items: start;
    }

    .tab-nav {
      position: fixed;
      top: 72px;
      left: 0;
      bottom: 0;
      z-index: 9;
      width: 214px;
      display: grid;
      align-content: start;
      gap: 4px;
      margin: 0;
      padding: 24px 14px;
      border: 0;
      border-right: 1px solid var(--border);
      border-radius: 0;
      background: var(--panel-strong);
      overflow-y: auto;
    }

    .tab-content {
      min-width: 0;
      width: calc(100% - 214px);
      max-width: 1540px;
      margin-left: 214px;
      padding: 34px clamp(24px, 4vw, 56px) 54px;
    }

    .tab-btn {
      border: 0;
      border-radius: 5px;
      min-height: 39px;
      padding: 10px 12px;
      background: transparent;
      color: var(--muted);
      cursor: pointer;
      font-weight: 500;
      font-size: 13px;
      white-space: nowrap;
      text-align: left;
    }

    .tab-btn.active {
      color: var(--heading-soft);
      background: var(--surface-hover);
    }

    [data-tab-panel]:not(.active-tab-panel) {
      display: none !important;
    }

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

    .brand img {
      display: block;
      width: 32px;
      height: 32px;
      border-radius: 7px;
    }

    .brand strong {
      margin: 0;
      font-size: 15px;
      letter-spacing: 0;
    }

    .brand p {
      margin: 4px 0 0;
      color: var(--muted);
      font-size: 0.82rem;
    }

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

    .pill {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 6px 8px;
      border: 0;
      border-radius: 4px;
      color: var(--muted);
      background: transparent;
      font-size: 12px;
    }

    .health-pill {
      padding: 6px 8px;
    }

    .health-pill #healthText {
      display: inline;
    }

    .theme-toggle {
      border: 1px solid var(--border);
      border-radius: 5px;
      padding: 9px 12px;
      background: var(--surface);
      color: var(--text);
      cursor: pointer;
      font-weight: 550;
      font-size: 0.86rem;
    }

    .btn {
      border: 1px solid var(--blue);
      border-radius: 5px;
      min-height: 36px;
      padding: 8px 13px;
      color: var(--button-text);
      background: var(--blue);
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
      box-shadow: none;
      transition: background .15s;
    }

    .btn:hover {
      filter: brightness(1.08);
    }

    .btn:disabled {
      opacity: 0.55;
      cursor: not-allowed;
      transform: none;
    }

    .btn.secondary {
      background: var(--control);
      color: var(--text);
      border: 1px solid var(--border);
    }

    .hero {
      display: grid;
      grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
      gap: 18px;
      margin-bottom: 18px;
    }

    .hero.updates-stack {
      grid-template-columns: minmax(0, 1fr);
    }

    .panel {
      border: 0;
      border-top: 1px solid var(--border);
      background: transparent;
      border-radius: 0;
      padding: 24px 0;
      box-shadow: none;
      overflow: hidden;
    }

    .panel h2,
    .panel h3 {
      margin: 0;
      letter-spacing: -0.03em;
    }

    .panel-subtitle {
      margin: 8px 0 0;
      color: var(--muted);
    }

    .connection-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
      margin-top: 18px;
    }

    .live-connections-grid {
      grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .live-connections-grid .mini {
      min-height: 108px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
    }

    .metric-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 0;
      border-top: 1px solid var(--border);
      border-bottom: 1px solid var(--border);
      margin-bottom: 30px;
    }

    .metric {
      min-height: 98px;
      border: 0;
      border-radius: 0;
      padding: 20px 16px;
      background: transparent;
      position: relative;
      overflow: hidden;
    }

    .metric::after {
      display: none;
    }

    .metric-icon {
      display: none;
    }

    .metric-value {
      font-size: 26px;
      font-weight: 500;
      letter-spacing: -.5px;
      font-variant-numeric: tabular-nums;
    }

    .metric-label {
      color: var(--muted);
      font-weight: 400;
      font-size: 12px;
      margin-top: 8px;
    }

    .mini {
      border: 0;
      border-bottom: 1px solid var(--border);
      border-radius: 0;
      padding: 14px 0;
      background: transparent;
    }

    .mini .label {
      color: var(--muted);
      font-size: 0.82rem;
      margin-bottom: 8px;
    }

    .mini .value {
      font-size: 21px;
      font-weight: 500;
      letter-spacing: -.3px;
      font-variant-numeric: tabular-nums;
    }

    .mini.status-warning {
      border-color: rgba(245, 158, 11, 0.72);
      background: rgba(245, 158, 11, 0.12);
    }

    .mini.status-critical {
      border-color: rgba(239, 68, 68, 0.8);
      background: rgba(239, 68, 68, 0.13);
    }

    .mini.status-healthy {
      border-color: var(--border);
    }

    .health-alerts {
      display: grid;
      gap: 9px;
      margin-top: 14px;
    }

    .health-alert {
      padding: 11px 13px;
      border-radius: 5px;
      border: 1px solid rgba(245, 158, 11, 0.55);
      background: rgba(245, 158, 11, 0.1);
      color: var(--text);
      font-weight: 500;
    }

    .health-alert.critical {
      border-color: rgba(239, 68, 68, 0.72);
      background: rgba(239, 68, 68, 0.12);
    }

    .health-alert.healthy {
      border-color: var(--border);
      background: transparent;
      color: var(--green);
    }

    .status-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      display: inline-block;
      background: var(--green);
    }

    .status-dot.bad {
      background: var(--red);
      box-shadow: none;
    }

    .status-dot.warning {
      background: var(--yellow);
      box-shadow: none;
    }

    .content-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
      gap: 18px;
    }

    .detail-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 14px;
      margin-bottom: 18px;
    }

    .section-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      margin-bottom: 16px;
    }

    .table-wrap {
      overflow-x: auto;
      border-radius: 0;
      border: 0;
      border-top: 1px solid var(--border);
    }

    table {
      width: 100%;
      min-width: 720px;
      border-collapse: collapse;
      background: transparent;
    }

    th,
    td {
      padding: 13px 14px;
      text-align: left;
      border-bottom: 1px solid var(--border);
      vertical-align: top;
    }

    th {
      color: var(--muted);
      font-size: 0.75rem;
      text-transform: none;
      letter-spacing: 0;
    }

    td {
      color: var(--text);
      font-size: 0.92rem;
    }

    .tag {
      display: inline-flex;
      align-items: center;
      padding: 4px 7px;
      border-radius: 4px;
      font-size: 11px;
      font-weight: 500;
      background: var(--control);
      color: var(--heading-soft);
      border: 0;
    }

    .tag.teacher {
      background: var(--control);
      color: var(--heading-soft);
    }

    .tag.student {
      background: var(--control);
      color: var(--heading-soft);
    }

    .empty {
      padding: 26px;
      color: var(--muted);
      text-align: center;
      border: 1px dashed var(--border);
      border-radius: 5px;
      background: var(--surface);
    }

    .user-toolbar {
      display: grid;
      grid-template-columns: minmax(220px, 1.3fr) repeat(3, minmax(130px, 0.65fr)) auto;
      gap: 10px;
      align-items: end;
      margin-top: 16px;
    }

    .user-profile-layout {
      display: grid;
      grid-template-columns: minmax(300px, 0.74fr) minmax(0, 1.26fr);
      gap: 18px;
      margin-bottom: 18px;
    }

    #userProfileDetail {
      max-height: min(760px, calc(100vh - 270px));
      overflow-x: hidden;
      overflow-y: auto;
      overscroll-behavior-y: auto;
      scroll-behavior: auto;
      touch-action: pan-y;
      scrollbar-gutter: stable;
      padding-right: 4px;
    }

    .user-list {
      display: grid;
      gap: 0;
      max-height: min(760px, calc(100vh - 270px));
      overflow-x: hidden;
      overflow-y: auto;
      overscroll-behavior-y: auto;
      scroll-behavior: auto;
      touch-action: pan-y;
      scrollbar-gutter: stable;
      padding-right: 4px;
    }

    .user-card {
      width: 100%;
      border: 0;
      border-bottom: 1px solid var(--border);
      border-radius: 0;
      padding: 15px 10px;
      background: transparent;
      color: var(--text);
      cursor: pointer;
      text-align: left;
    }

    .user-card:hover,
    .user-card.selected {
      border-color: var(--cyan);
      background: var(--surface-hover);
    }

    .user-row {
      display: flex;
      gap: 12px;
      align-items: center;
      min-width: 0;
    }

    .avatar {
      width: 48px;
      height: 48px;
      flex: 0 0 auto;
      display: grid;
      place-items: center;
      overflow: hidden;
      border-radius: 5px;
      background: var(--control);
      color: var(--heading-soft);
      font-weight: 550;
      border: 1px solid var(--border);
    }

    .avatar.large {
      width: 84px;
      height: 84px;
      border-radius: 5px;
      font-size: 1.6rem;
    }

    .avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .user-main {
      min-width: 0;
      flex: 1;
    }

    .user-name {
      margin: 0;
      font-weight: 550;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .user-meta {
      margin-top: 3px;
      color: var(--muted);
      font-size: 0.82rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .user-card-footer,
    .profile-chip-row {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 12px;
    }

    .profile-tabs {
      display: flex;
      gap: 8px;
      margin: 0 0 16px;
      padding-bottom: 10px;
      overflow-x: auto;
      border-bottom: 1px solid var(--border);
    }

    .profile-tab-btn {
      flex: 0 0 auto;
      border: 1px solid var(--border);
      border-radius: 5px;
      padding: 9px 13px;
      background: var(--surface);
      color: var(--muted);
      cursor: pointer;
      font-weight: 550;
    }

    .profile-tab-btn.active {
      border-color: var(--cyan);
      background: var(--surface-hover);
      color: var(--text);
    }

    .profile-tab-panel {
      display: none;
    }

    .profile-tab-panel.active {
      display: block;
    }

    .profile-head {
      display: flex;
      align-items: flex-start;
      gap: 16px;
      margin-bottom: 18px;
    }

    .profile-title {
      min-width: 0;
      flex: 1;
    }

    .profile-title h3 {
      margin: 0;
      font-size: 1.45rem;
    }

    .profile-title p {
      margin: 5px 0 0;
      color: var(--muted);
    }

    .profile-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
      margin: 16px 0;
    }

    .profile-field {
      padding: 12px 0;
      border: 0;
      border-bottom: 1px solid var(--border);
      border-radius: 0;
      background: transparent;
    }

    .profile-field span {
      display: block;
      color: var(--muted);
      font-size: 0.76rem;
      font-weight: 550;
      margin-bottom: 6px;
      text-transform: none;
      letter-spacing: 0;
    }

    .profile-field strong {
      display: block;
      color: var(--text);
      font-size: 0.94rem;
      word-break: break-word;
    }

    .profile-section-title {
      margin: 18px 0 10px;
      color: var(--heading-soft);
      font-size: 0.86rem;
      font-weight: 550;
      text-transform: none;
      letter-spacing: 0;
    }

    .plan-edit-form {
      margin-top: 14px;
      padding: 14px;
      border: 1px solid var(--border);
      border-radius: 5px;
      background: var(--surface);
    }

    .analysis-section {
      margin-bottom: 18px;
    }

    .analysis-metrics {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
      margin: 16px 0;
    }

    .chart-bars {
      display: grid;
      gap: 10px;
      margin-top: 16px;
    }

    .chart-row {
      display: grid;
      grid-template-columns: 96px minmax(0, 1fr) 54px;
      align-items: center;
      gap: 10px;
      color: var(--muted);
      font-size: 0.82rem;
    }

    .bar-track {
      height: 6px;
      border-radius: 0;
      background: var(--border);
      overflow: hidden;
    }

    .bar-fill {
      height: 100%;
      min-width: 3px;
      border-radius: inherit;
      background: var(--cyan);
    }

    .danger-btn {
      background: rgba(239, 68, 68, 0.14);
      color: var(--red);
      border: 1px solid rgba(239, 68, 68, 0.3);
      box-shadow: none;
    }

    .split-panels {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 18px;
      margin-bottom: 18px;
    }

    .login-overlay {
      position: fixed;
      inset: 0;
      z-index: 20;
      display: grid;
      place-items: center;
      padding: 32px 20px;
      background: var(--bg);
      overflow-y: auto;
    }

    .login-card {
      width: min(360px, 100%);
      border: 0;
      background: transparent;
      border-radius: 0;
      padding: 0;
      box-shadow: none;
    }

    .login-card h2 {
      margin: 0 0 10px;
      font-size: 26px;
      font-weight: 600;
      letter-spacing: -.6px;
    }

    .login-header {
      margin-bottom: 28px;
    }

    .password-field {
      position: relative;
    }

    .password-field input {
      padding-right: 84px;
    }

    .password-toggle {
      position: absolute;
      top: 50%;
      right: 8px;
      transform: translateY(-50%);
      border: 0;
      border-radius: 5px;
      padding: 8px 10px;
      background: var(--control);
      color: var(--heading-soft);
      cursor: pointer;
      font-size: 0.82rem;
      font-weight: 550;
    }

    label {
      display: block;
      color: var(--heading-soft);
      font-weight: 550;
      margin: 14px 0 8px;
      font-size: 0.88rem;
    }

    input,
    select,
    textarea {
      width: 100%;
      border: 1px solid var(--border);
      border-radius: 5px;
      padding: 13px 14px;
      background: var(--input-bg);
      color: var(--text);
      outline: none;
    }

    textarea {
      min-height: 140px;
      resize: vertical;
      line-height: 1.45;
    }

    input:focus,
    select:focus,
    textarea:focus {
      border-color: var(--cyan);
      outline: 2px solid var(--cyan);
      outline-offset: 2px;
      box-shadow: none;
    }

    .form-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 14px;
      margin-top: 16px;
    }

    .form-grid .full {
      grid-column: 1 / -1;
    }

    .checkbox-row {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      margin-top: 16px;
    }

    .check-pill {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 9px 11px;
      border: 1px solid var(--border);
      border-radius: 5px;
      color: var(--muted);
      background: var(--surface);
      font-size: 0.86rem;
      cursor: pointer;
    }

    .check-pill input {
      width: auto;
      accent-color: var(--cyan);
    }

    .notice {
      margin-top: 12px;
      color: var(--muted);
      font-size: 0.9rem;
      line-height: 1.5;
    }

    .success {
      color: var(--green);
      background: rgba(34, 197, 94, 0.12);
      border: 1px solid rgba(34, 197, 94, 0.25);
      border-radius: 5px;
      padding: 11px 12px;
      margin-top: 14px;
      font-size: 0.9rem;
    }

    .error {
      color: var(--red);
      background: rgba(239, 68, 68, 0.12);
      border: 1px solid rgba(239, 68, 68, 0.25);
      border-radius: 5px;
      padding: 11px 12px;
      margin: 14px 0;
      font-size: 0.9rem;
    }

    .footer-note {
      margin-top: 18px;
      color: var(--muted);
      font-size: 0.83rem;
      line-height: 1.5;
    }

    @media (max-width: 920px) {
      .topbar {
        position: relative;
        padding: 14px 16px;
        min-height: auto;
        flex-wrap: wrap;
      }

      .admin-layout {
        padding-top: 0;
      }

      .tab-nav {
        position: sticky;
        top: 0;
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        display: flex;
        overflow-x: auto;
        padding: 10px 12px;
      }

      .tab-content {
        width: 100%;
        margin-left: 0;
        padding: 16px;
      }

      .hero,
      .content-grid,
      .split-panels,
      .user-profile-layout {
        grid-template-columns: 1fr;
      }

      #userProfileDetail,
      .user-list {
        max-height: none;
        overflow: visible;
        scrollbar-gutter: auto;
      }

      .user-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }

      .metric-grid,
      .analysis-metrics,
      .detail-grid,
      .connection-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    @media (max-width: 620px) {
      .topbar {
        align-items: flex-start;
        flex-direction: column;
      }

      .actions {
        width: 100%;
        justify-content: flex-start;
      }

      .metric-grid,
      .analysis-metrics,
      .detail-grid,
      .connection-grid,
      .profile-grid,
      .form-grid {
        grid-template-columns: 1fr;
      }

      .user-toolbar {
        grid-template-columns: 1fr;
      }
    }

    .page-heading { margin-bottom: 28px; }
    .page-heading p { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
    .page-heading h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -.7px; }
    .panel h2, .panel h3 { font-size: 16px; font-weight: 550; letter-spacing: 0; }
    .panel-subtitle { font-size: 13px; line-height: 1.65; }
    .metric:first-child { padding-left: 0; }
    .login-brand { margin-bottom: 42px; }
    .login-brand strong { display: block; font-size: 15px; font-weight: 600; }
    .login-brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
    .login-header p { margin: 0; color: var(--muted); line-height: 1.6; }
    .login-card input { min-height: 44px; padding-top: 11px; padding-bottom: 11px; }
    .login-card #loginBtn { min-height: 42px; }
    button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
    .danger-btn { color: var(--red); }
    @media (max-width: 620px) {
      .health-pill #healthText { display: none; }
      .metric:first-child { padding-left: 16px; }
      .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .brand p { font-size: 12px; }
      .actions { gap: 6px; }
    }
    @media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
    @media (max-width: 1200px) {
      .user-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .live-connections-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }
    @media (max-width: 920px) {
      .live-connections-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }
    @media (max-width: 620px) {
      .user-toolbar, .live-connections-grid { grid-template-columns: 1fr; }
    }
