/* ==========================================================================
   IDEALOGY ENTERPRISE CSS v2.0 (ITCSS Architecture)
   Standards: WCAG 2.2 AA, W3C Reflow, WAI-ARIA APG
   Unified 2026-10-22 — dedupe: nav / @font-face / Mizan / sticky / chw / orphan rules
   ========================================================================== */
@layer reset, base, layout, components, utilities;

/* ---------- 1. SETTINGS ---------- */
:root {
  --ideal-primary: #0052CC; --ideal-primary-dark: #0747A6; --ideal-primary-bg: #DEEBFF;
  --ideal-success: #16a34a; --ideal-success-bg: #ecfdf5;
  --ideal-warning: #d97706; --ideal-warning-bg: #fffbeb;
  --ideal-danger: #dc2626;  --ideal-danger-bg: #fef2f2;
  --ideal-text: #111111; --ideal-muted: #6b7280;
  --ideal-border: #dfe1e6; --ideal-bg: #f5f5f5; --ideal-surface: #ffffff;
  --ideal-radius: 6px; --ideal-tap: 44px;
  --ideal-space-1: 0.25rem; --ideal-space-2: 0.5rem; --ideal-space-3: 0.75rem;
  --ideal-space-4: 1rem; --ideal-space-5: 1.5rem; --ideal-space-6: 2rem;
}

/* ---------- 2. RESET ---------- */
@layer reset {
  *, *::before, *::after { box-sizing: border-box !important; }
  html, body { margin: 0; padding: 0; max-width: 100vw; overflow-x: hidden; }
  body { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 15px; line-height: 1.55; color: var(--ideal-text); background: var(--ideal-bg); }
  h1, h2, h3, h4 { margin: 0 0 0.5rem 0; font-weight: 600; line-height: 1.3; }
  a { color: var(--ideal-primary); text-decoration: none; }
  a:hover { text-decoration: underline; }
  :focus-visible { outline: 2px solid var(--ideal-primary); outline-offset: 2px; }
}

/* ---------- 3. LAYOUT ---------- */
@layer layout {
  .page-content, .ideal-wrap, .wrap, .container { width: 100%; max-width: 1140px; margin: 0 auto; padding: var(--ideal-space-4); }
  @media (min-width: 768px) { .page-content, .ideal-wrap, .wrap, .container { padding: var(--ideal-space-6); } }
  .panel, .card, .ideal-card { background: var(--ideal-surface); border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); padding: var(--ideal-space-4); margin-bottom: var(--ideal-space-4); box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
  .panel-head, .dash-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: var(--ideal-space-2); margin-bottom: var(--ideal-space-3); border-bottom: 1px solid var(--ideal-border); padding-bottom: var(--ideal-space-2); }
  .panel-title, .page-title { font-size: 1.25rem; font-weight: 700; margin: 0; }
  .table-wrap, .dash-table-wrap, .table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: var(--ideal-space-4); }
  table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
  /* Only force min-width inside the designated scrollable wrapper */
  .table-responsive table, .table-wrap table, .dash-table-wrap table,
  .kc-table-wrap table, .paper-table-wrap table {
      min-width: 600px;
  }
  th, td { padding: 10px 12px; border-bottom: 1px solid var(--ideal-border); text-align: left; vertical-align: middle; white-space: nowrap; }
  th { background: var(--ideal-bg); font-weight: 600; color: var(--ideal-muted); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }
}

/* ---------- 4. COMPONENTS (base) ---------- */
@layer components {
  .btn, .ideal-btn, button[type="submit"] { display: inline-flex; align-items: center; justify-content: center; min-height: var(--ideal-tap); padding: 0 var(--ideal-space-4); border-radius: var(--ideal-radius); font-weight: 600; font-size: 0.875rem; cursor: pointer; border: 1px solid transparent; text-decoration: none; }
  .btn-primary, .ideal-btn { background: var(--ideal-primary); color: #fff; border: none; }
  .btn-primary:hover { background: var(--ideal-primary-dark); color: #fff; }
  .btn-secondary { background: var(--ideal-surface); color: var(--ideal-primary); border: 1px solid var(--ideal-border); }
  .btn-danger { background-color: var(--ideal-danger); color: white; border: none; padding: 0.5rem 1rem; border-radius: var(--ideal-radius); cursor: pointer; }
  .btn-danger:hover { background-color: #b91c1c; }
  .btn-ghost { background: transparent; color: var(--ideal-text); border: 1px solid var(--ideal-border); padding: 0.5rem 1rem; border-radius: var(--ideal-radius); cursor: pointer; }
  .btn-sm { padding: 0.35rem 0.75rem; font-size: 0.875rem; }
  .btn-back { background: rgba(0,0,0,0.05); color: rgba(0,0,0,0.75); }
  .btn-back:hover { background: rgba(0,0,0,0.1); }
  .field { display: flex; flex-direction: column; gap: var(--ideal-space-2); margin-bottom: var(--ideal-space-3); width: 100%; }
  .field-label { font-weight: 600; font-size: 0.875rem; color: var(--ideal-text); }
  .input, input[type="text"], input[type="password"], select { width: 100%; min-height: var(--ideal-tap); padding: 0 var(--ideal-space-3); border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); font-family: inherit; font-size: 1rem; background: var(--ideal-surface); color: var(--ideal-text); }
  .seg { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; width: 100% !important; border: 1px solid var(--ideal-border) !important; border-radius: var(--ideal-radius) !important; overflow: hidden !important; background: var(--ideal-surface); }
  .seg label { display: block !important; margin: 0 !important; padding: 0 !important; width: 100% !important; min-width: 0 !important; }
  .seg span { display: flex !important; justify-content: center !important; align-items: center !important; width: 100% !important; padding: 10px 2px !important; font-size: 0.8rem !important; border-right: 1px solid var(--ideal-border) !important; min-height: var(--ideal-tap) !important; cursor: pointer !important; white-space: nowrap !important; }
  .seg label:last-child span { border-right: none !important; }
  .seg input { position: absolute !important; opacity: 0 !important; pointer-events: none !important; }
  .seg-p input:checked + span { background: var(--ideal-primary) !important; color: #fff !important; }
  .seg-a input:checked + span { background: var(--ideal-danger) !important; color: #fff !important; }
  .seg-l input:checked + span { background: var(--ideal-warning) !important; color: #fff !important; }
  .kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ideal-space-4); margin-bottom: var(--ideal-space-4); }
  @media (max-width: 480px) { .kpi-row { grid-template-columns: 1fr; } }
  .kpi-value-lg { font-size: 2rem; font-weight: 700; color: var(--ideal-primary); line-height: 1.2; }
  .kpi-value-md { font-size: 1.5rem; font-weight: 700; color: var(--ideal-success); line-height: 1.2; }
  .kpi-success { color: var(--ideal-success); }
  .kpi-item { display: flex; flex-direction: column; gap: var(--ideal-space-1); }
  .kpi--warn { border-left: 4px solid #f59e0b; }
  .kpi--good { border-left: 4px solid #27ae60; }
  .tag { display: inline-block !important; padding: 0.25rem 0.5rem !important; font-size: 0.75rem !important; font-weight: 600 !important; border-radius: 4px !important; line-height: 1.2 !important; letter-spacing: 0.02em !important; }
  .tag--positive { background-color: #ecfdf5 !important; color: #047857 !important; border: 1px solid #a7f3d0 !important; }
  .tag--negative { background-color: #fef2f2 !important; color: #b91c1c !important; border: 1px solid #fecaca !important; }
  .tag--neutral { background-color: #f3f4f6 !important; color: #4b5563 !important; border: 1px solid #e5e7eb !important; }
  .tag.DONE, .tag.COMPLETED, .tag.ACTIVE { background: rgba(39,174,96,0.15); color: #166534; }
  .tag.WARN, .tag.IN_PROGRESS, .tag.BLOCKED { background: rgba(241,196,15,0.15); color: #92400e; }
  .tag.CRITICAL { background: rgba(192,57,43,0.15); color: #7f1d1d; font-weight: 600; }
  .tag.INFO, .tag.PENDING, .tag.ASSIGNED, .tag.SKIPPED { background: rgba(0,0,0,0.06); color: rgba(0,0,0,0.65); }
  

  
  .coach-summary-panel { background: var(--ideal-bg) !important; border-left: 4px solid var(--ideal-primary) !important; }
  .coach-summary-text { font-size: 1rem !important; line-height: 1.5 !important; color: var(--ideal-muted) !important; }

  .panel--inset { background-color: var(--ideal-bg); border: 1px solid var(--ideal-border); padding: var(--ideal-space-4); border-radius: var(--ideal-radius); }
  .panel--warning { border-left: 4px solid var(--ideal-warning) !important; background-color: var(--ideal-warning-bg); padding: var(--ideal-space-4); border-radius: var(--ideal-radius); }
  .panel--info { padding: 1rem 1.25rem; border-radius: 8px; background: rgba(52,152,219,0.08); border-left: 4px solid rgba(52,152,219,0.6); }
  .panel--positive { padding: 1rem 1.25rem; border-radius: 8px; background: rgba(39,174,96,0.06); border-left: 4px solid #27ae60; }
  .panel--negative { padding: 1rem 1.25rem; border-radius: 8px; background: rgba(192,57,43,0.06); border-left: 4px solid #c0392b; }
}

/* ---------- 4. COMPONENTS (continued: quick-links, funnel, help, tables, forms, threads, toggles, mastery, session) ---------- */
@layer components {
  .quick-links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--ideal-space-4); }
  .qlink { display: flex; flex-direction: column; padding: var(--ideal-space-4); border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); text-decoration: none; color: var(--ideal-text); background: var(--ideal-surface); transition: border-color 0.2s; }
  .qlink:hover { border-color: var(--ideal-primary); }
  .qlink-sub { font-size: 0.875rem; color: var(--ideal-muted); margin-top: var(--ideal-space-1); }
  .funnel-card { display: flex; flex-direction: column; padding: var(--ideal-space-4); border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); background: var(--ideal-surface); margin-bottom: var(--ideal-space-3); transition: border-color 0.2s; text-align: left !important; align-items: flex-start !important; }
  .funnel-card:hover { border-color: var(--ideal-primary); }
  .funnel-card summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; font-weight: 600; color: var(--ideal-text); width: 100%; }
  .funnel-card summary::-webkit-details-marker { display: none; }
  .funnel-card[open] summary { margin-bottom: var(--ideal-space-3); padding-bottom: var(--ideal-space-3); border-bottom: 1px solid var(--ideal-border); }
  .funnel-summary { display: flex; flex-direction: column; gap: var(--ideal-space-2); cursor: pointer; list-style: none; width: 100%; }
  .funnel-meta { display: flex; align-items: center; gap: var(--ideal-space-2); }
  .funnel-title { font-size: 1rem; font-weight: 600; color: var(--ideal-text); margin-bottom: var(--ideal-space-2); line-height: 1.4; }
  @media (min-width: 600px) { .funnel-summary { flex-direction: row; justify-content: space-between; align-items: center; } }
  .page-header-flex { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--ideal-space-3); }
  .help-btn { background: transparent; border: 1px solid var(--ideal-border); border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ideal-muted); flex-shrink: 0; font-weight: bold; }
  .help-btn:hover { background: var(--ideal-bg); color: var(--ideal-primary); border-color: var(--ideal-primary); }
  .help-drawer-overlay.is-open { display: block !important; }
  .help-drawer.is-open { transform: translateX(0) !important; }
  .help-drawer-header { display: flex; justify-content: space-between; align-items: center; padding: var(--ideal-space-4); border-bottom: 1px solid var(--ideal-border); }
  .help-drawer-body { padding: var(--ideal-space-4); overflow-y: auto; flex: 1; }
  .ideal-table { width: 100%; border-collapse: collapse; text-align: left; }
  .ideal-table th, .ideal-table td { padding: var(--ideal-space-3); border-bottom: 1px solid var(--ideal-border); }
  .ideal-table th { background: var(--ideal-bg); font-weight: 600; color: var(--ideal-text); }
  .ideal-table tr:hover { background: var(--ideal-bg); }
  .ideal-form-group { margin-bottom: var(--ideal-space-4); display: flex; flex-direction: column; gap: var(--ideal-space-1); }
  .ideal-label { font-weight: 600; font-size: 0.875rem; color: var(--ideal-text); }
  .ideal-input, .ideal-select { padding: var(--ideal-space-2) var(--ideal-space-3); border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); font-size: 1rem; width: 100%; max-width: 400px; }
  .ideal-input:focus, .ideal-select:focus { outline: 2px solid var(--ideal-primary); border-color: transparent; }
  .ideal-form-group input[type="text"], .ideal-form-group input[type="number"], .ideal-form-group input[type="password"], .ideal-form-group select, .ideal-form-group textarea { padding: var(--ideal-space-2) var(--ideal-space-3); border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); font-size: 1rem; width: 100%; max-width: 400px; font-family: inherit; }
  .ideal-form-group input:focus, .ideal-form-group select:focus, .ideal-form-group textarea:focus { outline: 2px solid var(--ideal-primary); border-color: transparent; }
  .ideal-code-block { background: var(--ideal-bg); border: 1px dashed var(--ideal-border); padding: var(--ideal-space-3); font-family: monospace; font-size: 1.1rem; letter-spacing: 1px; border-radius: var(--ideal-radius); word-break: break-all; margin-top: var(--ideal-space-2); }
  .ideal-recovery-list { background: var(--ideal-warning-bg); border: 1px solid var(--ideal-warning); padding: var(--ideal-space-4); border-radius: var(--ideal-radius); list-style-type: none; font-family: monospace; font-size: 1.1rem; display: grid; grid-template-columns: 1fr 1fr; gap: var(--ideal-space-2); }
  .msg-thread { display: flex; flex-direction: column; gap: var(--ideal-space-3); margin-top: var(--ideal-space-4); }
  .msg-card { background: var(--ideal-surface); border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); padding: var(--ideal-space-4); }
  .msg-header { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--ideal-muted); margin-bottom: var(--ideal-space-2); border-bottom: 1px solid var(--ideal-border); padding-bottom: var(--ideal-space-2); }
  .msg-body { font-size: 0.95rem; color: var(--ideal-text); line-height: 1.5; white-space: pre-wrap; }
  .msg { padding: 0.75rem 1rem; border-radius: 6px; margin: 0.75rem 0; }
  .msg.error { background: rgba(192,57,43,0.1); color: #7f1d1d; }
  .msg.info { background: rgba(52,152,219,0.1); color: #1e40af; }
  .msg.success { background: rgba(39,174,96,0.1); color: #166534; }
  .msg--highlighted { border-left: 3px solid #fbbf24; background: rgba(251,191,36,0.06); }
  .task-gate-row { display: flex; justify-content: space-between; align-items: center; padding: var(--ideal-space-3) 0; border-bottom: 1px solid var(--ideal-border); }
  .task-gate-list { display: flex; flex-direction: column; border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); overflow: hidden; }
  .task-gate-row:last-child { border-bottom: none; }
  .task-gate-row:hover { background: var(--ideal-bg); }
  .task-meta { font-size: 0.75rem; color: var(--ideal-muted); margin-top: 4px; }
  .toggle-switch { position: relative; display: inline-block; width: 48px; height: 24px; flex-shrink: 0; }
  .toggle-switch input { opacity: 0; width: 0; height: 0; }
  .toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: 0.4s; border-radius: 24px; }
  .toggle-slider::before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: 0.4s; border-radius: 50%; }
  input:checked + .toggle-slider { background-color: var(--ideal-success); }
  input:checked + .toggle-slider::before { transform: translateX(24px); }
  input:focus + .toggle-slider { box-shadow: 0 0 1px var(--ideal-success); }
  .prompt-container { position: relative; margin-top: var(--ideal-space-4); }
  .prompt-box { background: #1e1e1e; color: #d4d4d4; padding: var(--ideal-space-4); border-radius: var(--ideal-radius); font-family: monospace; font-size: 0.85rem; white-space: pre-wrap; line-height: 1.5; max-height: 300px; overflow-y: auto; display: block; }
  .copy-btn { position: absolute; top: -12px; right: 12px; padding: 6px 12px; font-size: 0.75rem; cursor: pointer; background: var(--ideal-primary); color: white; border: none; border-radius: 4px; font-weight: 600; z-index: 10; }
  .batch-toggle { display: flex; gap: var(--ideal-space-2); margin-bottom: var(--ideal-space-4); }
  .batch-btn { flex: 1; padding: var(--ideal-space-3); text-align: center; border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); cursor: pointer; background: var(--ideal-bg); font-weight: 600; color: var(--ideal-text); }
  .batch-btn.active { background: var(--ideal-primary); color: white; border-color: var(--ideal-primary); }
  .font-mono { font-family: monospace; }
  .mastery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--ideal-space-4); margin-top: var(--ideal-space-4); }
  .mastery-card { background: var(--ideal-surface); border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); padding: var(--ideal-space-4); }
  .mastery-card.NEW { border-top: 4px solid var(--ideal-muted); }
  .mastery-card.LEARNING { border-top: 4px solid var(--ideal-warning); }
  .mastery-card.REVIEW { border-top: 4px solid var(--ideal-primary); }
  .mastery-card.MASTERED { border-top: 4px solid var(--ideal-success); }
  .session-card { background: var(--ideal-surface); border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); padding: var(--ideal-space-4); margin-bottom: var(--ideal-space-3); }
  .session-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--ideal-border); padding-bottom: var(--ideal-space-2); margin-bottom: var(--ideal-space-2); }
  .session-meta { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ideal-space-2); font-size: 0.85rem; color: var(--ideal-muted); }
  @media (max-width: 600px) { .session-meta { grid-template-columns: 1fr; } }
  .file-input { padding: var(--ideal-space-3); border: 1px dashed var(--ideal-border); border-radius: var(--ideal-radius); width: 100%; background: var(--ideal-bg); cursor: pointer; }
  .status-box { padding: var(--ideal-space-3) var(--ideal-space-4); border-radius: var(--ideal-radius); margin-bottom: var(--ideal-space-4); display: none; font-weight: 500; }
  .status-box.is-visible { display: block; }
  .status-box--error { background: var(--ideal-danger-bg); border-left: 5px solid var(--ideal-danger); color: #991b1b; }
  .status-box--success { background: var(--ideal-success-bg); border-left: 5px solid var(--ideal-success); color: #166534; }
  .status-box--info { background: var(--ideal-primary-bg); border-left: 5px solid var(--ideal-primary); color: #1e3a8a; }
  .kzm-stars { display: inline-flex; gap: 2px; align-items: center; font-size: 1.3rem; }
  .kzm-star-filled { color: #f59e0b; }
  .kzm-star-empty { color: #d1d5db; }
}

/* ---------- 5. MIZAN (UNIFIED) ---------- */
@layer components {
  .mizan-hero { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: var(--ideal-space-4); padding: var(--ideal-space-5); background: var(--ideal-surface); border-radius: var(--ideal-radius); border: 1px solid var(--ideal-border); width: 100%; box-sizing: border-box; }
  @media (max-width: 768px) { .mizan-hero { flex-direction: column; align-items: stretch; } }
  .mizan-ring-wrapper { position: relative; width: 180px; height: 180px; flex-shrink: 0; margin: 0 auto; }
  .mizan-ring { position: relative; width: 100%; height: 100%; border-radius: 50%; background: conic-gradient(var(--ideal-primary) calc(var(--score) * 0.1%), var(--ideal-border) 0); display: flex; align-items: center; justify-content: center; }
  .mizan-ring::before { content: ""; position: absolute; width: 140px; height: 140px; border-radius: 50%; background: var(--ideal-surface); }
  .mizan-ring-inner { position: relative; z-index: 2; text-align: center; }
  .mizan-score { font-size: 2.5rem; font-weight: 800; line-height: 1; color: var(--ideal-text); }
  .mizan-label { font-size: 0.85rem; color: var(--ideal-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 1px; margin-top: 4px; }
  .mizan-ring-container { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--ideal-space-6); background: var(--ideal-surface); border-radius: var(--ideal-radius); border: 1px solid var(--ideal-border); }
  .mizan-ring-container .mizan-ring { position: relative; width: 200px; height: 200px; border-radius: 50%; background: conic-gradient(var(--ideal-primary) calc(var(--score) * 0.1%), var(--ideal-border) 0); display: flex; align-items: center; justify-content: center; }
  .mizan-ring-container .mizan-ring::before { content: ""; position: absolute; width: 160px; height: 160px; border-radius: 50%; background: var(--ideal-surface); }
  .mizan-risk-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; margin-top: var(--ideal-space-4); width: 100%; }
  .risk-segment { height: 100%; }
  .risk-red { width: 30%; background: #ef4444; }
  .risk-orange { width: 10%; background: #f97316; }
  .risk-yellow { width: 10%; background: #eab308; }
  .risk-green { width: 50%; background: #22c55e; }
  .risk-indicator { position: relative; height: 24px; margin-top: -18px; }
  .risk-pin { position: absolute; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 8px solid var(--ideal-text); transform: translateX(-50%); }
  .mizan-scale-wrapper { width: 100%; margin-top: var(--ideal-space-4); }
  .mizan-scale-bar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--ideal-border); position: relative; }
  .scale-zone { height: 100%; }
  .scale-red { width: 30%; background: #ef4444; }
  .scale-orange { width: 10%; background: #f97316; }
  .scale-yellow { width: 10%; background: #eab308; }
  .scale-green { width: 50%; background: #22c55e; }
  .mizan-pin { position: absolute; top: -6px; width: 4px; height: 28px; background: var(--ideal-text); border-radius: 2px; transform: translateX(-50%); transition: left 0.3s ease; }
  .mizan-scale-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--ideal-muted); margin-top: var(--ideal-space-2); font-weight: 600; }
  .mizan-consequence { padding: var(--ideal-space-3); border-radius: var(--ideal-radius); font-size: 0.9rem; margin-top: var(--ideal-space-4); border-left: 4px solid var(--ideal-text); }
  .consequence-safe { background: #ecfdf5; border-color: #22c55e; color: #166534; }
  .consequence-warn { background: #fffbeb; border-color: #eab308; color: #854d0e; }
  .consequence-danger { background: #fef2f2; border-color: #ef4444; color: #991b1b; }
}

/* ---------- 6. NAV (UNIFIED — single canonical) ---------- */
@layer components {
  .ent-navbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: var(--ideal-surface); border-bottom: 1px solid var(--ideal-border); position: sticky; top: 0; z-index: 10000; box-shadow: 0 1px 3px rgba(0,0,0,0.05); flex-wrap: nowrap; }
  .ent-brand { font-size: 1.25rem; font-weight: 800; color: var(--ideal-primary); text-decoration: none; display: flex; align-items: center; gap: 4px; }
  .ent-brand-dot { color: var(--ideal-danger, #dc2626); font-weight: 600; }
  .ent-nav-links { display: flex; gap: var(--ideal-space-4); align-items: center; }
  .ent-nav-link { text-decoration: none; color: var(--ideal-text); font-weight: 500; font-size: 0.95rem; min-height: 44px; display: inline-flex; align-items: center; padding: 8px 6px; transition: color 0.2s; }
  .ent-nav-link:hover, .ent-nav-link[aria-current="page"] { color: var(--ideal-primary); font-weight: 600; }
  .ent-nav-form { margin: 0; }
  .ent-nav-logout { padding: 6px 12px; font-size: 0.85rem; font-weight: 500; min-height: 44px; border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); background: transparent; color: var(--ideal-text); cursor: pointer; white-space: nowrap; transition: all 0.15s; }
  .ent-nav-logout:hover { background: var(--ideal-danger-bg); border-color: var(--ideal-danger); color: var(--ideal-danger); }
  .ent-nav-logout-block { width: 100%; text-align: left; background: transparent; border: 0; cursor: pointer; }
  .ent-mobile-menu { display: none; }
  .ent-mobile-menu summary { list-style: none; cursor: pointer; padding: 8px; display: flex; align-items: center; justify-content: center; }
  .ent-mobile-menu summary::-webkit-details-marker { display: none; }
  .ent-mobile-dropdown { position: absolute; right: 0; top: 100%; margin-top: 10px; width: 260px; max-height: 80vh; overflow-y: auto; background: var(--ideal-surface); border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); box-shadow: 0 10px 25px rgba(0,0,0,0.2); display: flex; flex-direction: column; padding: var(--ideal-space-2) 0; z-index: 10002; }
  .ent-dropdown-link { padding: var(--ideal-space-2) var(--ideal-space-4); text-decoration: none; color: var(--ideal-text); font-size: 0.9rem; min-height: 48px; display: flex; align-items: center; }
  .ent-dropdown-link:hover { background: var(--ideal-bg); color: var(--ideal-primary); }
  .ent-dropdown-header { font-size: 0.75rem; text-transform: uppercase; color: var(--ideal-muted); font-weight: 700; padding: var(--ideal-space-2) var(--ideal-space-4); margin-top: var(--ideal-space-2); }
  .ent-dropdown-header:first-child { margin-top: 0; }
  .ent-divider { height: 1px; background: var(--ideal-border); margin: var(--ideal-space-2) 0; }
  .ent-dropdown-btn { width: 100%; text-align: left; background: none; border: none; cursor: pointer; }
  .ent-nav-link:focus-visible, .ent-dropdown-link:focus-visible, .ent-nav-logout:focus-visible, .ent-nav-logout-block:focus-visible, .ent-mobile-menu summary:focus-visible, .ent-brand:focus-visible { outline: 2px solid var(--ideal-primary); outline-offset: 2px; border-radius: 2px; }
  @media (max-width: 1024px) {
    .ent-navbar { position: fixed; top: 0; left: 0; width: 100%; z-index: 10000; }
    body { padding-top: 60px; }
    .ent-nav-links { display: none; }
    .ent-nav-form { display: none; }
    .ent-mobile-menu { display: block; position: relative; z-index: 10001; }
    .ent-mobile-dropdown { max-height: calc(100vh - 70px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
  }
}

/* ---------- 7. BATTLE / GAME ---------- */
@layer components {
  .battle-wrapper { display: flex; justify-content: center; align-items: center; padding: var(--ideal-space-4) 0; }
  .battle-card { width: 100%; max-width: 600px; background: var(--ideal-surface); border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); padding: var(--ideal-space-6); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
  .battle-header { text-align: center; margin-bottom: var(--ideal-space-6); }
  .arena { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--ideal-space-6); }
  .player-sprite, .monster-sprite { font-size: 4rem; text-align: center; }
  .versus { font-size: 1.5rem; font-weight: 800; color: var(--ideal-muted); }
  .hp-track { width: 100%; height: 12px; background: var(--ideal-border); border-radius: 6px; overflow: hidden; margin-top: var(--ideal-space-2); }
  .hp-fill { height: 100%; background: var(--ideal-danger); width: 100%; transition: width 0.3s ease; }
  .hint-box { background: var(--ideal-warning-bg); border: 1px solid var(--ideal-warning); color: #92400e; padding: var(--ideal-space-3); border-radius: var(--ideal-radius); margin-bottom: var(--ideal-space-4); }
  .feedback-box { display: none; background: var(--ideal-success-bg); border: 1px solid var(--ideal-success); color: #166534; padding: var(--ideal-space-3); border-radius: var(--ideal-radius); margin-top: var(--ideal-space-4); }
  .wizard-gates { display: flex; flex-wrap: wrap; gap: var(--ideal-space-2); margin-top: var(--ideal-space-6); border-top: 1px solid var(--ideal-border); padding-top: var(--ideal-space-4); }
  .wizard-gate { padding: var(--ideal-space-2) var(--ideal-space-3); border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); text-decoration: none; color: var(--ideal-text); font-size: 0.85rem; font-weight: 500; }
  .wizard-gate:hover { background: var(--ideal-bg); }
  .wizard-gate.active { background: var(--ideal-primary); color: white; border-color: var(--ideal-primary); }
  .pokedex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--ideal-space-4); margin-top: var(--ideal-space-4); }
  .pokedex-card { background: var(--ideal-surface); border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); padding: var(--ideal-space-4); text-align: center; transition: transform 0.2s, box-shadow 0.2s; text-decoration: none; color: var(--ideal-text); display: block; }
  .pokedex-card:hover { transform: translateY(-4px) scale(1.02); box-shadow: 0 4px 12px rgba(0,0,0,0.15); border-color: var(--ideal-primary); }
  .pokedex-card.caught { border-top: 4px solid var(--ideal-success); }
  .pokedex-card.uncaught { opacity: 0.6; filter: grayscale(100%); }
  .monster-emoji { font-size: 3rem; display: block; margin-bottom: var(--ideal-space-2); }
  .kc-name { font-weight: 600; font-size: 0.9rem; }
  .kc-subject { font-size: 0.75rem; color: var(--ideal-muted); margin-top: 4px; }
  .options-grid { display: flex; flex-direction: column; gap: var(--ideal-space-2); margin-top: var(--ideal-space-4); }
  .option-btn { padding: var(--ideal-space-3) var(--ideal-space-4); background: var(--ideal-surface); border: 2px solid var(--ideal-border); border-radius: var(--ideal-radius); cursor: pointer; text-align: left; font-size: 1rem; font-family: inherit; transition: all 0.2s ease; width: 100%; }
  .option-btn:hover:not(:disabled) { border-color: var(--ideal-primary); background: var(--ideal-bg); transform: translateX(4px); }
  .option-btn.option-correct { background: var(--ideal-success-bg); border-color: var(--ideal-success); color: #166534; font-weight: 600; }
  .option-btn.option-wrong { background: var(--ideal-danger-bg); border-color: var(--ideal-danger); color: #991b1b; }
  .option-btn:disabled { cursor: default; opacity: 0.85; }
  .monster-sprite { transition: transform 0.3s ease; }
  .battle-question { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
  .battle-option { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; line-height: 1.4; }
  .monster-box { text-align: center; padding: var(--ideal-space-6); }
  .monster-icon { font-size: 5rem; margin-bottom: var(--ideal-space-4); }
  .xp-bar-container { background: var(--ideal-border); border-radius: 10px; height: 20px; width: 100%; overflow: hidden; margin: var(--ideal-space-4) 0; }
  .xp-bar-fill { background: var(--ideal-success); height: 100%; transition: width 0.3s ease; }
  .rank-card { display: flex; flex-direction: column; align-items: center; background: #1e293b; color: white; padding: 20px; border-radius: 12px; margin: 20px auto; width: 100%; max-width: 400px; box-sizing: border-box; border: 2px solid #334155; }
  .rank-icon { font-size: 4rem; line-height: 1; }
  .rank-title { font-size: 1.5rem; font-weight: 800; color: #fbbf24; margin-top: 10px; text-transform: uppercase; letter-spacing: 2px; }
  .rank-sub { font-size: 0.9rem; color: #94a3b8; margin-top: 5px; }
  .daily-goal-box { background: var(--ideal-surface); padding: 20px; border-radius: 12px; border: 1px solid var(--ideal-border); margin: 20px auto; width: 100%; max-width: 400px; box-sizing: border-box; text-align: center; }
  .goal-progress-bg { background: #e5e7eb; height: 12px; border-radius: 6px; overflow: hidden; margin: 15px 0 5px; }
  .goal-progress-fill { background: var(--ideal-primary); height: 100%; transition: width 0.3s; }
}

/* ---------- 8. STICKY / TIMELINE / HISTORY (UNIFIED) ---------- */
@layer components {
  .sticky-bottom-bar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 100; background: #ffffff; padding: 1rem; border-top: 2px solid var(--ideal-primary, #2563eb); box-shadow: 0 -4px 12px rgba(0,0,0,0.1); }
  @media (min-width: 768px) { .sticky-bottom-bar { position: sticky; bottom: 1rem; left: auto; right: auto; max-width: 1200px; margin: 0 auto; border: 2px solid var(--ideal-primary, #2563eb); border-radius: 12px; } }
  .compact-sticky-bar { position: fixed; bottom: 0; left: 0; right: 0; background: #ffffff; padding: 0.5rem 1rem; border-top: 1px solid #e2e8f0; box-shadow: 0 -2px 10px rgba(0,0,0,0.05); z-index: 1050; display: flex; justify-content: space-between; align-items: center; }
  @media (min-width: 768px) { .compact-sticky-bar { position: sticky; bottom: 1rem; left: auto; right: auto; max-width: 800px; margin: 2rem auto 0; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); padding: 1rem 1.5rem; } }
  .compact-sticky-bar .save-btn { padding: 0.5rem 1rem; font-size: 0.9rem; white-space: nowrap; display: flex; align-items: center; gap: 0.5rem; height: 42px; }
  .urdu-box { display: none; margin-top: 1rem; padding: 1rem; background: #f0fdf4; border-right: 4px solid #10b981; border-radius: 8px; font-size: 1.1rem; line-height: 2; color: #064e3b; text-align: left; font-family: 'Noto Nastaliq Urdu', serif; }
  .urdu-box.show { display: block; }
  .q-checkbox { width: 20px; height: 20px; cursor: pointer; }
  .back-arrow { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: #f1f5f9; color: #1e293b; text-decoration: none; transition: background 0.2s; }
  .back-arrow:hover { background: #e2e8f0; }
  .global-history-nav { display: flex; gap: 0.5rem; padding: 0.5rem 1rem; max-width: 1200px; margin: 0 auto; }
  .history-nav-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; cursor: pointer; transition: all 0.2s; }
  .history-nav-btn:hover { background: #e2e8f0; color: #0f172a; }
  .timeline { position: relative; padding-left: 0; margin: 1.5rem 0; }
  .timeline-item { display: flex; align-items: flex-start; gap: 1rem; padding: 1rem 0; position: relative; }
  .timeline-marker { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; flex-shrink: 0; background: #e2e8f0; color: #64748b; border: 2px solid #cbd5e1; z-index: 2; position: relative; transition: all 0.3s ease; }
  .timeline-item.is-done .timeline-marker { background: #22c55e; border-color: #22c55e; color: #ffffff; }
  .timeline-item.is-active .timeline-marker { background: #2563eb; border-color: #2563eb; color: #ffffff; box-shadow: 0 0 0 6px rgba(37,99,235,0.15); }
  .timeline-item.is-locked .timeline-marker { background: #f1f5f9; border-color: #e2e8f0; color: #94a3b8; }
  .timeline-line { position: absolute; left: 20px; top: 50px; bottom: 0; width: 2px; background: #e2e8f0; z-index: 1; }
  .timeline-item.is-done + .timeline-item .timeline-line { background: #22c55e; }
  .timeline-item.is-locked .timeline-line { background: #e2e8f0; }
  .timeline-body { flex: 1; min-width: 0; padding-top: 0.4rem; }
  .timeline-title { font-weight: 600; font-size: 1rem; color: #1e293b; margin-bottom: 0.25rem; }
  .timeline-item.is-locked .timeline-title { color: #94a3b8; }
  .timeline-desc { font-size: 0.85rem; color: #64748b; line-height: 1.5; }
  .timeline-cta { margin-top: 0.75rem; }
  .progress-header { position: sticky; top: 0; z-index: 100; background: #ffffff; border-bottom: 1px solid #e2e8f0; padding: 0.75rem 1rem; margin: -1rem -1rem 1rem -1rem; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
  .progress-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
  .progress-bar-track { flex: 1; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; min-width: 80px; }
  .progress-bar-fill { height: 100%; background: #2563eb; border-radius: 3px; transition: width 0.4s ease; }
  .progress-label { font-size: 0.8rem; font-weight: 600; color: #1e293b; white-space: nowrap; }
  .source-text { line-height: 1.6 !important; font-size: 0.95rem; }
}

/* ---------- 9. SESSION TIMEOUT ---------- */
@layer components {
  .session-timeout-modal, #session-timeout, .timeout-popup { position: fixed !important; top: 50% !important; left: 50% !important; transform: translate(-50%, -50%) !important; background: var(--ideal-surface) !important; padding: 30px !important; border-radius: 12px !important; box-shadow: 0 10px 30px rgba(0,0,0,0.3) !important; z-index: 99999 !important; text-align: center !important; border: 1px solid var(--ideal-border) !important; width: 90% !important; max-width: 400px !important; }
  .session-timeout-overlay { position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important; background: rgba(0,0,0,0.5) !important; z-index: 99998 !important; }
  .session-timeout-modal button, .timeout-popup button { margin-top: 20px !important; padding: 10px 24px !important; font-size: 1rem !important; border-radius: 8px !important; display: inline-block !important; }
}

/* ---------- 10. PIPELINE UI ---------- */
@layer components {
  .pipe-progress-wrap { margin: 0.75rem 0; }
  .pipe-progress-wrap progress { width: 100%; height: 20px; appearance: none; -webkit-appearance: none; border: none; border-radius: 10px; overflow: hidden; background: rgba(0,0,0,0.08); }
  .pipe-progress-wrap progress::-webkit-progress-bar { background: rgba(0,0,0,0.08); border-radius: 10px; }
  .pipe-progress-wrap progress::-webkit-progress-value { background: #0052CC; border-radius: 10px; transition: width 0.3s ease; }
  .pipe-progress-wrap progress::-moz-progress-bar { background: #0052CC; border-radius: 10px; }
  .pipe-progress-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; font-size: 0.9rem; color: rgba(0,0,0,0.55); margin-top: 0.35rem; }
  .stage-strip { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 1rem 0 0.5rem; }
  .stage-chip { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.35rem 0.65rem; border-radius: 6px; background: rgba(0,0,0,0.06); font-size: 0.85rem; font-weight: 500; min-width: 34px; justify-content: center; }
  .stage-chip.done { background: rgba(39,174,96,0.15); color: #166534; }
  .stage-chip.current { background: rgba(52,152,219,0.2); color: #1e40af; outline: 2px solid rgba(52,152,219,0.6); }
  .stage-chip.teacher { border-left: 3px solid rgba(241,196,15,0.9); }
  .stage-chip .c { font-size: 0.75rem; opacity: 0.7; }
  .stage-vert { list-style: none; padding: 0; margin: 1rem 0; display: none; }
  .stage-vert li { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; margin: 0.35rem 0; border-left: 3px solid rgba(0,0,0,0.15); background: rgba(0,0,0,0.02); border-radius: 0 6px 6px 0; }
  .stage-vert li.done { border-left-color: #27ae60; background: rgba(39,174,96,0.05); }
  .stage-vert li.current { border-left-color: #3498db; background: rgba(52,152,219,0.05); }
  .stage-vert li.teacher { border-left-color: #f1c40f; }
  .stage-vert li .num { font-weight: 700; min-width: 24px; text-align: center; color: rgba(0,0,0,0.55); font-size: 1rem; }
  .stage-vert li.done .num { color: #27ae60; }
  .stage-vert li .lbl { flex: 1; font-weight: 500; }
  .stage-vert li .meta { font-size: 0.8rem; color: rgba(0,0,0,0.5); }
  .stage-vert li .arrow { color: rgba(0,0,0,0.35); }
  @media (max-width: 560px) { .stage-strip { display: none; } .stage-vert { display: block; } }
  .pipe-card { padding: 1rem; margin: 1rem 0; border-radius: 8px; background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
  .pipe-card.done { border-left: 4px solid #27ae60; }
  .pipe-card.blocked { border-left: 4px solid #f1c40f; }
  .pipe-card > a.title { display: block; text-decoration: none; color: inherit; }
  .pipe-card .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; flex-wrap: wrap; }
  .pipe-card .paper { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; font-size: 0.95rem; }
  .pipe-card .ttl { color: rgba(0,0,0,0.7); font-size: 0.9rem; margin-top: 0.25rem; }
  .pipe-card .herline { color: rgba(0,0,0,0.5); font-size: 0.85rem; margin-top: 0.25rem; }
  .pipe-card .tag { font-size: 0.8rem; }
  .pipe-card .tag.done { background: rgba(39,174,96,0.15); color: #166534; }
  .pipe-card .tag.block { background: rgba(241,196,15,0.15); color: #92400e; }
  .pipe-card .tag.act { background: rgba(52,152,219,0.15); color: #1e40af; }
  .pipe-nextbox { margin-top: 1rem; padding: 0.75rem 1rem; background: rgba(52,152,219,0.06); border-left: 4px solid #3498db; border-radius: 6px; }
  .pipe-nextbox.done { background: rgba(39,174,96,0.06); border-left-color: #27ae60; }
  .pipe-nextbox.teacher { background: rgba(241,196,15,0.06); border-left-color: #f1c40f; }
  .pipe-nextbox .lbl { font-weight: 600; color: rgba(0,0,0,0.65); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
  .pipe-nextbox .val { margin: 0.35rem 0; font-size: 1rem; }
  .pipe-nextbox .btn { display: inline-block; padding: 0.4rem 0.85rem; background: #0052CC; color: white; border-radius: 6px; text-decoration: none; font-weight: 500; font-size: 0.9rem; }
  .pipe-nextbox .btn:hover { background: #0747A6; }
  .stage-list { list-style: none; padding: 0; margin: 1rem 0; }
  .stage-list li { padding: 1rem; margin: 0.5rem 0; border-radius: 8px; background: rgba(0,0,0,0.02); border-left: 4px solid rgba(0,0,0,0.15); }
  .stage-list li.done { border-left-color: #27ae60; background: rgba(39,174,96,0.04); }
  .stage-list li.current { border-left-color: #3498db; background: rgba(52,152,219,0.04); }
  .stage-list li.waiting { border-left-color: rgba(0,0,0,0.15); }
  .stage-list li.teacher:not(.done) { border-left-color: #f1c40f; }
  .stage-list li > a { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; text-decoration: none; color: inherit; }
  .stage-list .stage-row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
  .stage-list .left { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 0; }
  .stage-list .num { min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(0,0,0,0.06); font-weight: 700; font-size: 0.9rem; }
  .stage-list li.done .num { background: rgba(39,174,96,0.2); color: #166534; }
  .stage-list li.current .num { background: rgba(52,152,219,0.2); color: #1e40af; }
  .stage-list .body { flex: 1; min-width: 0; }
  .stage-list .ttl { font-weight: 600; }
  .stage-list .sub { font-size: 0.85rem; color: rgba(0,0,0,0.55); margin-top: 0.15rem; }
  .stage-list .tag { font-size: 0.8rem; padding: 0.25rem 0.65rem; border-radius: 999px; background: rgba(0,0,0,0.06); white-space: nowrap; }
  .stage-list .tag.done { background: rgba(39,174,96,0.15); color: #166534; }
  .stage-list .tag.current { background: rgba(52,152,219,0.15); color: #1e40af; }
  .stage-list .tag.waiting { background: rgba(0,0,0,0.06); }
  .stage-list .tag.teacher { background: rgba(241,196,15,0.15); color: #92400e; }
  .pipe-footer { font-size: 0.85rem; color: rgba(0,0,0,0.55); text-align: center; margin: 2rem 0 1rem; }
  .pipe-exit { text-align: center; padding: 1rem 0; }
  .pipe-exit a { color: #0052CC; text-decoration: none; }
  .pipe-exit a:hover { text-decoration: underline; }
  .pipe-back { display: inline-block; margin-bottom: 0.75rem; color: #0052CC; text-decoration: none; font-weight: 500; }
  .pipe-back:hover { text-decoration: underline; }
}

/* ---------- 11. STEPPER / GEM / FORM PAGES ---------- */
@layer components {
  .ideal-stepper { list-style: none; padding: 0; margin: 1.5rem 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
  .ideal-stepper li { flex: 1; min-width: 100px; display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.75rem; border-left: 4px solid rgba(0,0,0,0.15); background: rgba(0,0,0,0.03); border-radius: 6px; font-size: 0.875rem; }
  .ideal-stepper li.s-done { border-left-color: #27ae60; background: rgba(39,174,96,0.06); }
  .ideal-stepper li.s-active { border-left-color: #3498db; background: rgba(52,152,219,0.08); outline: 2px solid rgba(52,152,219,0.4); }
  .ideal-stepper li.s-blocked { border-left-color: #c0392b; background: rgba(192,57,43,0.06); }
  .ideal-stepper li.s-waiting { border-left-color: rgba(0,0,0,0.15); }
  .ideal-stepper li.s-locked { opacity: 0.55; }
  .ideal-stepper .num { min-width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(0,0,0,0.08); font-weight: 700; font-size: 0.85rem; }
  .ideal-stepper li.s-done .num { background: rgba(39,174,96,0.25); color: #166534; }
  .ideal-stepper li.s-active .num { background: rgba(52,152,219,0.25); color: #1e40af; }
  .ideal-stepper .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .ideal-stepper .label { font-weight: 600; font-size: 0.875rem; }
  .ideal-stepper .meta { font-size: 0.75rem; color: rgba(0,0,0,0.55); }
  @media (max-width: 768px) { .ideal-stepper { flex-direction: column; gap: 0.75rem; } .ideal-stepper li { width: 100%; min-width: 100%; } }
  .gem-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
  .gem-title { font-size: 1.5rem; font-weight: 700; margin: 0; }
  .gem-purpose { color: rgba(0,0,0,0.6); margin: 0.35rem 0 0; font-size: 0.95rem; }
  .stage-pill { display: inline-block; padding: 0.35rem 0.8rem; background: rgba(0,82,204,0.1); color: #0052CC; border-radius: 999px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
  .progress-banner { padding: 1rem 1.25rem; border-radius: 8px; background: rgba(52,152,219,0.08); border-left: 4px solid #3498db; margin: 1rem 0; font-size: 0.95rem; line-height: 1.5; }
  .gem-warning-box { padding: 0.75rem 1rem; margin: 1rem 0; border: 1px solid #fdba74; border-radius: 8px; background: #fff7ed; color: #9a3412; font-size: 0.92rem; }
  .gem-warning-box a { color: #9a3412; font-weight: 700; text-decoration: underline; }
  .gem-warn-text { color: #92400e; }
  .gem-flow { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 1rem 0; margin: 0.5rem 0; }
  .gem-flow .step { display: flex; align-items: center; gap: 0.5rem; padding: 0.65rem 0.9rem; background: rgba(0,0,0,0.03); border-radius: 8px; flex: 1; min-width: 130px; }
  .gem-flow .n { min-width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: #0052CC; color: white; font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
  .gem-flow .ico { font-size: 1.4rem; flex-shrink: 0; }
  .gem-flow .body { flex: 1; min-width: 0; }
  .gem-flow .title { font-weight: 600; font-size: 0.9rem; }
  .gem-flow .sub { font-size: 0.78rem; color: rgba(0,0,0,0.55); }
  .gem-flow .arrow { color: rgba(0,0,0,0.35); font-size: 1.2rem; flex-shrink: 0; }
  .slots { display: flex; flex-direction: column; gap: 1rem; margin: 1rem 0; }
  .slot { padding: 1rem; border-radius: 8px; border: 1px solid rgba(0,0,0,0.1); background: white; }
  .slot.saved { border-color: rgba(39,174,96,0.4); background: rgba(39,174,96,0.03); }
  .slot-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; gap: 0.5rem; flex-wrap: wrap; }
  .slot-title { font-weight: 700; font-size: 1rem; }
  .slot-status { font-size: 0.85rem; color: rgba(0,0,0,0.55); }
  .slot.saved .slot-status { color: #166534; font-weight: 600; }
  .gem-saved { padding: 0.75rem; background: rgba(0,0,0,0.03); border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; max-height: 300px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; margin: 0.5rem 0; }
  .gem-paste { width: 100%; padding: 0.75rem; box-sizing: border-box; border: 1px solid rgba(0,0,0,0.15); border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; min-height: 150px; resize: vertical; }
  .step-list { list-style: none; padding: 0; margin: 0; }
  .step-list li { display: flex; gap: 0.75rem; padding: 1rem 0; border-bottom: 1px solid rgba(0,0,0,0.06); }
  .step-list li.active { background: rgba(52,152,219,0.04); }
  .panel-slot { margin-top: 1.5rem; padding: 1rem; background: rgba(52,152,219,0.06); border-left: 4px solid #3498db; border-radius: 6px; }
  .form-inline { margin: 0; }
  .pwa-banner { display: none; position: fixed; bottom: 20px; left: 50%; background: #2c3e50; color: #fff; padding: 15px 25px; border-radius: 8px; z-index: 9999; align-items: center; gap: 15px; font-family: sans-serif; transform: translateX(-50%); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
  .pwa-banner-btn { background: #27ae60; color: #fff; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-weight: bold; }
  .brand-dot-warn { color: var(--ideal-warning, #f39c12); }
  .hint-box { padding: 0.75rem; background: rgba(52,152,219,0.08); border-left: 3px solid #3498db; border-radius: 6px; margin-bottom: 0.5rem; }
}

/* ---------- 11b. Master Stepper + Hero card (Mere Kaam / task_hub) ---------- */
.stepper-wrap {
    display: flex;
    justify-content: space-between;
    margin-bottom: 32px;
    position: relative;
    padding: 0 20px;
}
.stepper-line {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--ideal-border);
    z-index: 1;
}
.step-item {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 80px;
}
.step-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    background: var(--ideal-surface);
    border: 3px solid var(--ideal-border);
    /* TODO(color-debt): #9ca3af has no CSS var yet */
    color: #9ca3af;
    transition: all 0.3s;
}
.step-item.active .step-circle {
    /* TODO(color-debt): #3b82f6 / #eff6ff have no CSS vars yet */
    border-color: #3b82f6;
    background: #eff6ff;
    color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}
.step-item.completed .step-circle {
    border-color: var(--ideal-success);
    background: var(--ideal-success);
    color: var(--ideal-surface);
}
.step-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ideal-muted);
    text-align: center;
}
.step-item.active .step-label {
    color: #3b82f6;
}

.hero-card {
    background: var(--ideal-surface);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    /* TODO(color-debt): #f3f4f6 has no CSS var yet */
    border: 1px solid #f3f4f6;
}
.hero-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--ideal-text);
    margin-bottom: 12px;
}
.hero-text {
    font-size: 1.05rem;
    color: var(--ideal-muted);
    margin-bottom: 32px;
    line-height: 1.6;
}

/* ---------- 12. TEACHER PAGES ---------- */
@layer components {
  .banner-warning { padding: 1rem 1.25rem; margin-bottom: 1rem; border: 3px solid #b45309; border-radius: 8px; background: #fffbeb; }
  .banner-warning h2 { margin: 0 0 0.4rem; font-size: 1rem; color: #b45309; font-weight: 700; }
  .banner-warning ul { margin: 0.3rem 0 0.8rem 1.2rem; padding: 0; }
  .banner-warning .banner-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
  .btn-banner { display: inline-block; padding: 0.55rem 0.9rem; min-height: 44px; line-height: 1.2; background: #1e40af; color: #fff; font-weight: 700; text-decoration: none; border-radius: 6px; border: none; cursor: pointer; font-family: inherit; }
  .btn-banner:hover { background: #1e3a8a; }
  .btn-banner-danger { background: #fff; color: #b91c1c; border: 1px solid #b91c1c; }
  .btn-banner-danger:hover { background: rgba(185,28,28,0.06); }
  .students-list label { display: block; padding: 0.35rem 0.5rem; cursor: pointer; border-radius: 4px; }
  .students-list label:hover { background: rgba(0,0,0,0.03); }
  .form-label { display: block; font-weight: 600; margin: 0.5rem 0 0.25rem; }
  .form-submit { margin-top: 1rem; }
  .lead { font-size: 1.05rem; color: rgba(0,0,0,0.65); margin: 0.5rem 0 1rem; }
  .note { font-size: 0.875rem; color: rgba(0,0,0,0.55); margin-top: 0.25rem; }
  .mh { font-size: 0.8rem; color: rgba(0,0,0,0.55); margin-bottom: 0.25rem; }
  .status { font-size: 0.9rem; padding: 0.35rem 0.75rem; border-radius: 999px; }
  .status.off { background: rgba(0,0,0,0.06); color: rgba(0,0,0,0.55); }
  .status.on { background: rgba(39,174,96,0.15); color: #166534; font-weight: 600; }
  @keyframes kpiFlash { 0% { background: rgba(52,152,219,0.25); } 100% { background: rgba(0,0,0,0); } }
  .kpi.flash { animation: kpiFlash 0.9s ease-out 1; }
  .controls { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 1rem 0; }
  .doc-header { padding-bottom: 1rem; border-bottom: 2px solid rgba(0,0,0,0.1); margin-bottom: 1.5rem; }
  .doc-meta { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.5rem; flex-wrap: wrap; }
  .doc-tag { font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; color: rgba(0,0,0,0.55); font-weight: 600; }
  .doc-lede { font-size: 1rem; line-height: 1.6; color: rgba(0,0,0,0.65); margin-top: 0.5rem; }
  .doc-section { margin: 1.5rem 0; }
  .doc-alert { padding: 0.75rem 1rem; border-radius: 6px; border-left: 4px solid; background: rgba(39,174,96,0.08); border-left-color: #16a34a; color: #166534; margin: 0.75rem 0; }
  .doc-alert--error { padding: 0.75rem 1rem; border-radius: 6px; border-left: 4px solid; background: rgba(192,57,43,0.08); border-left-color: #dc2626; color: #7f1d1d; margin: 0.75rem 0; }
  .doc-body { margin-bottom: 0.5rem; }
  .request-card { border: 1px solid #d0d5dd; border-radius: 8px; padding: 14px; margin: 10px 0; }
  .request-meta { font-size: 0.875rem; color: #6b7280; }
  .request-reason { font-size: 0.875rem; margin: 8px 0; background: #f9fafb; padding: 8px; border-radius: 6px; }
  .request-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
  .request-note-input { flex: 1; min-width: 180px; padding: 8px; border: 1px solid #d0d5dd; border-radius: 6px; font-family: inherit; font-size: 0.9rem; }
  .back-line { margin: 1rem 0; }
  .back-line a { color: #0052CC; text-decoration: none; font-weight: 500; }
  .back-line a:hover { text-decoration: underline; }
  .big-link { display: inline-block; padding: 0.75rem 1.25rem; background: rgba(0,82,204,0.08); color: #0052CC; text-decoration: none; border-radius: 8px; font-weight: 600; margin: 0.5rem 0; }
  .big-link:hover { background: rgba(0,82,204,0.15); }
  .big-link.ext::after { content: " \2197"; }
  .link-row { margin: 1rem 0; }
  .stepper { padding: 1rem; border-radius: 8px; background: rgba(0,0,0,0.02); margin: 1rem 0; }
  .progress-text { font-size: 0.9rem; color: rgba(0,0,0,0.65); margin-top: 0.75rem; text-align: center; }
  .complete-card { text-align: center; padding: 2rem 1.5rem; background: rgba(39,174,96,0.06); border-radius: 12px; margin: 1.5rem 0; }
  .complete-icon { font-size: 3rem; color: #27ae60; font-weight: 700; margin-bottom: 0.75rem; }
  .next-actions { display: flex; gap: 0.75rem; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 1.25rem; }
  .step-card { padding: 1.5rem; border-radius: 8px; background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin: 1rem 0; }
  .step-card .block { margin: 1rem 0; }
  .step-card .block h3 { margin: 0 0 0.5rem; font-size: 1rem; font-weight: 600; }
  .step-card .block ol, .step-card .block ul { padding-left: 1.25rem; margin: 0.5rem 0; }
  .step-card .block li { margin: 0.35rem 0; }
  .stuck { padding: 0.75rem 1rem; border-radius: 6px; background: rgba(241,196,15,0.1); border-left: 4px solid #f1c40f; font-size: 0.9rem; }
  .reset-form { margin: 1rem auto; text-align: center; max-width: 400px; }
}

/* ---------- 13. VIOLATIONS / OPS ---------- */
@layer components {
  .violation-form { display: grid; gap: 14px; margin-top: 14px; }
  .violation-label { display: block; }
  .violation-label-text { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
  .violation-strike { color: #b42318; font-weight: 700; }
  .evidence-cell { max-width: 320px; }
  .no-violations { margin-top: 12px; color: #6b7280; }
  .ops-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
  .ops-bar h1 { margin: 0; }
  .ops-bar-meta { font-size: 0.82rem; color: rgba(0,0,0,0.55); margin-top: 0.25rem; }
  .ops-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
  .ops-refresh-btn { background: #ffebe6; color: #b92500; font-weight: 700; padding: 0.5rem 1rem; border: none; border-radius: 6px; cursor: pointer; font-family: inherit; font-size: 0.9rem; }
  .ops-refresh-btn:hover { background: #fdd; }
  .ops-btn-sec { background: rgba(0,0,0,0.06); color: rgba(0,0,0,0.75); padding: 0.5rem 1rem; border: none; border-radius: 6px; cursor: pointer; font-family: inherit; font-size: 0.9rem; font-weight: 500; }
  .ops-btn-sec:hover { background: rgba(0,0,0,0.1); }
  .ops-kpi { display: flex; gap: 0.5rem; flex-wrap: wrap; padding: 1rem; background: rgba(0,0,0,0.02); border-radius: 8px; margin-bottom: 1rem; }
  .ops-cell { flex: 1; min-width: 110px; padding: 0.75rem; text-align: center; background: white; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
  .ops-cell b { display: block; font-size: 1.5rem; line-height: 1; }
  .ops-cell span { font-size: 0.75rem; color: rgba(0,0,0,0.55); text-transform: uppercase; letter-spacing: 0.03em; }
  .ops-cell--good { border-left: 4px solid #27ae60; }
  .ops-cell--warn { border-left: 4px solid #f59e0b; }
  .ops-cell--crit { border-left: 4px solid #c0392b; }
  .ops-details { background: white; border-radius: 8px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
  .ops-summary { cursor: pointer; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; list-style: revert; user-select: none; color: #0052CC; }
  .ops-summary-hint { font-weight: 400; font-size: 0.78rem; text-transform: none; letter-spacing: 0; margin-left: 0.6rem; color: rgba(0,0,0,0.55); }
  .ops-live-row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; padding: 0.5rem 0; border-bottom: 1px solid rgba(0,0,0,0.05); }
  .ops-live-row:last-child { border-bottom: none; }
  .ops-live-row b { min-width: 80px; }
  .ops-mins { margin-left: auto; font-size: 0.8rem; color: rgba(0,0,0,0.55); }
  .ops-empty { padding: 1rem; text-align: center; color: rgba(0,0,0,0.5); }
  .ops-filter-row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin: 1rem 0 0.8rem; }
  .ops-filter-label { font-size: 0.82rem; color: rgba(0,0,0,0.55); }
  .ops-filter-select { padding: 4px 6px; border-radius: 4px; font-size: 0.85rem; min-width: 160px; border: 2px solid rgba(0,0,0,0.15); font-family: inherit; }
  .ops-filter-count { font-size: 0.82rem; margin-left: auto; color: rgba(0,0,0,0.55); }
  .ops-hint { background: #f0f9ff; border-left: 4px solid #0369a1; padding: 0.85rem 1rem; border-radius: 4px; margin: 1rem 0; font-size: 0.9rem; }
  .ops-table-hidden-init { display: none; }
  .ops-alerts-table { width: 100%; border-collapse: collapse; }
  .ops-alerts-table th, .ops-alerts-table td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.06); }
  .ops-alerts-table th { font-weight: 600; font-size: 0.85rem; color: rgba(0,0,0,0.65); }
  .ops-sitrep { padding: 1rem; background: rgba(0,0,0,0.03); border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; max-height: 400px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }
}

/* ---------- 14. OPTION 1 SEMANTIC (breadcrumb, disclosure, portal-state, chw) ---------- */
@layer components {
  .breadcrumb { font-size: 0.875rem; margin: 0.5rem 0; }
  .breadcrumb a { color: #0052CC; text-decoration: none; font-weight: 500; }
  .breadcrumb a:hover { text-decoration: underline; }
  .breadcrumb .separator { color: rgba(0,0,0,0.4); margin: 0 0.35rem; }
  .disclosure { background: white; border-radius: 8px; margin: 0.5rem 0; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
  .disclosure > summary { display: flex; align-items: center; gap: 0.75rem; padding: 1rem; cursor: pointer; list-style: none; font-weight: 600; }
  .disclosure > summary::-webkit-details-marker { display: none; }
  .disclosure > summary::after { content: "\25B8"; margin-left: auto; color: rgba(0,0,0,0.4); font-size: 0.8rem; transition: transform 0.15s; }
  .disclosure[open] > summary::after { transform: rotate(90deg); }
  .disclosure-body { padding: 0 1rem 1rem; line-height: 1.6; }
  .policy-index { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,0.08); font-size: 0.8rem; font-weight: 600; flex-shrink: 0; }
  .grid-2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
  @media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
  .sticky-bar { position: sticky; top: 0; z-index: 10; background: white; padding: 0.75rem 0; border-bottom: 2px solid rgba(0,0,0,0.1); margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
  .kpi-grid-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin: 1rem 0; }
  .empty-state-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(39,174,96,0.12); color: #27ae60; font-size: 1.2rem; margin-bottom: 0.5rem; }
  .empty-state-title { display: block; font-weight: 600; margin-bottom: 0.25rem; color: rgba(0,0,0,0.75); }
  .collapsible-section { border-radius: 8px; margin: 1rem 0; }
  .collapsible-section > summary { cursor: pointer; list-style: none; padding: 0.75rem 1rem; background: rgba(0,0,0,0.03); border-radius: 8px; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-weight: 600; }
  .collapsible-section > summary::-webkit-details-marker { display: none; }
  .collapsible-section > summary::after { content: "\25BC"; font-size: 0.7rem; color: rgba(0,0,0,0.5); }
  .collapsible-section[open] > summary::after { content: "\25B2"; }
  .portal-state { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-radius: 8px; flex-wrap: wrap; }
  .portal-state-on { background: rgba(39,174,96,0.08); border-left: 4px solid #27ae60; }
  .portal-state-off { background: rgba(192,57,43,0.06); border-left: 4px solid #c0392b; }
  .portal-state-icon { font-size: 1.5rem; flex-shrink: 0; }
  .portal-state-text { flex: 1; min-width: 200px; }
  .portal-state-title { display: block; font-weight: 700; }
  .portal-state-sub { display: block; font-size: 0.9rem; color: rgba(0,0,0,0.65); margin-top: 0.25rem; }
  .portal-state-action { flex-shrink: 0; }
  .pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1.5rem 0; flex-wrap: wrap; }
  .pagination-btn { display: inline-block; padding: 0.4rem 0.9rem; border-radius: 6px; background: rgba(0,0,0,0.06); color: rgba(0,0,0,0.75); text-decoration: none; font-weight: 500; font-size: 0.9rem; }
  .pagination-btn:hover { background: rgba(0,0,0,0.1); }
  .pagination-btn.disabled { opacity: 0.4; cursor: not-allowed; }
  .pagination-info { font-size: 0.875rem; color: rgba(0,0,0,0.55); }
  .chw-toolbar { display: flex; align-items: center; gap: 0.75rem; margin: 1rem 0; flex-wrap: wrap; justify-content: space-between; }
  .chw-table { width: 100%; border-collapse: collapse; }
  .chw-table th, .chw-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid rgba(0,0,0,0.08); vertical-align: middle; }
  .chw-table th { font-weight: 600; font-size: 0.8rem; color: rgba(0,0,0,0.65); text-transform: uppercase; letter-spacing: 0.03em; }
  .chw-cell { text-align: center; width: 60px; }
  .chw-switch { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
  .chw-switch input { opacity: 0; width: 0; height: 0; }
  .chw-slider { position: absolute; inset: 0; background: rgba(0,0,0,0.2); border-radius: 22px; transition: background 0.2s; }
  .chw-slider::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: transform 0.2s; }
  .chw-switch input:checked + .chw-slider { background: #27ae60; }
  .chw-switch input:checked + .chw-slider::before { transform: translateX(18px); }
  .chw-saved-pill { display: inline-block; margin-left: 0.5rem; padding: 0.1rem 0.4rem; background: rgba(39,174,96,0.15); color: #166534; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
  .chw-name { color: #0052CC; text-decoration: none; font-weight: 500; }
  .chw-name:hover { text-decoration: underline; }
  .chw-stars { display: inline-flex; gap: 0.15rem; }
  .chw-star { cursor: pointer; font-size: 1.2rem; position: relative; display: inline-block; }
  .chw-star input { opacity: 0; position: absolute; width: 100%; height: 100%; margin: 0; cursor: pointer; }
  .chw-star span { color: rgba(0,0,0,0.2); }
  .chw-star input:checked + span { color: #fbbf24; }
  .chw-pts { font-weight: 600; text-align: center; }
  .chw-diary-toggle > summary { cursor: pointer; font-size: 0.85rem; color: #0052CC; }
}

/* ---------- 15. PIPELINE DETAIL ---------- */
@layer components {
  .glossary-searchbox label { font-weight: 600; margin-bottom: 0.5rem; display: block; }
  .glossary-searchbox input[type="search"] { width: 100%; padding: 0.75rem 1rem; border: 1px solid rgba(0,0,0,0.15); border-radius: 8px; font-size: 1rem; box-sizing: border-box; }
  #glossary-panel { display: none; position: relative; max-height: 400px; overflow-y: auto; margin-top: 0.5rem; }
  #glossary-panel.open { display: block; }
  .hit { padding: 0.5rem 1rem; border-bottom: 1px solid rgba(0,0,0,0.08); cursor: pointer; }
  .hit:hover { background: rgba(0,0,0,0.04); }
  .hit:last-child { border-bottom: none; }
  .hit-term { font-weight: 600; }
  .hit-def { font-size: 0.9rem; color: rgba(0,0,0,0.55); }
  .hit mark { background: rgba(255,193,7,0.4); padding: 0 2px; border-radius: 2px; }
  #glossary-detail { display: none; margin-top: 1rem; }
  #glossary-detail.open { display: block; }
  .glossary-term { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.25rem; }
  .glossary-sub { color: rgba(0,0,0,0.55); font-size: 0.9rem; }
  .glossary-kc { margin-top: 0.75rem; font-size: 0.9rem; color: rgba(0,0,0,0.55); }
  .glossary-kc a { color: #0052CC; }
  #glossary-empty { display: none; padding: 1rem; text-align: center; background: rgba(0,0,0,0.03); border-radius: 8px; margin-top: 1rem; }
  .detail-back { display: inline-block; margin: 1rem 0; color: #0052CC; text-decoration: none; font-weight: 500; }
  .detail-back:hover { text-decoration: underline; }
  .detail-card { padding: 1rem; border-bottom: 1px solid rgba(0,0,0,0.08); }
  .detail-card .detail-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; gap: 0.5rem; flex-wrap: wrap; }
  .detail-card .detail-subject { font-weight: 700; font-size: 1.05rem; }
  .detail-card .detail-score { font-weight: 600; padding: 0.25rem 0.75rem; background: rgba(0,0,0,0.05); border-radius: 6px; }
  .detail-card .detail-band { display: inline-block; margin-left: 0.5rem; padding: 0.2rem 0.6rem; background: rgba(241,196,15,0.15); border-radius: 999px; font-size: 0.85rem; }
  .detail-card .detail-wrong { color: #c0392b; }
  .detail-card .detail-right { color: #27ae60; }
  .detail-card .detail-h { font-weight: 600; margin: 0; }
  .detail-card .detail-icon { margin-right: 0.5rem; }
  .detail-card details { margin-top: 1rem; }
  .detail-card summary { cursor: pointer; font-weight: 600; margin: 0.5rem 0; }
  .detail-card .detail-box { padding: 0.75rem; background: rgba(0,0,0,0.03); border-radius: 6px; margin-top: 0.5rem; }
  .detail-steps { margin-top: 1rem; }
  .detail-step { padding: 0.75rem 1rem; border-left: 4px solid rgba(0,0,0,0.1); background: rgba(0,0,0,0.02); margin: 0.5rem 0; border-radius: 6px; }
  .detail-step.done { border-left-color: #27ae60; background: rgba(39,174,96,0.05); }
  .detail-step.active { border-left-color: #3498db; background: rgba(52,152,219,0.05); }
  .detail-step.locked { opacity: 0.55; }
  .detail-step .detail-hint { font-size: 0.9rem; color: rgba(0,0,0,0.55); margin: 0.25rem 0; }
  .detail-step .detail-progress-line { font-size: 0.85rem; color: rgba(0,0,0,0.55); margin-bottom: 0.5rem; }
  .detail-step .detail-progress-bar { height: 8px; background: rgba(0,0,0,0.08); border-radius: 4px; overflow: hidden; margin-bottom: 1rem; }
  .detail-progress-bar progress { width: 100%; height: 100%; appearance: none; -webkit-appearance: none; border: none; }
  .detail-progress-bar progress::-webkit-progress-bar { background: rgba(0,0,0,0.08); }
  .detail-progress-bar progress::-webkit-progress-value { background: #3498db; }
  .detail-progress-bar progress::-moz-progress-bar { background: #3498db; }
  .detail-step .act { background: #0052CC; color: white; padding: 0.5rem 1rem; border: none; border-radius: 6px; cursor: pointer; font-weight: 500; margin-top: 0.5rem; }
  .detail-step .act:hover { background: #0747A6; }
  .detail-step .act:disabled { opacity: 0.5; cursor: not-allowed; }
  .detail-step .faded { padding: 0.75rem; background: rgba(0,0,0,0.03); border-radius: 6px; margin: 0.5rem 0; line-height: 1.8; }
  .detail-step .faded .blank { display: inline-block; min-width: 80px; padding: 0.25rem 0.5rem; border: 1px solid rgba(0,0,0,0.2); border-radius: 4px; font-family: inherit; font-size: inherit; }
  .detail-step .rewrite { width: 100%; padding: 0.75rem; border: 1px solid rgba(0,0,0,0.15); border-radius: 6px; font-family: inherit; font-size: 1rem; min-height: 100px; resize: vertical; box-sizing: border-box; }
  .detail-steps .msg { padding: 0.5rem 1rem; border-radius: 6px; margin-top: 0.75rem; display: none; }
  .detail-steps .msg.ok { display: block; background: rgba(39,174,96,0.1); color: #166534; }
  .detail-steps .msg.err { display: block; background: rgba(192,57,43,0.1); color: #7f1d1d; }
}

/* ---------- 16. UTILITIES ---------- */
@layer utilities {
  .text-muted { color: var(--ideal-muted) !important; }
  .text-center { text-align: center !important; }
  .text-right { text-align: right !important; }
  .text-left { text-align: left !important; }
  .text-2xl { font-size: 1.5rem; line-height: 1.3; }
  .text-sm { font-size: 0.875rem; }
  .text-xs { font-size: 0.75rem; }
  .text-lg { font-size: 1.125rem; }
  .text-base { font-size: 1rem; }
  .text-md { font-size: 1.1rem; }
  .font-bold { font-weight: 700; }
  .underline { text-decoration: underline; }
  .no-underline { text-decoration: none; }
  .u-color-27ae60 { color: var(--ideal-success) !important; }
  .u-color-dc2626 { color: var(--ideal-danger) !important; }
  .u-text-center { text-align: center !important; }
  .u-width-100 { width: 100% !important; }
  .u-bg-white, .u-background-fff { background: var(--ideal-surface) !important; }
  .u-display-flex, .d-flex { display: flex !important; }
  .u-flex-column { flex-direction: column !important; }
  .u-justify-content-space-between, .justify-between { justify-content: space-between !important; }
  .u-align-items-center, .align-center { align-items: center !important; }
  .align-items-start { align-items: flex-start !important; }
  .d-inline { display: inline !important; }
  .d-inline-block { display: inline-block; }
  .d-block { display: block; }
  .hidden { display: none !important; }
  .is-hidden { display: none !important; visibility: hidden !important; }
  .d-none { display: none !important; }
  .flex-wrap { flex-wrap: wrap; }
  .flex-1 { flex: 1 1 auto; min-width: 0; }
  .flex-shrink-0 { flex-shrink: 0; }
  .border-0 { border: 0; }
  .border-b { border-bottom: 1px solid rgba(0,0,0,0.06); }
  .py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .py-4 { padding-top: 1rem; padding-bottom: 1rem; }
  .p-6 { padding: 1.5rem; }
  .p-0 { padding: 0; }
  .w-100 { width: 100%; }
  .whitespace-pre-wrap { white-space: pre-wrap; }
  .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
  .text-primary { color: #0052CC; }
  .text-danger { color: #b42318; }
  .text-positive { color: #27ae60; font-weight: 600; }
  .list-plain { list-style: none; padding: 0; margin: 0; }
  .input-narrow { max-width: 120px; }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .ml-auto { margin-left: auto; }
  .ml-3 { margin-left: 0.6rem; }
  .mt-2 { margin-top: var(--ideal-space-2) !important; }
  .mt-3 { margin-top: 0.75rem; }
  .mt-4 { margin-top: var(--ideal-space-4) !important; }
  .mb-2 { margin-bottom: var(--ideal-space-2) !important; }
  .mb-4 { margin-bottom: 1rem !important; }
  .my-2 { margin-top: 0.5rem; margin-bottom: 0.5rem; }
  .my-4 { margin-top: 1rem; margin-bottom: 1rem; }
  .leading-tight { line-height: 1.35; }
  .gap-2 { gap: var(--ideal-space-2) !important; }
  .gap-4 { gap: 1rem; }
  .pl-20 { padding-left: 20px !important; }
  .icon-xl { font-size: 2rem; }
  .grid-full { grid-column: 1 / -1; }
  .summary-clean { cursor: pointer; list-style: none; }
  .skip { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
  .skip:focus, .skip:active { position: static; width: auto; height: auto; left: auto; overflow: visible; background: #fff; padding: 0.5rem 1rem; border: 2px solid #333; border-radius: 4px; }
  .m-0 { margin: 0 !important; }
  .btn-large { padding: 0.75rem 1.5rem; font-size: 1.05rem; font-weight: 600; }
  .btn-block { width: 100%; display: block; margin: 0.5rem 0; }
  @media (max-width: 768px) {
    .u-display-flex, .d-flex { flex-direction: column !important; gap: var(--ideal-space-2) !important; }
  }
}

/* ---------- 17. SHARE / OUTPUT / TOAST / DEV ---------- */
@layer components {
  .share-url { display: block; padding: 1rem; background: rgba(0,0,0,0.04); border-radius: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; text-align: center; color: inherit; }
  .ideal-textarea { width: 100%; padding: 0.75rem 1rem; border: 1px solid rgba(0,0,0,0.15); border-radius: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9rem; min-height: 300px; resize: vertical; background: white; color: inherit; box-sizing: border-box; }
  .output-block { display: block; padding: 1rem; background: rgba(0,0,0,0.04); border-radius: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; overflow-x: auto; max-height: 400px; overflow-y: auto; margin: 0; }
  progress.progress-native { width: 100%; height: 24px; appearance: none; -webkit-appearance: none; border: none; border-radius: 8px; overflow: hidden; background: rgba(0,0,0,0.08); }
  progress.progress-native::-webkit-progress-bar { background: rgba(0,0,0,0.08); border-radius: 8px; }
  progress.progress-native::-webkit-progress-value { background: rgba(52,152,219,0.85); border-radius: 8px; transition: width 0.3s ease; }
  progress.progress-native::-moz-progress-bar { background: rgba(52,152,219,0.85); border-radius: 8px; }
  .toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); padding: 12px 20px; border-radius: 8px; background: #2c3e50; color: white; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease; z-index: 9999; max-width: 90vw; text-align: center; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
  .toast.ok { background: #27ae60; }
  .toast.err { background: #c0392b; }
  .dev-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0; border-bottom: 1px solid rgba(0,0,0,0.08); flex-wrap: wrap; }
  .dev-row:last-child { border-bottom: none; }
  .dev-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dev-fp { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; color: rgba(0,0,0,0.55); flex-shrink: 0; }
  .dev-row .ideal-input { flex: 1; min-width: 100px; max-width: 200px; }
  .qtext { font-size: 1.1rem; line-height: 1.6; margin: 1rem 0; }
  .meta { font-size: 0.875rem; }
  .hint { font-size: 0.85rem; margin-top: 0.5rem; }
  .answer { padding: 1rem; background: rgba(0,0,0,0.03); border-radius: 8px; line-height: 1.6; }
  .btn-good { background: #27ae60; color: white; padding: 0.5rem 1rem; border-radius: 8px; border: none; cursor: pointer; }
  .btn-warn { background: #e67e22; color: white; padding: 0.5rem 1rem; border-radius: 8px; border: none; cursor: pointer; }
  .self-report { padding-top: 1rem; border-top: 1px solid rgba(0,0,0,0.08); }
  .band { padding: 1.5rem; border-radius: 12px; border-left: 6px solid; background: rgba(0,0,0,0.03); margin-top: 1rem; }
  .band--struck-off, .band--action { background: rgba(192,57,43,0.08); border-left-color: #c0392b; }
  .band--critical, .band--at-risk { background: rgba(230,126,34,0.08); border-left-color: #e67e22; }
  .band--watch { background: rgba(241,196,15,0.10); border-left-color: #f1c40f; }
  .band--neutral { background: rgba(149,165,166,0.08); border-left-color: #95a5a6; }
  .band--improving, .band--good { background: rgba(52,152,219,0.08); border-left-color: #3498db; }
  .band--excellent { background: rgba(39,174,96,0.08); border-left-color: #27ae60; }
  .band--default { background: rgba(0,0,0,0.03); border-left-color: #999; }
  .band-head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
  .band-ic { font-size: 2rem; line-height: 1; }
  .band-ttl { font-weight: 700; font-size: 1.15rem; }
  .band-chip { padding: 0.25rem 0.75rem; background: rgba(0,0,0,0.08); border-radius: 999px; font-size: 0.875rem; font-weight: 600; }
  .band-score { font-size: 3rem; font-weight: 800; line-height: 1; margin: 0.5rem 0; }
  .band-denom { font-size: 1.25rem; font-weight: 500; color: rgba(0,0,0,0.5); }
  .band-label { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
  .band-line { line-height: 1.6; margin: 0.5rem 0; }
  .band-damage { padding: 0.75rem; background: rgba(0,0,0,0.05); border-radius: 8px; font-size: 0.9rem; margin: 0.75rem 0; }
  .band-progress { width: 100%; height: 16px; appearance: none; -webkit-appearance: none; border: none; border-radius: 8px; overflow: hidden; background: rgba(0,0,0,0.08); margin: 1rem 0; }
  .band-progress::-webkit-progress-bar { background: rgba(0,0,0,0.08); border-radius: 8px; }
  .band-progress::-webkit-progress-value { background: #3498db; border-radius: 8px; }
  .band-progress::-moz-progress-bar { background: #3498db; border-radius: 8px; }
  .band-btn { display: inline-block; padding: 0.5rem 1rem; background: rgba(0,0,0,0.8); color: white; border-radius: 8px; text-decoration: none; font-weight: 600; margin-top: 0.75rem; }
  .band-btn:hover { background: rgba(0,0,0,0.9); }
  .metrics { gap: 1rem; }
  .metric { min-width: 100px; }
  .badge-chip { display: inline-block; padding: 0.35rem 0.75rem; background: rgba(255,193,7,0.15); color: #8a6d3b; border-radius: 999px; font-size: 0.85rem; margin: 0.25rem; }
  .flags { padding: 1rem; background: rgba(231,76,60,0.08); border-radius: 8px; }
  .pos { color: #27ae60; font-weight: 600; }
  .neg { color: #c0392b; font-weight: 600; }
  .empty { padding: 1.5rem; text-align: center; background: rgba(0,0,0,0.03); border-radius: 8px; }
  .footer { font-size: 0.85rem; text-align: center; margin-top: 2rem; }
  .doc-version { font-size: 0.85rem; }
  .subhead { border-bottom: 1px solid rgba(0,0,0,0.1); padding-bottom: 0.5rem; }
  .story { padding: 1rem; }
  .q { margin: 0.5rem 0; font-style: italic; }
  .text { line-height: 1.6; margin: 0.75rem 0; }
  .analogy { margin: 0.5rem 0; font-size: 0.9rem; }
  .comprehension { padding: 0.75rem; }
  .done { padding: 0.75rem; background: rgba(39,174,96,0.08); border-radius: 8px; }
  .rt { margin-top: 0.5rem; font-style: italic; }
  .err { padding: 0.75rem; background: rgba(231,76,60,0.08); border-radius: 8px; }
}

/* ---------- 18. URDU FONT (single canonical) ---------- */
@font-face {
  font-family: 'Jameel Noori Nastaleeq';
  src: url('fonts/JameelNooriNastaleeq.woff') format('woff');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
body, .question-text, .model-answer, .source-text, .urdu-text, .urdu-translation, [dir="rtl"] {
  font-family: 'Jameel Noori Nastaleeq', system-ui, -apple-system, sans-serif !important;
}
.urdu-text, .urdu-translation, [dir="rtl"] {
  line-height: 2.2 !important;
}

/* Floating Help Button (Added for UX Audit) */
.floating-help-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--ideal-primary, #0052CC);
    color: white;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.floating-help-btn:hover {
    transform: scale(1.05);
    background: var(--ideal-primary-dark, #0747A6);
}

/* 1-Minute Summary Accordion */
.urgent-summary { background: #fffbeb; border: 2px solid #f59e0b; border-radius: 8px; margin-bottom: 1.5rem; padding: 0.5rem; }
.urgent-summary summary { font-weight: 800; font-size: 1.1rem; color: #b45309; cursor: pointer; padding: 0.5rem; }
.urgent-summary .summary-content { padding: 1rem; background: white; border-radius: 6px; margin-top: 0.5rem; font-size: 1rem; line-height: 1.6; }
.guide-table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.9rem; }
.guide-table th, .guide-table td { border: 1px solid #e2e8f0; padding: 0.5rem; text-align: left; }
.guide-table th { background: #f8fafc; font-weight: 600; }

/* Trophy Count Visibility Fix */
.trophy-count-large {
    font-size: 3.5rem !important;
    font-weight: 900 !important;
    color: var(--ideal-primary, #0052CC) !important;
    line-height: 1 !important;
    margin: 1rem 0 !important;
    text-align: center !important;
}

/* Trophy Cabinet UI (2026-10-22) */
.trophy-icon {
    font-size: 2rem !important;
    line-height: 1 !important;
}


/* =========================================
   SUB-NAVIGATION TABS (Unified 2026-10-22)
   Standard: W3C ARIA navigation pattern, GOV.UK sub-nav
   ========================================= */
.ideal-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid var(--ideal-border, #dfe1e6);
    margin: 1rem 0 1.5rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
}
.ideal-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    min-height: 44px;
    color: var(--ideal-muted, #6b7280);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.ideal-tab:hover {
    color: var(--ideal-primary, #0052CC);
    background: var(--ideal-bg, #f5f5f5);
}
.ideal-tab[aria-current="page"] {
    color: var(--ideal-primary, #0052CC);
    border-bottom-color: var(--ideal-primary, #0052CC);
}
@media (max-width: 480px) {
    .ideal-tab {
        padding: 0.6rem 0.75rem;
        font-size: 0.875rem;
    }
}


/* =========================================
   GLOBAL GUIDE DRAWER (Urdu, RTL)
   ========================================= */
.global-guide-section {
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed var(--ideal-border, #dfe1e6);
}
.global-guide-section:last-child { border-bottom: none; padding-bottom: 0; }
.global-guide-section summary {
    list-style: none;
    cursor: pointer;
    padding: 0.75rem 0;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ideal-primary, #0052CC);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
}
.global-guide-section summary::-webkit-details-marker { display: none; }
.global-guide-section summary::before {
    content: "◂";
    display: inline-block;
    font-size: 0.75rem;
    color: var(--ideal-primary, #0052CC);
    transition: transform 0.2s;
    flex-shrink: 0;
}
.global-guide-section[open] summary::before { transform: rotate(-90deg); }
.global-guide-section p { margin: 0.5rem 0; line-height: 2; }
.global-guide-section ul { padding-left: 1.5rem; margin: 0.5rem 0; }
.global-guide-section li { margin: 0.35rem 0; line-height: 1.9; }
.global-guide-section strong { color: var(--ideal-text, #111); }
#global-help {
    font-family: inherit;
    direction: ltr;
    text-align: left;
}
#global-help h2, #global-help h3 { font-family: inherit; }
#global-help .help-drawer-body { font-size: 1.05rem; line-height: 2.2; }


/* =========================================
   GLOBAL HELP DRAWER & FAB (Industry Standard)
   ========================================= */
.help-fab {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1050;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--ideal-primary, #0d6efd);
    color: #ffffff;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
    padding: 0;
}

.help-fab:hover {
    transform: scale(1.08);
    background-color: #0b5ed7;
}

.help-fab svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

.help-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1055;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.help-overlay.is-open {
    display: block;
    opacity: 1;
}

.help-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 420px;
    height: 100vh;
    background: #ffffff;
    z-index: 1060;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    direction: ltr;
}

.help-drawer.is-open {
    right: 0;
}

.help-drawer-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.help-drawer-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    font-family: inherit;
    text-align: left;
    line-height: 2;
}

.help-drawer-body details {
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.help-drawer-body summary {
    font-weight: bold;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--ideal-primary, #0d6efd);
}

.help-drawer-body p {
    margin-top: 10px;
    color: #555;
    font-size: 1.05rem;
}


/* === Phase E.2: inline-style replacement utilities === */
.day-counter-wrapper { display: none; text-align: center; padding: 30px 20px; margin-top: 40px; border-top: 1px solid #eee; background: #f8f9fa; width: 100%; }
.day-counter-wrapper.is-visible,
.day-counter-wrapper.show-widget { display: block !important; }
.day-counter-title { font-weight: 800; color: #0d6efd; margin-bottom: 10px; }
.day-counter-actions { display: flex; justify-content: center; gap: 10px; margin-top: 15px; }


.help-drawer-title { font-size: 1.2rem; font-weight: bold; }


/* Per-page guides use .help-btn for close button - override to look like close button */
.help-drawer-header .help-btn {
    position: static !important;
    width: auto !important;
    height: auto !important;
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 8px 12px !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: #0f172a !important;
    box-shadow: none !important;
    z-index: auto !important;
    font-size: 1.5rem !important;
    border: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
}

.help-drawer-header .help-btn:hover {
    background: #e2e8f0 !important;
    color: #dc2626 !important;
}
.help-drawer-intro { font-size: 1.05rem; color: var(--ideal-muted); margin-bottom: 1rem; }
.guide-section-item { margin-bottom: 15px; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.guide-section-summary { font-weight: bold; cursor: pointer; color: var(--ideal-primary); font-size: 1.1rem; }
.guide-section-body { margin-top: 10px; color: #555; }


/* === Phase E.5: final inline-style replacements === */
.dm-btn-locked  { background:#f3f4f6; color:#9ca3af; border:1px solid #e5e7eb; cursor:not-allowed; padding:4px 12px; }
.dm-btn-change  { border:1px solid #cbd5e1; background:#fff; color:#1e293b; padding:4px 12px; }
.dm-btn-lock    { border:1px solid #fca5a5; background:#fef2f2; color:#b91c1c; padding:4px 12px; }
.dm-btn-label   { font-size:0.85em; }
.dm-lock-form   { display:inline-block; margin:0; }
.pacing-jump-box{ background:#f8fafc; border-radius:8px; }


/* === Phase G: Teacher Daily Codes page === */
.daily-codes-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.daily-codes-filter  { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.daily-codes-table   { width: 100%; border-collapse: collapse; }
.daily-codes-table th,
.daily-codes-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--ideal-border); text-align: left; }
.daily-codes-table th { background: #f8fafc; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
.code-cell { font-size: 1.4rem; font-weight: 600; color: #0d6efd; text-align: center; }
.test-code-badge { display: inline-block; padding: 4px 12px; background: #eef2ff; border-radius: 8px; font-weight: 600; }

/* === Phase H: Duty Cards === */
.duty-card { background: #f8fafc; padding: 1rem; border-radius: 8px; border-left: 5px solid #0d6efd; }
.duty-list { display: flex; flex-direction: column; gap: 0.75rem; }
.duty-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem; background: white; border: 1px solid #e2e8f0; border-radius: 6px; }

/* === Page Navigation & Pagination === */
.page-nav {
    display: inline-flex;
    margin: 0.5rem 0 0.25rem 0;
    vertical-align: middle;
}
.page-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #64748b;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.page-nav-btn:first-child {
    border-radius: 6px 0 0 6px;
    border-right: none;
}
.page-nav-btn:last-child {
    border-radius: 0 6px 6px 0;
}
.page-nav-btn:hover {
    background: #f8fafc;
    color: #0f172a;
}
.page-nav-btn:active {
    background: #e2e8f0;
}
.page-nav-btn:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: -2px;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 1rem;
}
.pagination-info {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}
.pagination-controls {
    display: flex;
    gap: 0.5rem;
}
.pagination-link {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #0f172a;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.pagination-link:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}
.pagination-link:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 1px;
}
.pagination-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
/* === END NAV PAGINATION === */


/* === Two-Shift Test Codes === */
.test-code-badge--morning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.test-code-badge--evening { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.shift-morning { background: #fffbeb; }
.shift-evening { background: #eff6ff; }

.ms-2 { margin-left: 0.5rem; }


/* === Trophy + Badge Cabinet (Mizan only) === */
.badge-count-large {
    font-size: 2.5rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1;
    margin-top: 0.5rem;
}
.trophy-cabinet-card {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fcd34d;
}
.badge-cabinet-card {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #93c5fd;
}


/* === Handwriting Card (Mizan & Discipline) === */
.handwriting-card {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
}
.handwriting-title {
    color: #b45309;
}
.handwriting-badge {
    background: #f59e0b;
    color: white;
}
.handwriting-desc {
    color: #92400e;
}


/* === Daily Mission Enterprise Action Buttons === */
.action-btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}
.enterprise-btn {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}
.dm-lock-form {
    margin: 0;
    padding: 0;
    width: 100%;
    display: flex;
}
.dm-lock-form .btn {
    width: 100%;
}
@media (min-width: 577px) {
    .action-btn-group {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .enterprise-btn {
        width: auto;
        min-width: 110px;
        padding: 0 20px;
    }
    .dm-lock-form {
        width: auto;
    }
    .dm-lock-form .btn {
        width: auto;
    }
}



.ql-bubble .ql-editor {
    min-height: 120px;
    padding: 12px;
}
.ql-bubble .ql-editor.ql-blank::before {
    color: #94a3b8;
    font-style: normal;
}
.d-none { display: none !important; }




/* === Clean Textarea Styling === */
.ideal-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    resize: vertical;
}
.ideal-textarea:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}


/* A9. Direction & Typography for Latin Script (Roman Urdu) */
.guide-text-ltr {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    font-weight: 400 !important;
    line-height: 1.6 !important;
    text-align: left !important;
    color: #333 !important;
}
.guide-text-ltr h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #111 !important;
}
.guide-text-ltr p {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

/* AI Rewrite Tier — Copy Toast */
.copy-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  z-index: 9999;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  opacity: 0;
  transition: opacity 0.3s ease;
  max-width: 90vw;
  text-align: center;
}
.copy-toast.show { opacity: 1; }
.copy-toast--error { background: #b91c1c; }

.visually-hidden {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Modal for manual copy fallback */
.copy-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.copy-modal {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.copy-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: #111;
}
.copy-modal-hint {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 12px 0;
}
.copy-modal-textarea {
  width: 100%;
  height: 240px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  resize: vertical;
  margin-bottom: 12px;
  background: #fafafa;
  color: #111;
}
.copy-modal-btns {
  display: flex;
  gap: 10px;
}

/* Roman Urdu toggle */
.tier-lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}
.tier-lang-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #2563eb;
}
.tier-lang-label { font-weight: 600; color: #111; }
.tier-lang-state { color: #6b7280; font-size: 12px; }


/* === Archive Days (Past Days, Phase 4) === */
.archive-day-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}
.archive-day-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    background: #f8fafc;
    font-weight: 600;
    list-style: none;
    user-select: none;
}
.archive-day-summary::-webkit-details-marker { display: none; }
.archive-day-summary::before {
    content: "▶";
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform 0.2s;
    font-size: 0.7rem;
    color: #64748b;
}
.archive-day-panel[open] .archive-day-summary::before {
    transform: rotate(90deg);
}
.archive-day-title { color: #0f172a; flex: 1; }
.archive-day-meta { font-size: 0.85rem; color: #64748b; font-weight: 500; }
.archive-day-body {
    padding: 0.75rem 1rem;
    border-top: 1px solid #e2e8f0;
}
.archive-subject-group { margin-bottom: 0.75rem; }
.archive-subject-group:last-child { margin-bottom: 0; }
.archive-subject-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.4rem;
}
.archive-questions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.archive-question-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid;
    transition: transform 0.15s, box-shadow 0.15s;
    min-height: 36px;
}
.archive-question-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.archive-q-graded {
    background: #ecfdf5;
    border-color: #86efac;
    color: #166534;
}
.archive-q-drafted {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1e40af;
}
.archive-q-not_started {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}
.archive-status-icon { font-size: 0.85rem; }

@media (max-width: 576px) {
    .archive-day-summary { padding: 0.65rem 0.85rem; }
    .archive-day-body { padding: 0.65rem 0.85rem; }
    .archive-question-chip { font-size: 0.85rem; padding: 0.35rem 0.65rem; min-height: 34px; }
}

/* === BULLETPROOF HELP DRAWER CLOSE BUTTON (Phase 13) === */
.help-drawer .help-drawer-close-btn,
.help-drawer .help-drawer-header .help-drawer-close-btn {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #e2e8f0 !important;
    color: #0f172a !important;
    border: 2px solid #cbd5e1 !important;
    border-radius: 8px !important;
    font-size: 24px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-align: center !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 99999 !important;
    font-family: Arial, sans-serif !important;
    text-decoration: none !important;
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
}

.help-drawer .help-drawer-close-btn:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
    border-color: #dc2626 !important;
}

/* Per-page guides use .help-btn — override for close purpose */
.help-drawer-header .help-btn {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #e2e8f0 !important;
    color: #0f172a !important;
    border: 2px solid #cbd5e1 !important;
    border-radius: 8px !important;
    font-size: 24px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    z-index: 99999 !important;
    transform: none !important;
    box-shadow: none !important;
}

.help-drawer-header .help-btn:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
}

/* === Phase 15: Definitive Help Drawer Fix (Z-Index & Size) === */
.help-drawer {
    z-index: 999999 !important;
    top: 0 !important;
    height: 100vh !important;
}

/* Ensure the header isn't covered and has enough padding */
.help-drawer-header {
    padding: 12px 20px !important;
    min-height: 56px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: #f8f9fa !important;
    border-bottom: 1px solid #e9ecef !important;
}

/* The close button - smaller size, perfectly centered */
.help-drawer .help-drawer-header .help-drawer-close-btn,
.help-drawer .help-drawer-header .help-btn {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #e2e8f0 !important;
    color: #0f172a !important;
    border: 2px solid #cbd5e1 !important;
    border-radius: 6px !important;
    font-size: 18px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-align: center !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 999999 !important;
    font-family: Arial, sans-serif !important;
    text-decoration: none !important;
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
}

.help-drawer .help-drawer-header .help-drawer-close-btn:hover,
.help-drawer .help-drawer-header .help-btn:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
    border-color: #dc2626 !important;
}


/* ============================================================
   Handwriting Points — Prominent Display (v4.0)
   Added: 2026-10-25
   ============================================================ */
.handwriting-points-huge {
    font-size: 4rem;
    font-weight: 800;
    color: #d97706;
    line-height: 1;
    text-align: center;
    margin: 0.5rem 0;
}

.handwriting-points-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #6b7280;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-align: center;
    margin-top: 0.25rem;
}

/* ============================================================
   Result Page — Side-by-Side Score Cards
   ============================================================ */
.result-stats-grid {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.result-stat-block {
    text-align: center;
    min-width: 140px;
}

.result-stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}

.result-stat-value--academic {
    color: #1e293b;
}

.result-stat-value--likhai {
    color: #16a34a;
}


/* ---------- 11d. Task Hub: Choice Grid & Semantic Hero Cards ---------- */
.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}
.selection-card {
    background: var(--ideal-surface);
    border: 1px solid var(--ideal-border);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}
.selection-card:hover {
    border-color: var(--ideal-primary);
    box-shadow: 0 8px 16px rgba(13,110,253,0.08);
    transform: translateY(-2px);
}
.card-icon { font-size: 3rem; margin-bottom: 16px; }
.card-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; color: var(--ideal-text); }
.card-desc { color: var(--ideal-muted); margin-bottom: 24px; flex-grow: 1; font-size: 0.95rem; }
.btn-outline-primary {
    background: transparent;
    color: var(--ideal-primary);
    border: 2px solid var(--ideal-primary);
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s ease;
    padding: 12px;
}
.btn-outline-primary:hover {
    background: var(--ideal-primary);
    color: white;
}

/* Semantic Hero Cards */
.hero-card {
    background: var(--ideal-surface);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid var(--ideal-border);
    border-left-width: 6px;
}
.hero-card--info { border-left-color: #3b82f6; }
.hero-card--warning { border-left-color: #f59e0b; background: #fffbeb; }
.hero-card--success { border-left-color: #10b981; }
.hero-card--danger { border-left-color: #ef4444; background: #fef2f2; }
.hero-card--primary { border-left-color: #8b5cf6; background: #f5f3ff; }
.hero-title { font-size: 1.8rem; font-weight: 800; color: var(--ideal-text); margin-bottom: 12px; }
.hero-text { font-size: 1.05rem; color: var(--ideal-muted); margin-bottom: 32px; line-height: 1.6; }

/* ═══════════════════════════════════════════════════════════
   Phase A additions — Mission stepper page (task_hub_v2)
   Appended $(date +%Y-%m-%d) — no existing rules modified.
   ═══════════════════════════════════════════════════════════ */

.mission-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}
.mission-page__topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.wallet-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-weight: 700;
    font-size: 0.95rem;
}
.mission-heading {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--ideal-text);
    margin-bottom: 20px;
    text-align: center;
}
.mission-cards {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}
.mission-gap-card {
    margin-top: 16px;
}
.mission-footer {
    margin-top: 32px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--ideal-muted);
}
@media (min-width: 768px) {
    .mission-cards { grid-template-columns: 1fr 1fr; }
}

/* ── Mobile tuning for existing stepper (tighten on small screens) ── */
@media (max-width: 480px) {
    .stepper-wrap { padding: 0 8px; margin-bottom: 20px; }
    .step-item    { width: 56px; gap: 4px; }
    .step-circle  { width: 36px; height: 36px; font-size: 1rem; }
    .step-label   { font-size: 0.6rem; }
}

/* V3 Self-Healing Edit Form */
.edit-form-container {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-top: 16px;
}
.edit-textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1.05rem;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
    background: #ffffff;
    color: #1e293b;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.edit-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}
.edit-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
}

/* Fix for squished textareas in Edit Form */
.edit-form-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: block !important;
}
.edit-textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: block !important;
    min-height: 150px !important; /* Taller for professional look */
    padding: 16px !important;
    font-size: 1.05rem !important;
    line-height: 1.6 !important;
    border-radius: 8px !important;
    border: 1px solid #cbd5e1 !important;
    resize: vertical !important;
}

/* V3 Edit Form - Flat Layout, No Flexbox Dependencies */
.v3-edit-form {
    width: 100% !important;
    box-sizing: border-box;
    padding: 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 16px;
}
.v3-edit-form textarea {
    width: 100% !important;
    box-sizing: border-box;
    min-height: 140px;
    padding: 14px;
    font-size: 1rem;
    line-height: 1.6;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    resize: vertical;
    font-family: inherit;
    background: #ffffff;
    color: #1e293b;
    display: block;
}
.v3-edit-form textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}
.v3-edit-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
}

/* Quota Lock - Physical lock on the card */
.card-locked {
    opacity: 0.35 !important;
    pointer-events: none !important;
    filter: grayscale(100%) !important;
    user-select: none !important;
}
#submit-btn:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    background-color: #e2e8f0 !important;
    color: #94a3b8 !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
}
#submit-btn:not(:disabled) {
    background-color: #10b981 !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

/* V3 Pipeline - Self-Healing Components */
.pipeline-question-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}
.pipeline-story-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
    margin-bottom: 16px;
}
.pipeline-heal-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 20px;
    margin-top: 16px;
    margin-bottom: 16px;
}
.pipeline-heal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #b45309;
    margin-bottom: 8px;
}
.pipeline-heal-desc {
    font-size: 0.95rem;
    color: #92400e;
    margin-bottom: 16px;
    line-height: 1.6;
}
.pipeline-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.9rem;
    background: #ffffff;
    margin-bottom: 12px;
    box-sizing: border-box;
}
.pipeline-textarea:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}
.q-text-display {
    word-break: break-word;
    white-space: pre-wrap;
    background: #f8fafc;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 1rem;
    line-height: 1.6;
}



/* ═══════════════════════════════════════════════════════════
   CALENDAR COMPONENT v2 — ITCSS + design-token aligned
   Added 2026-10-29, refined 2026-10-29
   Used by: portal_mission_calendar.html, completion_calendar.html
   Standards: W3C HTML5 <table>, WAI-ARIA Grid Pattern, WCAG 2.2 AA
   Overrides global table/th/td rules (base layer) — unlayered wins.
   ═══════════════════════════════════════════════════════════ */
.calendar-grid {
  width: 100%;
  min-width: 0;                  /* CRITICAL: overrides global table { min-width: 800px } */
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  text-align: center;
  margin: 0;
  font-size: inherit;            /* overrides global table { font-size: 0.875rem } */
}
.calendar-grid thead th {
  text-align: center;            /* overrides global th { text-align: left } */
  vertical-align: middle;
  padding: var(--ideal-space-1) 2px;
  border: none;                  /* overrides global th { border-bottom } */
  background: transparent;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ideal-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: normal;           /* overrides global th { white-space: nowrap } */
}
.calendar-grid tbody td {
  text-align: center;            /* overrides global td { text-align: left } */
  vertical-align: top;
  padding: 2px;
  border: none;                  /* overrides global td { border-bottom } */
  white-space: normal;           /* overrides global td { white-space: nowrap } */
}

.calendar-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-height: 58px;
  padding: var(--ideal-space-1) 2px;
  line-height: 1.1;
  border-radius: var(--ideal-radius);
  font-family: inherit;
  font-size: 0.85rem;
  text-align: center;
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--ideal-bg);
  color: inherit;
  transition: box-shadow 0.12s;
}
.calendar-cell:hover         { box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.calendar-cell:focus-visible { outline: 2px solid var(--ideal-primary); outline-offset: 2px; }

.calendar-cell .cell-day    { font-size: 0.65rem; font-weight: 700; opacity: 0.85; }
.calendar-cell .cell-date   { font-size: 1rem;     font-weight: 700; }
.calendar-cell .cell-actual { font-size: 0.65rem; font-weight: 600; opacity: 0.9; }

/* Status variants — all colors sourced from :root tokens */
.calendar-cell.is-upcoming {
  background: var(--ideal-bg);
  color: var(--ideal-muted);
  border-color: var(--ideal-border);
}
.calendar-cell.is-not-started {
  background: var(--ideal-warning-bg);
  color: var(--ideal-warning);
  border-color: var(--ideal-warning);
}
.calendar-cell.is-missed {
  background: var(--ideal-danger-bg);
  color: var(--ideal-danger);
  border-color: var(--ideal-danger);
}
.calendar-cell.is-completed {
  background: var(--ideal-success-bg);
  color: var(--ideal-success);
  border-color: var(--ideal-success);
}
.calendar-cell.is-today {
  background: var(--ideal-primary-bg);
  color: var(--ideal-primary);
  border-color: var(--ideal-primary);
  font-weight: 700;
}
.calendar-cell.is-viewing {
  box-shadow: 0 0 0 2px var(--ideal-text) inset;
}


/* ═══════════════════════════════════════════════════════════
   TEACHER COMPLETION MATRIX — added 2026-10-29
   Used by: teacher_completion_matrix.html
   Standards: W3C HTML5 <table>, sticky column/row, WCAG 2.2 AA
   ═══════════════════════════════════════════════════════════ */
.matrix-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--ideal-border);
  border-radius: var(--ideal-radius);
  background: var(--ideal-surface);
  -webkit-overflow-scrolling: touch;
  /* Removed max-height to allow natural page scrolling */
}
.matrix-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.75rem;
  width: max-content;
  /* Force minimum width to guarantee the scroll bar appears on mobile */
  min-width: 1000px; 
}
.matrix-table th,
.matrix-table td {
  border: none;
  border-bottom: 1px solid var(--ideal-border);
  padding: 4px 4px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}
.matrix-table thead th {
  background: var(--ideal-bg);
  color: var(--ideal-muted);
  font-weight: 600;
  font-size: 0.7rem;
  position: sticky;
  top: 0;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.matrix-table .col-student {
  position: sticky;
  left: 0;
  background: var(--ideal-surface);
  z-index: 2;
  text-align: left;
  min-width: 140px;
  max-width: 180px;
  font-weight: 600;
  padding: 6px 10px;
  font-size: 0.85rem;
  color: var(--ideal-text);
  border-right: 1px solid var(--ideal-border);
}
.matrix-table thead th.col-student {
  z-index: 3;
  background: var(--ideal-bg);
}
.matrix-table tbody tr:hover td.col-student { background: var(--ideal-bg); }
.matrix-table .col-summary {
  font-weight: 600;
  padding: 6px 10px;
  color: var(--ideal-text);
}

.matrix-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.matrix-cell.is-done   { background: var(--ideal-success-bg); color: var(--ideal-success); border-color: var(--ideal-success); }
.matrix-cell.is-missed { background: var(--ideal-danger-bg);  color: var(--ideal-danger);  border-color: var(--ideal-danger); }
.matrix-cell.is-future { background: var(--ideal-bg);         color: var(--ideal-muted); }
.matrix-cell.is-na     { background: transparent;             color: var(--ideal-muted); opacity: 0.4; }

.matrix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ideal-space-3);
  align-items: center;
  margin-top: var(--ideal-space-3);
  font-size: 0.85rem;
  color: var(--ideal-muted);
}

/* Dropdown Component */
.ideal-dropdown { display: inline-block; position: relative; }
.ideal-dropdown summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; }
.ideal-dropdown summary::-webkit-details-marker { display: none; }
.ideal-dropdown-content { position: absolute; top: 100%; left: 0; min-width: 250px; z-index: 50; box-shadow: 0 4px 12px rgba(0,0,0,0.1); border: 1px solid var(--ideal-border); background: var(--ideal-surface); border-radius: var(--ideal-radius); }
.star-select { padding: 4px; border: 1px solid var(--ideal-border); border-radius: 4px; background: var(--ideal-surface); font-size: 0.85rem; width: 50px; text-align: center; }

/* Floating God Control Room Button */
.fab-control-room {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: auto;
    background: #10b981;
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    font-weight: bold;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, background 0.2s;
}
.fab-control-room:hover {
    background: #059669;
    color: white;
    transform: scale(1.05);
    text-decoration: none;
}
/* Fix mobile overflow issues in grids and flex layouts */
.kpi-row > *, .d-flex > * { min-width: 0; }
.kpi-row .ideal-select, .kpi-row .ideal-input,
.d-flex .ideal-select, .d-flex .ideal-input { min-width: 0; width: 100%; }
html, body { overflow-x: hidden; }

/* Fix mobile overflow issues in grids and flex layouts */
.kpi-row > *, .d-flex > * { min-width: 0; }
.kpi-row .ideal-select, .kpi-row .ideal-input,
.d-flex .ideal-select, .d-flex .ideal-input { min-width: 0; width: 100%; }
html, body { overflow-x: hidden; }

/* ═══════════════════════════════════════════════════════════════════
   UTILITY CLASSES (Zero Tolerance for Inline CSS)
   ═══════════════════════════════════════════════════════════════════ */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.align-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.flex-1 { flex: 1 !important; }
.flex-wrap { flex-wrap: wrap !important; }
.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.mt-1 { margin-top: 4px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 12px !important; }
.mt-4 { margin-top: 16px !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-4 { margin-bottom: 16px !important; }
.m-0 { margin: 0 !important; }
.p-1 { padding: 4px !important; }
.p-2 { padding: 8px !important; }
.p-3 { padding: 12px !important; }
.p-4 { padding: 16px !important; }
.px-3 { padding-left: 12px !important; padding-right: 12px !important; }
.py-2 { padding-top: 8px !important; padding-bottom: 8px !important; }
.text-xs { font-size: 0.75rem !important; }
.text-sm { font-size: 0.875rem !important; }
.text-lg { font-size: 1.125rem !important; }
.text-xl { font-size: 1.25rem !important; }
.font-bold { font-weight: 700 !important; }
.font-semibold { font-weight: 600 !important; }
.text-muted { color: #6b7280 !important; }
.text-primary { color: #1e40af !important; }
.text-success { color: #10b981 !important; }
.text-warning { color: #f59e0b !important; }
.text-danger { color: #ef4444 !important; }
.text-dark { color: #111827 !important; }
.bg-white { background: #ffffff !important; }
.bg-light { background: #f9fafb !important; }
.bg-blue-50 { background: #eff6ff !important; }
.bg-green-50 { background: #f0fdf4 !important; }
.bg-yellow-50 { background: #fef9c3 !important; }
.bg-gray-50 { background: #f3f4f6 !important; }
.border { border: 1px solid #e5e7eb !important; }
.border-top { border-top: 1px solid #e5e7eb !important; }
.border-bottom { border-bottom: 1px solid #e5e7eb !important; }
.border-left-blue { border-left: 4px solid #3b82f6 !important; }
.border-left-green { border-left: 4px solid #10b981 !important; }
.border-left-yellow { border-left: 4px solid #f59e0b !important; }
.border-left-gray { border-left: 4px solid #e5e7eb !important; }
.border-radius-sm { border-radius: 6px !important; }
.border-radius { border-radius: 8px !important; }
.border-radius-lg { border-radius: 12px !important; }
.shadow-sm { box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important; }
.cursor-pointer { cursor: pointer !important; }
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-uppercase { text-transform: uppercase !important; }
.text-decoration-none { text-decoration: none !important; }
.list-none { list-style: none !important; }
.opacity-75 { opacity: 0.75 !important; }
.opacity-50 { opacity: 0.5 !important; }

/* ==========================================
   SUPPORT TICKET SYSTEM (Clean Overhaul B5.27)
   ========================================== */
.ticket-details {
    border: 1px solid var(--ideal-border);
    border-radius: 8px;
    background: #ffffff;
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 100vw; /* Strict boundary for mobile */
}
.ticket-summary {
    padding: 1rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}
.ticket-summary::-webkit-details-marker { display: none; }
.ticket-summary::after { content: '▼'; font-size: 0.75rem; transition: transform 0.2s; }
.ticket-details[open] .ticket-summary::after { transform: rotate(180deg); }
.ticket-details-content {
    border-top: 1px solid var(--ideal-border);
    padding: 1rem;
    overflow: hidden; /* CRITICAL: Stops the 640px table from stretching the page */
}
.ticket-table-wrapper {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto; /* Enables horizontal scroll */
    -webkit-overflow-scrolling: touch;
}
.ticket-table {
    width: 100%;
    min-width: 640px; /* Forces the table to be wider than mobile screens to trigger scroll */
    border-collapse: collapse;
}
.ticket-table th {
    text-align: left;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #6b7280;
    border-bottom: 2px solid var(--ideal-border);
    padding: 0.75rem 0.5rem;
    white-space: nowrap;
}
.ticket-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.875rem;
    vertical-align: middle;
}
.ticket-table tbody tr:hover { background: #f9fafb; }
.ticket-table .subject-link { font-weight: 600; color: #111827; text-decoration: none; }
.ticket-table .subject-link:hover { color: var(--ideal-primary); text-decoration: underline; }

/* Ticket Comments */
.comment-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.comment-item { padding: 1rem; border-radius: 8px; background: #f9fafb; border: 1px solid var(--ideal-border); }
.comment-item.is-own { background: #eff6ff; border-color: #bfdbfe; }
.comment-header { font-size: 0.75rem; color: #6b7280; margin-bottom: 0.5rem; display: flex; justify-content: space-between; align-items: center; }
.comment-body { font-size: 0.95rem; color: #111827; white-space: pre-wrap; line-height: 1.5; }
.meta-grid { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1rem; margin: 0; }
.meta-grid dt { font-weight: 600; font-size: 0.875rem; color: #374151; }
.meta-grid dd { margin: 0; font-size: 0.875rem; color: #4b5563; }

/* Professional Form Layout (B5.36) */
.form-container {
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}
.form-textarea {
    width: 100% !important;
    max-width: 100% !important;
    padding: var(--ideal-space-3) !important;
    border: 1px solid var(--ideal-border) !important;
    border-radius: var(--ideal-radius) !important;
    font-family: inherit !important; /* Overrides monospace */
    font-size: 1rem !important;
    min-height: 120px !important; /* Shrinks the 300px JSON height */
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-textarea:focus {
    outline: 2px solid var(--ideal-primary) !important;
    border-color: transparent !important;
}


/* Tier Card Selection (B5.77) */
.tier-card {
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px 28px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}
.tier-card:hover {
  border-color: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}
.tier-card--active {
  background: #eff6ff;
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
}
.tier-card__icon { font-size: 1.75rem; line-height: 1; }
.tier-card__title { font-size: 1rem; font-weight: 700; color: #111827; }
.tier-card__sub { font-size: 0.8rem; color: #6b7280; }
.tier-card--active .tier-card__title { color: #1e40af; }

/* ─────────────────────────────────────────────────
   Terminal Paste Viewer (B5.83)
   Mobile-first, dark theme, zero data leaves device
   ───────────────────────────────────────────────── */
.terminal-viewer {
    max-width: 900px;
    margin: 0 auto;
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.3);
    color: #e2e8f0;
}
.terminal-viewer__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #1e293b;
    flex-wrap: wrap;
}
.terminal-viewer__title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: #f1f5f9;
    line-height: 1.3;
}
.terminal-viewer__subtitle {
    font-size: 0.85rem;
    color: #94a3b8;
    margin: 4px 0 0;
}
.terminal-viewer__badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    background: #065f46;
    color: #6ee7b7;
    border-radius: 999px;
    white-space: nowrap;
    align-self: flex-start;
}
.terminal-viewer__toolbar {
    display: flex;
    gap: 8px;
    padding: 12px 24px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    flex-wrap: wrap;
}
.terminal-viewer__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    flex: 1 1 auto;
    min-width: 100px;
}
.terminal-viewer__btn:hover {
    background: #1e293b;
    border-color: #475569;
}
.terminal-viewer__btn:active {
    transform: scale(0.97);
}
.terminal-viewer__btn--primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}
.terminal-viewer__btn--primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}
.terminal-viewer__btn--danger {
    color: #fca5a5;
    border-color: #7f1d1d;
}
.terminal-viewer__btn--danger:hover {
    background: #7f1d1d;
    color: #ffffff;
}
.terminal-viewer__textarea {
    width: 100%;
    min-height: 55vh;
    padding: 20px 24px;
    background: #020617;
    color: #a5f3fc;
    border: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.terminal-viewer__textarea::placeholder {
    color: #475569;
    font-style: italic;
}
.terminal-viewer__textarea:focus {
    background: #000000;
    box-shadow: inset 0 0 0 2px #2563eb;
}
.terminal-viewer__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    background: #1e293b;
    border-top: 1px solid #334155;
    font-size: 0.8rem;
    flex-wrap: wrap;
}
.terminal-viewer__stats {
    color: #94a3b8;
    font-family: ui-monospace, monospace;
}
.terminal-viewer__status {
    color: #6ee7b7;
}
.terminal-viewer__info {
    padding: 16px 24px;
    background: #0f172a;
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.5;
    border-top: 1px solid #1e293b;
}
.terminal-viewer__info p { margin: 0; }
.terminal-viewer__info code {
    background: #1e293b;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #a5f3fc;
}
.terminal-viewer__toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #065f46;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.terminal-viewer__toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 600px) {
    .terminal-viewer { border-radius: 0; }
    .terminal-viewer__header { padding: 16px 16px 12px; }
    .terminal-viewer__title { font-size: 1.1rem; }
    .terminal-viewer__toolbar { padding: 10px 16px; }
    .terminal-viewer__btn { font-size: 0.85rem; padding: 0 12px; min-height: 42px; }
    .terminal-viewer__textarea { padding: 16px; font-size: 0.85rem; min-height: 50vh; }
    .terminal-viewer__footer { padding: 8px 16px; font-size: 0.75rem; }
    .terminal-viewer__info { padding: 12px 16px; font-size: 0.75rem; }
}


/* ── Exam Token Queue classes (T3/T4) ── */
.exam-token-container {
  max-width: 720px;
}
.form-inline {
  display: inline-block;
  margin: 0;
  padding: 0;
}

/* Scaffold block (MDD Phase 1 -- Roman Urdu bridging)
   Uses ITCSS design tokens. Intentionally outside @layer to ensure
   precedence over generic .panel rules. Do not hardcode colors. */
.scaffold-block {
  margin: var(--ideal-space-4) 0;
  padding: var(--ideal-space-4) var(--ideal-space-5);
  background: var(--ideal-primary-bg);
  border-left: 4px solid var(--ideal-primary);
  border-radius: var(--ideal-radius);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ideal-text);
}
.scaffold-block .scaffold-label {
  font-weight: 600;
  color: var(--ideal-primary-dark);
  margin-bottom: var(--ideal-space-1);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.scaffold-block .scaffold-intro p { margin: 0 0 var(--ideal-space-3) 0; }
.scaffold-block .scaffold-vocab ul { margin: 0 0 var(--ideal-space-3) 0; padding-left: var(--ideal-space-5); }
.scaffold-block .scaffold-vocab li { margin-bottom: var(--ideal-space-1); }
.scaffold-block .scaffold-hints summary { cursor: pointer; color: var(--ideal-primary); font-weight: 600; }
.scaffold-block .scaffold-hints ol { margin: var(--ideal-space-2) 0 0 0; padding-left: var(--ideal-space-5); }
.scaffold-block .scaffold-hints li { margin-bottom: var(--ideal-space-1); }


/* Workshop UI (MDD Phase 2 -- teacher dashboard). Design tokens only. */
.workshop-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.workshop-badge--pending  { background: var(--ideal-warning-bg); color: var(--ideal-warning); }
.workshop-badge--approved { background: var(--ideal-success-bg); color: var(--ideal-success); }
.workshop-badge--rejected { background: var(--ideal-danger-bg);  color: var(--ideal-danger); }
.workshop-badge--info     { background: var(--ideal-primary-bg); color: var(--ideal-primary-dark); }
.workshop-action-row { display: flex; gap: var(--ideal-space-2); flex-wrap: wrap; align-items: center; }
.workshop-nav { display: flex; gap: var(--ideal-space-2); margin-bottom: var(--ideal-space-4); flex-wrap: wrap; }
.workshop-kv { display: grid; grid-template-columns: 160px 1fr; gap: var(--ideal-space-2) var(--ideal-space-3); margin: var(--ideal-space-3) 0; }
.workshop-kv dt { font-weight: 600; color: var(--ideal-muted); }
.workshop-kv dd { margin: 0; }


/* ── Pagination (Batch 1.6 v2) ── */
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; padding: 20px 0; border-top: 1px solid #e5e7eb; margin-top: 24px; }
.pagination-prev, .pagination-next { padding: 8px 16px; border-radius: 6px; color: #1e40af; font-weight: 600; text-decoration: none; }
.pagination-prev:hover, .pagination-next:hover { background: #eff6ff; }
.pagination-info { color: #6b7280; font-size: 0.9rem; }

/* ── Note action buttons (Batch 1.6 v2) ── */
.note-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.note-edit-panel { display: inline-block; }
.note-edit-panel summary { display: inline-block; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: #1e40af; background: #eff6ff; font-size: 0.85rem; font-weight: 600; list-style: none; }
.note-edit-panel summary::-webkit-details-marker { display: none; }
.note-edit-panel summary:hover { background: #dbeafe; }

/* ── Queue summary card (Batch 1.6 v2) ── */
.queue-summary-card { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 12px; padding: 20px; margin-bottom: 24px; }
.queue-summary-header h3 { margin: 0 0 12px 0; color: #1e40af; font-size: 1.1rem; }
.queue-summary-stats { display: flex; gap: 24px; margin-bottom: 16px; flex-wrap: wrap; }
.queue-stat { font-size: 0.95rem; color: #374151; }
.queue-stat strong { font-size: 1.4rem; color: #1e40af; margin-right: 4px; }

/* ── App Shell Nav (extracted from _app_shell_nav.html, batch5_101) ──
   These rules were previously in an inline <style> block inside the template.
   Moved here for cacheability, CSP compliance, and clean template markup.
   Hardcoded hex colors retained intentionally to preserve exact visual
   appearance (token refactor is a separate future batch).
   Do NOT duplicate these selectors elsewhere. */
/* Desktop Navigation */
  .nav-container {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 64px;
    justify-content: space-between;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  }
  .nav-brand {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1e40af;
    text-decoration: none;
    letter-spacing: -0.5px;
    margin-right: 24px;
  }
  .nav-brand span { color: #3b82f6; }
  
  .nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
  }
  .nav-item {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #4b5563;
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .nav-item:hover { background: #f3f4f6; color: #111827; }
  .nav-item.active { background: #eff6ff; color: #1e40af; }

  /* Dropdowns */
  .nav-dropdown { position: relative; display: inline-block; }
  .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 220px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 6px;
    z-index: 50;
    margin-top: 0; transform: translateY(8px);
  }
  .dropdown-menu a {
    display: block;
    padding: 10px 12px;
    font-size: 0.9rem;
    color: #4b5563;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s;
  }
  .dropdown-menu a:hover { background: #f3f4f6; color: #111827; }
  .nav-dropdown:hover .dropdown-menu { display: block; }

  /* Right side actions */
  .nav-actions { display: flex; align-items: center; gap: 12px; }
  .btn-logout {
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #991b1b;
    cursor: pointer;
    font-weight: 600;
  }
  .btn-logout:hover { background: #fee2e2; }

  /* Mobile Menu */
  .mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #4b5563;
  }
  .mobile-menu {
    display: none;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
  }
  .mobile-menu.is-open { display: block; }
  .mobile-menu a {
    display: block;
    padding: 12px;
    color: #4b5563;
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
  }
  .mobile-menu a:hover { background: #f3f4f6; }
  .mobile-menu hr { margin: 8px 0; border: none; border-top: 1px solid #e5e7eb; }

  @media (max-width: 900px) {
    .nav-links, .nav-actions { display: none; }
    .mobile-toggle { display: none; }
  }

  /* FIX: Hover gap bridge for dropdowns */
  .nav-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 16px; /* Creates an invisible bridge */
    background: transparent;
    z-index: 49;
  }
  .dropdown-menu {
    margin-top: 0 !important; /* Remove physical gap */
    transform: translateY(12px) !important; /* Shift visually instead */
  }


/* ── Request Change panel (Batch 1.7) ── */
.change-request-panel { display: block; }
.change-request-panel summary { cursor: pointer; list-style: none; }
.change-request-panel summary::-webkit-details-marker { display: none; }
.change-request-panel form { border-radius: 6px; }

/* ═══════════════════════════════════════════════════════════════════
   BATCH 5.86: STRICT NAV OVERRIDE
   Bypasses any cascade or layer errors above in the file.
   ═══════════════════════════════════════════════════════════════════ */

.nav-links { display: flex !important; gap: 4px !important; align-items: center !important; }
.nav-dropdown { position: relative !important; display: inline-block !important; }
.dropdown-menu { display: none !important; position: absolute !important; top: 100% !important; left: 0 !important; z-index: 50 !important; }
.nav-dropdown:hover .dropdown-menu { display: block !important; }
.mobile-menu { display: none !important; }
.mobile-toggle { display: none !important; }
@media (max-width: 900px) {
  .nav-links { display: none !important; }
  .mobile-toggle { display: block !important; }
}

/* Ensure mobile menu works correctly */
@media (max-width: 900px) {
  .nav-links { display: none !important; }
  .mobile-toggle { display: block !important; }
  .mobile-menu.is-open { display: block !important; }
}

/* Profile Edit Page Utilities */
.profile-container { max-width: 640px; margin: 0 auto; }
.breadcrumb-nav ol { list-style: none; padding: 0; margin: 0; display: flex; gap: 0.5rem; }
.breadcrumb-nav a { color: var(--ideal-primary, #3b82f6); text-decoration: none; }
.breadcrumb-nav li { color: #6b7280; font-size: 0.875rem; }
.pw-wrapper { position: relative; }
.pw-toggle { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 1.1rem; color: #6b7280; }

/* Profile Edit Page Utilities */
.profile-container { max-width: 640px; margin: 0 auto; }
.breadcrumb-nav ol { list-style: none; padding: 0; margin: 0; display: flex; gap: 0.5rem; }
.breadcrumb-nav a { color: var(--ideal-primary, #3b82f6); text-decoration: none; }
.breadcrumb-nav li { color: #6b7280; font-size: 0.875rem; }
.pw-wrapper { position: relative; }
.pw-toggle { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 1.1rem; color: #6b7280; }

/* Leaderboard Card */
.leaderboard-card { --lb-row-gap: 0.5rem; }
.leaderboard-legend { font-size: 0.8rem; color: #4b5563; background: #f9fafb; padding: 0.75rem; border-radius: 8px; display: flex; flex-direction: column; gap: 0.25rem; border: 1px solid #e5e7eb; }
.leaderboard-list { display: flex; flex-direction: column; gap: 0; }
.leaderboard-row { display: flex; align-items: center; padding: 0.75rem 0.5rem; border-bottom: 1px solid #f3f4f6; gap: 0.75rem; }
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row--viewer { background: #fffbeb; border-radius: 6px; border-left: 3px solid #f59e0b; }
.leaderboard-rank { flex: 0 0 32px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 700; color: #6b7280; }
.leaderboard-rank--1, .leaderboard-rank--2, .leaderboard-rank--3 { font-size: 1.5rem; }
.leaderboard-name { flex: 1 1 auto; font-weight: 600; color: #111827; font-size: 0.95rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-score { flex: 0 0 auto; font-weight: 700; color: #3b82f6; font-size: 1.1rem; white-space: nowrap; }
.leaderboard-footer { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid #e5e7eb; font-size: 0.85rem; }
.leaderboard-aap { margin-left: 0.5rem; }
.leaderboard-empty { padding: 24px; }

/* Beta Legacy Page */
.beta-legacy-table { width: 100%; border-collapse: collapse; }
.beta-legacy-table thead tr { border-bottom: 2px solid #ccc; text-align: left; }
.beta-legacy-table tbody tr { border-bottom: 1px solid #eee; }
.beta-founder-card { flex: 1; min-width: 250px; background: #fffbeb; border: 1px solid #f59e0b; text-align: center; }
.beta-founder-icon { font-size: 2rem; }
.beta-mizan-text { color: #3b82f6; }
.beta-founder-note { background: #f9fafb; border-left: 4px solid #f59e0b; padding: 1rem; font-style: italic; }

/* ── Leaderboard (Industry Standard Grid Layout) ── */
.leaderboard-card { padding: 1.5rem; }
.leaderboard-legend { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 1rem; display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.85rem; color: #475569; margin-bottom: 1.5rem; }
.leaderboard-legend-item { flex: 1 1 200px; }
.leaderboard-legend-item strong { color: #1e293b; display: block; margin-bottom: 0.25rem; font-weight: 600; }

.leaderboard-header { display: grid; grid-template-columns: 48px minmax(120px, 1fr) 70px 70px 70px 90px; gap: 0.5rem; padding: 0.75rem 1rem; background: #f1f5f9; border-radius: 8px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: #64748b; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.leaderboard-header > div:not(:nth-child(2)) { text-align: center; }

.leaderboard-list { display: flex; flex-direction: column; gap: 0.5rem; }
.leaderboard-row { display: grid; grid-template-columns: 48px minmax(120px, 1fr) 70px 70px 70px 90px; gap: 0.5rem; align-items: center; padding: 0.75rem 1rem; border-radius: 8px; background: #ffffff; border: 1px solid #f1f5f9; transition: background 0.2s ease, transform 0.1s ease; }
.leaderboard-row:hover { background: #f8fafc; }

.leaderboard-row--viewer { background: #eff6ff; border-color: #bfdbfe; }
.leaderboard-row--viewer:hover { background: #e0f2fe; }

.leaderboard-rank { text-align: center; font-size: 1.25rem; font-weight: 700; color: #64748b; }
.leaderboard-name { font-weight: 600; color: #1e293b; font-size: 0.95rem; display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.leaderboard-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-stat { text-align: center; font-size: 0.9rem; font-weight: 500; color: #475569; }
.leaderboard-score { text-align: right; font-weight: 800; color: #2563eb; font-size: 1.1rem; }

.tag--viewer { background: #dbeafe; color: #1e40af; padding: 2px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0; }

.leaderboard-footer { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #e2e8f0; font-size: 0.9rem; color: #475569; text-align: center; }
.leaderboard-empty { padding: 3rem 1rem; text-align: center; background: #f8fafc; border-radius: 8px; border: 2px dashed #cbd5e1; }

/* Responsive: Hide secondary metrics on mobile */
@media (max-width: 640px) {
  .leaderboard-header, .leaderboard-row { grid-template-columns: 40px minmax(100px, 1fr) 80px; }
  .leaderboard-stat:nth-of-type(1), .leaderboard-stat:nth-of-type(2), .leaderboard-stat:nth-of-type(3) { display: none; }
  .leaderboard-header > div:nth-child(3), .leaderboard-header > div:nth-child(4), .leaderboard-header > div:nth-child(5) { display: none; }
}

/* ── Industry Standard Neighborhood Leaderboard ── */
.leaderboard-card { padding: 1.5rem; background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.leaderboard-legend { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 1rem; display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.85rem; color: #475569; margin-bottom: 1.5rem; }
.leaderboard-legend-item { flex: 1 1 200px; }
.leaderboard-legend-item strong { color: #1e293b; display: block; margin-bottom: 0.25rem; font-weight: 600; }

.leaderboard-header { display: grid; grid-template-columns: 48px minmax(120px, 1fr) 70px 70px 70px 90px; gap: 0.5rem; padding: 0.75rem 1rem; background: #f1f5f9; border-radius: 8px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: #64748b; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.leaderboard-header > div:not(:nth-child(2)) { text-align: center; }

.leaderboard-list { display: flex; flex-direction: column; gap: 0.25rem; }
.leaderboard-row { display: grid; grid-template-columns: 48px minmax(120px, 1fr) 70px 70px 70px 90px; gap: 0.5rem; align-items: center; padding: 0.75rem 1rem; border-radius: 8px; background: #ffffff; border: 1px solid transparent; transition: background 0.2s ease; }
.leaderboard-row:hover { background: #f8fafc; border-color: #e2e8f0; }

.leaderboard-row--viewer { background: #eff6ff; border-color: #bfdbfe; }
.leaderboard-row--viewer:hover { background: #e0f2fe; }

.leaderboard-rank { text-align: center; font-size: 1.1rem; font-weight: 700; color: #64748b; }
.leaderboard-name { font-weight: 600; color: #1e293b; font-size: 0.95rem; display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.leaderboard-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-stat { text-align: center; font-size: 0.9rem; font-weight: 500; color: #475569; }
.leaderboard-score { text-align: right; font-weight: 800; color: #2563eb; font-size: 1.1rem; }

.tag--viewer { background: #dbeafe; color: #1e40af; padding: 2px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0; }

.leaderboard-footer { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #e2e8f0; font-size: 0.9rem; color: #475569; text-align: center; }
.leaderboard-empty { padding: 3rem 1rem; text-align: center; background: #f8fafc; border-radius: 8px; border: 2px dashed #cbd5e1; }

@media (max-width: 640px) {
  .leaderboard-header, .leaderboard-row { grid-template-columns: 40px minmax(100px, 1fr) 80px; }
  .leaderboard-stat:nth-of-type(1), .leaderboard-stat:nth-of-type(2), .leaderboard-stat:nth-of-type(3) { display: none; }
  .leaderboard-header > div:nth-child(3), .leaderboard-header > div:nth-child(4), .leaderboard-header > div:nth-child(5) { display: none; }
}

/* ─── Trophy Cabinet (Tier Guide) ─── */
.tier-guide { background: #fff; border-radius: 12px; padding: 20px; border: 1px solid #e5e7eb; }
.tier-guide__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.tier-guide__title { font-size: 16px; font-weight: 700; color: #111827; margin: 0; }
.tier-guide__badge { font-size: 10px; font-weight: 600; padding: 4px 10px; background: #eff6ff; color: #1e40af; border-radius: 6px; }
.tier-guide__list { display: flex; flex-direction: column; gap: 6px; }
.tier-guide__row { display: grid; grid-template-columns: 28px 90px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; border-left: 3px solid; }
.tier-guide__row--green { background: #f0fdf4; border-left-color: #10b981; }
.tier-guide__row--blue { background: #eff6ff; border-left-color: #3b82f6; }
.tier-guide__row--amber { background: #fffbeb; border-left-color: #f59e0b; }
.tier-guide__row--orange { background: #fff7ed; border-left-color: #f97316; }
.tier-guide__row--red { background: #fef2f2; border-left-color: #ef4444; }
.tier-guide__row--active { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); transform: scale(1.01); }
.tier-guide__rank { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: white; border-radius: 50%; }
.tier-guide__row--green .tier-guide__rank { background: #10b981; }
.tier-guide__row--blue .tier-guide__rank { background: #3b82f6; }
.tier-guide__row--amber .tier-guide__rank { background: #f59e0b; }
.tier-guide__row--orange .tier-guide__rank { background: #f97316; }
.tier-guide__row--red .tier-guide__rank { background: #ef4444; }
.tier-guide__daily { font-size: 14px; font-weight: 700; color: #111827; line-height: 1.1; }
.tier-guide__daily span { display: block; font-size: 10px; font-weight: 500; color: #6b7280; margin-top: 2px; }
.tier-guide__outcome { font-size: 13px; color: #4b5563; }
.tier-guide__you { font-size: 10px; font-weight: 700; color: white; background: #3b82f6; padding: 3px 8px; border-radius: 999px; }
.tier-guide__footer { font-size: 12px; color: #6b7280; margin: 16px 0 0; padding-top: 16px; border-top: 1px solid #f3f4f6; }

/* ─── Prediction Card ─── */
.prediction { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border-radius: 12px; padding: 20px; border-left: 5px solid var(--prediction-color); position: relative; overflow: hidden; }
.prediction__header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; position: relative; }
.prediction__icon { font-size: 22px; }
.prediction__label { font-size: 11px; font-weight: 700; color: #78350f; text-transform: uppercase; }
.prediction__pace { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--prediction-color); background: white; padding: 4px 10px; border-radius: 999px; }
.prediction__text { font-size: 14px; line-height: 1.6; color: #451a03; margin: 0; position: relative; }

/* ─── Daily Averages ─── */
.daily-avg-card { background: #fff; border-radius: 12px; padding: 20px; border: 1px solid #e5e7eb; }
.daily-avg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }
.daily-avg-item { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 15px; text-align: center; }
.daily-avg-label { display: block; font-size: 12px; font-weight: 700; color: #64748b; text-transform: uppercase; margin-bottom: 5px; }
.daily-avg-value { display: block; font-size: 24px; font-weight: 800; margin-bottom: 5px; }
.daily-avg-desc { display: block; font-size: 11px; color: #94a3b8; }

@media (max-width: 480px) {
  .tier-guide__row { grid-template-columns: 28px 78px 1fr; gap: 8px; padding: 8px 10px; }
  .tier-guide__you { display: none; }
}


/* ─── Nav Menu v2 (grouped, badge-aware) ─── */
.nav-badge {
  display: inline-block;
  background: #ef4444;
  color: #fff;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 4px;
  line-height: 1.4;
}
.nav-item--staff { color: #7c3aed !important; font-weight: 600; }
.dropdown-menu--right { right: 0; left: auto !important; }
.btn-logout-menu {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  color: #991b1b;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-logout-menu:hover { background: #fef2f2; }
.dropdown-menu hr { margin: 6px 0; border: none; border-top: 1px solid #e5e7eb; }


/* ═══ NAV BADGE (zero-inline-css) ═══ */


/* ═══ NAV UTILITY CLASSES (zero-inline-css) ═══ */
.form-reset { margin: 0; }
.btn-full { width: 100%; }


/* ═══ KC STUDIO ═══ */
.kc-studio { max-width: 1400px; margin: 2rem auto; padding: 0 1rem; }
.kc-studio__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; gap: 1rem; flex-wrap: wrap; }
.kc-studio__title { font-size: 1.5rem; font-weight: 700; margin: 0; }
.kc-studio__filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; align-items: center; }
.kc-chip { padding: 6px 12px; border-radius: 20px; border: 1px solid #e5e7eb; background: #fff; font-size: 0.85rem; color: #374151; text-decoration: none; cursor: pointer; }
.kc-chip:hover { background: #f9fafb; }
.kc-chip--active, .kc-chip--active:hover { background: #1f2937; color: #fff; border-color: #1f2937; }
.kc-chip__count { opacity: 0.7; margin-left: 4px; font-weight: 600; }
.kc-studio__search { padding: 8px 12px; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 0.85rem; background: #fff; }
.kc-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; }
.kc-table th { text-align: left; padding: 12px 10px; border-bottom: 2px solid #e5e7eb; font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7280; background: #f9fafb; }
.kc-table td { padding: 10px; border-bottom: 1px solid #f3f4f6; vertical-align: top; }
.kc-table tbody tr:hover { background: #fafafa; }
.kc-table tbody tr:last-child td { border-bottom: none; }
.kc-badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.kc-badge--empty { background: #fee2e2; color: #991b1b; }
.kc-badge--unapproved { background: #fef3c7; color: #92400e; }
.kc-badge--approved { background: #d1fae5; color: #065f46; }
.kc-empty { padding: 3rem; text-align: center; color: #6b7280; background: #fff; border: 1px dashed #e5e7eb; border-radius: 8px; }

.kc-row-muted { opacity: 0.4; }


/* ═══ KC STUDIO FORMS ═══ */
.kc-message { padding: 12px; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; max-width: 800px; margin-left: auto; margin-right: auto; }
.kc-message--success { background: #d1fae5; color: #065f46; border: 1px solid #10b981; }
.kc-message--error { background: #fee2e2; color: #991b1b; border: 1px solid #ef4444; }
.kc-form { background: #fff; padding: 24px; border-radius: 8px; border: 1px solid #e5e7eb; max-width: 800px; margin: 0 auto; }
.kc-form-row { display: flex; gap: 1rem; margin-bottom: 1rem; }
.kc-form-group { flex: 1; display: flex; flex-direction: column; margin-bottom: 1rem; }
.kc-form-group label { font-size: 0.85rem; font-weight: 600; color: #374151; margin-bottom: 4px; }
.kc-req { color: #ef4444; }
.kc-form-group input, .kc-form-group select, .kc-form-group textarea { padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem; font-family: inherit; }
.kc-form-group input:focus, .kc-form-group select:focus, .kc-form-group textarea:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
.kc-help { font-size: 0.75rem; color: #6b7280; margin-top: 4px; }
.kc-form-actions { display: flex; gap: 1rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #e5e7eb; }
.kc-btn { padding: 10px 20px; border-radius: 6px; font-weight: 600; font-size: 0.9rem; cursor: pointer; text-decoration: none; border: none; text-align: center; }
.kc-btn--primary { background: #3b82f6; color: #fff; }
.kc-btn--primary:hover { background: #2563eb; }
.kc-btn--ghost { background: #f3f4f6; color: #374151; }
.kc-btn--ghost:hover { background: #e5e7eb; }
.kc-btn--push { margin-left: auto; }


/* ═══ KC STUDIO EDITOR ═══ */
.kc-subtitle { font-size: 0.95rem; color: #6b7280; margin-top: 4px; }
.kc-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid #e5e7eb; margin-bottom: 1.5rem; }
.kc-tab { padding: 10px 16px; background: transparent; border: none; border-bottom: 2px solid transparent; font-size: 0.9rem; font-weight: 500; color: #6b7280; cursor: pointer; }
.kc-tab:hover:not(:disabled) { color: #111827; border-bottom-color: #d1d5db; }
.kc-tab--active { color: #3b82f6 !important; border-bottom-color: #3b82f6 !important; font-weight: 600; }
.kc-tab:disabled { opacity: 0.5; cursor: not-allowed; }
.kc-tab-content { display: none; }
.kc-tab-content--active { display: block; animation: fadeIn 0.2s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.kc-input-disabled { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }
.kc-code-input { font-family: monospace; font-size: 0.85rem !important; background: #f9fafb; }
.kc-checkbox-group { display: flex; flex-direction: column; gap: 12px; margin-bottom: 1.5rem; }
.kc-checkbox-group label { display: flex; align-items: center; gap: 8px; font-weight: 500; color: #374151; cursor: pointer; font-size: 0.9rem; }
.kc-checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: #3b82f6; cursor: pointer; }

.kc-btn--sm { padding: 4px 10px; font-size: 0.8rem; }

.kc-table-wrap { width: 100%; overflow-x: auto; border-radius: 8px; border: 1px solid #e5e7eb; }
.kc-code-link { color: #3b82f6; text-decoration: none; font-weight: 600; font-family: monospace; }
.kc-code-link:hover { text-decoration: underline; }


/* ═══ MY PAPERS PIPELINE ═══ */
.paper-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.paper-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.paper-table th {
  text-align: left;
  padding: 10px;
  border-bottom: 2px solid #e5e7eb;
  font-weight: 600;
  color: #6b7280;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.paper-table td {
  padding: 10px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}
.paper-table tbody tr:hover { background: #fafafa; }
.paper-table tbody tr:last-child td { border-bottom: none; }
.tag--warning { background: #fef3c7; color: #92400e; }
.tag--info { background: #e0f2fe; color: #075985; }



/* ═══ UPLOAD PHYSICAL ═══ */
.border-radius-md { border-radius: 8px; }
.bg-light { background: #f8fafc; }

/* ═══ STUDENT TEST CODES CARD ═══ */
.codes-card { border-left: 4px solid #3b82f6; background: #f8fafc; }
.codes-morning { background: #fffbeb; border: 1px solid #fcd34d; }
.codes-evening { background: #eff6ff; border: 1px solid #93c5fd; }
.text-warning-dark { color: #92400e; }
.text-primary-dark { color: #1e40af; }

/* ═══ LAYOUT & Z-INDEX STANDARDS ═══ */
.nav-container {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.nav-dropdown .dropdown-menu {
    z-index: 1001;
}

/* Translate Widget - bottom right, below nav */
.translate-widget,
#google_translate_element {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 900;
    background: #ffffff;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Hide Google Translate top banner */
.goog-te-banner-frame { display: none !important; }
body { top: 0 !important; }


/* ═══ NOTIFICATION ALERT ═══ */
.notification-alert { border-left: 4px solid #ef4444; background: #fef2f2; }


/* ═══ MY ACCESS CARD + CLICKABLE PILLS ═══ */
.access-card { border-left: 4px solid #3b82f6; background: #f9fafb; }
a.status { text-decoration: none; transition: opacity 0.15s ease; }
a.status:hover { opacity: 0.85; text-decoration: none; }


/* ═══ NOTIFICATION FLASH CARDS (1-hour expiry) ═══ */
.notif-stack { margin-bottom: 16px; }
.notif-flash-card {
  padding: 14px 18px;
  margin-bottom: 10px;
  border-radius: 10px;
  border-left: 5px solid #f59e0b;
  background: #fffbeb;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.notif-flash-card--evening {
  border-left-color: #3b82f6;
  background: #eff6ff;
}
.notif-flash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.notif-flash-header strong { font-size: 0.95rem; }
.notif-countdown {
  font-family: monospace;
  font-size: 0.85rem;
  background: rgba(0,0,0,0.08);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}
.notif-flash-body {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.9rem;
  margin: 0 0 8px 0;
  color: #374151;
}
.notif-flash-actions { text-align: right; }

/* ═══ UPLOAD CENTER ═══ */
.upload-center-list { display: flex; flex-direction: column; gap: 4px; }
.upload-center-item { transition: transform 0.1s ease; }
.upload-center-item:hover { transform: translateX(2px); }


/* --- CENTRALIZED INLINE STYLES --- */

/* From portal_my_papers.html */

.extracted-inline-style:nth-of-type(1) { min-width: 250px; border-top: 4px solid {% if has_single or has_bulk %}#10b981{% else %}#ef4444{% endif %}; }
.extracted-inline-style:nth-of-type(2) { min-width: 250px; border-top: 4px solid #3b82f6; }
.extracted-inline-style:nth-of-type(3) { border-left: 4px solid {% if a.score >= 4 %}#10b981{% elif a.score >= 2 %}#f59e0b{% else %}#ef4444{% endif %}; background: #f9fafb; }

/* From portal_progress.html */

.extracted-inline-style:nth-of-type(1) { background: linear-gradient(135deg, #1e3a8a, #3b82f6); color: white; border-radius: 12px; padding: 30px; }
.extracted-inline-style:nth-of-type(2) { color: white; font-weight: 800; }
.extracted-inline-style:nth-of-type(3) { color: #e0e7ff; font-size: 1.1rem; }
.extracted-inline-style:nth-of-type(4) { background: rgba(0,0,0,0.2); border-radius: 10px; }
.extracted-inline-style:nth-of-type(5) { color: #93c5fd; }
.extracted-inline-style:nth-of-type(6) { font-size: 1.5rem; font-weight: 900; }
.extracted-inline-style:nth-of-type(7) { min-width: 150px; border-bottom: 4px solid {% if overall_pct >= 60 %}#10b981{% elif overall_pct >= 40 %}#f59e0b{% else %}#ef4444{% endif %}; }
.extracted-inline-style:nth-of-type(8) { min-width: 150px; border-bottom: 4px solid {% if trend_delta > 0 %}#10b981{% else %}#ef4444{% endif %}; }
.extracted-inline-style:nth-of-type(9) { min-width: 150px; border-bottom: 4px solid #3b82f6; }
.extracted-inline-style:nth-of-type(10) { min-width: 150px; border-bottom: 4px solid #ef4444; }
.extracted-inline-style:nth-of-type(11) { font-size: 1.25rem; }
.extracted-inline-style:nth-of-type(12) { border: 2px solid #fca5a5; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.extracted-inline-style:nth-of-type(13) { background: #fef2f2; border-bottom: 1px solid #fecaca; }
.extracted-inline-style:nth-of-type(14) { font-size: 1.1rem; }
.extracted-inline-style:nth-of-type(15) { background: #f8fafc; border-left: 3px solid #3b82f6; border-radius: 4px; font-size: 0.9rem; }
.extracted-inline-style:nth-of-type(16) { background: #f0fdf4; border: 1px solid #bbf7d0; }
.extracted-inline-style:nth-of-type(17) { list-style: none; cursor: pointer; background: #f9fafb; border-radius: 6px; }
.extracted-inline-style:nth-of-type(18) { list-style: none; cursor: pointer; background: #f9fafb; border-radius: 6px; }

/* From portal_question_result.html */

.extracted-inline-style:nth-of-type(1) { border-width: 4px !important; }
.extracted-inline-style:nth-of-type(2) { background: #eff6ff; }
.extracted-inline-style:nth-of-type(3) { border-width: 4px !important; }
.extracted-inline-style:nth-of-type(4) { border-width: 4px !important; }
.extracted-inline-style:nth-of-type(5) { border-width: 4px !important; }
.extracted-inline-style:nth-of-type(6) { border-width: 4px !important; }
.extracted-inline-style:nth-of-type(7) { border-width: 4px !important; background: #f0fdf4; }


/* Hide empty translate widget */
.translate-widget:empty, #google_translate_element:empty { display: none !important; }


/* Leaderboard mobile responsive */
@media (max-width: 768px) {
  .mobile-hide { display: none !important; }
}


/* Trophies per day: mobile-only display */
.mobile-only { display: none; }
@media (max-width: 768px) {
  .mobile-only { display: inline !important; }
}

/* --- INDUSTRY STANDARD DASHBOARD UTILITIES --- */
.text-xxs { font-size: 0.75rem; }
.ms-1 { margin-left: 0.25rem; }
.rank-width { width: 30px; }

/* Mizan Ring Dynamic Data Attribute Styling */
.mizan-ring[data-score] {
    --score: attr(data-score);
}
.mizan-pin[data-left] {
    left: calc(attr(data-left) * 0.1%);
}
.goal-progress-fill[data-width] {
    width: calc(attr(data-width) * 1%);
}

/* ==========================================
   UTILITIES EXTRACTED FROM DAILY MISSION V3
   ========================================== */
.wrap-tight {
    padding-top: 10px;
    padding-bottom: 0;
    margin-bottom: -10px;
}
.btn-border-ideal {
    border: 1px solid var(--ideal-border);
}

/* ═══ TEACHER STUDENT QUESTIONS & BOOK GRID ═══ */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.book-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.book-header {
  background: #f9fafb;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.book-question-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 400px;
  overflow-y: auto;
}
.book-question-list li {
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.9rem;
  line-height: 1.5;
}
.book-question-list li:last-child {
  border-bottom: none;
}





/* === PACE 1-10: widen jump track for 10 segments === */
.jump-track { min-width: 600px; }
.jump-track .jump-segment { font-size: 11px; min-width: 50px; }


/* ═══ TEST CODES CONSOLE (v10) ═══ */
.code-input-xs { width: 60px; }
.code-input-sm { width: 70px; }
.code-input-md { width: 75px; }
.code-select-auto { width: auto; }
.code-card-minw { min-width: 280px; }
.code-pub-card { padding: 1rem; border-radius: 6px; }
.code-pub-card.is-visible { background: #ecfdf5; border-left: 4px solid #10b981; }
.code-pub-card.is-hidden { background: #fef2f2; border-left: 4px solid #ef4444; }
.code-policy-card { padding: 1rem; border-radius: 6px; background: #f0f9ff; border-left: 4px solid #3b82f6; }
.code-generate-card { padding: 1rem; border-radius: 6px; background: #fef9e7; }
.code-form-card { padding: 1rem; border-radius: 6px; background: #f8f9fa; }
.code-coverage-grid { display: flex; flex-wrap: wrap; gap: 2px; }
.code-cov-dot { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; font-size: 9px; font-weight: 700; border-radius: 4px; text-decoration: none; cursor: pointer; }
.code-cov-dot.is-full { background: #10b981; color: white; }
.code-cov-dot.is-partial { background: #f59e0b; color: white; }
.code-cov-dot.is-missing { background: #ef4444; color: white; }
.code-cov-dot.is-future { background: #e5e7eb; color: #6b7280; }
.code-cov-dot.is-selected { outline: 2px solid #1e40af; outline-offset: 1px; }
.code-cov-dot:hover { opacity: 0.85; }

/* ═══ STUDENT CALENDAR (phase5) ═══ */
.calendar-cell { min-height: 60px; }
.calendar-codes { line-height: 1.3; margin-top: 4px; }
.calendar-codes > div { margin-bottom: 2px; font-size: 10px; font-weight: 600; }
.calendar-codes .morning-line { color: #d97706; }
.calendar-codes .evening-line { color: #7c3aed; }
.calendar-policy-badge { font-size: 10px; font-weight: 700; margin-top: 2px; }
.calendar-policy-badge.is-retry { color: #d97706; }
.calendar-policy-badge.is-practice { color: #7c3aed; }
.calendar-locked { color: #ef4444; font-size: 10px; font-weight: 600; }
.calendar-missing { color: #ef4444; font-size: 10px; font-weight: 700; }

/* ═══ TEACHER DASHBOARD (v4 - Fully Centralized) ═══ */
.teacher-dashboard {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1e293b;
}

/* Header & Navigation */
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    background: white;
    padding: 20px 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}
.dash-title h1 { margin: 0 0 4px 0; font-size: 24px; font-weight: 700; color: #0f172a; }
.dash-title p { margin: 0; font-size: 14px; color: #64748b; }
.dash-nav-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dash-input { 
    padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 8px; 
    font-size: 14px; outline: none; transition: border 0.2s; background: #f8fafc;
}
.dash-input-sm {
    padding: 4px 8px; width: 80px;
}
.dash-input:focus { border-color: #3b82f6; background: white; }
.dash-btn {
    padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
    cursor: pointer; border: 1px solid transparent; transition: all 0.2s;
    display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.dash-btn-primary { background: #2563eb; color: white; }
.dash-btn-primary:hover { background: #1d4ed8; }
.dash-btn-outline { background: white; border-color: #cbd5e1; color: #475569; }
.dash-btn-outline:hover { background: #f1f5f9; }
.dash-btn-success { background: #10b981; color: white; }
.dash-btn-success:hover { background: #059669; }
.dash-btn-warning { background: #f59e0b; color: white; }
.dash-btn-warning:hover { background: #d97706; }
.dash-btn-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* Purple PM Buttons */
.dash-btn-pm-outline { background: white; border-color: #c4b5fd; color: #6d28d9; }
.dash-btn-pm-outline:hover { background: #f5f3ff; }
.dash-btn-pm-primary { background: #7c3aed; color: white; }
.dash-btn-pm-primary:hover { background: #6d28d9; }

.dash-btn-xs { padding: 4px 8px; font-size: 12px; }

/* Main Grid Layout */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}
.dash-card {
    background: white; border-radius: 12px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); border: 1px solid #e2e8f0;
}
.dash-card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #f1f5f9;
}
.dash-card-title { font-size: 16px; font-weight: 700; color: #0f172a; margin: 0; display: flex; align-items: center; gap: 8px; }

/* Specific Widths */
.col-full { grid-column: span 12; }
.col-half { grid-column: span 6; }
.col-third { grid-column: span 4; }
@media (max-width: 900px) {
    .col-half, .col-third { grid-column: span 12; }
}

/* Coverage Dots */
.dash-coverage-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.dash-dot {
    width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center;
    justify-content: center; font-size: 11px; font-weight: 700; text-decoration: none;
    transition: transform 0.2s;
}
.dash-dot:hover { transform: scale(1.1); }
.dash-dot.is-full { background: #d1fae5; color: #065f46; border: 1px solid #10b981; }
.dash-dot.is-partial { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
.dash-dot.is-missing { background: #fee2e2; color: #991b1b; border: 1px solid #ef4444; }
.dash-dot.is-future { background: #f1f5f9; color: #94a3b8; border: 1px solid #e2e8f0; }
.dash-dot.is-selected { box-shadow: 0 0 0 2px #3b82f6; }

/* Split Shift Publish Boxes */
.shift-box { border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.shift-am { background: #fffbeb; border: 1px solid #fcd34d; }
.shift-pm { background: #f5f3ff; border: 1px solid #c4b5fd; }
.shift-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.shift-am .shift-title { color: #b45309; }
.shift-pm .shift-title { color: #6d28d9; }

/* Form Controls inside Cards */
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.form-group { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 100px; }
.form-group-sm { flex: 0 0 100px; min-width: 100px; }
.form-group label { font-size: 12px; font-weight: 600; color: #64748b; }
.form-group input, .form-group select {
    padding: 8px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px;
}
.form-group input:focus, .form-group select:focus { border-color: #3b82f6; outline: none; }
.btn-sm { padding: 8px 12px; font-size: 13px; }

.dash-divider { border: 0; border-top: 1px solid #e2e8f0; margin: 16px 0; }

/* Data Table */
.dash-table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 8px; }
.dash-table { width: 100%; border-collapse: collapse; text-align: left; }
.dash-table th {
    background: #f8fafc; padding: 12px 16px; font-size: 12px; font-weight: 700;
    color: #475569; text-transform: uppercase; border-bottom: 1px solid #e2e8f0;
}
.dash-table td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; font-size: 14px; vertical-align: middle; }
.dash-table tr:last-child td { border-bottom: none; }
.dash-table tr:hover { background: #f8fafc; }
.dash-td-empty { padding: 30px; text-align: center; color: #64748b; }

/* Tags for Table */
.tag { display: inline-block; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; margin: 2px; }
.tag-am { background: #fffbeb; color: #b45309; border: 1px solid #fcd34d; }
.tag-pm { background: #f5f3ff; color: #6d28d9; border: 1px solid #c4b5fd; }


/* ═══ PORTAL PROGRESS DASHBOARD ═══ */
.report-dashboard { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }
.report-header { margin-bottom: 24px; }
.report-title { font-size: 24px; font-weight: 800; color: #0f172a; margin: 0 0 4px 0; }
.report-subtitle { color: #64748b; font-size: 14px; margin: 0; }

.mastery-banner { background: white; border-radius: 12px; padding: 24px; margin-bottom: 24px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; }
.mastery-score { font-size: 48px; font-weight: 800; color: #0f172a; line-height: 1; }
.mastery-label { font-size: 14px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 24px; }
.subject-card { background: white; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); border-top: 4px solid #3b82f6; text-decoration: none; color: inherit; display: block; transition: transform 0.2s; }
.subject-card:hover { transform: translateY(-2px); }
.subject-name { font-size: 18px; font-weight: 700; color: #1e293b; margin: 0 0 8px 0; }
.subject-stat { font-size: 13px; color: #64748b; margin-bottom: 4px; }
.subject-score { font-size: 24px; font-weight: 800; color: #0f172a; margin-top: 12px; }

/* ═══ TIMELINE VIEW ═══ */
.timeline { position: relative; padding-left: 30px; margin-top: 20px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: #e2e8f0; }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot { position: absolute; left: -26px; top: 16px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 0 2px #3b82f6; background: #3b82f6; }
.timeline-dot.is-fair { background: #f59e0b; box-shadow: 0 0 0 2px #f59e0b; }
.timeline-dot.is-poor { background: #ef4444; box-shadow: 0 0 0 2px #ef4444; }
.timeline-dot.is-good { background: #10b981; box-shadow: 0 0 0 2px #10b981; }

.timeline-content { background: white; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; }
.timeline-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.timeline-title { font-weight: 700; color: #1e293b; font-size: 15px; margin: 0; }
.timeline-meta { font-size: 12px; color: #64748b; }

/* ═══ DIAGNOSTIC ACCORDION ═══ */
.diag-accordion { display: none; margin-top: 16px; padding-top: 16px; border-top: 1px dashed #e2e8f0; }
.diag-accordion.is-open { display: block; }

/* (Reusing the Expert Card classes from the previous step, adding nuances) */
.panel-report { max-width: 100%; margin: 0; padding: 0; }
.panel-header { background: #f8fafc; border-radius: 8px; padding: 16px; text-align: center; margin-bottom: 16px; border: 1px solid #e2e8f0; }
.panel-score { font-size: 32px; font-weight: 800; color: #0f172a; margin: 0; }
.panel-band { display: inline-block; padding: 2px 10px; border-radius: 20px; font-weight: 700; font-size: 12px; margin-top: 4px; text-transform: uppercase; }
.band-excellent { background: #d1fae5; color: #065f46; }
.band-good { background: #dbeafe; color: #1e40af; }
.band-fair { background: #fef3c7; color: #92400e; }
.band-poor, .band-wrong { background: #fee2e2; color: #991b1b; }

.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.expert-card { background: white; border-radius: 8px; padding: 12px; border-left: 4px solid #3b82f6; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.expert-title { font-size: 12px; font-weight: 800; color: #1e293b; margin: 0 0 8px 0; text-transform: uppercase; }
.expert-item { margin-bottom: 4px; font-size: 12px; }
.expert-label { font-weight: 600; color: #64748b; }
.expert-val { color: #0f172a; }

.treatment-plan { background: #f8fafc; border-radius: 8px; padding: 16px; border: 1px solid #e2e8f0; }
.treatment-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.treatment-box { background: white; padding: 12px; border-radius: 6px; border: 1px solid #e2e8f0; font-size: 12px; color: #334155; }
.treatment-box strong { display: block; margin-bottom: 4px; color: #0f172a; font-size: 11px; text-transform: uppercase; }

/* ═══ SKILL TREE UI ═══ */
.tree-container { display: flex; flex-direction: column; align-items: center; padding: 40px 20px; background: #f8fafc; border-radius: 12px; }
.tree-node-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 300px; }
.tree-node { width: 100%; padding: 16px; border-radius: 10px; text-align: center; position: relative; z-index: 2; box-shadow: 0 4px 6px rgba(0,0,0,0.05); border: 2px solid #e2e8f0; background: white; transition: all 0.2s; text-decoration: none; color: inherit; }
.tree-node:hover { transform: scale(1.02); }
.tree-node.is-mastered { border-color: #10b981; background: #ecfdf5; }
.tree-node.is-in_progress { border-color: #f59e0b; background: #fffbeb; }
.tree-node.is-not_started { border-color: #94a3b8; background: #f1f5f9; }
.tree-node.is-locked { border-color: #cbd5e1; background: #f8fafc; opacity: 0.6; }
.tree-node.is-current { box-shadow: 0 0 0 4px #bfdbfe; }

.tree-day { font-size: 18px; font-weight: 800; color: #0f172a; margin: 0; }
.tree-status { font-size: 12px; font-weight: 700; text-transform: uppercase; margin-top: 4px; }
.tree-status.is-mastered { color: #065f46; }
.tree-status.is-in_progress { color: #92400e; }
.tree-status.is-not_started { color: #475569; }
.tree-status.is-locked { color: #94a3b8; }

.tree-connector { width: 4px; height: 40px; background: #cbd5e1; margin: 0; }

/* ═══ REPORT HUB NAV BAR ═══ */
.report-hub-nav {
  display: flex; gap: 6px; flex-wrap: wrap;
  max-width: 1100px; margin: 0 auto 20px auto; padding: 8px;
  background: white; border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid #e2e8f0;
}
.rhub-link {
  padding: 8px 14px; border-radius: 6px;
  font-size: 13px; font-weight: 600;
  color: #475569; text-decoration: none;
  transition: all 0.15s; white-space: nowrap;
}
.rhub-link:hover { background: #f1f5f9; color: #0f172a; }
.rhub-link.is-active { background: #2563eb; color: white; }
.rhub-link.rhub-legacy { margin-left: auto; color: #94a3b8; }
.rhub-link.rhub-legacy.is-active { background: #64748b; color: white; }
@media (max-width: 600px) {
  .rhub-link { font-size: 12px; padding: 6px 10px; }
  .rhub-link.rhub-legacy { margin-left: 0; }
}

/* ═══ MTSS BRIDGE CARDS ═══ */
.mtss-row { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.mtss-card { background: white; border-radius: 10px; padding: 16px; flex: 1; min-width: 200px; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.mtss-card-title { font-size: 12px; font-weight: 700; color: #64748b; text-transform: uppercase; margin-bottom: 8px; }
.mtss-tier { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.mtss-tier.tier-1 { color: #065f46; }
.mtss-tier.tier-2 { color: #1e40af; }
.mtss-tier.tier-3 { color: #991b1b; }
.mtss-trend { font-size: 24px; font-weight: 800; }
.mtss-trend.up { color: #10b981; }
.mtss-trend.down { color: #ef4444; }
.mtss-kc { display: inline-block; background: #fee2e2; color: #991b1b; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; margin-right: 6px; margin-bottom: 6px; }

/* ═══ CLINICAL DIAGNOSTIC REPORT ═══ */
.clinical-report { max-width: 900px; margin: 0 auto; padding: 20px 16px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.report-header-banner { background: white; border-radius: 12px; padding: 30px 20px; text-align: center; margin-bottom: 24px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; }
.report-score-display { font-size: 56px; font-weight: 800; color: #0f172a; line-height: 1; margin: 0; }
.report-band { display: inline-block; padding: 6px 16px; border-radius: 20px; font-weight: 800; font-size: 14px; margin-top: 10px; text-transform: uppercase; letter-spacing: 1px; }
.band-excellent { background: #d1fae5; color: #065f46; }
.band-good { background: #dbeafe; color: #1e40af; }
.band-fair { background: #fef3c7; color: #92400e; }
.band-poor, .band-wrong { background: #fee2e2; color: #991b1b; }

.report-section { background: white; border-radius: 12px; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; }
.report-section-title { font-size: 16px; font-weight: 800; color: #1e293b; margin: 0 0 16px 0; display: flex; align-items: center; gap: 8px; border-bottom: 2px solid #f1f5f9; padding-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px; }

.evidence-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .evidence-grid { grid-template-columns: 1fr; } }
.evidence-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; }
.evidence-label { font-size: 12px; font-weight: 800; text-transform: uppercase; color: #64748b; margin-bottom: 8px; display: block; }
.evidence-text { font-size: 14px; color: #0f172a; line-height: 1.6; white-space: pre-wrap; }

.expert-grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .expert-grid-2col { grid-template-columns: 1fr; } }
.expert-box { border-left: 4px solid #3b82f6; background: #f8fafc; padding: 16px; border-radius: 6px; }
.expert-box h4 { font-size: 14px; font-weight: 800; margin: 0 0 8px 0; color: #1e293b; }
.expert-box p { font-size: 13px; margin: 0 0 6px 0; color: #334155; }
.expert-box strong { color: #0f172a; }

.treatment-grid-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .treatment-grid-3col { grid-template-columns: 1fr; } }
.treatment-box-new { background: white; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.treatment-icon { font-size: 24px; margin-bottom: 8px; display: block; }
.treatment-title { font-size: 13px; font-weight: 800; color: #1e293b; text-transform: uppercase; margin-bottom: 8px; display: block; }
.treatment-text { font-size: 13px; color: #475569; line-height: 1.5; }

/* ═══ TEMPLATE 1: BOARD-EXAM SIMULATOR ═══ */
.board-sim-wrap { max-width: 1100px; margin: 0 auto; padding: 20px; }
.board-header { text-align: center; margin-bottom: 30px; }
.board-score-circle { display: inline-flex; align-items: center; justify-content: center; width: 120px; height: 120px; border-radius: 50%; background: white; border: 6px solid #3b82f6; font-size: 40px; font-weight: 900; color: #0f172a; margin-bottom: 15px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.board-score-circle.is-fair { border-color: #f59e0b; }
.board-score-circle.is-poor { border-color: #ef4444; }
.board-score-circle.is-good { border-color: #10b981; }
.board-split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media(max-width: 800px) { .board-split-grid { grid-template-columns: 1fr; } }
.board-column { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; }
.board-column-header { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 2px solid #f1f5f9; display: flex; align-items: center; gap: 8px; }
.student-column .board-column-header { color: #ef4444; }
.topper-column .board-column-header { color: #10b981; }
.exam-penalty-badge { display: inline-block; background: #fee2e2; color: #991b1b; padding: 6px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; margin-bottom: 8px; margin-right: 4px; }
.student-text-box { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; padding: 16px; font-size: 15px; line-height: 1.6; color: #78350f; white-space: pre-wrap; margin-bottom: 16px; }
.topper-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 16px; overflow: hidden; }
.topper-card-header { background: #d1fae5; color: #065f46; padding: 10px 16px; font-size: 13px; font-weight: 800; text-transform: uppercase; }
.topper-card-body { padding: 16px; font-size: 14px; line-height: 1.6; color: #0f172a; white-space: pre-wrap; }
.topper-card-footer { padding: 10px 16px; background: #f1f5f9; font-size: 12px; color: #64748b; font-style: italic; border-top: 1px solid #e2e8f0; }
.missing-bridge-box { background: #e0e7ff; border-left: 4px solid #6366f1; padding: 16px; border-radius: 8px; margin-bottom: 24px; font-size: 15px; color: #3730a3; font-weight: 600; }
.expert-suggestions-box { background: #f8fafc; border-radius: 12px; padding: 24px; margin-top: 24px; border: 1px solid #e2e8f0; }
.expert-suggestion-item { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; font-size: 14px; color: #334155; }
.expert-suggestion-icon { color: #3b82f6; font-weight: bold; }

/* ═══ TEMPLATE 2: CLINICAL DIAGNOSTIC LAB ═══ */
.clinical-lab { max-width: 900px; margin: 0 auto; padding: 20px 16px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.clinical-verdict { background: white; border-radius: 12px; padding: 30px 20px; text-align: center; margin-bottom: 24px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; border-top: 8px solid #3b82f6; }
.clinical-verdict.is-fair { border-top-color: #f59e0b; }
.clinical-verdict.is-poor { border-top-color: #ef4444; }
.clinical-verdict.is-good { border-top-color: #10b981; }
.clinical-score { font-size: 56px; font-weight: 800; color: #0f172a; line-height: 1; margin: 0; }
.clinical-summary { font-size: 16px; color: #475569; margin-top: 16px; font-style: italic; }

.clinical-section { background: white; border-radius: 12px; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; }
.clinical-title { font-size: 16px; font-weight: 800; color: #1e293b; margin: 0 0 16px 0; display: flex; align-items: center; gap: 8px; border-bottom: 2px solid #f1f5f9; padding-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px; }

.clinical-evidence { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .clinical-evidence { grid-template-columns: 1fr; } }
.clinical-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; }
.clinical-label { font-size: 12px; font-weight: 800; text-transform: uppercase; color: #64748b; margin-bottom: 8px; display: block; }
.clinical-text { font-size: 14px; color: #0f172a; line-height: 1.6; white-space: pre-wrap; }
.clinical-diagnosis-box { background: #fef2f2; border-left: 4px solid #ef4444; padding: 16px; border-radius: 6px; margin-top: 16px; }

.clinical-chunks { display: flex; flex-direction: column; gap: 8px; }
.chunk-row { display: flex; align-items: flex-start; gap: 12px; background: #f8fafc; padding: 12px; border-radius: 6px; border: 1px solid #e2e8f0; }
.chunk-marks { background: #10b981; color: white; font-weight: 800; font-size: 12px; padding: 4px 8px; border-radius: 4px; white-space: nowrap; }
.chunk-text { font-size: 14px; color: #0f172a; line-height: 1.5; }

.clinical-prescription { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 800px) { .clinical-prescription { grid-template-columns: 1fr; } }
.rx-card { background: white; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; text-align: center; border-top: 4px solid #3b82f6; }
.rx-icon { font-size: 24px; margin-bottom: 8px; display: block; }
.rx-title { font-size: 13px; font-weight: 800; color: #1e293b; text-transform: uppercase; margin-bottom: 8px; display: block; }
.rx-text { font-size: 13px; color: #475569; line-height: 1.5; }

/* ═══ TEMPLATE 3: THE GROWTH PATH ═══ */
.growth-tabs { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 2px solid #e2e8f0; padding-bottom: 8px; }
.growth-tab-btn { background: none; border: none; padding: 8px 16px; font-weight: 700; color: #64748b; cursor: pointer; border-radius: 6px; font-size: 14px; transition: all 0.2s; }
.growth-tab-btn:hover { background: #f1f5f9; }
.growth-tab-btn.active { background: #e0e7ff; color: #3730a3; }
.growth-tab-content { display: none; }
.growth-tab-content.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.growth-answer-box { background: #f8fafc; border: 1px solid #e2e8f0; padding: 16px; border-radius: 8px; font-size: 15px; line-height: 1.6; color: #0f172a; white-space: pre-wrap; }
.growth-ideal-box { background: #f0fdf4; border: 1px solid #bbf7d0; padding: 16px; border-radius: 8px; font-size: 15px; line-height: 1.6; color: #166534; white-space: pre-wrap; }
.growth-gap-list { list-style: none; padding: 0; margin: 0; }
.growth-gap-item { display: flex; gap: 12px; background: #fef2f2; border: 1px solid #fecaca; padding: 12px; border-radius: 8px; margin-bottom: 8px; color: #991b1b; font-weight: 600; font-size: 14px; align-items: center; }
.growth-gap-icon { font-size: 18px; }

.growth-nudge { background: #fffbeb; border-left: 4px solid #f59e0b; padding: 16px; border-radius: 6px; margin-top: 16px; }
.growth-nudge-title { font-size: 12px; font-weight: 800; color: #b45309; text-transform: uppercase; margin-bottom: 4px; display: block; }
.growth-nudge-text { font-size: 14px; color: #78350f; font-weight: 500; }

/* ═══ TEMPLATE 4: EXECUTIVE SUMMARY (PARENT POSTER) ═══ */
.exec-summary-wrap { max-width: 800px; margin: 0 auto; padding: 20px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.exec-poster { background: white; border-radius: 16px; padding: 40px 30px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); border: 2px solid #e2e8f0; text-align: center; position: relative; overflow: hidden; }
.exec-poster::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 8px; background: #3b82f6; }
.exec-poster.is-fair::before { background: #f59e0b; }
.exec-poster.is-poor::before { background: #ef4444; }
.exec-poster.is-good::before { background: #10b981; }

.exec-band-badge { font-size: 28px; font-weight: 900; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 10px; display: inline-block; }
.exec-score-display { font-size: 72px; font-weight: 900; color: #0f172a; line-height: 1; margin: 0; }
.exec-parent-summary { font-size: 18px; color: #475569; line-height: 1.6; max-width: 600px; margin: 20px auto; font-weight: 500; }

.exec-evidence-mini { display: flex; gap: 16px; margin: 30px 0; text-align: left; }
@media (max-width: 600px) { .exec-evidence-mini { flex-direction: column; } }
.exec-mini-box { flex: 1; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; }
.exec-mini-label { font-size: 11px; font-weight: 800; color: #64748b; text-transform: uppercase; margin-bottom: 8px; display: block; }
.exec-mini-text { font-size: 14px; color: #0f172a; line-height: 1.5; }

.exec-magic-words-box { background: #fffbeb; border: 2px dashed #fcd34d; border-radius: 12px; padding: 20px; margin-bottom: 30px; text-align: center; }
.exec-magic-words-title { font-size: 14px; font-weight: 800; color: #b45309; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; display: block; }
.exec-magic-word { display: inline-block; background: #f59e0b; color: white; font-weight: 800; font-size: 16px; padding: 6px 14px; border-radius: 20px; margin: 4px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }

.exec-action-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-top: 20px; }
@media (max-width: 700px) { .exec-action-grid { grid-template-columns: 1fr; } }
.exec-action-card { background: white; border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px; text-align: center; border-top: 4px solid #3b82f6; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.exec-action-icon { font-size: 32px; margin-bottom: 12px; display: block; }
.exec-action-title { font-size: 14px; font-weight: 800; color: #1e293b; text-transform: uppercase; margin-bottom: 8px; display: block; }
.exec-action-text { font-size: 14px; color: #475569; line-height: 1.5; }

/* ═══ TEMPLATE 5: THE MASTERCLASS ═══ */
.master-dash { max-width: 1100px; margin: 0 auto; padding: 20px 16px; }
.master-header { background: white; border-radius: 12px; padding: 30px; margin-bottom: 24px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 4px 6px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; }
.master-score-big { font-size: 64px; font-weight: 900; color: #0f172a; line-height: 1; }
.master-band-badge { display: inline-block; padding: 6px 16px; border-radius: 20px; font-weight: 800; font-size: 14px; text-transform: uppercase; margin-top: 10px; }

.master-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; }
@media (max-width: 900px) { .master-grid { grid-template-columns: 1fr; } }

.score-bar-container { margin-bottom: 16px; }
.score-bar-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; color: #475569; margin-bottom: 6px; text-transform: uppercase; }
.score-bar-track { background: #e2e8f0; border-radius: 6px; height: 12px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 6px; transition: width 0.5s ease; }
.score-bar-fill.is-red { background: #ef4444; }
.score-bar-fill.is-amber { background: #f59e0b; }
.score-bar-fill.is-green { background: #10b981; }

.master-evidence-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.master-evidence-label { font-size: 12px; font-weight: 800; color: #64748b; text-transform: uppercase; margin-bottom: 8px; display: block; }
.master-evidence-text { font-size: 15px; color: #0f172a; line-height: 1.6; }

.keyword-heatmap { line-height: 2; font-size: 15px; }
.keyword-highlight { background: #fef08a; color: #854d0e; font-weight: 700; padding: 2px 4px; border-radius: 4px; }
.keyword-missing { background: #fee2e2; color: #991b1b; font-weight: 700; padding: 2px 4px; border-radius: 4px; text-decoration: line-through; margin-left: 4px; }

.master-must-include { background: #e0e7ff; border: 2px dashed #6366f1; border-radius: 12px; padding: 24px; margin-top: 24px; }
.master-must-include h3 { font-size: 16px; font-weight: 800; color: #3730a3; margin-top: 0; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.checklist-item { display: flex; align-items: flex-start; gap: 12px; font-size: 15px; color: #312e81; margin-bottom: 12px; font-weight: 500; }
.checklist-item span { color: #6366f1; font-weight: 900; font-size: 18px; line-height: 1; }

/* ═══ REPORT HUB & UNIFIED TABLES ═══ */
.report-hub { max-width: 1100px; margin: 0 auto; padding: 20px 16px; }
.hub-header { text-align: center; margin-bottom: 40px; }
.hub-score { font-size: 56px; font-weight: 900; color: #0f172a; line-height: 1; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.hub-card { background: white; border-radius: 12px; padding: 24px; border: 1px solid #e2e8f0; box-shadow: 0 4px 6px rgba(0,0,0,0.05); display: flex; flex-direction: column; justify-content: space-between; transition: transform 0.2s; text-decoration: none; color: inherit; }
.hub-card:hover { transform: translateY(-4px); border-color: #3b82f6; }
.hub-card-title { font-size: 18px; font-weight: 800; color: #0f172a; margin-bottom: 8px; }
.hub-card-desc { font-size: 14px; color: #64748b; line-height: 1.5; margin-bottom: 20px; flex-grow: 1; }
.hub-btn { display: inline-block; text-align: center; background: #f1f5f9; color: #1e293b; font-weight: 700; padding: 10px 16px; border-radius: 6px; text-decoration: none; transition: background 0.2s; }
.hub-card:hover .hub-btn { background: #3b82f6; color: white; }

/* ═══ RESPONSIVE DATA TABLES ═══ */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 20px; border-radius: 8px; border: 1px solid #e2e8f0; }
.data-table { width: 100%; border-collapse: collapse; min-width: 500px; text-align: left; }
.data-table th { background: #f8fafc; padding: 12px 16px; font-size: 13px; font-weight: 800; color: #475569; text-transform: uppercase; border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
.data-table td { padding: 12px 16px; font-size: 14px; color: #1e293b; border-bottom: 1px solid #f1f5f9; line-height: 1.5; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:nth-child(even) { background: #f8fafc; }

/* ═══ BADGES & COLORS ═══ */
.bg-success-light { background-color: #d1fae5 !important; color: #065f46 !important; }
.bg-danger-light { background-color: #fee2e2 !important; color: #991b1b !important; }
.bg-warning-light { background-color: #fef3c7 !important; color: #92400e !important; }
.bg-primary-light { background-color: #dbeafe !important; color: #1e40af !important; }

/* ═══ UNIQUE TEMPLATE LAYOUTS (Zero Inline) ═══ */
.template-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; background: white; padding: 12px 20px; border-radius: 10px; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.template-title { font-size: 14px; font-weight: 800; color: #1e293b; text-transform: uppercase; }

/* T1: Board Sim */
.board-split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.board-col { background: white; border-radius: 12px; padding: 20px; border: 1px solid #e2e8f0; }
.board-col-header { font-size: 14px; font-weight: 800; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 2px solid #f1f5f9; text-transform: uppercase; }
.student-text-box { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; padding: 16px; font-size: 15px; color: #78350f; white-space: pre-wrap; }

/* T2: Clinical */
.clinical-section { background: white; border-radius: 12px; padding: 20px; margin-bottom: 20px; border: 1px solid #e2e8f0; }
.clinical-title { font-size: 16px; font-weight: 800; color: #1e293b; border-bottom: 2px solid #f1f5f9; padding-bottom: 12px; margin-bottom: 16px; text-transform: uppercase; }

/* T3: Tabs */
.growth-tabs { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 2px solid #e2e8f0; padding-bottom: 8px; }
.growth-tab-btn { background: none; border: none; padding: 8px 16px; font-weight: 700; color: #64748b; cursor: pointer; border-radius: 6px; }
.growth-tab-btn.active { background: #e0e7ff; color: #3730a3; }
.growth-content { display: none; }
.growth-content.active { display: block; }

/* T4: Exec Poster */
.exec-poster { background: white; border-radius: 16px; padding: 40px 30px; border: 2px solid #e2e8f0; text-align: center; }
.exec-score { font-size: 72px; font-weight: 900; color: #0f172a; line-height: 1; margin: 10px 0; }

/* T5: Masterclass */
.master-bars { display: flex; flex-direction: column; gap: 12px; }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; color: #475569; margin-bottom: 4px; }
.bar-track { background: #e2e8f0; border-radius: 6px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; }

/* ═══ ULTIMATE UNIFIED REPORT ═══ */
.ultimate-report { max-width: 1100px; margin: 0 auto; padding: 20px 16px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.ultimate-header { background: white; border-radius: 12px; padding: 30px; border: 1px solid #e2e8f0; box-shadow: 0 4px 10px rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.ultimate-score { font-size: 64px; font-weight: 900; color: #0f172a; line-height: 1; margin: 0; }
.ultimate-section { background: white; border-radius: 12px; padding: 24px; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.05); margin-bottom: 24px; }
.ultimate-title { font-size: 18px; font-weight: 800; color: #1e293b; border-bottom: 2px solid #f1f5f9; padding-bottom: 12px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; text-transform: uppercase; }
.ultimate-split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media(max-width: 800px) { .ultimate-split { grid-template-columns: 1fr; } }

/* Existing classes reused for zero-inline */
.growth-tabs { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 2px solid #e2e8f0; padding-bottom: 8px; }
.growth-tab-btn { background: none; border: none; padding: 8px 16px; font-weight: 700; color: #64748b; cursor: pointer; border-radius: 6px; }
.growth-tab-btn.active { background: #e0e7ff; color: #3730a3; }
.growth-content { display: none; }
.growth-content.active { display: block; }

/* ═══ PREMIUM REPORT DASHBOARD ═══ */
.premium-report { max-width: 1100px; margin: 0 auto; padding: 24px 16px; font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background-color: #f8fafc; min-height: 100vh; }
.premium-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 32px; }
.premium-title { font-size: 24px; font-weight: 700; color: #0f172a; margin: 0; }
.premium-subtitle { font-size: 14px; color: #64748b; margin-top: 4px; }

/* Score Ring & Stats Grid */
.premium-summary-card { background: white; border-radius: 16px; padding: 32px; border: 1px solid #e2e8f0; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); display: flex; align-items: center; gap: 40px; margin-bottom: 24px; }
@media (max-width: 700px) { .premium-summary-card { flex-direction: column; gap: 24px; text-align: center; } }

.score-ring-container { position: relative; width: 140px; height: 140px; flex-shrink: 0; }
.score-ring-svg { transform: rotate(-90deg); width: 140px; height: 140px; }
.score-ring-bg { fill: none; stroke: #e2e8f0; stroke-width: 12; }
.score-ring-fill { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1s ease-in-out; }
.score-ring-fill.is-excellent { stroke: #10b981; }
.score-ring-fill.is-good { stroke: #3b82f6; }
.score-ring-fill.is-fair { stroke: #f59e0b; }
.score-ring-fill.is-poor, .score-ring-fill.is-wrong { stroke: #ef4444; }
.score-ring-text { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring-value { font-size: 32px; font-weight: 800; color: #0f172a; line-height: 1; }
.score-ring-label { font-size: 12px; color: #64748b; font-weight: 600; text-transform: uppercase; margin-top: 4px; }

.premium-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; width: 100%; }
.premium-stat-item { display: flex; flex-direction: column; gap: 4px; }
.premium-stat-label { font-size: 12px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }
.premium-stat-value { font-size: 16px; font-weight: 600; color: #0f172a; }
.premium-stat-value.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 13px; font-weight: 700; text-transform: uppercase; }
.badge-excellent { background: #d1fae5; color: #065f46; }
.badge-good { background: #dbeafe; color: #1e40af; }
.badge-fair { background: #fef3c7; color: #92400e; }
.badge-poor, .badge-wrong { background: #fee2e2; color: #991b1b; }

/* Card Layout */
.premium-card { background: white; border-radius: 12px; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); margin-bottom: 24px; overflow: hidden; }
.premium-card-header { padding: 20px 24px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items: center; }
.premium-card-title { font-size: 16px; font-weight: 700; color: #1e293b; margin: 0; display: flex; align-items: center; gap: 8px; }
.premium-card-body { padding: 24px; }

/* Evidence Grid */
.evidence-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .evidence-grid { grid-template-columns: 1fr; } }
.evidence-block { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; }
.evidence-block.is-student { background: #fffbeb; border-color: #fcd34d; }
.evidence-label { font-size: 12px; font-weight: 700; color: #64748b; text-transform: uppercase; margin-bottom: 8px; display: block; }
.evidence-block.is-student .evidence-label { color: #b45309; }
.evidence-text { font-size: 14px; color: #0f172a; line-height: 1.6; white-space: pre-wrap; }
.diagnosis-callout { background: #fef2f2; border-left: 4px solid #ef4444; padding: 16px; border-radius: 8px; margin-top: 20px; }
.diagnosis-callout-title { font-size: 12px; font-weight: 800; color: #991b1b; text-transform: uppercase; margin-bottom: 4px; display: block; }
.diagnosis-callout-text { font-size: 14px; color: #7f1d1d; font-weight: 500; }

/* Tables (Scrollable) */
.premium-table-wrapper { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid #e2e8f0; border-radius: 8px; }
.premium-table { width: 100%; border-collapse: collapse; min-width: 500px; text-align: left; }
.premium-table th { background: #f8fafc; padding: 12px 16px; font-size: 12px; font-weight: 700; color: #64748b; text-transform: uppercase; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.premium-table td { padding: 16px; font-size: 14px; color: #1e293b; border-bottom: 1px solid #f1f5f9; line-height: 1.5; vertical-align: top; }
.premium-table tr:last-child td { border-bottom: none; }
.premium-table tr:nth-child(even) { background: #f8fafc; }

/* Tabs */
.premium-tabs { display: flex; gap: 4px; padding: 4px; background: #f1f5f9; border-radius: 8px; margin-bottom: 20px; }
.premium-tab { flex: 1; text-align: center; padding: 10px; border-radius: 6px; font-size: 14px; font-weight: 600; color: #64748b; cursor: pointer; border: none; background: transparent; transition: all 0.2s; }
.premium-tab.active { background: white; color: #0f172a; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); }
.premium-tab-content { display: none; }
.premium-tab-content.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Expert Bars */
.expert-bars-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .expert-bars-grid { grid-template-columns: 1fr; } }
.expert-bar-item { display: flex; flex-direction: column; gap: 6px; }
.expert-bar-header { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: #475569; }
.expert-bar-track { background: #e2e8f0; border-radius: 4px; height: 8px; overflow: hidden; }
.expert-bar-fill { height: 100%; border-radius: 4px; background: #3b82f6; }

/* Suggestions List */
.suggestions-list { list-style: none; padding: 0; margin: 0; }
.suggestions-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; color: #334155; }
.suggestions-item:last-child { border-bottom: none; }
.suggestion-icon { color: #10b981; font-weight: 900; font-size: 16px; flex-shrink: 0; }

/* ═══ ZERO INLINE STYLE UTILITIES ═══ */
.premium-stat-full { grid-column: 1 / -1; }
.premium-summary-text { font-size: 15px; line-height: 1.6; font-weight: 500; color: #475569; }
.premium-card-split { margin-bottom: 0; min-width: 300px; }
.premium-table-wrapper-borderless { border: none; }
.premium-top-border { border-top: 1px solid #f1f5f9; }

.evidence-block-ideal { background: #f0fdf4; border-color: #bbf7d0; }
.label-ideal { color: #166534; }
.text-ideal { color: #166534; }
.text-danger-strong { color: #991b1b; font-weight: 500; }

/* Expert Bar Colors */
.expert-bar-blue { background-color: #3b82f6; }
.expert-bar-purple { background-color: #8b5cf6; }
.expert-bar-green { background-color: #10b981; }
.expert-bar-amber { background-color: #f59e0b; }

/* ═══ STRICT CENTRALIZED UTILITIES (Zero Inline) ═══ */
.wc-flex { display: flex; }
.wc-flex-col { display: flex; flex-direction: column; }
.wc-gap-2 { gap: 8px; }
.wc-align-center { align-items: center; }
.wc-mb-1 { margin-bottom: 4px; }
.wc-mb-2 { margin-bottom: 8px; }
.wc-mb-3 { margin-bottom: 12px; }
.wc-mb-4 { margin-bottom: 16px; }
.wc-mt-2 { margin-top: 8px; }
.wc-mt-4 { margin-top: 16px; }
.wc-p-0 { padding: 0; }
.wc-w-full { width: 100%; }
.wc-text-sm { font-size: 14px; }
.wc-text-xs { font-size: 12px; }
.wc-font-bold { font-weight: 700; }
.wc-text-muted { color: #64748b; }
.wc-text-dark { color: #1e293b; }
.wc-icon-cell { width: 40px; text-align: center; font-size: 20px; }

/* Ideal Answer Box (Green) */
.wc-evidence-box.is-ideal { background: #f0fdf4; border-color: #bbf7d0; }
.wc-evidence-box.is-ideal .wc-evidence-lbl { color: #166534; }
.wc-evidence-box.is-ideal .wc-evidence-txt { color: #166534; }

/* Danger Box (Red) */
.wc-root-cause { background: #fef2f2; border-left: 4px solid #ef4444; padding: 16px; border-radius: 8px; margin-top: 16px; }
.wc-root-cause-title { font-size: 12px; font-weight: 800; color: #991b1b; text-transform: uppercase; display: block; margin-bottom: 4px; }
.wc-root-cause-text { font-size: 14px; color: #7f1d1d; font-weight: 500; }

/* Suggestions */
.wc-suggestion-list { list-style: none; padding: 0; margin: 0; }
.wc-suggestion-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; color: #334155; }
.wc-suggestion-item:last-child { border-bottom: none; }
.wc-suggestion-check { color: #10b981; font-weight: 900; font-size: 16px; }

.wc-flex-wrap { flex-wrap: wrap; }

/* ═══ WORLD-CLASS DASHBOARD V2 ═══ */
.wc-dashboard { max-width: 1200px; margin: 0 auto; padding: 32px 24px; font-family: 'Inter', -apple-system, sans-serif; background: #f8fafc; min-height: 100vh; }
.wc-header { margin-bottom: 32px; display: flex; justify-content: space-between; align-items: flex-end; }
.wc-title { font-size: 28px; font-weight: 800; color: #0f172a; letter-spacing: -0.5px; margin: 0; }
.wc-subtitle { font-size: 14px; color: #64748b; margin-top: 4px; font-weight: 500; }

/* 2-Column Grid */
.wc-grid { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
@media (max-width: 1024px) { .wc-grid { grid-template-columns: 1fr; } }

/* Hero Card */
.wc-hero { background: white; border-radius: 16px; padding: 32px; border: 1px solid #e2e8f0; box-shadow: 0 4px 20px rgba(0,0,0,0.03); display: flex; align-items: center; gap: 40px; margin-bottom: 24px; }
@media (max-width: 768px) { .wc-hero { flex-direction: column; text-align: center; padding: 24px; gap: 24px; } }

/* Score Ring */
.wc-ring-wrap { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.wc-ring-svg { transform: rotate(-90deg); width: 120px; height: 120px; }
.wc-ring-bg { fill: none; stroke: #f1f5f9; stroke-width: 10; }
.wc-ring-fill { fill: none; stroke-width: 10; stroke-linecap: round; }
.wc-ring-fill.is-excellent { stroke: #10b981; }
.wc-ring-fill.is-good { stroke: #3b82f6; }
.wc-ring-fill.is-fair { stroke: #f59e0b; }
.wc-ring-fill.is-poor { stroke: #ef4444; }
.wc-ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.wc-ring-val { font-size: 28px; font-weight: 800; color: #0f172a; line-height: 1; }
.wc-ring-lbl { font-size: 12px; font-weight: 600; color: #64748b; margin-top: 2px; }

/* Cards */
.wc-card { background: white; border-radius: 16px; border: 1px solid #e2e8f0; box-shadow: 0 2px 10px rgba(0,0,0,0.02); margin-bottom: 24px; overflow: hidden; }
.wc-card-header { padding: 20px 24px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items: center; background: #f8fafc; }
.wc-card-title { font-size: 15px; font-weight: 800; color: #1e293b; margin: 0; text-transform: uppercase; letter-spacing: 0.5px; display: flex; align-items: center; gap: 8px; }
.wc-card-body { padding: 24px; }

/* Utilities (Zero Inline) */
.wc-flex { display: flex; }
.wc-flex-wrap { flex-wrap: wrap; }
.wc-gap-2 { gap: 8px; }
.wc-align-center { align-items: center; }
.wc-mb-1 { margin-bottom: 4px; }
.wc-mb-2 { margin-bottom: 8px; }
.wc-mb-3 { margin-bottom: 12px; }
.wc-mb-4 { margin-bottom: 16px; }
.wc-mt-4 { margin-top: 16px; }
.wc-p-0 { padding: 0; }
.wc-text-sm { font-size: 14px; }
.wc-font-bold { font-weight: 700; }
.wc-text-muted { color: #64748b; }
.wc-text-dark { color: #1e293b; }
.wc-text-center { text-align: center; }
.wc-icon-cell { width: 40px; text-align: center; font-size: 20px; }

/* Progress Bars */
.wc-progress-row { margin-bottom: 16px; }
.wc-progress-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.wc-progress { appearance: none; width: 100%; height: 8px; border-radius: 4px; background: #e2e8f0; }
.wc-progress::-webkit-progress-bar { background: #e2e8f0; border-radius: 4px; }
.wc-progress::-webkit-progress-value { border-radius: 4px; }
.wc-progress.is-blue::-webkit-progress-value { background: #3b82f6; }
.wc-progress.is-purple::-webkit-progress-value { background: #8b5cf6; }
.wc-progress.is-green::-webkit-progress-value { background: #10b981; }
.wc-progress.is-amber::-webkit-progress-value { background: #f59e0b; }

/* Evidence Grid */
.wc-evidence { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .wc-evidence { grid-template-columns: 1fr; } }
.wc-evidence-box { border-radius: 10px; padding: 20px; border: 1px solid #e2e8f0; background: #f8fafc; }
.wc-evidence-box.is-student { background: #fffbeb; border-color: #fcd34d; }
.wc-evidence-box.is-ideal { background: #f0fdf4; border-color: #bbf7d0; }
.wc-evidence-lbl { font-size: 11px; font-weight: 800; color: #64748b; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; display: block; }
.wc-evidence-box.is-student .wc-evidence-lbl { color: #b45309; }
.wc-evidence-box.is-ideal .wc-evidence-lbl { color: #166534; }
.wc-evidence-txt { font-size: 14px; color: #1e293b; line-height: 1.6; }
.wc-evidence-box.is-ideal .wc-evidence-txt { color: #166534; }

/* Root Cause Box */
.wc-root-cause { background: #fef2f2; border-left: 4px solid #ef4444; padding: 16px; border-radius: 8px; margin-top: 16px; }
.wc-root-cause-title { font-size: 12px; font-weight: 800; color: #991b1b; text-transform: uppercase; display: block; margin-bottom: 4px; }
.wc-root-cause-text { font-size: 14px; color: #7f1d1d; font-weight: 500; }

/* Tables */
.wc-table-wrap { width: 100%; overflow-x: auto; }
.wc-table { width: 100%; border-collapse: collapse; text-align: left; min-width: 400px; }
.wc-table th { padding: 12px 16px; font-size: 12px; font-weight: 800; color: #64748b; text-transform: uppercase; border-bottom: 2px solid #f1f5f9; }
.wc-table td { padding: 16px; font-size: 14px; color: #1e293b; border-bottom: 1px solid #f1f5f9; line-height: 1.5; }
.wc-table tr:last-child td { border-bottom: none; }
.wc-table tr:nth-child(even) { background: #f8fafc; }

/* Tabs */
.wc-tabs { display: flex; gap: 4px; background: #f1f5f9; padding: 4px; border-radius: 8px; margin-bottom: 20px; }
.wc-tab-btn { flex: 1; padding: 10px; text-align: center; border-radius: 6px; font-size: 13px; font-weight: 700; color: #64748b; cursor: pointer; border: none; background: transparent; transition: all 0.2s; }
.wc-tab-btn.active { background: white; color: #0f172a; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.wc-tab-pane { display: none; animation: fadeIn 0.2s ease; }
.wc-tab-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Badges */
.wc-badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.wc-badge.is-danger { background: #fee2e2; color: #991b1b; }
.wc-badge.is-success { background: #d1fae5; color: #065f46; }
.wc-badge.is-warning { background: #fef3c7; color: #92400e; }
.wc-badge.is-primary { background: #dbeafe; color: #1e40af; }

/* Suggestions */
.wc-suggestion-list { list-style: none; padding: 0; margin: 0; }
.wc-suggestion-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; color: #334155; }
.wc-suggestion-item:last-child { border-bottom: none; }
.wc-suggestion-check { color: #10b981; font-weight: 900; font-size: 16px; }



/* ═══ PREMIUM AMAZON-HEALTH STYLE DASHBOARD ═══ */
.wc-dashboard { max-width: 1200px; margin: 0 auto; padding: 32px 24px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f8fafc; min-height: 100vh; color: #1e293b; }
.wc-header { margin-bottom: 32px; }
.wc-title { font-size: 28px; font-weight: 800; color: #0f172a; letter-spacing: -0.5px; margin: 0 0 4px 0; }
.wc-subtitle { font-size: 14px; color: #64748b; font-weight: 500; margin: 0; }

/* 2-Column Grid */
.wc-grid { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
@media (max-width: 1024px) { .wc-grid { grid-template-columns: 1fr; } }

/* Hero Card */
.wc-hero { background: white; border-radius: 16px; padding: 32px; border: 1px solid #e2e8f0; box-shadow: 0 4px 20px rgba(0,0,0,0.03); display: flex; align-items: center; gap: 40px; margin-bottom: 24px; }
@media (max-width: 768px) { .wc-hero { flex-direction: column; text-align: center; padding: 24px; gap: 24px; } }

/* Score Ring */
.wc-ring-wrap { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.wc-ring-svg { transform: rotate(-90deg); width: 120px; height: 120px; }
.wc-ring-bg { fill: none; stroke: #f1f5f9; stroke-width: 10; }
.wc-ring-fill { fill: none; stroke-width: 10; stroke-linecap: round; }
.wc-ring-fill.is-excellent { stroke: #10b981; }
.wc-ring-fill.is-good { stroke: #3b82f6; }
.wc-ring-fill.is-fair { stroke: #f59e0b; }
.wc-ring-fill.is-poor { stroke: #ef4444; }
.wc-ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.wc-ring-val { font-size: 28px; font-weight: 800; color: #0f172a; line-height: 1; }
.wc-ring-lbl { font-size: 12px; font-weight: 600; color: #64748b; margin-top: 2px; }

/* Cards */
.wc-card { background: white; border-radius: 16px; border: 1px solid #e2e8f0; box-shadow: 0 2px 10px rgba(0,0,0,0.02); margin-bottom: 24px; overflow: hidden; }
.wc-card-header { padding: 20px 24px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items: center; background: #f8fafc; }
.wc-card-title { font-size: 15px; font-weight: 800; color: #1e293b; margin: 0; text-transform: uppercase; letter-spacing: 0.5px; display: flex; align-items: center; gap: 8px; }
.wc-card-body { padding: 24px; }

/* Utilities (Zero Inline) */
.wc-flex { display: flex; }
.wc-flex-wrap { flex-wrap: wrap; }
.wc-gap-2 { gap: 8px; }
.wc-align-center { align-items: center; }
.wc-mb-1 { margin-bottom: 4px; }
.wc-mb-2 { margin-bottom: 8px; }
.wc-mb-3 { margin-bottom: 12px; }
.wc-mb-4 { margin-bottom: 16px; }
.wc-mt-4 { margin-top: 16px; }
.wc-p-0 { padding: 0; }
.wc-text-sm { font-size: 14px; }
.wc-font-bold { font-weight: 700; }
.wc-text-muted { color: #64748b; }
.wc-text-dark { color: #1e293b; }
.wc-text-center { text-align: center; }
.wc-icon-cell { width: 40px; text-align: center; font-size: 20px; }

/* Progress Bars */
.wc-progress-row { margin-bottom: 16px; }
.wc-progress-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.wc-progress { appearance: none; width: 100%; height: 8px; border-radius: 4px; background: #e2e8f0; }
.wc-progress::-webkit-progress-bar { background: #e2e8f0; border-radius: 4px; }
.wc-progress::-webkit-progress-value { border-radius: 4px; }
.wc-progress.is-blue::-webkit-progress-value { background: #3b82f6; }
.wc-progress.is-purple::-webkit-progress-value { background: #8b5cf6; }
.wc-progress.is-green::-webkit-progress-value { background: #10b981; }
.wc-progress.is-amber::-webkit-progress-value { background: #f59e0b; }

/* Evidence Grid */
.wc-evidence { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .wc-evidence { grid-template-columns: 1fr; } }
.wc-evidence-box { border-radius: 10px; padding: 20px; border: 1px solid #e2e8f0; background: #f8fafc; }
.wc-evidence-box.is-student { background: #fffbeb; border-color: #fcd34d; }
.wc-evidence-box.is-ideal { background: #f0fdf4; border-color: #bbf7d0; }
.wc-evidence-lbl { font-size: 11px; font-weight: 800; color: #64748b; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; display: block; }
.wc-evidence-box.is-student .wc-evidence-lbl { color: #b45309; }
.wc-evidence-box.is-ideal .wc-evidence-lbl { color: #166534; }
.wc-evidence-txt { font-size: 14px; color: #1e293b; line-height: 1.6; }
.wc-evidence-box.is-ideal .wc-evidence-txt { color: #166534; }

/* Root Cause Box */
.wc-root-cause { background: #fef2f2; border-left: 4px solid #ef4444; padding: 16px; border-radius: 8px; margin-top: 16px; }
.wc-root-cause-title { font-size: 12px; font-weight: 800; color: #991b1b; text-transform: uppercase; display: block; margin-bottom: 4px; }
.wc-root-cause-text { font-size: 14px; color: #7f1d1d; font-weight: 500; }

/* Tables */
.wc-table-wrap { width: 100%; overflow-x: auto; }
.wc-table { width: 100%; border-collapse: collapse; text-align: left; min-width: 400px; }
.wc-table th { padding: 12px 16px; font-size: 12px; font-weight: 800; color: #64748b; text-transform: uppercase; border-bottom: 2px solid #f1f5f9; }
.wc-table td { padding: 16px; font-size: 14px; color: #1e293b; border-bottom: 1px solid #f1f5f9; line-height: 1.5; }
.wc-table tr:last-child td { border-bottom: none; }
.wc-table tr:nth-child(even) { background: #f8fafc; }

/* Tabs */
.wc-tabs { display: flex; gap: 4px; background: #f1f5f9; padding: 4px; border-radius: 8px; margin-bottom: 20px; }
.wc-tab-btn { flex: 1; padding: 10px; text-align: center; border-radius: 6px; font-size: 13px; font-weight: 700; color: #64748b; cursor: pointer; border: none; background: transparent; transition: all 0.2s; }
.wc-tab-btn.active { background: white; color: #0f172a; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.wc-tab-pane { display: none; animation: fadeIn 0.2s ease; }
.wc-tab-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Badges */
.wc-badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.wc-badge.is-danger { background: #fee2e2; color: #991b1b; }
.wc-badge.is-success { background: #d1fae5; color: #065f46; }
.wc-badge.is-warning { background: #fef3c7; color: #92400e; }
.wc-badge.is-primary { background: #dbeafe; color: #1e40af; }

/* Suggestions */
.wc-suggestion-list { list-style: none; padding: 0; margin: 0; }
.wc-suggestion-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; color: #334155; }
.wc-suggestion-item:last-child { border-bottom: none; }
.wc-suggestion-check { color: #10b981; font-weight: 900; font-size: 16px; }

/* ═══ INDUSTRY STANDARDS CSS COMPLIANCE ═══ */

/* 1. WCAG 2.4.7: Keyboard Focus Indicators */
.wc-tab-btn:focus-visible,
.btn:focus-visible,
a:focus-visible {
    outline: 3px solid #3b82f6 !important;
    outline-offset: 2px !important;
    border-radius: 4px;
}

/* 2. WCAG 2.3.3: Reduced Motion (Disables animations for motion sickness) */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 3. Cross-Browser Progress Bar Support (Firefox) */
.wc-progress.is-blue::-moz-progress-bar { background: #3b82f6; }
.wc-progress.is-purple::-moz-progress-bar { background: #8b5cf6; }
.wc-progress.is-green::-moz-progress-bar { background: #10b981; }
.wc-progress.is-amber::-moz-progress-bar { background: #f59e0b; }

/* 4. Ensure text contrast meets WCAG AA (4.5:1) */
.wc-text-muted { color: #475569; } /* Darkened from #64748b for better contrast on light backgrounds */

/* ═══ ZERO-INLINE-SYLE FIX ═══ */
.btn-logout-full { width: 100%; }

/* ═══ BASE.HTML ZERO-INLINE STYLES ═══ */
.base-back-nav-wrap { padding-top: 10px; padding-bottom: 0; margin-bottom: -10px; }
.base-back-btn { border: 1px solid var(--ideal-border); }
.base-messages-wrap { padding-top: 16px; padding-bottom: 0; }

.base-alert { padding: 12px 16px; }
.base-alert--success { border-left: 4px solid #10b981; background: #f0fdf4; }
.base-alert--error   { border-left: 4px solid #ef4444; background: #fef2f2; }
.base-alert--warning { border-left: 4px solid #f59e0b; background: #fffbeb; }
.base-alert--info    { border-left: 4px solid #3b82f6; background: #eff6ff; }

/* ═══ REPORT HUB GRID (Phase 4) ═══ */
.hub-grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 8px;
}
.hub-tile {
    display: block;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 28px 24px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.hub-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    border-color: #3b82f6;
}
.hub-tile:focus-visible {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}
.hub-icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 16px;
    display: block;
}
.hub-tile-title {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 8px 0;
}
.hub-tile-desc {
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
    margin: 0;
}
@media (max-width: 600px) {
    .hub-grid-cards { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    .hub-tile { transition: none; }
}

/* ═══ PHASE 4 FINAL CLEANUP — Static Style Extraction ═══ */
.dashboard-section-title { text-transform: uppercase; }
.subject-score-denom { font-size: 14px; color: #64748b; }
.alert-dashboard-success {
    border-left: 4px solid #10b981;
    background-color: #ecfdf5;
    padding: 15px;
    border-radius: 8px;
}
.mizan-score-label { font-size: 0.75rem; margin-left: 4px; }

/* ═══ PHASE 4 PARTIALS — MISSING CSS (v3) ═══ */
/* _masterpiece_guide.html */
.mp-panel { border-left: 4px solid #3b82f6; }
.mp-panel.mp-panel--blue   { border-left-color: #3b82f6; }
.mp-panel.mp-panel--red    { border-left-color: #ef4444; }
.mp-panel.mp-panel--amber  { border-left-color: #f59e0b; }
.mp-panel.mp-panel--green  { border-left-color: #10b981; }
.mp-panel.mp-panel--purple { border-left-color: #8b5cf6; }
.mp-panel.mp-panel--cyan   { border-left-color: #06b6d4; }
.mp-panel.mp-panel--pink   { border-left-color: #ec4899; background: #fdf2f8; }
.mp-blockquote { font-style: italic; border-left: 3px solid #cbd5e1; }
.mp-italic { font-style: italic; }

/* _achievements.html */
.achievements-cabinet { background: #fffbeb; border-color: #fde68a; }
.achievements-count { color: #d97706; }

/* portal_dohrai.html */
.dohrai-panel { border-left: 4px solid #3b82f6; }
.dohrai-panel.is-learning { border-left-color: #f59e0b; }

/* ═══ PHASE 4d — Professional attempt cards (My Papers) ═══ */
.attempt-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.attempt-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    padding: 16px 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    gap: 16px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.attempt-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
@media (max-width: 600px) {
    .attempt-item { flex-direction: column; align-items: stretch; }
    .attempt-item-right { justify-content: space-between; }
}
.attempt-item-left { flex: 1; min-width: 0; }
.attempt-item-subject { font-weight: 700; color: #0f172a; font-size: 15px; }
.attempt-item-qnum { font-weight: 500; color: #64748b; font-size: 13px; margin-left: 4px; }
.attempt-item-date { font-size: 12px; color: #64748b; margin-top: 4px; }
.attempt-item-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.attempt-item-score { font-weight: 800; font-size: 18px; color: #0f172a; white-space: nowrap; }
.attempt-item-max { font-size: 12px; font-weight: 500; color: #94a3b8; }
.attempt-item-band {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.attempt-item-band.is-correct { background: #d1fae5; color: #065f46; }
.attempt-item-band.is-partial { background: #fef3c7; color: #92400e; }
.attempt-item-band.is-wrong   { background: #fee2e2; color: #991b1b; }
.attempt-item-btn {
    background: #eff6ff;
    color: #2563eb;
    padding: 6px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    transition: background 0.15s ease;
}
.attempt-item-btn:hover { background: #dbeafe; }

/* ═══ PHASE 5 — Nav + Detail polish ═══ */
.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: transparent;
    border: none;
    padding: 16px;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
    font-family: inherit;
}
.timeline-header:hover { background: #f8fafc; }
.timeline-header:focus-visible { outline: 3px solid #3b82f6; outline-offset: 2px; }
.timeline-header-left { flex: 1; min-width: 0; }
.timeline-header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.timeline-score { font-weight: 800; color: #0f172a; white-space: nowrap; }
.timeline-toggle { color: #64748b; font-size: 12px; transition: transform 0.2s; }
.timeline-header[aria-expanded="true"] .timeline-toggle { transform: rotate(180deg); }

/* Empty state card */
.empty-state-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 40px 32px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-top: 24px;
}
.empty-state-title { font-size: 20px; font-weight: 800; color: #0f172a; margin: 0 0 8px 0; }
.empty-state-desc { font-size: 14px; color: #64748b; margin: 0 0 24px 0; }
.empty-state-label { font-size: 13px; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 12px 0; }
.empty-state-subjects { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 24px; }
.empty-state-subject-btn {
    display: inline-block;
    padding: 8px 16px;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    transition: background 0.15s;
}
.empty-state-subject-btn:hover { background: #dbeafe; }
.empty-state-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ═══ PHASE 6 — My Questions book grid ═══ */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 8px;
}
.book-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
}
.book-header {
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.book-title {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}
.book-question-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}
.book-question-item {
    padding: 12px 20px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: #1e293b;
    line-height: 1.5;
}
.book-question-item:last-child {
    border-bottom: none;
}
@media (max-width: 600px) {
    .book-grid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════
   CRITICAL FIX — Grid overflow / column cut-off
   Root cause: CSS Grid items default to min-width: auto, so long
   unbreakable content forces the column wider than the viewport,
   pushing the right sidebar off-screen. min-width: 0 lets columns
   shrink to their declared grid track size.
   Industry ref: https://css-tricks.com/preventing-a-grid-blowout/
   ════════════════════════════════════════════════════════════ */

/* Force the whole dashboard to never overflow horizontally */
.wc-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* The main 2-column grid — enforce proper tracks */
.wc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
    gap: 24px;
    align-items: start;
    max-width: 100%;
    box-sizing: border-box;
}

/* THE FIX: allow grid columns to shrink below content size */
.wc-grid > * {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Long text in evidence boxes — wrap instead of overflow */
.wc-evidence-txt,
.wc-evidence-box,
.wc-root-cause-text,
.wc-suggestion-item,
.expert-suggestion-item,
.evidence-text,
.diagnosis-callout-text {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

/* Tables should scroll inside their own card, not expand the grid */
.wc-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
}

/* Prevent any card from blowing out its parent */
.wc-card {
    max-width: 100%;
    box-sizing: border-box;
}

/* Ensure images / svg in cards don't overflow */
.wc-card img,
.wc-card svg {
    max-width: 100%;
    height: auto;
}

/* Mobile: collapse to single column (already there but reinforce) */
@media (max-width: 1024px) {
    .wc-grid {
        grid-template-columns: 1fr;
    }
}

/* Extra small screens — reduce padding */
@media (max-width: 600px) {
    .wc-dashboard {
        padding: 16px 12px;
    }
    .wc-grid {
        gap: 16px;
    }
}


/* ═══ POLISH — Ring text sizing for 100% ═══ */
.wc-ring-val {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
    letter-spacing: -0.5px;
}

/* ═══ Khaas Alfaz — perfect score message ═══ */
.wc-text-success { color: #059669; }
.font-bold { font-weight: 700; }

/* ═══ TREE V2 — Better states ═══ */
.tree-node {
    padding: 16px 20px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.15s;
}
.tree-node.is-mastered { border-color: #10b981; background: #ecfdf5; }
.tree-node.is-in_progress { border-color: #f59e0b; background: #fffbeb; }
.tree-node.is-not_started { border-color: #94a3b8; background: #f8fafc; }
.tree-node.is-locked { border-color: #cbd5e1; background: #f1f5f9; opacity: 0.6; }
.tree-node.is-current { box-shadow: 0 0 0 4px #bfdbfe; }

.tree-stats { flex-shrink: 0; }
.tree-pct {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
}
.tree-qcount {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
    margin-top: 2px;
}
.tree-node.is-mastered .tree-pct { color: #065f46; }
.tree-node.is-in_progress .tree-pct { color: #92400e; }

/* ═══ TREE V3 — shift-aware states ═══ */
.tree-node {
    padding: 16px 20px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.15s;
}
.tree-node.is-mastered      { border-color: #10b981; background: #ecfdf5; }
.tree-node.is-morning_done  { border-color: #f59e0b; background: #fffbeb; }
.tree-node.is-evening_done  { border-color: #8b5cf6; background: #f5f3ff; }
.tree-node.is-in_progress   { border-color: #3b82f6; background: #eff6ff; }
.tree-node.is-not_started   { border-color: #94a3b8; background: #f8fafc; }
.tree-node.is-locked        { border-color: #cbd5e1; background: #f1f5f9; opacity: 0.6; }
.tree-node.is-current       { box-shadow: 0 0 0 4px #bfdbfe; }

.tree-node-left { flex: 1; min-width: 140px; }
.tree-node-right { flex-shrink: 0; }

.shift-indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}
.shift-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid transparent;
}
.shift-pill.is-complete { background: #d1fae5; color: #065f46; border-color: #10b981; }
.shift-pill.is-partial  { background: #fef3c7; color: #92400e; border-color: #f59e0b; }

.tree-stats { flex-shrink: 0; }
.tree-pct { font-size: 20px; font-weight: 800; color: #0f172a; line-height: 1; }
.tree-qcount { font-size: 11px; color: #64748b; font-weight: 600; margin-top: 2px; }

.tree-node.is-mastered .tree-pct      { color: #065f46; }
.tree-node.is-morning_done .tree-pct  { color: #92400e; }
.tree-node.is-evening_done .tree-pct  { color: #5b21b6; }
.tree-node.is-in_progress .tree-pct   { color: #1e40af; }

@media (max-width: 600px) {
    .tree-node-right { flex-direction: column; align-items: flex-start !important; gap: 8px !important; }
}

/* ═══════════════════════════════════════════════════════════════
   SCROLLBAR STYLING — Industry standard (Material 3 / Apple HIG)
   Not hidden — styled. WCAG SC 2.5.1 compliant (visible affordance)
   Applies only to legitimately scrollable regions.
   ═══════════════════════════════════════════════════════════════ */
.table-responsive,
.table-wrap,
.dash-table-wrap,
.kc-table-wrap,
.paper-table-wrap,
.help-drawer-body,
.prompt-box,
.output-block {
    scrollbar-width: thin;                                   /* Firefox */
    scrollbar-color: #cbd5e1 transparent;                    /* Firefox */
    scrollbar-gutter: stable;                                /* Prevent layout shift */
}

/* Chrome/Edge/Safari */
.table-responsive::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.dash-table-wrap::-webkit-scrollbar,
.kc-table-wrap::-webkit-scrollbar,
.paper-table-wrap::-webkit-scrollbar,
.help-drawer-body::-webkit-scrollbar,
.prompt-box::-webkit-scrollbar,
.output-block::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track,
.dash-table-wrap::-webkit-scrollbar-track,
.kc-table-wrap::-webkit-scrollbar-track,
.paper-table-wrap::-webkit-scrollbar-track,
.help-drawer-body::-webkit-scrollbar-track,
.prompt-box::-webkit-scrollbar-track,
.output-block::-webkit-scrollbar-track {
    background: transparent;
}

.table-responsive::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.dash-table-wrap::-webkit-scrollbar-thumb,
.kc-table-wrap::-webkit-scrollbar-thumb,
.paper-table-wrap::-webkit-scrollbar-thumb,
.help-drawer-body::-webkit-scrollbar-thumb,
.prompt-box::-webkit-scrollbar-thumb,
.output-block::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover,
.kc-table-wrap::-webkit-scrollbar-thumb:hover,
.paper-table-wrap::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* BODY scrollbar — page-level scrolling (kept subtle but visible) */
body {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}
body::-webkit-scrollbar {
    width: 8px;
}
body::-webkit-scrollbar-track {
    background: #f1f5f9;
}
body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Ensure tables NEVER force scrollbars when in a NON-wrapper panel */
.panel > table:not(.table-responsive *) {
    min-width: 0 !important;
}

/* ═══════════════════════════════════════════════════════════════
   MATRIX TABLE MOBILE FIX (2026-11-06)
   Problem: sticky student column + tiny cells → squished controls
   Fix: enforce touch-target min-widths, narrower sticky on mobile,
        shadow on sticky column so users know it's fixed
   Standards: WCAG 2.5.5 (44×44 touch), Apple HIG (44px), Material 3 (48dp)
   ═══════════════════════════════════════════════════════════════ */

/* Every data cell must be wide enough for its control */
.matrix-table td,
.matrix-table th {
  min-width: 32px;
}

/* Star select needs room for its numbers */
.matrix-table .star-select {
  min-width: 48px;
  max-width: 60px;
  padding: 4px 2px;
  font-size: 0.8rem;
  border: 1px solid var(--ideal-border, #d1d5db);
  border-radius: 4px;
  background: #fff;
  color: var(--ideal-text, #111827);
}

/* Sticky column: visible shadow so users know it's fixed */
.matrix-table .col-student {
  box-shadow: 2px 0 6px rgba(0,0,0,0.08);
  white-space: normal;
}

/* Tablet & below: touch-target sizing + narrower sticky */
@media (max-width: 768px) {
  .matrix-table td,
  .matrix-table th {
    min-width: 42px;
  }
  .matrix-table .star-select {
    min-width: 50px;
    font-size: 0.85rem;
  }
  .matrix-table .col-student {
    min-width: 100px;
    max-width: 110px;
    font-size: 0.72rem;
    padding: 4px 6px;
    box-shadow: 3px 0 8px rgba(0,0,0,0.12);
  }
  .matrix-table thead th.col-student {
    font-size: 0.68rem;
  }
  /* Hide "Assigned Tasks" details on mobile — too much for the sticky column */
  .matrix-table .col-student details {
    display: none;
  }
}

/* Extra-small mobile: even narrower sticky, bigger targets */
@media (max-width: 480px) {
  .matrix-table .col-student {
    min-width: 90px;
    max-width: 100px;
  }
  .matrix-table td,
  .matrix-table th {
    min-width: 44px;
  }
}


/* ═══════════════════════════════════════════════════════════════
   DASH COMPONENT SYSTEM — COMPLETION PASS (2026-11-06)
   Fills in missing dash-* classes used by teacher_daily_codes.html
   Centralized in ideal_main.css per user requirement.
   Standards: WCAG 2.5.5 (44px tap target), design-token driven
   ═══════════════════════════════════════════════════════════════ */

/* ─── Layout: 2-column dashboard grid ─── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--ideal-space-4);
  margin-bottom: var(--ideal-space-4);
}
.dash-grid > .col-full { grid-column: 1 / -1; }
.dash-grid > .col-half { grid-column: span 1; }
@media (max-width: 768px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-grid > .col-half { grid-column: 1 / -1; }
}

/* ─── Header bar ─── */
.dash-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ideal-space-3);
  background: var(--ideal-surface);
  border: 1px solid var(--ideal-border);
  border-radius: var(--ideal-radius);
  padding: var(--ideal-space-4);
  margin-bottom: var(--ideal-space-4);
}
.dash-title h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ideal-text);
  margin: 0 0 4px;
}
.dash-title p {
  font-size: 0.85rem;
  color: var(--ideal-muted);
  margin: 0;
}

/* ─── Nav group ─── */
.dash-nav-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ideal-space-2);
  align-items: center;
}

/* ─── Missing button variants ─── */
.dash-btn-danger {
  background: var(--ideal-danger);
  color: #fff;
  border-color: var(--ideal-danger);
}
.dash-btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.dash-btn-success {
  background: var(--ideal-success);
  color: #fff;
  border-color: var(--ideal-success);
}
.dash-btn-success:hover { background: #15803d; border-color: #15803d; }
.dash-btn-warning {
  background: var(--ideal-warning);
  color: #fff;
  border-color: var(--ideal-warning);
}
.dash-btn-warning:hover { background: #b45309; border-color: #b45309; }
.dash-btn-pm-outline {
  background: transparent;
  color: var(--ideal-primary);
  border: 1px solid var(--ideal-primary);
}
.dash-btn-pm-outline:hover { background: var(--ideal-primary-bg); }
.dash-btn-pm-primary {
  background: var(--ideal-primary);
  color: #fff;
  border-color: var(--ideal-primary);
}
.dash-btn-pm-primary:hover { background: var(--ideal-primary-dark); }
.dash-btn-disabled,
.dash-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.dash-btn-xs {
  min-height: 28px;
  padding: 3px 10px;
  font-size: 0.72rem;
}

/* Focus ring on all dash-btns */
.dash-btn:focus-visible {
  outline: 2px solid var(--ideal-primary);
  outline-offset: 2px;
}

/* ─── Select dropdown arrow (dash-input) ─── */
select.dash-input,
select.dash-input-sm {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236b7280'%3e%3cpath d='M4 6l4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 30px;
  cursor: pointer;
}

/* ─── Coverage dots grid ─── */
.dash-coverage-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: var(--ideal-space-2) 0;
}
.dash-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  background: #94a3b8;
  transition: transform 0.1s, box-shadow 0.1s;
}
.dash-dot:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.dash-dot.is-full { background: var(--ideal-success); }
.dash-dot.is-partial { background: var(--ideal-warning); }
.dash-dot.is-missing { background: var(--ideal-danger); }
.dash-dot.is-future { background: #cbd5e1; color: #475569; }
.dash-dot.is-selected {
  outline: 3px solid var(--ideal-primary);
  outline-offset: 1px;
}

/* ─── Structural helpers ─── */
.dash-divider {
  height: 1px;
  background: var(--ideal-border);
  margin: var(--ideal-space-3) 0;
  border: none;
}
.dash-td-empty {
  color: var(--ideal-muted);
  font-style: italic;
  text-align: center;
  padding: var(--ideal-space-4);
}

/* ─── Shift boxes ─── */
.shift-box {
  display: flex;
  flex-direction: column;
  gap: var(--ideal-space-2);
  padding: var(--ideal-space-3);
  border: 1px solid var(--ideal-border);
  border-radius: var(--ideal-radius);
  background: var(--ideal-surface);
}
.shift-box.shift-am { border-left: 4px solid var(--ideal-warning); }
.shift-box.shift-pm { border-left: 4px solid var(--ideal-primary); }
.shift-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ideal-muted);
}

/* ─── Alerts ─── */
.alert {
  padding: 12px 16px;
  border-radius: var(--ideal-radius);
  border: 1px solid var(--ideal-border);
  font-size: 0.9rem;
  margin-bottom: var(--ideal-space-2);
}
.alert-success {
  background: var(--ideal-success-bg);
  border-color: var(--ideal-success);
  color: #065f46;
}
.alert-error {
  background: var(--ideal-danger-bg);
  border-color: var(--ideal-danger);
  color: #991b1b;
}
.alert-warning {
  background: var(--ideal-warning-bg);
  border-color: var(--ideal-warning);
  color: #92400e;
}
.alert-info {
  background: var(--ideal-primary-bg);
  border-color: var(--ideal-primary);
  color: #0c4a6e;
}

/* ─── Utility classes (replace inline styles) ─── */
.form-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--ideal-space-4);
  margin-bottom: var(--ideal-space-4);
}
@media (max-width: 768px) {
  .form-2col { grid-template-columns: 1fr; }
}
.dash-card-padded { padding: var(--ideal-space-4); }
.form-section-divider {
  border-top: 1px solid var(--ideal-border);
  padding-top: var(--ideal-space-2);
  margin-top: var(--ideal-space-1);
}
.dash-empty-msg {
  color: var(--ideal-muted);
  font-size: 0.85rem;
  padding: var(--ideal-space-3) 0;
  margin: 0;
}


/* ═══════════════════════════════════════════════════════════════
   PROFESSIONAL FORM PRIMITIVES (2026-11-06)
   Canonical form layout — never use .d-flex for form stacking
   Standards: WAI-ARIA form patterns, WCAG 2.5.5 tap targets
   ═══════════════════════════════════════════════════════════════ */

/* Override card grid — equal-height cards */
.override-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--ideal-space-4);
  margin-bottom: var(--ideal-space-4);
}
@media (max-width: 900px) {
  .override-cards { grid-template-columns: 1fr; }
}

/* Card inside override-cards — always fills height */
.override-card {
  display: flex;
  flex-direction: column;
  background: var(--ideal-surface);
  border: 1px solid var(--ideal-border);
  border-radius: var(--ideal-radius);
  padding: var(--ideal-space-4);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.override-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ideal-text);
  margin: 0 0 4px 0;
}
.override-card-desc {
  font-size: 0.8rem;
  color: var(--ideal-muted);
  margin: 0 0 var(--ideal-space-3) 0;
  line-height: 1.4;
}

/* Canonical form layout — vertical stack */
.dash-form {
  display: flex;
  flex-direction: column;
  gap: var(--ideal-space-3);
  flex: 1 1 auto;
}

/* Individual field: label above input */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.form-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ideal-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

/* Row of two fields side-by-side */
.form-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--ideal-space-3);
}
@media (max-width: 600px) {
  .form-field-row { grid-template-columns: 1fr; }
}

/* Optional sub-section within a form */
.form-section {
  border-top: 1px solid var(--ideal-border);
  padding-top: var(--ideal-space-3);
  margin-top: var(--ideal-space-1);
  display: flex;
  flex-direction: column;
  gap: var(--ideal-space-2);
}
.form-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ideal-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Action button pinned to bottom */
.form-actions {
  margin-top: auto;
  padding-top: var(--ideal-space-2);
}
.form-actions .dash-btn {
  width: 100%;
  justify-content: center;
}

/* Helper text under fields */
.form-help {
  font-size: 0.7rem;
  color: var(--ideal-muted);
  margin: 2px 0 0 0;
}

/* Make all inputs in the form respect card width */
.dash-form .dash-input,
.dash-form select.dash-input,
.dash-form input.dash-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Fix button stretching when inside flex column */
.dash-form .dash-btn {
  height: auto;
  min-height: 40px;
  padding: 10px 16px;
  align-self: stretch;
  flex: 0 0 auto;
}


/* Optional tag on form section labels */
.form-optional-tag {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ideal-muted);
  font-size: 0.7rem;
  margin-left: 4px;
}


/* ═══════════════════════════════════════════════════════════════
   VISIBILITY CONTROL CARDS (2026-11-06)
   Professional show/hide status for daily code publication
   ═══════════════════════════════════════════════════════════════ */
.visibility-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--ideal-space-3);
}
@media (max-width: 640px) {
  .visibility-2col { grid-template-columns: 1fr; }
}

.visibility-card {
  display: flex;
  flex-direction: column;
  padding: var(--ideal-space-3);
  border-radius: var(--ideal-radius);
  border: 1px solid var(--ideal-border);
  background: var(--ideal-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.visibility-card.is-published {
  border-left: 4px solid var(--ideal-success);
  background: linear-gradient(to right, #f0fdf4 0%, #ffffff 40%);
}
.visibility-card.is-hidden-state {
  border-left: 4px solid var(--ideal-danger);
  background: linear-gradient(to right, #fef2f2 0%, #ffffff 40%);
}

.visibility-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.visibility-shift {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ideal-text);
}
.visibility-pill {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 999px;
  background: var(--ideal-bg);
}
.visibility-card.is-published .visibility-pill {
  background: var(--ideal-success-bg);
  color: var(--ideal-success);
}
.visibility-card.is-hidden-state .visibility-pill {
  background: var(--ideal-danger-bg);
  color: var(--ideal-danger);
}

.visibility-stats {
  font-size: 0.78rem;
  color: var(--ideal-muted);
  line-height: 1.4;
  margin-bottom: 6px;
}
.visibility-stats strong {
  color: var(--ideal-text);
  font-weight: 700;
}
.visibility-stats .text-warning {
  color: var(--ideal-warning);
  font-weight: 600;
}


/* ═══════════════════════════════════════════════════════════════
   QUESTION SEARCH UI (2026-11-06)
   Live search dropdown for QuestionAssignment picker
   ═══════════════════════════════════════════════════════════════ */
.q-search-wrap { position: relative; }
.q-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--ideal-surface);
  border: 1px solid var(--ideal-border);
  border-radius: var(--ideal-radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  z-index: 50;
  margin-top: 4px;
}
.q-search-results.is-hidden { display: none; }
.q-search-item {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ideal-border);
  cursor: pointer;
  transition: background 0.1s;
}
.q-search-item:last-child { border-bottom: none; }
.q-search-item:hover, .q-search-item.selected {
  background: var(--ideal-primary-bg);
}
.q-search-text { font-size: 0.85rem; color: var(--ideal-text); line-height: 1.35; }
.q-search-meta {
  font-size: 0.7rem;
  color: var(--ideal-muted);
  margin-top: 3px;
}
.q-search-selected {
  padding: 10px 12px;
  background: var(--ideal-primary-bg);
  border: 1px solid var(--ideal-primary);
  border-radius: var(--ideal-radius);
  font-size: 0.85rem;
  margin-top: 6px;
}
.q-search-selected.is-hidden { display: none; }
.q-search-selected-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ideal-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.qa-table code {
  background: var(--ideal-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
}


/* ═══════════════════════════════════════════════════════════════
   FORM POLISH + QUICK LINKS (2026-11-06)
   ═══════════════════════════════════════════════════════════════ */

/* Auto-fit form grid for 3-6 fields */
.form-field-row--wide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--ideal-space-3);
  align-items: end;
}
@media (max-width: 640px) {
  .form-field-row--wide { grid-template-columns: 1fr; }
}

/* Checkbox list — replaces cramped multi-select */
.form-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--ideal-border);
  border-radius: var(--ideal-radius);
  background: var(--ideal-surface);
  min-height: 44px;
}
.form-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--ideal-text);
  user-select: none;
}
.form-checkbox-item:hover { color: var(--ideal-primary); }
.form-checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--ideal-danger);
  flex-shrink: 0;
}

/* Right-aligned form action buttons */
.form-actions--inline {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--ideal-space-3);
}

/* Quick links bar — cross-page navigation */
.quick-links-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
  border: 1px solid #93c5fd;
  border-radius: var(--ideal-radius);
  margin-bottom: var(--ideal-space-4);
}
.quick-links-bar a {
  font-size: 0.82rem;
  padding: 6px 14px;
  border-radius: 6px;
  background: white;
  color: var(--ideal-primary);
  text-decoration: none;
  border: 1px solid var(--ideal-primary);
  font-weight: 600;
  transition: all 0.15s;
}
.quick-links-bar a:hover {
  background: var(--ideal-primary);
  color: white;
}


/* Enhanced question search popup */
.q-search-popup-header {
  padding: 10px 14px;
  background: var(--ideal-bg);
  border-bottom: 1px solid var(--ideal-border);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ideal-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 1;
}
.q-search-item {
  padding: 12px 14px !important;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.q-search-item:hover {
  background: var(--ideal-primary-bg) !important;
  border-left-color: var(--ideal-primary);
}
.q-search-item .q-search-text {
  font-weight: 500;
  color: var(--ideal-text);
}
.q-search-meta {
  margin-top: 4px !important;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.q-search-meta span {
  background: var(--ideal-bg);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
}
.q-search-selected {
  padding: 12px 14px !important;
  background: linear-gradient(135deg, #eff6ff, #f0f9ff) !important;
  border: 2px solid var(--ideal-primary) !important;
  border-radius: var(--ideal-radius) !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.q-search-selected-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ideal-primary);
  text-transform: uppercase;
}
.q-search-selected-text {
  flex: 1;
  font-size: 0.85rem;
  color: var(--ideal-text);
}
.q-search-change-btn {
  background: white;
  border: 1px solid var(--ideal-primary);
  color: var(--ideal-primary);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.q-search-change-btn:hover {
  background: var(--ideal-primary);
  color: white;
}
.q-search-loading {
  padding: 16px;
  text-align: center;
  color: var(--ideal-muted);
  font-size: 0.85rem;
}
.q-search-empty {
  padding: 16px;
  text-align: center;
  color: var(--ideal-muted);
  font-size: 0.85rem;
}


/* ═══════════════════════════════════════════════════════════════
   MULTI-SELECT QUESTION LIST (2026-11-06)
   ═══════════════════════════════════════════════════════════════ */
.q-checkbox-list {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--ideal-border);
  border-radius: var(--ideal-radius);
  background: var(--ideal-surface);
  margin-top: 8px;
}
.q-checkbox-list.is-hidden { display: none; }

.q-checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ideal-border);
  cursor: pointer;
  transition: background 0.12s;
}
.q-checkbox-item:last-child { border-bottom: none; }
.q-checkbox-item:hover { background: var(--ideal-bg); }
.q-checkbox-item.is-checked {
  background: var(--ideal-primary-bg);
  border-left: 3px solid var(--ideal-primary);
}
.q-checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--ideal-primary);
  cursor: pointer;
  flex-shrink: 0;
}
.q-checkbox-content { flex: 1; min-width: 0; }
.q-checkbox-text {
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--ideal-text);
  font-weight: 500;
}
.q-checkbox-meta {
  font-size: 0.72rem;
  color: var(--ideal-muted);
  margin-top: 3px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.q-checkbox-meta span {
  background: var(--ideal-bg);
  padding: 2px 8px;
  border-radius: 4px;
}
.q-checkbox-item.is-checked .q-checkbox-meta span {
  background: white;
}

/* Selection summary bar */
.q-selection-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--ideal-primary-bg);
  border: 1px solid var(--ideal-primary);
  border-radius: var(--ideal-radius);
  margin-top: 8px;
  margin-bottom: 8px;
}
.q-selection-bar.is-hidden { display: none; }
.q-selection-info {
  font-size: 0.85rem;
  color: var(--ideal-text);
}
.q-selection-info strong {
  font-size: 1.1rem;
  color: var(--ideal-primary);
  margin-right: 4px;
}

/* Scroll list header (sticky) */
.q-list-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 14px;
  background: var(--ideal-bg);
  border-bottom: 1px solid var(--ideal-border);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ideal-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.q-list-header .btn-select-all {
  background: transparent;
  border: 1px solid var(--ideal-primary);
  color: var(--ideal-primary);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}
.q-list-header .btn-select-all:hover {
  background: var(--ideal-primary);
  color: white;
}


/* === Extracted inline styles (2026-11-10) === */
.ei-list-item-default { list-style: none; cursor: pointer; background: #f9fafb; border-radius: 6px; }
.ei-cursor-pointer { cursor: pointer; }
.ei-min-w-150 { min-width: 150px; }
.ei-border-l-blue { border-left: 4px solid #3b82f6; }
.ei-pad-16-32-fs-lg { padding: 16px 32px; font-size: 1.1rem; }
.ei-fs-lg { font-size: 1.1rem; }
.ei-max-w-800-center { max-width: 800px; margin: 0 auto; }


/* === Extracted inline styles — batch 2 (2026-11-10) === */
.ei-min-w-220 { min-width: 220px; }
.ei-min-w-200 { min-width: 200px; }
.ei-max-w-full { max-width: 100%; }
.ei-fs-085 { font-size: 0.85rem; }
.ei-fs-07 { font-size: 0.7rem; }
.ei-fs-075-pad-4-10 { font-size: 0.75rem; padding: 4px 10px; }
.ei-fs-07-pad-2-8 { font-size: 0.7rem; padding: 2px 8px; }
.ei-fs-3xl-mb-12 { font-size: 3rem; margin-bottom: 12px; }
.ei-fs-base { font-size: 1rem; }
.ei-fs-16 { font-size: 1.6rem; }
.ei-fs-085-gray-666 { font-size: 0.85rem; color: #666; }
.ei-fs-0875 { font-size: 0.875rem; }
.ei-mt-6 { margin-top: 6px; }
.ei-callout-warning { border-left: 4px solid #f59e0b; background: #fffbeb; }
.ei-border-l-green { border-left: 4px solid #10b981; }
.ei-text-left-pad-8 { text-align: left; padding: 8px; }
.ei-pad-8 { padding: 8px; }


/* === Utility classes — property:value extraction (2026-11-10) === */
.ei-widt-100 { width: 100%; }
.ei-bord-6px { border-radius: 6px; }
.ei-bord-8px { border-radius: 8px; }
.ei-bord-none { border: none; }
.ei-font-0-85rem { font-size: 0.85rem; }
.ei-colo-white { color: white; }
.ei-marg-0 { margin: 0; }
.ei-font-0-75rem { font-size: 0.75rem; }
.ei-font-bold { font-weight: bold; }
.ei-font-600 { font-weight: 600; }
.ei-padd-12px { padding: 12px; }
.ei-curs-pointer { cursor: pointer; }
.ei-font-monospace { font-family: monospace; }
.ei-colo-6b7280 { color: #6b7280; }
.ei-padd-8px { padding: 8px; }
.ei-alig-center { align-items: center; }
.ei-bord-1px-solid--d1d5db { border: 1px solid #d1d5db; }
.ei-back-10b981 { background: #10b981; }
.ei-font-1-1rem { font-size: 1.1rem; }
.ei-bord-4px { border-radius: 4px; }
.ei-font-0-8rem { font-size: 0.8rem; }
.ei-disp-none { display: none; }
.ei-back-f8fafc { background: #f8fafc; }
.ei-padd-10px { padding: 10px; }
.ei-back-f0fdf4 { background: #f0fdf4; }
.ei-back-eff6ff { background: #eff6ff; }
.ei-bord-4px-solid--f59e0b { border-left: 4px solid #f59e0b; }
.ei-back-f9fafb { background: #f9fafb; }
.ei-bord-1px-solid--e5e7eb { border: 1px solid #e5e7eb; }
.ei-font-0-95rem { font-size: 0.95rem; }
.ei-padd-16px { padding: 16px; }
.ei-font-800 { font-weight: 800; }
.ei-bord-4px-solid--3b82f6 { border-left: 4px solid #3b82f6; }
.ei-line-1-6 { line-height: 1.6; }
.ei-whit-pre-wrap { white-space: pre-wrap; }
.ei-over-hidden { overflow: hidden; }
.ei-text-left { text-align: left; }
.ei-font-700 { font-weight: 700; }
.ei-bord-12px { border-radius: 12px; }
.ei-font-1rem { font-size: 1rem; }


/* === Utility classes — batch 4 expansion (2026-11-10) === */
.ei-marg-8px { margin-top: 8px; }
.ei-font-0-9rem { font-size: 0.9rem; }
.ei-marg-10px { margin-bottom: 10px; }
.ei-bord-3px-solid--f59e0b { border-left: 3px solid #f59e0b; }
.ei-padd-12px-16px { padding: 12px 16px; }
.ei-alig-flex-start { align-items: flex-start; }
.ei-gap-10px { gap: 10px; }
.ei-marg-3px { margin-top: 3px; }
.ei-widt-24px { width: 24px; }
.ei-heig-24px { height: 24px; }
.ei-bord-50 { border-radius: 50%; }
.ei-back-white { background: white; }
.ei-flex-0 { flex-shrink: 0; }
.ei-colo-111827 { color: #111827; }
.ei-whit-pre-line { white-space: pre-line; }
.ei-list-none { list-style: none; }
.ei-font-1-2rem { font-size: 1.2rem; }
.ei-righ-0 { right: 0; }
.ei-marg-4px { margin-bottom: 4px; }
.ei-padd-6px { padding: 6px; }
.ei-marg-6px { margin-left: 6px; }
.ei-padd-4px-10px { padding: 4px 10px; }
.ei-bord-2px-solid--10b981 { border: 2px solid #10b981; }
.ei-font-14px { font-size: 14px; }
.ei-text-line-through { text-decoration: line-through; }
.ei-opac-0-7 { opacity: 0.7; }
.ei-gap-6px { gap: 6px; }
.ei-gap-12px { gap: 12px; }
.ei-marg-16px { margin-top: 16px; }
.ei-lett-0-05em { letter-spacing: 0.05em; }
.ei-font-2rem { font-size: 2rem; }
.ei-line-1-1 { line-height: 1.1; }
.ei-gap-16px { gap: 16px; }
.ei-marg-20px { margin-bottom: 20px; }
.ei-font-1-4rem { font-size: 1.4rem; }
.ei-colo-666 { color: #666; }
.ei-bord-1px-solid--ccc { border: 1px solid #ccc; }
.ei-marg-0-auto { margin: 0 auto; }
.ei-padd-2rem { padding: 2rem; }
.ei-text-center { text-align: center; }
.ei-back-fff { background: #fff; }
.ei-colo-3b82f6 { color: #3b82f6; }
.ei-font-2-5rem { font-size: 2.5rem; }
.ei-marg-1rem { margin-bottom: 1rem; }
.ei-marg-2rem { margin-top: 2rem; }
.ei-colo-4b5563 { color: #4b5563; }
.ei-disp-flex { display: flex; }
.ei-just-space-between { justify-content: space-between; }
.ei-bord-1px-solid--000 { border-top: 1px solid #000; }
.ei-padd-0-5rem { padding-top: 0.5rem; }
.ei-widt-150px { width: 150px; }
.ei-back-fffbeb { background: #fffbeb; }
.ei-font-0-7rem { font-size: 0.7rem; }
.ei-padd-2px-8px { padding: 2px 8px; }
.ei-bord-1px-solid--bbf7d0 { border: 1px solid #bbf7d0; }
.ei-colo-166534 { color: #166534; }
.ei-back-fef2f2 { background: #fef2f2; }
.ei-bord-1px-solid--fecaca { border: 1px solid #fecaca; }
.ei-colo-991b1b { color: #991b1b; }
.ei-padd-6px-16px { padding: 6px 16px; }
.ei-minw-300px { min-width: 300px; }
.ei-bord-3b82f6 { border-color: #3b82f6; }
.ei-line-1-8 { line-height: 1.8; }
.ei-back-f0f9ff { background: #f0f9ff; }
.ei-bord-4px-solid--10b981 { border-left: 4px solid #10b981; }
.ei-bord-4px-solid--8b5cf6 { border-left: 4px solid #8b5cf6; }
.ei-bord-4px-solid--ef4444 { border-left: 4px solid #ef4444; }
.ei-padd-20px { padding: 20px; }
.ei-maxw-720px { max-width: 720px; }
.ei-back-fef3c7 { background: #fef3c7; }
.ei-colo-92400e { color: #92400e; }
.ei-disp-block { display: block; }
.ei-font-italic { font-style: italic; }
.ei-marg-15px { margin-bottom: 15px; }
.ei-padd-6px-14px { padding: 6px 14px; }
.ei-boxs-0-1px-3px-rgba-0-0-0 { box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.ei-padd-10px-20px { padding: 10px 20px; }
.ei-colo-374151 { color: #374151; }
.ei-bord-1px-solid--3b82f6 { border: 1px solid #3b82f6; }
.ei-padd-15px-30px { padding: 15px 30px; }
.ei-maxw-900px { max-width: 900px; }
.ei-flex-wrap { flex-wrap: wrap; }
.ei-gap-8px { gap: 8px; }
.ei-gap-4px { gap: 4px; }
.ei-marg-12px { margin-bottom: 12px; }
.ei-just-flex-end { justify-content: flex-end; }
.ei-bord-1px-solid--f3f4f6 { border-top: 1px solid #f3f4f6; }
.ei-font-1-3rem { font-size: 1.3rem; }
.ei-colo-10b981 { color: #10b981; }
.ei-heig-8px { height: 8px; }
.ei-back-e5e7eb { background: #e5e7eb; }
.ei-text-right { text-align: right; }
.ei-font-0-65rem { font-size: 0.65rem; }
.ei-bord-collapse { border-collapse: collapse; }
.ei-bord-1px-solid--e2e8f0 { border: 1px solid #e2e8f0; }
.ei-bord-16px { border-radius: 16px; }
.ei-padd-24px { padding: 24px; }
.ei-colo-1e293b { color: #1e293b; }
.ei-padd-6px-12px { padding: 6px 12px; }
.ei-back-1e293b { background: #1e293b; }
.ei-colo-f8fafc { color: #f8fafc; }
.ei-text-uppercase { text-transform: uppercase; }
.ei-colo-e2e8f0 { color: #e2e8f0; }
.ei-heig-100 { height: 100%; }
.ei-back-e2e8f0 { background: #e2e8f0; }
.ei-bord-bbf7d0 { border-color: #bbf7d0; }
.ei-over-auto { overflow-y: auto; }
.ei-minw-250px { min-width: 250px; }
.ei-bord-3px-solid--3b82f6 { border-left: 3px solid #3b82f6; }
.ei-font-1-05rem { font-size: 1.05rem; }
.ei-colo-9ca3af { color: #9ca3af; }
.ei-back-f8f9fa { background: #f8f9fa; }
.ei-back-fff3cd { background: #fff3cd; }
.ei-bord-4px-solid--ffc107 { border-left: 4px solid #ffc107; }
.ei-minw-100px { min-width: 100px; }
.ei-flex-1 { flex: 1; }
.ei-back-e0f2fe { background: #e0f2fe; }
.ei-colo-78350f { color: #78350f; }
.ei-back-f59e0b { background: #f59e0b; }
.ei-padd-0 { padding: 0; }
.ei-font-0-875rem { font-size: 0.875rem; }
.ei-whit-nowrap { white-space: nowrap; }
.ei-back-fee2e2 { background: #fee2e2; }
.ei-bord-fecaca { border-color: #fecaca; }
.ei-widt-22px { width: 22px; }
.ei-heig-22px { height: 22px; }
.ei-font-500 { font-weight: 500; }
.ei-font-3rem { font-size: 3rem; }
.ei-back-1e1e1e { background-color: #1e1e1e; }
.ei-padd-15px { padding: 15px; }
.ei-colo-00ffcc { color: #00ffcc; }
.ei-font-sf-mono---monaco--mo { font-family: 'sf mono', monaco, monospace; }
.ei-bord-1px-solid--444 { border: 1px solid #444; }
.ei-bord-1px-dashed--e5e7eb { border-top: 1px dashed #e5e7eb; }
.ei-font-inherit { font-family: inherit; }
.ei-font-1-1em { font-size: 1.1em; }
.ei-marg-24px { margin-top: 24px; }
.ei-back-dcfce7 { background: #dcfce7; }
.ei-minw-200px { min-width: 200px; }
.ei-font-12px { font-size: 12px; }
.ei-font-16px { font-size: 16px; }
.ei-text-none { text-decoration: none; }
.ei-widt-92vw { width: 92vw; }
.ei-boxs-0-20px-60px-rgba-0-0 { box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.ei-just-center { justify-content: center; }
.ei-widt-28px { width: 28px; }
.ei-heig-28px { height: 28px; }
.ei-back-3b82f6 { background: #3b82f6; }
.ei-font-ui-monospace--sfmono { font-family: ui-monospace, sfmono-regular, monospace; }
.ei-maxw-600px { max-width: 600px; }
.ei-top-0 { top: 0; }
.ei-left-0 { left: 0; }
.ei-widt-90 { width: 90%; }
.ei-padd-8px-18px { padding: 8px 18px; }
.ei-back-ef4444 { background: #ef4444; }
.ei-padd-8px-16px { padding: 8px 16px; }
.ei-back-0056b3 { background-color: #0056b3; }
.ei-colo-00ff00 { color: #00ff00; }
.ei-colo-0369a1 { color: #0369a1; }
.ei-posi-relative { position: relative; }
.ei-font-1-5rem { font-size: 1.5rem; }
.ei-line-1-5 { line-height: 1.5; }
.ei-disp-inline-block { display: inline-block; }
.ei-maxw-250px { max-width: 250px; }
.ei-colo-ef4444 { color: #ef4444; }
.ei-widt-auto { width: auto; }
.ei-padd-4px-8px { padding: 4px 8px; }
.ei-colo-1e3a5f { color: #1e3a5f; }
.ei-heig-45px { height: 45px; }


/* === Utility classes — safe singles (2026-11-10) === */
.ei-colo-dc2626 { color: #dc2626; }
.ei-disp-grid { display: grid; }
.ei-colo-06b6d4 { color: #06b6d4; }
.ei-padd-3rem { padding: 3rem; }
.ei-marg-1-5rem-0 { margin: 1.5rem 0; }
.ei-marg-4rem { margin-top: 4rem; }
.ei-marg-0-5rem { margin-top: 0.5rem; }
.ei-colo-1e40af { color: #1e40af; }
.ei-line-1 { line-height: 1; }
.ei-marg-12px-0 { margin: 12px 0; }
.ei-font-9px { font-size: 9px; }
.ei-marg-8px-0 { margin: 8px 0; }
.ei-padd-10px-14px { padding: 10px 14px; }
.ei-padd-8px-0 { padding: 8px 0; }
.ei-back-ffffff { background: #ffffff; }
.ei-colo-64748b { color: #64748b; }
.ei-colo-d97706 { color: #d97706; }
.ei-back-f1f5f9 { background: #f1f5f9; }
.ei-back-ecfdf5 { background: #ecfdf5; }
.ei-font-1-25rem { font-size: 1.25rem; }
.ei-line-1-7 { line-height: 1.7; }
.ei-padd-12px-24px { padding: 12px 24px; }
.ei-marg-0-25rem { margin-top: 0.25rem; }
.ei-padd-0-0-0-5rem { padding: 0 0 0.5rem; }
.ei-padd-10px-24px { padding: 10px 24px; }
.ei-colo-d4d4d4 { color: #d4d4d4; }
.ei-back-transparent { background: transparent; }
.ei-back-252526 { background: #252526; }
.ei-colo-ccc { color: #ccc; }
.ei-marg-4px-0-0 { margin: 4px 0 0; }
.ei-back-f3f4f6 { background: #f3f4f6; }
.ei-colo-111 { color: #111; }
.ei-colo-b45309 { color: #b45309; }
.ei-back-f5f3ff { background: #f5f3ff; }
.ei-colo-6d28d9 { color: #6d28d9; }
.ei-colo-4c1d95 { color: #4c1d95; }
.ei-disp-inline-flex { display: inline-flex; }
.ei-back-rgba-0-0-0-0-6 { background: rgba(0,0,0,0.6); }
.ei-marg-auto { margin-left: auto; }
.ei-padd-40px { padding: 40px; }
.ei-marg-0-35rem { margin-left: 0.35rem; }
.ei-gap-0-5rem { gap: 0.5rem; }
.ei-back-fef08a { background: #fef08a; }
.ei-colo-854d0e { color: #854d0e; }
.ei-font-1-15em { font-size: 1.15em; }
.ei-marg-0--important { margin-bottom: 0 !important; }
.ei-padd-48px { padding-left: 48px; }
.ei-back-rgba-0-0-0-0-5 { background: rgba(0,0,0,0.5); }
.ei-back-none { background: none; }
.ei-font-ui-monospace--monosp { font-family: ui-monospace, monospace; }
.ei-marg-0-0-8px-0 { margin: 0 0 8px 0; }
.ei-colo-7f1d1d { color: #7f1d1d; }
.ei-padd-14px-28px { padding: 14px 28px; }
.ei-padd-16px-32px { padding: 16px 32px; }
.ei-padd-40px-20px { padding: 40px 20px; }
.ei-padd-40px-24px { padding: 40px 24px; }
.ei-lett-0-5px { letter-spacing: 0.5px; }
.ei-marg-16px-0 { margin: 16px 0; }
.ei-font-0-82rem { font-size: 0.82rem; }
.ei-font-13px { font-size: 13px; }
.ei-back-28a745 { background-color: #28a745; }
.ei-back-f4f4f4 { background: #f4f4f4; }
.ei-padd-2px-6px { padding: 2px 6px; }
.ei-padd-1-5rem { padding: 1.5rem; }
.ei-marg-3rem { margin-top: 3rem; }
.ei-padd-12px-20px { padding: 12px 20px; }
.ei-colo-059669 { color: #059669; }
.ei-padd-24px-32px { padding: 24px 32px; }
.ei-padd-32px { padding: 32px; }
.ei-bord-20px { border-radius: 20px; }
.ei-colo-1e3a8a { color: #1e3a8a; }

/* ---------------------------------------------------------------------------
 * Command 98 — Final inline CSS cleanup (Amendment A1 exemption 3)
 * 3 utility classes for the 3 duplicate patterns found by Command 95.
 * These replace 6 inline style= occurrences (2 sites each).
 * --------------------------------------------------------------------------- */
.ei-border-left-primary { border-left: 4px solid var(--ideal-primary) !important; }
.ei-text-primary-bold { color: var(--ideal-primary) !important; font-weight: 600 !important; }
.ei-text-warning-bold { color: var(--ideal-warning) !important; font-weight: 600 !important; }


/* ══════════════════════════════════════════════════════════════
   FIX (2026-11-10): visibility buttons (Hide AM/PM Globally)
   were orange with white text — visually indistinct from a plain
   orange bar. Make text bold + dark for clarity.
   ══════════════════════════════════════════════════════════════ */
.dash-btn.dash-btn-warning,
.visibility-card .dash-btn-warning {
  background: #f59e0b !important;
  color: #78350f !important;   /* dark amber text — high contrast on orange */
  font-weight: 800 !important;
  font-size: 0.92rem !important;
  border: 2px solid #b45309 !important;  /* visible border */
  min-height: 44px;                       /* WCAG tap target */
}
.dash-btn.dash-btn-warning:hover {
  background: #d97706 !important;
  color: #451a03 !important;
}


/* ═══════════════════════════════════════════════════════════════
   MOBILE LAYOUT FIX (2026-11-10): Prevent horizontal overflow
   on the teacher daily codes dashboard.
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* 1. Force the grid and its children to shrink */
  .dash-grid {
    grid-template-columns: 1fr !important;
    width: 100%;
    box-sizing: border-box;
  }
  .dash-grid > .col-half,
  .dash-grid > .col-full {
    grid-column: 1 / -1 !important;
    min-width: 0; /* Critical for allowing children to shrink */
  }

  /* 2. Force cards to never exceed the viewport width */
  .dash-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  /* 3. Ensure the table wrapper scrolls internally, not the page */
  .dash-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 4. Make buttons wrap or stack instead of overflowing */
  .dash-form .form-row {
    flex-direction: column;
    align-items: stretch;
  }
  .dash-btn {
    white-space: normal; /* Allow button text to wrap */
    text-align: center;
  }

  /* 5. Fix for the pure blue block (Assign button) */
  #qassign_submit {
    width: 100% !important;
    display: block;
    margin-top: 8px;
  }
}

/* Optional: For very small phones, ensure the button is never clipped */
@media (max-width: 480px) {
  .dash-btn-primary {
    min-height: 44px;
  }
}


/* ═══════════════════════════════════════════════════════════════
   ROOT CAUSE FIX (2026-11-10): input width overflow

   Bug: <input type="number"> and <input type="text"> have browser
   default intrinsic width (~160px for size=20). Inside .form-row
   with 9 inputs, this forces the container to ~1440px, causing
   the entire dashboard to overflow horizontally on mobile (375px).

   Fix: force inputs/selects inside dash-card to respect container
   width. This is the actual fix that resolves the mobile overflow.
   ═══════════════════════════════════════════════════════════════ */

/* Global safety: any input/select/textarea inside a dashboard card
   cannot be wider than its parent (which is <= 100% of viewport). */
.dash-card input:not([type="checkbox"]):not([type="radio"]),
.dash-card select,
.dash-card textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
}

/* On mobile, force all form-groups to wrap to full width so a form
   with 9 fields never tries to fit them on one line. */
@media (max-width: 768px) {
    .dash-card .form-row {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .dash-card .form-row > .form-group,
    .dash-card .form-row > .form-group-sm,
    .dash-card .form-row > .form-field,
    .dash-card .form-row > button,
    .dash-card .form-row > .dash-btn {
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    /* Also: the grid column must allow shrink (auto -> minmax(0,1fr)) */
    .dash-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    .dash-grid > .col-half,
    .dash-grid > .col-full {
        min-width: 0 !important;
        grid-column: 1 / -1 !important;
    }
    .dash-card {
        min-width: 0 !important;
        box-sizing: border-box !important;
    }
}

/* Extracted: saas-polish */

/* Polish the cards */
.lr-card-head {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.95rem;
}
/* Chat input polish */
input[placeholder="Type a message..."] {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 14px;
}
/* Fix the "Loading..." text color */
.text-muted:contains('Loading') {
    color: transparent !important;
}


/* Extracted: saas-single-column */

/* ============================================
   SINGLE COLUMN SAAS LAYOUT — Industry Standard
   Reference: Linear, Notion, GitHub, Stripe
   ============================================ */

/* Card headers */
/* Card bodies */
/* Nested cards (inside lr-grid, e.g. Turn Control, Video) */
/* Internal 2-col grids stay side-by-side (Turn + Video) on desktop */
/* Smart Board toolbar: proper flex wrapping */
/* Session info: clean table rhythm */
/* Skeleton loading state for stuck "Loading..." */
.loading-skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: skeleton 1.4s ease infinite;
    border-radius: 6px;
    color: transparent !important;
    user-select: none;
    display: inline-block;
    min-width: 80px;
}

@keyframes skeleton {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Hide old turn UI (replaced by Turn Control card) */
button[onclick*="nextTurn('STUDENT')"],
button[onclick*="nextTurn('TEACHER')"],
select[id="studentSelect"] {
    display: none !important;
}

/* ----------- Mobile: single column, tight but readable ----------- */
@media (max-width: 768px) {
    /* 44px touch targets (WCAG 2.5.5) */
    /* 16px inputs prevent iOS auto-zoom */
    }



/* ============================================================
   LIVE CLASSROOM — SaaS 2-Column Layout
   ============================================================ */
@media (max-width: 1024px) {
    }

/* ============================================================
   LIVE CLASSROOM — SaaS 2-Column Grid (v2 CLEAN)
   ============================================================ */

.saas-container.live-classroom-page {
    display: block !important;
    max-width: 1500px !important;
    margin: 0 auto !important;
    padding: 20px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* removed grid rule */
/* legacy grid-column:1 rule removed */

/* legacy grid-column:2 card rule removed */



/* Keep teaching inner grid for Turn+Video */
.saas-main > .lr-grid-teaching {
    grid-column: 1 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 16px !important;
    min-width: 0 !important;
}

/* Prevent canvas overflow */
.saas-main canvas {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
}

.saas-main .lr-card {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

/* Mobile: single column */
@media (max-width: 1024px) {
    .saas-main {
        grid-template-columns: 1fr !important;
        padding: 12px !important;
    }
    .saas-main > .lr-grid-teaching {
        grid-template-columns: 1fr !important;
    }
    .saas-main > *,
    #chatCard, #micMonitorCard, #micControlCard,
    #handQueueCard, #gamificationCard, #manageAccessCard,
    #grantCard, #quizCard, #pendingRequestsCard {
        grid-column: 1 !important;
    }
}


/* ============================================================
   LIVE CLASSROOM — Flexbox 2-Column Layout (Phase 3)
   Left: teaching zone (Turn, Video, Session, Board)
   Right: tools (Chat, Mic, Hands, Points, Access, Grant, Quiz)
   ============================================================ */

.saas-container.live-classroom-page {
    display: block !important;
    max-width: 1500px !important;
    margin: 0 auto !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

.lr-col-left {
    flex: 1.6 1 0 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}

.lr-col-right {
    flex: 0 0 380px !important;
    width: 380px !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}

/* Teaching inner grid (Turn + Video + Session + Board) */
.lr-col-left .lr-grid-teaching {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 16px !important;
}

/* Tool inner wrapper (Grant + Quiz) */
.lr-col-right .lr-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}

/* Cards fill their column */
.lr-col-left > .lr-card,
.lr-col-right > .lr-card,
.lr-col-left .lr-grid-teaching > .lr-card,
.lr-col-right .lr-grid > .lr-card {
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
}

/* Canvas never overflows */
.lr-col-left canvas {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
}

/* Mobile: single column */
@media (max-width: 1024px) {
    .saas-main {
        flex-direction: column !important;
        padding: 12px !important;
    }
    .lr-col-left, .lr-col-right {
        flex: 1 1 auto !important;
        width: 100% !important;
    }
    .lr-col-left .lr-grid-teaching {
        grid-template-columns: 1fr !important;
    }
}

/* FORCE_FLEX_FINAL — highest priority, at end of file */
.saas-main.saas-main.lr-col-left {
    flex: 1.6 1 0 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}
.lr-col-right {
    flex: 0 0 380px !important;
    width: 380px !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}
@media (max-width: 1024px) {
    .saas-main.saas-main.saas-main { flex-direction: column !important; padding: 12px !important; }
    .lr-col-left, .lr-col-right { flex: 1 1 auto !important; width: 100% !important; }
}

/* ============================================================
   JS DOM Move v2 — Block main + flex wrapper (header on top)
   ============================================================ */

.saas-container.live-classroom-page {
    display: block !important;
    max-width: 1500px !important;
    margin: 0 auto !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

.saas-main {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.saas-columns-wrapper {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 20px !important;
    align-items: flex-start !important;
    width: 100% !important;
    margin-top: 20px !important;
    box-sizing: border-box !important;
}

.lr-col-left {
    flex: 1.6 1 0% !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}

.lr-col-right {
    flex: 0 0 380px !important;
    width: 380px !important;
    max-width: 380px !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}

.lr-col-left > .lr-card,
.lr-col-right > .lr-card {
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

.lr-col-left canvas {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
}

@media (max-width: 1024px) {
    .saas-columns-wrapper {
        flex-direction: column !important;
    }
    .lr-col-left, .lr-col-right {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ============================================================
   SaaS POLISH — Column ratio, sticky sidebar, text fixes
   ============================================================ */

/* Left 65% / Right 35% */
.saas-columns-wrapper {
    gap: 24px !important;
}

.lr-col-left {
    flex: 1.85 1 0% !important;   /* 65% when right is fixed 380px */
    min-width: 0 !important;
}

/* sticky rule removed - lets right column flow naturally */

/* Custom scrollbar for sidebar */
.lr-col-right::-webkit-scrollbar { width: 6px; }
.lr-col-right::-webkit-scrollbar-track { background: transparent; }
.lr-col-right::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* Prevent text truncation in dropdowns */
.lr-col-right select,
.lr-col-left select {
    min-width: 0 !important;
    max-width: 100% !important;
    text-overflow: ellipsis !important;
}

/* Small card padding */
.lr-col-right > .lr-card,
.lr-col-left > .lr-card {
    padding: 16px 18px !important;
}

/* Mobile: single column, disable sticky */
@media (max-width: 1024px) {
    .saas-columns-wrapper {
        flex-direction: column !important;
        gap: 16px !important;
    }
    .lr-col-left,
    .lr-col-right {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        position: static !important;
        max-height: none !important;
        overflow: visible !important;
    }
}

/* ============================================================
   SCROLL & UNSQUISH FIX
   ============================================================ */

/* 1. Right Column: Independent Sticky Scroll */
/* sticky rule removed - lets right column flow naturally */

/* 2. Prevent Cards from Squishing */
.lr-col-right > .lr-card,
.lr-col-left > .lr-card {
    flex-shrink: 0 !important; /* Do NOT shrink cards */
    height: auto !important;
    overflow: visible !important; /* Show all content */
    margin-bottom: 0 !important; /* Gap handles spacing */
}

/* 3. Custom Scrollbar for Chrome/Safari/Edge */
.lr-col-right::-webkit-scrollbar {
    width: 8px;
}
.lr-col-right::-webkit-scrollbar-track {
    background: transparent;
}
.lr-col-right::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}
.lr-col-right::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

/* 4. Left Column: Just grows the page normally */
.lr-col-left {
    overflow: visible !important;
    height: auto !important;
}

/* Mobile: Remove sticky and scroll, just stack */
@media (max-width: 1024px) {
    .lr-col-right {
        position: static !important;
        max-height: none !important;
        overflow-y: visible !important;
        padding-right: 0 !important;
    }
}

/* ============================================================
   Button-row overflow fix (2026-11-11)
   Applies to: Classroom Gamification card, My Papers page, any
   .d-flex.gap-2 / .d-flex.gap-1 row of buttons on narrow screens.
   Buttons wrap to next line instead of overflowing horizontally.
   ============================================================ */

.d-flex.gap-2,
.d-flex.gap-1,
.d-flex.gap-3 {
  flex-wrap: wrap !important;
}

.d-flex.gap-2 > .btn,
.d-flex.gap-2 > button,
.d-flex.gap-2 > .btn-group,
.d-flex.gap-1 > .btn,
.d-flex.gap-1 > button,
.d-flex.gap-3 > .btn,
.d-flex.gap-3 > button {
  flex-shrink: 0;
}

/* Tighter buttons on very narrow viewports (phones) */
@media (max-width: 640px) {
  .d-flex.gap-2 > .btn,
  .d-flex.gap-2 > button,
  .d-flex.gap-1 > .btn,
  .d-flex.gap-1 > button {
    padding: 4px 10px !important;
    font-size: 0.85rem !important;
    line-height: 1.2 !important;
  }
}

/* Gamification card specifically — force dropdown-style compactness if
   wrapped onto 2 lines, keep leaderboard below clean */
.panel .d-flex.gap-2 > .btn[data-points],
.gamification-points-row > .btn {
  min-width: 52px;
  justify-content: center;
}

/* ============================================================
   BUTTON STATE SYSTEM — visible intent + disabled + loading
   ============================================================ */

/* Universal loading state */
.btn-state { transition: all 0.15s ease; }
.btn-state[disabled], .btn-state:disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    filter: grayscale(0.6);
    pointer-events: none;
}
.btn-state.loading {
    opacity: 0.7 !important;
    cursor: wait !important;
    position: relative;
}

/* Chat status badge */
#chatStatus {
    padding: 4px 10px !important;
    border-radius: 12px !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    display: inline-block !important;
    transition: background 0.2s;
}
#chatStatus.state-open     { background: #ecfdf5; color: #047857; }
#chatStatus.state-disabled { background: #f3f4f6; color: #6b7280; }
#chatStatus.state-oneway   { background: #fffbeb; color: #b45309; }
#chatStatus.state-loading  { background: #eff6ff; color: #1d4ed8; }

/* Chat buttons explicit colors */
#chatToggleBtn { transition: background 0.2s, color 0.2s; }
#oneWayBtn { transition: all 0.2s; }

/* Preset buttons — active highlight */
.preset-btn {
    transition: all 0.2s;
    position: relative;
}
.preset-btn.active-preset {
    box-shadow: 0 0 0 3px rgba(59,130,246,0.5) !important;
    transform: scale(1.02);
    font-weight: 700 !important;
}

/* Freeze button */
#freezeBtn { transition: background 0.2s; }

/* Pause/Resume */
#btnPause, #btnResume { transition: opacity 0.2s; }

/* ============================================================ 
   EXTRACTED FROM CLASSROOM TEMPLATE (2026-11-11)
   Zero inline <style> blocks remaining in HTML
   ============================================================ */

/* ===== Extracted <style id="(no id)"> from classroom template ===== */

.lr { max-width: 1400px; margin: 0 auto; padding: 20px; }
.lr-head { background: #fff; border-radius: 14px; padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; border: 1px solid #e5e7eb; flex-wrap: wrap; gap: 12px; }
.lr-head h1 { margin: 0; font-size: 1.4rem; }
.lr-head p { margin: 4px 0 0 0; color: #6b7280; font-size: 0.85rem; }
.lr-badge { padding: 8px 18px; border-radius: 999px; font-weight: 700; font-size: 0.9rem; }
.lr-badge.t { background: #dbeafe; color: #1e40af; }
.lr-badge.s { background: #fef3c7; color: #92400e; }
.lr-exit { padding: 10px 18px; background: #f3f4f6; border: 1px solid #d1d5db; border-radius: 10px; text-decoration: none; color: #374151; font-weight: 600; }
.lr-toolbar { background: #fff; border-radius: 14px; padding: 16px 20px; margin-bottom: 20px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; border: 1px solid #e5e7eb; }
.lr-toolbar button, .lr-toolbar select { padding: 10px 20px; border-radius: 10px; border: 1px solid #d1d5db; font-weight: 600; cursor: pointer; background: #fff; }
.lr-btn-green { background: #10b981 !important; color: #fff !important; border: none !important; }
.lr-btn-amber { background: #f59e0b !important; color: #fff !important; border: none !important; }
.lr-btn-blue { background: #3b82f6 !important; color: #fff !important; border: none !important; }
.lr-btn-red { background: #ef4444 !important; color: #fff !important; border: none !important; }
.lr-toolbar .lr-end { margin-left: auto; }
.lr-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 900px) { .lr-grid { grid-template-columns: 1fr; } }
.lr-card { background: #fff; border-radius: 14px; border: 1px solid #e5e7eb; overflow: hidden; }
.lr-card-head { padding: 14px 20px; border-bottom: 1px solid #e5e7eb; font-weight: 700; background: #f9fafb; display: flex; justify-content: space-between; align-items: center; }
.lr-card-body { padding: 20px; }
.lr-video { background: linear-gradient(135deg, #0f172a, #1e293b); border-radius: 12px; padding: 40px; text-align: center; color: #fff; }
.lr-video h3 { margin: 0 0 10px 0; font-size: 1.3rem; color: #fff; }
.lr-video p { color: #cbd5e1; margin: 0 0 20px 0; }
.lr-join { display: inline-block; padding: 14px 32px; background: #3b82f6; color: #fff; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: 1rem; }
.lr-join:hover { background: #2563eb; color: #fff; }
.lr-info-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f3f4f6; font-size: 0.9rem; }
.lr-info-row:last-child { border-bottom: none; }
.lr-label { color: #6b7280; font-weight: 500; }
.lr-val { color: #111827; font-weight: 600; }
.lr-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 600px) { .lr-form-row { grid-template-columns: 1fr; } }
.lr-input, .lr-select { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; box-sizing: border-box; font-size: 0.9rem; }
.lr-flabel { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; color: #374151; }
#canvas { width: 100%; border-radius: 8px; display: block; background: #fff; }
.lr-btn-sm { padding: 6px 14px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; cursor: pointer; font-weight: 600; }

.wb-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.wb-btn { padding: 6px 10px; border: 1px solid #d1d5db; background: #fff; border-radius: 6px; cursor: pointer; font-size: 0.85rem; font-weight: 600; }
.wb-btn:hover { background: #f3f4f6; }
.wb-btn.active { background: #3b82f6 !important; color: #fff !important; border-color: #3b82f6 !important; }
.wb-colors { display: flex; gap: 4px; padding: 0 6px; }
.wb-color { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; display: inline-block; }
.wb-color.active { border-color: #111827 !important; box-shadow: 0 0 0 2px #fff inset; }
.wb-sizes { display: flex; gap: 4px; padding: 0 6px; }
.wb-size { width: 28px; height: 28px; border: 1px solid #d1d5db; background: #fff; border-radius: 6px; cursor: pointer; font-size: 0.8rem; line-height: 1; }
.wb-size.active { background: #3b82f6 !important; color: #fff !important; border-color: #3b82f6 !important; }
.wb-clear { color: #dc2626 !important; }
@media (max-width: 768px) {
  .wb-tools { gap: 4px; }
  .wb-color { width: 18px; height: 18px; }
  .wb-size { width: 24px; height: 24px; font-size: 0.7rem; }
/* NUCLEAR FIX 2026-11-12: disabled canvas max-height cap */
}


.lr-meet-hint { color: #94a3b8; margin: 15px 0 10px; font-size: 0.9rem; }
.lr-meet-form { display: flex; gap: 8px; max-width: 520px; margin: 0 auto; flex-wrap: wrap; }
.lr-meet-input { flex: 1; min-width: 200px; padding: 10px 12px; border-radius: 8px; border: 1px solid #d1d5db; font-size: 0.9rem; }
.lr-meet-save { padding: 10px 20px; border: none; border-radius: 8px; background: #3b82f6; color: #fff; font-weight: 600; cursor: pointer; }
.lr-meet-save:hover { background: #2563eb; }
@media (max-width: 600px) { .lr-meet-form { flex-direction: column; } .lr-meet-input, .lr-meet-save { width: 100%; } }

/* MOBILE_V2_INDUSTRY */
@media (max-width: 900px) {
  .lr { padding: 12px !important; }
  .lr-head { flex-direction: column !important; align-items: stretch !important; gap: 12px !important; padding: 16px !important; }
  .lr-head h1 { font-size: 1.1rem !important; line-height: 1.3 !important; word-break: break-word !important; }
  .lr-head p { font-size: 0.78rem !important; }
  .lr-head > div:last-child { display: flex !important; justify-content: space-between !important; align-items: center !important; gap: 8px !important; }
  .lr-badge { font-size: 0.78rem !important; padding: 6px 12px !important; }
  .lr-exit { padding: 8px 14px !important; font-size: 0.85rem !important; }
  .lr-toolbar { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; padding: 12px !important; }
  .lr-toolbar select, .lr-toolbar button { width: 100% !important; padding: 12px !important; font-size: 14px !important; min-height: 44px !important; box-sizing: border-box !important; }
  .lr-toolbar .lr-end { margin-left: 0 !important; }
  .lr-grid { grid-template-columns: 1fr !important; gap: 12px !important; margin-bottom: 12px !important; }
  .lr-card { border-radius: 12px !important; }
  .lr-card-head { padding: 12px 14px !important; font-size: 0.88rem !important; flex-wrap: wrap !important; gap: 8px !important; }
  .lr-card-body { padding: 14px !important; }
  .lr-video { padding: 24px 14px !important; }
  .lr-video h3 { font-size: 1.05rem !important; }
  .lr-video p { font-size: 0.82rem !important; line-height: 1.4 !important; }
  .lr-join { padding: 12px 24px !important; font-size: 0.92rem !important; display: inline-block !important; }
  .lr-info-row { font-size: 0.85rem !important; padding: 8px 0 !important; }
  .wb-tools { width: 100% !important; justify-content: flex-start !important; gap: 6px !important; flex-wrap: wrap !important; }
  .wb-btn { padding: 8px 12px !important; font-size: 0.8rem !important; min-height: 36px !important; touch-action: manipulation !important; }
  .wb-colors { gap: 6px !important; padding: 0 !important; }
  .wb-color { width: 26px !important; height: 26px !important; }
  .wb-sizes { gap: 6px !important; padding: 0 !important; }
  .wb-size { width: 32px !important; height: 32px !important; font-size: 0.85rem !important; min-height: 36px !important; }
/* NUCLEAR FIX 2026-11-12: disabled canvas max-height cap */
  .lr-form-row { grid-template-columns: 1fr !important; gap: 10px !important; }
  .lr-input, .lr-select, .lr-meet-input, .lr-meet-save { font-size: 16px !important; padding: 12px !important; box-sizing: border-box !important; min-height: 44px !important; }
  .lr-flabel { font-size: 0.82rem !important; }
  .lr-meet-form { flex-direction: column !important; }
  .lr-meet-input, .lr-meet-save { width: 100% !important; }
}
@media (max-width: 400px) {
  .wb-color { width: 22px !important; height: 22px !important; }
  .wb-btn { padding: 6px 10px !important; font-size: 0.75rem !important; }
}

/* MOBILE_COMPACT_V3 */
@media (max-width: 900px) {
  .lr { padding: 8px !important; }
  .lr-head { padding: 12px 14px !important; gap: 8px !important; }
  .lr-head h1 { font-size: 1rem !important; }
  .lr-head p { font-size: 0.75rem !important; }
  .lr-toolbar { padding: 10px 12px !important; gap: 6px !important; }
  .lr-toolbar button, .lr-toolbar select { padding: 10px !important; font-size: 13px !important; min-height: 40px !important; }
  .lr-card-head { padding: 10px 12px !important; }
  .lr-card-body { padding: 10px 12px !important; }
  .lr-video { padding: 18px 12px !important; }
  .lr-video h3 { font-size: 1rem !important; }
  .lr-video p { font-size: 0.78rem !important; }
  .lr-info-row { padding: 6px 0 !important; font-size: 0.82rem !important; }
  .wb-tools { gap: 4px !important; }
  .wb-btn { padding: 6px 10px !important; font-size: 0.75rem !important; }
  .wb-color { width: 22px !important; height: 22px !important; }
  .wb-size { width: 28px !important; height: 28px !important; }
/* NUCLEAR FIX 2026-11-12: disabled canvas max-height cap */
  .lr-form-row { grid-template-columns: 1fr !important; }
  .lr-input, .lr-select { font-size: 16px !important; padding: 10px !important; min-height: 42px !important; }
  .chat-panel { max-height: 250px !important; }
  .chat-input-row { flex-direction: column !important; }
  .chat-input-row input { width: 100% !important; }
  .chat-input-row button { width: 100% !important; }
}

/* ===== Extracted <style id="(no id)"> from classroom template ===== */
@media (max-width: 1024px) { .saas-container { padding: 10px; } .saas-main { gap: 12px; } }

/* ===== Extracted <style id="(no id)"> from classroom template ===== */
.saas-container {
    display: block;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}.saas-sidebar { display: none !important; }@media(max-width:1024px){.saas-container {
    display: block;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}.saas-sidebar { display: none !important; }}

/* ===== Extracted <style id="(no id)"> from classroom template ===== */
/* Canvas Fix — Full width override + proper aspect */
#smartBoardCard {
    grid-column: 1 / -1 !important; /* span full grid width */
    width: 100% !important;
    max-width: 100% !important;
}
#smartBoardCard .lr-card-body {
    padding: 12px !important;
    overflow: hidden !important;
}
#smartBoardCard #canvas,
#smartBoardCard canvas {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    margin: 0 auto !important;
    background: #ffffff !important;
}
/* Ensure canvas container has proper aspect via JS */
/* ============================================================ 
   BATCH 1 — Auto-extracted inline styles
   ============================================================ */

.bs-1 { margin-bottom: 20px; }

.bs-2 { font-size: 0.75rem; }

.bs-3 { margin-bottom: 20px; padding: 20px; border-radius: 12px; background: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.bs-4 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

.bs-5 { padding: 8px 16px; border-radius: 6px; border: none; background: #10b981; color: white; font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: background 0.2s; }

.bs-6 { display:grid; grid-template-columns: 1fr 1fr; gap:8px; margin-bottom:8px; }

.bs-7 { display:none; }

.bs-8 { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }

.bs-9 { padding: 14px; }

.bs-10 { color: #94a3b8; font-size: 0.82rem; margin: 0; }

.bs-11 { color: #9ca3af; font-style: italic; }

.bs-12 { margin: 0; font-size: 1.1rem; font-weight: 600; color: #111827; }

.bs-13 { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; background: #f9fafb; padding: 12px; border-radius: 8px; border: 1px solid #e5e7eb; }

.bs-14 { padding: 6px 10px; background:#ef4444; color:white; border:none; border-radius:4px; font-weight:600; cursor:pointer; }

.bs-15 { cursor:pointer; font-weight:600; color:#6b7280; padding-bottom:8px; }


/* ============================================================
   INDUSTRY STANDARD LIVE CLASSROOM LAYOUT
   ============================================================ */

/* Utility classes to fix missing flexbox rules */
.flex-column { flex-direction: column; }

/* Main 2-Column Grid Layout */
.saas-main > .lr-grid, .lr-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 20px;
    align-items: start;
    width: 100%;
}

.lr-col-left, .lr-col-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    min-width: 0;
}

/* Mobile responsiveness */
@media (max-width: 1024px) {
    .saas-main > .lr-grid, .lr-grid {
        grid-template-columns: 1fr;
    }
}

/* Leaderboard Stacking (Fixes rows sitting side-by-side) */
#leaderboardList {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.lb-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.lb-btn-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Button Groups Wrapping (Fixes overflow in Gamification & Access) */
.cg-btn-group, .ca-controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}

.cg-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    background: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* FORCE LAYOUT TO USE COLUMNS */
.lr-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 20px;
    align-items: start;
    width: 100%;
}
.lr-col-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}
.lr-col-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}
@media (max-width: 1024px) {
    .lr-grid { grid-template-columns: 1fr; }
}

/* FORCE LEADERBOARD TO STACK VERTICALLY */
#leaderboardList {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
}
.lb-row {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    box-sizing: border-box;
}

/* FORCE BUTTONS TO WRAP NEATLY */
.cg-btn-group, .ca-controls-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
}
.cg-btn-group button, .ca-controls-row button {
    flex-shrink: 0 !important;
}


/* ============================================================
   DEFINITIVE LAYOUT - All issues addressed
   ============================================================ */

/* 1. Force leaderboard rows to stack vertically */
#leaderboardList {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 8px;
}
#leaderboardList > div {
    width: 100%;
    box-sizing: border-box;
}
.lb-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    width: 100%;
    box-sizing: border-box;
}

/* 2. Grid stays 2 columns */
.lr-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    align-items: stretch;
    gap: 20px;
    width: 100%;
}
.lr-col-left,
.lr-col-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

/* 3. Right column stretches - last card fills remaining space */
.lr-col-right > .lr-card:last-child {
    flex: 1 1 auto;
}

/* 4. Buttons wrap, never squish */
.cg-btn-group,
.ca-controls-row,
.lb-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.cg-btn-group button,
.ca-controls-row button,
.lb-btn-group button {
    flex: 0 0 auto;
}

@media (max-width: 1024px) {
    .lr-grid { grid-template-columns: 1fr; }
}


/* ============================================================
   SURGICAL FIXES (Added 2026-11-11) — No truncation, only targeted rules
   ============================================================ */

/* 6a. Missing utility class — fixes leaderboard side-by-side */
.flex-column { flex-direction: column !important; }

/* 6b. Force leaderboard rows to stack and fill width */
#leaderboardList {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
}
#leaderboardList > div {
    width: 100% !important;
    box-sizing: border-box !important;
}
.lb-row {
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
}

/* 6c. Buttons wrap instead of overflowing */
.cg-btn-group,
.ca-controls-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
}
.cg-btn-group button,
.ca-controls-row button {
    flex-shrink: 0 !important;
}

/* 6d. Right column flows full-height, no sticky, no internal scroll */
.lr-col-right {
    position: static !important;
    max-height: none !important;
    overflow-y: visible !important;
    align-self: stretch !important;
}

/* 6e. Ensure the 2-column grid still works */
.lr-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 380px !important;
    gap: 20px !important;
    align-items: stretch !important;
    width: 100% !important;
}

@media (max-width: 1024px) {
    .lr-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================================
   TARGETED FIXES FOR LEADERBOARD AND ACCESS CARDS
   ============================================================ */

/* --- 1. FIX LEADERBOARD SQUISHING --- */
/* Force the name to always take the full width, pushing buttons to the next line */
.lb-name {
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-bottom: 6px;
}

/* Ensure the button group stays together and wraps if needed */
.lb-btn-group {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
    justify-content: flex-start !important;
}

.lb-row {
    padding: 10px 12px !important;
}

/* --- 2. FIX CLASSROOM ACCESS OVERLAP --- */
/* Make the controls row stack vertically instead of squishing horizontally */
.ca-controls-row {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
}

/* Force the "Quick presets" label to its own line or give it spacing */
.ca-controls-row > span {
    flex-basis: 100% !important;
    margin-top: 4px;
    margin-bottom: 4px;
}

/* Style the preset buttons to wrap nicely */
.preset-btn {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
}

/* ============================================================
   INDUSTRY STANDARD TARGETED FIXES
   ============================================================ */
#leaderboardList .lb-name {
    flex: 0 0 100%;
    width: 100%;
    margin-bottom: 6px;
}
#leaderboardList .lb-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    justify-content: flex-start;
}
#leaderboardList .lb-row {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
}

.ca-controls-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.ca-controls-row > span {
    flex-basis: 100%;
    margin-top: 4px;
}
.preset-btn {
    flex: 0 0 auto;
}

/* ============================================================
   LEADERBOARD SCORE & ADD BUTTON STYLING
   ============================================================ */


.ca-btn-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    background-color: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.ca-btn-add:hover {
    background-color: #2563eb;
}

/* ============================================================
   FINAL STYLES FOR SCORE BOX AND ADD BUTTON
   ============================================================ */


.ca-btn-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background-color: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
    margin: 0;
}

.ca-btn-add:hover {
    background-color: #2563eb;
}


/* ============================================================
   DEFINITIVE LEADERBOARD SCORE STYLING (high specificity)
   ============================================================ */
#leaderboardList .lb-row .lb-btn-group .lb-score,
#leaderboardList .lb-score {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 38px !important;
    height: 26px !important;
    padding: 0 8px !important;
    background-color: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #f59e0b !important;
    border-radius: 4px !important;
    font-size: 0.85rem !important;
    font-weight: 800 !important;
    margin: 0 4px !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
}

/* MOBILE FIX: My Papers - prevent View Report button overflow */
.attempt-list .attempt-item { flex-wrap: wrap; gap: 8px; }
.attempt-list .attempt-item .attempt-item-right { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
@media (max-width: 640px) {
  .attempt-list .attempt-item { flex-direction: column; align-items: stretch; }
  .attempt-list .attempt-item .attempt-item-left, .attempt-list .attempt-item .attempt-item-right { width: 100%; }
  .attempt-list .attempt-item .attempt-item-right { justify-content: flex-start; }
}

@media (max-width:640px){.attempt-item{flex-direction:column!important;align-items:stretch!important}.attempt-item>*{width:100%!important}.attempt-item-right{justify-content:flex-start!important}}


/* ═══════════════════════════════════════════════════════════
   WHITEBOARD PERMANENT FIX — Architectural, not override
   - Buffer stays 1200x600 always (no setDimensions calls)
   - CSS scales display proportionally via aspect-ratio
   - #canvas-wrapper #canvas (2 IDs = 200 specificity) beats
     any existing #canvas rule (1 ID = 100)
   ═══════════════════════════════════════════════════════════ */
#canvas-wrapper {
    width: 100%;
    aspect-ratio: 2 / 1;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #ffffff;
}
#canvas-wrapper #canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    display: block !important;
}
#canvas-wrapper .canvas-container {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}
#canvas-wrapper .canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    display: block !important;
}
/* End whiteboard permanent fix */

/* NUCLEAR CANVAS OVERRIDE - highest priority, last in file */
#canvas, #canvas.lower-canvas, #canvas.upper-canvas {
  max-height: none !important;
  height: auto !important;
  max-width: 100% !important;
  width: 100% !important;
  aspect-ratio: 2 / 1 !important;
  display: block !important;
}


/* ═══════════════════════════════════════════════════════════
   SMARTBOARD NUCLEAR FIX — wins against #smartBoardCard canvas
   Uses (2 IDs) specificity to beat the existing rule
   ═══════════════════════════════════════════════════════════ */
#smartBoardCard #canvas,
#smartBoardCard #canvas.lower-canvas,
#smartBoardCard #canvas.upper-canvas {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    max-width: 100% !important;
    aspect-ratio: 2 / 1 !important;
    display: block !important;
    visibility: visible !important;
}
#smartBoardCard .canvas-container {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    aspect-ratio: 2 / 1 !important;
    position: relative !important;
}
#smartBoardCard .canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    aspect-ratio: 2 / 1 !important;
}
#smartBoardCard .lr-card-body {
    padding: 12px !important;
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
}
#canvas-wrapper {
    width: 100% !important;
    aspect-ratio: 2 / 1 !important;
    max-height: none !important;
    overflow: visible !important;
}
/* End SMARTBOARD NUCLEAR */

/* ============================================================
   URDU FONT (Jameel Noori Nastaliq) - Strictly Urdu Only!
   ============================================================ */
@font-face {
    font-family: 'Jameel Noori Nastaliq';
    src: url('/static/exams/fonts/JameelNooriNastaleeq.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    /* THIS IS THE GUARANTEE: Only loads for Urdu/Arabic Unicode. 
       English/Roman Urdu (A-Z) is ignored completely by this font. */
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF;
}

/* Apply to body. The unicode-range above ensures Roman Urdu is untouched. */
body, .question-text, .model-answer, .source-text {
    font-family: 'Jameel Noori Nastaliq', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Force the font on specific Urdu classes you already use */
.urdu-text, 
.urdu-translation, 
.urdu-box, 
.urdu-message, 
.urdu-font, 
[dir="rtl"] {
    font-family: 'Jameel Noori Nastaliq', 'Noto Nastaliq Urdu', serif !important;
}

/* Flow-player Urdu-script fields (_urdu) — Nastaliq, RTL, larger line-height */
.urdu-nastaliq {
    font-family: 'Jameel Noori Nastaliq', 'Noto Nastaliq Urdu', serif !important;
    font-size: 1.4rem;
    line-height: 2.2;
    direction: rtl;
    text-align: right;
    unicode-bidi: plaintext;
}

/* --- SaaS AUTHENTICATION LAYOUT --- */
.auth-wrapper {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card {
    background: #ffffff;
    width: 100%;
    max-width: 440px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}
.auth-header {
    text-align: center;
    padding: 32px 32px 0 32px;
}
.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}
.auth-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 24px;
}
.auth-body {
    padding: 0 32px 32px 32px;
}
.auth-footer {
    background-color: #f9fafb;
    padding: 16px 32px;
    text-align: center;
    border-top: 1px solid #e5e7eb;
    font-size: 0.875rem;
    color: #4b5563;
}
.auth-form-group {
    margin-bottom: 18px;
}
.auth-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}
.auth-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}
.auth-input:focus {
    border-color: var(--ideal-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.auth-btn {
    width: 100%;
    padding: 11px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    background-color: var(--ideal-primary, #2563eb);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}
.auth-btn:hover {
    background-color: #1d4ed8;
}
.auth-link {
    color: var(--ideal-primary, #2563eb);
    font-weight: 500;
    text-decoration: none;
}
.auth-link:hover {
    text-decoration: underline;
}


/* ==============================================================
   AUTH PAGES — INDUSTRY STANDARD SAAS STYLES
   (No inline styles anywhere in templates)
   ============================================================== */

/* Alerts (BEM-style modifiers) */
.auth-alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.auth-alert--error {
    background-color: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}
.auth-alert--success {
    background-color: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}
.auth-alert--info {
    background-color: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

/* Small helper text (for optional labels) */
.auth-label__optional {
    color: #9ca3af;
    font-weight: 400;
}

/* Two-column row inside the card (for Class + Shift side by side) */
.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 480px) {
    .auth-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* Ensure word wrapping on auth subtitles/body without inline style */
.auth-subtitle,
.auth-body,
.auth-alert {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ==============================================================
   MOBILE RESPONSIVE AUTH
   ============================================================== */
@media (max-width: 576px) {
    .auth-wrapper {
        padding: 12px;
        min-height: calc(100vh - 120px);
    }
    .auth-card {
        border-radius: 10px;
        box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.08),
                    0 1px 2px -1px rgba(0, 0, 0, 0.04);
    }
    .auth-header {
        padding: 24px 20px 0 20px;
    }
    .auth-title {
        font-size: 1.35rem;
    }
    .auth-subtitle {
        font-size: 0.82rem;
        margin-bottom: 18px;
    }
    .auth-body {
        padding: 0 20px 24px 20px;
    }
    .auth-form-group {
        margin-bottom: 14px;
    }
    .auth-input {
        padding: 11px 13px;
        font-size: 0.95rem;
    }
    .auth-btn {
        padding: 12px;
        font-size: 0.95rem;
    }
    .auth-footer {
        padding: 14px 20px;
        font-size: 0.82rem;
    }
}

/* Helper link text (e.g. "Forgot Password?" under login) */
.auth-helper-text {
    text-align: center;
    margin-top: 16px;
    margin-bottom: 0;
    font-size: 0.85rem;
}

/* ============================================================
   STICKY FOOTER — GLOBAL LAYOUT
   ============================================================ */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
}

main.page-content {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Footer — semantic BEM classes, no inline styles */
.site-footer {
    flex-shrink: 0;
    margin-top: auto;
    background-color: #1f2937;
    color: #9ca3af;
    padding: 16px 20px;
}

.site-footer__inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    font-size: 0.85rem;
}

.site-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.site-footer__link {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.15s ease;
}

.site-footer__link:hover,
.site-footer__link:focus {
    color: #ffffff;
}

.site-footer__link--admin {
    color: #fbbf24;
}

.site-footer__link--admin:hover,
.site-footer__link--admin:focus {
    color: #fcd34d;
}

.site-footer__sep {
    color: #4b5563;
    user-select: none;
}

/* Mobile responsive */
@media (max-width: 576px) {
    .site-footer__inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .site-footer__links {
        gap: 10px;
    }
}

/* ============================================================
   RETAKE REQUESTS — Teacher Dashboard (BEM, SaaS-grade)
   ============================================================ */

/* Card toolbar — top-right action row */
.dash-card-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 4px;
}

.dash-card-toolbar__left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dash-card-toolbar__right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Pending count badge — pill style */
.dash-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;
}

.dash-pill--info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Bulk approve form — compact group */
.dash-bulk-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 6px 12px;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.dash-bulk-form__label {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
    white-space: nowrap;
}

.dash-bulk-form__input {
    width: 64px;
    padding: 6px 8px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #111827;
    background: #ffffff;
}

.dash-bulk-form__input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Student cell — stacked code + name */
.dash-student-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dash-student-cell__code {
    font-weight: 700;
    color: #111827;
    font-size: 0.9rem;
}

.dash-student-cell__name {
    color: #6b7280;
    font-size: 0.78rem;
}

/* Attempts input (per-row) */
.dash-attempts-input {
    width: 64px;
    padding: 6px 8px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #111827;
    background: #ffffff;
}

.dash-attempts-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Actions cell — inline forms */
.dash-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.dash-actions__form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

/* Responsive: stack toolbar on mobile */
@media (max-width: 640px) {
    .dash-card-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .dash-card-toolbar__right {
        justify-content: flex-start;
    }
    .dash-bulk-form {
        width: 100%;
        justify-content: space-between;
    }
}

/* Empty state */
.dash-empty-msg {
    padding: 32px 16px;
    text-align: center;
    color: #6b7280;
    font-size: 0.9rem;
    background-color: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    margin: 16px 0 0 0;
}

/* --- FORM BEM CLASSES (GLOBAL) --- */
.dash-form__group {
    margin-bottom: 16px;
}
.dash-form__label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.dash-form__actions {
    margin-top: 20px;
}

/* HELP BUTTON FIX — Remove white ghost block */
.help-btn, .help-fab, .help-widget, .floating-help-btn {
    background-color: var(--ideal-primary, #2563eb) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3) !important;
}
.help-btn::before, .help-btn::after,
.help-fab::before, .help-fab::after {
    display: none !important;
    content: none !important;
}
.help-widget-wrapper, div[class*="help-widget"]:empty {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ==========================================
   NEW: Story Accordion SaaS UI
   ========================================== */
.story-accordion-container {
    margin-bottom: 2rem;
    margin-top: 1.5rem;
}
.story-accordion {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.story-accordion summary {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    font-weight: 600;
    color: #0056b3;
    cursor: pointer;
    user-select: none;
    outline: none;
    list-style: none;
    background-color: #f8f9fa;
    transition: background-color 0.2s ease;
}
.story-accordion summary:hover {
    background-color: #e9ecef;
}
.story-accordion summary::-webkit-details-marker {
    display: none;
}
.story-accordion .summary-icon {
    margin-right: 10px;
    font-size: 1.2rem;
}
.story-accordion .summary-text {
    flex-grow: 1;
    font-size: 1.1rem;
}
.story-accordion .summary-hint {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: normal;
}
.story-accordion[open] summary {
    border-bottom: 1px solid #dee2e6;
}
.story-accordion .story-content {
    padding: 20px;
    background-color: #ffffff;
}
.story-accordion .story-desc {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 15px;
}
.story-accordion .story-step {
    margin-bottom: 20px;
}
.story-accordion .story-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.story-accordion .story-step-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}
.story-accordion .story-desc-sm {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 8px;
}
.story-accordion .story-code-box {
    width: 100%;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    background-color: #1e1e1e;
    color: #00ff00;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #444;
    resize: vertical;
}
.story-accordion .story-json-box {
    width: 100%;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #ccc;
    resize: vertical;
}
.story-accordion .story-validation-box {
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

/* Story Accordion Cleanup */
details summary::-webkit-details-marker {
    display: none;
}
details summary {
    list-style: none;
}
details summary::after {
    content: '▼';
    float: right;
    transition: transform 0.3s ease;
    font-size: 0.8rem;
    margin-top: 5px;
}
details[open] summary::after {
    transform: rotate(180deg);
}

/* Fix Details Arrow */
details > summary {
    list-style-type: none;
}
details > summary::-webkit-details-marker {
    display: none;
}
details > summary::after {
    content: '▼';
    float: right;
    transition: transform 0.2s ease-in-out;
    margin-top: 4px;
    font-size: 0.8rem;
}
details[open] > summary::after {
    transform: rotate(180deg);
}


/* Professional SaaS Navigation Buttons */
.nav-pill-group {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 10px !important;
    margin: 15px 0 20px 15px !important;
    padding: 0 !important;
    width: auto !important;
}

.nav-pill-btn {
    border-radius: 6px !important;
    padding: 6px 16px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    width: auto !important;
    height: auto !important;
    color: #374151 !important;
    background-color: #ffffff !important;
    border: 1px solid #d1d5db !important;
    margin: 0 !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
    text-decoration: none !important;
}

.nav-pill-btn:hover {
    background-color: #f3f4f6 !important;
    border-color: #9ca3af !important;
    color: #111827 !important;
}


/* ==========================================
   FINAL CLEAN REPORT CARD SYSTEM
   ========================================== */
.rc-layout { max-width: 1100px; margin: 0 auto; padding: 20px; }
.rc-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.rc-title { font-size: 1.75rem; font-weight: 800; color: #0f172a; margin: 0; }
.rc-subtitle { color: #64748b; font-size: 0.95rem; margin-top: 4px; font-weight: 500; }

/* Hero Card */
.rc-hero-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 24px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); margin-bottom: 24px; }
.rc-hero-flex { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.rc-hero-left { flex: 0 0 140px; text-align: center; }
.rc-hero-right { flex: 1; min-width: 300px; }
.rc-hero-title-sm { border: none; padding: 0; font-size: 1.25rem; margin-bottom: 10px; font-weight: 700; color: #1e293b; }

/* Ring */
.rc-ring-container { position: relative; width: 140px; height: 140px; display: inline-block; }
.rc-ring-svg { width: 140px; height: 140px; transform: rotate(-90deg); }
.rc-ring-bg { fill: none; stroke: #e2e8f0; stroke-width: 10; }
.rc-ring-fill-excellent { fill: none; stroke: #10b981; stroke-width: 10; stroke-linecap: round; }
.rc-ring-fill-fair { fill: none; stroke: #f59e0b; stroke-width: 10; stroke-linecap: round; }
.rc-ring-fill-poor { fill: none; stroke: #ef4444; stroke-width: 10; stroke-linecap: round; }
.rc-ring-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; width: 100%; }
.rc-score-num { font-size: 2rem; font-weight: 800; color: #1e293b; display: block; line-height: 1; }
.rc-score-sub { display: block; color: #64748b; font-size: 0.85rem; font-weight: 600; margin-top: 4px; }

/* Badges */
.rc-badge { border-radius: 6px; padding: 6px 14px; font-size: 0.8rem; font-weight: 700; display: inline-block; }
.rc-badge-success { background: #d1fae5; color: #065f46; }
.rc-badge-primary { background: #e0e7ff; color: #3730a3; }
.rc-badge-warning { background: #fef3c7; color: #92400e; }
.rc-badge-danger { background: #fee2e2; color: #991b1b; }
.rc-badge-gray { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

/* Story Card */
.rc-story-card { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); border-radius: 16px; padding: 32px; color: #f8fafc; margin-bottom: 24px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.rc-story-title { color: #fbbf24; font-weight: 800; font-size: 1.35rem; margin-bottom: 24px; display: flex; align-items: center; gap: 8px; }
.rc-story-act { margin-bottom: 24px; }
.rc-story-act-title { font-size: 0.75rem; text-transform: uppercase; font-weight: 800; letter-spacing: 0.05em; margin-bottom: 8px; display: block; }
.rc-act-1 { color: #38bdf8; }
.rc-act-2 { color: #f87171; }
.rc-act-3 { color: #4ade80; }
.rc-story-text { font-size: 1rem; line-height: 1.7; color: #cbd5e1; margin: 0; font-weight: 400; }

/* Grids */
.rc-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; margin-bottom: 24px; }
.rc-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 24px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02); }
.rc-section-title { font-size: 1.15rem; font-weight: 800; color: #0f172a; margin-bottom: 20px; border-bottom: 2px solid #f1f5f9; padding-bottom: 12px; }

/* Typography */
.rc-text-sm { font-size: 0.9rem !important; line-height: 1.6 !important; }
.rc-text-xs { font-size: 0.75rem !important; }
.rc-text-uppercase { text-transform: uppercase !important; letter-spacing: 0.05em !important; }
.rc-fw-bold { font-weight: 700 !important; }
.rc-text-dark { color: #1e293b !important; }
.rc-text-muted { color: #64748b !important; }
.rc-text-danger-emphasis { color: #991b1b !important; }
.rc-text-success-emphasis { color: #065f46 !important; }
.rc-text-warning-emphasis { color: #92400e !important; }
.rc-code-block { color: #e2e8f0 !important; background: #1e293b !important; border-radius: 8px; padding: 16px; }

/* Progress Bars (Using CSS variables) */
.rc-progress-wrap { width: 100%; margin-bottom: 16px; }
.rc-progress-labels { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 0.85rem; font-weight: 600; color: #334155; }
.rc-progress-bg { width: 100%; height: 8px; background: #e2e8f0; border-radius: 9999px; overflow: hidden; }
.rc-progress-fill { height: 100%; border-radius: 9999px; width: var(--pct); transition: width 0.5s ease; }
.rc-fill-success { background: #10b981; }
.rc-fill-warning { background: #f59e0b; }
.rc-fill-danger { background: #ef4444; }

/* Feedback Boxes */
.rc-feedback-box { border-radius: 8px; padding: 20px; border-left-width: 4px; border-left-style: solid; }
.rc-fb-danger { background: #fef2f2; border-left-color: #ef4444; }
.rc-fb-success { background: #f0fdf4; border-left-color: #10b981; }
.rc-fb-warning { background: #fffbeb; border-left-color: #f59e0b; }
.rc-fb-title { font-size: 0.85rem; font-weight: 800; margin-bottom: 8px; display: block; text-transform: uppercase; letter-spacing: 0.02em; }

/* Tables */
.rc-table { width: 100%; border-collapse: collapse; }
.rc-table th, .rc-table td { padding: 16px; border-bottom: 1px solid #e2e8f0; text-align: left; font-size: 0.9rem; }
.rc-table th { background: #f8fafc; font-weight: 700; color: #475569; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }
.rc-table tr:last-child td { border-bottom: none; }

/* Inner Panels */
.rc-inner-panel { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; }
.rc-inner-warning { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 16px; }

/* ==========================================
   FINAL CLEAN REPORT CARD SYSTEM (V2)
   ========================================== */
.rc-layout { max-width: 1100px; margin: 0 auto; padding: 20px; }
.rc-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.rc-title { font-size: 1.75rem; font-weight: 800; color: #0f172a; margin: 0; }
.rc-subtitle { color: #64748b; font-size: 0.95rem; margin-top: 4px; font-weight: 500; }

.rc-hero-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 24px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); margin-bottom: 24px; }
.rc-hero-flex { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.rc-hero-left { flex: 0 0 140px; text-align: center; }
.rc-hero-right { flex: 1; min-width: 300px; }
.rc-hero-title-sm { border: none; padding: 0; font-size: 1.25rem; margin-bottom: 10px; font-weight: 700; color: #1e293b; }

.rc-ring-container { position: relative; width: 140px !important; height: 140px !important; display: inline-block !important; }
.rc-ring-svg { width: 140px !important; height: 140px !important; max-width: 140px !important; max-height: 140px !important; transform: rotate(-90deg) !important; fill: none !important; }
.rc-ring-bg { fill: none !important; stroke: #e2e8f0 !important; stroke-width: 10 !important; }
.rc-ring-fill-excellent { fill: none !important; stroke: #10b981 !important; stroke-width: 10 !important; stroke-linecap: round !important; }
.rc-ring-fill-fair { fill: none !important; stroke: #f59e0b !important; stroke-width: 10 !important; stroke-linecap: round !important; }
.rc-ring-fill-poor { fill: none !important; stroke: #ef4444 !important; stroke-width: 10 !important; stroke-linecap: round !important; }
.rc-ring-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; width: 100%; }
.rc-score-num { font-size: 2rem; font-weight: 800; color: #1e293b; display: block; line-height: 1; }
.rc-score-sub { display: block; color: #64748b; font-size: 0.85rem; font-weight: 600; margin-top: 4px; }

.rc-badge { border-radius: 6px; padding: 6px 14px; font-size: 0.8rem; font-weight: 700; display: inline-block; }
.rc-badge-success { background: #d1fae5; color: #065f46; }
.rc-badge-primary { background: #e0e7ff; color: #3730a3; }
.rc-badge-warning { background: #fef3c7; color: #92400e; }
.rc-badge-danger { background: #fee2e2; color: #991b1b; }
.rc-badge-gray { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

.rc-story-card { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); border-radius: 16px; padding: 32px; color: #f8fafc; margin-bottom: 24px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.rc-story-title { color: #fbbf24; font-weight: 800; font-size: 1.35rem; margin-bottom: 24px; display: flex; align-items: center; gap: 8px; }
.rc-story-act { margin-bottom: 24px; }
.rc-story-act-title { font-size: 0.75rem; text-transform: uppercase; font-weight: 800; letter-spacing: 0.05em; margin-bottom: 8px; display: block; }
.rc-act-1 { color: #38bdf8; }
.rc-act-2 { color: #f87171; }
.rc-act-3 { color: #4ade80; }
.rc-story-text { font-size: 1rem; line-height: 1.7; color: #cbd5e1; margin: 0; font-weight: 400; }

.rc-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; margin-bottom: 24px; }
.rc-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 24px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02); }
.rc-section-title { font-size: 1.15rem; font-weight: 800; color: #0f172a; margin-bottom: 20px; border-bottom: 2px solid #f1f5f9; padding-bottom: 12px; }

.rc-text-sm { font-size: 0.9rem !important; line-height: 1.6 !important; }
.rc-text-xs { font-size: 0.75rem !important; }
.rc-text-uppercase { text-transform: uppercase !important; letter-spacing: 0.05em !important; }
.rc-fw-bold { font-weight: 700 !important; }
.rc-text-dark { color: #1e293b !important; }
.rc-text-muted { color: #64748b !important; }
.rc-text-danger-emphasis { color: #991b1b !important; }
.rc-text-success-emphasis { color: #065f46 !important; }
.rc-text-warning-emphasis { color: #92400e !important; }
.rc-code-block { color: #e2e8f0 !important; background: #1e293b !important; border-radius: 8px; padding: 16px; }

.rc-progress-wrap { width: 100%; margin-bottom: 16px; }
.rc-progress-labels { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 0.85rem; font-weight: 600; color: #334155; }
.rc-progress-bg { width: 100%; height: 8px; background: #e2e8f0; border-radius: 9999px; overflow: hidden; }
.rc-progress-fill { height: 100%; border-radius: 9999px; transition: width 0.5s ease; }
.rc-fill-success { background: #10b981; }
.rc-fill-warning { background: #f59e0b; }
.rc-fill-danger { background: #ef4444; }

.rc-feedback-box { border-radius: 8px; padding: 20px; border-left-width: 4px; border-left-style: solid; }
.rc-fb-danger { background: #fef2f2; border-left-color: #ef4444; }
.rc-fb-success { background: #f0fdf4; border-left-color: #10b981; }
.rc-fb-warning { background: #fffbeb; border-left-color: #f59e0b; }
.rc-fb-title { font-size: 0.85rem; font-weight: 800; margin-bottom: 8px; display: block; text-transform: uppercase; letter-spacing: 0.02em; }

.rc-table { width: 100%; border-collapse: collapse; }
.rc-table th, .rc-table td { padding: 16px; border-bottom: 1px solid #e2e8f0; text-align: left; font-size: 0.9rem; }
.rc-table th { background: #f8fafc; font-weight: 700; color: #475569; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }
.rc-table tr:last-child td { border-bottom: none; }

.rc-inner-panel { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; }
.rc-inner-warning { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 16px; }


/* ==========================================
   INDUSTRY STANDARD LAYOUT (PERMANENT FIX)
   ========================================== */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main.page-content {
    flex: 1 0 auto;
    width: 100%;
    max-width: 100%;
    padding: 16px;
    box-sizing: border-box;
}

footer {
    flex-shrink: 0;
    margin-top: auto;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    height: 64px;
    padding: 0 20px;
    box-sizing: border-box;
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.page-nav {
    display: flex;
    gap: 10px;
    padding: 16px 0;
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    box-sizing: border-box;
}

.page-nav .btn {
    flex: 1;
    font-weight: 600;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* MOBILE RESPONSIVE OVERRIDES (Crucial for hiding Logout) */
@media (max-width: 900px) {
    .nav-links, .nav-actions {
        display: none !important; /* Overrides the flex display above */
    }
    .mobile-toggle {
        display: block !important;
    }
    .mobile-menu.is-open {
        display: block !important;
    }
}

/* Prevent overflow */
.panel, .card, .ideal-wrap, p, h1, h2, h3, h4, h5, h6, td, th {
    word-break: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

mjx-container {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 5px;
}

/* ============================================================= */
/* PROGRESS DASHBOARD — SaaS STYLES (progress page only)          */
/* Self-contained. No Bootstrap. No inline styles.                */
/* ============================================================= */

.saas-dashboard { max-width: 1400px; margin: 0 auto; padding: 24px; font-family: inherit; }

.saas-back-nav { margin-bottom: 24px; }
.saas-back-btn { display: inline-block; padding: 8px 16px; background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 0.9rem; transition: background 0.2s; }
.saas-back-btn:hover { background: #e5e7eb; color: #111827; }

.saas-wallet-card { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); color: white; border-radius: 16px; padding: 24px 32px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); margin-bottom: 24px; }
.saas-wallet-title { font-size: 1.1rem; font-weight: 600; opacity: 0.95; margin: 0 0 4px 0; color: #fff; }
.saas-wallet-sub { font-size: 0.85rem; opacity: 0.7; margin: 0; color: #fff; }
.saas-wallet-amount { font-size: 3.5rem; font-weight: 800; line-height: 1; letter-spacing: -0.05em; margin: 0; color: #fff; }
.saas-wallet-link { color: #93c5fd; font-size: 0.85rem; text-decoration: none; margin-top: 8px; display: inline-block; font-weight: 500; }
.saas-wallet-link:hover { color: #bfdbfe; text-decoration: underline; }
.saas-wallet-right { text-align: right; }

.saas-section-card { background: #ffffff; border-radius: 16px; padding: 24px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03); border: 1px solid #e2e8f0; margin-bottom: 24px; }
.saas-section-title { font-size: 1.25rem; font-weight: 700; color: #1e293b; margin-top: 0; margin-bottom: 20px; }
.saas-section-meta { color: #6b7280; font-size: 0.85rem; margin-bottom: 16px; }
.saas-section-meta strong { color: #111827; }

.saas-expert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px; }
.saas-expert-card { border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px; text-align: center; transition: all 0.2s ease; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.saas-expert-card:hover { border-color: #cbd5e1; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); transform: translateY(-2px); }
.saas-expert-id { font-size: 0.7rem; font-weight: 700; color: #64748b; letter-spacing: 0.05em; text-transform: uppercase; }
.saas-expert-name { font-size: 0.9rem; font-weight: 600; color: #0f172a; line-height: 1.2; }
.saas-badge { font-size: 0.7rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; display: inline-block; white-space: nowrap; }
.saas-badge-red { background: #fee2e2; color: #b91c1c; }
.saas-badge-yellow { background: #fef3c7; color: #b45309; }
.saas-badge-green { background: #dcfce7; color: #15803d; }

.saas-accordion { border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; margin-bottom: 8px; background: #ffffff; }
.saas-accordion summary { padding: 16px; font-weight: 600; color: #1e293b; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; transition: background 0.2s; }
.saas-accordion summary::-webkit-details-marker { display: none; }
.saas-accordion summary::after { content: '\25BC'; font-size: 0.8rem; color: #94a3b8; transition: transform 0.2s; }
.saas-accordion[open] summary::after { transform: rotate(180deg); }
.saas-accordion summary:hover { background: #f8fafc; }
.saas-accordion[open] summary { border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.saas-accordion-content { padding: 16px; }
.saas-accordion-target { color: #6b7280; font-size: 0.85rem; font-weight: 500; }

.saas-question-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap; gap: 12px; }
.saas-question-row:last-child { border-bottom: none; padding-bottom: 0; }
.saas-question-text { font-size: 0.9rem; color: #334155; margin: 0; }

.saas-btn-primary { background: #2563eb; color: white; border: none; border-radius: 6px; padding: 8px 16px; font-weight: 500; font-size: 0.8rem; cursor: pointer; text-decoration: none; display: inline-block; transition: background 0.2s; white-space: nowrap; }
.saas-btn-primary:hover { background: #1d4ed8; color: white; }

.saas-empty-state { text-align: center; padding: 32px; color: #64748b; background: #f8fafc; border-radius: 12px; border: 1px dashed #cbd5e1; }

.saas-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.saas-charts-row .saas-section-card { margin-bottom: 0; }
.saas-chart-canvas { max-height: 200px; width: 100%; display: block; }
.saas-chart-title-primary { color: #2563eb; }
.saas-chart-title-success { color: #10b981; }

/* Custom Modal (no Bootstrap dependency) */
.saas-modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1050; align-items: center; justify-content: center; padding: 16px; }
.saas-modal-overlay.is-open { display: flex; }
.saas-modal-content { background: white; border-radius: 16px; padding: 28px; max-width: 520px; width: 100%; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.15); }
.saas-modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 12px; }
.saas-modal-title { font-size: 1.25rem; font-weight: 700; margin: 0; color: #0f172a; }
.saas-modal-close { background: none; border: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: #6b7280; padding: 0; }
.saas-modal-close:hover { color: #111827; }
.saas-modal-subject { color: #6b7280; margin-bottom: 16px; font-size: 0.9rem; }
.saas-modal-subject strong { color: #0f172a; }

.saas-path-card { display: flex; gap: 16px; padding: 16px; border: 1px solid #e2e8f0; border-radius: 12px; text-decoration: none; transition: all 0.2s; align-items: center; margin-bottom: 12px; }
.saas-path-card:hover { border-color: #3b82f6; background: #f8fafc; transform: translateY(-2px); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.saas-path-card:last-child { margin-bottom: 0; }
.saas-path-icon { font-size: 2rem; flex-shrink: 0; }
.saas-path-content { flex: 1; }
.saas-path-title { font-weight: 700; margin: 0 0 4px 0; color: #0f172a; font-size: 1rem; }
.saas-path-desc { margin: 0; color: #6b7280; font-size: 0.85rem; }

@media (max-width: 768px) {
    .saas-charts-row { grid-template-columns: 1fr; }
    .saas-wallet-card { flex-direction: column; align-items: flex-start; gap: 12px; }
    .saas-wallet-right { text-align: left; width: 100%; }
}

/* --- Mastery Engine UI (Copy Paste Page) --- */
.sam-wrapper { max-width: 680px; margin: 2rem auto; padding: 0 1rem; font-family: inherit; }
.sam-card { background: #ffffff; border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.05), 0 4px 6px rgba(0,0,0,0.03); border: 1px solid #f0f0f0; padding: 2.5rem; position: relative; overflow: hidden; }
.sam-header { margin-bottom: 2rem; text-align: center; }
.sam-header h2 { font-size: 1.5rem; font-weight: 700; color: #111827; margin: 0 0 0.5rem 0; }
.sam-header p { color: #6b7280; font-size: 0.95rem; margin: 0; }
.sam-badge { display: inline-block; background: #eff6ff; color: #2563eb; padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 1rem; border: 1px solid #bfdbfe; }
.sam-step { display: flex; gap: 1rem; margin-bottom: 1.5rem; position: relative; }
.sam-step:not(:last-child)::before { content: ''; position: absolute; left: 16px; top: 40px; bottom: -15px; width: 2px; background: #e5e7eb; z-index: 1; }
.sam-step-num { background: #eff6ff; color: #2563eb; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; flex-shrink: 0; z-index: 2; border: 2px solid #ffffff; box-shadow: 0 0 0 2px #eff6ff; }
.sam-step-content { flex-grow: 1; padding-top: 4px; }
.sam-step-title { font-weight: 600; color: #1f2937; font-size: 1.05rem; margin-bottom: 0.75rem; }
.sam-help-text { color: #6b7280; font-size: 0.9rem; margin-bottom: 10px; }
.sam-btn-copy { background: #2563eb; color: white; border: none; border-radius: 8px; padding: 12px 24px; font-weight: 600; font-size: 0.95rem; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: all 0.2s ease; width: 100%; justify-content: center; }
.sam-btn-copy:hover { background: #1d4ed8; transform: translateY(-1px); }
.sam-btn-copy:active { transform: translateY(0); }
.sam-btn-submit { background: #10b981; color: white; border: none; border-radius: 8px; padding: 14px 24px; font-weight: 600; font-size: 1rem; cursor: pointer; width: 100%; transition: all 0.2s ease; display: flex; justify-content: center; align-items: center; gap: 8px; }
.sam-btn-submit:hover { background: #059669; }
.sam-btn-submit:disabled { background: #9ca3af; cursor: not-allowed; }
.sam-json-input { width: 100%; min-height: 140px; padding: 16px; border: 2px dashed #d1d5db; border-radius: 12px; font-family: 'Fira Code', 'Courier New', Courier, monospace; font-size: 0.85rem; background: #f9fafb; transition: border-color 0.2s; resize: vertical; box-sizing: border-box; }
.sam-json-input:focus { outline: none; border-color: #3b82f6; background: #ffffff; }
.sam-copy-success { color: #10b981; font-weight: 600; font-size: 0.9rem; margin-top: 8px; display: none; text-align: center; }
.sam-links { display: flex; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.sam-link-btn { display: inline-flex; align-items: center; padding: 10px 16px; border-radius: 8px; background: #f3f4f6; color: #374151; text-decoration: none; font-weight: 500; font-size: 0.9rem; border: 1px solid #e5e7eb; transition: all 0.2s; }
.sam-link-btn:hover { background: #e5e7eb; color: #111827; }

/* --- Teacher Approval Table (SaaS) --- */
.saas-teacher-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.saas-teacher-table thead { background: #f8fafc; border-bottom: 2px solid #e2e8f0; }
.saas-teacher-table th { padding: 12px 16px; text-align: left; font-size: 0.75rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.saas-teacher-table td { padding: 16px; border-bottom: 1px solid #f1f5f9; font-size: 0.9rem; color: #334155; vertical-align: middle; }
.saas-teacher-table tr:hover td { background: #f8fafc; }
.saas-teacher-table .saas-cell-answer { color: #059669; font-weight: 500; }
.saas-teacher-table .saas-cell-question { color: #475569; font-style: italic; }
.saas-checkbox { width: 18px; height: 18px; cursor: pointer; }
.saas-bulk-bar { display: flex; justify-content: space-between; align-items: center; padding: 16px; margin-top: 16px; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 12px; }
.saas-bulk-bar-text { color: #0369a1; font-weight: 600; font-size: 0.9rem; }
.saas-btn-success { background: #10b981; color: white; border: none; border-radius: 6px; padding: 10px 20px; font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: background 0.2s; }
.saas-btn-success:hover { background: #059669; color: white; }
.saas-btn-sm { padding: 6px 12px; font-size: 0.8rem; }

.saas-btn-danger { background: #dc2626; color: white; border: none; border-radius: 6px; padding: 10px 20px; font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: background 0.2s; }
.saas-btn-danger:hover { background: #b91c1c; color: white; }

/* --- Google Translate Button & Panel (Flow Bubbles) --- */
.bubble-wrap { display: flex; flex-direction: column; gap: 6px; }
.bubble-row { display: flex; align-items: flex-start; gap: 8px; }
.bubble-translate-btn { background: transparent; border: 1px solid #d1d5db; border-radius: 6px; padding: 4px 8px; font-size: 0.75rem; cursor: pointer; color: #6b7280; transition: all 0.15s; flex-shrink: 0; margin-top: 8px; }
.bubble-translate-btn:hover { background: #f3f4f6; color: #111827; border-color: #9ca3af; }
.bubble-translate-btn:disabled { opacity: 0.5; cursor: wait; }
.bubble-translation { background: #f0f9ff; border: 1px solid #bae6fd; border-left: 3px solid #3b82f6; border-radius: 8px; padding: 12px 14px; font-size: 0.9rem; line-height: 1.5; color: #0c4a6e; margin-top: 4px; }
.bubble-translation-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #0369a1; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }

/* === 7-Turn Bilingual Flow Cards === */
.flow-card-question { background: #eff6ff; border-left: 4px solid #3b82f6; border-radius: 8px; padding: 14px 18px; margin: 8px 0; }
.flow-card-answer { background: #fef3c7; border-left: 4px solid #f59e0b; border-radius: 8px; padding: 14px 18px; margin: 8px 0; }
.flow-card-label { font-size: 0.7rem; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.flow-en { font-size: 0.95rem; color: #1f2937; font-weight: 500; line-height: 1.5; margin-bottom: 6px; }
.flow-ur { font-size: 0.9rem; color: #4b5563; font-style: italic; line-height: 1.5; }
.flow-ur::before { content: '🇵🇰 '; font-style: normal; }
.flow-en::before { content: '🇬🇧 '; }

/* ==========================================
   TEACHER EXAM QUEUE — mobile-first, no !important
   ========================================== */
.queue-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin: 24px 0 16px;
}
.queue-title { font-size: 1.4rem; font-weight: 800; margin: 0; color: #0f172a; }
.queue-subtitle { font-size: 0.9rem; color: #64748b; margin: 4px 0 0; }

.queue-quicklinks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.queue-quicklinks a {
  padding: 8px 14px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #1e293b;
  font-size: 0.85rem;
  text-decoration: none;
}
.queue-quicklinks a:hover { background: #e2e8f0; }

.queue-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.queue-stat {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.queue-stat__label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 6px;
}
.queue-stat__value { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.queue-stat__hint { font-size: 0.75rem; color: #94a3b8; margin-top: 4px; }
.queue-stat--pending .queue-stat__value { color: #f59e0b; }
.queue-stat--called .queue-stat__value { color: #2563eb; }
.queue-stat--progress .queue-stat__value { color: #06b6d4; }
.queue-stat--completed .queue-stat__value { color: #10b981; }

.queue-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.queue-action-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.queue-action-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}
.queue-action-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.queue-count-input { max-width: 100px; }

.queue-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.queue-form-field { display: flex; flex-direction: column; gap: 6px; }
.queue-form-actions { display: flex; justify-content: flex-end; }

.queue-checkboxes { display: flex; flex-wrap: wrap; gap: 12px; }
.queue-checkbox { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; }

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

.queue-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.queue-danger-panel { border-color: #ef4444; }
.queue-accent-panel { border-color: #2563eb; }

@media (min-width: 768px) {
  .queue-title { font-size: 1.6rem; }
}

/* ==========================================
   BOOTSTRAP FALLBACK — btn-outline-secondary
   (Bootstrap CDN blocked by CSP, local rules missing)
   ========================================== */
.btn-outline-secondary {
  background: #ffffff;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #94a3b8;
  text-decoration: none;
}

/* Ensure active vs inactive tabs are visually distinct */
.btn-primary.btn-sm {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #2563eb;
}
.btn-outline-secondary.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* Mobile: make tab row wrap nicely and be tappable */
@media (max-width: 640px) {
  .btn-outline-secondary.btn-sm,
  .btn-primary.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
  }
}

/* ==========================================
   PREMIUM STORY CARD (Cinema/SaaS Theme)
   ========================================== */
.story-reading-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 16px;
    padding: 28px 24px;
    color: #f8fafc;
    margin-bottom: 24px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    box-sizing: border-box;
}
.story-reading-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 16px;
}
.story-reading-title {
    color: #fbbf24; /* Premium Gold */
    font-weight: 800;
    font-size: 1.35rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.story-reading-badge {
    background: rgba(255,255,255,0.1);
    color: #cbd5e1;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.story-reading-content {
    font-size: 1rem;
    line-height: 1.7;
    color: #e2e8f0;
    font-weight: 400;
    white-space: pre-wrap; /* Preserves line breaks from AI */
}

@media (max-width: 600px) {
    .story-reading-card { padding: 20px 16px; }
    .story-reading-title { font-size: 1.15rem; }
    .story-reading-content { font-size: 0.95rem; line-height: 1.6; }
}

/* === Teacher Review Detail (TRD) === */
.trd-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 5rem;
    font-family: system-ui, -apple-system, sans-serif;
    color: #1f2937;
}
.trd-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1.5rem;
}
.trd-breadcrumb {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}
.trd-breadcrumb a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}
.trd-breadcrumb a:hover { text-decoration: underline; }
.trd-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}
.trd-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: #111827;
}
.trd-meta {
    font-size: 0.9rem;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.trd-badge {
    background: #e5e7eb;
    color: #374151;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.trd-btn-back {
    background: #f3f4f6;
    color: #374151;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid #d1d5db;
    transition: background 0.15s;
}
.trd-btn-back:hover { background: #e5e7eb; }

.trd-messages { margin-bottom: 1.5rem; }
.trd-alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-weight: 500;
}
.trd-alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.trd-alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.trd-alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

.trd-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}
@media (min-width: 992px) {
    .trd-grid { grid-template-columns: 1fr 1fr; }
}

.trd-col { display: flex; flex-direction: column; gap: 1.5rem; }

.trd-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.trd-card-header {
    background: #f9fafb;
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
}
.trd-card-body { padding: 1.25rem; }

.trd-field { margin-bottom: 1rem; }
.trd-field:last-child { margin-bottom: 0; }
.trd-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}
.trd-field input[type="text"],
.trd-field input[type="number"],
.trd-field textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #111827;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.trd-field textarea { resize: vertical; min-height: 2.5rem; }
.trd-field input:focus,
.trd-field textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.trd-score-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}
@media (min-width: 576px) {
    .trd-score-grid { grid-template-columns: repeat(4, 1fr); }
}
.trd-score-grid .trd-field { margin-bottom: 0; }
.trd-score-grid input { text-align: center; }
.trd-score-grid + .trd-field { margin-top: 1rem; }

.trd-three-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}
@media (min-width: 768px) {
    .trd-three-grid { grid-template-columns: repeat(3, 1fr); }
}

.trd-json-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.trd-json-warning code {
    background: #fef3c7;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-weight: 600;
}

.trd-code-area {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.85rem;
    background: #1e293b;
    color: #e2e8f0;
    border: none;
    padding: 1rem;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
}
.trd-code-area:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.trd-publish-card {
    margin-top: 2rem;
    border: 2px solid #10b981;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.trd-publish-header {
    background: #10b981;
    color: #fff;
    padding: 1rem 1.25rem;
    font-weight: 700;
    font-size: 1rem;
}
.trd-publish-body { padding: 1.5rem; }
.trd-publish-fields {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
@media (min-width: 768px) {
    .trd-publish-fields { flex-direction: row; align-items: flex-start; }
    .trd-publish-fields .publish-score { width: 33%; }
    .trd-publish-fields .publish-feedback { width: 67%; }
}
.trd-publish-fields .req { color: #ef4444; }
.trd-score-input {
    display: flex;
    align-items: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
}
.trd-score-input input {
    border: none;
    border-radius: 0;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    padding: 0.5rem;
    width: 100%;
}
.trd-score-input input:focus { box-shadow: none; }
.trd-score-max {
    background: #f3f4f6;
    padding: 0.5rem 1rem;
    color: #6b7280;
    font-weight: 600;
    border-left: 1px solid #d1d5db;
    white-space: nowrap;
}

.trd-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}
.trd-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: filter 0.15s;
    font-family: inherit;
}
.trd-btn:hover { filter: brightness(0.95); }
.trd-btn-outline {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}
.trd-btn-success {
    background: #10b981;
    color: #fff;
}
@media (max-width: 576px) {
    .trd-actions {
        flex-direction: column-reverse;
    }
    .trd-btn {
        width: 100%;
    }
}

/* --- Master Board Accordion (Added for Student Board) --- */
.ideal-toggle-icon { transition: transform 0.2s; display: inline-block; font-size: 0.8rem; color: var(--ideal-muted); }

/* =========================================
/* =========================================

/* Standard Layout Utilities fallback */
.row { display: flex; flex-wrap: wrap; margin-right: -0.75rem; margin-left: -0.75rem; }
.col-6, .col-md-3 { position: relative; width: 100%; padding-right: 0.75rem; padding-left: 0.75rem; }
.col-6 { flex: 0 0 auto; width: 50%; }
@media (min-width: 768px) {
  .col-md-3 { flex: 0 0 auto; width: 25%; }
}
.card { position: relative; display: flex; flex-direction: column; min-width: 0; word-wrap: break-word; background-color: #fff; background-clip: border-box; border: 1px solid rgba(0,0,0,.125); border-radius: .5rem; }
.card-header { padding: .5rem 1rem; margin-bottom: 0; background-color: rgba(0,0,0,.03); border-bottom: 1px solid rgba(0,0,0,.125); }
.shadow-sm { box-shadow: 0 .125rem .25rem rgba(0,0,0,.075)!important; }
.border-0 { border: 0!important; }
.rounded-3 { border-radius: .5rem!important; }
.w-50 { width: 50%!important; }
.w-auto { width: auto!important; }

/* KPI Grid for Master Board */
.ideal-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.ideal-kpi-card { background: #fff; border: 1px solid var(--ideal-border); border-radius: var(--ideal-radius); padding: 1.5rem; text-align: center; display: flex; flex-direction: column; justify-content: center; }
.ideal-kpi-value { font-size: 2rem; font-weight: 800; margin-bottom: 0.25rem; }
.ideal-kpi-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ideal-muted); font-weight: 700; }

/* Accordion Header Fixes */
.ideal-accordion summary { display: flex !important; justify-content: space-between; align-items: center; list-style: none; cursor: pointer; padding: 1rem 1.25rem; }
.ideal-accordion summary::-webkit-details-marker { display: none; }
.ideal-accordion-title { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.1rem; color: var(--ideal-text); }
.ideal-accordion-badge { font-size: 0.85rem; padding: 0.4rem 0.8rem; border-radius: 50rem; font-weight: 600; }
.ideal-accordion-body { max-height: 50vh; overflow-y: auto; padding: 0; }
.ideal-list-item { padding: 1rem 1.25rem; display: flex; align-items: flex-start; gap: 0.75rem; border-bottom: 1px solid var(--ideal-border); background: #fff; cursor: pointer; }
.ideal-list-item:last-child { border-bottom: none; }
.ideal-list-item:hover { background: #f8f9fa; }
.ideal-accordion-footer { padding: 1rem 1.25rem; background: #f8f9fa; border-top: 1px solid var(--ideal-border); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; }


/* === MASTER STUDENT BOARD CUSTOM CSS === */
.smb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.smb-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 1.5rem; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.smb-value { font-size: 2rem; font-weight: 800; margin-bottom: 0.25rem; }
.smb-label { font-size: 0.75rem; text-transform: uppercase; color: #6b7280; font-weight: 700; letter-spacing: 0.05em; }

.smb-accordion { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 1rem; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.smb-accordion summary { padding: 1rem 1.25rem; display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-weight: 700; background: #f9fafb; list-style: none; }
.smb-accordion summary::-webkit-details-marker { display: none; }
.smb-accordion[open] summary { border-bottom: 1px solid #e5e7eb; background: #fff; }
.smb-body { max-height: 50vh; overflow-y: auto; padding: 0; }
.smb-item { padding: 1rem 1.25rem; display: flex; align-items: flex-start; gap: 0.75rem; border-bottom: 1px solid #f3f4f6; background: #fff; }
.smb-item:last-child { border-bottom: none; }
.smb-footer { padding: 1rem 1.25rem; background: #f9fafb; border-top: 1px solid #e5e7eb; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }

.smb-form-group { margin-bottom: 1rem; }
.smb-form-group label { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 0.25rem; color: #374151; }
.smb-form-group input, .smb-form-group select, .smb-form-group textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px; box-sizing: border-box; background: #fff; }


/* === MASTER STUDENT BOARD TABS === */
.smb-tab { padding: 0.5rem 1.25rem; border-radius: 50rem; border: 1px solid #d1d5db; background: #fff; color: #374151; text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; gap: 0.5rem; transition: all 0.2s; cursor: pointer; font-size: 0.95rem; }
.smb-tab:hover { background: #f3f4f6; }
.smb-tab.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.smb-tab.active-danger { background: #dc3545; color: #fff; border-color: #dc3545; }
.smb-tab.active-dark { background: #212529; color: #fff; border-color: #212529; }

/* Filter Toolbar Overrides */
.filter-toolbar-header {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
}
.filter-actions {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.5rem;
}

/* --- SMB FILTER TOOLBAR --- */
.smb-filter-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.smb-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
}
.smb-filter-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}
.smb-filter-badge {
    background: #f1f5f9;
    color: #475569;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid #e2e8f0;
}
.smb-filter-form {
    display: grid;
    grid-template-columns: 2fr 1.5fr 2.5fr 1fr;
    gap: 12px;
    align-items: center;
    margin: 0;
}
.smb-filter-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.smb-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.875rem;
    background: #fff;
    color: #334155;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.smb-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.smb-date-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}
.smb-date-sep {
    color: #94a3b8;
    font-size: 0.875rem;
}
.smb-filter-actions {
    display: flex;
    gap: 8px;
}
.smb-btn-primary, .smb-btn-secondary {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.smb-btn-primary {
    background: #3b82f6;
    color: #fff;
    border: 1px solid #3b82f6;
}
.smb-btn-primary:hover {
    background: #2563eb;
    color: #fff;
}
.smb-btn-secondary {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #cbd5e1;
}
.smb-btn-secondary:hover {
    background: #f1f5f9;
    color: #334155;
}
.smb-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
@media (max-width: 768px) {
    .smb-filter-form {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .smb-date-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .smb-date-sep {
        display: none;
    }
    .smb-filter-actions {
        flex-direction: row;
    }
}
/* --- END SMB FILTER TOOLBAR --- */

/* --- SMB CUSTOM SELECT OVERRIDE --- */
select.smb-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px;
    cursor: pointer;
}
/* Desktop-only option styling (Mobile OS ignores this) */
select.smb-input option {
    padding: 10px;
    font-size: 0.875rem;
    color: #334155;
    background: #ffffff;
}
/* --- END SMB CUSTOM SELECT OVERRIDE --- */

/* Teacher Direct Grade Styles */
.dg-panel { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 24px; margin-bottom: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.dg-title { font-size: 1.25rem; font-weight: 700; color: #1e293b; margin-bottom: 16px; }
.dg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.dg-group { display: flex; flex-direction: column; }
.dg-group-action { justify-content: flex-end; }
.dg-label { font-size: 0.85rem; font-weight: 600; color: #475569; margin-bottom: 6px; }
.dg-input, .dg-select, .dg-textarea { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 0.9rem; color: #334155; background: #fff; transition: border-color 0.2s; }
.dg-input:focus, .dg-select:focus, .dg-textarea:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
.dg-textarea { resize: vertical; min-height: 120px; font-family: monospace; }
.dg-input-row { display: flex; gap: 8px; align-items: center; }
.dg-btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 20px; background: #3b82f6; color: #fff; border: 1px solid #3b82f6; border-radius: 6px; font-weight: 600; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.dg-btn:hover { background: #2563eb; color: #fff; }
.dg-btn-secondary { background: #f8fafc; color: #475569; border: 1px solid #cbd5e1; }
.dg-btn-secondary:hover { background: #f1f5f9; color: #334155; }
.dg-btn-nowrap { white-space: nowrap; }
.dg-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 16px; }
.dg-textarea, .dg-prompt-section textarea { display: block !important; width: 100% !important; box-sizing: border-box !important; min-height: 200px !important; resize: vertical !important; padding: 14px !important; font-family: monospace !important; font-size: 0.9rem !important; line-height: 1.6 !important; background-color: #f8fafc !important; border: 1px solid #cbd5e1 !important; border-radius: 8px !important; }
