/* DESIGN SYSTEM & GLOBAL VARIABLES */
    :root {
      --font-heading: 'Outfit', sans-serif;
      --font-body: 'Inter', sans-serif;
      
      /* Light Mode Palette */
      --bg-primary: #f8fafc;
      --bg-secondary: #ffffff;
      --bg-tertiary: #f1f5f9;
      --text-primary: #0f172a;
      --text-secondary: #475569;
      --text-muted: #94a3b8;
      --primary: #4f46e5;
      --primary-hover: #4338ca;
      --primary-light: #e0e7ff;
      --accent: #d97706;
      --accent-hover: #b45309;
      --accent-light: #fef3c7;
      --success: #10b981;
      --success-light: #d1fae5;
      --danger: #ef4444;
      --danger-light: #fee2e2;
      --border-color: #e2e8f0;
      --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
      --hover-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
      --glass-bg: rgba(255, 255, 255, 0.8);
      --glass-border: rgba(241, 245, 249, 0.6);
      --sidebar-width: 260px;
    }

    [data-theme="dark"] {
      /* Dark Mode Palette */
      --bg-primary: #0b0f19;
      --bg-secondary: #111827;
      --bg-tertiary: #1f2937;
      --text-primary: #f9fafb;
      --text-secondary: #d1d5db;
      --text-muted: #6b7280;
      --primary: #6366f1;
      --primary-hover: #4f46e5;
      --primary-light: #1e1b4b;
      --accent: #f59e0b;
      --accent-hover: #d97706;
      --accent-light: #451a03;
      --success: #10b981;
      --success-light: #064e3b;
      --danger: #f87171;
      --danger-light: #7f1d1d;
      --border-color: #374151;
      --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
      --hover-shadow: 0 10px 20px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
      --glass-bg: rgba(17, 24, 39, 0.8);
      --glass-border: rgba(55, 65, 81, 0.6);
    }

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

    html {
      scroll-behavior: smooth;
    }

    body {
      font-family: var(--font-body);
      background-color: var(--bg-primary);
      color: var(--text-primary);
      transition: background-color 0.3s, color 0.3s;
      overflow-x: hidden;
      line-height: 1.6;
    }

    h1, h2, h3, h4, h5, h6 {
      font-family: var(--font-heading);
      font-weight: 700;
      line-height: 1.25;
    }

    a {
      text-decoration: none;
      color: inherit;
    }

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

    /* UTILITIES */
    .container {
      width: 100%;
      max-width: 1200px;
      margin: 0 auto;
      padding: 0 1.5rem;
    }

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.5rem;
      padding: 0.75rem 1.5rem;
      border-radius: 0.5rem;
      font-weight: 600;
      font-size: 0.95rem;
      cursor: pointer;
      transition: all 0.2s ease-in-out;
      border: none;
    }

    .btn-primary {
      background-color: var(--primary);
      color: #ffffff;
    }
    .btn-primary:hover {
      background-color: var(--primary-hover);
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    }

    .btn-accent {
      background-color: var(--accent);
      color: #ffffff;
    }
    .btn-accent:hover {
      background-color: var(--accent-hover);
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
    }

    .btn-secondary {
      background-color: var(--bg-tertiary);
      color: var(--text-primary);
      border: 1px solid var(--border-color);
    }
    .btn-secondary:hover {
      background-color: var(--border-color);
      transform: translateY(-2px);
    }

    .btn-danger {
      background-color: var(--danger);
      color: #ffffff;
    }
    .btn-danger:hover {
      background-color: #dc2626;
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    }

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

    .gradient-text {
      background: linear-gradient(135deg, var(--primary), #a855f7);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .glass {
      background: var(--glass-bg);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border: 1px solid var(--glass-border);
    }

    .badge {
      display: inline-flex;
      align-items: center;
      padding: 0.25rem 0.75rem;
      font-size: 0.75rem;
      font-weight: 600;
      border-radius: 9999px;
    }

    .badge-primary { background: var(--primary-light); color: var(--primary); }
    .badge-success { background: var(--success-light); color: var(--success); }
    .badge-warning { background: var(--accent-light); color: var(--accent); }
    .badge-danger { background: var(--danger-light); color: var(--danger); }

    /* HEADER & NAV */
    header {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: 80px;
      z-index: 1000;
      transition: all 0.3s;
      border-bottom: 1px solid var(--border-color);
    }

    header.scrolled {
      height: 70px;
      box-shadow: var(--card-shadow);
    }

    .nav-wrapper {
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 100%;
    }

    .logo {
      font-size: 1.5rem;
      font-weight: 800;
      font-family: var(--font-heading);
      letter-spacing: -0.5px;
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .logo i {
      color: var(--primary);
    }

    .nav-links {
      display: flex;
      align-items: center;
      gap: 1.5rem;
    }

    .nav-link {
      font-weight: 500;
      font-size: 0.95rem;
      color: var(--text-secondary);
      transition: color 0.2s;
      position: relative;
    }

    .nav-link:hover, .nav-link.active {
      color: var(--primary);
    }

    .nav-link.active::after {
      content: '';
      position: absolute;
      bottom: -6px;
      left: 0;
      width: 100%;
      height: 2px;
      background-color: var(--primary);
      border-radius: 2px;
    }

    .nav-actions {
      display: flex;
      align-items: center;
      gap: 1rem;
    }

    .theme-toggle {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--bg-tertiary);
      border: 1px solid var(--border-color);
      cursor: pointer;
      color: var(--text-primary);
      transition: all 0.2s;
    }
    
    .theme-toggle:hover {
      background: var(--border-color);
    }

    /* MOBILE NAV */
    .mobile-menu-btn {
      display: none;
      font-size: 1.5rem;
      background: none;
      border: none;
      color: var(--text-primary);
      cursor: pointer;
    }

    /* PUBLIC VIEWPORT & SECTIONS */
    main.public-site {
      margin-top: 80px;
      min-height: calc(100vh - 80px);
    }

    .hero-section {
      padding: 6rem 0 4rem;
      position: relative;
      overflow: hidden;
      text-align: center;
    }

    .hero-section::before {
      content: '';
      position: absolute;
      top: -10%;
      left: -10%;
      width: 50%;
      height: 60%;
      background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 60%);
      z-index: -1;
    }

    .hero-section::after {
      content: '';
      position: absolute;
      bottom: -10%;
      right: -10%;
      width: 50%;
      height: 60%;
      background: radial-gradient(circle, rgba(217, 119, 6, 0.1) 0%, transparent 60%);
      z-index: -1;
    }

    .hero-tag {
      background: var(--primary-light);
      color: var(--primary);
      padding: 0.35rem 1rem;
      border-radius: 9999px;
      font-size: 0.85rem;
      font-weight: 600;
      display: inline-block;
      margin-bottom: 1.5rem;
      animation: pulse 2s infinite;
    }

    @keyframes pulse {
      0% { transform: scale(1); }
      50% { transform: scale(1.03); }
      100% { transform: scale(1); }
    }

    .hero-title {
      font-size: 3.5rem;
      letter-spacing: -1px;
      max-width: 800px;
      margin: 0 auto 1.5rem;
      line-height: 1.15;
    }

    .hero-subtitle {
      font-size: 1.25rem;
      color: var(--text-secondary);
      max-width: 600px;
      margin: 0 auto 2.5rem;
    }

    .hero-cta {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 1.5rem;
      margin-bottom: 4rem;
    }

    .hero-video-container {
      max-width: 800px;
      margin: 0 auto;
      border-radius: 1rem;
      overflow: hidden;
      box-shadow: var(--hover-shadow);
      border: 4px solid var(--bg-secondary);
      position: relative;
      cursor: pointer;
    }

    /* MOCK VIDEO STYLING */
    .mock-video-player {
      width: 100%;
      aspect-ratio: 16/9;
      background: #0f172a;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
    }

    .video-thumbnail {
      position: absolute;
      width: 100%;
      height: 100%;
      background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: #ffffff;
      transition: opacity 0.5s ease;
    }

    .video-play-btn {
      width: 80px;
      height: 80px;
      border-radius: 50%;
      background: var(--primary);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 2rem;
      box-shadow: 0 10px 25px rgba(99, 102, 241, 0.5);
      margin-bottom: 1rem;
      transition: all 0.3s;
    }

    .video-play-btn:hover {
      transform: scale(1.1);
      background: var(--primary-hover);
    }

    /* STATS SECTION */
    .stats-section {
      padding: 3rem 0;
      border-top: 1px solid var(--border-color);
      border-bottom: 1px solid var(--border-color);
      background: var(--bg-secondary);
    }

    .stats-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 2rem;
      text-align: center;
    }

    .stat-card h3 {
      font-size: 2.5rem;
      color: var(--primary);
      margin-bottom: 0.25rem;
    }

    .stat-card p {
      color: var(--text-secondary);
      font-weight: 500;
      font-size: 0.95rem;
    }

    /* CORE SERVICES SECTION */
    .services-section {
      padding: 6rem 0;
    }

    .section-header {
      text-align: center;
      max-width: 600px;
      margin: 0 auto 4rem;
    }

    .section-header h2 {
      font-size: 2.25rem;
      margin-bottom: 1rem;
    }

    .section-header p {
      color: var(--text-secondary);
    }

    .services-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 2rem;
    }

    .service-card {
      background: var(--bg-secondary);
      border-radius: 1rem;
      padding: 2.5rem 2rem;
      border: 1px solid var(--border-color);
      transition: all 0.3s;
      display: flex;
      flex-direction: column;
      gap: 1.5rem;
      box-shadow: var(--card-shadow);
      position: relative;
      overflow: hidden;
    }

    .service-card::after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 4px;
      background: var(--primary);
      transform: scaleX(0);
      transform-origin: left;
      transition: transform 0.3s;
    }

    .service-card:hover {
      transform: translateY(-5px);
      box-shadow: var(--hover-shadow);
    }

    .service-card:hover::after {
      transform: scaleX(1);
    }

    .service-icon {
      width: 60px;
      height: 60px;
      border-radius: 0.75rem;
      background: var(--primary-light);
      color: var(--primary);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.5rem;
    }

    .service-title {
      font-size: 1.25rem;
      font-weight: 700;
    }

    .service-desc {
      color: var(--text-secondary);
      font-size: 0.95rem;
      flex-grow: 1;
    }

    .service-features {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      font-size: 0.85rem;
      color: var(--text-secondary);
    }

    .service-features li {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .service-features i {
      color: var(--success);
    }

    /* PROCESS TIMELINE */
    .process-section {
      padding: 6rem 0;
      background: var(--bg-secondary);
    }

    .process-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 2rem;
      position: relative;
    }

    .process-card {
      text-align: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 1rem;
      z-index: 1;
    }

    .process-step {
      width: 50px;
      height: 50px;
      border-radius: 50%;
      background: var(--primary);
      color: #ffffff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 1.2rem;
      box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
    }

    .process-title {
      font-size: 1.1rem;
      font-weight: 700;
    }

    .process-desc {
      font-size: 0.85rem;
      color: var(--text-secondary);
    }

    /* TURNITIN SCAN PAGE */
    .turnitin-container {
      background: var(--bg-secondary);
      border-radius: 1rem;
      border: 1px solid var(--border-color);
      box-shadow: var(--card-shadow);
      padding: 3rem;
      margin-top: 2rem;
    }

    .scanner-layout {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 3rem;
    }

    .scanner-controls {
      display: flex;
      flex-direction: column;
      gap: 1.5rem;
    }

    .textarea-wrapper {
      position: relative;
    }

    .scanner-textarea {
      width: 100%;
      height: 250px;
      border-radius: 0.5rem;
      border: 1px solid var(--border-color);
      background: var(--bg-primary);
      color: var(--text-primary);
      padding: 1rem;
      font-family: var(--font-body);
      font-size: 0.95rem;
      resize: none;
      outline: none;
      transition: border-color 0.2s;
    }

    .scanner-textarea:focus {
      border-color: var(--primary);
    }

    .word-counter {
      position: absolute;
      bottom: 10px;
      right: 15px;
      font-size: 0.75rem;
      color: var(--text-muted);
    }

    /* SCANNING ANIMATION */
    .scan-progress-bar {
      width: 100%;
      height: 8px;
      background: var(--bg-tertiary);
      border-radius: 4px;
      overflow: hidden;
      display: none;
    }

    .scan-progress-fill {
      height: 100%;
      background: linear-gradient(90deg, var(--primary), #a855f7);
      width: 0%;
      transition: width 0.1s linear;
    }

    /* REPORT DISPLAY */
    .report-display {
      border: 1px solid var(--border-color);
      border-radius: 0.75rem;
      padding: 2rem;
      background: var(--bg-primary);
      display: flex;
      flex-direction: column;
      gap: 2rem;
      height: 100%;
      justify-content: center;
      align-items: center;
      text-align: center;
    }

    .empty-report-state i {
      font-size: 4rem;
      color: var(--text-muted);
      margin-bottom: 1rem;
    }

    .report-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 1.5rem;
      width: 100%;
    }

    .metric-card {
      background: var(--bg-secondary);
      border-radius: 0.5rem;
      padding: 1.5rem;
      border: 1px solid var(--border-color);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.5rem;
    }

    .metric-circle {
      width: 100px;
      height: 100px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.75rem;
      font-weight: 800;
      background: conic-gradient(var(--success) 0%, var(--bg-tertiary) 0%);
      position: relative;
    }

    .metric-circle::after {
      content: '';
      position: absolute;
      width: 80px;
      height: 80px;
      border-radius: 50%;
      background: var(--bg-secondary);
    }

    .metric-circle span {
      position: relative;
      z-index: 1;
    }

    .scan-highlighted-text {
      width: 100%;
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: 0.5rem;
      padding: 1rem;
      text-align: left;
      font-size: 0.9rem;
      height: 180px;
      overflow-y: auto;
    }

    .plagiarized-highlight {
      background: rgba(239, 68, 68, 0.15);
      border-bottom: 2px solid var(--danger);
      cursor: pointer;
    }

    .ai-highlight {
      background: rgba(168, 85, 247, 0.15);
      border-bottom: 2px solid #a855f7;
      cursor: pointer;
    }

    /* SAMPLE ESSAYS PAGE */
    .samples-layout {
      display: grid;
      grid-template-columns: 320px 1fr;
      gap: 2rem;
      margin-top: 2rem;
    }

    .samples-sidebar {
      background: var(--bg-secondary);
      border-radius: 1rem;
      border: 1px solid var(--border-color);
      padding: 1.5rem;
      display: flex;
      flex-direction: column;
      gap: 1rem;
      height: fit-content;
    }

    .samples-list {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }

    .sample-item-btn {
      width: 100%;
      padding: 1rem;
      border-radius: 0.5rem;
      background: var(--bg-primary);
      border: 1px solid var(--border-color);
      text-align: left;
      cursor: pointer;
      font-size: 0.9rem;
      font-weight: 600;
      transition: all 0.2s;
    }

    .sample-item-btn:hover, .sample-item-btn.active {
      border-color: var(--primary);
      background: var(--primary-light);
      color: var(--primary);
    }

    .sample-viewer {
      background: var(--bg-secondary);
      border-radius: 1rem;
      border: 1px solid var(--border-color);
      box-shadow: var(--card-shadow);
      padding: 2.5rem;
      display: flex;
      flex-direction: column;
      gap: 1.5rem;
      min-height: 500px;
    }

    .sample-header {
      border-bottom: 1px solid var(--border-color);
      padding-bottom: 1.5rem;
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
    }

    .sample-meta {
      display: flex;
      gap: 1rem;
      color: var(--text-secondary);
      font-size: 0.85rem;
      margin-top: 0.5rem;
    }

    .sample-grade-badge {
      background: var(--success-light);
      color: var(--success);
      font-size: 1.25rem;
      font-weight: 800;
      padding: 0.5rem 1rem;
      border-radius: 0.5rem;
      border: 1px dashed var(--success);
    }

    .essay-document {
      font-family: 'Times New Roman', Times, serif;
      font-size: 1.1rem;
      color: #2b2b2b;
      line-height: 1.8;
      padding: 1rem;
      background: #faf8f5;
      border-radius: 0.25rem;
      border: 1px solid #e5dec9;
      height: 380px;
      overflow-y: auto;
    }

    .essay-annotation {
      position: relative;
      background-color: #fef08a;
      border-bottom: 1px dashed #ca8a04;
      cursor: help;
    }

    .essay-annotation::after {
      content: attr(data-comment);
      position: absolute;
      bottom: 100%;
      left: 50%;
      transform: translateX(-50%);
      width: 260px;
      background: #1e293b;
      color: #ffffff;
      padding: 0.75rem;
      border-radius: 0.5rem;
      font-size: 0.8rem;
      font-family: var(--font-body);
      line-height: 1.4;
      box-shadow: var(--hover-shadow);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s;
      z-index: 10;
    }

    .essay-annotation:hover::after {
      opacity: 1;
    }

    /* WRITER TEAM PAGE */
    .tutors-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 2rem;
      margin-top: 2rem;
    }

    .tutor-card {
      background: var(--bg-secondary);
      border-radius: 1rem;
      border: 1px solid var(--border-color);
      box-shadow: var(--card-shadow);
      overflow: hidden;
      transition: all 0.3s;
      display: flex;
      flex-direction: column;
    }

    .tutor-card:hover {
      transform: translateY(-5px);
      box-shadow: var(--hover-shadow);
    }

    .tutor-avatar-wrapper {
      height: 180px;
      background: linear-gradient(135deg, var(--primary-light), var(--bg-tertiary));
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
    }

    .tutor-avatar-wrapper i {
      font-size: 5rem;
      color: var(--primary);
      opacity: 0.8;
    }

    .tutor-rating {
      position: absolute;
      bottom: 10px;
      right: 10px;
      background: var(--bg-secondary);
      padding: 0.25rem 0.5rem;
      border-radius: 0.25rem;
      font-size: 0.8rem;
      font-weight: 700;
      color: var(--accent);
      display: flex;
      align-items: center;
      gap: 0.25rem;
      box-shadow: var(--card-shadow);
    }

    .tutor-info {
      padding: 1.5rem;
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
      flex-grow: 1;
    }

    .tutor-name {
      font-size: 1.15rem;
      font-weight: 700;
    }

    .tutor-credentials {
      font-size: 0.8rem;
      color: var(--text-muted);
      font-weight: 600;
    }

    .tutor-bio {
      font-size: 0.85rem;
      color: var(--text-secondary);
      flex-grow: 1;
    }

    .tutor-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 0.25rem;
    }

    /* BLOG PAGE */
    .blog-layout {
      display: grid;
      grid-template-columns: 2fr 1fr;
      gap: 3rem;
      margin-top: 2rem;
    }

    .blog-posts-list {
      display: flex;
      flex-direction: column;
      gap: 3rem;
    }

    /* v4 — Writing Tips news-feed chrome */
    .blog-toolbar {
      display: flex;
      flex-wrap: wrap;
      gap: 0.75rem;
      align-items: center;
      margin-bottom: 1.5rem;
    }
    .blog-search-box {
      flex: 1 1 240px;
      position: relative;
    }
    .blog-search-box input {
      width: 100%;
      padding: 0.6rem 0.85rem 0.6rem 2.2rem;
      border-radius: 0.5rem;
      border: 1px solid var(--border-color);
      background: var(--bg-secondary);
      color: var(--text-primary);
      font-size: 0.9rem;
    }
    .blog-search-box i {
      position: absolute;
      left: 0.75rem;
      top: 50%;
      transform: translateY(-50%);
      color: var(--text-muted);
      font-size: 0.85rem;
    }
    .blog-filter-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 0.4rem;
    }
    .blog-filter-chip {
      padding: 0.35rem 0.85rem;
      border-radius: 9999px;
      background: var(--bg-tertiary);
      color: var(--text-secondary);
      font-size: 0.78rem;
      font-weight: 600;
      border: 1px solid var(--border-color);
      cursor: pointer;
      transition: all 0.2s;
    }
    .blog-filter-chip:hover { color: var(--primary); border-color: var(--primary); }
    .blog-filter-chip.active {
      background: var(--primary);
      color: #fff;
      border-color: var(--primary);
    }

    .blog-featured-card {
      background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(168, 85, 247, 0.08));
      border: 1px solid var(--border-color);
      border-left: 4px solid var(--primary);
      border-radius: 1rem;
      padding: 2rem;
      position: relative;
      overflow: hidden;
    }
    .blog-featured-card .featured-tag {
      position: absolute;
      top: 1rem;
      right: 1rem;
      background: var(--accent);
      color: #fff;
      padding: 0.2rem 0.6rem;
      border-radius: 9999px;
      font-size: 0.65rem;
      font-weight: 700;
      letter-spacing: 0.05em;
      text-transform: uppercase;
    }

    .blog-post-card {
      background: var(--bg-secondary);
      border-radius: 1rem;
      border: 1px solid var(--border-color);
      box-shadow: var(--card-shadow);
      padding: 2.5rem;
      display: flex;
      flex-direction: column;
      gap: 1.25rem;
      transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    }
    .blog-post-card:hover {
      transform: translateY(-2px);
      box-shadow: var(--hover-shadow);
    }

    .blog-title {
      font-size: 1.75rem;
      font-weight: 800;
    }

    .blog-meta-row {
      display: flex;
      flex-wrap: wrap;
      gap: 1.5rem;
      font-size: 0.85rem;
      color: var(--text-secondary);
    }
    .blog-meta-row .blog-meta-reading-time {
      color: var(--text-muted);
    }
    .blog-meta-row .blog-meta-views {
      color: var(--text-muted);
    }

    .blog-content {
      color: var(--text-secondary);
      font-size: 0.95rem;
    }

    .blog-tags-row {
      display: flex;
      flex-wrap: wrap;
      gap: 0.4rem;
    }
    .blog-tag {
      font-size: 0.72rem;
      padding: 0.2rem 0.6rem;
      border-radius: 0.3rem;
      background: var(--bg-tertiary);
      color: var(--text-secondary);
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
    }
    .blog-tag:hover { color: var(--primary); background: var(--primary-light); }

    .blog-actions-bar {
      display: flex;
      align-items: center;
      gap: 1rem;
      padding-top: 1rem;
      border-top: 1px solid var(--border-color);
      font-size: 0.9rem;
      font-weight: 600;
      flex-wrap: wrap;
    }

    .blog-action-btn {
      background: none;
      border: none;
      color: var(--text-secondary);
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      transition: color 0.2s;
      padding: 0.35rem 0.5rem;
      border-radius: 0.35rem;
    }

    .blog-action-btn:hover {
      color: var(--primary);
    }
    .blog-action-btn.liked {
      color: var(--primary);
    }
    .blog-action-btn.bookmarked {
      color: var(--accent);
    }
    .blog-share-row {
      display: flex;
      gap: 0.4rem;
      margin-left: auto;
    }
    .blog-share-btn {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: var(--bg-tertiary);
      color: var(--text-secondary);
      border: none;
      cursor: pointer;
      transition: all 0.2s;
    }
    .blog-share-btn:hover {
      background: var(--primary);
      color: #fff;
      transform: translateY(-1px);
    }

    .blog-sidebar {
      display: flex;
      flex-direction: column;
      gap: 2rem;
    }

    .sidebar-widget {
      background: var(--bg-secondary);
      border-radius: 1rem;
      border: 1px solid var(--border-color);
      padding: 1.5rem;
    }

    .sidebar-widget h3 {
      font-size: 1.15rem;
      margin-bottom: 1rem;
      border-bottom: 2px solid var(--border-color);
      padding-bottom: 0.5rem;
    }

    .recent-posts-list {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }
    .recent-post-item {
      display: flex;
      flex-direction: column;
      gap: 0.2rem;
    }
    .recent-post-link {
      font-size: 0.9rem;
      font-weight: 600;
      color: var(--text-secondary);
      transition: color 0.2s;
    }
    .recent-post-link:hover {
      color: var(--primary);
    }
    .recent-post-meta {
      font-size: 0.72rem;
      color: var(--text-muted);
      display: flex;
      gap: 0.6rem;
      align-items: center;
    }
    .recent-post-rank {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: var(--primary-light);
      color: var(--primary);
      font-size: 0.7rem;
      font-weight: 700;
    }

    /* Tag cloud widget */
    .tag-cloud {
      display: flex;
      flex-wrap: wrap;
      gap: 0.4rem;
    }
    .tag-cloud-item {
      font-size: 0.78rem;
      padding: 0.25rem 0.7rem;
      border-radius: 9999px;
      background: var(--bg-tertiary);
      color: var(--text-secondary);
      cursor: pointer;
      transition: all 0.2s;
      border: 1px solid transparent;
    }
    .tag-cloud-item:hover {
      background: var(--primary-light);
      color: var(--primary);
      border-color: var(--primary);
    }
    .tag-cloud-item .tag-count {
      font-size: 0.65rem;
      color: var(--text-muted);
      margin-left: 0.25rem;
    }

    /* Newsletter signup widget */
    .newsletter-widget {
      background: linear-gradient(135deg, var(--primary), #a855f7);
      color: #fff;
      padding: 1.5rem;
      border-radius: 1rem;
    }
    .newsletter-widget h3 {
      color: #fff;
      border-bottom-color: rgba(255, 255, 255, 0.25);
    }
    .newsletter-widget p {
      font-size: 0.82rem;
      opacity: 0.92;
      margin-bottom: 1rem;
    }
    .newsletter-widget input {
      width: 100%;
      padding: 0.6rem 0.85rem;
      border-radius: 0.4rem;
      border: none;
      margin-bottom: 0.6rem;
      font-size: 0.85rem;
    }
    .newsletter-widget button {
      width: 100%;
      padding: 0.65rem;
      background: #fff;
      color: var(--primary);
      border: none;
      border-radius: 0.4rem;
      font-weight: 700;
      cursor: pointer;
      transition: transform 0.2s;
    }
    .newsletter-widget button:hover { transform: translateY(-1px); }

    /* Archive by month */
    .blog-archive-list {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }
    .blog-archive-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.85rem;
      color: var(--text-secondary);
      cursor: pointer;
      padding: 0.35rem 0;
      transition: color 0.2s;
    }
    .blog-archive-row:hover { color: var(--primary); }
    .blog-archive-row .archive-count {
      background: var(--bg-tertiary);
      color: var(--text-muted);
      font-size: 0.7rem;
      padding: 0.1rem 0.5rem;
      border-radius: 9999px;
      font-weight: 600;
    }

    /* Stats strip widget */
    .blog-stats-strip {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 0.75rem;
    }
    .blog-stat-cell {
      text-align: center;
      padding: 0.85rem 0.5rem;
      background: var(--bg-tertiary);
      border-radius: 0.5rem;
    }
    .blog-stat-cell .stat-num {
      font-size: 1.25rem;
      font-weight: 800;
      color: var(--primary);
      font-family: var(--font-heading);
    }
    .blog-stat-cell .stat-label {
      font-size: 0.7rem;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      font-weight: 600;
    }

    /* Comments section */
    .blog-comments-list {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
      margin-bottom: 1rem;
    }
    .blog-comment-item {
      background: var(--bg-primary);
      padding: 0.75rem 1rem;
      border-radius: 0.5rem;
      font-size: 0.85rem;
      border-left: 3px solid var(--primary);
    }
    .blog-comment-author {
      font-weight: 700;
      color: var(--text-primary);
    }
    .blog-comment-time {
      font-size: 0.7rem;
      color: var(--text-muted);
      margin-left: 0.5rem;
    }
    .blog-comment-form {
      display: flex;
      gap: 0.5rem;
      margin-top: 0.5rem;
    }

    @media (max-width: 900px) {
      .blog-layout { grid-template-columns: 1fr; }
    }

    /* INTERACTIVE PRICE CALCULATOR MODAL */
    .modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0,0,0,0.5);
      z-index: 1100;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s ease;
    }

    .modal-overlay.open {
      opacity: 1;
      pointer-events: all;
    }

    .modal-card {
      background: var(--bg-secondary);
      border-radius: 1rem;
      max-width: 600px;
      width: 100%;
      border: 1px solid var(--border-color);
      box-shadow: var(--hover-shadow);
      overflow: hidden;
      transform: scale(0.95);
      transition: transform 0.3s ease;
    }

    .modal-overlay.open .modal-card {
      transform: scale(1);
    }

    .modal-header {
      padding: 1.5rem;
      border-bottom: 1px solid var(--border-color);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .modal-header h2 {
      font-size: 1.5rem;
    }

    .modal-close-btn {
      background: none;
      border: none;
      font-size: 1.5rem;
      cursor: pointer;
      color: var(--text-secondary);
    }

    .modal-body {
      padding: 2rem;
      display: flex;
      flex-direction: column;
      gap: 1.5rem;
    }

    .calculator-form-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 1.5rem;
    }

    .form-group {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }

    .form-group label {
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--text-secondary);
    }

    .form-control {
      padding: 0.75rem;
      border-radius: 0.5rem;
      border: 1px solid var(--border-color);
      background: var(--bg-primary);
      color: var(--text-primary);
      outline: none;
      font-size: 0.95rem;
      transition: border-color 0.2s;
    }

    .form-control:focus {
      border-color: var(--primary);
    }

    .calc-currencies-box {
      border-top: 1px solid var(--border-color);
      padding-top: 1.5rem;
    }

    .currencies-list {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 0.75rem;
      text-align: center;
      margin-top: 1rem;
    }

    .currency-item {
      background: var(--bg-primary);
      border-radius: 0.5rem;
      padding: 0.75rem 0.5rem;
      border: 1px solid var(--border-color);
    }

    .currency-name {
      font-size: 0.75rem;
      color: var(--text-muted);
      font-weight: 600;
      margin-bottom: 0.25rem;
    }

    .currency-price {
      font-size: 1.1rem;
      font-weight: 700;
      color: var(--primary);
    }

    /* WORKSPACE PORTAL CONTAINER */
    .portal-container {
      display: flex;
      min-height: 100vh;
      background: var(--bg-primary);
    }

    .portal-sidebar {
      width: var(--sidebar-width);
      background: var(--bg-secondary);
      border-right: 1px solid var(--border-color);
      display: flex;
      flex-direction: column;
      height: 100vh;
      position: fixed;
      left: 0;
      top: 0;
      z-index: 100;
    }

    .portal-logo-area {
      padding: 1.5rem;
      border-bottom: 1px solid var(--border-color);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .portal-menu {
      list-style: none;
      padding: 1.5rem 1rem;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      flex-grow: 1;
      overflow-y: auto;
      overflow-x: hidden;
      min-height: 0;
      scrollbar-width: thin;
      scrollbar-color: var(--text-muted) transparent;
    }
    .portal-menu::-webkit-scrollbar { width: 6px; }
    .portal-menu::-webkit-scrollbar-track { background: transparent; }
    .portal-menu::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }

    .portal-menu-item-btn {
      width: 100%;
      padding: 0.75rem 1rem;
      border-radius: 0.5rem;
      background: none;
      border: none;
      text-align: left;
      cursor: pointer;
      color: var(--text-secondary);
      font-weight: 500;
      font-size: 0.95rem;
      display: flex;
      align-items: center;
      gap: 0.75rem;
      transition: all 0.2s;
    }

    .portal-menu-item-btn:hover, .portal-menu-item-btn.active {
      background: var(--primary-light);
      color: var(--primary);
      font-weight: 600;
    }

    .portal-role-switcher-box {
      border-top: 1px solid var(--border-color);
      padding: 1.5rem;
    }

    .portal-content-area {
      margin-left: var(--sidebar-width);
      flex-grow: 1;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    .portal-top-bar {
      height: 70px;
      background: var(--bg-secondary);
      border-bottom: 1px solid var(--border-color);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 2rem;
      position: sticky;
      top: 0;
      z-index: 90;
    }

    .portal-user-info {
      display: flex;
      align-items: center;
      gap: 1rem;
    }

    .portal-avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: var(--primary-light);
      color: var(--primary);
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
    }

    .portal-viewport {
      padding: 2rem;
      flex-grow: 1;
    }

    /* DASHBOARD CARD GRID */
    .dashboard-metrics-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 1.5rem;
      margin-bottom: 2rem;
    }

    .dashboard-metric-card {
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: 0.75rem;
      padding: 1.5rem;
      box-shadow: var(--card-shadow);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .metric-text h4 {
      font-size: 0.85rem;
      color: var(--text-muted);
      font-weight: 600;
      margin-bottom: 0.25rem;
    }

    .metric-text p {
      font-size: 1.75rem;
      font-weight: 800;
    }

    .metric-icon {
      width: 48px;
      height: 48px;
      border-radius: 0.5rem;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.25rem;
    }

    /* DATA TABLES */
    .data-table-wrapper {
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: 0.75rem;
      box-shadow: var(--card-shadow);
      overflow: hidden;
      margin-top: 1.5rem;
    }

    .data-table-header {
      padding: 1.25rem 1.5rem;
      border-bottom: 1px solid var(--border-color);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .data-table {
      width: 100%;
      border-collapse: collapse;
      text-align: left;
    }

    .data-table th {
      background: var(--bg-tertiary);
      padding: 1rem 1.5rem;
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .data-table td {
      padding: 1.25rem 1.5rem;
      border-bottom: 1px solid var(--border-color);
      font-size: 0.9rem;
    }

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

    .data-table tr:hover td {
      background: rgba(99, 102, 241, 0.02);
    }

    /* DYNAMIC ORDER DETAIL COMPONENT */
    .order-detail-layout {
      display: grid;
      grid-template-columns: 2fr 1fr;
      gap: 2rem;
    }

    .order-detail-main {
      display: flex;
      flex-direction: column;
      gap: 1.5rem;
    }

    .order-card-panel {
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: 0.75rem;
      padding: 1.75rem;
      box-shadow: var(--card-shadow);
    }

    .order-timeline {
      display: flex;
      justify-content: space-between;
      position: relative;
      margin: 1.5rem 0 2rem;
    }

    .order-timeline::after {
      content: '';
      position: absolute;
      top: 15px;
      left: 5%;
      right: 5%;
      height: 2px;
      background: var(--border-color);
      z-index: 1;
    }

    .timeline-step {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.5rem;
      z-index: 2;
      position: relative;
      width: 20%;
      text-align: center;
    }

    .timeline-dot {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: var(--bg-primary);
      border: 2px solid var(--border-color);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.8rem;
      color: var(--text-muted);
      transition: all 0.3s;
    }

    .timeline-step.completed .timeline-dot {
      background: var(--success);
      border-color: var(--success);
      color: #ffffff;
    }

    .timeline-step.active .timeline-dot {
      background: var(--primary);
      border-color: var(--primary);
      color: #ffffff;
      box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
    }

    .timeline-label {
      font-size: 0.75rem;
      font-weight: 600;
      color: var(--text-secondary);
    }

    /* MOCK EDITING & REVISION FLOWS */
    .editor-container-box {
      border: 1px solid var(--border-color);
      border-radius: 0.5rem;
      overflow: hidden;
      margin-top: 1rem;
    }

    .editor-toolbar-box {
      background: var(--bg-tertiary);
      padding: 0.75rem;
      border-bottom: 1px solid var(--border-color);
      display: flex;
      gap: 0.5rem;
    }

    .editor-textarea {
      width: 100%;
      height: 350px;
      padding: 1.5rem;
      border: none;
      background: var(--bg-secondary);
      color: var(--text-primary);
      font-family: 'Times New Roman', Times, serif;
      font-size: 1.05rem;
      line-height: 1.8;
      resize: none;
      outline: none;
    }

    /* ORDER LINK STYLING */
    .order-link {
      color: var(--primary);
      text-decoration: none;
      font-weight: 600;
      cursor: pointer;
      transition: color 0.2s;
    }
    .order-link:hover {
      color: var(--primary-hover);
      text-decoration: underline;
    }

    /* CHAT COMPONENT */
    .chat-card {
      display: flex;
      flex-direction: column;
      height: 400px;
    }

    .chat-messages {
      flex-grow: 1;
      overflow-y: auto;
      padding: 1rem;
      display: flex;
      flex-direction: column;
      gap: 1rem;
      background: var(--bg-primary);
      border: 1px solid var(--border-color);
      border-radius: 0.5rem;
    }

    .chat-bubble {
      max-width: 75%;
      padding: 0.75rem 1rem;
      border-radius: 0.75rem;
      font-size: 0.85rem;
      line-height: 1.4;
    }

    .chat-bubble.sent {
      align-self: flex-end;
      background: var(--primary);
      color: #ffffff;
      border-bottom-right-radius: 0.15rem;
    }

    .chat-bubble.received {
      align-self: flex-start;
      background: var(--bg-secondary);
      color: var(--text-primary);
      border-bottom-left-radius: 0.15rem;
      border: 1px solid var(--border-color);
    }

    .chat-input-row {
      display: flex;
      gap: 0.5rem;
      margin-top: 1rem;
    }

    /* FOOTER */
    footer {
      background: var(--bg-secondary);
      border-top: 1px solid var(--border-color);
      padding: 4rem 0 2rem;
      margin-top: 6rem;
    }

    .footer-grid {
      display: grid;
      grid-template-columns: 2fr repeat(3, 1fr);
      gap: 3rem;
      margin-bottom: 3rem;
    }

    .footer-col h3 {
      font-size: 1.1rem;
      margin-bottom: 1.25rem;
    }

    .footer-col p {
      color: var(--text-secondary);
      font-size: 0.9rem;
      margin-bottom: 1rem;
    }

    .footer-links {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
      font-size: 0.9rem;
      color: var(--text-secondary);
    }

    .footer-links a:hover {
      color: var(--primary);
    }

    .footer-bottom {
      border-top: 1px solid var(--border-color);
      padding-top: 2rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.85rem;
      color: var(--text-muted);
    }

    /* RESPONSIVE BREAKPOINTS */
    @media (max-width: 1024px) {
      .services-grid, .tutors-grid {
        grid-template-columns: repeat(2, 1fr);
      }
      .footer-grid {
        grid-template-columns: repeat(2, 1fr);
      }
    }

    @media (max-width: 768px) {
      .hero-title {
        font-size: 2.5rem;
      }
      .nav-links {
        display: none; /* Add slide out or modal later */
      }
      .mobile-menu-btn {
        display: block;
      }
      .stats-grid, .process-grid, .dashboard-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
      }
      .scanner-layout, .samples-layout, .blog-layout, .order-detail-layout {
        grid-template-columns: 1fr;
      }
      .portal-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
      }
      .portal-sidebar.open {
        transform: translateX(0);
      }
      .portal-content-area {
        margin-left: 0;
      }
    }

    /* ACTIVITY LOG PANEL */
    .portal-activity-log-panel {
      position: fixed;
      top: 0;
      right: 0;
      width: 320px;
      height: 100vh;
      background: var(--bg-secondary);
      border-left: 1px solid var(--border-color);
      box-shadow: -4px 0 15px rgba(0, 0, 0, 0.05);
      z-index: 1000;
      display: flex;
      flex-direction: column;
      transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      transform: translateX(100%);
    }
    .portal-activity-log-panel.open {
      transform: translateX(0);
    }
    .activity-log-header {
      padding: 1.5rem;
      border-bottom: 1px solid var(--border-color);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .activity-log-content {
      flex-grow: 1;
      overflow-y: auto;
      padding: 1.5rem;
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }
    .activity-item {
      display: flex;
      flex-direction: column;
      gap: 0.25rem;
      padding-bottom: 0.75rem;
      border-bottom: 1px dashed var(--border-color);
    }
    .activity-item-text {
      font-size: 0.85rem;
      color: var(--text-primary);
    }
    .activity-item-time {
      font-size: 0.7rem;
      color: var(--text-muted);
    }
    
    /* REVISION & DISPUTE STYLE CLASSES */
    .revision-card, .dispute-card {
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: 0.75rem;
      padding: 1.5rem;
      box-shadow: var(--card-shadow);
      margin-bottom: 1.5rem;
    }
    .file-attachment-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      padding: 0.25rem 0.5rem;
      background: var(--bg-tertiary);
      border: 1px solid var(--border-color);
      border-radius: 0.25rem;
      font-size: 0.75rem;
      color: var(--text-secondary);
      cursor: pointer;
      margin-top: 0.25rem;
      width: fit-content;
      text-decoration: none;
    }
    .file-attachment-badge:hover {
      background: var(--border-color);
      color: var(--primary);
    }

    /* SCROLL-TO-TOP BUTTON */
    .scroll-top-btn {
      position: fixed;
      bottom: 1.5rem;
      right: 1.5rem;
      width: 48px;
      height: 48px;
      border-radius: 50%;
      background: var(--primary);
      color: #ffffff;
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.1rem;
      box-shadow: var(--hover-shadow);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s;
      z-index: 950;
    }
    .scroll-top-btn.visible {
      opacity: 1;
      pointer-events: auto;
    }
    .scroll-top-btn:hover {
      background: var(--primary-hover);
      transform: translateY(-3px);
    }

    /* ACCESSIBILITY: visually hidden but available to screen readers */
    .sr-only {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

    /* LOCK BODY SCROLL WHEN A MODAL IS OPEN */
    body.modal-open {
      overflow: hidden;
    }

    /* =====================================================
       NEW COMPONENTS — Per HuaMentor v2 Specification
       ===================================================== */

    /* Live red counter pill on sidebar menu items */
    .portal-menu-item-btn {
      position: relative;
    }
    .menu-badge-counter {
      margin-left: auto;
      min-width: 22px;
      height: 22px;
      padding: 0 7px;
      border-radius: 9999px;
      background: var(--danger);
      color: #ffffff;
      font-size: 0.72rem;
      font-weight: 700;
      line-height: 22px;
      text-align: center;
      box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
      animation: badgePulse 1.8s ease-in-out infinite;
    }
    .menu-badge-counter.zero {
      background: var(--text-muted);
      box-shadow: none;
      animation: none;
      opacity: 0.55;
    }
    @keyframes badgePulse {
      0%, 100% { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }
      50%      { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.08); }
    }

    /* Payment selection modal — AliPay brand red */
    .payment-option-card {
      border: 2px solid var(--border-color);
      border-radius: 0.75rem;
      padding: 1.5rem;
      cursor: pointer;
      transition: all 0.2s ease;
      background: var(--bg-secondary);
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      text-align: left;
    }
    .payment-option-card:hover {
      border-color: var(--primary);
      transform: translateY(-2px);
      box-shadow: var(--hover-shadow);
    }
    .payment-option-card.alipay {
      border-color: #00aaee;
    }
    .payment-option-card.alipay:hover {
      border-color: #1677ff;
      box-shadow: 0 6px 18px rgba(22, 119, 255, 0.18);
    }
    .payment-option-card.alipay .pay-logo {
      background: #1677ff;
      color: #fff;
    }
    .payment-option-card.manual .pay-logo {
      background: var(--accent);
      color: #fff;
    }
    .pay-logo {
      width: 44px;
      height: 44px;
      border-radius: 0.5rem;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.25rem;
      font-weight: 700;
    }
    .alipay-redirect-bar {
      height: 4px;
      background: linear-gradient(90deg, #00aaee, #1677ff, #00aaee);
      background-size: 200% 100%;
      animation: alipaySlide 1.2s linear infinite;
      border-radius: 2px;
      margin: 1rem 0;
    }
    @keyframes alipaySlide {
      0%   { background-position: 0% 0%; }
      100% { background-position: 200% 0%; }
    }

    /* Star rating widget (Upwork style) */
    .star-rating-widget {
      display: inline-flex;
      flex-direction: row-reverse;
      gap: 0.25rem;
      font-size: 1.8rem;
      line-height: 1;
    }
    .star-rating-widget input {
      display: none;
    }
    .star-rating-widget label {
      cursor: pointer;
      color: #d1d5db;
      transition: color 0.15s, transform 0.15s;
    }
    .star-rating-widget label:hover,
    .star-rating-widget label:hover ~ label,
    .star-rating-widget input:checked ~ label {
      color: #f5a623;
    }
    .star-rating-widget label:hover {
      transform: scale(1.1);
    }
    .star-rating-readonly {
      display: inline-flex;
      gap: 0.15rem;
      font-size: 1rem;
      line-height: 1;
    }
    .star-rating-readonly .star-filled { color: #f5a623; }
    .star-rating-readonly .star-empty  { color: #d1d5db; }

    .rating-feedback-card {
      background: var(--bg-primary);
      border: 1px solid var(--border-color);
      border-left: 4px solid #f5a623;
      border-radius: 0.5rem;
      padding: 1rem 1.25rem;
      margin-top: 0.75rem;
    }

    /* Unfunded order row stripe */
    .unfunded-row td {
      background: rgba(239, 68, 68, 0.04) !important;
    }
    .payment-status-pill {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      padding: 0.2rem 0.6rem;
      border-radius: 9999px;
      font-size: 0.7rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.4px;
    }
    .payment-status-pill.paid      { background: var(--success-light); color: var(--success); }
    .payment-status-pill.unfunded  { background: var(--danger-light);  color: var(--danger);  }
    .payment-status-pill.manual    { background: var(--accent-light);  color: var(--accent);  }

    /* Price adjustment chip */
    .price-adjust-chip {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      padding: 0.25rem 0.6rem;
      border-radius: 0.4rem;
      font-size: 0.72rem;
      font-weight: 600;
      background: var(--accent-light);
      color: var(--accent);
      border: 1px solid var(--accent);
    }
    .price-adjust-chip.pending {
      background: rgba(239, 68, 68, 0.08);
      color: var(--danger);
      border-color: var(--danger);
    }
    .price-adjust-chip.approved {
      background: var(--success-light);
      color: var(--success);
      border-color: var(--success);
    }

    /* Message center order accordion */
    .msg-order-accordion {
      border: 1px solid var(--border-color);
      border-radius: 0.6rem;
      overflow: hidden;
      background: var(--bg-secondary);
      transition: box-shadow 0.2s;
    }
    .msg-order-accordion:hover {
      box-shadow: var(--card-shadow);
    }
    .msg-order-accordion.active {
      border-color: var(--primary);
      box-shadow: 0 4px 14px rgba(99, 102, 241, 0.12);
    }
    .msg-order-header {
      display: flex;
      align-items: center;
      gap: 1rem;
      padding: 1rem 1.25rem;
      cursor: pointer;
      transition: background 0.15s;
    }
    .msg-order-header:hover {
      background: var(--bg-tertiary);
    }
    .msg-order-chevron {
      margin-left: auto;
      transition: transform 0.2s;
      color: var(--text-muted);
    }
    .msg-order-accordion.active .msg-order-chevron {
      transform: rotate(90deg);
      color: var(--primary);
    }
    .msg-order-body {
      display: none;
      padding: 0 1.25rem 1.25rem 1.25rem;
      border-top: 1px solid var(--border-color);
      background: var(--bg-primary);
    }
    .msg-order-accordion.active .msg-order-body {
      display: block;
    }
    .msg-order-unread-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--danger);
      box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
    }
    .workplace-msg-section {
      background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(168, 85, 247, 0.05));
      border: 1px dashed var(--primary);
      border-radius: 0.75rem;
      padding: 1.5rem;
    }

    /* Pricing rules editor table */
    .pricing-rules-table td input {
      width: 100%;
      padding: 0.4rem 0.6rem;
      border: 1px solid var(--border-color);
      border-radius: 0.35rem;
      font-size: 0.85rem;
      background: var(--bg-secondary);
      color: var(--text-primary);
    }
    .pricing-rules-table td input:focus {
      outline: none;
      border-color: var(--primary);
      box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    }

    /* Identity badge — privacy ID chips */
    .identity-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      padding: 0.15rem 0.5rem;
      border-radius: 0.35rem;
      font-size: 0.72rem;
      font-weight: 700;
      font-family: 'JetBrains Mono', monospace;
      background: var(--bg-tertiary);
      color: var(--text-secondary);
      border: 1px solid var(--border-color);
    }
    .identity-badge.writer-id {
      background: rgba(99, 102, 241, 0.1);
      color: var(--primary);
      border-color: var(--primary);
    }
    .identity-badge.client-id {
      background: rgba(217, 119, 6, 0.1);
      color: var(--accent);
      border-color: var(--accent);
    }

    /* =====================================================
       v3 — Message Center Two-Category Layout
       ===================================================== */
    .msg-category-tabs {
      display: flex;
      gap: 0.5rem;
      margin-bottom: 1.5rem;
      border-bottom: 1px solid var(--border-color);
      padding-bottom: 0;
    }
    .msg-category-tab {
      padding: 0.75rem 1.25rem;
      background: none;
      border: none;
      border-bottom: 2px solid transparent;
      cursor: pointer;
      font-weight: 600;
      font-size: 0.95rem;
      color: var(--text-secondary);
      transition: all 0.2s;
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      margin-bottom: -1px;
    }
    .msg-category-tab:hover { color: var(--primary); }
    .msg-category-tab.active {
      color: var(--primary);
      border-bottom-color: var(--primary);
    }
    .msg-category-panel { display: none; }
    .msg-category-panel.active { display: block; }

    /* Order/Sender list rows — similar to data-table but optimized for messages */
    .msg-list {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }
    .msg-list-row {
      display: flex;
      align-items: center;
      gap: 1rem;
      padding: 1rem 1.25rem;
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: 0.6rem;
      cursor: pointer;
      transition: all 0.18s ease;
      text-decoration: none;
      color: inherit;
    }
    .msg-list-row:hover {
      border-color: var(--primary);
      box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
      transform: translateY(-1px);
    }
    .msg-list-row.has-unread {
      border-left: 3px solid var(--danger);
    }
    .msg-list-row.has-unread .msg-list-title,
    .msg-list-row.has-unread .msg-list-meta {
      font-weight: 700;
      color: var(--text-primary);
    }
    .msg-list-row.opened .msg-list-title,
    .msg-list-row.opened .msg-list-meta {
      font-weight: 400;
      color: var(--text-secondary);
    }
    .msg-list-icon {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: var(--primary-light);
      color: var(--primary);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1rem;
      flex-shrink: 0;
    }
    .msg-list-row.has-unread .msg-list-icon {
      background: var(--danger-light);
      color: var(--danger);
    }
    .msg-list-body { flex-grow: 1; min-width: 0; }
    .msg-list-title {
      font-size: 0.95rem;
      font-weight: 600;
      color: var(--text-primary);
      display: flex;
      align-items: center;
      gap: 0.5rem;
      flex-wrap: wrap;
    }
    .msg-list-preview {
      font-size: 0.8rem;
      color: var(--text-muted);
      margin-top: 0.2rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .msg-list-meta {
      font-size: 0.72rem;
      color: var(--text-muted);
      margin-top: 0.2rem;
    }
    .msg-list-unread-pill {
      min-width: 24px;
      height: 24px;
      padding: 0 8px;
      border-radius: 9999px;
      background: var(--danger);
      color: #fff;
      font-size: 0.72rem;
      font-weight: 700;
      line-height: 24px;
      text-align: center;
      flex-shrink: 0;
      box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
      animation: badgePulse 1.8s ease-in-out infinite;
    }
    .msg-list-row.opened .msg-list-unread-pill {
      display: none;
    }
    .msg-list-time {
      font-size: 0.72rem;
      color: var(--text-muted);
      flex-shrink: 0;
      text-align: right;
      min-width: 90px;
    }

    /* =====================================================
       v3 — Order Detail: Merged Messaging + Activity Log Side Panel
       ===================================================== */
    .order-msg-activity-panel {
      display: flex;
      flex-direction: column;
      gap: 1rem;
      position: sticky;
      top: 90px;
      max-height: calc(100vh - 110px);
    }
    .order-msg-activity-tabs {
      display: flex;
      gap: 0.25rem;
      background: var(--bg-tertiary);
      padding: 0.25rem;
      border-radius: 0.5rem;
    }
    .order-msg-activity-tab {
      flex-grow: 1;
      padding: 0.5rem 0.75rem;
      background: none;
      border: none;
      border-radius: 0.35rem;
      cursor: pointer;
      font-weight: 600;
      font-size: 0.8rem;
      color: var(--text-secondary);
      transition: all 0.2s;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.35rem;
      position: relative;
    }
    .order-msg-activity-tab.active {
      background: var(--bg-secondary);
      color: var(--primary);
      box-shadow: var(--card-shadow);
    }
    .order-msg-activity-tab .tab-badge {
      min-width: 18px;
      height: 18px;
      padding: 0 5px;
      border-radius: 9999px;
      background: var(--danger);
      color: #fff;
      font-size: 0.65rem;
      font-weight: 700;
      line-height: 18px;
      text-align: center;
    }
    .order-msg-activity-tab.active .tab-badge {
      background: var(--primary);
    }
    .order-msg-activity-content {
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: 0.6rem;
      display: flex;
      flex-direction: column;
      max-height: 600px;
      overflow: hidden;
    }
    .order-msg-activity-pane {
      display: none;
      flex-direction: column;
      flex-grow: 1;
      min-height: 0;
    }
    .order-msg-activity-pane.active {
      display: flex;
    }
    .order-msg-activity-pane .chat-messages {
      flex-grow: 1;
      max-height: 460px;
      overflow-y: auto;
      padding: 1rem;
      display: flex;
      flex-direction: column;
      gap: 0.85rem;
      background: var(--bg-primary);
      border: none;
      border-bottom: 1px solid var(--border-color);
      border-radius: 0;
    }
    .order-activity-log-list {
      flex-grow: 1;
      max-height: 580px;
      overflow-y: auto;
      padding: 1rem;
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }
    .order-activity-log-list .activity-item {
      border-left: 2px solid var(--primary);
      padding-left: 0.65rem;
      padding-bottom: 0.5rem;
      border-bottom: none;
    }
    .order-msg-compose {
      padding: 0.75rem;
      border-top: 1px solid var(--border-color);
      background: var(--bg-secondary);
    }
    .order-msg-compose textarea {
      width: 100%;
      min-height: 60px;
      padding: 0.5rem 0.65rem;
      border: 1px solid var(--border-color);
      border-radius: 0.35rem;
      background: var(--bg-primary);
      color: var(--text-primary);
      font-size: 0.85rem;
      resize: vertical;
      font-family: inherit;
    }
    .order-msg-compose textarea:focus {
      outline: none;
      border-color: var(--primary);
      box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
    }

    /* =====================================================
       v3 — Finished Orders View
       ===================================================== */
    .finished-order-card {
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-left: 4px solid var(--success);
      border-radius: 0.6rem;
      padding: 1.25rem 1.5rem;
      box-shadow: var(--card-shadow);
      margin-bottom: 1rem;
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }
    .finished-order-card.auto-closed {
      border-left-color: var(--text-muted);
    }
    .finished-order-card.disputed {
      border-left-color: var(--danger);
    }
    /* v4 — Archived Orders (final resting place, read-only history) */
    .archived-order-card {
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-left: 4px solid var(--primary);
      border-radius: 0.6rem;
      padding: 1.25rem 1.5rem;
      box-shadow: var(--card-shadow);
      margin-bottom: 1rem;
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }
    .archived-order-card.auto-closed {
      border-left-color: var(--text-muted);
      opacity: 0.92;
    }
    .archived-order-card.disputed {
      border-left-color: var(--danger);
    }
    .finished-order-meta-row {
      display: flex;
      flex-wrap: wrap;
      gap: 1rem;
      font-size: 0.78rem;
      color: var(--text-muted);
    }
    .finished-order-meta-row strong { color: var(--text-secondary); }

    /* =====================================================
       v3 — Rating Privacy Toggle & Profile View
       ===================================================== */
    .rating-privacy-toggle {
      display: flex;
      align-items: center;
      gap: 0.65rem;
      padding: 0.75rem 1rem;
      background: var(--bg-tertiary);
      border-radius: 0.4rem;
      margin-top: 1rem;
      cursor: pointer;
      font-size: 0.85rem;
    }
    .rating-privacy-toggle input[type="checkbox"] {
      width: 16px;
      height: 16px;
      cursor: pointer;
      accent-color: var(--primary);
    }
    .profile-modal-stat {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.25rem;
      padding: 1rem;
      background: var(--bg-tertiary);
      border-radius: 0.5rem;
    }
    .profile-modal-stat .stat-value {
      font-size: 1.4rem;
      font-weight: 700;
      color: var(--primary);
    }
    .profile-modal-stat .stat-label {
      font-size: 0.72rem;
      color: var(--text-muted);
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.4px;
    }
    .profile-feedback-item {
      padding: 0.85rem 1rem;
      background: var(--bg-primary);
      border: 1px solid var(--border-color);
      border-left: 3px solid #f5a623;
      border-radius: 0.4rem;
      font-size: 0.85rem;
      margin-bottom: 0.65rem;
    }
    .profile-feedback-item.private-feedback {
      border-left-color: var(--text-muted);
      font-style: italic;
      color: var(--text-muted);
    }

    /* =====================================================
       v3 — QC Overview (Admin) cards
       ===================================================== */
    .qc-overview-editor-card {
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: 0.6rem;
      padding: 1.25rem 1.5rem;
      box-shadow: var(--card-shadow);
      margin-bottom: 1rem;
      display: grid;
      grid-template-columns: 2fr 1fr 1fr 1fr;
      gap: 1rem;
      align-items: center;
    }
    .qc-overview-decision-row {
      display: grid;
      grid-template-columns: 80px 1fr 120px 120px 1fr;
      gap: 0.75rem;
      padding: 0.65rem 1rem;
      border-bottom: 1px solid var(--border-color);
      font-size: 0.82rem;
      align-items: center;
    }
    .qc-overview-decision-row:last-child { border-bottom: none; }

    /* Sticky right panel layout for order details (v3) */
    .order-detail-layout-v3 {
      display: grid;
      grid-template-columns: 1.6fr 1fr;
      gap: 1.5rem;
      align-items: start;
    }
    @media (max-width: 1024px) {
      .order-detail-layout-v3 { grid-template-columns: 1fr; }
      .order-msg-activity-panel { position: static; max-height: none; }
      .qc-overview-editor-card { grid-template-columns: 1fr; }
      .qc-overview-decision-row { grid-template-columns: 1fr; gap: 0.25rem; }
    }

    /* === v4: Scrollable side panels — contents scroll when they overflow the viewport === */
    /* The portal sidebar itself: logo + scrollable menu + role switcher */
    .portal-sidebar {
      overflow: hidden;
    }
    .portal-sidebar .portal-menu {
      overflow-y: auto;
    }
    /* The right-side activity log panel: header + scrollable content */
    .portal-activity-log-panel {
      overflow: hidden;
    }
    .portal-activity-log-panel .activity-log-content {
      overflow-y: auto;
      min-height: 0;
      flex: 1 1 auto;
      scrollbar-width: thin;
      scrollbar-color: var(--text-muted) transparent;
    }
    .portal-activity-log-panel .activity-log-content::-webkit-scrollbar { width: 6px; }
    .portal-activity-log-panel .activity-log-content::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
    /* The order detail side panel (messages + activity log): ensure inner panes scroll */
    .order-msg-activity-content {
      max-height: calc(100vh - 200px) !important;
      overflow: hidden;
    }
    .order-msg-activity-pane {
      overflow: hidden;
      min-height: 0;
    }
    .order-msg-activity-pane .chat-messages {
      overflow-y: auto !important;
      min-height: 0;
      flex: 1 1 auto;
      scrollbar-width: thin;
      scrollbar-color: var(--text-muted) transparent;
    }
    .order-msg-activity-pane .chat-messages::-webkit-scrollbar { width: 6px; }
    .order-msg-activity-pane .chat-messages::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
    .order-activity-log-list {
      overflow-y: auto !important;
      min-height: 0;
      flex: 1 1 auto;
      scrollbar-width: thin;
      scrollbar-color: var(--text-muted) transparent;
    }
    .order-activity-log-list::-webkit-scrollbar { width: 6px; }
    .order-activity-log-list::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
    /* Message center aside: make it sticky and scrollable */
    .order-detail-layout > aside {
      max-height: calc(100vh - 140px);
      overflow-y: auto;
      position: sticky;
      top: 90px;
      scrollbar-width: thin;
      scrollbar-color: var(--text-muted) transparent;
      padding-right: 0.25rem;
    }
    .order-detail-layout > aside::-webkit-scrollbar { width: 6px; }
    .order-detail-layout > aside::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
    .order-detail-layout > aside > .order-card-panel {
      margin-bottom: 1rem;
    }
    /* Portal viewport: allow internal scroll for long content */
    .portal-viewport {
      overflow-x: hidden;
    }
  /* ============================================================
     v6 — IN-APP NOTIFICATION SYSTEM (toast + confirm + prompt)
     Replaces all native huaAlert() / huaConfirm() / huaPrompt() calls.
     ============================================================ */
  .hua-toast-stack {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: 380px;
    pointer-events: none;
  }
  .hua-toast {
    pointer-events: auto;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    border-radius: 0.55rem;
    box-shadow: 0 12px 28px -8px rgba(0,0,0,0.25), 0 4px 8px -4px rgba(0,0,0,0.15);
    padding: 0.85rem 1rem 0.85rem 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.88rem;
    line-height: 1.4;
    min-width: 280px;
    animation: hua-toast-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
    word-wrap: break-word;
  }
  .hua-toast.hua-toast-leaving { animation: hua-toast-out 0.22s ease-in both; }
  .hua-toast.hua-toast-success { border-left-color: var(--success); }
  .hua-toast.hua-toast-error   { border-left-color: var(--danger);  }
  .hua-toast.hua-toast-warning { border-left-color: var(--accent);  }
  .hua-toast.hua-toast-info    { border-left-color: var(--primary); }
  .hua-toast-icon {
    flex-shrink: 0;
    width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: 0.78rem;
    color: #fff;
    margin-top: 1px;
  }
  .hua-toast-success .hua-toast-icon { background: var(--success); }
  .hua-toast-error   .hua-toast-icon { background: var(--danger);  }
  .hua-toast-warning .hua-toast-icon { background: var(--accent);  }
  .hua-toast-info    .hua-toast-icon { background: var(--primary); }
  .hua-toast-body { flex-grow: 1; min-width: 0; }
  .hua-toast-title { font-weight: 700; font-size: 0.82rem; margin-bottom: 0.15rem; }
  .hua-toast-msg { color: var(--text-secondary); font-size: 0.82rem; white-space: pre-wrap; }
  .hua-toast-close {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0 0 0.25rem;
    flex-shrink: 0;
  }
  .hua-toast-close:hover { color: var(--text-primary); }
  @keyframes hua-toast-in {
    from { opacity: 0; transform: translateX(40px) scale(0.96); }
    to   { opacity: 1; transform: translateX(0)    scale(1);    }
  }
  @keyframes hua-toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
  }

  /* ============================================================
     v6 — DEADLINE EXTENSION APPROVE/REJECT BUTTON VISUAL FEEDBACK
     When Admin/Editor clicks Approve or Reject on a pending deadline
     extension request, the clicked button blurs + shows a spinner
     (so the user instantly sees the click was registered), then the
     success/danger flash plays before the view re-renders with the
     updated state. Prevents double-clicks and reassures the user
     that the approval went through.
     ============================================================ */
  .btn.hua-ext-pending {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
    filter: blur(0.4px);
    animation: hua-ext-pulse 0.9s ease-in-out infinite;
  }
  .btn.hua-ext-pending::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 13px; height: 13px;
    margin: -7px 0 0 -7px;
    border: 2px solid rgba(255,255,255,0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: hua-ext-spin 0.6s linear infinite;
  }
  .btn.hua-ext-pending > * { visibility: hidden; }
  .btn.hua-ext-pending > i { visibility: hidden; }
  @keyframes hua-ext-pulse {
    0%, 100% { opacity: 0.7; }
    50%      { opacity: 0.92; }
  }
  @keyframes hua-ext-spin {
    to { transform: rotate(360deg); }
  }
  .btn.hua-ext-approved-flash {
    animation: hua-ext-flash-success 0.55s ease-out both;
  }
  .btn.hua-ext-rejected-flash {
    animation: hua-ext-flash-danger 0.55s ease-out both;
  }
  @keyframes hua-ext-flash-success {
    0%   { background-color: var(--success); transform: scale(1);    box-shadow: 0 0 0 0 rgba(16,185,129,0.0); }
    40%  { background-color: #34d399;        transform: scale(1.06); box-shadow: 0 0 0 8px rgba(16,185,129,0.22); }
    100% { background-color: var(--success); transform: scale(1);    box-shadow: 0 0 0 0 rgba(16,185,129,0.0); }
  }
  @keyframes hua-ext-flash-danger {
    0%   { background-color: var(--danger);  transform: scale(1);    box-shadow: 0 0 0 0 rgba(239,68,68,0.0); }
    40%  { background-color: #f87171;        transform: scale(1.06); box-shadow: 0 0 0 8px rgba(239,68,68,0.22); }
    100% { background-color: var(--danger);  transform: scale(1);    box-shadow: 0 0 0 0 rgba(239,68,68,0.0); }
  }
  /* Small status chip used to replace the action buttons after a
     decision has been applied, so the row remains visible (without
     the buttons) until the full re-render completes. */
  .hua-ext-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    border-radius: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
  }
  .hua-ext-status-chip.approved { background: var(--success); }
  .hua-ext-status-chip.rejected { background: var(--danger); }

  /* In-app confirm modal */
  .hua-confirm-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    z-index: 100001;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    animation: hua-fade-in 0.18s ease-out both;
  }
  .hua-confirm-card {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.7rem;
    box-shadow: 0 24px 60px -12px rgba(0,0,0,0.4);
    width: 100%; max-width: 440px;
    overflow: hidden;
    animation: hua-pop-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
  }
  .hua-confirm-header {
    padding: 1.1rem 1.25rem 0.5rem;
    display: flex; align-items: center; gap: 0.6rem;
  }
  .hua-confirm-header h3 {
    font-size: 1.05rem; font-weight: 700; margin: 0;
  }
  .hua-confirm-icon {
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    color: #fff; font-size: 0.85rem;
    background: var(--accent);
    flex-shrink: 0;
  }
  .hua-confirm-body {
    padding: 0.25rem 1.25rem 1.1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
  }
  .hua-confirm-actions {
    padding: 0.85rem 1.25rem;
    background: var(--bg-tertiary);
    display: flex; justify-content: flex-end; gap: 0.6rem;
  }
  @keyframes hua-fade-in { from { opacity: 0; } to { opacity: 1; } }
  @keyframes hua-pop-in {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
  }

  /* In-app prompt modal */
  .hua-prompt-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.4rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    margin-top: 0.6rem;
    box-sizing: border-box;
  }
  .hua-prompt-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
  }

    /* ====== v7 LANGUAGE SWITCHER + AUTH UI ====== */
    .lang-switcher {
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      background: var(--bg-tertiary);
      border: 1px solid var(--border-color);
      border-radius: 9999px;
      padding: 0.2rem;
    }
    .lang-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      background: transparent;
      color: var(--text-secondary);
      border: none;
      padding: 0.3rem 0.7rem;
      font-size: 0.78rem;
      font-weight: 600;
      border-radius: 9999px;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .lang-btn:hover { color: var(--primary); }
    .lang-btn.active {
      background: var(--primary);
      color: #ffffff;
    }
    .lang-btn i { font-size: 0.7rem; }

    .nav-user-chip {
      display: inline-flex;
      align-items: center;
      gap: 0.4rem;
      background: var(--primary-light);
      color: var(--primary);
      padding: 0.35rem 0.8rem;
      border-radius: 9999px;
      font-size: 0.8rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .nav-user-chip:hover { background: var(--primary); color: #ffffff; }
    .nav-user-chip .chip-avatar {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: var(--primary);
      color: #ffffff;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 0.7rem;
      font-weight: 700;
    }

    .auth-modal-body { padding: 1.5rem; }
    .auth-modal-body .form-group { margin-bottom: 1rem; }
    .auth-modal-body .form-group label {
      display: block;
      font-size: 0.85rem;
      font-weight: 600;
      margin-bottom: 0.35rem;
      color: var(--text-primary);
    }
    .auth-notice {
      background: var(--primary-light);
      color: var(--primary);
      padding: 0.75rem 1rem;
      border-radius: 0.5rem;
      font-size: 0.8rem;
      margin: 1rem 0;
      border-left: 3px solid var(--primary);
    }
    .auth-switch-link {
      display: block;
      text-align: center;
      margin-top: 1rem;
      font-size: 0.85rem;
      color: var(--primary);
      cursor: pointer;
      font-weight: 600;
    }
    .auth-switch-link:hover { text-decoration: underline; }

    .role-gate-banner {
      background: var(--accent-light);
      color: var(--accent);
      padding: 0.75rem 1rem;
      border-radius: 0.5rem;
      font-size: 0.82rem;
      margin: 1rem 0;
      border-left: 3px solid var(--accent);
    }

    .empty-state-card {
      text-align: center;
      padding: 3rem 1.5rem;
      background: var(--bg-secondary);
      border: 1px dashed var(--border-color);
      border-radius: 0.75rem;
      color: var(--text-muted);
    }
    .empty-state-card i {
      font-size: 2.5rem;
      margin-bottom: 1rem;
      display: block;
      color: var(--text-muted);
    }
    .empty-state-card h4 {
      font-size: 1.05rem;
      color: var(--text-secondary);
      margin-bottom: 0.5rem;
    }
    .empty-state-card p {
      font-size: 0.85rem;
      max-width: 480px;
      margin: 0 auto;
      line-height: 1.55;
    }

    [data-i18n-hidden] { display: none !important; }
  