/* ============================================================
   PSEUDOCODE TO PYTHON — AUTOMATED CODE GENERATION SYSTEM
   Design System — Bold, Clean, Dark Theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ── CSS Variables ── */
:root {
  /* Light Theme (Default) */
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-input: #ffffff;
  --bg-code: #f1f5f9;

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --accent-subtle: rgba(59, 130, 246, 0.05);

  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.15);
  --error: #ef4444;
  --error-glow: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.15);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-accent: #2563eb;

  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-accent: rgba(59, 130, 246, 0.2);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px var(--accent-glow);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.25s;
}

[data-theme='dark'] {
  --bg-primary: #06060b;
  --bg-secondary: #0d0d14;
  --bg-card: #111119;
  --bg-card-hover: #16161f;
  --bg-elevated: #1a1a25;
  --bg-input: #0e0e16;
  --bg-code: #0a0a12;

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --accent-subtle: rgba(59, 130, 246, 0.08);

  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.25);
  --error: #ef4444;
  --error-glow: rgba(239, 68, 68, 0.25);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.25);

  --text-primary: #f0f0f5;
  --text-secondary: #8b8ba0;
  --text-muted: #55556a;
  --text-accent: #60a5fa;

  --border: #1e1e2e;
  --border-hover: #2a2a3e;
  --border-accent: rgba(59, 130, 246, 0.3);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* ── Reset ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
/* ── Utility ── */
.hidden {
  display: none !important;
}

/* ── Typography ── */
h1,
h2,
h3,
h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.125rem;
}

h4 {
  font-size: 1rem;
}

/* ── Utility ── */
.hidden {
  display: none !important;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* ============================================================
   LOGIN PAGE — Split Layout
   ============================================================ */

.login-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  overflow: hidden;
}

/* ── Left Hero Panel ── */
.login-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #080818 0%, #0d1530 40%, #0a1628 100%);
  overflow: hidden;
  padding: 3rem;
}

.hero-bg-shapes {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
}

.hero-shape-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.35), transparent 70%);
  top: -10%;
  left: -10%;
  animation: shapeFloat1 14s ease-in-out infinite alternate;
}

.hero-shape-2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.3), transparent 70%);
  bottom: 10%;
  right: -5%;
  animation: shapeFloat2 12s ease-in-out infinite alternate;
}

.hero-shape-3 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.2), transparent 70%);
  top: 50%;
  left: 40%;
  animation: shapeFloat3 16s ease-in-out infinite alternate;
}

@keyframes shapeFloat1 {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(30px, 40px) scale(1.15);
  }
}

@keyframes shapeFloat2 {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(-20px, -30px) scale(1.1);
  }
}

@keyframes shapeFloat3 {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(15px, -20px) scale(1.2);
  }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 500px;
}

.hero-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.hero-logo .logo-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
}

.hero-logo .logo-text {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.hero-tagline {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.hero-highlight {
  background: linear-gradient(135deg, #60a5fa, #a78bfa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 380px;
  margin-bottom: 2.5rem;
}

/* ── Decorative Code Card ── */
.hero-code-card {
  background: rgba(10, 10, 18, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(59, 130, 246, 0.06);
  max-width: 340px;
  animation: cardFloat 6s ease-in-out infinite;
}

@keyframes cardFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.code-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.6rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.code-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.code-dot.red {
  background: #ff5f57;
}

.code-dot.yellow {
  background: #febc2e;
}

.code-dot.green {
  background: #28c840;
}

.code-card-title {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.code-card-body {
  padding: 1rem 1.1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.75;
  color: #a0a0b8;
  margin: 0;
  white-space: pre;
}

.code-kw {
  color: #c084fc;
}

.code-fn {
  color: #60a5fa;
}

.code-str {
  color: #34d399;
}

/* ── Right Form Panel ── */
.login-form-section {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: var(--bg-primary);
  position: relative;
}

.login-form-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(to bottom, transparent, var(--border), transparent);
}

.login-card {
  width: 100%;
  max-width: 420px;
}

.login-card-header {
  margin-bottom: 2rem;
}

.login-card-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
}

.login-card-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ── Form Elements ── */
.form-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.form-input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.role-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.role-option {
  position: relative;
}

.role-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.role-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem 0.75rem;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  text-transform: none;
  letter-spacing: 0;
}

.role-option label .role-icon {
  font-size: 1.75rem;
}

.role-option label .role-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.role-option input:checked+label {
  border-color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: 0 0 20px var(--accent-glow);
}

.role-option input:checked+label .role-name {
  color: var(--text-accent);
}

.role-option label:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.login-footer-text {
  text-align: center;
  margin-top: 1.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Login Responsive ── */
@media (max-width: 1024px) {
  .hero-tagline {
    font-size: 2.75rem;
  }

  .login-hero {
    padding: 2rem;
  }
}

@media (max-width: 768px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-hero {
    display: none;
  }

  .login-form-section {
    min-height: 100vh;
    padding: 2rem 1.5rem;
  }

  .login-form-section::before {
    display: none;
  }

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

@media (max-width: 380px) {
  .role-selector {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .role-option label {
    flex-direction: row;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  outline: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: #fff;
  padding: 0.65rem;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 25px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

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

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

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
  box-shadow: 0 4px 15px var(--success-glow);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 25px var(--success-glow);
}

.btn-danger {
  background: linear-gradient(135deg, var(--error), #dc2626);
  color: #fff;
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 25px var(--error-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.5rem 0.75rem;
}

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

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-sm);
}

svg.lucide {
  width: 1.1em;
  height: 1.1em;
  display: inline-block;
  flex: 0 0 auto;
  vertical-align: middle;
}

.btn,
.login-hint-header > span,
.hint-badge,
.login-hint-tip,
.login-card-header h2 {
  align-items: center;
}

svg.lucide {
  width: 1.1em;
  height: 1.1em;
  flex: 0 0 auto;
  vertical-align: middle;
}

.login-hint-header > span,
.hint-badge,
.login-hint-tip,
.btn,
.login-card-header h2 {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* ============================================================
   APP LAYOUT (Post-login)
   ============================================================ */

.app-layout {
  display: grid;
  grid-template-columns: clamp(160px, 18vw, 220px) 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

/* ── Sidebar ── */
.sidebar {
  grid-row: 1 / -1;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

.sidebar-header {
  padding: 0 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.sidebar-header .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-header .brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-header .brand-text h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-header .brand-text span {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-nav {
  flex: 1;
  padding: 0 0.5rem;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.75rem 0.75rem 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  font-size: 0.8rem;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover {
  background: var(--accent-subtle);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-subtle);
  color: var(--text-accent);
  font-weight: 600;
}

.nav-item .nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item .nav-icon svg.lucide,
.sidebar-header .brand-icon svg.lucide {
  width: 18px;
  height: 18px;
  display: block;
  margin: 0 auto;
}

.sidebar-footer {
  padding: 0.75rem 0.75rem 0;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.user-avatar {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.user-details .user-name {
  font-size: 0.8rem;
  font-weight: 600;
}

.user-details .user-role {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

/* ── Top Bar ── */
.topbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Main Content ── */
.main-content {
  padding: 1rem;
  overflow-y: auto;
  background: var(--bg-primary);
  min-width: 0;
}

/* ============================================================
   STUDENT DASHBOARD — PSEUDOCODE EDITOR
   ============================================================ */

.editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  height: calc(100vh - 120px);
}

.editor-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.85rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  min-height: 40px;
}

.panel-header h3 {
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.panel-header .lang-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lang-badge.pseudo {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.lang-badge.python {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.code-editor {
  flex: 1;
  width: 100%;
  resize: none;
  border: none;
  outline: none;
  padding: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-code);
  tab-size: 4;
}

.code-editor::placeholder {
  color: var(--text-muted);
}

.code-editor:read-only {
  color: var(--text-secondary);
  cursor: default;
}

.panel-footer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ── Action Bar (Translate / Execute) ── */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 0;
}

.action-bar .btn {
  padding: 0.65rem 1.5rem;
}

/* ── Output Panel ── */
.output-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.output-content {
  padding: 1.25rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.825rem;
  line-height: 1.7;
  min-height: 120px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-code);
  white-space: pre-wrap;
  color: var(--success);
}

.output-content.error {
  color: var(--error);
}


/* ── Validation Error Panel ── */
.validation-error-panel {
  max-height: 140px;
  overflow-y: auto;
  background: rgba(239, 68, 68, 0.06);
  border-top: 1px solid rgba(239, 68, 68, 0.2);
  padding: 0.5rem 0.75rem;
}

.validation-error-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.3rem 0;
  font-size: 0.75rem;
  border-bottom: 1px solid rgba(239, 68, 68, 0.1);
}

.validation-error-item:last-child {
  border-bottom: none;
}

.error-line-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--error);
  background: rgba(239, 68, 68, 0.12);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  flex-shrink: 0;
}

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

.error-suggestion {
  color: var(--warning);
  font-size: 0.7rem;
  width: 100%;
  padding-left: 0.25rem;
}

/* Editor error state */
.code-editor.has-errors {
  border-left: 3px solid var(--error);
  box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.05);
}

/* ── Sample Dropdown ── */
.sample-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  min-width: 220px;
  padding: 0.35rem;
  margin-bottom: 0.35rem;
}

.sample-dropdown button {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.sample-dropdown button:hover {
  background: var(--accent-subtle);
  color: var(--text-accent);
}

/* ── Disabled Run Button ── */
.btn-success:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.skulpt-input-container {
  margin: 0.75rem 0 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  animation: fadeInInput 0.25s ease;
}

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

.skulpt-input-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-accent);
  margin-bottom: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
}

.skulpt-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.skulpt-input-field {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.skulpt-input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.skulpt-input-field::placeholder {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.skulpt-input-btn {
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.skulpt-input-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.skulpt-input-echo {
  padding: 0.25rem 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.825rem;
  line-height: 1.6;
}

.skulpt-echo-prompt {
  color: var(--text-secondary);
}

.skulpt-echo-value {
  color: #22d3ee;
  font-weight: 600;
}

/* ── Feedback Panel ── */
.feedback-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 1.5rem;
}

.feedback-list {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
}

.feedback-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border-left: 3px solid var(--accent);
  font-size: 0.85rem;
}

.feedback-item.success {
  border-left-color: var(--success);
}

.feedback-item.warning {
  border-left-color: var(--warning);
}

.feedback-item.error {
  border-left-color: var(--error);
}

.feedback-item .fb-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.feedback-item .fb-text {
  color: var(--text-secondary);
  line-height: 1.5;
}

.feedback-item .fb-text strong {
  color: var(--text-primary);
}

/* ============================================================
   FULL-WIDTH PAGES (Exercises, Analytics, Admin)
   ============================================================ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* ── Stats Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  transition: all var(--duration) var(--ease);
}

.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.stat-card .stat-icon svg.lucide {
  width: 28px;
  height: 28px;
  display: block;
}

.stat-icon-total { color: var(--accent); }
.stat-icon-active,
.stat-icon-easy { color: var(--success); }
.stat-icon-inactive,
.stat-icon-hard { color: var(--error); }
.stat-icon-moderate { color: var(--warning); }

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

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

.stat-card .stat-change {
  font-size: 0.75rem;
  margin-top: 0.5rem;
  font-weight: 600;
}

.stat-card .stat-change.positive {
  color: var(--success);
}

.stat-card .stat-change.negative {
  color: var(--error);
}

/* ── Data Table ── */
.data-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.data-table thead {
  background: var(--bg-elevated);
}

.data-table th {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.85rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

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

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

.data-table tr:hover td {
  background: var(--bg-card-hover);
}

.data-table .user-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.data-table .user-cell .avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-student {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
}

.badge-instructor {
  background: rgba(139, 92, 246, 0.12);
  color: #a78bfa;
}

.badge-admin {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}

.badge-active {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}

.badge-inactive {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.badge-archived {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ── Chart Placeholder ── */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chart-body {
  padding: 1.5rem;
  min-height: 280px;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.chart-bar {
  flex: 1;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  min-height: 20px;
  transition: all var(--duration) var(--ease);
  position: relative;
  cursor: pointer;
}

.chart-bar:hover {
  opacity: 0.8;
}

.chart-bar .bar-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.chart-bar .bar-value {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* ── Student Exercises & Tasks ── */
.student-guidelines-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.guidelines-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.guidelines-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.guidelines-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.guidelines-icon-box svg.lucide,
.ex-date-row svg.lucide,
.ex-completed-badge svg.lucide,
.ex-start-btn svg.lucide,
.panel-header h3 svg.lucide,
.panel-footer .btn svg.lucide,
#topbar-progress-pill svg.lucide {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  vertical-align: middle;
}

.ex-completed-badge.active {
  color: var(--success);
}

.ex-start-btn.inactive {
  color: #fff;
}

.account-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.account-status svg.lucide {
  width: 0.75em;
  height: 0.75em;
  fill: currentColor;
}

.account-status.is-active {
  color: var(--success);
}

.account-status.is-inactive {
  color: var(--error);
}

.guidelines-title h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.guidelines-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.guidelines-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.guidelines-body {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.guidelines-body.collapsed {
  display: none;
}

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

.guidelines-col {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.guidelines-col li {
  margin-bottom: 0.4rem;
}

/* ── Exercise Cards Grid ── */
.exercises-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.exercise-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.exercise-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.ex-card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.ex-icon-box {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  font-weight: 800;
  font-size: 1.2rem;
}

.ex-icon-box svg {
  width: 24px;
  height: 24px;
}

.ex-header-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ex-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

.ex-title {
  font-size: 1.025rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0;
  word-break: break-word;
}

.ex-difficulty {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
  align-self: flex-start;
  flex-shrink: 0;
}

.ex-difficulty.easy {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.ex-difficulty.moderate {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.ex-difficulty.hard {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.ex-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0 0 1rem 0;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ex-date-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.ex-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 0 0 0.85rem 0;
}

.ex-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.ex-start-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.48rem;
  background: #3b82f6;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.ex-start-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.45);
}

.ex-completed-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ── Pagination Wrapper ── */
.pagination-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
  gap: 1rem;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled):not(.active) {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.page-btn.active {
  background: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-ellipsis {
  min-width: 24px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
  animation: fadeIn 0.2s var(--ease);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.3s var(--ease);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ── Side Drawer / Right Panel ── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1050;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.2s var(--ease);
}

.drawer-panel {
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  width: 100%;
  max-width: 380px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

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

.drawer-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.drawer-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.drawer-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.drawer-item-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.drawer-item-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  padding-left: 1.5rem;
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s var(--ease);
  font-size: 0.85rem;
  min-width: 280px;
}

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.error {
  border-left: 3px solid var(--error);
}

.toast.info {
  border-left: 3px solid var(--accent);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Hamburger Button (hidden on desktop) ── */
.hamburger-btn {
  display: none;
  font-size: 1.25rem;
}

.hamburger-icon {
  font-size: 1.25rem;
  line-height: 1;
}

/* ── Sidebar Overlay (mobile) ── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  animation: fadeIn 0.2s var(--ease) forwards;
}

/* ── Responsive Grid Breakpoints ── */
@media (max-width: 1200px) {
  .exercises-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

@media (max-width: 640px) {
  .exercises-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
  .guidelines-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .student-ex-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 1rem;
  }
  .student-progress-box {
    width: 100%;
  }
  .progress-bar-bg {
    width: 100% !important;
  }
  .pagination-wrapper {
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
  }
}

/* ============================================================
   RESPONSIVE — Tablet (≤ 576px)
   ============================================================ */

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

  /* Sidebar becomes slide-out drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease);
    box-shadow: none;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
  }

  .hamburger-btn {
    display: flex;
  }

  .editor-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .editor-panel {
    min-height: 300px;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding: 1rem;
  }

  .topbar {
    padding: 0.75rem 1rem;
  }

  /* Table horizontal scroll */
  .data-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 600px;
  }

  .modal-overlay {
    padding: 1rem;
    align-items: flex-end;
  }

  .modal {
    max-height: 90vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}

/* ============================================================
   RESPONSIVE — Phone (≤ 480px)
   ============================================================ */

@media (max-width: 480px) {
  html {
    font-size: 13px;
  }

  .login-page {
    padding: 1.25rem;
  }

  .login-logo .logo-icon {
    width: 64px;
    height: 64px;
    font-size: 1.75rem;
  }

  .login-logo h1 {
    font-size: 1.35rem;
  }

  .login-logo p {
    font-size: 0.8rem;
  }

  .login-card {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
  }

  .role-selector {
    gap: 0.5rem;
  }

  .role-option label {
    padding: 1rem 0.5rem;
  }

  .role-option label .role-icon {
    font-size: 1.5rem;
  }

  .role-option label .role-name {
    font-size: 0.7rem;
  }

  .main-content {
    padding: 1rem;
  }

  .topbar {
    padding: 0.6rem 0.85rem;
  }

  .topbar-title {
    font-size: 0.95rem;
  }

  .page-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
  }

  .page-header h2 {
    font-size: 1.2rem;
  }

  .page-header p {
    font-size: 0.8rem;
  }

  .page-header .btn {
    width: 100%;
  }

  .editor-panel {
    min-height: 250px;
  }

  .code-editor {
    font-size: 0.8rem;
    padding: 0.85rem;
    line-height: 1.6;
  }

  .panel-header {
    padding: 0.6rem 0.85rem;
    min-height: 42px;
  }

  .panel-header h3 {
    font-size: 0.78rem;
  }

  .panel-footer {
    padding: 0.6rem 0.85rem;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .panel-footer .btn {
    font-size: 0.78rem;
    padding: 0.5rem 0.85rem;
  }

  .output-content {
    font-size: 0.78rem;
    padding: 0.85rem;
    min-height: 80px;
    max-height: 300px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-card .stat-value {
    font-size: 1.35rem;
  }

  .stat-card .stat-label {
    font-size: 0.7rem;
  }

  .exercises-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .exercise-card {
    padding: 1rem;
  }

  .feedback-item {
    padding: 0.6rem 0.75rem;
    font-size: 0.8rem;
  }

  .chart-body {
    min-height: 200px;
    padding: 1rem;
  }

  .toast-container {
    top: auto;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
  }

  .toast {
    min-width: auto;
    width: 100%;
    font-size: 0.8rem;
  }

  .btn {
    font-size: 0.825rem;
  }

  .btn-primary {
    padding: 0.75rem;
    font-size: 0.875rem;
  }

  /* Ensure nav items are touch-friendly */
  .nav-item {
    padding: 0.85rem 0.75rem;
    font-size: 0.9rem;
    min-height: 44px;
  }
}

/* ============================================================
   RESPONSIVE — Small Phone (≤ 380px)
   ============================================================ */

@media (max-width: 380px) {
  html {
    font-size: 14px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .role-selector {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .role-option label {
    flex-direction: row;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }
}

/* ============================================================
   PWA — iOS Safe Areas & Standalone Mode
   ============================================================ */

/* iOS notch / home indicator safe areas */
@supports (padding: env(safe-area-inset-top)) {
  .topbar {
    padding-top: max(0.75rem, env(safe-area-inset-top));
  }

  .sidebar {
    padding-top: max(1.5rem, env(safe-area-inset-top));
    padding-bottom: max(0, env(safe-area-inset-bottom));
  }

  .main-content {
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }

  .login-page {
    padding-top: max(2rem, env(safe-area-inset-top));
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }

  .toast-container {
    top: max(1.5rem, env(safe-area-inset-top));
  }

  @media (max-width: 640px) {
    .toast-container {
      top: auto;
      bottom: max(1rem, env(safe-area-inset-bottom));
    }
  }
}

/* iOS standalone (installed PWA) */
body.ios-standalone {
  padding-top: 0;
}

/* Prevent text size adjustment on orientation change */
@media (orientation: landscape) and (max-height: 500px) {
  .editor-layout {
    grid-template-columns: 1fr 1fr;
  }

  .editor-panel {
    min-height: 200px;
  }
}

/* Touch-device optimizations */
@media (hover: none) and (pointer: coarse) {

  .stat-card:hover,
  .exercise-card:hover {
    transform: none;
    box-shadow: none;
  }

  .btn:hover {
    transform: none;
  }

  /* Active states for touch */
  .btn:active {
    transform: scale(0.97);
    opacity: 0.9;
  }

  .nav-item:active {
    background: var(--accent-subtle);
  }

  /* Make code editors more touch-friendly */
  .code-editor {
    -webkit-text-size-adjust: none;
  }
}

/* ── Loading spinner ── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state h3 {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.85rem;
  max-width: 360px;
  margin: 0 auto;
}

/* ── Student exercise view ── */
.exercise-attempt {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.exercise-attempt h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.exercise-attempt .instructions {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* ── Status indicator ── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 6px var(--success-glow);
}

.status-dot.offline {
  background: var(--text-muted);
}

/* ── Page transitions ── */
.page-view {
  animation: pageIn 0.3s var(--ease);
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Select input ── */
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2355556a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2.5rem;
}

/* ============================================================
   CHANGE PASSWORD PAGE
   ============================================================ */

.change-password-container {
  display: flex;
  justify-content: flex-start;
  margin-top: 1.5rem;
}

.change-password-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-sm);
}

.cp-requirements {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.pwd-masked {
  letter-spacing: 2px;
  color: var(--text-secondary);
}

/* ============================================================
   STUDENT SETTINGS — PROFILE & PASSWORD CHANGE
   ============================================================ */

/* ── Profile Card ── */
.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.profile-card-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.75rem 2rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(139, 92, 246, 0.08));
  border-bottom: 1px solid var(--border);
}

.profile-avatar {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.profile-info h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.profile-details {
  padding: 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.profile-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.profile-detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.detail-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Settings Sections ── */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}

.settings-section .section-header {
  margin-bottom: 1.25rem;
}

.settings-section .section-header h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.settings-section .section-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ── Cooldown Warning ── */
.cooldown-warning {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}

.cooldown-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.cooldown-warning strong {
  font-size: 0.9rem;
  color: #f59e0b;
  display: block;
  margin-bottom: 0.25rem;
}

.cooldown-warning p {
  font-size: 0.825rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Password Request Cards ── */
.request-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  transition: all var(--duration) var(--ease);
}

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

.request-card.pending {
  border-left-color: #f59e0b;
}

.request-card.approved {
  border-left-color: var(--success);
}

.request-card.rejected {
  border-left-color: var(--error);
}

.request-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.request-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.request-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

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

.request-approved-date {
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 500;
}

.request-rejected-note {
  font-size: 0.75rem;
  color: var(--error);
  font-style: italic;
}

/* ── Status Badges ── */
.badge-pending {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.badge-approved {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.badge-rejected {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

/* ── Nav Badge (Pending Count) ── */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 0.35rem;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  margin-left: auto;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
}

/* ── Disabled button style ── */
#submit-password-request-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ── Responsive Settings ── */
@media (max-width: 576px) {
  .profile-card-header {
    flex-direction: column;
    text-align: center;
    padding: 1.25rem;
  }

  .profile-details {
    padding: 1rem;
  }

  .profile-detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .settings-section {
    padding: 1.25rem;
  }

  .request-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
}

/* ============================================================
   EDITOR GUTTER & ERROR STYLING
   ============================================================ */

.editor-with-gutter {
  display: flex;
  height: 100%;
  border-radius: var(--radius-md);
  background: var(--bg-code);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}

.editor-with-gutter .code-editor {
  border: none;
  border-radius: 0;
  flex: 1;
  background: transparent;
  position: relative;
  z-index: 2;
}

.editor-highlights {
  position: absolute;
  top: 0;
  left: 40px; /* Aligns with editor-gutter width */
  right: 0;
  bottom: 0;
  padding: 0.85rem; /* Matches textarea padding exactly */
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: transparent;
  pointer-events: none;
  overflow: hidden;
  box-sizing: border-box;
  z-index: 1;
}

.highlight-line {
  min-height: 1.65em; /* Match line height */
  box-sizing: border-box;
}

.highlight-line.error-highlight-line {
  background: rgba(239, 68, 68, 0.08);
  border-bottom: 2px dashed rgba(239, 68, 68, 0.4);
}

@media (max-width: 480px) {
  .editor-highlights {
    font-size: 0.8rem;
    padding: 0.85rem;
    line-height: 1.6;
  }
  .highlight-line {
    min-height: 1.6em;
  }
}

.editor-gutter {
  width: 40px;
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid var(--border);
  padding: 0.8rem 0; /* Usually matches standard form-input padding */
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  text-align: right;
  overflow: hidden;
  user-select: none;
  flex-shrink: 0;
}

.gutter-num {
  padding-right: 8px;
  line-height: inherit;
  min-height: 1.5em; /* Fallback line-height */
}

.gutter-num.error-line {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-left: 3px solid var(--error);
  padding-right: 5px;
}

.error-text {
  color: var(--error);
}

.suggestion-text {
  color: var(--success);
}

.code-editor[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
}

/* ── Login Credentials Hint Box ── */
.login-hint-box {
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-secondary);
  transition: border-color var(--duration) var(--ease);
}
.login-hint-box:hover {
  border-color: var(--accent);
}
.login-hint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.login-hint-header:hover {
  background: var(--accent-subtle);
  color: var(--accent);
}
.login-hint-arrow {
  font-size: 1rem;
  transition: transform var(--duration) var(--ease);
}
.login-hint-box.open .login-hint-arrow {
  transform: rotate(180deg);
}
.login-hint-body {
  display: none;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border);
  animation: hintFadeIn 0.2s ease;
}
.login-hint-box.open .login-hint-body {
  display: block;
}
@keyframes hintFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-hint-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
  line-height: 1.5;
}
.login-hint-table {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.login-hint-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.9fr;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  transition: background var(--duration) var(--ease);
}
.login-hint-row.hint-row-2col {
  grid-template-columns: 1.6fr 1fr;
}
.login-hint-row:not(.login-hint-head):hover {
  background: var(--accent-subtle);
}
.login-hint-head {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: 'Inter', sans-serif;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  margin-bottom: 0.1rem;
}
.hint-username {
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  transition: color var(--duration) var(--ease);
}
.hint-username:hover {
  color: var(--accent-hover);
}
.hint-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.03em;
}
.hint-admin      { background: rgba(239, 68,  68,  0.15); color: #ef4444; }
.hint-instructor { background: rgba(245, 158, 11,  0.15); color: #f59e0b; }
.hint-student    { background: rgba(16,  185, 129, 0.15); color: #10b981; }
.login-hint-tip {
  margin-top: 0.6rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ════════════════════════════════════════════════════════════════════════
   LEARNING ANALYTICS (REFERENCE DASHBOARD DESIGN)
   ════════════════════════════════════════════════════════════════════════ */
.an-page-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.an-page-icon {
  font-size: 2rem;
}

.an-header-icon-box svg.lucide,
.an-filter-label svg.lucide,
.an-info-badge svg.lucide,
.an-chart-footer svg.lucide,
.an-kpi-icon-wrap svg.lucide,
.an-page-btn svg.lucide,
.an-tip-bar svg.lucide,
.an-modal-title svg.lucide {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  vertical-align: middle;
}

.an-header-icon-box,
.an-filter-label,
.an-info-badge,
.an-chart-footer,
.an-tip-bar,
.an-modal-title {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.an-kpi-icon-wrap svg.lucide {
  width: 24px;
  height: 24px;
}

.an-eye-btn svg.lucide {
  width: 15px;
  height: 15px;
}
.an-page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.an-page-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ── Filter Bar ── */
.an-filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.an-filter-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.an-filter-search {
  flex: 1;
  min-width: 220px;
}
.an-filter-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.an-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.85rem;
  padding: 0.45rem 0.75rem;
  outline: none;
  transition: all var(--duration) var(--ease);
  width: 100%;
}
.an-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.an-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.an-search-icon {
  position: absolute;
  left: 0.75rem;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.an-search-wrap .an-input {
  padding-left: 2.25rem;
}
.an-reset-btn {
  height: 38px;
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

/* ── KPI Cards Grid ── */
.an-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.an-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: transform var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.an-kpi-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
}
.an-kpi-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.an-kpi-icon-wrap svg {
  width: 24px;
  height: 24px;
  color: #ffffff;
}
.an-kpi-body {
  display: flex;
  flex-direction: column;
}
.an-kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}
.an-kpi-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}
.an-kpi-trend {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.an-kpi-trend.positive { color: #10b981; }
.an-kpi-trend.negative { color: #ef4444; }
.an-kpi-trend.neutral  { color: var(--text-muted); }

/* ── Charts Grid / Row ── */
.an-charts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.an-chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 320px;
}
.an-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.an-info-badge {
  color: var(--text-muted);
  cursor: help;
  font-size: 0.85rem;
}
.an-chart-footer {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--border);
}

/* ── Bar Chart Specifics ── */
.an-bar-chart-wrap {
  display: flex;
  height: 220px;
  gap: 0.75rem;
  align-items: flex-end;
  position: relative;
  margin-bottom: 0.5rem;
}
.an-bar-y-axis {
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  height: 180px;
  font-size: 0.68rem;
  color: var(--text-muted);
  padding-bottom: 22px;
  user-select: none;
  min-width: 20px;
}
.an-bar-chart-area {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 100%;
  gap: 0.5rem;
  position: relative;
}
.an-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  position: relative;
  cursor: pointer;
}
.an-bar-val {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  transition: color var(--duration);
}
.an-bar-inner {
  width: 70%;
  max-width: 44px;
  transform-origin: center bottom;
  background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s, opacity 0.2s;
  min-height: 4px;
}
.an-bar-col:hover .an-bar-inner {
  background: linear-gradient(180deg, #93c5fd 0%, #2563eb 100%);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}
.an-bar-col.highlighted .an-bar-inner {
  background: linear-gradient(180deg, #c084fc 0%, #7c3aed 100%);
}
.an-bar-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  white-space: nowrap;
  text-align: center;
  font-weight: 500;
}

/* ── Bar Tooltip ── */
.an-bar-tooltip {
  position: absolute;
  z-index: 100;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  min-width: 190px;
  font-size: 0.78rem;
  color: #e2e8f0;
  transition: opacity 0.15s ease;
}
.an-bar-tooltip.hidden { display: none; opacity: 0; }
.an-tt-header {
  font-weight: 700;
  color: #ffffff;
  border-bottom: 1px solid #334155;
  padding-bottom: 0.4rem;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
}
.an-tt-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}
.an-tt-students {
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px dashed #334155;
}
.an-tt-st-head {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.an-tt-st-list {
  color: #cbd5e1;
  line-height: 1.4;
  font-size: 0.72rem;
}

/* ── Donut Chart ── */
.an-donut-wrap {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 1.5rem;
  margin: auto 0;
  padding: 0.5rem 0;
}
.an-donut-chart {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.4);
}
.an-donut-center {
  width: 105px;
  height: 105px;
  background: var(--bg-card);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.an-donut-total-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.an-donut-total-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.an-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}
.an-donut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}
.an-donut-dot-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}
.an-donut-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.an-donut-val {
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Submission Table & Pagination ── */
.an-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.an-table-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.an-pagination-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
}
.an-page-info {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.an-page-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.an-page-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.an-page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.an-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.an-page-numbers {
  display: flex;
  gap: 0.25rem;
}
.an-page-num-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.an-page-num-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.an-tip-bar {
  padding: 0.75rem 1.5rem;
  background: rgba(59, 130, 246, 0.08);
  border-top: 1px solid rgba(59, 130, 246, 0.2);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ── Result Badges ── */
.badge-result-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-result-syntax {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge-result-logic {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-result-runtime {
  background: rgba(217, 119, 6, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(217, 119, 6, 0.3);
}
.badge-result-pending {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* ── Shared base for inline result/status/diff badges in analytics table ── */
.badge-result,
.badge-status,
.badge-diff {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ── Difficulty Badges ── */
.badge-easy {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.badge-moderate {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.badge-hard {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ── Analytics Status Badges ── */
.badge-completed {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.badge-failed {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.badge-status.badge-pending {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* ── Eye Action Button (Blue Rounded Rectangle) ── */
.an-eye-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  border-radius: 6px;
  border: none;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}
.an-eye-btn:hover {
  background: #1d4ed8;
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

/* ============================================================
   RESPONSIVE DESIGN SYSTEM — BREAKPOINTS & MOBILE OPTIMIZATIONS
   ============================================================ */

/* ── Hamburger Button (Hidden on Desktop) ── */
.hamburger-btn {
  display: none;
  width: 44px;
  height: 44px;
  font-size: 1.3rem;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  flex-shrink: 0;
}

/* ── Table Container Scoped Scroll ── */
.data-table-container,
.table-responsive,
.analytics-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  min-width: 600px;
}

/* ── Responsive Grid Helpers ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* ── Media Query: Large Desktop (1440px+) ── */
@media (min-width: 1440px) {
  .main-content {
    max-width: 1600px;
    margin: 0 auto;
  }
}

/* ── Media Query: Tablet & Mobile (< 1024px) ── */
@media (max-width: 1023px) {
  /* Layout Transformation */
  .app-layout {
    display: block;
    width: 100vw;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
  }

  /* Hamburger & Topbar */
  .hamburger-btn {
    display: inline-flex;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.6rem 0.85rem;
    padding-top: calc(0.6rem + env(safe-area-inset-top, 0px));
    width: 100%;
    box-sizing: border-box;
  }

  .topbar-title {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
  }

  .topbar-actions {
    gap: 0.4rem;
  }

  #topbar-user-info {
    max-width: 110px;
    overflow: hidden;
  }

  #topbar-welcome {
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }

  #topbar-role {
    font-size: 0.68rem;
  }

  #topbar-time {
    display: none;
  }

  /* Off-Canvas Sidebar Drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    padding-top: calc(1rem + env(safe-area-inset-top, 0px));
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1090;
  }

  /* Main Content Area */
  .main-content {
    padding: 0.85rem;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* Pseudocode & Editor Layout Stack */
  .editor-layout {
    grid-template-columns: 1fr;
    height: auto;
    gap: 1rem;
  }

  .editor-panel {
    min-height: 350px;
    height: auto;
  }

  .panel-footer {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .panel-footer .btn {
    flex: 1 1 auto;
    min-height: 40px;
  }

  /* Learning Analytics Charts & Filters */
  .analytics-charts-grid,
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  .analytics-filters-bar,
  #analytics-filters-wrap {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

/* ── Media Query: Mobile Devices (< 768px) ── */
@media (max-width: 767px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.0rem; }

  /* Touch targets minimum height */
  .btn, .nav-item, select, input, button {
    min-height: 42px;
  }

  /* Stats Cards Grid Stack */
  .stats-grid {
    grid-template-columns: 1fr;
  }

  /* Modals on Mobile */
  .modal {
    width: 95vw !important;
    max-width: 100% !important;
    max-height: 88vh !important;
    margin: 0 auto;
    border-radius: var(--radius-lg) !important;
  }

  .modal-footer {
    flex-direction: column;
    gap: 0.5rem;
  }

  .modal-footer .btn {
    width: 100% !important;
  }

  /* Active exercise header controls stack */
  #active-exercise-panel .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* Search & Filter Inputs Stack */
  .filter-input, select.form-input, input.form-input {
    width: 100% !important;
  }

  /* Mobile Submit Solution Button */
  #btn-submit-exercise, #btn-translate-pseudocode {
    width: 100% !important;
    justify-content: center;
  }
}

/* ── Media Query: Small Mobile (< 430px) ── */
@media (max-width: 429px) {
  .topbar-title {
    max-width: 130px;
    font-size: 0.88rem;
  }

  #topbar-welcome {
    display: none;
  }

  .modal-header h3 {
    font-size: 0.95rem;
  }

  .sidebar {
    width: 100vw;
    max-width: 100vw;
  }
}

/* ══════════════════════════════════════════════════════════════
   PASSWORD RECOVERY & SECURITY STYLES
   ══════════════════════════════════════════════════════════════ */

/* ── Recovery Status Badges ── */
.badge-recovery-pending {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #f59e0b !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
}

.badge-recovery-approved {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
}

.badge-recovery-rejected {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
}

.badge-recovery-completed {
  background: rgba(5, 150, 105, 0.15) !important;
  color: #34d399 !important;
  border: 1px solid rgba(5, 150, 105, 0.35) !important;
}

.badge-recovery-expired {
  background: rgba(107, 114, 128, 0.15) !important;
  color: #9ca3af !important;
  border: 1px solid rgba(107, 114, 128, 0.35) !important;
}

/* ── Recovery Review Modal Grid ── */
.recovery-info-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.recovery-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
}

.recovery-info-label {
  color: var(--text-muted);
  font-weight: 500;
}

.recovery-info-value {
  color: var(--text-primary);
  font-weight: 600;
}

.recovery-security-notice {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Forgot Password Flow Cards ── */
.fp-status-card {
  padding: 1.25rem;
  border-radius: var(--radius);
  text-align: center;
  margin-bottom: 1rem;
}

.fp-status-card .fp-status-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.fp-status-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.fp-status-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.fp-status-pending {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.fp-status-pending h3 {
  color: #f59e0b;
}

.fp-status-approved {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.fp-status-approved h3 {
  color: #10b981;
}

.fp-status-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.fp-status-success h3 {
  color: #10b981;
}

.fp-requirements {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  padding-left: 0.25rem;
}

/* ══════════════════════════════════════════════════════════════
   STUDENT NOTIFICATION SYSTEM STYLES
   ══════════════════════════════════════════════════════════════ */

.topbar-notifications {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-right: 0.25rem;
}

#notif-bell-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius, 8px);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

#notif-bell-btn:hover {
  background: var(--bg-card, #1e293b);
  border-color: var(--border, #334155);
}

.notif-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  background: linear-gradient(135deg, #ef4444, #a855f7);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 700;
  border-radius: 999px;
  min-width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  pointer-events: none;
  line-height: 1;
}

/* ── Notification Dropdown Panel ── */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 330px;
  max-width: calc(100vw - 24px);
  background: var(--bg-card, #0f172a);
  border: 1px solid var(--border, #334155);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  z-index: 10000;
  overflow: hidden;
  animation: notifFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes notifFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.notif-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary, #1e293b);
  border-bottom: 1px solid var(--border, #334155);
}

.notif-dropdown-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.notif-unread-count {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary, #3b82f6);
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
}

.notif-mark-all-btn {
  background: transparent;
  border: none;
  color: var(--accent, #38bdf8);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.notif-mark-all-btn:hover {
  background: rgba(56, 189, 248, 0.1);
  text-decoration: underline;
}

.notif-list {
  max-height: 380px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.notif-item {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border, #1e293b);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

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

.notif-item:hover {
  background: rgba(255, 255, 255, 0.035);
}

.notif-item.unread {
  background: rgba(59, 130, 246, 0.05);
  border-left: 3px solid var(--accent, #38bdf8);
}

.notif-item.read {
  opacity: 0.82;
}

.notif-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.2rem;
}

.notif-item-title-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.notif-unread-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, #38bdf8);
  box-shadow: 0 0 6px var(--accent, #38bdf8);
  display: inline-block;
}

.notif-item-title {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 600;
}

.notif-item-status {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.notif-item-status.unread {
  color: var(--accent, #38bdf8);
  background: rgba(56, 189, 248, 0.12);
}

.notif-item-status.read {
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.1);
}

.notif-item-ex-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #a5f3fc;
  margin-bottom: 0.2rem;
}

.notif-item-msg {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.35rem;
}

.notif-item-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.notif-empty {
  padding: 2.25rem 1.25rem;
  text-align: center;
}

/* ── Mobile adjustments for notification dropdown ── */
@media (max-width: 480px) {
  .notif-dropdown {
    position: fixed;
    top: 56px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }
}

/* ── Device Management & Authorization Styles ── */
.device-action-btn {
  position: relative;
}

.device-pending-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 7px;
  height: 7px;
  background: #f59e0b;
  border-radius: 50%;
  box-shadow: 0 0 6px #f59e0b;
  animation: pulse-badge 1.8s infinite;
}

@keyframes pulse-badge {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 10px #f59e0b; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.badge-device-approved {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
}

.badge-device-pending {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
}

.badge-device-revoked {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
}


/* ============================================================
   SESSION TIMEOUT WARNING MODAL
   ============================================================ */

/* Countdown ring wrapper — sits above the modal card */
.sto-ring-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  margin: -55px auto 0; /* Overlap the top edge of the modal */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Lift the modal card so the ring can overlap */
.sto-modal {
  margin-top: 60px !important;
}

/* SVG ring — full size of the wrapper */
.sto-ring-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* Start progress arc from the top */
  filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.5));
}

/* Background track circle */
.sto-ring-track {
  fill: none;
  stroke: var(--bg-card-hover, #16161f);
  stroke-width: 8;
}

/* Animated countdown progress arc */
.sto-ring-progress {
  fill: none;
  stroke: #f59e0b;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s linear;
}

/* Center content inside the ring */
.sto-ring-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  z-index: 1;
}

.sto-clock-icon {
  font-size: 1.6rem;
  line-height: 1;
  animation: sto-pulse 1s ease-in-out infinite;
}

@keyframes sto-pulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.15); opacity: 0.75; }
}

.sto-countdown-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #f59e0b;
  line-height: 1;
  font-family: 'JetBrains Mono', monospace;
}

/* Urgency: turn ring red in final seconds */
.sto-ring-progress.urgent {
  stroke: var(--error, #ef4444);
  filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.6));
}

/* Responsive: small screens */
@media (max-width: 480px) {
  .sto-ring-wrap {
    width: 90px;
    height: 90px;
    margin-top: -45px;
  }
  .sto-modal {
    margin-top: 50px !important;
  }
  .sto-clock-icon {
    font-size: 1.3rem;
  }
}


/* ══════════════════════════════════════════════════════════════
   DEVELOPER OPTIONS — Compiler Debugger (Admin Only)
   ══════════════════════════════════════════════════════════════ */

/* Controls Bar */
.devtools-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--card-bg, #1e293b);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border, #334155);
}

/* Pipeline Visualizer */
.devtools-pipeline {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    padding: 1rem;
    background: var(--card-bg, #1e293b);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border, #334155);
}

.pipeline-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border, #334155);
    min-width: 120px;
    text-align: center;
    transition: all 0.25s ease;
    position: relative;
}

.pipeline-stage.pipeline-active {
    box-shadow: 0 0 0 2px var(--primary, #6366f1), 0 0 16px rgba(99,102,241,0.3);
}

.pipe-status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #475569;
    transition: background 0.25s;
}

.pipe-label { font-weight: 600; font-size: 0.78rem; color: var(--text-primary, #e2e8f0); }
.pipe-func  { font-size: 0.68rem; color: var(--text-secondary, #94a3b8); font-family: 'Courier New', monospace; }
.pipe-time  { font-size: 0.68rem; color: var(--text-secondary, #94a3b8); }

.pipeline-arrow {
    color: var(--text-secondary, #64748b);
    font-size: 1.2rem;
    padding: 0 0.35rem;
    flex-shrink: 0;
}

/* Stage status colors */
.pipeline-stage.status-RUNNING  .pipe-status-dot { background: #f59e0b; animation: dt-pulse 1s infinite; }
.pipeline-stage.status-SUCCESS  .pipe-status-dot { background: #22c55e; }
.pipeline-stage.status-WARNING  .pipe-status-dot { background: #eab308; }
.pipeline-stage.status-ERROR    .pipe-status-dot { background: #ef4444; }
.pipeline-stage.status-SKIPPED  .pipe-status-dot { background: #64748b; }
.pipeline-stage.status-RETRYING .pipe-status-dot { background: #f97316; animation: dt-pulse 1s infinite; }

.pipeline-stage.status-SUCCESS { border-color: #22c55e44; background: rgba(34,197,94,0.05); }
.pipeline-stage.status-ERROR   { border-color: #ef444444; background: rgba(239,68,68,0.05); }
.pipeline-stage.status-WARNING { border-color: #eab30844; background: rgba(234,179,8,0.05); }
.pipeline-stage.status-RUNNING { border-color: #f59e0b44; background: rgba(245,158,11,0.05); }

@keyframes dt-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* Three-Column Layout */
.devtools-columns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.devtools-col { min-height: 280px; }

.devtools-panel {
    background: var(--card-bg, #1e293b);
    border: 1px solid var(--border, #334155);
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.devtools-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border, #334155);
    flex-shrink: 0;
}

.devtools-panel-header h3 { font-size: 0.9rem; margin: 0; }

.devtools-panel-body {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.devtools-editor {
    width: 100%;
    height: 100%;
    min-height: 240px;
    resize: none;
    border: none;
    border-radius: 0 0 0.75rem 0.75rem;
    font-size: 0.85rem;
}

.devtools-python-pre {
    margin: 0;
    padding: 0.75rem;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.82rem;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary, #e2e8f0);
    min-height: 240px;
}

/* Stage Badge */
.devtools-stage-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: #475569;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.devtools-badge-SUCCESS { background: #16a34a; }
.devtools-badge-ERROR   { background: #dc2626; }
.devtools-badge-WARNING { background: #ca8a04; }
.devtools-badge-RUNNING { background: #d97706; }

/* Tabbed Inspector */
.devtools-tabs {
    background: var(--card-bg, #1e293b);
    border: 1px solid var(--border, #334155);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
}

.devtools-tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 1px solid var(--border, #334155);
    padding: 0;
    overflow-x: auto;
}

.devtools-tab {
    padding: 0.55rem 0.9rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary, #94a3b8);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.devtools-tab:hover { color: var(--text-primary, #e2e8f0); background: rgba(255,255,255,0.03); }
.devtools-tab.active {
    color: var(--primary, #6366f1);
    border-bottom-color: var(--primary, #6366f1);
    background: rgba(99,102,241,0.06);
}

.devtools-tab-panel { display: none; padding: 1rem; max-height: 400px; overflow: auto; }
.devtools-tab-panel.active { display: block; }

/* Panel Toolbar */
.devtools-panel-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.devtools-filter {
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border, #334155);
    border-radius: 0.375rem;
    background: var(--input-bg, #0f172a);
    color: var(--text-primary, #e2e8f0);
    font-size: 0.8rem;
}

.devtools-count {
    font-size: 0.75rem;
    color: var(--text-secondary, #94a3b8);
    margin-left: auto;
}

/* Tables */
.devtools-table-wrap { overflow-x: auto; }

.devtools-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.devtools-table th {
    padding: 0.4rem 0.6rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
    border-bottom: 1px solid var(--border, #334155);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.devtools-table td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: top;
}

.devtools-table tr:hover td { background: rgba(255,255,255,0.02); }

.devtools-empty { text-align: center; color: var(--text-secondary, #94a3b8); padding: 2rem !important; }

/* Token type badges */
.token-type-KEYWORD    { color: #c084fc; }
.token-type-IDENTIFIER { color: #67e8f9; }
.token-type-NUMBER     { color: #fbbf24; }
.token-type-STRING     { color: #86efac; }
.token-type-OPERATOR   { color: #f87171; }
.token-type-NEWLINE    { color: #64748b; }
.token-type-EOF        { color: #64748b; }

/* AST Tree */
.devtools-ast-tree { padding: 0.5rem; }

.ast-node {
    margin-left: 1rem;
    border-left: 1px solid var(--border, #334155);
    padding-left: 0.75rem;
    margin-bottom: 0.25rem;
}

.ast-node-summary {
    cursor: pointer;
    padding: 0.25rem 0;
    font-size: 0.82rem;
}

.ast-type {
    font-weight: 700;
    color: #c084fc;
    background: rgba(192,132,252,0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.78rem;
}

.ast-prop {
    font-size: 0.75rem;
    color: var(--text-secondary, #94a3b8);
    margin-left: 0.5rem;
}

.ast-prop code { color: #67e8f9; }
.ast-children { margin-top: 0.25rem; }
.ast-child-label { font-size: 0.72rem; font-weight: 600; color: var(--text-secondary, #94a3b8); margin: 0.25rem 0; padding-left: 0.5rem; }
.ast-expr { font-size: 0.78rem; padding: 0.15rem 0 0.15rem 0.5rem; }

/* Key-Value pairs */
.devtools-kv { font-size: 0.82rem; margin-bottom: 0.3rem; }
.devtools-kv-key { font-weight: 600; color: var(--text-secondary, #94a3b8); margin-right: 0.4rem; }

/* Status text */
.devtools-status-SUCCESS { color: #22c55e; font-weight: 600; }
.devtools-status-ERROR   { color: #ef4444; font-weight: 600; }
.devtools-status-WARNING { color: #eab308; font-weight: 600; }
.devtools-status-RUNNING { color: #f59e0b; font-weight: 600; }
.devtools-status-SKIPPED { color: #64748b; }

/* Error/Warning lists */
.devtools-error-item, .devtools-warning-item {
    padding: 0.5rem 0.75rem;
    border-left: 3px solid #ef4444;
    margin-bottom: 0.5rem;
    background: rgba(239,68,68,0.05);
    border-radius: 0 0.375rem 0.375rem 0;
    font-size: 0.82rem;
}
.devtools-warning-item { border-left-color: #eab308; background: rgba(234,179,8,0.05); }
.devtools-suggestion { font-size: 0.78rem; color: var(--text-secondary, #94a3b8); margin-top: 0.25rem; }

/* Error category badges */
.error-cat-LEXICAL    { color: #f97316; font-weight: 600; font-size: 0.75rem; }
.error-cat-SYNTAX     { color: #ef4444; font-weight: 600; font-size: 0.75rem; }
.error-cat-SEMANTIC   { color: #eab308; font-weight: 600; font-size: 0.75rem; }
.error-cat-CODEGEN    { color: #8b5cf6; font-weight: 600; font-size: 0.75rem; }
.error-cat-RUNTIME    { color: #ec4899; font-weight: 600; font-size: 0.75rem; }
.error-cat-VALIDATION { color: #14b8a6; font-weight: 600; font-size: 0.75rem; }

/* Event Log */
.devtools-event-log {
    max-height: 350px;
    overflow-y: auto;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.78rem;
}

.devtools-log-entry {
    display: flex;
    gap: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.devtools-log-entry:hover { background: rgba(255,255,255,0.02); }
.devtools-log-time   { color: #64748b; min-width: 90px; }
.devtools-log-type   { color: #67e8f9; min-width: 160px; font-weight: 500; }
.devtools-log-stage  { color: var(--text-secondary, #94a3b8); min-width: 130px; }
.devtools-log-status { font-weight: 600; }

.devtools-log-SUCCESS .devtools-log-status { color: #22c55e; }
.devtools-log-ERROR   .devtools-log-status { color: #ef4444; }
.devtools-log-WARNING .devtools-log-status { color: #eab308; }
.devtools-log-RUNNING .devtools-log-status { color: #f59e0b; }
.devtools-log-SKIPPED .devtools-log-status { color: #64748b; }
.devtools-log-RETRYING .devtools-log-status { color: #f97316; }

/* Metrics Dashboard */
.devtools-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.devtools-metric-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border, #334155);
    border-radius: 0.5rem;
    padding: 0.75rem;
    text-align: center;
}

.devtools-metric-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.devtools-metric-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary, #e2e8f0);
    font-family: 'Courier New', Consolas, monospace;
}

/* Attempt History */
.devtools-attempt-card {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border, #334155);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.devtools-attempt-card:hover { background: rgba(255,255,255,0.04); }
.devtools-attempt-card.attempt-success { border-left: 3px solid #22c55e; }
.devtools-attempt-card.attempt-error   { border-left: 3px solid #ef4444; }
.devtools-attempt-card.attempt-warning { border-left: 3px solid #eab308; }

.attempt-num    { font-weight: 700; font-size: 0.85rem; min-width: 100px; }
.attempt-status { font-size: 0.78rem; color: var(--text-secondary, #94a3b8); min-width: 120px; }
.attempt-time   { font-size: 0.75rem; color: var(--text-secondary, #64748b); }
.attempt-meta   { font-size: 0.72rem; color: var(--text-secondary, #64748b); margin-left: auto; }

/* Runtime panels */
.devtools-runtime-info { margin-bottom: 0.75rem; }
.devtools-runtime-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.devtools-runtime-section h4 { font-size: 0.78rem; margin: 0 0 0.35rem; color: var(--text-secondary, #94a3b8); }

.devtools-output-pre {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border, #334155);
    border-radius: 0.375rem;
    padding: 0.75rem;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.8rem;
    min-height: 80px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary, #e2e8f0);
    margin: 0;
}

/* Execution Trace */
.devtools-trace-step {
    padding: 0.5rem 0.75rem;
    border-left: 2px solid var(--primary, #6366f1);
    margin-bottom: 0.5rem;
    background: rgba(99,102,241,0.03);
    border-radius: 0 0.375rem 0.375rem 0;
    font-size: 0.82rem;
}

.trace-step-num { font-weight: 700; color: var(--primary, #6366f1); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.trace-step-line { margin-top: 0.2rem; }
.trace-step-condition { color: #f59e0b; font-size: 0.78rem; margin-top: 0.15rem; }
.trace-step-output { color: #22c55e; font-size: 0.78rem; margin-top: 0.15rem; }
.trace-step-vars { color: var(--text-secondary, #94a3b8); font-size: 0.75rem; margin-top: 0.15rem; font-family: 'Courier New', monospace; }

/* Translation view */
.devtools-translation-list { display: flex; flex-direction: column; gap: 0.75rem; }
.devtools-translation-item {
    border: 1px solid var(--border, #334155);
    border-radius: 0.5rem;
    overflow: hidden;
}
.devtools-trans-pseudo {
    padding: 0.5rem 0.75rem;
    background: rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    flex-wrap: wrap;
}
.devtools-trans-arrow { color: var(--text-secondary, #64748b); }
.devtools-trans-python {
    padding: 0.5rem 0.75rem;
    margin: 0;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.8rem;
    color: #86efac;
    background: rgba(0,0,0,0.2);
}

/* Raw JSON */
.devtools-raw-sections { display: flex; flex-direction: column; gap: 0.5rem; }
.devtools-raw-detail { border: 1px solid var(--border, #334155); border-radius: 0.375rem; }
.devtools-raw-detail summary {
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    background: rgba(255,255,255,0.03);
}

.devtools-raw-pre {
    margin: 0;
    padding: 0.75rem;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.75rem;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow: auto;
    background: rgba(0,0,0,0.2);
    color: #94a3b8;
}

/* Auto-Fix Panel */
.devtools-autofix-panel {
    background: var(--card-bg, #1e293b);
    border: 1px solid #f9731644;
    border-left: 3px solid #f97316;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.devtools-autofix-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.devtools-autofix-item:last-child { border-bottom: none; }

/* Idle message */
.devtools-idle-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-secondary, #94a3b8);
    text-align: center;
    min-height: 120px;
}

/* Stage event detail */
.devtools-stage-event { padding: 0.5rem; }
.devtools-stage-summary { padding: 0.5rem; }

/* Responsive */
@media (max-width: 1024px) {
    .devtools-columns { grid-template-columns: 1fr; }
    .devtools-pipeline { flex-wrap: wrap; justify-content: center; }
    .devtools-runtime-panels { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .devtools-tab-bar { gap: 0; }
    .devtools-tab { padding: 0.4rem 0.6rem; font-size: 0.72rem; }
    .devtools-metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .pipeline-stage { min-width: 90px; padding: 0.5rem; }
    .pipe-label { font-size: 0.68rem; }
    .pipe-func { font-size: 0.6rem; }
}

