@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

/* ============================================
   리딩 PRO Design System
   Korean Educational Neo-Minimalism
   ============================================ */

/* ============================================
   1. Design Tokens
   ============================================ */
:root {
  /* Light theme (default) */
  color-scheme: light;

  /* Colors - Core */
  --rp-bg: #FFFFFF;
  --rp-bg-subtle: #F8FAFC;
  --rp-surface: #FFFFFF;
  --rp-border: #E2E8F0;
  --rp-border-strong: #CBD5E1;

  /* Colors - Text */
  --rp-text-title: #0F172A;
  --rp-text-body: #475569;
  --rp-text-muted: #64748B;  /* Updated for WCAG AA contrast (5.2:1) */
  --rp-text-subtle: #94A3B8;
  --rp-text-dark: #1E293B;
  --rp-text-darker: #334155;

  /* Colors - Brand */
  --rp-primary: #2F5BFF;
  --rp-primary-hover: #1E4AE8;
  --rp-primary-soft: #EEF2FF;
  --rp-primary-softer: #F5F8FF;
  --rp-blue: #2563EB;
  --rp-blue-50: #EFF6FF;
  --rp-blue-100: #DBEAFE;

  /* Colors - Status */
  --rp-success: #22C55E;
  --rp-success-soft: #DCFCE7;
  --rp-success-dark: #15803D;
  --rp-warning: #F59E0B;
  --rp-warning-soft: #FEF3C7;
  --rp-warning-dark: #B45309;
  --rp-danger: #EF4444;
  --rp-danger-soft: #FEE2E2;
  --rp-danger-dark: #B91C1C;
  --rp-info: #0EA5E9;
  --rp-info-soft: #E0F2FE;
  --rp-info-dark: #0369A1;

  /* Colors - Extended */
  --rp-slate-100: #F1F5F9;
  --rp-landing-bg: #F4F6F2;

  /* Spacing Scale - 8px-based system
   * Base unit: 8px
   * Usage: Prefer semantic spacing variables over hardcoded values
   * Scale follows: 0, 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 60, 64, 80px
   */
  --rp-space-0: 0px;       /* 0px - No spacing */
  --rp-space-1: 4px;       /* 4px - Minimal spacing (badges, tight elements) */
  --rp-space-2: 8px;       /* 8px - Small spacing (gaps, internal padding) */
  --rp-space-3: 12px;      /* 12px - Medium spacing (form elements, cards) */
  --rp-space-4: 16px;      /* 16px - Standard spacing (cards, sections) */
  --rp-space-5: 20px;      /* 20px - Large spacing (between components) */
  --rp-space-6: 24px;      /* 24px - Extra large spacing (page sections) */
  --rp-space-7: 28px;      /* 28px - Section dividers */
  --rp-space-8: 32px;      /* 32px - Major sections */
  --rp-space-10: 40px;     /* 40px - Large gaps */
  --rp-space-12: 48px;     /* 48px - Major page sections */
  --rp-space-15: 60px;     /* 60px - Hero sections */
  --rp-space-16: 64px;     /* 64px - Large page margins */
  --rp-space-20: 80px;     /* 80px - Maximum spacing */

  /* Typography - Font Family & Sizes (4-level scale, sidebar 기준) */
  --rp-font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --rp-font-size-xs:  13px;      /* 배지, 캡션, 메타 정보 */
  --rp-font-size-sm:  14px;      /* 본문 (사이드바 일반 메뉴 기준) */
  --rp-font-size-md:  15px;      /* 작은 제목 (사이드바 그룹 제목 기준) */
  --rp-font-size-lg:  17px;      /* 중간 제목 */
  --rp-font-size-xl:  19px;      /* 큰 제목 */
  --rp-font-size-2xl: 19px;      /* 큰 제목 (xl과 동일) */

  /* Typography - Font Weights */
  --rp-font-weight-normal: 400;  /* Normal text */
  --rp-font-weight-medium: 500;  /* Medium emphasis */
  --rp-font-weight-semibold: 600; /* Semibold - headings, buttons */
  --rp-font-weight-bold: 700;    /* Bold - strong emphasis */
  --rp-font-weight-extrabold: 800; /* Extra bold - hero titles */

  /* Border Radius */
  --rp-radius-sm: 6px;
  --rp-radius-md: 8px;
  --rp-radius-lg: 12px;
  --rp-radius-xl: 16px;
  --rp-radius-full: 9999px;

  /* Shadows */
  --rp-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --rp-shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --rp-shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.08);
  --rp-shadow-xl: 0 16px 40px rgba(15, 23, 42, 0.12);

  /* Layout */
  --rp-header-height: 64px;
  --rp-sidebar-width: 240px;
  --rp-content-max-width: 1200px;

  /* Transitions */
  --rp-transition-fast: 0.15s ease;
  --rp-transition-normal: 0.2s ease;
  --rp-transition-slow: 0.3s ease;
}

/* ============================================
   2. Base Styles
   ============================================ */
.rp-body {
  margin: 0;
  font-family: var(--rp-font-family);
  font-size: var(--rp-font-size-sm);
  line-height: 1.6;
  color: var(--rp-text-body);
  background: var(--rp-bg-subtle);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   3. Layout System
   ============================================ */
.rp-layout {
  display: flex;
  min-height: 100vh;
}

.rp-layout--with-header {
  flex-direction: column;
}

.rp-layout__body {
  display: flex;
  flex: 1;
}

/* ============================================
   4. Header Component
   ============================================ */
.rp-header {
  height: var(--rp-header-height);
  background: var(--rp-surface);
  border-bottom: 1px solid var(--rp-border);
  display: flex;
  align-items: center;
  padding: 0 var(--rp-space-6);
  position: sticky;
  top: 0;
  z-index: 100;
}

.rp-header__left {
  display: flex;
  align-items: center;
  gap: var(--rp-space-4);
  min-width: 200px;
}

.rp-header__center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.rp-header__right {
  display: flex;
  align-items: center;
  gap: var(--rp-space-3);
  min-width: 200px;
  justify-content: flex-end;
}

.rp-header__title {
  font-size: var(--rp-font-size-lg);
  font-weight: var(--rp-font-weight-semibold);
  color: var(--rp-text-title);
  margin: 0;
}

.rp-header__hamburger {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: var(--rp-radius-md);
  cursor: pointer;
  display: none;  /* Hidden on desktop, shown on mobile via media query */
  align-items: center;
  justify-content: center;
  color: var(--rp-text-body);
  transition: background var(--rp-transition-fast);
}

.rp-header__hamburger:hover {
  background: var(--rp-bg-subtle);
}

/* Logo */
.rp-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--rp-space-1);
  text-decoration: none;
  color: var(--rp-primary);
}

.rp-logo__main {
  display: flex;
  align-items: center;
  gap: var(--rp-space-2);
}

.rp-logo__icon {
  width: 28px;
  height: 24px;
}

.rp-logo__text {
  font-size: var(--rp-font-size-lg);
  font-weight: var(--rp-font-weight-bold);
  letter-spacing: -0.02em;
  color: #2563eb;
}

.rp-logo__subtitle {
  font-size: var(--rp-font-size-sm);
  color: #334155;
  text-align: center;
  width: 100%;
}

/* ============================================
   5. Role Chip Component
   ============================================ */
.rp-role-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--rp-space-2);
  padding: var(--rp-space-2) var(--rp-space-3);
  background: var(--rp-primary-soft);
  color: var(--rp-primary);
  border-radius: var(--rp-radius-full);
  font-size: var(--rp-font-size-sm);
  font-weight: var(--rp-font-weight-semibold);
  cursor: pointer;
  transition: background var(--rp-transition-fast);
  border: none;
}

.rp-role-chip:hover {
  background: var(--rp-primary-softer);
}

.rp-role-chip__icon {
  width: 16px;
  height: 16px;
}

/* Role Colors */
.rp-role-chip--student { background: #DBEAFE; color: #1D4ED8; }
.rp-role-chip--parent { background: #FCE7F3; color: #BE185D; }
.rp-role-chip--school { background: #D1FAE5; color: #047857; }
.rp-role-chip--teacher { background: #FEF3C7; color: #B45309; }
.rp-role-chip--developer { background: #E0E7FF; color: #4338CA; }
.rp-role-chip--admin { background: #FEE2E2; color: #B91C1C; }

/* ============================================
   6. Notification & Avatar
   ============================================ */
.rp-notification-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--rp-border);
  background: var(--rp-surface);
  border-radius: var(--rp-radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rp-text-muted);
  position: relative;
  transition: all var(--rp-transition-fast);
}

.rp-notification-btn:hover {
  border-color: var(--rp-border-strong);
  color: var(--rp-text-body);
}

.rp-notification-btn__badge {
  position: absolute;
  top: var(--rp-space-2);
  right: var(--rp-space-2);
  width: var(--rp-space-2);
  height: var(--rp-space-2);
  background: var(--rp-danger);
  border-radius: 50%;
  border: 2px solid var(--rp-surface);
}

/* User Name Button */
.rp-user-name-btn {
  padding: var(--rp-space-2) var(--rp-space-3);
  background: transparent;
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-md);
  font-size: var(--rp-font-size-sm);
  font-weight: var(--rp-font-weight-medium);
  color: var(--rp-text-body);
  cursor: pointer;
  transition: all var(--rp-transition-fast);
  font-family: var(--rp-font-family);
}

.rp-user-name-btn:hover {
  background: var(--rp-bg-subtle);
  border-color: var(--rp-border-strong);
  color: var(--rp-text-title);
}

/* ============================================
   7. Sidebar Component
   ============================================ */
.rp-sidebar {
  width: var(--rp-sidebar-width);
  background: var(--rp-surface);
  border-right: 1px solid var(--rp-border);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--rp-header-height));
  position: sticky;
  top: var(--rp-header-height);
  overflow-y: auto;
}

.rp-sidebar__content {
  flex: 1;
  padding: var(--rp-space-3) var(--rp-space-3);
}

.rp-sidebar__footer {
  padding: var(--rp-space-4);
  border-top: 1px solid var(--rp-border);
}

/* Nav Group */
.rp-nav-group {
  margin-bottom: var(--rp-space-2);
  padding-bottom: var(--rp-space-2);
  border-bottom: 1px solid var(--rp-border);
}

.rp-nav-group:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.rp-nav-group__label {
  font-size: var(--rp-font-size-md);
  font-weight: var(--rp-font-weight-bold);
  color: var(--rp-text-title);
  letter-spacing: 0.02em;
  padding: var(--rp-space-3) var(--rp-space-3) var(--rp-space-1);
  margin-bottom: var(--rp-space-1);
  display: flex;
  align-items: center;
  gap: 6px;
}

.rp-nav-group__label::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--rp-primary, #4f46e5);
  border-radius: 2px;
  flex-shrink: 0;
}

/* Nav Item */
.rp-nav-item {
  display: flex;
  align-items: center;
  gap: var(--rp-space-3);
  padding: 9px var(--rp-space-3);
  border-radius: var(--rp-radius-md);
  color: var(--rp-text-body);
  text-decoration: none;
  font-size: var(--rp-font-size-sm);
  font-weight: var(--rp-font-weight-medium);
  transition: all var(--rp-transition-fast);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

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

.rp-nav-item--active {
  background: var(--rp-primary);
  color: white;
}

.rp-nav-item--active:hover {
  background: var(--rp-primary-hover);
  color: white;
}

.rp-nav-item__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.rp-nav-item__badge {
  margin-left: auto;
  background: var(--rp-danger);
  color: white;
  font-size: var(--rp-font-size-xs);
  font-weight: var(--rp-font-weight-semibold);
  padding: 2px var(--rp-space-2);
  border-radius: var(--rp-radius-full);
}

.rp-nav-item--active .rp-nav-item__badge {
  background: rgba(255,255,255,0.2);
}

/* Submenu Styles */
.rp-nav-item-group {
  position: relative;
}

.rp-nav-item--parent {
  justify-content: space-between;
}

.rp-nav-item__chevron {
  margin-left: auto;
  transition: transform var(--rp-transition-fast);
  flex-shrink: 0;
  opacity: 0.5;
}

.rp-nav-item--parent[data-toggle-submenu] .rp-nav-item__chevron {
  transform: rotate(0deg);
}

.rp-nav-item--active .rp-nav-item__chevron {
  transform: rotate(180deg);
  opacity: 1;
}

.rp-nav-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--rp-transition-normal) ease;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0;
  margin-left: 12px;
  border-left: 2px solid var(--rp-border);
}

.rp-nav-submenu--open {
  max-height: 500px;
  padding: var(--rp-space-1) 0;
}

.rp-nav-subitem {
  display: flex;
  align-items: center;
  gap: var(--rp-space-2);
  padding: 7px var(--rp-space-3) 7px 14px;
  border-radius: var(--rp-radius-md);
  color: var(--rp-text-muted);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: var(--rp-font-weight-normal);
  transition: all var(--rp-transition-fast);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  position: relative;
}

.rp-nav-subitem svg {
  opacity: 0.6;
  flex-shrink: 0;
}

.rp-nav-subitem:hover {
  background: var(--rp-bg-subtle);
  color: var(--rp-text-title);
}

.rp-nav-subitem:hover svg {
  opacity: 1;
}

.rp-nav-subitem--active {
  background: linear-gradient(135deg, var(--rp-primary), #6366f1);
  color: white;
  font-weight: var(--rp-font-weight-medium);
}

.rp-nav-subitem--active svg {
  opacity: 1;
}

.rp-nav-subitem--active:hover {
  background: linear-gradient(135deg, var(--rp-primary-hover, #4338ca), #5b5bd6);
}

/* ============================================
   8. Main Content Area
   ============================================ */
.rp-main {
  flex: 1;
  padding: var(--rp-space-3);
  max-width: calc(100vw - var(--rp-sidebar-width));
  overflow-x: hidden;
}

.rp-main__container {
  margin: 0;
  background: var(--rp-surface);
  border-radius: var(--rp-radius-lg);
  box-shadow: var(--rp-shadow-md);
  padding: var(--rp-space-6);
}

/* Page Header */
.rp-page-header {
  margin-bottom: var(--rp-space-6);
}

.rp-page-header__title {
  font-size: var(--rp-font-size-2xl);
  font-weight: var(--rp-font-weight-bold);
  color: var(--rp-text-title);
  margin: 0 0 var(--rp-space-2);
  letter-spacing: -0.02em;
}

.rp-page-header__subtitle {
  font-size: var(--rp-font-size-md);
  color: var(--rp-text-muted);
  margin: 0;
}

/* ============================================
   9. Card Component
   ============================================ */
.rp-card {
  background: var(--rp-surface);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-lg);
  padding: var(--rp-space-5);
  box-shadow: var(--rp-shadow-sm);
  transition: box-shadow var(--rp-transition-normal);
}

.rp-card:hover {
  box-shadow: var(--rp-shadow-md);
}

.rp-card--clickable {
  cursor: pointer;
}

.rp-card--highlight {
  border-color: var(--rp-primary);
  background: var(--rp-primary-softer);
}

.rp-card--compact {
  padding: var(--rp-space-3);
}

.rp-card--elevated {
  box-shadow: var(--rp-shadow-lg);
}

.rp-card--flat {
  box-shadow: none;
  border-width: 1px;
}

.rp-card--success {
  border-color: var(--rp-success);
  background: var(--rp-success-soft);
}

.rp-card--warning {
  border-color: var(--rp-warning);
  background: var(--rp-warning-soft);
}

.rp-card--danger {
  border-color: var(--rp-danger);
  background: var(--rp-danger-soft);
}

.rp-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--rp-space-4);
  margin-bottom: var(--rp-space-4);
}

.rp-card__title {
  font-size: var(--rp-font-size-lg);
  font-weight: var(--rp-font-weight-semibold);
  color: var(--rp-text-title);
  margin: 0;
}

.rp-card__subtitle {
  font-size: var(--rp-font-size-sm);
  color: var(--rp-text-muted);
  margin: var(--rp-space-1) 0 0;
}

.rp-card__body {
  color: var(--rp-text-body);
}

.rp-card__footer {
  margin-top: var(--rp-space-4);
  padding-top: var(--rp-space-4);
  border-top: 1px solid var(--rp-border);
}

/* ============================================
   10. Grid System
   ============================================ */
.rp-grid {
  display: grid;
  gap: var(--rp-space-4);
}

.rp-grid--2 { grid-template-columns: repeat(2, 1fr); }
.rp-grid--3 { grid-template-columns: repeat(3, 1fr); }
.rp-grid--4 { grid-template-columns: repeat(4, 1fr); }
.rp-grid--auto { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* 3-Column Layout for Item Editor */
.rp-grid--3col {
  display: grid;
  grid-template-columns: 45% 35% 20%;
  gap: var(--rp-space-4);
}

@media (max-width: 1200px) {
  .rp-grid--3col {
    grid-template-columns: 1fr;
  }
}

/* Responsive grid improvements */
@media (max-width: 1024px) {
  .rp-grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .rp-grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .rp-grid--2,
  .rp-grid--3,
  .rp-grid--4 {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   11. Stat Card Component
   ============================================ */
.rp-stat {
  background: var(--rp-surface);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-lg);
  padding: var(--rp-space-4);
}

.rp-stat__label {
  font-size: var(--rp-font-size-sm);
  color: var(--rp-text-muted);
  margin-bottom: var(--rp-space-2);
}

.rp-stat__value {
  font-size: var(--rp-font-size-2xl);
  font-weight: var(--rp-font-weight-bold);
  color: var(--rp-text-title);
}

.rp-stat__trend {
  font-size: var(--rp-font-size-xs);
  margin-top: var(--rp-space-1);
}

.rp-stat__trend--up { color: var(--rp-success); }
.rp-stat__trend--down { color: var(--rp-danger); }

/* ============================================
   12. Button Components
   ============================================ */
.rp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--rp-space-2);
  padding: var(--rp-space-3) var(--rp-space-4);
  border-radius: var(--rp-radius-md);
  font-family: var(--rp-font-family);
  font-size: var(--rp-font-size-sm);
  font-weight: var(--rp-font-weight-medium);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--rp-transition-fast);
  border: 1px solid transparent;
}

.rp-btn--primary {
  background: var(--rp-primary);
  color: white;
  border-color: var(--rp-primary);
}

.rp-btn--primary:hover {
  background: var(--rp-primary-hover);
  border-color: var(--rp-primary-hover);
}

.rp-btn--secondary {
  background: var(--rp-surface);
  color: var(--rp-text-body);
  border-color: var(--rp-border);
}

.rp-btn--secondary:hover {
  background: var(--rp-bg-subtle);
  border-color: var(--rp-border-strong);
}

.rp-btn--ghost {
  background: transparent;
  color: var(--rp-text-muted);
  border-color: transparent;
}

.rp-btn--ghost:hover {
  background: var(--rp-bg-subtle);
  color: var(--rp-text-body);
}

.rp-btn--danger {
  background: var(--rp-danger);
  color: white;
  border-color: var(--rp-danger);
}

.rp-btn--success {
  background: var(--rp-success);
  color: white;
  border-color: var(--rp-success);
}

.rp-btn--success:hover {
  opacity: 0.9;
}

.rp-btn--lg {
  padding: var(--rp-space-4) var(--rp-space-6);
  font-size: var(--rp-font-size-md);
}

.rp-btn--sm {
  padding: var(--rp-space-2) var(--rp-space-3);
  font-size: var(--rp-font-size-xs);
}

.rp-btn--xs {
  padding: 2px var(--rp-space-2);
  font-size: var(--rp-font-size-xs);
}

.rp-btn--full {
  width: 100%;
}

.rp-btn--outline {
  background: transparent;
  color: var(--rp-primary);
  border-color: var(--rp-primary);
}

.rp-btn--outline:hover {
  background: var(--rp-primary-soft);
}

.rp-btn--pill {
  border-radius: var(--rp-radius-full);
}

.rp-btn--icon {
  padding: var(--rp-space-2);
  width: 36px;
  height: 36px;
}

.rp-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================
   13. Badge Components
   ============================================ */
.rp-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--rp-space-1);
  padding: 3px var(--rp-space-2);
  border-radius: var(--rp-radius-full);
  font-size: var(--rp-font-size-xs);
  font-weight: var(--rp-font-weight-semibold);
}

.rp-badge--default {
  background: var(--rp-bg-subtle);
  color: var(--rp-text-body);
}

.rp-badge--primary {
  background: var(--rp-primary-soft);
  color: var(--rp-primary);
}

.rp-badge--success {
  background: var(--rp-success-soft);
  color: #15803D;
}

.rp-badge--warning {
  background: var(--rp-warning-soft);
  color: #B45309;
}

.rp-badge--danger {
  background: var(--rp-danger-soft);
  color: #B91C1C;
}

.rp-badge--info {
  background: var(--rp-info-soft);
  color: #0369A1;
}

/* Status Badges */
.rp-badge--draft {
  background: var(--rp-warning-soft);
  color: #B45309;
}

.rp-badge--review {
  background: var(--rp-info-soft);
  color: #0369A1;
}

.rp-badge--published {
  background: var(--rp-success-soft);
  color: #15803D;
}

/* ============================================
   14. Table Component
   ============================================ */
.rp-table-wrapper {
  overflow-x: auto;
}

.rp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--rp-font-size-sm);
}

.rp-table th,
.rp-table td {
  padding: var(--rp-space-3) var(--rp-space-4);
  text-align: left;
  border-bottom: 1px solid var(--rp-border);
}

.rp-table th {
  font-weight: var(--rp-font-weight-semibold);
  color: var(--rp-text-muted);
  background: var(--rp-bg-subtle);
}

.rp-table tr:hover td {
  background: var(--rp-bg-subtle);
}

/* ============================================
   15. Form Components
   ============================================ */
.rp-form-group {
  margin-bottom: var(--rp-space-4);
}

.rp-label {
  display: block;
  font-size: var(--rp-font-size-sm);
  font-weight: var(--rp-font-weight-medium);
  color: var(--rp-text-title);
  margin-bottom: var(--rp-space-2);
}

.rp-input,
.rp-select,
.rp-textarea {
  width: 100%;
  padding: var(--rp-space-3);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-md);
  font-family: var(--rp-font-family);
  font-size: var(--rp-font-size-sm);
  color: var(--rp-text-body);
  background: var(--rp-surface);
  transition: border-color var(--rp-transition-fast), box-shadow var(--rp-transition-fast);
}

.rp-input:focus,
.rp-select:focus,
.rp-textarea:focus {
  outline: none;
  border-color: var(--rp-primary);
  box-shadow: 0 0 0 3px var(--rp-primary-soft);
}

.rp-textarea {
  min-height: 100px;
  resize: vertical;
}

/* ============================================
   16. Checklist Component
   ============================================ */
.rp-checklist {
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-3);
}

.rp-checklist__item {
  display: flex;
  align-items: center;
  gap: var(--rp-space-3);
  font-size: var(--rp-font-size-sm);
  color: var(--rp-text-body);
}

.rp-checklist__item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--rp-primary);
}

.rp-checklist__item--checked {
  color: var(--rp-success);
}

/* ============================================
   17. AI Coach Section
   ============================================ */
.rp-ai-coach {
  background: linear-gradient(135deg, var(--rp-primary-softer) 0%, #F0F4FF 100%);
  border: 1px solid var(--rp-primary);
  border-radius: var(--rp-radius-lg);
  padding: var(--rp-space-4);
}

.rp-ai-coach__header {
  display: flex;
  align-items: center;
  gap: var(--rp-space-2);
  margin-bottom: var(--rp-space-3);
}

.rp-ai-coach__icon {
  width: 24px;
  height: 24px;
  color: var(--rp-primary);
}

.rp-ai-coach__title {
  font-size: var(--rp-font-size-md);
  font-weight: var(--rp-font-weight-semibold);
  color: var(--rp-primary);
}

.rp-ai-coach__content {
  font-size: var(--rp-font-size-sm);
  color: var(--rp-text-body);
  line-height: 1.7;
}

.rp-ai-coach__actions {
  margin-top: var(--rp-space-4);
  display: flex;
  gap: var(--rp-space-2);
  flex-wrap: wrap;
}

/* ============================================
   18. Empty/Loading/Error States
   ============================================ */
.rp-empty-state {
  text-align: center;
  padding: var(--rp-space-12) var(--rp-space-6);
}

.rp-empty-state__icon {
  width: 64px;
  height: 64px;
  color: var(--rp-text-muted);
  margin-bottom: var(--rp-space-4);
}

.rp-empty-state__title {
  font-size: var(--rp-font-size-lg);
  font-weight: var(--rp-font-weight-semibold);
  color: var(--rp-text-title);
  margin: 0 0 var(--rp-space-2);
}

.rp-empty-state__description {
  font-size: var(--rp-font-size-sm);
  color: var(--rp-text-muted);
  margin: 0 0 var(--rp-space-4);
}

/* Loading Spinner */
.rp-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--rp-border);
  border-top-color: var(--rp-primary);
  border-radius: 50%;
  animation: rp-spin 0.8s linear infinite;
}

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

/* ============================================
   19. Flash Messages
   ============================================ */
.rp-flash {
  padding: var(--rp-space-3) var(--rp-space-4);
  border-radius: var(--rp-radius-md);
  font-size: var(--rp-font-size-sm);
  margin-bottom: var(--rp-space-4);
  display: flex;
  align-items: center;
  gap: var(--rp-space-2);
}

.rp-flash--notice {
  background: var(--rp-info-soft);
  color: #0369A1;
  border: 1px solid #BAE6FD;
}

.rp-flash--alert {
  background: var(--rp-danger-soft);
  color: #B91C1C;
  border: 1px solid #FECACA;
}

.rp-flash--success {
  background: var(--rp-success-soft);
  color: #15803D;
  border: 1px solid #BBF7D0;
}

/* Toast Notifications */
.rp-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: var(--rp-font-size-md);
  font-weight: var(--rp-font-weight-medium);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
  animation: rp-toast-in 0.35s ease-out;
  transition: opacity 0.4s, transform 0.4s;
  max-width: 420px;
}
.rp-toast--success {
  background: #065f46;
  color: #ffffff;
  border: 1px solid #10b981;
}
.rp-toast--alert {
  background: #991b1b;
  color: #ffffff;
  border: 1px solid #ef4444;
}
@keyframes rp-toast-in {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* New item highlight */
@keyframes rp-highlight-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37,99,235,0.4); }
  50%  { box-shadow: 0 0 0 8px rgba(37,99,235,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); }
}
.q-new-question-highlight {
  animation: rp-highlight-pulse 1s ease-out 2;
  border-left: 3px solid #2563eb !important;
}

/* ============================================
   20. Permission Matrix Table
   ============================================ */
.rp-permission-matrix {
  width: 100%;
  border-collapse: collapse;
}

.rp-permission-matrix th,
.rp-permission-matrix td {
  padding: var(--rp-space-3);
  border: 1px solid var(--rp-border);
  text-align: center;
}

.rp-permission-matrix th {
  background: var(--rp-bg-subtle);
  font-weight: var(--rp-font-weight-semibold);
  font-size: var(--rp-font-size-sm);
}

.rp-permission-matrix td:first-child {
  text-align: left;
  font-weight: var(--rp-font-weight-medium);
}

.rp-permission-check {
  color: var(--rp-success);
}

.rp-permission-deny {
  color: var(--rp-text-muted);
}

/* ============================================
   21. Chart Placeholder
   ============================================ */
.rp-chart-placeholder {
  background: linear-gradient(180deg, var(--rp-bg-subtle) 0%, var(--rp-surface) 100%);
  border-radius: var(--rp-radius-md);
  height: 200px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--rp-space-2);
  padding: var(--rp-space-4);
}

.rp-chart-bar {
  width: 32px;
  background: linear-gradient(180deg, var(--rp-primary) 0%, #1E40AF 100%);
  border-radius: var(--rp-radius-sm) var(--rp-radius-sm) 0 0;
  transition: height var(--rp-transition-slow);
}

/* ============================================
   22. Dropdown
   ============================================ */
.rp-dropdown {
  position: relative;
  display: inline-block;
}

.rp-dropdown__content {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--rp-space-2);
  background: var(--rp-surface);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-md);
  box-shadow: var(--rp-shadow-lg);
  min-width: 180px;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--rp-transition-fast);
}

.rp-dropdown:hover .rp-dropdown__content,
.rp-dropdown--open .rp-dropdown__content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.rp-dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--rp-space-2);
  width: 100%;
  padding: var(--rp-space-3) var(--rp-space-4);
  text-align: left;
  font-size: var(--rp-font-size-sm);
  color: var(--rp-text-body);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.rp-dropdown__item:hover {
  background: var(--rp-bg-subtle);
}

.rp-dropdown__divider {
  height: 1px;
  background: var(--rp-border);
  margin: var(--rp-space-2) 0;
}

/* ============================================
   23. Responsive
   ============================================ */

/* --- Tablet & Mobile (≤1024px) --- */
@media (max-width: 1024px) {
  .rp-header__hamburger {
    display: flex;
  }

  .rp-header__center {
    display: none;
  }

  .rp-sidebar {
    position: fixed;
    left: -100%;
    top: var(--rp-header-height);
    width: var(--rp-sidebar-width);
    height: calc(100vh - var(--rp-header-height));
    z-index: 200;
    transition: left var(--rp-transition-normal);
    box-shadow: none;
  }

  .rp-sidebar--open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }

  /* Sidebar backdrop overlay */
  .rp-sidebar-backdrop {
    display: none;
    position: fixed;
    top: var(--rp-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 199;
    opacity: 0;
    transition: opacity var(--rp-transition-normal);
  }

  .rp-sidebar-backdrop--visible {
    display: block;
    opacity: 1;
  }

  .rp-main {
    max-width: 100vw;
    width: 100%;
  }
}

/* --- Mobile (≤768px) --- */
@media (max-width: 768px) {
  .rp-header {
    padding: 0 var(--rp-space-3);
  }

  .rp-header__left {
    min-width: auto;
    gap: var(--rp-space-2);
  }

  .rp-header__right {
    min-width: auto;
    gap: var(--rp-space-2);
  }

  /* Hide user name on narrow tablets */
  .rp-user-name-btn {
    display: none;
  }

  /* Smaller logo on mobile */
  .rp-logo__main img {
    height: 52px !important;
  }
}

/* --- Small Mobile (≤640px) --- */
@media (max-width: 640px) {
  .rp-header__right {
    gap: var(--rp-space-1);
  }

  /* Hide notification button on small screens */
  .rp-notification-btn {
    display: none;
  }

  .rp-main {
    padding: var(--rp-space-3);
  }

  .rp-main__container {
    padding: var(--rp-space-4);
  }

  /* Compact role chip */
  .rp-role-chip span {
    display: none;
  }

  .rp-role-chip svg:last-child {
    display: none;
  }

  .rp-role-chip {
    padding: var(--rp-space-1) var(--rp-space-2);
  }

  /* Smaller logo */
  .rp-logo__main img {
    height: 40px !important;
  }

  /* Compact logout button */
  .rp-btn--sm {
    padding: var(--rp-space-1) var(--rp-space-2);
    font-size: var(--rp-font-size-xs);
  }
}

/* ============================================
   24. Animations
   ============================================ */
@keyframes rp-fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.rp-animate-in {
  animation: rp-fadeIn 0.3s ease forwards;
}

/* Stagger children */
.rp-stagger > * {
  opacity: 0;
  animation: rp-fadeIn 0.4s ease forwards;
}

.rp-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.rp-stagger > *:nth-child(2) { animation-delay: 0.1s; }
.rp-stagger > *:nth-child(3) { animation-delay: 0.15s; }
.rp-stagger > *:nth-child(4) { animation-delay: 0.2s; }
.rp-stagger > *:nth-child(5) { animation-delay: 0.25s; }
.rp-stagger > *:nth-child(6) { animation-delay: 0.3s; }

/* ============================================
   25. Utility Classes
   ============================================ */
.rp-text-center { text-align: center; }
.rp-text-right { text-align: right; }
.rp-text-muted { color: var(--rp-text-muted); }
.rp-text-success { color: var(--rp-success); }
.rp-text-warning { color: var(--rp-warning); }
.rp-text-danger { color: var(--rp-danger); }

/* Font Size Utilities (6-step) */
.rp-text-xs   { font-size: var(--rp-font-size-xs) !important; }
.rp-text-sm   { font-size: var(--rp-font-size-sm) !important; }
.rp-text-md   { font-size: var(--rp-font-size-md) !important; }
.rp-text-lg   { font-size: var(--rp-font-size-lg) !important; }
.rp-text-xl   { font-size: var(--rp-font-size-xl) !important; }
.rp-text-2xl  { font-size: var(--rp-font-size-2xl) !important; }
.rp-mt-2 { margin-top: var(--rp-space-2); }
.rp-mt-4 { margin-top: var(--rp-space-4); }
.rp-mt-6 { margin-top: var(--rp-space-6); }
.rp-mb-2 { margin-bottom: var(--rp-space-2); }
.rp-mb-4 { margin-bottom: var(--rp-space-4); }
.rp-mb-6 { margin-bottom: var(--rp-space-6); }

.rp-flex { display: flex; }
.rp-flex-col { flex-direction: column; }
.rp-items-center { align-items: center; }
.rp-justify-between { justify-content: space-between; }
.rp-gap-2 { gap: var(--rp-space-2); }
.rp-gap-4 { gap: var(--rp-space-4); }

.rp-hidden { display: none; }

/* Screen reader only - for accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Skip to main content link */
.skip-to-main {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--rp-primary);
  color: white;
  padding: var(--rp-space-2) var(--rp-space-4);
  text-decoration: none;
  z-index: 100;
  border-radius: 0 0 var(--rp-radius-md) 0;
}

.skip-to-main:focus {
  top: 0;
}

/* ============================================
   26. Researcher Items Edit Page Components
   ============================================ */

/* Tabs Component - Consistent with Design.md */
.rp-tabs {
  display: flex;
  gap: var(--rp-space-4);
  border-bottom: 2px solid var(--rp-border);
  padding: 0 0 var(--rp-space-4) 0;
  margin-bottom: var(--rp-space-8);
  overflow-x: auto;
}

.rp-tab {
  padding: var(--rp-space-3) var(--rp-space-1);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--rp-text-muted);
  font-weight: var(--rp-font-weight-medium);
  font-size: var(--rp-font-size-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
}

.rp-tab:hover {
  color: var(--rp-text-title);
}

.rp-tab--active {
  color: var(--rp-primary);
  border-bottom-color: var(--rp-primary);
  font-weight: var(--rp-font-weight-semibold);
}

/* Frame sections */
.rp-frame {
  display: block;
}

.rp-frame[data-state] {
  display: none;
}

.rp-frame[data-state="mcq-default"],
.rp-frame[style*="display: none"] {
  display: none;
}

/* Grid layout */
.rp-grid {
  display: grid;
}

.rp-grid--3 {
  grid-template-columns: repeat(3, 1fr);
  gap: var(--rp-space-6);
}

/* Column containers */
.rp-col-left,
.rp-col-center,
.rp-col-right {
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-5);
}

/* Choice Options - Clear Interaction Feedback */
.rp-choice-option {
  display: flex;
  align-items: flex-start;
  gap: var(--rp-space-3);
  padding: var(--rp-space-4) var(--rp-space-4);
  border: 1.5px solid var(--rp-border);
  border-radius: var(--rp-radius-md);
  margin-bottom: var(--rp-space-3);
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.rp-choice-option:hover {
  border-color: var(--rp-primary);
  background: var(--rp-primary-softer);
  box-shadow: 0 1px 3px rgba(47, 91, 255, 0.1);
}

.rp-choice-option--correct {
  border-color: var(--rp-success);
  background: var(--rp-success-soft);
}

.rp-choice-option--correct:hover {
  border-color: var(--rp-success);
  box-shadow: 0 1px 3px rgba(34, 197, 94, 0.12);
}

.rp-choice-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--rp-space-3);
}

.rp-choice-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--rp-primary-soft);
  color: var(--rp-primary);
  border-radius: 50%;
  font-weight: var(--rp-font-weight-bold);
  font-size: var(--rp-font-size-sm);
  flex-shrink: 0;
}

.rp-choice-text {
  flex: 1;
  font-size: var(--rp-font-size-sm);
  color: var(--rp-text-body);
  line-height: 1.5;
}

.rp-radio {
  margin-top: 2px;
  cursor: pointer;
}

/* Score Rows - Consistent Spacing */
.rp-score-row {
  display: grid;
  grid-template-columns: 32px 1fr 80px 30px;
  gap: var(--rp-space-3);
  align-items: center;
  padding: var(--rp-space-4) 0;
  border-bottom: 1px solid var(--rp-border);
}

.rp-score-row:last-child {
  border-bottom: none;
}

.rp-input--score {
  text-align: right;
  font-weight: var(--rp-font-weight-semibold);
  font-size: var(--rp-font-size-sm);
}

.rp-score-unit {
  font-size: var(--rp-font-size-sm);
  color: var(--rp-text-muted);
  font-weight: var(--rp-font-weight-medium);
}

/* Rubric Builder - Modular Card Design */
.rp-criteria-list {
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-4);
  margin-bottom: var(--rp-space-6);
}

.rp-criterion-card {
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-md);
  padding: var(--rp-space-4);
  background: white;
  transition: all 0.2s ease;
}

.rp-criterion-card:hover {
  border-color: var(--rp-primary);
  box-shadow: 0 1px 3px rgba(47, 91, 255, 0.08);
}

.rp-criterion-header {
  display: flex;
  gap: var(--rp-space-2);
  align-items: flex-start;
  margin-bottom: var(--rp-space-4);
}

.rp-criterion-name {
  flex: 1;
  font-weight: var(--rp-font-weight-semibold) !important;
  font-size: var(--rp-font-size-sm) !important;
  line-height: 1.5;
}

.rp-criterion-actions {
  display: flex;
  gap: var(--rp-space-1);
  align-items: center;
}

.rp-levels-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--rp-space-3);
  margin-top: var(--rp-space-4);
}

.rp-level-cell {
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-2);
}

.rp-level-label {
  font-size: var(--rp-font-size-xs);
  font-weight: var(--rp-font-weight-semibold);
  color: var(--rp-primary);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.4;
}

.rp-textarea--sm {
  min-height: 60px;
  resize: vertical;
  font-size: var(--rp-font-size-xs) !important;
  line-height: 1.4 !important;
}

/* Checklist - Better Visual Hierarchy */
.rp-checklist {
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-3);
}

.rp-checkbox {
  display: flex;
  align-items: center;
  gap: var(--rp-space-3);
  font-size: var(--rp-font-size-sm);
  color: var(--rp-text-body);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 2px;
}

.rp-checkbox:hover {
  color: var(--rp-text-title);
}

.rp-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--rp-primary);
  flex-shrink: 0;
}

.rp-checkbox span {
  flex: 1;
  line-height: 1.5;
}

/* Info Grid - Better Typography Hierarchy */
.rp-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--rp-space-5);
}

.rp-info-item {
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-2);
}

.rp-info-label {
  font-size: var(--rp-font-size-xs);
  font-weight: var(--rp-font-weight-medium);
  color: var(--rp-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.4;
}

.rp-info-value {
  font-size: var(--rp-font-size-md);
  color: var(--rp-text-title);
  font-weight: var(--rp-font-weight-semibold);
  line-height: 1.5;
}

.rp-info-value a {
  color: var(--rp-primary);
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: var(--rp-font-weight-semibold);
}

.rp-info-value a:hover {
  color: var(--rp-primary-hover);
  text-decoration: underline;
}

/* Stimulus & Prompt Sections - Clear Segmentation */
.rp-stimulus-section,
.rp-prompt-section {
  padding: var(--rp-space-4);
  background: var(--rp-bg-subtle);
  border-radius: var(--rp-radius-md);
  border-left: var(--rp-space-1) solid var(--rp-primary);
  margin-bottom: var(--rp-space-4);
}

.rp-stimulus-section:last-child,
.rp-prompt-section:last-child {
  margin-bottom: 0;
}

.rp-stimulus-text,
.rp-prompt-text {
  font-size: var(--rp-font-size-sm);
  line-height: 1.7;
  color: var(--rp-text-body);
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-top: var(--rp-space-3);
}

.rp-stimulus-section .rp-label,
.rp-prompt-section .rp-label {
  font-size: var(--rp-font-size-sm);
  font-weight: var(--rp-font-weight-semibold);
  color: var(--rp-text-title);
  margin: 0;
}

/* AI Suggestion Box - Clear Visual Hierarchy */
.rp-ai-suggestion {
  padding: var(--rp-space-4);
  background: white;
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-md);
  margin-bottom: var(--rp-space-4);
  transition: all 0.2s ease;
}

.rp-ai-suggestion:last-child {
  margin-bottom: 0;
}

.rp-ai-suggestion--highlight {
  border: 2px solid var(--rp-primary);
  background: var(--rp-primary-soft);
}

.rp-ai-suggestion__title {
  font-size: var(--rp-font-size-sm);
  font-weight: var(--rp-font-weight-semibold);
  color: var(--rp-text-title);
  margin: 0 0 var(--rp-space-3) 0;
  line-height: 1.5;
}

.rp-ai-suggestion__list {
  list-style: disc;
  padding-left: var(--rp-space-6);
  margin: var(--rp-space-3) 0 0 0;
  font-size: var(--rp-font-size-sm);
  color: var(--rp-text-body);
  line-height: 1.7;
}

.rp-ai-suggestion__list li {
  margin-bottom: var(--rp-space-2);
}

.rp-ai-suggestion__list li:last-child {
  margin-bottom: 0;
}

/* Score Table - Clear Visual Hierarchy */
.rp-score-table {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--rp-space-3);
  background: var(--rp-bg-subtle);
  padding: var(--rp-space-4);
  border-radius: var(--rp-radius-md);
  margin: var(--rp-space-4) 0;
  font-size: var(--rp-font-size-sm);
}

.rp-score-table > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--rp-space-3) var(--rp-space-3);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-sm);
  background: white;
  transition: all 0.2s ease;
}

.rp-score-table > div:hover {
  border-color: var(--rp-primary);
}

.rp-score-table .rp-label {
  font-size: var(--rp-font-size-xs);
  font-weight: var(--rp-font-weight-medium);
  color: var(--rp-text-muted);
  margin: 0;
}

.rp-score-table strong {
  font-weight: var(--rp-font-weight-semibold);
  color: var(--rp-primary);
}

/* Tag List - Consistent Badge Styling */
.rp-tag-list {
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-3);
}

.rp-tag {
  display: inline-flex;
  padding: var(--rp-space-2) var(--rp-space-3);
  background: var(--rp-primary-soft);
  color: var(--rp-primary);
  border-radius: var(--rp-radius-md);
  font-size: var(--rp-font-size-xs);
  font-weight: var(--rp-font-weight-medium);
  width: fit-content;
  line-height: 1.4;
}

/* Summary Grid - Consistent Spacing */
.rp-summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.rp-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--rp-space-4) 0;
  border-bottom: 1px solid var(--rp-border);
}

.rp-summary-item:last-child {
  border-bottom: none;
}

.rp-summary-item .rp-label {
  font-size: var(--rp-font-size-xs);
  font-weight: var(--rp-font-weight-medium);
  color: var(--rp-text-muted);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rp-summary-item .rp-value {
  font-size: var(--rp-font-size-sm);
  font-weight: var(--rp-font-weight-bold);
  color: var(--rp-text-title);
}

/* Card Footer for Actions */
.rp-card__footer {
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-3);
  padding-top: var(--rp-space-4);
  border-top: 1px solid var(--rp-border);
}

.rp-card__footer .rp-btn {
  margin: 0;
  font-weight: var(--rp-font-weight-medium);
}

/* Modal - Clear Visual Hierarchy */
.rp-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.rp-modal.is-open {
  display: flex;
}

.rp-modal__card {
  background: white;
  border-radius: var(--rp-radius-lg);
  padding: var(--rp-space-7);
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
}

.rp-modal__card h3 {
  font-size: var(--rp-font-size-lg);
  font-weight: var(--rp-font-weight-semibold);
  color: var(--rp-text-title);
  margin: 0 0 var(--rp-space-3) 0;
  line-height: 1.5;
}

.rp-modal__card p {
  font-size: var(--rp-font-size-sm);
  color: var(--rp-text-body);
  margin: 0 0 var(--rp-space-7) 0;
  line-height: 1.6;
}

.rp-modal__actions {
  display: flex;
  gap: var(--rp-space-3);
  flex-direction: column-reverse;
}

.rp-modal__actions .rp-btn {
  margin: 0;
  width: 100%;
  font-weight: var(--rp-font-weight-medium);
}

/* Responsive Design */
@media (max-width: 1400px) {
  .rp-grid--3 {
    grid-template-columns: 1fr !important;
  }

  .rp-col-left,
  .rp-col-center,
  .rp-col-right {
    gap: var(--rp-space-4);
  }
}

@media (max-width: 768px) {
  .rp-tabs {
    gap: var(--rp-space-1);
    padding-bottom: var(--rp-space-2);
    margin-bottom: var(--rp-space-6);
  }

  .rp-tab {
    padding: var(--rp-space-2) var(--rp-space-3);
    font-size: var(--rp-font-size-xs);
  }

  .rp-levels-grid {
    grid-template-columns: 1fr 1fr;
  }

  .rp-level-cell {
    margin-bottom: var(--rp-space-3);
  }

  .rp-score-row {
    grid-template-columns: 24px 1fr 60px 24px;
    padding: var(--rp-space-2);
    gap: var(--rp-space-2);
  }

  .rp-choice-label {
    width: 28px;
    height: 28px;
    font-size: var(--rp-font-size-xs);
  }

  .rp-info-grid {
    grid-template-columns: 1fr;
  }

  .rp-modal__card {
    margin: var(--rp-space-4);
    max-width: calc(100% - var(--rp-space-8));
  }
}

/* ============================================
   Admin Dashboard - Phase 3.5.4
   ============================================ */

.admin-header {
  margin-bottom: var(--rp-space-8);
}

.admin-title {
  font-size: var(--rp-font-size-2xl);
  font-weight: var(--rp-font-weight-bold);
  color: var(--rp-text-title);
  margin: 0 0 var(--rp-space-2);
}

.admin-subtitle {
  font-size: var(--rp-font-size-sm);
  color: var(--rp-text-muted);
  margin: 0;
}

.admin-description {
  font-size: var(--rp-font-size-sm);
  color: var(--rp-text-muted);
  margin: var(--rp-space-2) 0 var(--rp-space-4);
}

.admin-section {
  margin-bottom: var(--rp-space-10);
}

.admin-section h2 {
  font-size: var(--rp-font-size-xl);
  font-weight: var(--rp-font-weight-semibold);
  color: var(--rp-text-title);
  margin: 0 0 var(--rp-space-4);
}

/* Grid Layout */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--rp-space-4);
  margin-bottom: var(--rp-space-4);
}

/* Status Cards */
.admin-stat {
  background: var(--rp-bg-subtle);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-lg);
  padding: var(--rp-space-4);
  transition: all var(--rp-transition-fast);
}

.admin-stat:hover {
  border-color: var(--rp-border-strong);
  box-shadow: var(--rp-shadow-sm);
}

.admin-stat-label {
  font-size: var(--rp-font-size-sm);
  font-weight: var(--rp-font-weight-medium);
  color: var(--rp-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--rp-space-2);
}

.admin-stat-value {
  font-size: var(--rp-font-size-2xl);
  font-weight: var(--rp-font-weight-bold);
  color: var(--rp-text-title);
  margin-bottom: var(--rp-space-1);
  padding: var(--rp-space-2);
  border-radius: var(--rp-radius-md);
}

.admin-stat-meta {
  font-size: var(--rp-font-size-xs);
  color: var(--rp-text-muted);
}

/* Status Color Classes */
.status-green {
  color: var(--rp-success);
  background: var(--rp-success-soft);
}

.status-yellow {
  color: #D97706;
  background: var(--rp-warning-soft);
}

.status-red {
  color: var(--rp-danger);
  background: var(--rp-danger-soft);
}

/* Cards */
.admin-card {
  background: var(--rp-bg-subtle);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-lg);
  padding: var(--rp-space-6);
  transition: all var(--rp-transition-fast);
}

.admin-card:hover {
  border-color: var(--rp-border-strong);
  box-shadow: var(--rp-shadow-sm);
}

.admin-card h2 {
  font-size: var(--rp-font-size-lg);
  font-weight: var(--rp-font-weight-semibold);
  color: var(--rp-text-title);
  margin: 0 0 var(--rp-space-4);
}

/* Buttons */
.admin-button {
  padding: var(--rp-space-2) var(--rp-space-4);
  background: var(--rp-primary);
  color: white;
  border: none;
  border-radius: var(--rp-radius-md);
  font-weight: var(--rp-font-weight-medium);
  cursor: pointer;
  transition: all var(--rp-transition-fast);
  font-family: var(--rp-font-family);
  font-size: var(--rp-font-size-sm);
}

.admin-button:hover {
  background: var(--rp-primary-hover);
}

.admin-button.secondary {
  background: transparent;
  color: var(--rp-primary);
  border: 1px solid var(--rp-primary);
}

.admin-button.secondary:hover {
  background: var(--rp-primary-soft);
}

.admin-actions {
  display: flex;
  gap: var(--rp-space-2);
  flex-wrap: wrap;
}

/* Divider */
.admin-divider {
  height: 1px;
  background: var(--rp-border);
  margin: var(--rp-space-8) 0;
}

/* Trends Display */
.admin-trends {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--rp-space-4);
}

.admin-trend-card {
  background: var(--rp-bg-subtle);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-lg);
  padding: var(--rp-space-4);
}

.admin-trend-card h3 {
  font-size: var(--rp-font-size-sm);
  font-weight: var(--rp-font-weight-semibold);
  color: var(--rp-text-title);
  margin: 0 0 var(--rp-space-3);
}

.admin-trend-data {
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-2);
}

.admin-trend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--rp-space-2);
  background: var(--rp-surface);
  border-radius: var(--rp-radius-md);
  font-size: var(--rp-font-size-sm);
}

.admin-trend-time {
  font-weight: var(--rp-font-weight-medium);
  color: var(--rp-text-muted);
}

.admin-trend-value {
  font-weight: var(--rp-font-weight-semibold);
  color: var(--rp-text-title);
}

/* Alerts */
.admin-alert {
  padding: var(--rp-space-3);
  border-radius: var(--rp-radius-md);
  margin-bottom: var(--rp-space-2);
  font-size: var(--rp-font-size-sm);
}

.alert-warning {
  background: var(--rp-warning-soft);
  color: #92400E;
  border: 1px solid var(--rp-warning);
}

.alert-danger {
  background: var(--rp-danger-soft);
  color: #7F1D1D;
  border: 1px solid var(--rp-danger);
}

/* Utilities */
.admin-muted {
  color: var(--rp-text-muted);
  font-style: italic;
}

/* ============================================
   Icon System
   ============================================ */

/* Base icon styles */
.rp-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: currentColor;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Icon size modifiers */
.rp-icon--sm {
  width: 16px;
  height: 16px;
}

.rp-icon--md {
  width: 24px;
  height: 24px;
}

.rp-icon--lg {
  width: 32px;
  height: 32px;
}

/* Icon color variants (use with CSS color utilities) */
.rp-icon--primary {
  color: var(--rp-primary);
}

.rp-icon--success {
  color: var(--rp-success);
}

.rp-icon--warning {
  color: var(--rp-warning);
}

.rp-icon--danger {
  color: var(--rp-danger);
}

.rp-icon--info {
  color: var(--rp-info);
}

.rp-icon--muted {
  color: var(--rp-text-muted);
}

/* Icon with text alignment */
.rp-icon-text {
  display: inline-flex;
  align-items: center;
  gap: var(--rp-space-2);
}

/* Icon animations */
@keyframes rp-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Parent Dashboard Styles */
.rp-mini-chart {
  display: flex;
  align-items: flex-end;
  gap: var(--rp-space-1);
  height: 80px;
  margin-top: var(--rp-space-4);
}

.rp-mini-chart__bar {
  flex: 1;
  background: var(--rp-primary);
  border-radius: var(--rp-radius-sm) var(--rp-radius-sm) 0 0;
  min-height: 4px;
  transition: background var(--rp-transition-fast);
  cursor: pointer;
}

.rp-mini-chart__bar:hover {
  background: var(--rp-primary-hover);
}

.rp-activity-feed {
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-4);
}

.rp-activity-item {
  padding: var(--rp-space-3);
  background: var(--rp-bg-subtle);
  border-radius: var(--rp-radius-md);
  transition: background var(--rp-transition-fast);
}

.rp-activity-item:hover {
  background: var(--rp-border);
}

.rp-activity-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: var(--rp-radius-md);
  color: var(--rp-text-muted);
}

.rp-activity-item.activity-assessment .rp-activity-icon {
  color: var(--rp-success);
}

.rp-activity-item.activity-consultation .rp-activity-icon {
  color: var(--rp-info);
}

.rp-icon--spinning {
  animation: rp-spin 1s linear infinite;
}

@keyframes rp-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.rp-icon--pulsing {
  animation: rp-pulse 2s ease-in-out infinite;
}

/* ============================================
   Form Validation States
   ============================================ */

/* Error state */
.rp-form-group--error .rp-label {
  color: var(--rp-danger);
}

.rp-form-group--error .rp-input,
.rp-form-group--error .rp-select,
.rp-form-group--error .rp-textarea {
  border-color: var(--rp-danger);
  background-color: var(--rp-danger-soft);
}

.rp-form-group--error .rp-input:focus,
.rp-form-group--error .rp-select:focus,
.rp-form-group--error .rp-textarea:focus {
  border-color: var(--rp-danger);
  box-shadow: 0 0 0 3px var(--rp-danger-soft);
}

.rp-form-error {
  display: block;
  color: var(--rp-danger);
  font-size: var(--rp-font-size-sm);
  margin-top: var(--rp-space-2);
  font-weight: var(--rp-font-weight-medium);
}

/* Success state */
.rp-form-group--success .rp-label {
  color: var(--rp-success);
}

.rp-form-group--success .rp-input,
.rp-form-group--success .rp-select,
.rp-form-group--success .rp-textarea {
  border-color: var(--rp-success);
  background-color: var(--rp-success-soft);
}

.rp-form-group--success .rp-input:focus,
.rp-form-group--success .rp-select:focus,
.rp-form-group--success .rp-textarea:focus {
  border-color: var(--rp-success);
  box-shadow: 0 0 0 3px var(--rp-success-soft);
}

.rp-form-success {
  display: block;
  color: var(--rp-success);
  font-size: var(--rp-font-size-sm);
  margin-top: var(--rp-space-2);
  font-weight: var(--rp-font-weight-medium);
}

/* Form hint text */
.rp-form-hint {
  display: block;
  color: var(--rp-text-muted);
  font-size: var(--rp-font-size-sm);
  margin-top: var(--rp-space-1);
}

/* ============================================
   Modal Dialog Component
   ============================================ */

.rp-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--rp-transition-normal);
}

.rp-modal-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.rp-modal {
  background: var(--rp-surface);
  border-radius: var(--rp-radius-lg);
  box-shadow: var(--rp-shadow-xl);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform var(--rp-transition-normal);
}

.rp-modal-overlay--visible .rp-modal {
  transform: scale(1);
}

.rp-modal__header {
  padding: var(--rp-space-6);
  border-bottom: 1px solid var(--rp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rp-modal__header h2 {
  margin: 0;
  font-size: var(--rp-font-size-2xl);
  color: var(--rp-text-title);
}

.rp-modal__body {
  padding: var(--rp-space-6);
}

.rp-modal__footer {
  padding: var(--rp-space-6);
  border-top: 1px solid var(--rp-border);
  display: flex;
  gap: var(--rp-space-3);
  justify-content: flex-end;
}

.rp-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--rp-text-muted);
  font-size: var(--rp-font-size-2xl);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--rp-radius-sm);
  transition: background-color var(--rp-transition-fast);
}

.rp-modal__close:hover {
  background-color: var(--rp-bg-subtle);
  color: var(--rp-text-title);
}

/* ============================================
   Tooltip Component
   ============================================ */

.rp-tooltip {
  position: relative;
  display: inline-block;
}

.rp-tooltip__trigger {
  cursor: help;
  border-bottom: 1px dotted var(--rp-text-muted);
}

.rp-tooltip__content {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--rp-text-title);
  color: white;
  padding: var(--rp-space-2) var(--rp-space-3);
  border-radius: var(--rp-radius-sm);
  font-size: var(--rp-font-size-sm);
  white-space: nowrap;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--rp-transition-fast);
}

.rp-tooltip__content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--rp-text-title);
}

.rp-tooltip:hover .rp-tooltip__content,
.rp-tooltip:focus-within .rp-tooltip__content {
  opacity: 1;
}

/* Tooltip variants */
.rp-tooltip__content--dark {
  background: var(--rp-text-title);
  color: white;
}

.rp-tooltip__content--dark::after {
  border-top-color: var(--rp-text-title);
}

.rp-tooltip__content--light {
  background: white;
  color: var(--rp-text-title);
  border: 1px solid var(--rp-border);
}

.rp-tooltip__content--light::after {
  border-top-color: white;
}

/* Top position (default) */
.rp-tooltip__content--top {
  bottom: 100%;
  top: auto;
  transform: translateX(-50%) translateY(-8px);
}

.rp-tooltip__content--top::after {
  top: 100%;
  bottom: auto;
}

/* Bottom position */
.rp-tooltip__content--bottom {
  top: 100%;
  bottom: auto;
  transform: translateX(-50%) translateY(8px);
}

.rp-tooltip__content--bottom::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--rp-text-title);
}

/* ============================================
   Toast Notification Component
   ============================================ */

.rp-toast-container {
  position: fixed;
  top: var(--rp-space-4);
  right: var(--rp-space-4);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-3);
  pointer-events: none;
}

.rp-toast {
  background: white;
  border-radius: var(--rp-radius-lg);
  box-shadow: var(--rp-shadow-lg);
  padding: var(--rp-space-4);
  min-width: 300px;
  max-width: 400px;
  display: flex;
  align-items: flex-start;
  gap: var(--rp-space-3);
  animation: rp-toast-slide-in 0.3s ease var(--rp-transition-normal);
  pointer-events: auto;
}

@keyframes rp-toast-slide-in {
  from {
    transform: translateX(calc(100% + 24px));
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.rp-toast--exit {
  animation: rp-toast-slide-out 0.3s ease forwards;
}

@keyframes rp-toast-slide-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(calc(100% + 24px));
    opacity: 0;
  }
}

/* Toast variants */
.rp-toast--success {
  background: #065f46;
  color: #ffffff;
  border-left: 4px solid var(--rp-success);
}

.rp-toast--alert {
  background: #991b1b;
  color: #ffffff;
  border-left: 4px solid var(--rp-danger);
}

.rp-toast--warning {
  background: #92400e;
  color: #ffffff;
  border-left: 4px solid var(--rp-warning);
}

.rp-toast--danger {
  background: #991b1b;
  color: #ffffff;
  border-left: 4px solid var(--rp-danger);
}

.rp-toast--info {
  background: #1e40af;
  color: #ffffff;
  border-left: 4px solid var(--rp-info);
}

.rp-toast__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.rp-toast__success .rp-toast__icon {
  color: var(--rp-success);
}

.rp-toast__warning .rp-toast__icon {
  color: var(--rp-warning);
}

.rp-toast__danger .rp-toast__icon {
  color: var(--rp-danger);
}

.rp-toast__info .rp-toast__icon {
  color: var(--rp-info);
}

.rp-toast__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-1);
}

.rp-toast__title {
  font-weight: var(--rp-font-weight-semibold);
  color: var(--rp-text-title);
  font-size: var(--rp-font-size-sm);
}

.rp-toast__message {
  color: var(--rp-text-body);
  font-size: var(--rp-font-size-sm);
}

.rp-toast__close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--rp-text-muted);
  font-size: var(--rp-font-size-xl);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--rp-radius-sm);
  transition: background-color var(--rp-transition-fast);
}

.rp-toast__close:hover {
  background-color: var(--rp-bg-subtle);
  color: var(--rp-text-title);
}

/* Progress bar for auto-dismiss */
.rp-toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--rp-primary), transparent);
  border-radius: 0 0 var(--rp-radius-lg) 0;
  animation: rp-toast-progress 3s linear forwards;
}

@keyframes rp-toast-progress {
  from { width: 100%; }
  to { width: 0; }
}

/* Mobile responsive */
@media (max-width: 767px) {
  .rp-toast {
    min-width: auto;
    width: calc(100vw - var(--rp-space-4) * 2);
  }

  .rp-modal {
    width: calc(100vw - var(--rp-space-4) * 2);
  }

  .rp-tooltip__content {
    white-space: normal;
    max-width: 200px;
  }
}

/* ============================================
   Dark Mode Support
   ============================================ */

/* System preference: Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    /* Colors - Core */
    --rp-bg: #0F172A;
    --rp-bg-subtle: #1E293B;
    --rp-surface: #1E293B;
    --rp-border: #334155;
    --rp-border-strong: #475569;

    /* Colors - Text */
    --rp-text-title: #F1F5F9;
    --rp-text-body: #CBD5E1;
    --rp-text-muted: #94A3B8;  /* Brighter in dark mode for contrast */

    /* Colors - Status (adjusted for dark) */
    --rp-success: #4ADE80;
    --rp-success-soft: #1F4D38;
    --rp-warning: #FBBF24;
    --rp-warning-soft: #4D3D1C;
    --rp-danger: #F87171;
    --rp-danger-soft: #4D2626;
    --rp-info: #38BDF8;
    --rp-info-soft: #1E3A4D;

    /* Brand color (slightly brighter in dark mode) */
    --rp-primary: #60A5FA;
    --rp-primary-hover: #93C5FD;
    --rp-primary-soft: #1E3A8A;
    --rp-primary-softer: #0F172A;
  }
}

/* Manual dark mode toggle via data attribute */
html[data-theme="dark"] {
  color-scheme: dark;

  --rp-bg: #0F172A;
  --rp-bg-subtle: #1E293B;
  --rp-surface: #1E293B;
  --rp-border: #334155;
  --rp-border-strong: #475569;
  --rp-text-title: #F1F5F9;
  --rp-text-body: #CBD5E1;
  --rp-text-muted: #64748B;
  --rp-success: #4ADE80;
  --rp-success-soft: #1F4D38;
  --rp-warning: #FBBF24;
  --rp-warning-soft: #4D3D1C;
  --rp-danger: #F87171;
  --rp-danger-soft: #4D2626;
  --rp-info: #38BDF8;
  --rp-info-soft: #1E3A4D;
  --rp-primary: #60A5FA;
  --rp-primary-hover: #93C5FD;
  --rp-primary-soft: #1E3A8A;
  --rp-primary-softer: #0F172A;
}

/* Light mode override (for forcing light theme) */
html[data-theme="light"] {
  color-scheme: light;

  --rp-bg: #FFFFFF;
  --rp-bg-subtle: #F8FAFC;
  --rp-surface: #FFFFFF;
  --rp-border: #E2E8F0;
  --rp-border-strong: #CBD5E1;
  --rp-text-title: #0F172A;
  --rp-text-body: #475569;
  --rp-text-muted: #94A3B8;
  --rp-success: #22C55E;
  --rp-success-soft: #DCFCE7;
  --rp-warning: #F59E0B;
  --rp-warning-soft: #FEF3C7;
  --rp-danger: #EF4444;
  --rp-danger-soft: #FEE2E2;
  --rp-info: #0EA5E9;
  --rp-info-soft: #E0F2FE;
  --rp-primary: #2F5BFF;
  --rp-primary-hover: #1E4AE8;
  --rp-primary-soft: #EEF2FF;
  --rp-primary-softer: #F5F8FF;
}

/* Smooth transition for theme switching */
html {
  transition: background-color var(--rp-transition-normal),
              color var(--rp-transition-normal);
}

/* Mobile Optimization (Phase 9 Option A) */
@media (max-width: 640px) {
  /* Assessment Timer - Larger font for mobile */
  .timer {
    font-size: var(--rp-font-size-2xl) !important;
    font-weight: var(--rp-font-weight-bold);
    min-width: 90px;
  }

  /* Assessment Choices - Better touch targets */
  .rp-choice {
    padding: var(--rp-space-4);
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .rp-choice input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: var(--rp-space-2);
  }

  /* Results Table - Card stack on mobile */
  .rp-table {
    font-size: var(--rp-font-size-xs);
  }

  .rp-table thead {
    display: none;
  }

  .rp-table tbody {
    display: block;
  }

  .rp-table tr {
    display: block;
    margin-bottom: var(--rp-space-3);
    padding: var(--rp-space-3);
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius-md);
    background: var(--rp-bg-card, #fff);
  }

  .rp-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--rp-space-2) var(--rp-space-3);
    text-align: right;
    border-bottom: 1px solid #f1f5f9;
    white-space: normal;
    word-break: break-word;
  }

  .rp-table td:last-child {
    border-bottom: none;
  }

  .rp-table td:before {
    content: attr(data-label);
    font-weight: var(--rp-font-weight-semibold);
    color: var(--rp-text-muted);
    margin-right: var(--rp-space-3);
    flex-shrink: 0;
    text-align: left;
  }

  .rp-table td:not([data-label]):before {
    display: none;
  }

  /* Dashboard Cards - Stack vertically */
  .rp-card {
    margin-bottom: var(--rp-space-4);
    padding: var(--rp-space-4);
  }

  .admin-grid,
  .stats-grid,
  .child-card {
    grid-template-columns: 1fr;
  }

  /* Progress Bars - Full width on mobile */
  .rp-progress-bar {
    width: 100%;
    height: 6px;
  }

  /* Buttons - Better touch targets (width: auto, not 100%) */
  .rp-btn {
    padding: var(--rp-space-3) var(--rp-space-4);
    font-size: var(--rp-font-size-sm);
    min-height: 44px;
  }

  .rp-navigation {
    flex-direction: column;
    gap: var(--rp-space-3);
  }

  .rp-navigation .rp-btn {
    width: 100%;
  }

  /* Tabs - Better mobile display */
  .rp-tabs {
    flex-wrap: wrap;
  }

  .rp-tab-button {
    flex: 1;
    min-width: 80px;
    padding: var(--rp-space-2) var(--rp-space-3);
    font-size: var(--rp-font-size-xs);
  }

  /* Assessment Header - Vertical layout */
  .rp-assessment__header {
    flex-direction: column;
    gap: var(--rp-space-4);
  }

  .rp-assessment__controls {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
  }

  /* Form Groups - Better mobile spacing */
  .rp-form-group {
    margin-bottom: var(--rp-space-4);
  }

  .rp-label {
    font-size: var(--rp-font-size-sm);
  }

  .rp-input,
  .rp-select,
  .rp-textarea {
    font-size: var(--rp-font-size-sm);  /* 16px — Prevents zoom on iOS */
    padding: var(--rp-space-3);
  }

  /* Activity Feed - Mobile friendly */
  .activity-item {
    flex-direction: column;
    gap: var(--rp-space-2);
  }

  .activity-time {
    text-align: right;
    font-size: var(--rp-font-size-xs);
  }

  /* Badge sizing */
  .rp-badge {
    padding: var(--rp-space-1) var(--rp-space-2);
    font-size: var(--rp-font-size-xs);
  }
}

/* ============================================
   25. Mobile Responsiveness - Post-Login Pages
   ============================================ */

/* --- Page Header: Flex Wrap (≤768px) --- */
@media (max-width: 768px) {
  .rp-page-header .rp-flex {
    flex-wrap: wrap;
    gap: var(--rp-space-3);
  }

  .rp-page-header__title {
    font-size: var(--rp-font-size-xl);
  }

  /* Inline 2-col grids → 1 column */
  .rp-main__container [style*="grid-template-columns:1fr 320px"],
  .rp-main__container [style*="grid-template-columns: 1fr 320px"],
  .rp-main__container [style*="grid-template-columns: 1fr 1fr"],
  .rp-main__container [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* rp-grid responsive: 4-col → 2-col */
  .rp-grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Table wrapper: ensure horizontal scroll */
  .rp-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Page header buttons wrap */
  .rp-page-header .rp-flex .rp-flex.rp-gap-2 {
    flex-wrap: wrap;
  }
}

/* --- Small Mobile Enhancements (≤640px) --- */
@media (max-width: 640px) {
  /* Page header stacks vertically */
  .rp-page-header .rp-flex {
    flex-direction: column;
    align-items: flex-start;
  }

  .rp-page-header .rp-flex .rp-flex {
    width: 100%;
    flex-wrap: wrap;
  }

  .rp-page-header__title {
    font-size: var(--rp-font-size-lg);
  }

  .rp-page-header__subtitle {
    font-size: var(--rp-font-size-sm);
  }

  /* Card header wraps */
  .rp-card__header {
    flex-wrap: wrap;
    gap: var(--rp-space-2);
  }

  .rp-card__title {
    font-size: var(--rp-font-size-md);
  }

  /* Inline 3/4-col grids → 1 column safety net */
  .rp-main__container [style*="grid-template-columns: repeat(3"],
  .rp-main__container [style*="grid-template-columns:repeat(3"],
  .rp-main__container [style*="grid-template-columns: repeat(4"],
  .rp-main__container [style*="grid-template-columns:repeat(4"] {
    grid-template-columns: 1fr !important;
  }

  /* Stat cards: smaller text on mobile */
  .rp-stat__value {
    font-size: var(--rp-font-size-xl);
  }

  .rp-stat__label {
    font-size: var(--rp-font-size-xs);
  }

  /* CTA card / highlight card: stack flex children */
  .rp-card--highlight .rp-flex {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--rp-space-3);
  }

  .rp-card--highlight .rp-btn--lg {
    width: 100%;
    justify-content: center;
  }

  /* Child selector card (parent dashboard) */
  .rp-card > .rp-flex.rp-items-center.rp-justify-between {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--rp-space-3);
  }

  .rp-card > .rp-flex .rp-flex.rp-gap-2 {
    width: 100%;
    flex-wrap: wrap;
  }

  .rp-card > .rp-flex .rp-select {
    width: 100% !important;
    max-width: 100%;
  }

  /* Upload panel: full width on mobile */
  .upload-panel {
    width: 100vw !important;
    max-width: 100vw !important;
    right: 0;
    left: 0;
    border-radius: 0;
  }

  .upload-panel-content {
    padding: var(--rp-space-4);
  }

  /* Mini chart (parent dashboard) */
  .rp-mini-chart {
    min-height: 60px;
  }

  /* Activity feed items */
  .rp-activity-item .rp-flex {
    flex-wrap: wrap;
    gap: var(--rp-space-2);
  }
}
