/* Base component styles for the main OWEN interface.
   This file establishes the default look and layout rules for the HTML shell
   before more specialized UI layers add feature-specific styling. */
      * {
        box-sizing: border-box;
      }

      [hidden] {
        display: none !important;
      }

      html,
      body {
        height: 100%;
        min-height: 100%;
      }

      body {
        margin: 0;
        font-family: var(--font-body);
        background: var(--bg);
        color: var(--text);
        line-height: 1.6;
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        -webkit-text-size-adjust: 100%;
      }

      body[data-route="landing"] {
        background: var(--landing-bg);
        color: #f5f7fb;
      }

      body[data-route="student"] {
        overflow: hidden;
        height: 100vh;
      }

      img {
        max-width: 100%;
        display: block;
      }

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

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

      input::placeholder,
      textarea::placeholder {
        color: var(--text-placeholder);
      }

      button {
        border: none;
        background: none;
        color: inherit;
      }

      button:focus-visible,
      input:focus-visible,
      textarea:focus-visible,
      select:focus-visible {
        outline: 2px solid var(--focus-ring);
        outline-offset: 2px;
        box-shadow: var(--shadow-focus);
      }

      .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        border: 0;
      }

      .app-root {
        min-height: 100vh;
      }

      @supports (min-height: 100dvh) {
        .app-root {
          min-height: 100dvh;
        }
      }

      body[data-route="student"] {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
      }

      body[data-route="student"] .app-root {
        height: 100%;
      }

      .skip-link {
        position: absolute;
        top: 12px;
        left: 12px;
        padding: 8px 12px;
        border-radius: 999px;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        color: var(--text);
        transform: translateY(-140%);
        transition: transform 0.2s ease;
        z-index: 30;
      }

      .skip-link:focus {
        transform: translateY(0);
      }

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

      .btn-primary {
        background: var(--primary);
        color: #f5fbfc;
        box-shadow: 0 12px 24px rgba(46, 111, 114, 0.25);
      }

      .btn-primary:hover {
        background: var(--primary-dark);
      }

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

      .btn-ghost:hover {
        border-color: var(--border-strong);
        background: var(--primary-soft);
      }

      .btn:disabled,
      .icon-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        box-shadow: none;
        transform: none;
      }

      .continue-btn,
      .continue-cancel-btn {
        margin-top: 8px;
        padding: 8px 12px;
        border-radius: 10px;
        border: 1px solid var(--border);
        background: var(--bg-soft);
        cursor: pointer;
        font-weight: 600;
      }

      .continue-btn:hover,
      .continue-cancel-btn:hover {
        border-color: var(--border-strong);
        background: var(--primary-soft);
      }

      .badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 4px 10px;
        border-radius: 999px;
        border: 1px solid var(--border);
        font-size: 12px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--primary-dark);
        background: rgba(46, 111, 114, 0.12);
      }

      .chip-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 4px 10px;
        border-radius: 999px;
        border: 1px solid var(--color-border);
        font-size: 12px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--primary-dark);
        background: var(--owen-warm-white);
        cursor: pointer;
        transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
      }

      .chip-btn:hover {
        border-color: var(--border-strong);
        background: var(--owen-warm-white-soft);
      }

      .chip-btn:active,
      .chip-btn[aria-pressed="true"] {
        border-color: var(--border-strong);
        background: var(--owen-warm-white-soft);
      }

      .chip-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
      }

      .status-pill {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 10px;
        border-radius: 999px;
        border: 1px solid var(--border);
        font-size: 12px;
        font-weight: 600;
        background: rgba(46, 111, 114, 0.08);
        color: var(--text-secondary);
        min-height: 24px;
      }

      .status-pill[data-state="success"] {
        background: rgba(46, 111, 114, 0.18);
        border-color: var(--border-strong);
        color: var(--primary-dark);
      }

      .status-pill[data-state="pending"] {
        background: rgba(61, 126, 130, 0.12);
        color: var(--text-soft);
      }

      .status-pill[data-state="warning"] {
        background: rgba(244, 162, 74, 0.16);
        border-color: rgba(244, 162, 74, 0.35);
        color: #7a4b15;
      }

      .status-pill[data-state="error"] {
        background: rgba(197, 90, 90, 0.16);
        border-color: rgba(197, 90, 90, 0.35);
        color: #7e2e2e;
      }

      body.theme-dark .status-pill[data-state="warning"] {
        color: #f5c68b;
      }

      body.theme-dark .status-pill[data-state="error"] {
        color: #f2b0b0;
      }

      .status-pill.upload-status[data-mode="success"] {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        border-radius: 14px;
        padding: 10px 12px;
        min-height: 0;
        max-width: 100%;
      }

      .upload-success-banner {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
      }

      .upload-success-dot {
        width: 8px;
        height: 8px;
        border-radius: 999px;
        background: var(--primary);
        flex: 0 0 auto;
        margin-top: 2px;
      }

      .status-pill.upload-status[data-state="warning"] .upload-success-dot {
        background: #f4a24a;
      }

      .status-pill.upload-status[data-state="error"] .upload-success-dot {
        background: #c55a5a;
      }

      .upload-success-text {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
      }

      .upload-success-primary {
        font-size: 13px;
        font-weight: 600;
        color: var(--text-primary);
      }

      .upload-success-secondary {
        font-size: 12px;
        color: var(--text-soft);
      }

      .upload-success-filename {
        font-size: 12px;
        color: var(--text-secondary);
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .upload-success-details {
        font-size: 12px;
        color: var(--text-secondary);
      }

      .upload-success-details summary {
        cursor: pointer;
        color: var(--text-soft);
      }

      .upload-success-details-body {
        margin-top: 6px;
        display: flex;
        flex-direction: column;
        gap: 6px;
      }

      .upload-success-detail-row {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        flex-wrap: wrap;
        min-width: 0;
      }

      .upload-success-detail-label {
        font-weight: 600;
        color: var(--text-soft);
      }

      .upload-success-detail-body {
        min-width: 0;
        flex: 1 1 auto;
      }

      .upload-success-detail-value {
        overflow-wrap: anywhere;
        max-width: 100%;
        white-space: normal;
      }

      .upload-success-path,
      .upload-success-path code {
        font-family: var(--font-mono);
        overflow-wrap: anywhere;
        max-width: 100%;
        white-space: normal;
      }

      .upload-success-copy {
        padding: 4px 8px;
        border-radius: 999px;
        font-size: 11px;
      }

      .card {
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-soft);
      }

      .card-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
      }

      .section-label {
        font-size: 11px;
        letter-spacing: 0.22em;
        text-transform: uppercase;
        color: var(--text-soft);
        font-weight: 700;
      }

      .chevron {
        width: 10px;
        height: 10px;
        display: inline-block;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        transition: transform 0.16s ease;
      }

      button[aria-expanded="false"] .chevron {
        transform: rotate(-45deg);
      }

      .landing {
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 64px 24px;
      }

      .landing-theme-teal {
        --landing-cta-primary-bg: var(--surface-mint);
        --landing-cta-primary-border: var(--border-mint);
        --landing-cta-primary-hover-bg: var(--surface-mint-hover);
        --landing-cta-primary-hover-border: var(--border-mint-hover);
        --landing-cta-secondary-bg: var(--surface-welcome);
        --landing-cta-secondary-border: var(--border-mint);
        --landing-cta-secondary-hover-bg: var(--surface-mint);
        --landing-cta-secondary-hover-border: var(--border-mint-hover);
        --landing-cta-text-color: var(--text-heading);
        --landing-cta-subtitle-color: var(--text-supporting);
        --landing-cta-chip-border: rgba(255, 255, 255, 0.7);
        --landing-cta-chip-dot: var(--bg-surface-hover);
      }

      .landing-theme-dark {
        --landing-cta-primary-bg: rgba(8, 12, 18, 0.96);
        --landing-cta-primary-border: rgba(255, 255, 255, 0.14);
        --landing-cta-primary-hover-bg: rgba(15, 20, 30, 0.98);
        --landing-cta-primary-hover-border: rgba(255, 255, 255, 0.22);
        --landing-cta-secondary-bg: rgba(8, 12, 18, 0.9);
        --landing-cta-secondary-border: rgba(255, 255, 255, 0.12);
        --landing-cta-secondary-hover-bg: rgba(15, 20, 30, 0.98);
        --landing-cta-secondary-hover-border: rgba(255, 255, 255, 0.22);
        --landing-cta-text-color: #f5f7fb;
        --landing-cta-subtitle-color: rgba(245, 248, 255, 0.6);
        --landing-cta-chip-border: rgba(245, 248, 255, 0.6);
        --landing-cta-chip-dot: rgba(245, 248, 255, 0.9);
      }

      .landing-card {
        width: min(1200px, 94vw);
        background: var(--landing-card);
        border: 1px solid var(--landing-border);
        border-radius: 36px;
        box-shadow: var(--landing-glow), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
        padding: 56px 60px;
        display: grid;
        grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
        gap: 48px;
        align-items: center;
        justify-items: center;
        backdrop-filter: blur(12px);
        position: relative;
        overflow: hidden;
      }

      .landing-mascot {
        width: min(360px, 70vw);
        aspect-ratio: 1 / 1;
        margin: 0 auto;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
      }

      .landing-content {
        display: flex;
        flex-direction: column;
        gap: 18px;
        align-items: center;
        text-align: center;
        justify-self: center;
        max-width: 560px;
      }

      .landing-lockup {
        --landing-lockup-shift: clamp(6px, 0.9vw, 12px);
        --landing-wordmark-shift: clamp(16px, 1.9vw, 24px);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 18px;
        transform: translateY(var(--landing-lockup-shift, 0px));
      }

      .landing-wordmark {
        font-family: var(--font-display);
        font-size: clamp(48px, 5.8vw, 80px);
        letter-spacing: 0.28em;
        margin: 0;
        transform: translateY(var(--landing-wordmark-shift, 0px));
      }

      .landing-tagline {
        margin: 0;
        font-size: clamp(18px, 1.9vw, 22.5px);
        line-height: 1.25;
        letter-spacing: 0.02em;
        color: rgba(226, 234, 248, 0.78);
        transform: translateY(-6px);
      }

      .landing-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: var(--landing-cta-stack-gap);
        margin-top: 8px;
        justify-items: center;
        align-items: stretch;
        width: 100%;
      }

      .landing-button {
        --landing-cta-bg: var(--landing-cta-secondary-bg);
        --landing-cta-border: var(--landing-cta-secondary-border);
        --landing-cta-hover-bg: var(--landing-cta-secondary-hover-bg);
        --landing-cta-hover-border: var(--landing-cta-secondary-hover-border);
        position: relative;
        flex: 0 1 var(--landing-cta-width);
        width: min(100%, var(--landing-cta-width));
        min-width: min(100%, var(--landing-cta-min));
        max-width: var(--landing-cta-max);
        min-height: var(--landing-cta-height);
        min-height: max(
          var(--landing-cta-height),
          calc(
            var(--landing-cta-icon-height) + var(--landing-cta-text-block) + var(--landing-cta-padding-block) +
              var(--landing-cta-padding-block)
          )
        );
        border-radius: var(--landing-cta-radius);
        display: grid;
        align-items: stretch;
        justify-items: center;
        padding: var(--landing-cta-padding-block) var(--landing-cta-padding-inline);
        border: 1px solid var(--landing-cta-border);
        cursor: pointer;
        overflow: hidden;
        background: var(--landing-cta-bg);
        color: var(--landing-cta-text-color);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
        transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), background 0.22s ease, border-color 0.22s ease,
          box-shadow 0.22s ease;
      }

      .landing-button__content {
        width: min(90%, var(--landing-cta-text-max));
        max-width: var(--landing-cta-text-max);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0;
        row-gap: 0;
        align-self: center;
        text-align: center;
        pointer-events: none;
      }

      .landing-button__icon-region {
        position: absolute;
        left: 50%;
        top: var(--landing-cta-icon-top);
        width: var(--landing-cta-icon-width);
        height: var(--landing-cta-icon-height);
        display: grid;
        place-items: center;
        margin: 0;
        padding: 0;
        line-height: normal;
        transform: translate(-50%, -50%) translateY(calc(var(--landing-cta-stack-shift) + var(--landing-cta-stack-lower)));
        z-index: 1;
        pointer-events: none;
      }

      .landing-button__chip {
        position: relative;
        display: grid;
        place-items: center;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        line-height: normal;
        transform: translateY(var(--icon-nudge-y));
        transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), filter 220ms ease;
        will-change: transform;
      }

      .landing-button__icon {
        width: 100%;
        height: 100%;
        display: block;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        object-fit: contain;
      }

      .landing-button__text {
        position: relative;
        z-index: 2;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--landing-cta-text-gap);
        width: 100%;
        margin: 0;
        margin-top: calc(-1 * var(--landing-cta-title-overlap));
        padding: 0;
        line-height: normal;
        opacity: 0;
        transform: translateY(
          calc(
            var(--landing-cta-text-shift) - var(--landing-cta-title-overlap) + var(--landing-cta-stack-shift) +
              var(--landing-cta-stack-lower) + var(--landing-cta-text-drop)
          )
        );
        filter: blur(6px);
        pointer-events: none;
        text-align: center;
        text-shadow: 0 2px 10px rgba(5, 10, 22, 0.35);
        transition: opacity 180ms ease, transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), filter 220ms ease;
        will-change: transform, opacity;
      }

      .landing-button__title {
        font-weight: 600;
        font-size: var(--landing-cta-title-size);
        letter-spacing: 0.015em;
        line-height: 1.02;
        margin: 0;
      }

      .landing-button__subtitle {
        font-size: var(--landing-cta-subtitle-size);
        color: var(--landing-cta-subtitle-color);
        line-height: 1.08;
        font-weight: 500;
        margin: 0;
      }

      .landing-button h1,
      .landing-button h2,
      .landing-button h3,
      .landing-button p {
        margin-block-start: 0;
        margin-block-end: 0;
      }

      .landing-button:focus-visible,
      .landing-button:hover {
        border-color: var(--landing-cta-hover-border);
        transform: translateY(-2px) scale(1.01);
        background: var(--landing-cta-hover-bg);
        box-shadow: var(--landing-cta-shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
      }

      .landing-button:focus-visible {
        outline: 2px solid rgba(140, 225, 231, 0.8);
        outline-offset: 3px;
      }

      .landing-button:focus-visible .landing-button__chip,
      .landing-button:hover .landing-button__chip {
        transform: translateY(calc(var(--icon-nudge-y) - var(--landing-cta-chip-lift)));
        filter: drop-shadow(0 12px 24px rgba(3, 10, 24, 0.35));
      }

      .landing-button:focus-visible .landing-button__text,
      .landing-button:hover .landing-button__text {
        opacity: 1;
        transform: translateY(
          calc(
            var(--landing-cta-text-shift) - var(--landing-cta-title-overlap) - var(--landing-cta-chip-lift) +
              var(--landing-cta-stack-shift) + var(--landing-cta-stack-lower) + var(--landing-cta-text-drop) +
              var(--landing-cta-text-hover-nudge, 0px)
          )
        );
        filter: blur(0);
      }

      .landing-button.student {
        --landing-cta-bg: var(--landing-cta-primary-bg);
        --landing-cta-border: var(--landing-cta-primary-border);
        --landing-cta-hover-bg: var(--landing-cta-primary-hover-bg);
        --landing-cta-hover-border: var(--landing-cta-primary-hover-border);
      }

      .landing-button.faculty {
        --landing-cta-bg: var(--landing-cta-secondary-bg);
        --landing-cta-border: var(--landing-cta-secondary-border);
        --landing-cta-hover-bg: var(--landing-cta-secondary-hover-bg);
        --landing-cta-hover-border: var(--landing-cta-secondary-hover-border);
      }

      .landing-button.faculty .landing-button__text {
        transition: opacity 180ms ease, transform 150ms ease, filter 220ms ease;
      }

      @media (hover: hover) and (pointer: fine) {
        .landing-button.faculty:hover {
          --landing-cta-text-hover-nudge: 8px;
        }
      }

      @media (min-width: 1024px) {
        .landing-content {
          max-width: 720px;
        }

        .landing-actions {
          grid-template-columns: repeat(2, minmax(var(--landing-cta-min), var(--landing-cta-max)));
          justify-content: center;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        .landing-button,
        .landing-button__content,
        .landing-button__chip,
        .landing-button__icon,
        .landing-button__text {
          transition-duration: 0.01ms;
          transition-delay: 0ms;
        }
        .landing-button:focus-visible,
        .landing-button:hover {
          transform: none;
        }
        .landing-button__chip,
        .landing-button:focus-visible .landing-button__chip,
        .landing-button:hover .landing-button__chip {
          transform: translateY(var(--icon-nudge-y));
          filter: none;
        }
        .landing-button:focus-visible .landing-button__text,
        .landing-button:hover .landing-button__text,
        .landing-button__text {
          transform: translateY(
            calc(
              var(--landing-cta-text-shift) - var(--landing-cta-title-overlap) + var(--landing-cta-stack-shift) +
                var(--landing-cta-stack-lower) + var(--landing-cta-text-drop)
            )
          );
          filter: none;
        }
      }

      @media (max-width: 900px) {
        .landing-card {
          grid-template-columns: 1fr;
          text-align: center;
          padding: 40px 30px;
          gap: 28px;
        }

        .landing-content {
          align-items: center;
        }

        .landing-actions {
          width: 100%;
          justify-content: center;
        }

        .landing-mascot {
          width: min(300px, 70vw);
        }
      }

      .hover-swap-robot {
        --robot-static-x: 0px;
        --robot-static-y: 0px;
        --robot-static-scale: 1;
        --robot-anim-x: 0px;
        --robot-anim-y: 0px;
        --robot-anim-scale: 1;
        --robot-anim-mask: radial-gradient(ellipse at 50% 70%, #000 0%, #000 74%, transparent 100%);
        position: relative;
        width: 100%;
        height: 100%;
        display: block;
      }

      .landing-mascot .hover-swap-robot {
        --robot-anim-x: 0.3%;
        --robot-anim-y: 28%;
        --robot-anim-scale: 1.28;
        --robot-anim-mask: radial-gradient(
          ellipse at 50% 78%,
          #000 0%,
          #000 68%,
          rgba(0, 0, 0, 0.5) 82%,
          transparent 100%
        );
      }

      .hover-swap-robot__frame {
        position: relative;
        width: 100%;
        height: 100%;
        aspect-ratio: 1 / 1;
        overflow: hidden;
      }

      .hover-swap-robot__layer {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        display: block;
        object-fit: contain;
        object-position: center bottom;
        transition: opacity 0.2s ease;
        transform: translate(var(--robot-layer-x, 0px), var(--robot-layer-y, 0px))
          scale(var(--robot-layer-scale, 1));
        transform-origin: center bottom;
        will-change: opacity, transform;
        pointer-events: none;
      }

      .hover-swap-robot__layer--static {
        --robot-layer-x: var(--robot-static-x);
        --robot-layer-y: var(--robot-static-y);
        --robot-layer-scale: var(--robot-static-scale);
      }

      .hover-swap-robot__layer--animated {
        --robot-layer-x: var(--robot-anim-x);
        --robot-layer-y: var(--robot-anim-y);
        --robot-layer-scale: var(--robot-anim-scale);
        -webkit-mask-image: var(--robot-anim-mask);
        mask-image: var(--robot-anim-mask);
        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;
        -webkit-mask-size: 100% 100%;
        mask-size: 100% 100%;
        -webkit-mask-position: center;
        mask-position: center;
      }

      .hover-swap-robot__layer.is-hidden {
        opacity: 0;
      }

      .student-shell {
        min-height: 100vh;
        height: 100vh;
        display: grid;
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
        gap: 20px;
        padding: 24px;
        transition: grid-template-columns 0.2s ease, gap 0.2s ease;
        position: relative;
      }

      @supports (height: 100dvh) {
        .student-shell {
          min-height: 100dvh;
          height: 100dvh;
        }
      }

      .student-shell > * {
        min-height: 0;
      }

      .student-sidebar {
        display: flex;
        flex-direction: column;
        gap: 12px;
        min-height: 0;
      }

      .student-theme-toggle {
        position: static;
        z-index: 3;
      }

      .sidebar-scroll-region {
        display: flex;
        flex-direction: column;
        gap: 16px;
        min-height: 0;
        overflow-y: auto;
        flex: 1;
      }

      body.sidebar-collapsed .student-shell {
        grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
        gap: 16px;
      }

      .brand-card {
        padding: 18px 18px 16px;
        background: var(--bg-surface-alt);
      }

      .brand-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
      }

      .brand-wordmark {
        font-family: var(--font-display);
        font-size: 26px;
        letter-spacing: 0.16em;
      }

      .brand-subtitle {
        font-size: 12px;
        margin-top: 6px;
        color: var(--text-secondary);
      }

      .brand-powered {
        font-size: 11px;
        margin-top: 4px;
        color: var(--text-soft);
      }

      .sidebar-toggle {
        width: 40px;
        height: 40px;
      }

      .sidebar-rail {
        display: none;
        flex-direction: column;
        align-items: center;
        gap: 14px;
        padding: 4px 0 8px;
      }

      .sidebar-bubble {
        width: 52px;
        height: 52px;
        border-radius: 16px;
        border: 1px solid var(--border);
        background: var(--bg-surface-alt);
        box-shadow: var(--shadow-soft);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 22px;
        cursor: pointer;
        transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
      }

      .sidebar-bubble:hover {
        border-color: var(--border-strong);
        background: var(--primary-soft);
        transform: translateY(-1px);
      }

      .sidebar-expanded {
        display: flex;
        flex-direction: column;
        gap: 16px;
      }

      .student-sidebar.is-collapsed .sidebar-expanded {
        display: none;
      }

      .student-sidebar.is-collapsed .sidebar-rail {
        display: flex;
      }

      .student-sidebar.is-collapsed .brand-card {
        padding: 12px;
        text-align: center;
      }

      .student-sidebar.is-collapsed .brand-row {
        justify-content: center;
      }

      .student-sidebar.is-collapsed .brand-wordmark,
      .student-sidebar.is-collapsed .brand-subtitle,
      .student-sidebar.is-collapsed .brand-powered {
        display: none;
      }

      .sidebar-card {
        padding: 16px;
        background: var(--bg-surface-alt);
      }

      .sidebar-card .card-header {
        margin-bottom: 12px;
      }

      .sidebar-card .card-title {
        font-weight: 700;
        font-size: 15px;
        display: flex;
        align-items: center;
        gap: 10px;
      }

      .sidebar-emoji {
        font-size: 18px;
      }

      .library-advanced-toggle {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-radius: 12px;
        border: 1px solid var(--border);
        padding: 8px 10px;
        font-weight: 600;
        background: var(--bg-soft);
        cursor: pointer;
      }

      .library-advanced-body {
        margin-top: 10px;
        display: none;
        flex-direction: column;
        gap: 10px;
      }

      .library-advanced-body.is-open {
        display: flex;
      }

      .sidebar-input,
      .sidebar-select {
        width: 100%;
        border-radius: 12px;
        border: 1px solid var(--border);
        background: var(--surface-input);
        padding: 10px 12px;
        font-size: 14px;
        color: var(--text);
      }

      .sidebar-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
      }

      .sidebar-actions .btn {
        width: 100%;
      }

      .sidebar-inline-actions {
        display: flex;
        gap: 8px;
      }

      .sidebar-inline-actions .btn {
        flex: 1;
      }

      .machine-txt-row {
        align-items: center;
        min-width: 0;
      }

      .pipeline-actions .machine-txt-row .btn {
        flex: 0 0 auto;
        width: auto;
      }

      .machine-txt-name-wrap {
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
      }

      .machine-txt-pill {
        display: inline-block;
        max-width: 100%;
        padding: 6px 12px;
        border-radius: 999px;
        border: 1px solid var(--color-border);
        background: var(--owen-warm-white);
        color: var(--text-secondary);
        font-size: 12px;
        line-height: 1.4;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .sidebar-panel-body {
        display: flex;
        flex-direction: column;
        gap: 12px;
      }

      .retrieve-result {
        display: flex;
        flex-direction: column;
        gap: 8px;
        font-size: 12px;
        color: var(--text-soft);
      }

      .retrieve-title {
        font-size: 13px;
        font-weight: 600;
        color: var(--text);
      }

      .retrieve-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
      }

      .retrieve-actions .btn {
        width: auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }

      .sidebar-card .sidebar-panel-body {
        overflow: hidden;
        max-height: 2000px;
        opacity: 1;
        transition: max-height 250ms ease, opacity 200ms ease;
      }

      .panel-collapsed .sidebar-panel-body,
      .sidebar-card.is-collapsed .sidebar-panel-body {
        max-height: 0;
        opacity: 0;
        pointer-events: none;
      }

      .sidebar-card.is-collapsed .chevron {
        transform: rotate(-45deg);
      }

      @media (prefers-reduced-motion: reduce) {
        .sidebar-card .sidebar-panel-body {
          transition: none;
        }
      }

      #historyPanel {
        --conv-row-h: 76px;
        --conv-row-gap: 10px;
        --conv-list-max-h: calc(var(--conv-row-h) * 5 + var(--conv-row-gap) * 4);
        display: flex;
        flex-direction: column;
      }

      #historyList {
        min-height: 0;
      }

      .conversation-list-scroll {
        max-height: var(--conv-list-max-h);
        overflow-y: auto;
        padding: 0 6px 0 2px;
        scrollbar-gutter: stable;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        border-radius: 12px;
      }

      .conversation-list-scroll:focus-visible {
        outline: 2px solid var(--focus-ring);
        outline-offset: 2px;
        box-shadow: var(--shadow-focus);
      }

      .library-advanced-toggle .chevron {
        margin-left: auto;
      }

      .library-advanced-toggle.is-open .chevron {
        transform: rotate(45deg);
      }

      .conversation-search {
        width: 100%;
        border-radius: 12px;
        border: 1px solid var(--border);
        background: var(--surface-input);
        padding: 8px 12px;
        font-size: 13px;
        color: var(--text);
      }

      .saved-list {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: var(--conv-row-gap);
      }

      .saved-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 10px 12px;
        height: var(--conv-row-h);
        min-height: var(--conv-row-h);
        border-radius: 12px;
        border: 1px solid transparent;
        background: var(--bg-surface);
      }

      body.theme-dark .saved-item {
        background: rgba(20, 32, 36, 0.7);
      }

      .saved-item.active {
        border-color: var(--border-strong);
        background: rgba(46, 111, 114, 0.12);
      }

      .saved-item-main {
        display: flex;
        flex-direction: column;
        gap: 4px;
        text-align: left;
        flex: 1;
        min-width: 0;
        padding: 0;
        background: transparent;
        border: none;
        cursor: pointer;
        justify-content: center;
      }

      .saved-item-main:focus-visible {
        outline: none;
        box-shadow: var(--shadow-focus);
        border-radius: 10px;
      }

      .saved-item-title {
        font-weight: 600;
        font-size: 14px;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        min-height: calc(2 * 1.3em);
        max-height: calc(2 * 1.3em);
      }

      .saved-item-meta {
        font-size: 12px;
        color: var(--text-soft);
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .saved-item-actions {
        display: flex;
        align-items: center;
        gap: 6px;
      }

      .menu-trigger {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        border: 1px solid var(--border);
        background: transparent;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        font-weight: 700;
        line-height: 1;
        color: var(--text-soft);
      }

      .menu-trigger:hover,
      .menu-trigger[aria-expanded="true"] {
        border-color: var(--border-strong);
        background: var(--primary-soft);
        color: var(--text);
      }

      .menu-popover {
        position: absolute;
        right: 0;
        top: 40px;
        min-width: 160px;
        background: var(--bg-soft);
        border: 1px solid var(--border-strong);
        border-radius: 12px;
        box-shadow: var(--shadow-soft);
        padding: 6px;
        display: none;
        z-index: 20;
      }

      .menu-popover.is-open {
        display: block;
      }

      .menu-popover[data-floating="true"] {
        position: fixed;
        top: auto;
        right: auto;
        z-index: 2400;
      }

      .menu-item {
        width: 100%;
        text-align: left;
        padding: 8px 10px;
        border-radius: 10px;
        font-size: 13px;
        cursor: pointer;
        border: none;
        background: transparent;
        color: inherit;
        display: flex;
        align-items: center;
        gap: 8px;
      }

      .menu-item:hover {
        background: var(--surface-mint-hover);
      }

      .menu-item--danger {
        color: var(--color-danger);
      }

      .menu-item--danger:hover {
        background: color-mix(in srgb, var(--color-danger) 12%, var(--color-surface));
        color: var(--color-danger);
      }

      .chat-column,
      .chat-pane {
        display: flex;
        flex-direction: column;
        min-height: 0;
        height: 100%;
        overflow: hidden;
        position: relative;
        gap: 12px;
      }

      .chat-scroll-area {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
      }

      .chat-composer {
        flex: 0 0 auto;
        position: sticky;
        bottom: 0;
        z-index: 6;
        backdrop-filter: blur(8px);
      }

      .workspace-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 6px 6px 0;
      }

      .workspace-title {
        font-weight: 600;
        font-size: 18px;
      }

      .workspace-header__left,
      .workspace-header__actions {
        display: inline-flex;
        align-items: center;
        gap: 10px;
      }

      .workspace-header__left {
        min-width: 0;
      }

      .workspace-header__title {
        font-weight: 600;
        font-size: 16px;
        white-space: nowrap;
      }

      .workspace-tools-btn {
        padding: 8px 12px;
        font-size: 13px;
      }

      #sidebarDrawerToggle,
      #toolsToggle {
        display: none;
      }

      .chat-log {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding: 16px;
        padding-bottom: calc(var(--composer-height) + 24px);
        scroll-padding-bottom: calc(var(--composer-height) + 24px);
        border-radius: var(--radius-lg);
        border: 1px solid var(--color-border);
        background: var(--owen-warm-white);
        box-shadow: var(--shadow-soft);
        scrollbar-color: #ffffff rgba(0, 0, 0, 0.15);
      }

      .chat-log::-webkit-scrollbar {
        width: 8px;
        height: 8px;
        background: transparent;
      }

      .chat-log::-webkit-scrollbar-track {
        background: transparent;
        border-radius: 999px;
      }

      .chat-log::-webkit-scrollbar-thumb {
        background: transparent;
        background-color: #ffffff !important;
        background-image: none;
        box-shadow: none;
        border-radius: 999px;
        border: 2px solid var(--scrollbar-thumb-border);
        background-clip: padding-box;
      }

      .chat-log::-webkit-scrollbar-thumb:hover {
        background: transparent;
        background-color: #ffffff !important;
        background-image: none;
        box-shadow: none;
        border: 2px solid var(--scrollbar-thumb-border-hover);
      }

      .chat-log::-webkit-scrollbar-thumb:active {
        background: transparent;
        background-color: #ffffff !important;
        background-image: none;
        box-shadow: none;
        border: 2px solid var(--scrollbar-thumb-border-active);
      }

      .chat-log::-webkit-scrollbar-corner,
      .conversation-list-scroll::-webkit-scrollbar-corner,
      .sidebar-scroll-region::-webkit-scrollbar-corner,
      .sources-drawer__list::-webkit-scrollbar-corner,
      .owen-table-scroll::-webkit-scrollbar-corner,
      .owen-pretty-table__wrap::-webkit-scrollbar-corner {
        background: transparent;
      }

      body:not(.theme-dark) .chat-log {
        box-shadow: var(--shadow-card);
      }

      .chat-log[data-empty="true"]::before {
        content: "No messages yet. Ask OWEN something to get started.";
        display: block;
        color: var(--text-soft);
        font-size: 14px;
        padding: 8px 6px;
      }

      .bubble {
        max-width: min(80%, var(--chat-max-width));
        padding: 14px 16px;
        border-radius: 18px;
        margin-bottom: 16px;
        line-height: 1.6;
        position: relative;
      }

      .bubble-text {
        white-space: pre-wrap;
      }

      .bubble-actions {
        display: flex;
        gap: 8px;
        margin-top: 10px;
        align-items: center;
      }

      .response-mode-badge {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        margin-top: 10px;
        padding: 4px 10px;
        border-radius: 999px;
        border: 1px solid rgba(46, 111, 114, 0.25);
        background: rgba(46, 111, 114, 0.12);
        color: var(--text-soft);
        font-size: 11px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
      }

      .bubble.assistant.has-response .response-mode-badge {
        margin-left: 12px;
      }

      .bubble.assistant.has-response {
        background: transparent;
        border: none;
        padding: 0;
        max-width: min(100%, var(--chat-max-width));
        width: 100%;
      }

      .bubble.assistant.has-response .response-card {
        background: var(--owen-warm-white);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        padding: 16px clamp(16px, 4vw, 48px);
        box-shadow: none;
      }

      body:not(.theme-dark) .bubble.assistant.has-response .response-card {
        box-shadow: none;
      }

      .bubble.error {
        border-color: rgba(197, 90, 90, 0.4);
        background: rgba(197, 90, 90, 0.12);
        color: #7e2e2e;
      }

      body.theme-dark .bubble.error {
        color: #f2b0b0;
      }

      .bubble-status {
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 6px 0 10px;
        color: var(--text-soft);
        font-size: 12px;
        width: 100%;
      }

      .bubble-status-text {
        flex: 1;
      }

      .interrupt-btn {
        margin-left: auto;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 12px;
        border-radius: 999px;
        border: 1px solid var(--response-pill-border);
        background: var(--response-pill-bg);
        color: var(--response-pill-text);
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.02em;
        line-height: 1;
        min-height: 40px;
        min-width: 40px;
        flex-shrink: 0;
        box-shadow: var(--response-pill-shadow);
        cursor: pointer;
        transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
      }

      .interrupt-btn svg {
        display: block;
      }

      .interrupt-btn:hover {
        background: var(--response-pill-bg-hover);
      }

      .interrupt-btn:active {
        background: var(--response-pill-bg-active);
        border-color: var(--response-pill-border-active);
        transform: translateY(1px);
      }

      .thinking-text-strong {
        font-weight: 600;
        letter-spacing: 0.04em;
      }

      .loading-bar {
        width: 160px;
        height: 6px;
        border-radius: 999px;
        background: rgba(46, 111, 114, 0.15);
        overflow: hidden;
      }

      .loading-bar__fill {
        width: 60%;
        height: 100%;
        background: var(--primary);
        animation: loading-bar 1.2s ease-in-out infinite;
      }

      @keyframes loading-bar {
        0% { transform: translateX(-100%); }
        50% { transform: translateX(0); }
        100% { transform: translateX(100%); }
      }

      .bubble-attachments {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 10px;
      }

      .bubble-attachment {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 10px;
        border-radius: 999px;
        background: var(--bg-soft);
        border: 1px solid var(--border);
        color: inherit;
        font-size: 12px;
        text-decoration: none;
        max-width: 100%;
      }

      .bubble-attachment-thumb {
        width: 38px;
        height: 38px;
        object-fit: cover;
        border-radius: 10px;
        border: 1px solid var(--border);
      }

      .bubble-attachment-label {
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        max-width: 220px;
        display: inline-block;
      }

      .bubble-attachment.image-only {
        padding: 0;
        border: none;
        background: transparent;
      }

      .bubble-attachment.image-only .bubble-attachment-label {
        display: none;
      }

      .bubble-image {
        margin: 12px 0 0 0;
      }

      .bubble-image img {
        width: 100%;
        max-height: 420px;
        border-radius: 16px;
        border: 1px solid var(--border);
        object-fit: contain;
      }

      .response-card {
        display: flex;
        flex-direction: column;
        gap: 12px;
      }

      .response-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
      }

      .response-toolbar-row {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 16px;
        flex-wrap: wrap;
        width: 100%;
      }

      .response-highlight-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        font-size: 12px;
        color: var(--text-soft);
      }

      .response-toggle-row {
        align-self: flex-start;
      }

      .toggle-switch {
        width: 36px;
        height: 20px;
        border-radius: 999px;
        background: rgba(46, 111, 114, 0.2);
        border: 1px solid var(--border-strong);
        position: relative;
        transition: background 0.16s ease;
        cursor: pointer;
      }

      .toggle-switch::after {
        content: "";
        position: absolute;
        top: 2px;
        left: 2px;
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: var(--bg-surface-hover);
        transition: transform 0.16s ease;
      }

      .toggle-switch.is-on {
        background: var(--primary);
      }

      .toggle-switch.is-on::after {
        transform: translateX(16px);
      }

      .response-sources {
        font-size: 12px;
        color: var(--text-secondary);
        border: 1px solid var(--border);
        border-radius: 999px;
        padding: 4px 8px;
        cursor: pointer;
        background: var(--bg-soft);
        transition: background 0.16s ease, border-color 0.16s ease;
      }

      .response-sources:hover {
        border-color: var(--border-strong);
        background: var(--primary-soft);
      }

      .response-sources:disabled {
        opacity: 0.6;
        cursor: not-allowed;
      }

      .response-toolbar {
        display: flex;
        align-items: center;
        gap: 8px;
      }

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

      .response-action {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        border: 1px solid var(--border);
        background: var(--bg-soft);
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
      }

      .response-action:hover {
        background: var(--primary-soft);
        border-color: var(--border-strong);
      }

      .response-action[aria-disabled="true"] {
        opacity: 0.5;
        cursor: not-allowed;
      }

      .response-action.is-active,
      .response-action[aria-pressed="true"] {
        background: var(--primary-soft);
        border-color: var(--border-strong);
        color: var(--primary-dark);
      }

      .response-action[data-copied="true"] {
        background: var(--primary);
        border-color: var(--primary);
        color: #f7fbfc;
      }

      .response-collapse-toggle {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        border: 1px solid var(--border);
        background: var(--bg-soft);
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }

      .response-collapse-toggle:hover {
        background: var(--primary-soft);
        border-color: var(--border-strong);
      }

      .response-card[data-collapsed="true"] .response-body {
        display: none;
      }

      .response-card[data-view-mode="summary"] .response-content {
        display: none;
      }

      .response-card[data-view-mode="full"] .response-summary {
        display: none;
      }

      .response-body {
        display: flex;
        flex-direction: column;
        gap: 12px;
      }

      .response-content {
        font-size: 14px;
        line-height: 1.7;
      }

      .response-content p {
        margin: 0 0 10px 0;
      }

      .response-content ul,
      .response-content ol {
        margin: 0 0 12px 18px;
        padding: 0;
      }

      .response-summary {
        border-radius: 14px;
        border: 1px solid var(--border);
        background: var(--bg-soft);
        padding: 12px 14px;
        display: flex;
        flex-direction: column;
        gap: 8px;
      }

      .response-summary-header {
        font-weight: 700;
        font-size: 13px;
        text-transform: uppercase;
        letter-spacing: 0.12em;
        color: var(--text-soft);
      }

      .response-summary-heading {
        font-weight: 600;
        margin-bottom: 4px;
      }

      .response-summary-lead p {
        margin: 0;
        font-size: 13px;
        color: var(--text-secondary);
      }

      .response-summary-list {
        margin: 0;
        padding-left: 18px;
        display: grid;
        gap: 6px;
        font-size: 13px;
        color: var(--text-secondary);
      }

      .response-summary-note,
      .response-summary-fallback {
        font-size: 12px;
        color: var(--text-soft);
      }

      .answer-pre {
        white-space: pre-wrap;
        font-family: var(--font-mono);
        font-size: 13px;
        line-height: 1.5;
        padding: 12px;
        border-radius: 12px;
        background: var(--bg-soft);
        border: 1px solid var(--border);
      }

      .response-card[data-highlight="on"] .response-content strong,
      .response-card[data-highlight="on"] .response-summary strong {
        background: var(--term-highlight-bg);
        box-shadow: 0 0 0 2px var(--term-highlight-border);
        border-radius: 6px;
        box-decoration-break: clone;
        -webkit-box-decoration-break: clone;
        transition: background 0.16s ease, box-shadow 0.16s ease;
      }

      .composer-card {
        margin-top: 0;
        padding: 16px;
        padding-bottom: calc(16px + var(--safe-bottom));
        border-radius: var(--radius-lg);
        border: 1px solid var(--color-border);
        background: var(--owen-warm-white);
        box-shadow: var(--shadow-soft);
        display: flex;
        flex-direction: column;
        gap: 10px;
      }

      .composer-label {
        font-size: 12px;
        color: var(--text-soft);
        letter-spacing: 0.12em;
        text-transform: uppercase;
      }

      .composer-attachments {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
      }

      .composer-attachments:empty {
        display: none;
      }

      .attachment-chip {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 10px;
        border-radius: 999px;
        background: rgba(46, 111, 114, 0.12);
        border: 1px solid rgba(46, 111, 114, 0.25);
        font-size: 12px;
      }

      .attachment-chip-thumb {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        background-size: cover;
        background-position: center;
        border: 1px solid var(--border);
      }

      .attachment-chip-text {
        max-width: 180px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .attachment-chip button {
        border: none;
        background: transparent;
        cursor: pointer;
        font-size: 12px;
      }

      .attachment-chip.loading {
        gap: 10px;
      }

      .attachment-chip.error {
        background: rgba(177, 54, 54, 0.12);
        border-color: rgba(177, 54, 54, 0.28);
      }

      .loading-track {
        position: relative;
        width: 80px;
        height: 6px;
        border-radius: 999px;
        background: rgba(46, 111, 114, 0.18);
        overflow: hidden;
      }

      .loading-track::after {
        content: "";
        position: absolute;
        inset: 0;
        background: var(--primary);
        animation: loading-bar 1.2s ease-in-out infinite;
      }

      .composer-row {
        display: flex;
        align-items: center;
        gap: 12px;
      }

      .composer-mode {
        display: inline-flex;
        flex-direction: column;
        gap: 4px;
        min-width: 120px;
      }

      .composer-mode-label {
        font-size: 11px;
        color: var(--text-soft);
        letter-spacing: 0.08em;
        text-transform: uppercase;
      }

      .composer-mode-select {
        height: 42px;
        border-radius: 12px;
        border: 1px solid var(--color-border);
        background: var(--owen-warm-white);
        padding: 0 12px;
        font-size: 13px;
        color: var(--text);
      }

      .composer-mode-select option {
        background: var(--owen-warm-white);
        color: var(--text-heading);
      }

      .composer-field {
        position: relative;
        flex: 1;
      }

      .composer-field textarea {
        width: 100%;
        min-height: 56px;
        border-radius: 18px;
        border: 1px solid var(--color-border);
        background: var(--owen-warm-white);
        padding: 14px 16px 14px 52px;
        font-size: 14px;
        resize: vertical;
        color: var(--text);
      }

      .composer-field textarea:disabled {
        background: var(--card-strong);
        color: var(--text-muted);
        cursor: not-allowed;
      }

      .composer-attach-btn {
        position: absolute;
        left: 12px;
        top: 12px;
        width: 32px;
        height: 32px;
        border-radius: 8px;
        border: 1px solid var(--color-border);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: var(--owen-warm-white);
        cursor: pointer;
      }

      .composer-attach-btn[hidden] {
        display: none !important;
      }

      .chat-composer:not(.attachments-enabled) .chat-input {
        padding-left: 16px;
      }

      .composer-send {
        min-width: 88px;
        height: 42px;
        padding: 0 16px;
        font-size: 14px;
        line-height: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }

      .chat-actions button:not(.btn-primary) {
        background: var(--owen-warm-white);
        border: 1px solid var(--color-border);
      }

      .sources-overlay {
        position: fixed;
        inset: 0;
        background: rgba(6, 10, 18, 0.35);
        backdrop-filter: blur(2px);
        z-index: 40;
      }

      .tools-overlay {
        position: fixed;
        inset: 0;
        background: rgba(6, 10, 18, 0.35);
        backdrop-filter: blur(2px);
        z-index: 35;
      }

      .sources-drawer {
        position: fixed;
        right: 0;
        top: 0;
        height: 100vh;
        width: min(400px, 90vw);
        background: var(--bg-soft);
        border-left: 1px solid var(--border);
        box-shadow: var(--shadow-card);
        transform: translateX(100%);
        transition: transform 0.2s ease;
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 16px;
        z-index: 50;
      }

      .sources-drawer.is-open {
        transform: translateX(0);
      }

      .sources-drawer__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
      }

      .sources-drawer__title {
        font-weight: 700;
      }

      .sources-drawer__list {
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 12px;
      }

      .sources-drawer__search {
        display: flex;
      }

      body.quiz-open {
        overflow: hidden;
      }

      body.student-login-open {
        overflow: hidden;
      }

      .student-login-overlay {
        position: fixed;
        inset: 0;
        background: rgba(6, 10, 18, 0.45);
        backdrop-filter: blur(2px);
        z-index: 65;
      }

      .student-login-modal {
        position: fixed;
        inset: 50% auto auto 50%;
        transform: translate(-50%, -50%);
        width: min(420px, 92vw);
        max-height: 90vh;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        box-shadow: var(--shadow-card);
        border-radius: 20px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 20px 22px 22px;
        z-index: 70;
      }

      .student-login-title {
        margin: 0;
        font-size: 20px;
      }

      .student-login-subtitle {
        margin: 0;
        font-size: 14px;
        color: var(--text-secondary);
      }

      .student-login-form {
        display: flex;
        flex-direction: column;
        gap: 12px;
      }

      .student-login-form .btn {
        width: 100%;
      }

      .quiz-overlay {
        position: fixed;
        inset: 0;
        background: rgba(6, 10, 18, 0.45);
        backdrop-filter: blur(2px);
        z-index: 55;
      }

      .quiz-modal {
        position: fixed;
        inset: 50% auto auto 50%;
        transform: translate(-50%, -50%);
        width: min(880px, 94vw);
        max-height: 90vh;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        box-shadow: var(--shadow-card);
        border-radius: 20px;
        display: flex;
        flex-direction: column;
        z-index: 60;
      }

      body.library-modal-open {
        overflow: hidden;
      }

      .library-modal-overlay {
        position: fixed;
        inset: 0;
        background: rgba(6, 10, 18, 0.4);
        backdrop-filter: blur(2px);
        z-index: 72;
      }

      .library-modal__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
      }

      .library-modal__title {
        margin: 0;
        font-size: var(--text-xl);
        color: var(--text-heading);
        letter-spacing: -0.02em;
      }

      .library-modal__body {
        display: flex;
        flex-direction: column;
        gap: 12px;
        overflow: auto;
      }

      .library-modal__section {
        display: flex;
        flex-direction: column;
        gap: 8px;
      }

      .library-modal__label {
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--text-soft);
      }

      .library-modal__meta {
        font-size: 13px;
        color: var(--text-secondary);
      }

      .library-modal__footer {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
      }

      .quiz-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 16px 20px;
        border-bottom: 1px solid var(--border);
        background: var(--bg-surface-alt);
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
      }

      .quiz-title {
        font-size: 16px;
        font-weight: 700;
      }

      .quiz-subtitle {
        font-size: 12px;
        color: var(--text-soft);
      }

      .quiz-body {
        padding: 16px 20px 22px;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 16px;
      }

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

      .quiz-interrupt {
        display: inline-flex;
        align-items: center;
        gap: 6px;
      }

      .quiz-error {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 12px;
        border-radius: 12px;
        border: 1px solid rgba(180, 35, 24, 0.4);
        background: rgba(180, 35, 24, 0.08);
        color: #b42318;
        font-size: 12px;
      }

      body.theme-dark .quiz-error {
        background: rgba(180, 35, 24, 0.18);
      }

      .quiz-warning {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 12px;
        border-radius: 12px;
        border: 1px solid rgba(180, 120, 24, 0.4);
        background: rgba(180, 120, 24, 0.08);
        color: #b45309;
        font-size: 12px;
      }

      body.theme-dark .quiz-warning {
        background: rgba(180, 120, 24, 0.18);
      }

      .quiz-sets {
        display: flex;
        flex-direction: column;
        gap: 16px;
      }

      .quiz-set {
        border-radius: 16px;
        border: 1px solid var(--border);
        background: var(--bg-surface-alt);
        padding: 16px;
        display: flex;
        flex-direction: column;
        gap: 14px;
      }

      .quiz-set-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 13px;
        font-weight: 600;
        color: var(--text-secondary);
      }

      .quiz-question {
        border-radius: 14px;
        border: 1px solid var(--border);
        background: var(--card);
        padding: 12px;
        display: flex;
        flex-direction: column;
        gap: 10px;
      }

      .quiz-question-title {
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--text-soft);
      }

      .quiz-question-stem {
        font-size: 14px;
        color: var(--text);
      }

      .quiz-options {
        display: flex;
        flex-direction: column;
        gap: 8px;
      }

      .quiz-option {
        width: 100%;
        text-align: left;
        display: grid;
        grid-template-columns: 18px 1fr;
        gap: 10px;
        align-items: flex-start;
        border-radius: 12px;
        border: 1px solid var(--border);
        background: var(--bg-surface);
        padding: 10px 12px;
        cursor: pointer;
        transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
      }

      .quiz-option:hover {
        border-color: var(--border-strong);
        background: var(--bg-surface-hover);
        transform: translateY(-1px);
      }

      .quiz-option:active {
        transform: translateY(0);
      }

      .quiz-option:disabled {
        cursor: not-allowed;
        opacity: 0.7;
        transform: none;
      }

      .quiz-option-bubble {
        width: 16px;
        height: 16px;
        border-radius: 50%;
        border: 2px solid var(--border-strong);
        margin-top: 3px;
        flex-shrink: 0;
      }

      .quiz-option.is-incorrect {
        border-color: rgba(180, 35, 24, 0.45);
        background: rgba(180, 35, 24, 0.08);
      }

      .quiz-option.is-incorrect .quiz-option-bubble {
        border-color: #b42318;
        background: #b42318;
      }

      .quiz-option.is-correct {
        border-color: rgba(46, 111, 114, 0.6);
        background: rgba(46, 111, 114, 0.12);
      }

      .quiz-option.is-correct .quiz-option-bubble {
        border-color: var(--primary);
        background: var(--primary);
      }

      .quiz-option-text {
        font-size: 13px;
        color: var(--text);
        line-height: 1.4;
      }

      .quiz-explanation {
        border-radius: 10px;
        border-left: 3px solid var(--primary);
        background: var(--bg-surface);
        padding: 8px 10px;
        font-size: 12px;
        color: var(--text-secondary);
        line-height: 1.5;
      }

      .quiz-references {
        font-size: 11px;
        color: var(--text-soft);
      }

      .quiz-set-results {
        display: flex;
        flex-direction: column;
        gap: 4px;
        font-size: 12px;
        color: var(--text-secondary);
        padding-top: 8px;
        border-top: 1px dashed var(--border);
      }

      .quiz-footer {
        display: flex;
        justify-content: flex-end;
      }

      .quiz-placeholder {
        margin-top: 16px;
        border: 1px dashed rgba(46, 111, 114, 0.28);
        border-radius: 14px;
        padding: 16px;
        text-align: center;
        font-size: 14px;
        color: var(--text-secondary);
        background: rgba(46, 111, 114, 0.05);
      }

      .quiz-content {
        display: flex;
        flex-direction: column;
        gap: 12px;
      }

      .quiz-score-summary {
        border-radius: 12px;
        border: 1px solid var(--color-border);
        background: var(--bg-surface-alt);
        padding: 10px 12px;
        font-size: 13px;
        color: var(--text-secondary);
        display: grid;
        gap: 4px;
      }

      .quiz-score-summary.is-final {
        border-color: rgba(46, 111, 114, 0.35);
        background: rgba(46, 111, 114, 0.08);
        color: var(--text);
      }

      .quiz-choice-btn {
        width: 100%;
        text-align: left;
        border-radius: 12px;
        border: 1px solid var(--color-border);
        background: var(--owen-warm-white);
        color: var(--text);
        font-size: 14px;
        padding: 10px 12px;
        cursor: pointer;
        transition: border-color 0.15s ease, background 0.15s ease;
      }

      .quiz-choice-btn:hover {
        border-color: var(--border-strong);
      }

      .quiz-choice-btn:disabled {
        cursor: default;
      }

      .quiz-choice-btn.is-correct {
        border-color: rgba(21, 128, 61, 0.5);
        background: rgba(21, 128, 61, 0.1);
      }

      .quiz-choice-btn.is-wrong {
        border-color: rgba(180, 35, 24, 0.45);
        background: rgba(180, 35, 24, 0.1);
      }

      .quiz-feedback {
        border-radius: 10px;
        border: 1px solid var(--color-border);
        background: var(--bg-surface);
        padding: 10px 12px;
        font-size: 13px;
        color: var(--text-secondary);
      }

      .quiz-feedback.correct {
        border-color: rgba(21, 128, 61, 0.4);
      }

      .quiz-feedback.incorrect {
        border-color: rgba(180, 35, 24, 0.38);
      }

      .quiz-card {
        box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
      }

      .quiz-vignette,
      .vignette {
        margin: 0;
        font-size: 14px;
        color: var(--text);
        line-height: 1.6;
      }

      .quiz-choices,
      .choices {
        display: flex;
        flex-direction: column;
        gap: 6px;
      }

      /* Chat->Quiz giftwrap: reuse 3.0 quiz button aesthetics on 2.6 renderer */
      .quiz-option.quiz-choice-btn {
        width: 100%;
        text-align: left;
        border-radius: 12px;
        border: 1px solid var(--color-border);
        background: var(--owen-warm-white);
        color: var(--text);
        font-size: 14px;
        padding: 10px 12px;
        cursor: pointer;
        transition: border-color 0.15s ease, background 0.15s ease;
        display: block;
      }

      .quiz-option.quiz-choice-btn:hover {
        border-color: var(--border-strong);
        transform: none;
      }

      .quiz-option-bubble {
        display: none !important;
      }

      .quiz-question.quiz-card {
        border-radius: 14px;
      }

      .quiz-question-stem.quiz-vignette {
        font-size: 14px;
        line-height: 1.55;
      }

      .quiz-options.quiz-choices {
        display: flex;
        flex-direction: column;
        gap: 8px;
      }

      /* Giftwrap stub bubble */
      .bubble.assistant.quiz-giftwrap-stub .bubble-text {
        font-weight: 600;
      }

      @media (max-width: 720px) {
        .quiz-modal {
          width: 94vw;
          max-height: 92vh;
        }

        .quiz-header,
        .quiz-body {
          padding: 14px 16px;
        }
      }

      .source-row {
        width: 100%;
        text-align: left;
        border-radius: 12px;
        border: 1px solid var(--border);
        padding: 10px 12px;
        background: var(--bg-surface);
        cursor: pointer;
        display: flex;
        gap: 10px;
        align-items: flex-start;
      }

      .source-row:focus-visible {
        outline: 2px solid var(--focus-ring);
        outline-offset: 2px;
        box-shadow: var(--shadow-focus);
      }

      .source-row:hover {
        border-color: var(--border-strong);
        background: rgba(46, 111, 114, 0.08);
      }

      body.theme-dark .source-row {
        background: rgba(17, 28, 32, 0.8);
      }

      .source-row.is-active {
        border-color: var(--border-strong);
        background: rgba(46, 111, 114, 0.12);
      }

      .source-title {
        font-weight: 600;
        font-size: 14px;
      }

      .source-meta {
        font-size: 12px;
        color: var(--text-soft);
        display: flex;
        align-items: center;
        gap: 6px;
      }

      .source-index {
        font-size: 12px;
        color: var(--text-soft);
        min-width: 32px;
      }

      .source-body {
        display: flex;
        flex-direction: column;
        gap: 6px;
        flex: 1;
      }

      .source-snippet {
        font-size: 12px;
        color: var(--text-secondary);
        line-height: 1.5;
      }

      .source-url {
        font-size: 11px;
        color: var(--text-soft);
        word-break: break-all;
      }

      .source-actions {
        margin-top: 4px;
        display: flex;
        gap: 8px;
        align-items: center;
      }

      .sources-link {
        font-size: 12px;
        color: var(--primary-dark);
        text-decoration: underline;
      }

      .sources-list {
        margin: 6px 0 0 18px;
        font-size: 12px;
        color: var(--text-secondary);
      }

      .sources-domain {
        font-size: 11px;
        color: var(--text-soft);
      }

      .source-favicon {
        width: 18px;
        height: 18px;
        border-radius: 6px;
        background: var(--primary-soft);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 11px;
        color: var(--primary-dark);
      }

      .sources-empty {
        font-size: 12px;
        color: var(--text-soft);
        padding: 6px 2px;
      }

      .sources-legacy-note {
        font-size: 12px;
        color: var(--text-secondary);
        background: var(--card);
        border: 1px dashed var(--border);
        padding: 8px 10px;
        border-radius: 10px;
        margin-bottom: 8px;
      }

      .sources-drawer__section {
        padding-top: 10px;
      }

      .sources-drawer__section--divider {
        border-top: 1px dashed var(--border);
      }

      .sources-drawer__section-title {
        font-size: 12px;
        color: var(--text-soft);
        margin-bottom: 6px;
      }

      .references-list {
        margin: 0;
        padding-left: 18px;
        font-size: 12px;
        color: var(--text-secondary);
      }

      body.sources-open {
        overflow: hidden;
      }

      .faculty-shell {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
      }

      .faculty-console-root {
        background: var(--color-bg);
      }

      .faculty-heading-icon { width: 56px; height: 56px; flex: 0 0 auto; }

      .pipeline-active__title-stack > .faculty-heading-icon { position: absolute; left: 0; top: 50%; transform: translateY(-50%); }

      .faculty-login-card > .faculty-heading-icon { width: 76px; height: 76px; }

      .faculty-tab-icon { width: 24px; height: 24px; flex: 0 0 auto; }

      .pipeline-card-header .faculty-heading-icon { width: 42px; height: 42px; }

      .faculty-title-stack {
        display: flex;
        flex-direction: row;
        gap: var(--space-4);
        align-items: center;
        min-width: 0;
      }

      .faculty-content {
        flex: 1;
        padding: 24px;
        display: flex;
        flex-direction: column;
        gap: 20px;
        --pipeline-grid-gap: 22px;
        --pipeline-card-padding: 20px;
        --pipeline-card-gap: 12px;
        --pipeline-card-header-gap: 12px;
        --pipeline-actions-gap: 10px;
      }

      .faculty-console-root .btn-ghost {
        background: var(--surface-pearl);
        border-color: var(--color-border);
      }

      .faculty-console-root .btn-ghost:hover {
        background: var(--surface-mint-hover);
        border-color: var(--border-mint-hover);
      }

      .faculty-console-root .icon-btn {
        background: var(--surface-pearl);
        border-color: var(--color-border);
      }

      .faculty-console-root .icon-btn:hover {
        background: var(--surface-mint-hover);
        border-color: var(--border-mint-hover);
      }

      .faculty-console-root input:not([type="checkbox"]):not([type="radio"]),
      .faculty-console-root textarea,
      .faculty-console-root select {
        background: var(--surface-pearl);
        border: 1px solid var(--color-border);
        color: var(--text-heading);
      }

      .faculty-login-card {
        width: min(480px, 100%);
        margin: 6vh auto;
        padding: var(--space-6);
        border-radius: var(--radius-xl);
        background: var(--surface-mint);
        border: 1px solid var(--border-mint);
        box-shadow: var(--shadow-inset), var(--shadow-mint);
        display: flex;
        flex-direction: column;
        gap: var(--space-4);
      }

      .faculty-login-card h2 {
        margin: 0;
        font-size: 22px;
        color: var(--text-heading);
        line-height: 1.25;
        letter-spacing: -0.025em;
      }

      .faculty-login-card p {
        margin: 0;
        color: var(--text-supporting);
        font-size: 14px;
        line-height: 1.65;
      }

      .faculty-login-card input {
        width: 100%;
        border-radius: var(--radius-md);
        border: 1px solid var(--color-border);
        background: var(--surface-pearl);
        padding: 12px 14px;
      }

      .pipeline-header {
        display: flex;
        flex-direction: column;
        gap: 6px;
      }

      .pipeline-title {
        font-size: 24px;
        font-weight: 700;
        line-height: 1.2;
      }

      .pipeline-subtitle {
        color: var(--text-secondary);
        font-size: 14px;
      }

      .tool-card {
        padding: var(--pipeline-card-padding);
        border-radius: var(--radius-lg);
        border: 1px solid var(--color-border);
        display: flex;
        flex-direction: column;
        gap: var(--pipeline-card-gap);
        min-width: 0;
        background: var(--surface-pearl);
        box-shadow: var(--shadow-inset), var(--shadow-sm);
        border-color: var(--color-border);
      }

      .pipeline-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: var(--pipeline-grid-gap);
        align-items: start;
        grid-template-areas:
          "upload"
          "indexocr"
          "txt"
          "guide"
          "anki"
          "library"
          "analytics";
      }
      .card-upload {
        grid-area: upload;
      }
      .card-indexocr {
        grid-area: indexocr;
      }
      .card-txt {
        grid-area: txt;
      }
      .card-guide {
        grid-area: guide;
        align-self: stretch;
        min-height: 0;
      }
      .card-anki {
        grid-area: anki;
        align-self: stretch;
        min-height: 0;
      }
      .card-library {
        grid-area: library;
        align-self: stretch;
        min-height: 0;
      }
      .card-analytics {
        grid-area: analytics;
      }
      .pipeline-top-grid {
        display: contents;
      }
      .pipeline-column--right {
        display: contents;
      }

      .pipeline-card-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: var(--pipeline-card-header-gap);
        flex-wrap: wrap;
        min-width: 0;
      }

      .pipeline-card-header .pipeline-step {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        min-width: 0;
        flex: 1 1 auto;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        overflow: visible;
      }
      .pipeline-card-header .pipeline-step > div {
        min-width: 0;
      }

      .step-badge {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        font-size: 13px;
        background: var(--surface-mint);
        color: var(--text-heading);
        border: 1px solid var(--border-mint);
        box-shadow: var(--shadow-inset);
        font-variant-numeric: tabular-nums;
        flex-shrink: 0;
      }

      .pipeline-step-meta {
        font-size: 12px;
        color: var(--text-soft);
      }
      .pipeline-card-header .badge {
        white-space: nowrap;
        align-self: flex-start;
      }

      .pipeline-actions {
        display: flex;
        flex-direction: column;
        gap: var(--pipeline-actions-gap, 8px);
        min-width: 0;
      }

      .pipeline-actions .btn {
        width: 100%;
        min-height: 44px;
      }
      .pipeline-actions .sidebar-select {
        width: 100%;
        min-width: 0;
      }

      .anki-section-title {
        font-size: 12px;
        font-weight: 600;
        color: var(--text-secondary);
        text-transform: uppercase;
        letter-spacing: 0.08em;
      }

      .anki-loader-grid {
        display: flex;
        flex-direction: column;
        gap: 8px;
      }

      .anki-loader-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
      }

      .anki-loader-row .btn {
        flex: 0 0 auto;
      }

      .anki-advanced {
        display: flex;
        flex-direction: column;
        gap: 8px;
      }

      .anki-advanced summary {
        cursor: pointer;
        font-size: 12px;
        color: var(--text-soft);
      }

      .anki-advanced-body {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-top: 8px;
      }

      .anki-advanced-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 8px;
      }

      .anki-advanced-field {
        display: flex;
        flex-direction: column;
        gap: 4px;
        font-size: 12px;
        color: var(--text-soft);
      }

      .anki-advanced-field .sidebar-input {
        width: 100%;
      }

      .anki-checkbox-row {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        font-size: 12px;
        color: var(--text-soft);
      }

      .anki-quality-grid {
        display: flex;
        flex-direction: column;
        gap: 4px;
        margin-top: 8px;
      }

      .anki-quality-line {
        font-size: 12px;
        color: var(--text-secondary);
      }

      .anki-loaded-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
      }

      .anki-downloads {
        display: flex;
        flex-direction: column;
        gap: 8px;
      }

      .anki-loaded-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
      }

      .anki-status-pill {
        display: inline-flex;
        align-items: center;
        padding: 6px 10px;
        border-radius: 999px;
        border: 1px solid var(--color-border);
        background: var(--owen-warm-white);
        color: var(--text-secondary);
        font-size: 11px;
        line-height: 1.4;
        white-space: nowrap;
      }

      .anki-file-pills {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        max-height: 72px;
        overflow-y: auto;
        padding-right: 4px;
      }

      .anki-code-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
      }

      .anki-note {
        font-size: 12px;
        color: var(--text-soft);
      }

      .anki-spinner {
        width: 12px;
        height: 12px;
        border-radius: 50%;
        border: 2px solid var(--color-border);
        border-top-color: var(--primary);
        display: inline-block;
        animation: anki-spin 0.9s linear infinite;
        vertical-align: middle;
      }

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

      .pipeline-card--dual {
        max-height: none;
        overflow: visible;
      }

      .pipeline-dual-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: var(--pipeline-card-gap);
        min-height: 0;
        height: 100%;
        position: relative;
      }

      .pipeline-dual-grid::before {
        display: none;
      }

      .pipeline-subsection {
        display: flex;
        flex-direction: column;
        gap: var(--pipeline-card-gap);
        min-width: 0;
        min-height: 0;
      }
      .index-ocr-wrapper .pipeline-subsection + .pipeline-subsection {
        border-top: 1px solid var(--color-border);
        padding-top: 10px;
      }

      .pipeline-card--dual .pipeline-card-header {
        flex: 0 0 auto;
      }

      .pipeline-subsection-body {
        display: flex;
        flex-direction: column;
        gap: 6px;
        flex: 1 1 auto;
        min-height: 0;
        min-width: 0;
        overflow: auto;
        padding-right: 4px;
      }

      .pipeline-card--dual .pipeline-actions {
        gap: var(--pipeline-actions-gap);
      }

      .pipeline-card--dual .details-toggle {
        font-size: 11px;
      }

      .pipeline-card--dual .details-body {
        padding-top: 6px;
        font-size: 11px;
      }

      .pipeline-card--library {
        min-height: 0;
      }

      .pipeline-active__row {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 16px;
        flex-wrap: wrap;
      }

      .pipeline-active__title-stack {
        display: flex;
        flex-direction: column;
        gap: 4px;
        position: relative;
        padding-left: 68px;
        min-height: 56px;
        justify-content: center;
      }

      .pipeline-active__eyebrow {
        font-size: 11px;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: var(--text-muted);
      }

      .pipeline-active__actions {
        display: flex;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
      }

      .pipeline-active__controls {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        flex-wrap: wrap;
      }

      .pipeline-active__select {
        display: flex;
        flex-direction: column;
        gap: 6px;
        min-width: 220px;
      }

      .pipeline-active__label {
        font-size: 11px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-soft);
      }

      .pipeline-tracker__top {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 12px;
        font-weight: 600;
      }

      .pipeline-tracker__meta {
        font-size: 11px;
        color: var(--text-soft);
      }

      .pipeline-tracker__icon::after {
        content: "";
        width: 6px;
        height: 10px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        opacity: 0;
      }

      .pipeline-tracker__step[data-status="succeeded"] .pipeline-tracker__icon {
        background: var(--color-success);
        border-color: var(--color-success);
        color: #fff;
      }

      .pipeline-tracker__step[data-status="succeeded"] .pipeline-tracker__icon::after {
        opacity: 1;
      }

      .pipeline-tracker__step[data-status="running"] {
        border-color: color-mix(in srgb, var(--color-warning) 58%, transparent);
        box-shadow: var(--shadow-inset);
      }

      .pipeline-tracker__step[data-status="failed"] {
        border-color: color-mix(in srgb, var(--color-danger) 56%, transparent);
      }

      /* Keep steps + library in one grid row so the library stretches to analytics height. */
      .pipeline-layout {
        display: grid;
        grid-template-columns: minmax(520px, 1fr) minmax(380px, 520px);
        gap: 16px;
        align-items: stretch;
        min-width: 0;
      }

      .pipeline-steps {
        display: flex;
        flex-direction: column;
        gap: 14px;
        min-width: 0;
        min-height: 0;
      }

      .pipeline-sidebar {
        display: flex;
        flex-direction: column;
        min-height: 0;
        min-width: 0;
        height: 100%;
        align-self: stretch;
      }

      .pipeline-step__summary::-webkit-details-marker {
        display: none;
      }

      .pipeline-step__summary-left {
        display: flex;
        align-items: center;
        gap: 12px;
        flex: 1 1 240px;
        min-width: 0;
      }

      .pipeline-step__summary-left > div {
        min-width: 0;
      }

      .pipeline-step__summary-right {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
        margin-left: auto;
        min-width: 0;
        max-width: 100%;
      }

      .pipeline-step-check {
        width: 18px;
        height: 18px;
        border-radius: 999px;
        border: 1px solid var(--color-border);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
        flex: 0 0 auto;
      }

      .pipeline-step-check::after {
        content: "";
        width: 6px;
        height: 10px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        opacity: 0;
      }

      details.pipeline-step[data-status="succeeded"] .pipeline-step-check {
        background: var(--color-success);
        border-color: var(--color-success);
        color: #fff;
      }

      details.pipeline-step[data-status="succeeded"] .pipeline-step-check::after {
        opacity: 1;
      }

      details.pipeline-step[data-status="failed"] {
        border-color: color-mix(in srgb, var(--color-danger) 56%, transparent);
      }

      details.pipeline-step[data-status="running"] {
        border-color: color-mix(in srgb, var(--color-warning) 58%, transparent);
      }

      .pipeline-step__body {
        padding: 0 16px 16px;
        display: flex;
        flex-direction: column;
        gap: 10px;
        min-width: 0;
        width: 100%;
      }

      .pipeline-step__body > * {
        min-width: 0;
        max-width: 100%;
      }

      .pipeline-step__body .pipeline-actions {
        width: 100%;
        min-width: 0;
      }

      .pipeline-step__body .sidebar-inline-actions {
        flex-wrap: wrap;
        align-items: center;
        width: 100%;
        min-width: 0;
      }

      .pipeline-step__body .sidebar-inline-actions > * {
        min-width: 0;
      }

      .pipeline-step__body .sidebar-inline-actions .btn {
        width: auto;
        flex: 0 0 auto;
        max-width: 100%;
      }

      #file-name {
        flex: 1 1 180px;
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .pipeline-step__footer {
        display: flex;
        justify-content: flex-end;
      }

      .pipeline-status-pill {
        display: inline-flex;
        align-items: center;
        padding: 4px 10px;
        border-radius: 999px;
        border: 1px solid var(--color-border);
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        background: var(--owen-warm-white);
        color: var(--text-secondary);
      }

      .pipeline-publish-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 12px;
      }

      .pipeline-publish-card {
        border: 1px solid var(--border-mint);
        border-radius: 12px;
        padding: 12px;
        background: var(--surface-mint);
        display: flex;
        flex-direction: column;
        gap: 8px;
        box-shadow: var(--shadow-inset);
      }

      .pipeline-publish-title {
        font-size: 11px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-soft);
      }

      .pipeline-history {
        border-radius: 14px;
        border: 1px solid var(--color-border);
        background: var(--owen-warm-white);
        padding: 12px;
        display: flex;
        flex-direction: column;
        gap: 10px;
      }

      .pipeline-history__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
      }

      .pipeline-history__list {
        display: flex;
        flex-direction: column;
        gap: 8px;
        max-height: 200px;
        overflow: auto;
      }

      .pipeline-history__row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
      }

      .pipeline-history__meta {
        font-size: 11px;
        color: var(--text-soft);
      }

      .pipeline-history__empty {
        font-size: 12px;
        color: var(--text-soft);
        text-align: center;
        border: 1px dashed var(--color-border);
        padding: 10px;
        border-radius: 10px;
      }

      .student-library {
        display: flex;
        flex-direction: column;
        gap: 12px;
      }

      .student-library__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
      }

      .student-library__breadcrumb {
        font-size: 12px;
        color: var(--text-soft);
      }

      .student-library__controls {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        flex-wrap: wrap;
      }

      .student-library__search {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
      }

      .library-advanced-body .student-library__search {
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap;
      }

      .library-advanced-body .student-library__search .btn {
        width: 100%;
      }

      .student-library__list {
        display: flex;
        flex-direction: column;
        gap: 8px;
        max-height: 300px;
        overflow: auto;
        padding-right: 4px;
      }

      .student-library__item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 10px 12px;
        border-radius: 12px;
        border: 1px solid var(--border);
        background: var(--bg-surface);
        cursor: pointer;
        transition: border-color 0.16s ease, background 0.16s ease;
      }

      .student-library__item:hover {
        border-color: var(--border-strong);
        background: var(--bg-soft);
      }

      .student-library__item.is-active {
        border-color: rgba(59, 130, 246, 0.5);
        box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2) inset;
      }

      .student-library__item-title {
        font-weight: 600;
        font-size: 13px;
      }

      .student-library__item-meta {
        font-size: 11px;
        color: var(--text-soft);
      }

      .student-library__selected-actions {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
        gap: 8px;
      }

      .student-library__selected-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        flex-wrap: wrap;
      }

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

      @media (max-width: 900px) {
        .pipeline-tracker {
          grid-template-columns: repeat(4, minmax(0, 1fr));
        }

        .pipeline-publish-grid {
          grid-template-columns: 1fr;
        }
      }

      @media (max-width: 640px) {
        .pipeline-tracker {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }
      }
      .lecture-library-card {
        display: flex;
        flex-direction: column;
        min-height: 0;
        height: 100%;
        min-width: 0;
        flex: 1 1 auto;
        container-type: inline-size;
      }
      .lecture-library-card .pipeline-card-header {
        flex-wrap: nowrap;
        align-items: center;
      }
      .lecture-library-card .library-manager {
        flex: 1 1 0;
        min-height: 0;
      }
      /* Allow the list region to scroll inside a full-height library card. */
      .lecture-library-body {
        display: flex;
        flex-direction: column;
        gap: 10px;
        flex: 1 1 0;
        min-height: 0;
        overflow: hidden;
      }
      .library-view {
        display: flex;
        flex-direction: column;
        gap: 10px;
        flex: 1 1 0;
        min-height: 0;
      }
      .library-browser__search {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        gap: 8px;
        align-items: center;
      }
      .library-browser__search .sidebar-input {
        flex: 1 1 220px;
        min-width: 0;
      }
      .library-browser__search .sidebar-select {
        flex: 0 0 auto;
        min-width: 140px;
      }

      .library-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        flex-wrap: nowrap;
        min-width: 0;
      }

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

      .library-year-tabs {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 4px;
        border-radius: 999px;
        background: var(--owen-warm-white);
        border: 1px solid var(--color-border);
      }

      .library-year-tab {
        border: 0;
        background: transparent;
        color: var(--text-soft);
        font-size: 12px;
        font-weight: 600;
        padding: 6px 12px;
        border-radius: 999px;
        cursor: pointer;
        transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
      }

      .library-year-tab[aria-selected="true"] {
        background: var(--owen-warm-white-soft);
        color: var(--text);
        box-shadow: var(--shadow-soft);
      }

      .library-course-view {
        display: flex;
        flex-direction: column;
        gap: 10px;
        flex: 1 1 auto;
        min-height: 0;
      }

      .library-course-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
        overflow: auto;
        padding-right: 4px;
        min-height: 0;
        flex: 1 1 auto;
      }

      .library-course-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 8px 12px;
        border-radius: 12px;
        border: 1px solid var(--color-border);
        background: var(--owen-warm-white);
        cursor: pointer;
        transition: border-color 0.16s ease, background 0.16s ease;
      }

      .library-course-row:hover {
        border-color: var(--border-strong);
        background: var(--owen-warm-white-soft);
      }

      .library-course-row.is-add {
        border-style: dashed;
        color: var(--text-soft);
        justify-content: flex-start;
        font-weight: 600;
      }

      .library-course-title {
        font-weight: 600;
        font-size: 13px;
      }

      .library-course-count {
        font-size: 12px;
        color: var(--text-soft);
        white-space: nowrap;
      }

      .library-course-chevron {
        width: 8px;
        height: 8px;
        border-right: 2px solid var(--text-muted);
        border-bottom: 2px solid var(--text-muted);
        transform: rotate(-45deg);
      }

      .library-lecture-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        flex-wrap: nowrap;
        min-width: 0;
      }

      .library-breadcrumb {
        font-size: 12px;
        color: var(--text-secondary);
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .library-lecture-controls {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 0 0 auto;
      }

      .library-row-actions {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-end;
      }

      .library-status-chip {
        display: inline-flex;
        align-items: center;
        padding: 4px 8px;
        border-radius: 999px;
        border: 1px solid var(--color-border);
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        color: var(--text-secondary);
        background: var(--owen-warm-white);
      }

      .library-status-chip.is-ready {
        color: var(--primary-dark);
        background: var(--primary-soft);
      }

      .library-status-chip.is-ocr {
        color: color-mix(in srgb, var(--color-warning) 80%, var(--color-text));
        background: color-mix(in srgb, var(--color-warning) 10%, var(--color-surface));
        border-color: color-mix(in srgb, var(--color-warning) 45%, transparent);
      }

      .library-status-chip.is-missing {
        color: var(--text-muted);
      }

      .library-status-chip.is-locked {
        color: var(--text-heading);
        background: var(--surface-pearl);
        border-color: var(--border-mint);
      }

      .library-status-chip.is-archived {
        color: color-mix(in srgb, var(--color-warning) 80%, var(--color-text));
        background: color-mix(in srgb, var(--color-warning) 12%, var(--color-surface));
        border-color: color-mix(in srgb, var(--color-warning) 45%, transparent);
      }

      .library-archive-action {
        color: color-mix(in srgb, var(--color-warning) 80%, var(--color-text));
        background: color-mix(in srgb, var(--color-warning) 8%, var(--color-surface));
        border-color: color-mix(in srgb, var(--color-warning) 40%, transparent);
      }

      .library-archive-action:hover {
        color: color-mix(in srgb, var(--color-warning) 88%, var(--color-text));
        background: color-mix(in srgb, var(--color-warning) 16%, var(--color-surface));
        border-color: var(--color-warning);
      }

      .library-row-menu {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
      }

      .library-row-menu summary {
        list-style: none;
      }

      .library-row-menu summary::-webkit-details-marker {
        display: none;
      }

      .library-row-menu__toggle {
        width: 28px;
        height: 28px;
        border-radius: var(--radius-sm);
        border: 1px solid var(--color-border);
        background: var(--surface-pearl);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: var(--text-soft);
        transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
      }

      .library-row-menu__toggle:hover {
        border-color: var(--border-mint-hover);
        background: var(--surface-mint-hover);
        color: var(--text);
      }

      .library-row-menu__panel {
        display: flex;
        flex-direction: column;
        gap: 6px;
        align-items: stretch;
        padding: var(--space-2);
        min-width: 160px;
        max-width: 100%;
        background: var(--surface-pearl);
        border: 1px solid var(--border-mint);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-inset), var(--shadow-sm);
      }

      .library-row-menu__panel .btn {
        width: 100%;
      }

      .library-row-manage {
        display: none;
      }

      .lecture-library-card.is-manage .library-row-manage {
        display: inline-flex;
      }

      /* Container query keeps two-column controls until the card is truly narrow. */
      @container (max-width: 419px) {
        .lecture-library-card .pipeline-card-header {
          flex-wrap: wrap;
          align-items: flex-start;
        }

        .lecture-library-card .library-browser__search {
          grid-template-columns: 1fr;
          justify-items: stretch;
        }

        .lecture-library-card .library-browser__search .sidebar-input,
        .lecture-library-card .library-browser__search .btn,
        .lecture-library-card .library-browser__search .sidebar-select {
          width: 100%;
        }

        .lecture-library-card .library-toolbar {
          flex-wrap: wrap;
        }

        .lecture-library-card .library-lecture-header {
          flex-wrap: wrap;
        }

        .lecture-library-card .library-breadcrumb {
          white-space: normal;
          overflow: visible;
        }

        .lecture-library-card .library-lecture-controls {
          width: 100%;
          justify-content: flex-start;
        }
      }

      @media (min-width: 1280px) {
        .pipeline-layout {
          grid-template-columns: minmax(640px, 1fr) minmax(520px, 1.2fr);
          gap: var(--pipeline-grid-gap);
        }

        .pipeline-grid {
          grid-template-columns: repeat(12, minmax(0, 1fr));
          grid-template-areas:
            "top top top top top top top top rightcol rightcol rightcol rightcol"
            "guide guide guide guide guide guide guide guide rightcol rightcol rightcol rightcol"
            "anki anki anki anki anki anki anki anki rightcol rightcol rightcol rightcol"
            "analytics analytics analytics analytics analytics analytics analytics analytics analytics analytics analytics analytics";
        }

        .pipeline-top-grid {
          display: grid;
          grid-area: top;
          grid-template-columns: repeat(2, minmax(0, 1fr));
          grid-template-rows: auto auto;
          column-gap: var(--pipeline-grid-gap);
          row-gap: 0;
          align-items: stretch;
          min-width: 0;
        }

        .pipeline-top-grid .card-upload {
          grid-area: auto;
          grid-column: 1;
          grid-row: 1 / span 2;
          align-self: stretch;
          min-height: 0;
        }

        .pipeline-top-grid .card-indexocr {
          display: contents;
          grid-area: auto;
        }

        .pipeline-top-grid .pipeline-dual-grid {
          display: contents;
        }

        .pipeline-top-grid .pipeline-subsection {
          grid-column: 2;
          min-width: 0;
          min-height: 0;
          padding: var(--pipeline-card-padding);
          border-radius: var(--radius-lg);
          border: 1px solid var(--color-border);
          background: var(--owen-warm-white);
          box-shadow: var(--shadow-soft);
        }

        .pipeline-top-grid .pipeline-subsection--index {
          grid-row: 1;
          border-bottom: 0;
          border-bottom-left-radius: 0;
          border-bottom-right-radius: 0;
          padding-bottom: 0;
        }

        .pipeline-top-grid .pipeline-subsection--ocr {
          grid-row: 2;
          border-top-left-radius: 0;
          border-top-right-radius: 0;
          padding-top: 10px;
        }

        .pipeline-top-grid .index-ocr-wrapper .pipeline-subsection + .pipeline-subsection {
          padding-top: 10px;
        }
      }

      @media (min-width: 900px) and (max-width: 1279px) {
        .pipeline-grid {
          grid-template-columns: repeat(2, minmax(360px, 1fr));
          grid-template-areas:
            "upload upload"
            "indexocr rightcol"
            "guide rightcol"
            "anki rightcol"
            "analytics analytics";
        }
      }

      @media (min-width: 900px) {
        .pipeline-column--right {
          display: flex;
          flex-direction: column;
          gap: var(--pipeline-grid-gap);
          grid-area: rightcol;
          align-self: stretch;
          min-height: 0;
          height: 100%;
        }

        .pipeline-column--right .card-txt {
          flex: 0 0 auto;
        }

        .pipeline-column--right .card-library {
          flex: 1 1 0;
          min-height: 0;
        }
      }

      @media (max-width: 1279px) {
        .faculty-content {
          --pipeline-grid-gap: 20px;
          --pipeline-card-padding: 18px;
          --pipeline-card-gap: 10px;
          --pipeline-card-header-gap: 10px;
          --pipeline-actions-gap: 8px;
        }
      }

      @media (max-width: 1100px) {
        .index-ocr-wrapper {
          grid-template-columns: 1fr;
          gap: 10px;
        }
      }

      @media (max-width: 899px) {
        .faculty-content {
          --pipeline-grid-gap: 18px;
          --pipeline-card-padding: 16px;
          --pipeline-card-gap: 10px;
        }
      }

      .library-manager {
        display: flex;
        flex-direction: column;
        gap: 10px;
        min-height: 0;
      }

      .library-manager__list {
        display: flex;
        flex-direction: column;
        gap: 8px;
        overflow: auto;
        padding-right: 4px;
        min-height: 0;
        flex: 1 1 0;
      }

      .library-manager__course {
        border: 1px solid var(--color-border);
        border-radius: 14px;
        background: var(--surface-pearl);
        padding: 8px 10px;
        box-shadow: var(--shadow-inset);
      }

      .library-manager__course summary {
        list-style: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        font-weight: 600;
        font-size: 13px;
        color: var(--text);
      }

      .library-manager__course summary::-webkit-details-marker {
        display: none;
      }

      .library-manager__course summary::after {
        content: "";
        width: 10px;
        height: 10px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(-45deg);
        transition: transform 0.16s ease;
      }

      .library-manager__course[open] summary::after {
        transform: rotate(45deg);
      }

      .library-manager__course-count {
        color: var(--text-soft);
        font-weight: 500;
        font-variant-numeric: tabular-nums;
      }

      .library-manager__course-list {
        margin-top: 10px;
        display: flex;
        flex-direction: column;
        gap: 10px;
      }

      .library-manager__row {
        border: 1px solid var(--color-border);
        border-radius: 12px;
        padding: 8px 10px;
        background: var(--owen-warm-white);
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        align-items: center;
      }
      .library-manager__row > div:first-child {
        min-width: 0;
      }

      .library-manager__row .library-row-actions {
        width: 100%;
        min-width: 0;
        justify-content: flex-start;
      }

      .library-manager__row .library-manager__download {
        width: auto;
        min-width: 132px;
        max-width: 200px;
        flex: 1 1 144px;
        min-height: 34px;
        padding: 6px 10px;
        font-size: var(--text-xs);
      }

      .library-manager__title {
        font-weight: 700;
        font-size: var(--text-sm);
        margin-bottom: 4px;
        color: var(--text-heading);
      }

      .library-manager__meta {
        font-size: 12px;
        color: var(--text-soft);
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        min-width: 0;
        align-items: center;
      }

      .library-manager__meta-item {
        max-width: 220px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
        gap: 6px;
      }

      .library-manager__meta-code {
        max-width: none;
        overflow: visible;
      }

      .qbank-count-summary {
        max-width: none;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        flex-wrap: wrap;
        row-gap: 2px;
      }

      .qbank-count-summary__label,
      .qbank-count-summary__value,
      .qbank-count-summary__state {
        white-space: nowrap;
      }

      .qbank-count-summary__values {
        display: inline-flex;
        align-items: center;
        flex-wrap: wrap;
        column-gap: 6px;
        row-gap: 2px;
        min-width: 0;
      }

      .qbank-count-summary__separator {
        color: var(--text-muted);
        line-height: 1;
      }

      .library-manager__meta-sep {
        opacity: 0.7;
      }

      .library-manager__code {
        font-family: var(--font-mono);
        color: var(--text);
        letter-spacing: 0.02em;
      }

      .library-code-copy {
        width: 24px;
        height: 24px;
        border-radius: 8px;
        border: 1px solid var(--color-border);
        background: var(--surface-pearl);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: var(--text-soft);
        transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
        border-color: var(--color-border);
      }

      .library-code-copy:hover {
        border-color: var(--border-mint-hover);
        color: var(--text);
        background: var(--surface-mint-hover);
      }

      .library-code-copy:disabled {
        opacity: 0.5;
        cursor: not-allowed;
      }

      .library-code-copy[data-copied="true"] {
        color: var(--primary-dark);
        border-color: var(--border-strong);
        background: var(--primary-soft);
      }

      .library-code-feedback {
        font-size: 11px;
        color: var(--text-soft);
        opacity: 0;
        transform: translateY(-1px);
        transition: opacity 0.16s ease, transform 0.16s ease;
        white-space: nowrap;
      }

      .library-code-feedback.is-visible {
        opacity: 1;
        transform: translateY(0);
      }

      .library-code-feedback.is-error {
        color: var(--color-danger);
      }

      .library-manager__badges {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 8px;
      }

      .artifact-badge {
        border-radius: 999px;
        padding: 4px 8px;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.02em;
        text-transform: uppercase;
        border: 1px solid var(--color-border);
        background: var(--primary-soft);
        color: var(--primary-dark);
      }

      .artifact-badge.is-missing {
        background: var(--owen-warm-white);
        color: var(--text-muted);
      }

      .library-manager__actions {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-end;
      }
      .library-manager__actions .btn,
      .library-manager__actions .sidebar-select {
        min-height: 34px;
      }

      .library-manager__confirm {
        grid-column: 1 / -1;
        border-top: 1px dashed var(--color-border);
        margin-top: 8px;
        padding-top: 8px;
        display: flex;
        flex-direction: column;
        gap: 8px;
        font-size: 12px;
        color: var(--text-secondary);
      }

      .library-manager__confirm-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
      }

      .library-manager__confirm-input {
        flex: 1 1 140px;
      }

      .library-manager__empty {
        padding: 12px;
        border-radius: 12px;
        border: 1px dashed var(--color-border);
        color: var(--text-soft);
        font-size: 12px;
        text-align: center;
      }

      .btn-danger {
        background: #b42318;
        color: #fff;
        box-shadow: 0 10px 20px rgba(180, 35, 24, 0.2);
      }

      .btn-danger:hover {
        background: #8f1a12;
      }

      @media (max-width: 1279px) {
        .library-manager__row {
          grid-template-columns: 1fr;
        }

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

        .library-manager__confirm-actions {
          flex-direction: column;
          align-items: stretch;
        }

        .library-manager__confirm-actions .btn,
        .library-manager__confirm-actions .sidebar-input {
          width: 100%;
        }

        .library-manager__meta span {
          max-width: 100%;
        }
      }

      .details-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 12px;
        padding: 10px 16px;
        min-height: 44px;
        font-size: 12px;
        color: var(--text-soft);
        cursor: pointer;
      }

      .details-toggle .details-label {
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .details-toggle .chevron {
        flex: 0 0 auto;
        width: 12px;
        height: 12px;
      }

      .details-body {
        border-top: 1px dashed var(--color-border);
        padding-top: 10px;
        font-size: 12px;
        color: var(--text-muted);
      }

      .machine-result {
        font-size: 12px;
        color: var(--text-soft);
      }

      .machine-result a {
        color: var(--primary-dark);
        text-decoration: underline;
      }

      .publish-result {
        display: flex;
        flex-direction: column;
        gap: 8px;
        font-size: 12px;
        color: var(--text-soft);
      }

      .publish-code-row {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
      }

      .publish-code {
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        padding: 6px 10px;
        border-radius: 10px;
        border: 1px solid var(--color-border);
        background: var(--surface-mint);
        border-color: var(--border-mint);
        color: var(--text-heading);
        font-variant-numeric: tabular-nums;
      }

      .publish-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
      }

      .publish-details summary {
        cursor: pointer;
        font-size: 12px;
        color: var(--text-muted);
      }

      .publish-details-body {
        margin-top: 6px;
        display: flex;
        flex-direction: column;
        gap: 6px;
      }

      .publish-details-body code {
        word-break: break-all;
      }

      .machine-key {
        overflow-wrap: anywhere;
        max-width: 100%;
        white-space: normal;
      }

      .machine-key code {
        overflow-wrap: anywhere;
        white-space: normal;
      }

      .status-tag {
        padding: 2px 8px;
        border-radius: 999px;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        border: 1px solid var(--color-border);
        color: var(--text-soft);
      }

      .status-tag.ready {
        background: var(--surface-mint);
        color: var(--text-heading);
        border-color: var(--border-mint);
      }

      .status-tag.warn {
        background: color-mix(in srgb, var(--color-warning) 12%, var(--color-surface));
        color: color-mix(in srgb, var(--color-warning) 80%, var(--color-text));
        border-color: color-mix(in srgb, var(--color-warning) 48%, transparent);
      }

      .status-tag.missing {
        background: color-mix(in srgb, var(--color-danger) 12%, var(--color-surface));
        color: var(--color-danger);
        border-color: color-mix(in srgb, var(--color-danger) 48%, transparent);
      }

      .analytics-card {
        padding: var(--pipeline-card-padding);
        border-radius: var(--radius-lg);
        border: 1px solid var(--color-border);
        background: var(--surface-pearl);
        box-shadow: var(--shadow-inset), var(--shadow-sm);
        display: flex;
        flex-direction: column;
        gap: var(--pipeline-card-gap);
        min-width: 0;
      }

      .analytics-header {
        display: flex;
        flex-direction: column;
        gap: var(--pipeline-card-gap);
        padding: var(--space-4);
        background: var(--surface-mint);
        border: 1px solid var(--border-mint);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-inset);
      }

      .analytics-title {
        font-weight: 800;
        font-size: 18px;
        color: var(--text-heading);
      }

      .analytics-meta-row {
        display: flex;
        align-items: center;
        gap: 12px;
      }

      .analytics-subtitle {
        font-size: 12px;
        color: var(--text-soft);
      }

      .analytics-updated {
        margin-left: auto;
        font-size: 12px;
        color: var(--text-soft);
        white-space: nowrap;
      }

      .meta-body {
        margin-top: 16px;
        display: flex;
        flex-direction: column;
        gap: 12px;
      }

      .meta-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
      }

      .meta-section-title,
      .meta-label {
        font-size: 12px;
        font-weight: 600;
        color: var(--text-soft);
      }

      .meta-label {
        color: var(--text);
      }

      .meta-helper {
        font-size: 11px;
        color: var(--text-soft);
      }

      .meta-error {
        margin-top: 8px;
        font-size: 12px;
        color: var(--color-danger);
      }

      .meta-error[data-tone="info"] {
        color: var(--text-soft);
      }

      .meta-note {
        margin-top: 4px;
        font-size: 12px;
        color: var(--text-soft);
      }

      body.theme-dark .meta-error {
        color: var(--color-danger);
      }

      body.theme-dark .meta-error[data-tone="info"] {
        color: var(--text-soft);
      }

      .meta-status[data-state="loading"] {
        color: var(--text-soft);
      }

      .meta-status[data-state="error"] {
        color: var(--color-danger);
      }

      .meta-status {
        display: flex;
        flex-direction: column;
        gap: 0;
        font-size: 12px;
        color: var(--text);
      }

      .meta-status[data-empty="true"],
      .meta-cleaned[data-empty="true"],
      .meta-topics-chart[data-empty="true"] {
        color: var(--text-soft);
      }

      .meta-topics-chart {
        display: flex;
        flex-direction: column;
        gap: 0;
        font-size: 12px;
        color: var(--text);
      }

      .meta-waiting-item {
        display: flex;
        align-items: baseline;
        gap: 12px;
        padding: 6px 0;
        border-top: 1px solid var(--color-border);
      }

      .meta-waiting-item:first-child {
        border-top: none;
      }

      .meta-waiting-text {
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .meta-waiting-count {
        font-size: 11px;
        color: var(--text-soft);
        white-space: nowrap;
        font-variant-numeric: tabular-nums;
      }

      .meta-field {
        display: flex;
        align-items: center;
        gap: 8px;
        min-height: 28px;
      }

      .meta-cleaned {
        flex: 1;
        min-width: 0;
        font-size: 12px;
        color: var(--text);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .meta-action {
        width: 28px;
        height: 28px;
        border-radius: 8px;
        border: 1px solid var(--color-border);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: var(--text-soft);
        transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
        background: var(--surface-pearl);
      }

      .meta-action:hover {
        color: var(--text);
        background: var(--surface-mint-hover);
        border-color: var(--border-mint-hover);
      }

      .meta-action:disabled {
        opacity: 0.45;
        cursor: not-allowed;
        background: transparent;
      }

      .meta-action[data-copied="true"] {
        color: var(--primary-dark);
        border-color: var(--border-strong);
        background: var(--primary-soft);
      }

      .meta-topic-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 12px;
        align-items: center;
        padding: 6px 0;
        border-top: 1px solid var(--color-border);
      }

      .meta-topic-row:first-child {
        border-top: none;
      }

      .meta-topic-label-wrap {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 0;
      }

      .meta-topic-label {
        font-size: 12px;
        font-weight: 600;
      }

      .meta-topic-label,
      .meta-topic-aliases {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .meta-topic-aliases {
        font-size: 11px;
        color: var(--text-soft);
      }

      .meta-topic-track {
        height: 6px;
        border-radius: 999px;
        background: var(--color-accent-weak);
        overflow: hidden;
        margin-top: 6px;
      }

      .meta-topic-fill {
        height: 100%;
        border-radius: inherit;
        background: var(--action-primary);
      }

      .meta-topic-count {
        font-size: 11px;
        color: var(--text-soft);
        text-align: right;
        font-variant-numeric: tabular-nums;
      }

      .meta-body select {
        width: 100%;
        border-radius: 8px;
        border: 1px solid var(--color-border);
        background: var(--owen-warm-white);
        padding: 8px 10px;
        font-size: 13px;
        color: var(--text);
        transition: border-color 0.16s ease, box-shadow 0.16s ease;
      }

      .meta-body select:focus-visible,
      .meta-action:focus-visible {
        outline: 1px solid var(--border-strong);
        outline-offset: 2px;
        box-shadow: var(--shadow-focus);
      }

      .citation-chip,
      .cite {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 2px 6px;
        border-radius: 999px;
        background: rgba(46, 111, 114, 0.12);
        border: 1px solid rgba(46, 111, 114, 0.25);
        font-size: 12px;
        color: var(--primary-dark);
        cursor: pointer;
      }

      .citation-chip[aria-disabled="true"] {
        opacity: 0.5;
        cursor: not-allowed;
      }

      .citation-chip.is-highlighted {
        background: rgba(46, 111, 114, 0.26);
      }

      .citation-tooltip {
        position: fixed;
        z-index: 50;
        background: var(--bg-soft);
        border: 1px solid var(--border);
        border-radius: 12px;
        box-shadow: var(--shadow-soft);
        padding: 10px 12px;
        width: min(340px, calc(100vw - 24px));
        box-sizing: border-box;
        overflow: auto;
        overflow-wrap: anywhere;
        font-size: 13px;
        line-height: 1.5;
        color: var(--color-text);
      }

      .citation-tooltip[hidden] { display: none; }

      .citation-tooltip-title {
        padding-right: 24px;
        font-weight: 600;
        margin-bottom: 4px;
      }

      .citation-tooltip-meta {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 11px;
        color: var(--text-soft);
        margin-bottom: 6px;
      }

      .citation-tooltip-snippet {
        font-size: 12px;
        color: var(--text-secondary);
        margin-bottom: 8px;
      }

      .citation-tooltip-actions {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
      }

      .citation-tooltip-actions button,
      .citation-tooltip-actions a {
        border-radius: 10px;
        border: 1px solid var(--border);
        background: var(--bg-soft);
        padding: 4px 8px;
        font-size: 12px;
        cursor: pointer;
      }

      .citation-tooltip-actions button:hover,
      .citation-tooltip-actions a:hover {
        background: var(--primary-soft);
        border-color: var(--border-strong);
      }

      .citation-tooltip-actions a {
        display: inline-flex;
        align-items: center;
        color: var(--color-accent-strong);
        text-decoration: none;
      }
      .citation-tooltip-close {
        position: absolute;
        top: 5px;
        right: 5px;
        width: 30px;
        height: 30px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--color-muted);
        font-size: 21px;
        cursor: pointer;
      }
      .citation-source-attribution,
      .citation-source-access,
      .citation-source-doi {
        margin-block: 4px;
        font-size: 12px;
        line-height: 1.5;
        color: var(--color-muted);
        overflow-wrap: anywhere;
      }
      .citation-chip:focus-visible,
      .citation-tooltip :is(a, button):focus-visible {
        outline: 2px solid var(--color-accent);
        outline-offset: 3px;
      }
      @media (hover: none) and (pointer: coarse) {
        .citation-chip { min-width: 28px; min-height: 28px; justify-content: center; }
        .citation-tooltip-actions :is(a, button) { min-height: 44px; }
        .citation-tooltip-close { width: 36px; height: 36px; }
        .citation-tooltip-title { padding-right: 30px; }
      }

      .response-card[data-cite-mode="inline"] .citation-endnotes:not(.structured-segment-sources) {
        display: none;
      }

      .citation-endnotes {
        border-top: 1px dashed var(--border);
        margin-top: 14px;
        padding-top: 10px;
        font-size: 12px;
        color: var(--text-muted);
      }

      .citation-endnotes ol {
        margin: 0;
        padding-left: 18px;
      }

      .citation-index {
        color: var(--primary-dark);
        text-decoration: underline;
      }

      .ref-highlight {
        background: rgba(46, 111, 114, 0.12);
        border-radius: 6px;
        padding: 2px 4px;
      }

      .assistant-section {
        margin-bottom: 12px;
      }

      .section-heading {
        font-size: 14px;
        font-weight: 700;
        margin-bottom: 6px;
      }

      .response-section .section-heading {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 12px;
        border-radius: 999px;
        border: 1px solid var(--response-pill-border);
        background: var(--response-pill-bg);
        color: var(--response-pill-text);
        box-shadow: var(--response-pill-shadow);
        width: fit-content;
        transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
      }

      .response-section .section-heading:hover {
        background: var(--response-pill-bg-hover);
        transform: translateY(-1px);
      }

      .response-section .section-heading.is-active,
      .response-section .section-heading:focus-visible {
        background: var(--response-pill-bg-active);
        border-color: var(--response-pill-border-active);
      }

      .response-section .section-heading.section-heading--response {
        backdrop-filter: blur(6px);
      }

      .section-body {
        font-size: 14px;
      }

      .reference-panel {
        margin-top: 10px;
        padding: 10px 12px;
        border-radius: var(--radius-md);
        border: 1px solid var(--ref-panel-border);
        background: var(--ref-panel-bg);
        color: var(--ref-panel-text);
        font-size: 12px;
        max-width: var(--reading-max-width);
      }

      .reference-panel__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
      }

      .reference-panel__title {
        font-weight: 600;
        font-size: 12px;
        color: var(--text-secondary);
      }

      .reference-panel__toggle {
        border-radius: 999px;
        border: 1px solid var(--ref-toggle-border);
        background: var(--ref-toggle-bg);
        color: var(--ref-toggle-text);
        font-size: 11px;
        padding: 4px 10px;
        cursor: pointer;
        transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
      }

      .reference-panel__toggle:hover {
        transform: translateY(-1px);
        background: var(--ref-chip-hover);
      }

      .reference-panel__body {
        margin-top: 8px;
        display: grid;
        gap: 8px;
      }

      .reference-panel__chips,
      .reference-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        max-height: 120px;
        overflow: auto;
        padding-right: 4px;
      }

      .reference-chips {
        margin-top: 6px;
      }

      .reference-chip {
        appearance: none;
        border: 1px solid var(--ref-chip-border);
        background: var(--ref-chip-bg);
        color: var(--ref-chip-text);
        font-size: 11px;
        border-radius: 999px;
        padding: 4px 10px;
        cursor: default;
        line-height: 1.2;
        display: inline-flex;
        align-items: center;
        gap: 6px;
      }

      button.reference-chip {
        cursor: pointer;
      }

      .reference-chip:hover {
        background: var(--ref-chip-hover);
      }

      .reference-chip.is-active {
        background: var(--ref-chip-active);
        border-color: var(--ref-chip-border-active);
      }

      .reference-chip:focus-visible {
        outline: 2px solid var(--focus-ring);
        outline-offset: 2px;
      }

      .reference-panel__detail {
        border-radius: 10px;
        border: 1px dashed var(--ref-panel-border);
        background: var(--ref-detail-bg);
        padding: 6px 8px;
        color: var(--text-secondary);
        font-size: 11px;
      }

      .reference-panel__detail-title {
        font-weight: 600;
        color: var(--text-primary);
        font-size: 11px;
        margin-bottom: 2px;
      }

      .reference-panel__fallback {
        white-space: pre-wrap;
        font-size: 11px;
        color: var(--text-secondary);
        max-height: 160px;
        overflow: auto;
      }

      .table-fallback,
      .owen-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 13px;
      }

      .owen-table-card {
        border-radius: 16px;
        border: 1px solid var(--border);
        background: var(--bg-soft);
        padding: 10px;
        margin: 10px 0;
      }

      .owen-table-card__header {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 8px;
      }

      .owen-table-card__title {
        font-weight: 600;
        font-size: 13px;
      }

      .owen-table-toggle {
        margin-left: auto;
        border-radius: 999px;
        border: 1px solid var(--border);
        background: var(--bg-soft);
        padding: 4px 8px;
        font-size: 12px;
        cursor: pointer;
      }

      .owen-table-resizer {
        position: relative;
        resize: both;
        overflow: hidden;
        min-width: 320px;
        min-height: 200px;
        width: 100%;
        border-radius: 12px;
        border: 1px solid var(--border);
        background: var(--bg-surface);
      }

      body.theme-dark .owen-table-resizer {
        background: rgba(17, 28, 32, 0.6);
      }

      .owen-table-scroll {
        overflow: auto;
        width: 100%;
        height: 100%;
      }

      .owen-table-handle {
        position: absolute;
        width: 14px;
        height: 14px;
        right: 6px;
        bottom: 6px;
        border-right: 2px solid rgba(0, 0, 0, 0.2);
        border-bottom: 2px solid rgba(0, 0, 0, 0.2);
        border-radius: 2px;
        opacity: 0.4;
      }

      body.theme-dark .owen-table-handle {
        border-color: rgba(255, 255, 255, 0.25);
      }

      .owen-table-card--nowrap .owen-table th,
      .owen-table-card--nowrap .owen-table td {
        white-space: nowrap;
      }

      .owen-pretty-table__wrap {
        width: 100%;
        overflow: auto;
        border-radius: 12px;
        border: 1px solid var(--border);
        background: var(--bg-soft);
        padding: 6px;
      }

      .owen-table th,
      .owen-table td {
        border: 1px solid var(--border);
        padding: 8px 10px;
        vertical-align: top;
      }

      .owen-table thead th {
        background: rgba(46, 111, 114, 0.08);
      }

      @media (max-width: 980px) {
        .student-shell {
          grid-template-columns: 1fr;
          padding: 16px;
        }

        .chat-log {
          min-height: 48vh;
        }
      }

      @media (max-width: 720px) {
        .landing {
          --landing-cta-height: 150px;
          --landing-cta-icon-width: 150px;
          --landing-cta-icon-height: 110px;
          --landing-cta-icon-top: 24%;
          --icon-nudge-y: 1px;
          --landing-cta-title-size: 20px;
          --landing-cta-subtitle-size: 12px;
          --landing-cta-stack-gap: 14px;
          --landing-cta-stack-gap-collapsed: 10px;
          --landing-cta-text-gap: 4px;
          --landing-cta-padding-block: 10px;
          --landing-cta-padding-inline: 12px;
          --landing-cta-text-block: 50px;
          --landing-cta-text-shift: var(--icon-nudge-y);
          --landing-cta-text-drop: 18px;
          --landing-cta-title-overlap: 20px;
          --landing-cta-stack-shift: 20px;
          --landing-cta-stack-lower: 16px;
        }

        .landing-actions {
          grid-template-columns: 1fr;
        }

        .landing-button {
          width: 100%;
          max-width: var(--landing-cta-mobile-max);
        }

        .response-header {
          flex-direction: column;
          align-items: flex-start;
        }

        .composer-row {
          flex-direction: column;
          align-items: stretch;
        }

        .composer-mode,
        .composer-mode-select {
          width: 100%;
        }

        .composer-send {
          width: 100%;
        }

        .sources-drawer {
          width: 100vw;
        }

        .pipeline-title {
          font-size: 20px;
        }

        .analytics-meta-row {
          flex-direction: column;
          align-items: flex-start;
        }

        .analytics-updated {
          margin-left: 0;
          white-space: normal;
        }

        body[data-route="student"] .chat-composer textarea,
        body[data-route="student"] .chat-composer input {
          font-size: max(16px, 1rem);
        }

        body[data-route="student"] .chat-column,
        body[data-route="student"] .chat-pane,
        body[data-route="student"] .chat-composer,
        body[data-route="student"] .composer-row,
        body[data-route="student"] .composer-field {
          transform: none !important;
        }
      }

      @media (max-width: 1024px) {
        body[data-route="student"] .student-shell {
          grid-template-columns: minmax(0, 1fr);
          padding: 16px;
          gap: 0;
        }

        body[data-route="student"].sidebar-collapsed .student-shell {
          grid-template-columns: minmax(0, 1fr);
        }

        body[data-route="student"] .student-sidebar {
          position: fixed;
          top: 0;
          left: 0;
          height: 100vh;
          height: 100dvh;
          width: min(360px, 90vw);
          padding: 16px;
          background: var(--bg-surface);
          border-right: 1px solid var(--border);
          box-shadow: var(--shadow-card);
          transform: translateX(-110%);
          opacity: 0;
          visibility: hidden;
          pointer-events: none;
          transition: transform 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
          z-index: 45;
        }

        body[data-route="student"].tools-open .student-sidebar {
          transform: translateX(0);
          opacity: 1;
          visibility: visible;
          pointer-events: auto;
        }

        body[data-route="student"] .sidebar-scroll-region {
          padding-bottom: calc(16px + var(--safe-bottom));
        }

        body[data-route="student"] .chat-log {
          min-height: 0;
        }

        body[data-route="student"] #sidebarDrawerToggle,
        body[data-route="student"] #toolsToggle {
          display: inline-flex;
        }
      }

      @media (max-width: 640px) {
        body[data-route="student"] .student-shell {
          padding: 12px;
        }

        body[data-route="student"] .workspace-header {
          padding: 4px 4px 0;
        }

        body[data-route="student"] .workspace-header__title {
          font-size: 14px;
        }

        body[data-route="student"] .workspace-tools-btn {
          padding: 6px 10px;
          font-size: 12px;
        }

        body[data-route="student"] .chat-log {
          padding: 12px;
          padding-bottom: calc(var(--composer-height) + 20px);
        }

        body[data-route="student"] .chat-composer {
          padding-bottom: calc(14px + var(--safe-bottom));
        }

        body[data-route="student"] .student-sidebar {
          width: min(320px, 92vw);
        }
      }

      @media (prefers-reduced-motion: reduce) {
        * {
          transition: none !important;
          animation: none !important;
          scroll-behavior: auto !important;
        }
      }

/* -------------------------------------------------------------
   Premium UI overrides
------------------------------------------------------------- */
html,
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}

body {
  letter-spacing: 0.002em;
  font-size: var(--text-md);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(1100px 580px at 0% -20%, color-mix(in srgb, var(--color-accent) 10%, transparent), transparent 60%),
    radial-gradient(900px 440px at 100% -24%, color-mix(in srgb, var(--color-accent) 8%, transparent), transparent 62%),
    linear-gradient(180deg, color-mix(in srgb, var(--color-surface) 40%, transparent), transparent 30%);
}

.app-root {
  min-height: 100dvh;
}

.card,
.sidebar-card,
.pipeline-card,
.library-modal,
.quiz-card,
.response-card,
.pipeline-step,
.pipeline-active,
.pipeline-history,
.library-toast,
.student-login-modal,
.faculty-login-card {
        background: var(--surface-pearl);
        border: 1px solid var(--color-border);
        box-shadow: var(--shadow-inset), var(--shadow-sm);
        border-radius: var(--radius-lg);
}

.card,
.sidebar-card,
.pipeline-card,
.pipeline-step,
.pipeline-active,
.pipeline-history,
.library-modal,
.quiz-card,
.response-card {
  backdrop-filter: blur(6px);
}

.section-label {
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-soft);
  font-weight: 700;
  margin: var(--space-2) 0 var(--space-1);
}

.btn {
        border-radius: var(--radius-md);
        padding: 10px var(--space-4);
        font-weight: 700;
        cursor: pointer;
        border: 1px solid var(--btn-border);
        transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
        --btn-bg: var(--surface-pearl);
        --btn-border: var(--color-border);
        --btn-text: var(--text-heading);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: var(--space-2);
        background: var(--btn-bg);
        color: var(--btn-text);
        font-size: var(--text-sm);
        line-height: 1.25;
        text-decoration: none;
        box-shadow: var(--shadow-inset);
        min-height: 40px;
}

.btn:hover {
        background: var(--surface-mint-hover);
        border-color: var(--border-mint-hover);
}

.btn.btn-primary {
        --btn-bg: var(--action-primary);
        --btn-border: var(--border-mint-hover);
        --btn-text: #f6ffff;
        box-shadow: var(--shadow-inset), var(--shadow-mint);
}

.btn.btn-primary:hover {
        box-shadow: var(--shadow-inset), var(--shadow-md);
        background: var(--action-primary);
        filter: brightness(1.05);
}

.btn.btn-ghost {
        --btn-bg: var(--surface-pearl);
        --btn-border: var(--color-border);
  --btn-text: var(--text-supporting);
}

.btn.btn-ghost:hover {
        --btn-text: var(--text-heading);
        --btn-bg: var(--surface-mint-hover);
        background: var(--surface-mint-hover);
}

.btn.btn-danger {
        --btn-bg: color-mix(in srgb, var(--color-danger) 12%, var(--color-surface));
        --btn-border: color-mix(in srgb, var(--color-danger) 48%, transparent);
  --btn-text: var(--color-danger);
}

.btn.btn-danger:hover {
  background: color-mix(in srgb, var(--color-danger) 18%, var(--color-surface));
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.btn.btn-mini {
        min-height: 34px;
        padding: 7px var(--space-3);
        font-size: var(--text-xs);
        border-radius: var(--radius-sm);
}

.icon-btn {
        width: 40px;
        height: 40px;
        border-radius: var(--radius-md);
        border: 1px solid var(--color-border);
        background: var(--surface-pearl);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
        color: var(--text-secondary);
        box-shadow: var(--shadow-inset);
}

.icon-btn:hover {
        border-color: var(--border-mint-hover);
        background: var(--surface-mint-hover);
        transform: none;
        color: var(--text-heading);
}

input:not([type="checkbox"]):not([type="radio"]),
textarea,
select,
.sidebar-input,
.sidebar-select,
.conversation-search,
.chat-input,
.composer-mode-select {
        width: 100%;
        border-radius: var(--radius-md);
        border: 1px solid var(--color-border);
        background: var(--surface-pearl);
        color: var(--text-heading);
        font: inherit;
        padding: 0.62rem 0.75rem;
        min-height: 40px;
        box-shadow: var(--shadow-inset);
        line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-placeholder);
}

input:hover,
textarea:hover,
select:hover,
.sidebar-input:hover,
.sidebar-select:hover,
.chat-input:hover {
  border-color: color-mix(in srgb, var(--color-accent) 36%, var(--color-border) 64%);
}

.student-shell {
  gap: var(--space-5);
  padding: var(--space-5);
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.student-sidebar {
  background: color-mix(in srgb, var(--color-surface) 90%, var(--color-surface-2) 10%);
  border: 1px solid color-mix(in srgb, var(--color-border) 68%, transparent);
  border-radius: calc(var(--radius-lg) + 2px);
  box-shadow: var(--shadow-md);
  padding: var(--space-3);
}

.sidebar-scroll-region {
  display: grid;
  gap: var(--space-3);
  padding-right: var(--space-1);
}

.brand-card {
  background: linear-gradient(150deg, color-mix(in srgb, var(--color-surface) 90%, var(--color-accent) 10%), var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--color-border) 45%, var(--color-accent) 55%);
  box-shadow: 0 12px 24px color-mix(in srgb, var(--color-accent) 18%, transparent);
}

.brand-row {
  align-items: center;
}

.brand-wordmark {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.07em;
}

.brand-subtitle {
  margin-top: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.brand-powered {
  margin-top: var(--space-2);
  color: var(--text-soft);
  font-size: var(--text-xs);
}

.sidebar-rail {
  gap: var(--space-2);
  padding: var(--space-2);
}

.sidebar-bubble {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--color-surface-2) 80%, transparent);
  font-size: 1rem;
  box-shadow: none;
}

.sidebar-bubble:hover {
  border-color: color-mix(in srgb, var(--color-accent) 46%, transparent);
  background: color-mix(in srgb, var(--color-surface-2) 64%, var(--color-accent) 36%);
}

.sidebar-card {
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.card-header {
  margin-bottom: var(--space-3);
}

.card-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
}

.sidebar-panel-body {
  display: grid;
  gap: var(--space-3);
}

.student-settings-control {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-3);
        padding: 10px 12px;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        background: var(--surface-pearl);
        box-shadow: var(--shadow-inset);
}

.student-settings-control__label-wrap {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.student-settings-control__label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
}

.student-settings-control__value {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-soft);
}

.student-settings-control__actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 0 auto;
}

.student-settings-control__btn {
  min-width: 40px;
  min-height: 38px;
  padding-inline: 0;
  justify-content: center;
}

.settings-text-scale.settings-text-scale--compact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
}

.settings-text-scale__meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.settings-text-scale__value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.settings-text-scale__buttons {
        display: inline-grid;
        grid-auto-flow: column;
        align-items: center;
        gap: 6px;
        padding: 4px;
        border-radius: 12px;
        border: 1px solid var(--color-border);
        background: var(--surface-pearl);
}

.settings-text-scale__button {
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.student-library__selected {
        border: 1px solid var(--border-mint);
        border-radius: var(--radius-md);
        padding: var(--space-3);
        background: var(--surface-mint);
        display: flex;
        flex-direction: column;
        box-shadow: var(--shadow-inset);
}

.student-library__list,
.library-manager__list,
.library-course-list,
.saved-list {
  display: grid;
  gap: var(--space-2);
}

.student-library__item,
.library-manager__row,
.library-course-row,
.saved-item,
.source-row,
.references-list > * {
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        background: var(--surface-pearl);
        padding: var(--space-3) var(--space-4);
        box-shadow: var(--shadow-inset);
}

.student-library__item:hover,
.library-manager__row:hover,
.library-course-row:hover,
.saved-item:hover,
.source-row:hover {
        border-color: var(--border-mint-hover);
        background: var(--surface-mint-hover);
}

.student-library__item.is-active,
.library-course-row.is-active,
.saved-item.active {
        border-color: var(--border-mint);
        background: var(--surface-mint);
        box-shadow: var(--shadow-inset), var(--shadow-sm);
}

.workspace-header {
  position: sticky;
  top: 0;
  z-index: 8;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}

.workspace-header.workspace-header--brand {
  background: linear-gradient(150deg, color-mix(in srgb, var(--color-surface) 90%, var(--color-accent) 10%), var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--color-border) 45%, var(--color-accent) 55%);
  box-shadow: 0 12px 24px color-mix(in srgb, var(--color-accent) 18%, transparent);
}

.workspace-header__title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.chat-column,
.chat-pane {
  gap: var(--space-4);
}

.chat-log {
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-surface) 78%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-border) 62%, transparent);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
  gap: var(--space-4);
}

.chat-log[data-empty="true"]::before {
  color: var(--text-soft);
  font-size: var(--text-sm);
}

.bubble {
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}

.bubble.user {
        margin-left: auto;
        background: var(--surface-mint);
        border: 1px solid var(--border-mint);
        color: var(--text-heading);
        box-shadow: var(--shadow-inset), var(--shadow-sm);
}

.bubble.assistant {
        margin-right: auto;
        background: var(--surface-pearl);
        border: 1px solid var(--color-border);
        box-shadow: var(--shadow-inset), var(--shadow-sm);
        width: min(100%, calc(var(--reading-max-width) + 7.5rem));
}

.bubble.error {
  border-color: color-mix(in srgb, var(--color-danger) 58%, transparent);
  background: color-mix(in srgb, var(--color-danger) 10%, var(--color-surface));
}

.response-card {
  border: none;
  box-shadow: none;
  background: transparent;
}

.response-header {
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 78%, transparent);
}

.response-toolbar-row {
  gap: var(--space-2);
}

.response-action,
.response-sources,
.reference-chip,
.chip-btn,
.toc-item,
.status-pill {
        border-radius: 999px;
        border: 1px solid var(--color-border);
        background: var(--surface-pearl);
        color: var(--text-secondary);
}

.response-action,
.response-sources,
.reference-chip,
.chip-btn,
.toc-item {
  min-height: 30px;
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
  font-weight: 700;
}

.response-action:hover,
.response-sources:hover,
.reference-chip:hover,
.chip-btn:hover,
.toc-item:hover {
        color: var(--text-heading);
        border-color: var(--border-mint-hover);
        background: var(--surface-mint-hover);
}

.composer-card,
.chat-composer {
  position: sticky;
  bottom: 0;
  z-index: 7;
  border: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-surface) 90%, transparent);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  padding: var(--space-3);
}

.chat-composer.is-dragging-files {
  border-color: color-mix(in srgb, var(--color-accent) 58%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent) 18%, transparent), var(--shadow-md);
}

.chat-composer.is-dragging-files .composer-field {
  border-color: color-mix(in srgb, var(--color-accent) 52%, transparent);
  background: color-mix(in srgb, var(--color-surface) 82%, var(--color-accent) 18%);
}

.active-lecture-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 32%, transparent);
  background: color-mix(in srgb, var(--color-surface) 86%, var(--color-accent) 14%);
  color: var(--color-text);
}

.active-lecture-banner__label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
}

.active-lecture-banner__prefix {
  flex: 0 0 auto;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: none;
}

.active-lecture-banner__copy {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-lecture-banner__close,
.active-lecture-banner .close-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 38%, transparent);
  background: color-mix(in srgb, var(--color-surface) 78%, transparent);
  color: var(--color-text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.active-lecture-banner__close:hover,
.active-lecture-banner__close:focus-visible {
  border-color: color-mix(in srgb, var(--color-accent) 54%, transparent);
  background: color-mix(in srgb, var(--color-surface-2) 64%, var(--color-accent) 36%);
  outline: none;
}

body.active-lecture-mode .chat-composer .composer-field {
  border-color: color-mix(in srgb, var(--color-accent) 68%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent) 16%, transparent);
}

.composer-row {
  gap: var(--space-3);
}

.composer-field {
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--color-border) 78%, transparent);
  background: color-mix(in srgb, var(--color-surface) 92%, var(--color-surface-2) 8%);
  padding: var(--space-2);
  gap: var(--space-2);
}

.chat-input {
  border: none;
  background: transparent;
  box-shadow: none;
  min-height: 50px;
  padding: var(--space-2) var(--space-1);
  line-height: 1.5;
}

.chat-input:focus,
.chat-input:focus-visible {
  outline: none;
  box-shadow: none;
}

.composer-attach-btn {
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-surface-2) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-border) 64%, transparent);
  color: var(--text-secondary);
}

.composer-attach-btn:hover {
  color: var(--color-text);
  border-color: color-mix(in srgb, var(--color-accent) 46%, transparent);
  background: color-mix(in srgb, var(--color-surface-2) 54%, var(--color-accent) 46%);
}

.sources-overlay,
.quiz-overlay,
.tools-overlay,
.library-modal-overlay {
  background: var(--overlay-bg);
  backdrop-filter: blur(3px);
}

.sources-drawer {
  width: min(460px, 100vw);
  background: color-mix(in srgb, var(--color-surface) 90%, transparent);
  border-left: 1px solid color-mix(in srgb, var(--color-border) 78%, transparent);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4);
}

.sources-drawer__header {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 80%, transparent);
}

.sources-drawer__title {
  font-size: var(--text-lg);
  font-weight: 700;
}

.sources-drawer__search {
  margin: var(--space-3) 0;
}

.sources-drawer__list {
  display: grid;
  gap: var(--space-3);
}

.source-row {
  padding: var(--space-3);
  display: grid;
  gap: var(--space-2);
}

.source-meta,
.source-domain,
.source-url,
.sources-domain,
.sources-empty {
  color: var(--text-soft);
  font-size: var(--text-xs);
}

.source-title,
.sources-link {
  color: var(--color-text);
  font-weight: 700;
  text-decoration: none;
}

.source-actions .sources-link,
.sources-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 var(--space-3);
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-surface-2) 64%, var(--color-accent) 36%);
  border: 1px solid color-mix(in srgb, var(--color-accent) 42%, transparent);
}

.quiz-modal {
  width: min(980px, calc(100vw - var(--space-6)));
  max-height: min(90dvh, 860px);
  border: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.quiz-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 78%, transparent);
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  backdrop-filter: blur(8px);
}

.quiz-header__content {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: var(--space-2);
}

.quiz-header__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-left: auto;
}

.quiz-title {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.quiz-subtitle {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.quiz-progress {
  display: grid;
  gap: var(--space-2);
}

.quiz-progress__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.quiz-progress__track {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-surface-2) 86%, transparent);
  overflow: hidden;
}

.quiz-progress__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-strong));
}

.quiz-body {
  padding: var(--space-4) var(--space-5) var(--space-5);
  display: grid;
  gap: var(--space-4);
  background: color-mix(in srgb, var(--color-surface-2) 52%, transparent);
}

.quiz-faculty-gate {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  overflow: auto;
  background: color-mix(in srgb, var(--color-surface) 58%, transparent);
  backdrop-filter: blur(10px);
}

.quiz-faculty-gate[hidden] {
  display: none;
}

.quiz-faculty-gate__card {
  width: min(560px, 100%);
  max-height: 100%;
  overflow: auto;
  display: grid;
  gap: var(--space-4);
  padding: clamp(var(--space-4), 4vw, var(--space-6));
  border: 1px solid color-mix(in srgb, var(--color-border) 78%, transparent);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
}

.quiz-faculty-gate__header,
.quiz-faculty-gate__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.quiz-faculty-gate__title {
  margin: var(--space-1) 0 0;
  color: var(--color-text);
  font-size: var(--text-xl);
  line-height: 1.2;
}

.quiz-faculty-gate__message,
.quiz-faculty-gate__hint {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.55;
}

.quiz-faculty-gate__summary {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1.3fr);
  border: 1px solid color-mix(in srgb, var(--color-border) 76%, transparent);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: color-mix(in srgb, var(--color-surface-2) 70%, transparent);
}

.quiz-faculty-gate__summary dt,
.quiz-faculty-gate__summary dd {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 66%, transparent);
}

.quiz-faculty-gate__summary dt {
  color: var(--text-soft);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.quiz-faculty-gate__summary dd {
  color: var(--color-text);
  font-weight: 650;
}

.quiz-faculty-gate__summary :is(dt, dd):nth-last-child(-n + 2) {
  border-bottom: 0;
}

.quiz-faculty-gate__panel,
.quiz-faculty-gate__dev {
  display: grid;
  gap: var(--space-3);
}

.quiz-faculty-gate__panel[hidden],
.quiz-faculty-gate__dev[hidden] {
  display: none;
}

.quiz-faculty-gate__field {
  display: grid;
  gap: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 700;
}

.quiz-faculty-gate__sso,
.quiz-faculty-generate-btn {
  justify-self: start;
}

.quiz-faculty-gate__error {
  padding: var(--space-3);
  border: 1px solid color-mix(in srgb, var(--color-danger) 45%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-danger) 10%, var(--color-surface));
  color: var(--color-danger);
  font-size: var(--text-sm);
}

.quiz-faculty-gate__error[hidden] {
  display: none;
}

.quiz-faculty-gate__actions {
  justify-content: flex-end;
  padding-top: var(--space-1);
}

.quiz-set {
  display: grid;
  gap: var(--space-4);
}

.quiz-set-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.quiz-question {
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-border) 68%, transparent);
}

.quiz-question-title {
  font-size: var(--text-sm);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: var(--space-2);
}

.question-anki-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2, 8px);
  margin-bottom: var(--space-2, 8px);
}
.question-anki-heading > :first-child { min-width: 0; margin: 0; }
.question-anki-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 1px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  cursor: pointer;
}
.question-anki-button img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
  object-position: center;
}
.question-anki-button:hover { background: var(--color-surface-hover, var(--color-bg)); }
.question-anki-button:focus-visible,
.question-anki-dialog :focus-visible { outline: 3px solid var(--color-primary, #54aaa4); outline-offset: 3px; }
.question-anki-dialog {
  box-sizing: border-box;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 14px);
  background: var(--color-surface, white);
  color: var(--color-text, #1e293b);
  box-shadow: 0 16px 60px #0004;
  text-align: left;
  font: 400 14px/1.5 var(--font-sans, system-ui, sans-serif);
  letter-spacing: normal;
  text-transform: none;
}
.question-anki-dialog::backdrop { background: #101c2c66; }
.question-anki-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.question-anki-dialog h2 { margin: 0; font-size: 18px; line-height: 1.3; }
.question-anki-dialog button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
}
.question-anki-dialog .question-anki-copy { background: var(--color-primary, #54aaa4); color: #071b1a; font-weight: 700; }
.question-anki-id strong, .question-anki-id code { display: block; }
.question-anki-id code { margin-top: 4px; overflow-wrap: anywhere; user-select: text; }
.question-anki-search {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg, #f5f8f8);
  color: var(--color-text);
  font: 13px/1.6 monospace;
  resize: vertical;
  overflow-wrap: anywhere;
  user-select: text;
}
.question-anki-status { margin-bottom: 0; }
.question-anki-status:empty { display: none; }

.quiz-question-stem {
  margin: 0 0 var(--space-4);
  font-size: var(--text-md);
  line-height: 1.66;
  color: var(--color-text);
}

.quiz-text-highlight {
  padding: 0 0.08em;
  border-radius: 0.18em;
  background: #ffe27a;
  color: #2b2300;
  box-shadow: inset 0 -1px 0 rgba(128, 91, 0, 0.34);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  cursor: pointer;
  user-select: text;
}

.quiz-text-highlight:hover {
  background: #ffd75a;
}

.quiz-text-highlight:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

:root[data-theme="dark"] .quiz-text-highlight,
body.theme-dark .quiz-text-highlight {
  background: #675716;
  color: #fff3b2;
  box-shadow: inset 0 -1px 0 rgba(255, 222, 102, 0.64);
}

:root[data-theme="dark"] .quiz-text-highlight:hover,
body.theme-dark .quiz-text-highlight:hover {
  background: #796719;
}

.quiz-highlight-action {
  position: absolute;
  z-index: 7;
  transform: translate(-50%, -100%);
  padding: 3px;
  border: 1px solid color-mix(in srgb, var(--color-warning) 46%, var(--color-border));
  border-radius: 999px;
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.quiz-highlight-action[hidden] {
  display: none;
}

.quiz-highlight-action__button {
  min-height: 30px;
  border-color: transparent;
  border-radius: 999px;
  background: color-mix(in srgb, #f4c430 38%, var(--color-surface));
  color: var(--color-text);
  font-weight: 800;
}

.quiz-highlight-action__button:hover {
  background: color-mix(in srgb, #f4c430 54%, var(--color-surface));
}

.quiz-clear-highlights-btn {
  white-space: nowrap;
}

.quiz-options {
  display: grid;
  gap: var(--space-2);
}

.quiz-option {
  position: relative;
  justify-content: flex-start;
  width: 100%;
  min-height: 50px;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--color-border) 74%, transparent);
  background: color-mix(in srgb, var(--color-surface-2) 64%, transparent);
  padding: var(--space-3) var(--space-4) var(--space-3) calc(var(--space-4) + 10px);
  text-align: left;
  gap: var(--space-3);
}

.quiz-option::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px 0;
  width: 4px;
  border-radius: 999px;
  background: transparent;
}

.quiz-option:hover {
  border-color: color-mix(in srgb, var(--color-accent) 48%, transparent);
  background: color-mix(in srgb, var(--color-surface-2) 48%, var(--color-accent) 52%);
}

.quiz-option.is-correct {
  border-color: color-mix(in srgb, var(--color-success) 62%, transparent);
  background: color-mix(in srgb, var(--color-success) 18%, var(--color-surface));
}

.quiz-option.is-correct::before {
  background: var(--color-success);
}

.quiz-option.is-incorrect {
  border-color: color-mix(in srgb, var(--color-danger) 56%, transparent);
  background: color-mix(in srgb, var(--color-danger) 12%, var(--color-surface));
}

.quiz-option.is-incorrect::before {
  background: var(--color-danger);
}

.quiz-option-bubble {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--color-border) 50%, transparent);
  background: var(--color-surface);
}

.quiz-option-text {
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-text);
}

.quiz-option.is-explanation-active {
  outline: 2px solid color-mix(in srgb, var(--color-accent) 74%, transparent);
  outline-offset: 2px;
}

.quiz-option.is-explanation-active:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--focus-ring);
}

.quiz-option-status {
  display: block;
  grid-column: 2;
  margin-top: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.35;
}

.quiz-option-status:empty {
  display: none;
}

/* Sibling controls preserve the full answer card and isolate personal annotations. */
.quiz-option-row,
.practice-attempt__option-row {
  position: relative;
  min-width: 0;
}

.quiz-option-row > .quiz-option {
  min-height: 56px;
  padding-inline-end: 62px;
  overflow-wrap: anywhere;
}

.quiz-choice-crossout {
  position: absolute;
  inset-inline-end: 9px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  touch-action: manipulation;
  transition: color var(--dur-1), background-color var(--dur-1), border-color var(--dur-1);
}

.quiz-choice-crossout svg {
  display: block;
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.quiz-choice-crossout:hover:not(:disabled) {
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-muted) 10%, transparent);
}

.quiz-choice-crossout[aria-pressed="true"] {
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-muted) 13%, transparent);
  border-color: color-mix(in srgb, var(--color-muted) 24%, transparent);
}

.quiz-choice-crossout:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.quiz-choice-crossout:disabled {
  cursor: default;
}

.quiz-option.is-eliminated .quiz-option-text,
.practice-attempt__choice.is-eliminated .practice-attempt__choice-letter,
.practice-attempt__choice.is-eliminated .practice-attempt__choice-text,
.practice-attempt__review-choice.is-eliminated .practice-attempt__choice-letter,
.practice-attempt__review-choice.is-eliminated .practice-attempt__choice-text {
  color: var(--color-muted);
  text-decoration-line: line-through;
  text-decoration-thickness: 1.3px;
}

.quiz-explanation,
.quiz-references {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
}

.quiz-explanation {
  display: grid;
  gap: var(--space-2);
  overflow-wrap: anywhere;
}

.quiz-explanation[hidden] {
  display: none;
}

.quiz-explanation-heading {
  color: var(--color-text);
  font-weight: 800;
}

.quiz-explanation-submitted {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 700;
}

.quiz-explanation-text {
  white-space: pre-wrap;
}

.quiz-set-results {
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--color-accent) 36%, transparent);
  background: color-mix(in srgb, var(--color-surface) 76%, var(--color-accent) 24%);
  padding: var(--space-3) var(--space-4);
  display: grid;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 700;
}

.quiz-stored-set-status {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.45;
  margin-inline-end: auto;
}

.quiz-faculty-generate-btn {
  white-space: nowrap;
}

.quiz-warning,
.quiz-error {
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

.quiz-warning {
  background: color-mix(in srgb, var(--color-warning) 12%, var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--color-warning) 46%, transparent);
}

.quiz-error {
  background: color-mix(in srgb, var(--color-danger) 12%, var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--color-danger) 48%, transparent);
}

.faculty-shell {
  min-height: 100dvh;
  background: var(--color-bg);
  color: var(--color-text);
}

.faculty-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--space-3) var(--space-5);
        border-bottom: 1px solid var(--color-border);
        background: var(--surface-pearl);
        position: sticky;
        top: var(--space-3);
        z-index: 10;
        margin: var(--space-4) var(--space-5) 0;
        border-radius: var(--radius-lg);
        border: 1px solid var(--border-mint);
        box-shadow: var(--shadow-inset), var(--shadow-sm);
        backdrop-filter: blur(8px);
        gap: var(--space-4);
}

.faculty-title-stack .eyebrow {
        font-size: var(--text-sm);
        letter-spacing: 0;
        text-transform: none;
        color: var(--text-supporting);
        font-weight: 500;
        border-left: 1px solid var(--border-mint);
        padding-left: var(--space-4);
}

.faculty-title-stack .title {
        font-size: clamp(1.5rem, 1.2rem + 0.65vw, 1.85rem);
        font-weight: 700;
        letter-spacing: 0.02em;
        font-family: var(--font-display);
        color: var(--color-text);
}

.faculty-content {
  padding: var(--space-5);
  gap: var(--space-5);
}

.pipeline-active {
        display: flex;
        flex-direction: column;
        gap: 14px;
        padding: var(--space-5);
        border-radius: var(--radius-xl);
        border: 1px solid var(--color-border);
        background: var(--surface-mint);
        box-shadow: var(--shadow-inset), var(--shadow-mint);
        margin-bottom: 20px;
        border-color: var(--border-mint);
}

.pipeline-active__title {
        font-size: clamp(1.25rem, 1.12rem + 0.4vw, 1.6rem);
        font-weight: 800;
        color: var(--text-heading);
        letter-spacing: -0.025em;
        line-height: 1.3;
}

.pipeline-active__subtitle {
        font-size: var(--text-sm);
        color: var(--text-supporting);
}

.pipeline-auto-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: var(--space-2) var(--space-3);
        border-radius: 999px;
        border: 1px solid var(--border-mint);
        background: var(--surface-pearl);
        font-size: 12px;
        color: var(--text-heading);
        box-shadow: var(--shadow-inset);
}

.pipeline-tracker {
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: var(--space-2);
        position: relative;
        padding: var(--space-3);
        border-radius: var(--radius-md);
        background: var(--surface-pearl);
        border: 1px solid var(--color-border);
        box-shadow: var(--shadow-inset);
}

.pipeline-console-stepper {
  display: grid;
  gap: var(--space-3);
}

.pipeline-tracker::before {
  content: "";
  position: absolute;
  left: calc(var(--space-3) + 12px);
  right: calc(var(--space-3) + 12px);
  top: 34px;
  height: 1px;
  background: color-mix(in srgb, var(--color-border) 90%, transparent);
  z-index: 0;
}

.pipeline-tracker__step {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: var(--space-2);
        border-radius: var(--radius-md);
        border: 1px solid var(--color-border);
        background: var(--surface-pearl);
        min-height: 86px;
        position: relative;
        z-index: 1;
        box-shadow: var(--shadow-inset);
        color: var(--text-heading);
}

.pipeline-tracker__icon {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        border: 1px solid var(--border-mint);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
        background: var(--surface-mint);
        box-shadow: var(--shadow-inset);
}

.pipeline-tracker__step[data-status="running"],
details.pipeline-step[data-status="running"] {
  border-color: color-mix(in srgb, var(--color-warning) 58%, transparent);
  background: color-mix(in srgb, var(--color-warning) 10%, var(--color-surface));
}

.pipeline-tracker__step[data-status="succeeded"],
details.pipeline-step[data-status="succeeded"] {
  border-color: color-mix(in srgb, var(--color-success) 58%, transparent);
  background: color-mix(in srgb, var(--color-success) 12%, var(--color-surface));
}

.pipeline-tracker__step[data-status="failed"],
details.pipeline-step[data-status="failed"] {
  border-color: color-mix(in srgb, var(--color-danger) 56%, transparent);
  background: color-mix(in srgb, var(--color-danger) 11%, var(--color-surface));
}

.pipeline-layout {
  gap: var(--space-5);
}

.pipeline-steps {
  display: grid;
  gap: var(--space-3);
}

details.pipeline-step {
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        background: var(--surface-pearl);
        box-shadow: var(--shadow-soft);
        display: flex;
        flex-direction: column;
        min-width: 0;
        padding: 0;
        overflow: hidden;
}

details.pipeline-step[open] {
        background: var(--owen-warm-white-soft);
        box-shadow: var(--shadow-inset), var(--shadow-sm);
        border-color: var(--border-mint);
}

.pipeline-step__summary {
        list-style: none;
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 12px;
        row-gap: 8px;
        padding: var(--space-4);
        cursor: pointer;
        background: var(--surface-pearl);
}

.pipeline-step__body {
  padding: var(--space-4);
  display: grid;
  gap: var(--space-3);
}

.pipeline-step-title {
        font-weight: 800;
        line-height: 1.3;
        font-size: var(--text-md);
        color: var(--text-heading);
}

.pipeline-step-meta {
  color: var(--text-soft);
  font-size: var(--text-xs);
}

.pipeline-status-pill,
.status-pill,
.library-status-chip,
.anki-status-pill,
.status-tag {
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-border) 78%, transparent);
  background: color-mix(in srgb, var(--color-surface-2) 74%, transparent);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 0.2rem 0.56rem;
}

.pipeline-status-pill[data-status="running"],
.status-pill[data-state="warning"] {
  border-color: color-mix(in srgb, var(--color-warning) 62%, transparent);
  background: color-mix(in srgb, var(--color-warning) 14%, var(--color-surface));
  color: color-mix(in srgb, var(--color-warning) 70%, var(--color-text));
}

.pipeline-status-pill[data-status="succeeded"],
.status-pill[data-state="success"] {
  border-color: color-mix(in srgb, var(--color-success) 62%, transparent);
  background: color-mix(in srgb, var(--color-success) 14%, var(--color-surface));
  color: color-mix(in srgb, var(--color-success) 75%, var(--color-text));
}

.pipeline-status-pill[data-status="failed"],
.status-pill[data-state="error"] {
  border-color: color-mix(in srgb, var(--color-danger) 62%, transparent);
  background: color-mix(in srgb, var(--color-danger) 14%, var(--color-surface));
  color: color-mix(in srgb, var(--color-danger) 72%, var(--color-text));
}

.pipeline-history {
  padding: var(--space-3);
  background: var(--surface-pearl);
  box-shadow: var(--shadow-inset);
  border: 1px solid var(--color-border);
  scroll-margin-top: 110px;
}

.pipeline-history__header,
.pipeline-history__row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  align-items: center;
}

.pipeline-history__list {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.pipeline-history__item {
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        padding: var(--space-3);
        background: var(--surface-pearl);
        display: flex;
        flex-direction: column;
        gap: 4px;
        box-shadow: var(--shadow-inset);
}

.pipeline-sidebar {
  gap: var(--space-3);
}

.lecture-library-card,
.pipeline-card--library {
  border-radius: var(--radius-lg);
}

.library-modal {
        position: fixed;
        inset: 50% auto auto 50%;
        transform: translate(-50%, -50%);
        width: min(620px, calc(100vw - 2rem));
        max-height: calc(100dvh - 2rem);
        background: var(--surface-pearl);
        border: 1px solid var(--border-mint);
        box-shadow: var(--shadow-inset), var(--shadow-lg);
        border-radius: var(--radius-xl);
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: var(--space-5);
        z-index: 75;
        overflow: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
}

.library-modal__header,
.library-modal__footer {
  padding: 0;
  margin-bottom: var(--space-3);
}

.library-modal__footer {
  margin-top: var(--space-4);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.library-toast {
        position: fixed;
        right: 20px;
        bottom: 20px;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 14px;
        border-radius: 14px;
        border: 1px solid var(--border-mint);
        background: var(--surface-mint);
        box-shadow: var(--shadow-inset), var(--shadow-mint);
        z-index: 85;
        font-size: 13px;
}

@media (max-width: 1260px) {
  .pipeline-tracker {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .pipeline-tracker::before {
    display: none;
  }
}

@media (max-width: 1024px) {
  .student-shell {
    padding: var(--space-4);
  }

  .chat-log {
    padding: var(--space-4);
  }

  .quiz-modal {
    width: min(100vw - var(--space-4), 980px);
    max-height: min(92dvh, 920px);
  }

  .faculty-content,
  .faculty-topbar {
    margin-left: var(--space-4);
    margin-right: var(--space-4);
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

@media (max-width: 720px) {
  .student-shell,
  .faculty-content {
    padding: var(--space-3);
  }

  .workspace-header,
  .chat-log,
  .chat-composer,
  .student-sidebar,
  .pipeline-active,
  .pipeline-step,
  .pipeline-card,
  .library-modal,
  .quiz-modal {
    border-radius: var(--radius-md);
  }

  .chat-log {
    padding: var(--space-3);
  }

  .quiz-header,
  .quiz-body {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  .quiz-faculty-gate {
    align-items: end;
    padding: var(--space-3);
  }

  .quiz-faculty-gate__card {
    width: 100%;
    border-radius: var(--radius-md);
  }

  .quiz-faculty-gate__summary {
    grid-template-columns: 1fr;
  }

  .quiz-faculty-gate__summary dt {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .quiz-faculty-gate__summary dd {
    padding-top: var(--space-1);
  }

  .quiz-faculty-gate__summary :is(dt, dd):nth-last-child(-n + 2) {
    border-bottom: 0;
  }

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

/* -------------------------------------------------------------
   Panel Mechanics + Layout Reliability
------------------------------------------------------------- */
body[data-route="student"] .student-workspace-grid {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0;
  gap: 0;
  padding: var(--space-4);
  transition: grid-template-columns var(--dur-3) var(--ease-standard), gap var(--dur-3) var(--ease-standard);
  position: relative;
}

body[data-route="student"].sources-open .student-workspace-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 27vw);
  gap: var(--space-4);
}

body[data-route="student"] .student-shell {
  grid-column: 1;
  min-height: 0;
  height: calc(100dvh - (var(--space-4) * 2));
  padding: 0;
  margin: 0;
  gap: var(--space-4);
  transition: grid-template-columns var(--dur-3) var(--ease-standard), gap var(--dur-3) var(--ease-standard);
}

body[data-route="student"] .chat-column,
body[data-route="student"] .chat-pane {
  min-width: 0;
}

body[data-route="student"] .conversation-lane {
  width: min(100%, 900px);
  min-width: 0;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

body[data-route="student"].focus-mode .conversation-lane {
  width: min(100%, 1180px);
}

body[data-route="student"] #sidebarCollapseToggle {
  display: inline-flex;
  pointer-events: auto;
  position: relative;
  z-index: 3;
}

body[data-route="student"] .student-sidebar.is-collapsed #sidebarCollapseToggle {
  margin-inline: auto;
}

body[data-route="student"] .student-sidebar {
  min-width: 0;
  overflow: hidden;
}

body[data-route="student"] .student-sidebar .sidebar-expanded {
  display: flex;
  flex-direction: column;
  opacity: 1;
  max-height: 4000px;
  overflow: hidden;
  transition: opacity var(--dur-2) var(--ease-standard), max-height var(--dur-3) var(--ease-standard);
}

body[data-route="student"] .student-sidebar .sidebar-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity var(--dur-2) var(--ease-standard), max-height var(--dur-3) var(--ease-standard);
}

body[data-route="student"] .student-sidebar.is-collapsed .sidebar-expanded {
  display: flex;
  opacity: 0;
  max-height: 0;
  pointer-events: none;
}

body[data-route="student"] .student-sidebar.is-collapsed .sidebar-rail {
  opacity: 1;
  max-height: 420px;
  pointer-events: auto;
}

body[data-route="student"].focus-mode .student-shell {
  grid-template-columns: 0 minmax(0, 1fr);
}

body[data-route="student"].focus-mode .student-sidebar {
  opacity: 0;
  border: none;
  box-shadow: none;
  padding: 0;
  width: 0;
  pointer-events: none;
}

body[data-route="student"] .student-workspace-grid > .sources-drawer {
  grid-column: 2;
  position: relative;
  top: auto;
  right: auto;
  left: auto;
  height: calc(100dvh - (var(--space-4) * 2));
  width: 100%;
  border-radius: var(--radius-lg);
  transform: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 50;
}

body[data-route="student"] .student-workspace-grid > .sources-drawer.is-open,
body[data-route="student"].sources-open .student-workspace-grid > .sources-drawer {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body[data-route="student"] .sources-overlay {
  z-index: 45;
}

body[data-route="student"] .sources-drawer__list {
  min-height: 0;
}

.bubble.library-error-bubble {
  border-color: color-mix(in srgb, var(--color-danger) 55%, transparent);
  background: color-mix(in srgb, var(--color-danger) 10%, var(--color-surface));
}

.library-error-callout {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--color-danger) 46%, transparent);
  background: color-mix(in srgb, var(--color-surface) 86%, var(--color-danger) 14%);
}

.library-error-callout__title {
  font-size: var(--text-sm);
  font-weight: 800;
  color: color-mix(in srgb, var(--color-danger) 74%, var(--color-text));
  letter-spacing: 0.02em;
}

.library-error-callout__body {
  color: var(--text-secondary);
  line-height: 1.55;
  font-size: var(--text-sm);
}

.library-error-callout__actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

@media (max-width: 1024px) {
  body[data-route="student"] .student-workspace-grid {
    display: block;
    padding: var(--space-4);
  }

  body[data-route="student"] .student-shell {
    height: auto;
    min-height: calc(100dvh - (var(--space-4) * 2));
  }

  body[data-route="student"] .conversation-lane {
    width: 100%;
    max-width: none;
  }

  body[data-route="student"] .student-workspace-grid > .sources-drawer {
    position: fixed;
    right: 0;
    top: 0;
    width: min(430px, 94vw);
    height: 100dvh;
    border-radius: 0;
    transform: translateX(104%);
    opacity: 1;
    visibility: hidden;
    pointer-events: none;
  }

  body[data-route="student"].sources-open .student-workspace-grid > .sources-drawer,
  body[data-route="student"] .student-workspace-grid > .sources-drawer.is-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }
}

@media (max-width: 640px) {
  body[data-route="student"] .student-workspace-grid {
    padding: var(--space-3);
  }

  body[data-route="student"] .student-shell {
    min-height: calc(100dvh - (var(--space-3) * 2));
  }

  body[data-route="student"] .student-workspace-grid > .sources-drawer {
    width: 100vw;
  }
}

/* -------------------------------------------------------------
   Pilot Deployment UI Additions
------------------------------------------------------------- */
.saved-placeholder {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}

.file-name-label {
  flex: 1 1 180px;
  min-width: 0;
  align-self: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-soft);
}

.field-inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.details-summary-advanced {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-soft);
}

.model-note {
  font-size: 12px;
  color: var(--text-soft);
}

.workspace-header__context {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.workspace-header__eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.workspace-header__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.workspace-header__meta {
  font-size: 13px;
  color: var(--text-secondary);
}

.workspace-header__title--brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.08em;
  flex-wrap: wrap;
}

.workspace-header__brand {
  font-family: var(--font-display);
  letter-spacing: 0.07em;
}

.workspace-header__brand-copy {
  font-family: var(--font-body);
}

.focus-sidebar-restore {
  position: absolute;
  top: var(--space-4);
  left: -16px;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  height: 48px;
  padding: 0 0 0 2px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-border) 58%, var(--color-accent) 42%);
  background: linear-gradient(150deg, color-mix(in srgb, var(--color-surface) 94%, var(--color-accent) 6%), color-mix(in srgb, var(--color-surface) 88%, var(--color-surface-2) 12%));
  color: var(--color-text);
  line-height: 0;
  overflow: visible;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--color-accent) 16%, transparent);
  backdrop-filter: blur(10px);
  transition: transform var(--dur-2) var(--ease-standard), border-color var(--dur-2) var(--ease-standard), box-shadow var(--dur-2) var(--ease-standard), background var(--dur-2) var(--ease-standard);
}

.focus-sidebar-restore svg {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  overflow: visible;
}

.focus-sidebar-restore:hover {
  transform: translateX(2px);
  border-color: color-mix(in srgb, var(--color-accent) 56%, var(--color-border) 44%);
  box-shadow: 0 14px 24px color-mix(in srgb, var(--color-accent) 20%, transparent);
}

.focus-sidebar-restore:focus-visible {
  outline: none;
  transform: translateX(2px);
  border-color: color-mix(in srgb, var(--color-accent) 60%, var(--color-border) 40%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 22%, transparent), 0 14px 24px color-mix(in srgb, var(--color-accent) 20%, transparent);
}

.workspace-context-btn {
  flex: 0 0 auto;
}

.workspace-utility-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
  background: color-mix(in srgb, var(--color-surface-2) 78%, transparent);
}

.student-empty-state {
  display: grid;
  align-content: start;
  align-items: start;
  gap: var(--space-4);
  min-height: min(440px, 62vh);
  padding: clamp(20px, 4vw, 36px);
}

.chat-log[data-empty="false"] > .student-empty-state {
  display: none;
}

.chat-log[data-empty="true"]::before {
  content: none;
  display: none;
}

.chat-jump-latest {
  position: absolute;
  right: var(--space-5);
  bottom: calc(var(--composer-height) + var(--space-6));
  z-index: 8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
  background: color-mix(in srgb, var(--color-surface) 94%, var(--color-accent) 6%);
  color: var(--color-text);
  box-shadow: var(--shadow-md);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
}

.chat-jump-latest:hover {
  border-color: color-mix(in srgb, var(--color-accent) 46%, var(--color-border) 54%);
  background: color-mix(in srgb, var(--color-surface) 90%, var(--color-accent) 10%);
}

.student-empty-state__hero {
  display: grid;
  gap: 12px;
  width: 100%;
}

.student-empty-state__hero-copy {
  display: grid;
  justify-items: start;
  gap: 14px;
}

.student-empty-state__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  flex: 0 0 auto;
  width: fit-content;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 34%, transparent);
  background: color-mix(in srgb, var(--color-accent) 12%, var(--color-surface));
  color: var(--color-accent-strong);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: none;
  transition: transform var(--dur-2) var(--ease-standard), box-shadow var(--dur-2) var(--ease-standard), border-color var(--dur-2) var(--ease-standard), background var(--dur-2) var(--ease-standard);
}

.student-empty-state__badge--tutorial {
  display: inline-grid;
  justify-items: start;
  align-content: center;
  gap: 4px;
  text-align: left;
}

.student-empty-state__tutorial-callout {
  position: relative;
  display: inline-flex;
  align-self: flex-start;
  max-width: min(100%, 22rem);
}

.student-empty-state__badge-label {
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.student-empty-state__badge-meta {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  opacity: 0.92;
}

.student-empty-state__title {
  flex: 1 1 16ch;
  max-width: 16ch;
  font-size: clamp(1.8rem, 1.45rem + 1vw, 2.45rem);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.03em;
}

.student-empty-state__body {
  max-width: 62ch;
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-md);
  line-height: 1.7;
}

.student-empty-state__body--instructions {
  white-space: pre-line;
}

.student-empty-state__body--secondary {
  color: var(--text-soft);
}

.student-empty-state__lecture {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--color-accent) 28%, transparent);
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface));
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 700;
}

.student-empty-state__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.active-lecture-banner__context {
  display: flex;
  align-items: center;
  min-width: 0;
}

.active-lecture-banner__eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.active-lecture-banner__path {
  color: var(--color-text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.active-lecture-banner__meta {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.active-lecture-banner__actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.active-lecture-banner__action {
  white-space: nowrap;
}

.active-lecture-banner__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-accent) 16%, var(--color-surface));
  color: var(--color-accent-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.student-guided-overlay {
  position: fixed;
  inset: 0;
  z-index: 2400;
  pointer-events: none;
  --student-guided-clear-left: 0px;
  --student-guided-clear-top: 0px;
  --student-guided-clear-right: 0px;
  --student-guided-clear-bottom: 0px;
}

.student-guided-overlay__backdrop {
  position: absolute;
  background: rgba(8, 15, 31, 0.3);
  backdrop-filter: blur(6px);
}

.student-guided-overlay__backdrop--full {
  inset: 0;
}

.student-guided-overlay__backdrop:not(.student-guided-overlay__backdrop--full) {
  display: none;
}

.student-guided-overlay[data-spotlight-scope="sidebar"][data-sidebar-backdrop="segmented"] .student-guided-overlay__backdrop--full {
  display: none;
}

.student-guided-overlay[data-spotlight-scope="sidebar"][data-sidebar-backdrop="segmented"] .student-guided-overlay__backdrop:not(.student-guided-overlay__backdrop--full) {
  display: block;
}

.student-guided-overlay[data-layout-mode="drawer"][data-spotlight-scope="sidebar"][data-sidebar-render-mode="drawer-clear"] .student-guided-overlay__backdrop {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.student-guided-overlay[data-spotlight-scope="sidebar"][data-sidebar-backdrop="segmented"] .student-guided-overlay__backdrop--top {
  inset: 0 0 calc(100% - var(--student-guided-clear-top)) 0;
}

.student-guided-overlay[data-spotlight-scope="sidebar"][data-sidebar-backdrop="segmented"] .student-guided-overlay__backdrop--left {
  inset:
    var(--student-guided-clear-top)
    calc(100% - var(--student-guided-clear-left))
    calc(100% - var(--student-guided-clear-bottom))
    0;
}

.student-guided-overlay[data-spotlight-scope="sidebar"][data-sidebar-backdrop="segmented"] .student-guided-overlay__backdrop--right {
  inset:
    var(--student-guided-clear-top)
    0
    calc(100% - var(--student-guided-clear-bottom))
    var(--student-guided-clear-right);
}

.student-guided-overlay[data-spotlight-scope="sidebar"][data-sidebar-backdrop="segmented"] .student-guided-overlay__backdrop--bottom {
  inset: var(--student-guided-clear-bottom) 0 0 0;
}

.student-guided-overlay__card {
  position: fixed;
  z-index: 2402;
  width: min(320px, calc(100vw - 32px));
  display: grid;
  gap: 12px;
  padding: 16px 18px 18px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 36%, transparent);
  background: color-mix(in srgb, var(--color-surface) 96%, rgba(255, 255, 255, 0.04));
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.18);
  pointer-events: auto;
  overscroll-behavior: contain;
}

.student-guided-overlay__card[data-card-mode="sheet"] {
  width: min(440px, calc(100vw - 24px - var(--safe-left) - var(--safe-right)));
  max-height: calc(100vh - 24px - var(--safe-top) - var(--safe-bottom));
  overflow: auto;
  padding: 16px 18px calc(18px + var(--safe-bottom));
  border-radius: 22px;
}

.student-guided-overlay__card[data-card-mode="sheet"][data-card-placement="upper-sheet"] {
  padding-top: calc(16px + var(--safe-top));
}

.student-guided-overlay__close {
  justify-self: end;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.student-guided-overlay__step {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.student-guided-overlay__body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text);
  white-space: pre-line;
}

.student-guided-overlay__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.student-guided-overlay__prev,
.student-guided-overlay__next {
  width: 36px;
  height: 36px;
  border: 1px solid color-mix(in srgb, #2563eb 48%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, #2563eb 10%, var(--color-surface));
  color: #2563eb;
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.student-guided-overlay__prev {
  border-color: color-mix(in srgb, var(--color-border) 72%, transparent);
  background: color-mix(in srgb, var(--color-surface-2) 58%, transparent);
  color: var(--text-secondary);
}

.student-guided-overlay__prev:disabled,
.student-guided-overlay__next:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}

.is-guided-spotlight {
  position: relative;
  z-index: 2401 !important;
}

@media (max-width: 720px) {
  .student-settings-control {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .student-settings-control__actions {
    width: 100%;
    justify-content: flex-end;
  }

  .settings-text-scale.settings-text-scale--compact {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-text-scale__buttons {
    justify-self: end;
  }
}

.faculty-login-card__eyebrow,
.faculty-dev-auth__eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.faculty-login-card__primary {
  display: grid;
  gap: 10px;
}

.faculty-login-card__sso {
  width: 100%;
}

.faculty-dev-auth {
        display: grid;
        gap: 12px;
        padding: var(--space-4);
        border-radius: var(--radius-lg);
        border: 1px solid var(--border-mint);
        background: var(--surface-pearl);
        box-shadow: var(--shadow-inset);
}

.faculty-dev-auth__header {
  display: grid;
  gap: 4px;
}

.faculty-dev-auth__copy {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.pipeline-run-next-helper {
  display: grid;
  gap: 4px;
  max-width: 240px;
}

.pipeline-run-next-helper[data-state="blocked"] {
  color: color-mix(in srgb, var(--color-warning) 80%, var(--color-text));
}

.pipeline-run-next-helper[data-state="running"] {
  color: color-mix(in srgb, var(--color-accent) 78%, var(--color-text));
}

.pipeline-run-next-helper[data-state="complete"] {
  color: color-mix(in srgb, var(--color-success) 78%, var(--color-text));
}

.pipeline-run-next-helper__meta {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.pipeline-run-next-helper__text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

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

.pipeline-summary-card {
        display: grid;
        gap: 8px;
        padding: var(--space-4);
        border-radius: var(--radius-lg);
        border: 1px solid var(--border-mint);
        background: var(--surface-pearl);
        min-width: 0;
        box-shadow: var(--shadow-inset);
}

.pipeline-summary-card__label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.pipeline-summary-card__value {
        font-size: var(--text-lg);
        font-weight: 800;
        color: var(--text-heading);
        line-height: 1.3;
        min-width: 0;
        font-variant-numeric: tabular-nums;
        overflow-wrap: anywhere;
}

.pipeline-summary-card__value--body {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.pipeline-summary-card[data-state="blocked"] {
  border-color: color-mix(in srgb, var(--color-warning) 44%, transparent);
  background: color-mix(in srgb, var(--color-warning) 10%, var(--color-surface));
}

.pipeline-summary-card[data-state="ready"] {
  border-color: color-mix(in srgb, var(--color-accent) 40%, transparent);
}

.pipeline-summary-card[data-state="running"] {
  border-color: color-mix(in srgb, var(--color-accent) 44%, transparent);
  background: color-mix(in srgb, var(--color-accent) 12%, var(--color-surface));
}

.pipeline-summary-card[data-state="complete"] {
  border-color: color-mix(in srgb, var(--color-success) 42%, transparent);
  background: color-mix(in srgb, var(--color-success) 10%, var(--color-surface));
}

.pipeline-step-helper {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
  background: color-mix(in srgb, var(--color-surface-2) 80%, transparent);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.pipeline-step-helper[data-state="blocked"] {
  border-color: color-mix(in srgb, var(--color-warning) 40%, transparent);
  background: color-mix(in srgb, var(--color-warning) 10%, var(--color-surface));
}

.pipeline-step-helper[data-state="success"] {
  border-color: color-mix(in srgb, var(--color-success) 42%, transparent);
  background: color-mix(in srgb, var(--color-success) 10%, var(--color-surface));
}

.pipeline-step-helper[data-state="pending"] {
  border-color: color-mix(in srgb, var(--color-accent) 36%, transparent);
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface));
}

.pipeline-step-helper[data-state="error"] {
  border-color: color-mix(in srgb, var(--color-danger) 42%, transparent);
  background: color-mix(in srgb, var(--color-danger) 10%, var(--color-surface));
}

.pipeline-step-note {
  padding: 0 2px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.pipeline-secondary-tabs {
        display: inline-flex;
        flex-wrap: wrap;
        gap: 4px;
        padding: 5px;
        border-radius: var(--radius-lg);
        border: 1px solid var(--color-border);
        background: var(--surface-pearl);
        box-shadow: var(--shadow-inset);
}

.pipeline-secondary-tab {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 40px;
        padding: 0 10px;
        border-radius: var(--radius-md);
        border: 1px solid transparent;
        background: transparent;
        color: var(--text-secondary);
        font: inherit;
        font-size: 13px;
        font-weight: 700;
        cursor: pointer;
        gap: 6px;
        opacity: 1;
}

.pipeline-secondary-tab.is-active,
.pipeline-secondary-tab.active {
        border-color: var(--border-mint);
        background: var(--surface-mint);
        color: var(--text-heading);
        box-shadow: var(--shadow-inset), var(--shadow-sm);
}

.faculty-tab-container {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

[data-role="faculty-tab"] {
        opacity: 1;
        transition: opacity 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

[data-role="faculty-tab"].active,
[data-role="faculty-tab"].is-active {
  opacity: 1;
  min-width: 0;
  line-height: 1.25;
}

.pipeline-secondary-panel,
.faculty-tab-panel {
  min-height: 0;
}

.faculty-tab-panel {
  display: none;
  flex: 1 1 auto;
}

.faculty-tab-panel[hidden] {
  display: none !important;
}

.faculty-tab-panel.active,
.faculty-tab-panel.is-active {
  display: grid;
  align-content: start;
  animation: faculty-tab-panel-in 0.18s ease;
}

.faculty-tab-panel > .pipeline-card {
  min-height: 0;
  height: 100%;
}

.pipeline-secondary-panel:not(.is-active):not(.active) {
  display: none;
}

@keyframes faculty-tab-panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pipeline-step[data-ui-state="current"],
.pipeline-step.is-current,
.pipeline-tracker__step[data-ui-state="current"],
.pipeline-tracker__step.is-current {
  border-color: color-mix(in srgb, var(--color-accent) 56%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-accent) 18%, transparent), var(--shadow-sm);
}

.pipeline-step[data-ui-state="running"],
.pipeline-step.is-running,
.pipeline-tracker__step[data-ui-state="running"],
.pipeline-tracker__step.is-running {
  border-color: color-mix(in srgb, var(--color-warning) 52%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-warning) 18%, transparent), var(--shadow-sm);
}

.pipeline-step[data-ui-state="blocked"],
.pipeline-step.is-blocked,
.pipeline-tracker__step[data-ui-state="blocked"],
.pipeline-tracker__step.is-blocked {
  opacity: 1;
}

.pipeline-step[data-ui-state="blocked"],
.pipeline-step.is-blocked {
  background: color-mix(in srgb, var(--color-surface) 94%, var(--color-surface-2) 6%);
}

.pipeline-step[data-ui-state="not_started"] .step-badge,
.pipeline-step.is-not-started .step-badge,
.pipeline-tracker__step[data-ui-state="not_started"] .pipeline-tracker__icon,
.pipeline-tracker__step.is-not-started .pipeline-tracker__icon {
  background: color-mix(in srgb, var(--color-surface-2) 82%, var(--color-surface));
}

.pipeline-step[data-ui-state="completed"] .step-badge,
.pipeline-step.is-completed .step-badge,
.pipeline-tracker__step[data-ui-state="completed"] .pipeline-tracker__icon,
.pipeline-tracker__step.is-completed .pipeline-tracker__icon {
  background: color-mix(in srgb, var(--color-success) 20%, var(--color-surface));
}

.pipeline-step[data-ui-state="current"] .step-badge,
.pipeline-step.is-current .step-badge,
.pipeline-tracker__step[data-ui-state="current"] .pipeline-tracker__icon,
.pipeline-tracker__step.is-current .pipeline-tracker__icon {
  background: color-mix(in srgb, var(--color-accent) 20%, var(--color-surface));
}

.pipeline-step[data-ui-state="running"] .step-badge,
.pipeline-step.is-running .step-badge,
.pipeline-tracker__step[data-ui-state="running"] .pipeline-tracker__icon,
.pipeline-tracker__step.is-running .pipeline-tracker__icon {
  background: color-mix(in srgb, var(--color-warning) 20%, var(--color-surface));
}

.pipeline-step[data-ui-state="failed"] .step-badge,
.pipeline-step.is-failed .step-badge,
.pipeline-tracker__step[data-ui-state="failed"] .pipeline-tracker__icon,
.pipeline-tracker__step.is-failed .pipeline-tracker__icon {
  background: color-mix(in srgb, var(--color-danger) 16%, var(--color-surface));
}

#pipelineRunNext[data-state="blocked"] {
  --btn-bg: color-mix(in srgb, var(--color-warning) 12%, var(--color-surface));
  --btn-border: color-mix(in srgb, var(--color-warning) 42%, transparent);
  --btn-text: color-mix(in srgb, var(--color-warning) 78%, var(--color-text));
  box-shadow: none;
}

#pipelineRunNext[data-state="complete"] {
  --btn-bg: color-mix(in srgb, var(--color-success) 12%, var(--color-surface));
  --btn-border: color-mix(in srgb, var(--color-success) 42%, transparent);
  --btn-text: color-mix(in srgb, var(--color-success) 80%, var(--color-text));
  box-shadow: none;
}

@media (max-width: 960px) {
  .pipeline-active__summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pipeline-summary-card--helper {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .pipeline-active__summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .student-empty-state__actions {
    flex-direction: column;
  }

  .student-empty-state__actions .btn {
    width: 100%;
  }

  .pipeline-secondary-tabs {
    width: 100%;
    justify-content: stretch;
  }

  .pipeline-secondary-tab {
    flex: 1 1 0;
  }

  .pipeline-run-next-helper {
    max-width: none;
  }

  .faculty-topbar {
    margin: var(--space-3);
    padding: var(--space-3);
    gap: var(--space-2);
  }

  .faculty-title-stack {
    gap: var(--space-2);
  }

  .faculty-title-stack .eyebrow {
    padding-left: var(--space-2);
    font-size: var(--text-xs);
  }

  .faculty-topbar .saved-item-actions {
    gap: var(--space-1);
  }

  .faculty-topbar .btn {
    padding-inline: var(--space-2);
  }

  .faculty-content {
    margin-inline: 0;
  }
}
.faculty-quiz-authoring {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color, #d5dde5);
}
.faculty-quiz-authoring [role="status"] {
  flex-basis: 100%;
  font-size: 0.875rem;
}
