/* ── FILES LOADING STATE ── */
.co-files-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
}
.co-files-loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  animation: co-loading-pulse 1s ease-in-out infinite;
}
@keyframes co-loading-pulse {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}
body:not(.night) .co-files-loading {
  color: rgba(0, 0, 0, 0.4);
}

/* ── RAG STATUS INDICATOR (inline on file rows) ── */
.co-rag-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-right: 8px;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  cursor: default;
  user-select: none;
  transition: opacity 0.15s;
  line-height: 1;
}
.co-rag-status[data-rag-status='failed'] {
  cursor: pointer;
  opacity: 0.85;
}
.co-rag-status[data-rag-status='failed']:hover {
  opacity: 1;
}

/* ── RAG FEEDBACK BAR ── */
.rag-feedback-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.rag-fb-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  flex: 1;
}
.rag-fb-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 3px 7px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}
.rag-fb-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}
.rag-fb-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
body:not(.night) .rag-feedback-bar {
  border-top-color: rgba(0, 0, 0, 0.08);
}
body:not(.night) .rag-fb-label {
  color: rgba(0, 0, 0, 0.4);
}
body:not(.night) .rag-fb-btn {
  border-color: rgba(0, 0, 0, 0.12);
}

/* PORTAL */
#portal {
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  background: var(--dp-bg);
  background-attachment: fixed;
}
#portal.show {
  display: block;
  opacity: 1;
  pointer-events: auto;
}
.blobs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.22;
  animation: drift 12s ease-in-out infinite alternate;
}
body:not(.night) .blob {
  opacity: 0.32;
}
.blob-1 {
  width: 600px;
  height: 600px;
  background: var(--purple);
  top: -150px;
  left: -120px;
}
.blob-2 {
  width: 450px;
  height: 450px;
  background: var(--pink);
  top: 40%;
  right: -100px;
  animation-delay: 3s;
}
.blob-3 {
  width: 400px;
  height: 400px;
  background: var(--blue);
  bottom: -80px;
  left: 30%;
  animation-delay: 5s;
}
.blob-4 {
  width: 300px;
  height: 300px;
  background: #ff6b35;
  top: 20%;
  left: 50%;
  animation-delay: 7s;
  opacity: 0.12;
}

/* noise texture overlay */
#portal::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 180px;
  opacity: 0.028;
}

.p-inner {
  position: relative;
  z-index: 10;
  max-width: 780px;
  margin: 0 auto;
  padding: 60px 24px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header */
.p-logo {
  font-family: 'Fredoka One', cursive;
  font-size: 3.2rem;
  background: linear-gradient(135deg, #3b82f6, #0ea5e9, #fb923c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
  filter: drop-shadow(0 0 40px rgba(59, 130, 246, 0.35));
}
.p-tag {
  text-align: center;
  color: var(--on-glass-muted);
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Uni badge */
.p-uni-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 48px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 40px;
  padding: 8px 18px 8px 10px;
  backdrop-filter: blur(12px);
}
.p-logo-sq {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #003c78;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}
.p-uni-name {
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--on-glass);
}
.p-uni-city {
  font-size: 0.68rem;
  color: var(--on-glass-muted);
}

/* Nav pill bar */
@keyframes tabSlideIn {
  from {
    opacity: 0;
    transform: translateX(-6px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}
@keyframes tabPop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.08);
  }
  70% {
    transform: scale(0.97);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes shimmer {
  0% {
    background-position: 200% center;
  }
  100% {
    background-position: -200% center;
  }
}
@keyframes tabGlow {
  0%,
  100% {
    box-shadow:
      0 0 0 0 rgba(59, 130, 246, 0),
      0 2px 12px rgba(59, 130, 246, 0.25);
  }
  50% {
    box-shadow:
      0 0 0 4px rgba(59, 130, 246, 0.12),
      0 2px 20px rgba(59, 130, 246, 0.4);
  }
}
/* Portal nav bar */
.p-nav-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 44px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-top-color: rgba(255, 255, 255, 0.22);
  border-radius: 40px;
  padding: 5px;
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
  position: relative;
}
.p-nav-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 40px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0) 60%);
}
.psb {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  border: 1px solid transparent;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  animation: tabSlideIn 0.35s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}
.psb:nth-child(1) {
  animation-delay: 0.04s;
}
.psb:nth-child(2) {
  animation-delay: 0.08s;
}
.psb:nth-child(3) {
  animation-delay: 0.12s;
}
.psb:nth-child(4) {
  animation-delay: 0.16s;
}
.psb:nth-child(5) {
  animation-delay: 0.2s;
}
.psb:nth-child(6) {
  animation-delay: 0.24s;
}
.psb:nth-child(7) {
  animation-delay: 0.28s;
}
.psb::after {
  content: '';
  position: absolute;
  top: 0;
  left: -80%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.45s ease;
  pointer-events: none;
}
.psb:hover::after {
  left: 130%;
}
.psb:hover {
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.psb:active {
  transform: scale(0.96) translateY(0);
}
.psb.on {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.32), rgba(14, 165, 233, 0.22));
  color: #fff;
  border-color: rgba(59, 130, 246, 0.45);
  border-top-color: rgba(255, 255, 255, 0.3);
  box-shadow:
    0 2px 16px rgba(59, 130, 246, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  animation:
    tabPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    tabGlow 2.4s ease-in-out 0.4s infinite;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.psb.on::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 55%);
  pointer-events: none;
}
.psb .ic {
  font-size: 0.95rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.psb:hover .ic {
  transform: scale(1.2) rotate(-4deg);
}
.psb.on .ic {
  transform: scale(1.1);
}
.psb-div {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 2px;
}
.psb.ai-link {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(14, 165, 233, 0.22));
  color: #f0d0ff;
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow:
    0 2px 12px rgba(59, 130, 246, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.psb.ai-link:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.42), rgba(14, 165, 233, 0.32));
  box-shadow:
    0 4px 18px rgba(59, 130, 246, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* Grid */
.p-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
}
@media (max-width: 600px) {
  .p-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 520px) {
  .p-inner {
    padding: 40px 14px 60px;
  }
  .p-nav-bar {
    gap: 2px;
    padding: 4px;
    margin-bottom: 28px;
  }
  .psb {
    padding: 7px 10px;
    font-size: 0.72rem;
    gap: 4px;
  }
  .psb-div {
    margin: 0 1px;
  }
}

/* Cards */
.pc {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-top-color: rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  padding: 28px 16px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.2, 0.64, 1);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 2px 16px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.pc::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 60%);
  pointer-events: none;
}
.pc::after {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  transition: left 0.5s ease;
  pointer-events: none;
}
.pc:hover {
  transform: translateY(-6px) scale(1.02);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(59, 130, 246, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.pc:hover::after {
  left: 120%;
}
.pc-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 12px rgba(59, 130, 246, 0.4));
}
body:not(.night) .pc-icon {
  filter: drop-shadow(0 4px 14px rgba(37, 99, 235, 0.35));
}
.pc-name {
  font-weight: 800;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--on-glass);
}
.pc-desc {
  font-size: 0.7rem;
  color: var(--on-glass-faint);
  font-weight: 600;
}

/* Removed old layout pieces */
.p-body {
  display: none;
}
.p-side {
  display: none;
}
.p-right {
  display: none;
}

/* APP */
#app {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  z-index: 10;
  background: var(--dp-solid);
  overflow-x: hidden;
}
.topbar {
  height: var(--topbar-h);
  background: var(--card);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 100;
}
.tb-toggle {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 9px;
  background: #f3eeff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  transition: background 0.15s;
}
.tb-toggle:hover {
  background: #e6d9ff;
}
.tb-logo {
  font-family: 'Fredoka One', cursive;
  font-size: 1.25rem;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
  white-space: nowrap;
}
.tb-crumb {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
}
.tb-crumb b {
  color: var(--purple);
}
.tb-portal-btn {
  padding: 7px 14px;
  background: #f3eeff;
  border: none;
  border-radius: 9px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.78rem;
  color: var(--purple);
  cursor: pointer;
  flex-shrink: 0;
}
.tb-portal-btn:hover {
  background: #e6d9ff;
}
.app-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  background: var(--dp-solid);
}

/* SIDEBAR */
.sidebar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sb-w);
  background: var(--card);
  border-right: 1px solid #ede8f5;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: hidden;
  z-index: 90;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.visible {
  transform: translateX(0);
}
#sbHoverZone {
  display: none;
}
#sbTab {
  display: none;
}
#sbMain,
#sbCourse {
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}
.sb-x-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: #f3eeff;
  cursor: pointer;
  font-size: 1rem;
  color: var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  flex-shrink: 0;
}
.sb-x-btn:hover {
  background: #ede0ff;
}
.sb-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--purple) #f0f0f0;
}
.sb-scroll::-webkit-scrollbar {
  width: 4px;
}
.sb-scroll::-webkit-scrollbar-thumb {
  background: var(--purple);
  border-radius: 4px;
}
.sb-section {
  margin-bottom: 10px;
}
.sb-section-title {
  font-family: 'Fredoka One', cursive;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 4px 8px;
  margin-bottom: 5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sem-wrap {
  position: relative;
  margin-bottom: 8px;
}
.sem-btn {
  width: 100%;
  padding: 9px 12px;
  background: #f8f5ff;
  border: 1.5px solid #ddd6f5;
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color 0.15s;
}
.sem-btn:hover,
.sem-btn.open {
  border-color: var(--purple);
}
.sem-btn.open {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.sem-btn-l {
  display: flex;
  align-items: center;
  gap: 7px;
}
.sem-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sem-chev {
  font-size: 9px;
  color: var(--purple);
  transition: transform 0.18s;
}
.sem-chev.up {
  transform: rotate(180deg);
}
.sem-dd {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--card);
  border: 1.5px solid var(--purple);
  border-top: none;
  border-radius: 0 0 10px 10px;
  z-index: 60;
  max-height: 200px;
  overflow-y: auto;
}
.sem-dd.open {
  display: block;
}
.sem-opt {
  padding: 9px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text);
  border-bottom: 0.5px solid #f5f5f5;
  transition: background 0.12s;
}
.sem-opt:last-child {
  border-bottom: none;
  border-radius: 0 0 8px 8px;
}
.sem-opt:hover {
  background: #f8f5ff;
  color: var(--purple);
}
.sem-opt.sel {
  background: linear-gradient(135deg, #f0e8ff, #ffe8f5);
  color: var(--purple);
}
.sem-cur {
  display: none;
}
.course-row {
  background: #f8f5ff;
  border-radius: 10px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  margin-bottom: 5px;
  border: 1.5px solid transparent;
  transition: all 0.15s;
}
.course-row:hover {
  border-color: var(--purple);
  transform: translateX(2px);
}
.course-row.active {
  border-color: var(--purple);
  background: #ede0ff;
}
.cr-bar {
  width: 3px;
  height: 30px;
  border-radius: 3px;
  flex-shrink: 0;
}
.cr-info {
  flex: 1;
  min-width: 0;
}
.cr-name {
  font-weight: 800;
  font-size: 0.77rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr-meta {
  font-size: 0.66rem;
  color: var(--muted);
  margin-top: 1px;
}
.cr-arr {
  display: none;
}
.files-sub {
  margin-left: 12px;
  margin-bottom: 5px;
  display: none;
  flex-direction: column;
  gap: 4px;
}
.files-sub.open {
  display: flex;
}
.file-row {
  background: #fff;
  border-radius: 8px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  border: 1.5px solid #ede8f5;
  transition: all 0.13s;
  font-size: 0.74rem;
  font-weight: 700;
}
.file-row:hover {
  border-color: var(--purple);
  background: #f8f5ff;
}
.file-row.active {
  border-color: var(--purple);
  background: #ede0ff;
  color: var(--purple);
}
.fr-icon {
  font-size: 0.95rem;
  flex-shrink: 0;
}
.fr-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--purple);
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.13s;
  margin-bottom: 4px;
  user-select: none;
}
.sb-back:hover {
  background: #f3eeff;
}
.sb-course-name {
  font-family: 'Fredoka One', cursive;
  font-size: 0.9rem;
  color: var(--text);
  padding: 8px 12px 14px;
  line-height: 1.3;
  border-bottom: 1px solid #ede8f5;
  margin-bottom: 8px;
}
.sb-course-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
/* Sidebar accordion */
.sb-acc-item {
  border-radius: 10px;
  margin-bottom: 4px;
  border: 1.5px solid transparent;
  transition: border-color 0.15s;
}
.sb-acc-item.open {
  border-color: var(--purple);
}
.sb-acc-hdr {
  display: flex;
  align-items: stretch;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--text);
  user-select: none;
  background: transparent;
  transition: background 0.14s;
  overflow: hidden;
}
.sb-acc-hdr:hover {
  background: #f3eeff;
}
.sb-acc-item.open .sb-acc-hdr {
  background: linear-gradient(135deg, #eee5ff, #ffe8f5);
  color: var(--purple);
  border-radius: 10px 10px 0 0;
}
.sb-acc-label-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  padding: 11px 8px 11px 13px;
  cursor: pointer;
  color: inherit;
  min-width: 0;
}
.sb-acc-label-btn:hover {
  color: var(--purple);
}
.sb-acc-icon {
  font-size: 1.1rem;
  width: 26px;
  text-align: center;
  flex-shrink: 0;
}
.sb-acc-label {
  flex: 1;
}
.sb-acc-chev-btn {
  width: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  border-left: 1px solid rgba(37, 99, 235, 0.15);
  transition: background 0.14s;
}
.sb-acc-chev-btn:hover {
  background: rgba(37, 99, 235, 0.15);
}
.sb-acc-chev {
  font-size: 0.65rem;
  color: var(--purple);
  transition: transform 0.2s;
  opacity: 0.8;
  display: block;
}
.sb-acc-item.open .sb-acc-chev {
  transform: rotate(180deg);
}
.sb-acc-body {
  height: 0;
  overflow: hidden;
  background: #f8f5ff;
  border-radius: 0 0 10px 10px;
  transition: height 0.22s ease;
}
.sb-acc-item.open .sb-acc-body {
  height: 160px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--purple) rgba(37, 99, 235, 0.08);
}
.sb-acc-item.open .sb-acc-body::-webkit-scrollbar {
  width: 4px;
}
.sb-acc-item.open .sb-acc-body::-webkit-scrollbar-thumb {
  background: var(--purple);
  border-radius: 4px;
}
.sb-acc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  border-bottom: 0.5px solid rgba(37, 99, 235, 0.08);
  transition: background 0.12s;
  flex-shrink: 0;
}
.sb-acc-row:last-child {
  border-bottom: none;
}
.sb-acc-row:hover {
  background: #ede0ff;
  color: var(--purple);
}
.sb-acc-row-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}
.sb-acc-row-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-acc-row-meta {
  font-size: 0.63rem;
  color: var(--muted);
  flex-shrink: 0;
}
.sb-acc-row-active {
  background: #ede0ff !important;
  color: var(--purple) !important;
}
.sb-dl-btn {
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(6, 214, 160, 0.15);
  color: rgba(6, 214, 160, 0.9);
  border: 1px solid rgba(6, 214, 160, 0.3);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.13s;
}
.sb-dl-btn:hover {
  background: rgba(6, 214, 160, 0.3);
}
body.night .sb-acc-row-active {
  background: #334155 !important;
  color: #3b82f6 !important;
}
body.night .sb-acc-hdr:hover {
  background: #1e293b;
}
body.night .sb-acc-item.open .sb-acc-hdr {
  background: linear-gradient(135deg, #221d3a, #231d30);
}
body.night .sb-acc-body {
  background: #1f1d2e;
}
body.night .sb-acc-row {
  border-bottom-color: rgba(37, 99, 235, 0.12);
}
body.night .sb-acc-row:hover {
  background: #334155;
}
body.night .sb-acc-chev-btn {
  border-left-color: rgba(37, 99, 235, 0.25);
}
.tt-day-sb {
  font-family: 'Fredoka One', cursive;
  font-size: 0.73rem;
  color: var(--purple);
  margin: 6px 0 3px;
}
.tt-slot-sb {
  padding: 7px 10px;
  background: #f8f5ff;
  border-radius: 9px;
  margin-bottom: 4px;
  border-left: 3px solid var(--purple);
}
.tt-time-sb {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--muted);
}
.tt-name-sb {
  font-weight: 800;
  font-size: 0.75rem;
  margin: 1px 0;
}
.tt-room-sb {
  font-size: 0.65rem;
  color: var(--muted);
}
.mail-sb {
  padding: 8px 10px;
  background: #f8f5ff;
  border-radius: 9px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background 0.13s;
  border-left: 3px solid transparent;
}
.mail-sb:hover {
  background: #ede0ff;
}
.mail-sb.unread {
  border-left-color: var(--purple);
  background: #f0eaff;
}
.mail-sb-subj {
  font-weight: 800;
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-sb-date {
  font-size: 0.63rem;
  color: var(--muted);
  margin-top: 1px;
}
.mail-sb-prev {
  font-size: 0.7rem;
  color: var(--text);
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* PDF VIEWER */
.pdf-viewer-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--dp-solid);
}
.pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--card);
  border-bottom: 1px solid #ede8f5;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.pdf-tb-btn {
  background: #f8f5ff;
  border: 1.5px solid #ddd6f5;
  border-radius: 7px;
  padding: 5px 10px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.73rem;
  color: var(--purple);
  cursor: pointer;
  transition: background 0.13s;
  white-space: nowrap;
}
.pdf-tb-btn:hover {
  background: #ede0ff;
}
.pdf-page-info {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.pdf-page-input {
  width: 30px;
  border: none;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--purple);
  text-align: center;
  padding: 1px 2px;
  border-radius: 4px;
  -moz-appearance: textfield;
  cursor: text;
  font-family: inherit;
}
.pdf-page-input::-webkit-outer-spin-button,
.pdf-page-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
.pdf-page-input:focus {
  outline: 1.5px solid var(--purple);
  background: rgba(37, 99, 235, 0.07);
}
.pdf-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  background: #888;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 16px;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: #555 #666;
  min-width: 0;
}
.pdf-body::-webkit-scrollbar {
  width: 6px;
}
.pdf-body::-webkit-scrollbar-thumb {
  background: #666;
  border-radius: 4px;
}
.pdf-page-wrap {
  position: relative;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border-radius: 2px;
  margin: 0 auto;
}
.pdf-page-wrap canvas {
  display: block;
}
.pdf-text-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: auto;
  line-height: 1;
  user-select: text;
}
.pdf-text-layer span,
.pdf-text-layer br {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
}
.pdf-text-layer .markedContent {
  top: 0;
  height: 0;
}
.pdf-text-layer ::selection {
  background: rgba(37, 99, 235, 0.35);
  color: transparent;
}
/* ANNOTATION LAYER */
.annot-live {
  position: absolute;
  inset: 0;
  z-index: 6;
  touch-action: pan-x pan-y;
}
.annot-live.annot-mode-pen {
  cursor: crosshair;
}
.annot-live.annot-mode-highlight {
  cursor: crosshair;
}
.annot-live.annot-mode-eraser {
  cursor: cell;
}
.annot-live.annot-mode-text {
  cursor: text;
}
.annot-committed {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.annot-tool-btn {
  background: none;
  border: none;
  border-radius: 8px;
  padding: 5px 7px;
  color: var(--on-glass);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.13s;
  touch-action: manipulation;
}
.annot-fmt-btn,
.annot-color-swatch {
  touch-action: manipulation;
}
.annot-tool-btn:hover {
  background: rgba(37, 99, 235, 0.2);
}
.annot-tool-btn.active {
  background: rgba(37, 99, 235, 0.4) !important;
}
.annot-color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition:
    transform 0.12s,
    border-color 0.12s;
  flex-shrink: 0;
}
.annot-color-swatch:hover {
  transform: scale(1.15);
}
.annot-color-swatch.active {
  border-color: #fff;
  transform: scale(1.15);
}
.annot-fmt-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--on-glass);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.13s;
}
.annot-fmt-btn:hover,
.annot-fmt-btn.active {
  background: rgba(37, 99, 235, 0.35);
}
.annot-text-input {
  position: absolute;
  z-index: 10;
  background: transparent;
  border: 1.5px dashed rgba(37, 99, 235, 0.7);
  outline: none;
  resize: none;
  min-width: 80px;
  min-height: 28px;
  font-family: 'Nunito', sans-serif;
  color: inherit;
  padding: 2px 4px;
  border-radius: 3px;
  overflow: hidden;
  line-height: 1.3;
}
#annotToolbar {
  flex-shrink: 0;
}
/* pdf-text-layer pointer-events off in annotate mode */
.annot-active .pdf-text-layer {
  pointer-events: none !important;
  user-select: none !important;
}
.pdf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 16px;
  color: #fff;
}
.pdf-loading p {
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
}
.loading-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}
.loading-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: dotBounce 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(1) {
  background: var(--purple);
}
.loading-dots span:nth-child(2) {
  background: var(--pink);
  animation-delay: 0.2s;
}
.loading-dots span:nth-child(3) {
  background: var(--orange);
  animation-delay: 0.4s;
}
.welcome-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  padding: 40px;
  text-align: center;
  background: var(--dp-solid);
}
/* Multi-file select */
.co-files-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.co-course-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  padding: 5px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.co-course-tab {
  position: relative;
  min-height: 40px;
  padding: 0 28px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--on-glass-muted);
  font-family: 'Nunito', sans-serif;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.co-course-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--on-glass);
}
.co-course-tab.active {
  color: #fff;
  background: rgba(124, 92, 255, 0.22);
  border-color: rgba(124, 92, 255, 0.45);
}
.co-course-tab.active::after {
  display: none;
}
.co-course-panel {
  display: none;
}
.co-course-panel.active {
  display: block;
}
.co-study-tools {
  margin: 0 0 14px;
  padding: 18px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.14), transparent 34%),
    rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.co-study-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.co-study-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  color: var(--on-glass);
}
.co-study-sub {
  margin-top: 3px;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--on-glass-muted);
}
.co-study-tabs {
  display: inline-flex;
  padding: 4px;
  background: rgba(10, 12, 22, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  flex-shrink: 0;
}
.co-study-tab {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.58);
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  cursor: pointer;
}
.co-study-tab.active {
  background: linear-gradient(135deg, #fb7185, #fb923c);
  color: #fff;
  box-shadow: 0 8px 24px rgba(251, 113, 133, 0.22);
}
.co-study-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.co-study-generate {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.78);
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  cursor: pointer;
}
.co-study-generate.primary {
  border: 0;
  background: linear-gradient(135deg, #fb7185, #fb923c);
  color: #fff;
}
.co-study-body {
  display: flex;
  justify-content: center;
}
.co-quiz-card {
  width: min(100%, 560px);
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, #fff7fb 0%, #fff 100%);
  color: #30162f;
  box-shadow: 0 18px 45px rgba(20, 13, 37, 0.24);
}
.co-quiz-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff0f6;
  border: 1px solid #ffd1e3;
  color: #b4235a;
  font-size: 0.76rem;
  font-weight: 900;
}
.co-quiz-category {
  margin-top: 14px;
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b5cf6;
}
.co-quiz-question {
  margin: 8px 0 14px;
  font-family: 'Fredoka One', cursive;
  font-size: clamp(1.18rem, 2vw, 1.55rem);
  line-height: 1.25;
  color: #26112b;
}
.co-quiz-options {
  display: grid;
  gap: 9px;
}
.co-quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 15px;
  border: 2px solid #f4d7fa;
  background: #fff3fb;
  color: #37213b;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}
.co-option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: #f7dff8;
  color: #2563eb;
  flex-shrink: 0;
}
.co-option-status {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 1000;
  white-space: nowrap;
}
.co-quiz-option.correct {
  border-color: #22c55e;
  background: #dcfce7;
  color: #166534;
}
.co-quiz-option.correct .co-option-letter {
  background: #22c55e;
  color: #fff;
}
.co-quiz-option.incorrect {
  border-color: #fb7185;
  background: #ffe4e6;
  color: #be123c;
}
.co-quiz-option.incorrect .co-option-letter {
  background: #fb7185;
  color: #fff;
}
.co-quiz-explanation {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 16px;
  background: #fff7dd;
  border: 1px solid #fde68a;
  color: #4a3411;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.5;
}
.co-continue-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #fb7185, #fb923c);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 0.96rem;
  font-weight: 1000;
  cursor: pointer;
}
.co-flash-shell {
  width: min(100%, 680px);
  padding: 18px;
  border-radius: 20px;
  background: #10131b;
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #f8fafc;
}
.co-flash-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.co-flash-label {
  font-size: 0.78rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.co-flash-icons {
  display: flex;
  gap: 7px;
}
.co-flash-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.045);
  color: #cbd5e1;
  cursor: pointer;
  font-weight: 900;
}
.co-flash-icon.active {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.42);
  color: #86efac;
}
.co-flash-icon.review.active {
  background: rgba(251, 113, 133, 0.14);
  border-color: rgba(251, 113, 133, 0.42);
  color: #fda4af;
}
.co-flash-icon.bookmark.active {
  background: rgba(250, 204, 21, 0.14);
  border-color: rgba(250, 204, 21, 0.42);
  color: #fde047;
}
.co-flash-stage {
  perspective: 1200px;
}
.co-flash-card {
  position: relative;
  width: 100%;
  min-height: 260px;
  border: 0;
  padding: 0;
  border-radius: 18px;
  background: transparent;
  transform-style: preserve-3d;
  transition: transform 0.52s ease;
  cursor: pointer;
}
.co-flash-card.flipped {
  transform: rotateY(180deg);
}
.co-flash-side {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  border-radius: 18px;
  background: #1f2430;
  border: 1px solid rgba(148, 163, 184, 0.28);
  backface-visibility: hidden;
  text-align: center;
}
.co-flash-side.back {
  transform: rotateY(180deg);
}
.co-flash-text {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.35;
  color: #f8fafc;
}
.co-flash-side.back .co-flash-text {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(1.02rem, 2vw, 1.32rem);
  font-weight: 900;
  color: #e2e8f0;
}
.co-flash-controls {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-top: 14px;
}
.co-flash-control {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 13px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.055);
  color: #e2e8f0;
  font-family: 'Nunito', sans-serif;
  font-weight: 1000;
  cursor: pointer;
}
.co-study-empty {
  width: 100%;
  padding: 22px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px dashed rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.5);
  font-weight: 800;
  text-align: center;
}
.co-select-toggle {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.1);
  color: rgba(59, 130, 246, 0.9);
  cursor: pointer;
  transition: all 0.15s;
}
.co-select-toggle:hover {
  background: rgba(59, 130, 246, 0.2);
}
.co-select-toggle.active {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.6);
}
.co-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid rgba(6, 214, 160, 0.35);
  background: rgba(6, 214, 160, 0.1);
  color: rgba(6, 214, 160, 0.9);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1;
}
.co-upload-btn:hover {
  background: rgba(6, 214, 160, 0.2);
}
.co-reindex-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.12);
  color: rgba(37, 99, 235, 0.9);
  cursor: pointer;
  transition: all 0.15s;
}
.co-reindex-all-btn:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.22);
}
.co-reindex-all-btn:disabled {
  opacity: 0.7;
  cursor: progress;
}
.co-file-uploaded {
  border-left: 2px solid rgba(6, 214, 160, 0.5);
}
.co-upload-progress {
  width: 100%;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.co-upload-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  opacity: 0.7;
}
.co-upload-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.co-upload-progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #2563eb, #06d6a0);
  transition: width 0.2s ease;
}
.co-file-cb {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.co-select-mode .co-file-cb {
  display: flex;
}
.co-file-cb.checked {
  background: rgba(59, 130, 246, 0.5);
  border-color: #3b82f6;
}
.co-file-cb.checked::after {
  content: '✓';
  font-size: 0.7rem;
  color: #fff;
  font-weight: 900;
}
.co-select-mode .co-file:hover {
  border-color: rgba(59, 130, 246, 0.4);
}
.co-select-mode .co-file.selected {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.1);
}
.co-multi-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(15, 12, 26, 0.98), rgba(18, 14, 32, 0.98));
  border-top: 1px solid rgba(59, 130, 246, 0.25);
  backdrop-filter: blur(16px);
  z-index: 20;
  margin: 0 -22px -20px;
  border-radius: 0 0 20px 20px;
}
.co-multi-bar.show {
  display: flex;
}
/* User folders */
.co-new-folder-btn {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px dashed rgba(37, 99, 235, 0.4);
  background: rgba(37, 99, 235, 0.07);
  color: var(--purple);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.co-new-folder-btn:hover {
  background: rgba(37, 99, 235, 0.18);
}
.co-folder-section {
  border-radius: 14px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  background: rgba(37, 99, 235, 0.04);
  margin-bottom: 10px;
  overflow: hidden;
}
.co-folder-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.co-folder-header:hover {
  background: rgba(37, 99, 235, 0.1);
}
.co-folder-toggle-icon {
  font-size: 0.75rem;
  color: var(--on-glass-faint);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.co-folder-section:not(.collapsed) .co-folder-toggle-icon {
  transform: rotate(90deg);
}
.co-folder-name-label {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--on-glass);
  flex: 1;
}
.co-folder-count-label {
  font-size: 0.7rem;
  color: var(--on-glass-faint);
  font-weight: 600;
  flex-shrink: 0;
}
.co-folder-files {
  padding: 0 8px 8px;
}
.co-folder-section.collapsed .co-folder-files {
  display: none;
}
.co-folder-empty {
  padding: 14px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--on-glass-faint);
  opacity: 0.7;
}
.co-folder-up-btn,
.co-folder-del-btn,
.co-folder-select-all-btn {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  flex-shrink: 0;
  font-family: Nunito, sans-serif;
  transition: all 0.13s;
}
.co-folder-select-all-btn {
  color: rgba(59, 130, 246, 0.9);
}
.co-folder-select-all-btn:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
}
.co-folder-up-btn {
  color: rgba(6, 214, 160, 0.9);
}
.co-folder-up-btn:hover {
  background: rgba(6, 214, 160, 0.15);
  border-color: rgba(6, 214, 160, 0.3);
}
.co-folder-del-btn {
  color: rgba(239, 68, 68, 0.8);
}
.co-folder-del-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
}
.co-multi-count {
  font-weight: 800;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.7);
  flex: 1;
}
.co-multi-count b {
  color: #3b82f6;
}
.co-multi-delete {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 20px;
  padding: 9px 18px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.78rem;
  color: #fff;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.co-multi-delete:hover {
  background: rgba(239, 68, 68, 0.32);
}
.co-multi-move {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(37, 99, 235, 0.2);
  border: 1px solid rgba(37, 99, 235, 0.4);
  border-radius: 20px;
  padding: 9px 18px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.78rem;
  color: #fff;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.co-multi-move:hover {
  background: rgba(37, 99, 235, 0.35);
}
.co-multi-summarise {
  display: flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(14, 165, 233, 0.2));
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 20px;
  padding: 9px 18px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.78rem;
  color: #fff;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.co-multi-summarise:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.45), rgba(14, 165, 233, 0.35));
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}
.co-multi-summarise:disabled {
  opacity: 0.5;
  cursor: default;
}
.co-multi-select-all {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  padding: 9px 18px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.78rem;
  color: #fff;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.co-multi-select-all:hover {
  background: rgba(255, 255, 255, 0.15);
}
.co-multi-clear {
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.14s;
  white-space: nowrap;
}
.co-multi-clear:hover {
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.07);
}

/* Multi-summary result modal */
#multiSumModal {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#multiSumModal.show {
  display: flex;
}
.msm-box {
  background: var(--dp-modal);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 24px;
  width: 100%;
  max-width: 700px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
.msm-hdr {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.msm-title {
  flex: 1;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--on-glass);
}
.msm-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--divider);
  border-radius: 9px;
  background: var(--row-bg);
  color: var(--on-glass-muted);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.14s;
}
.msm-close:hover {
  background: rgba(255, 107, 55, 0.2);
  color: #ff6b35;
}
.msm-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(37, 99, 235, 0.3) transparent;
  font-size: 0.82rem;
  color: var(--on-glass);
  line-height: 1.8;
}
.msm-body h3 {
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  color: #3b82f6;
  margin: 18px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--divider);
}
.msm-body h3:first-child {
  margin-top: 0;
}
.msm-body h4 {
  font-size: 0.82rem;
  font-weight: 800;
  color: #0ea5e9;
  margin: 10px 0 4px;
}
.msm-body li {
  padding-left: 14px;
  position: relative;
  margin-bottom: 4px;
  list-style: none;
  color: var(--on-glass);
}
.msm-body li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: #3b82f6;
}
.msm-body strong {
  color: var(--text);
  font-weight: 800;
}
.msm-body code {
  background: rgba(59, 130, 246, 0.12);
  border-radius: 5px;
  padding: 1px 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.78em;
  color: #3b82f6;
}
.msm-files-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.msm-file-tag {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: rgba(59, 130, 246, 0.8);
}
.msm-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 20px;
  color: var(--on-glass-muted);
  font-size: 0.85rem;
}
.msm-dots {
  display: flex;
  gap: 7px;
}
.msm-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: dotBounce 1.2s ease-in-out infinite;
}
.msm-dots span:nth-child(1) {
  background: #3b82f6;
}
.msm-dots span:nth-child(2) {
  background: #0ea5e9;
  animation-delay: 0.2s;
}
.msm-dots span:nth-child(3) {
  background: #fb923c;
  animation-delay: 0.4s;
}
.msm-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--divider);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.msm-save-btn {
  flex: 1;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(14, 165, 233, 0.15));
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 12px;
  padding: 9px 16px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.78rem;
  color: #3b82f6;
  cursor: pointer;
  transition: all 0.15s;
}
.msm-save-btn:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), rgba(14, 165, 233, 0.3));
}

#courseOverview {
  background: var(--dp-bg);
  background-attachment: fixed;
  position: relative;
  min-height: 100%;
}
#courseOverview::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 180px;
  opacity: 0.025;
  z-index: 0;
}
/* glowing blobs inside courseOverview */
#courseOverview::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.18) 0%, transparent 70%);
  top: -120px;
  right: -80px;
  pointer-events: none;
  z-index: 0;
}

.co-inner {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 24px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* Quiz and flashcards panels need much more horizontal room for their two-pane layout */
.co-inner:has(#coQuizPanel.active),
.co-inner:has(#coFlashPanel.active) {
  max-width: 1280px;
  align-items: stretch;
}
/* ── Quiz score popup (shown inside the study pane) ─────────────────────── */
.qz-score-popup {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: rgba(15, 10, 30, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.qz-score-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 32px 28px;
  color: rgba(255, 255, 255, 0.92);
}
.qz-score-emoji { font-size: 2.8rem; line-height: 1; }
.qz-score-title { font-size: 1rem; font-weight: 800; opacity: 0.75; }
.qz-score-num { font-size: 2.4rem; font-weight: 900; color: #3b82f6; line-height: 1; }
.qz-score-pct { font-size: 1rem; font-weight: 700; opacity: 0.65; }
.qz-score-grade { font-size: 0.9rem; font-weight: 700; }
.qz-score-retry { margin-top: 10px; }
.qz-score-close {
  position: absolute;
  top: 12px; right: 14px;
  background: transparent; border: 0;
  color: rgba(255,255,255,0.45); font-size: 1rem;
  cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.qz-score-close:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* ── Generating overlay (quiz & flashcard generation) ───────────────────── */
.gen-overlay {
  position: fixed;
  inset: 0;
  z-index: 850;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gen-overlay-box {
  background: #1a1330;
  border: 1px solid rgba(37, 99, 235, 0.4);
  border-radius: 22px;
  padding: 36px 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  min-width: 280px;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
}
.gen-overlay-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: genSpin 0.75s linear infinite;
}
@keyframes genSpin { to { transform: rotate(360deg); } }
.gen-overlay-title {
  font-size: 1rem;
  font-weight: 800;
}
.gen-overlay-sub {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: -8px;
}

/* ── Source picker modal (quiz & flashcard generation) ───────────────────── */
.qzsp-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.qzsp-modal {
  background: #1a1330;
  border: 1px solid rgba(37, 99, 235, 0.35);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  padding: 22px 22px 18px;
  color: rgba(255, 255, 255, 0.9);
  overflow: hidden;
}
.qzsp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  margin-bottom: 4px;
}
.qzsp-title {
  font-size: 1rem;
  font-weight: 800;
}
.qzsp-close {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.qzsp-close:hover { color: #fff; background: rgba(255,255,255,0.08); }
.qzsp-sub {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 10px;
  flex-shrink: 0;
}
.qzsp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  margin-bottom: 14px;
  scrollbar-width: auto;
  scrollbar-color: rgba(37,99,235,0.55) rgba(255,255,255,0.06);
}
.qzsp-list::-webkit-scrollbar { width: 8px; }
.qzsp-list::-webkit-scrollbar-thumb { background: rgba(37,99,235,0.55); border-radius: 6px; }
.qzsp-list::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); border-radius: 6px; }
.qzsp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.qzsp-item:hover { background: rgba(37, 99, 235, 0.1); border-color: rgba(37, 99, 235, 0.3); }
.qzsp-cb { accent-color: #3b82f6; width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
.qzsp-name { font-size: 0.84rem; font-weight: 600; }
.qzsp-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.qzsp-btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 16px;
  cursor: pointer;
}
.qzsp-btn-ghost:hover { background: rgba(255,255,255,0.09); }
.qzsp-btn-primary {
  flex: 1;
  background: linear-gradient(135deg, #3b82f6, #93c5fd);
  border: 0;
  border-radius: 12px;
  color: #1a1330;
  font-size: 0.84rem;
  font-weight: 800;
  padding: 10px 20px;
  cursor: pointer;
  text-align: center;
}
.qzsp-btn-primary:hover { filter: brightness(1.08); }

/* Settings modal additions */
.qzsp-settings .qzsp-settings-body { padding: 18px 20px 4px; display: flex; flex-direction: column; gap: 10px; }
.qzsp-label { font-size: 0.78rem; font-weight: 700; color: #3b82f6; text-transform: uppercase; letter-spacing: 0.06em; }
.qzsp-count-row { display: flex; align-items: center; gap: 12px; }
.qzsp-slider { flex: 1; accent-color: #3b82f6; cursor: pointer; }
.qzsp-count-val { min-width: 24px; text-align: center; font-weight: 700; font-size: 1rem; color: #fff; }
.qzsp-diff-row { display: flex; gap: 8px; }
.qzsp-diff-opt { flex: 1; text-align: center; padding: 8px 4px; border-radius: 8px; border: 1px solid rgba(37,99,235,0.25); cursor: pointer; font-size: 0.82rem; font-weight: 600; color: #b0b0c0; transition: all 0.15s; user-select: none; }
.qzsp-diff-opt:hover { border-color: rgba(59,130,246,0.5); color: #fff; }
.qzsp-diff-opt.active { background: rgba(37,99,235,0.25); border-color: #3b82f6; color: #fff; }
.qzsp-diff-opt input[type="radio"] { display: none; }
.qzsp-reset-btn { margin-top: 6px; font-size: 0.78rem; padding: 7px 14px; opacity: 0.75; }
.qzsp-reset-btn:hover { opacity: 1; }
.qzsp-reset-hint { margin: 0; font-size: 0.72rem; color: #7a7a9a; line-height: 1.4; }

/* Folder-grouped source picker */
.qzsp-folder { border: 1px solid rgba(37,99,235,0.18); border-radius: 10px; overflow: hidden; }
.qzsp-folder-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; cursor: pointer;
  background: rgba(37,99,235,0.08);
  transition: background 0.15s; user-select: none;
}
.qzsp-folder-header:hover { background: rgba(37,99,235,0.16); }
.qzsp-folder-header.open { background: rgba(37,99,235,0.14); }
.qzsp-folder-toggle { font-size: .75rem; color: rgba(255,255,255,.5); flex-shrink: 0; transition: transform .2s; }
.qzsp-folder-icon { font-size: 1rem; flex-shrink: 0; }
.qzsp-folder-name { font-size: .88rem; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qzsp-folder-count { font-size: .72rem; color: rgba(255,255,255,.45); font-weight: 600; flex-shrink: 0; }
.qzsp-folder-selall {
  font-size: .68rem; font-weight: 700; padding: 3px 9px; border-radius: 20px;
  background: rgba(59,130,246,.12); color: rgba(59,130,246,.85);
  border: 1px solid rgba(59,130,246,.25); cursor: pointer; flex-shrink: 0;
  transition: background .15s;
}
.qzsp-folder-selall:hover { background: rgba(59,130,246,.22); }
.qzsp-folder-files { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 10px; }
.qzsp-folder-list { gap: 6px; }

/* Fallback for browsers without :has() — JS adds .co-inner-wide */
.co-inner.co-inner-wide {
  max-width: 1280px;
  align-items: stretch;
}

.co-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 36px;
  justify-content: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-top-color: rgba(255, 255, 255, 0.22);
  border-radius: 40px;
  padding: 5px;
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
  position: relative;
}
.co-nav::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 40px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0) 60%);
}
.co-nav-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 30px;
  padding: 7px 15px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.79rem;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.2s ease;
  animation: tabSlideIn 0.32s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}
.co-nav-btn:nth-child(1) {
  animation-delay: 0.04s;
}
.co-nav-btn:nth-child(2) {
  animation-delay: 0.09s;
}
.co-nav-btn:nth-child(3) {
  animation-delay: 0.14s;
}
.co-nav-btn:nth-child(4) {
  animation-delay: 0.19s;
}
.co-nav-btn:nth-child(5) {
  animation-delay: 0.24s;
}
.co-nav-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -80%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.45s ease;
  pointer-events: none;
}
.co-nav-btn:hover::after {
  left: 130%;
}
.co-nav-btn:hover {
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.co-nav-btn:active {
  transform: scale(0.96) translateY(0);
}
.co-nav-btn.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.32), rgba(14, 165, 233, 0.22));
  color: #fff;
  border-color: rgba(59, 130, 246, 0.45);
  border-top-color: rgba(255, 255, 255, 0.3);
  box-shadow:
    0 2px 16px rgba(59, 130, 246, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  animation:
    tabPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    tabGlow 2.4s ease-in-out 0.4s infinite;
}
.co-nav-btn.active::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 55%);
  pointer-events: none;
}

.co-logo {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  background: linear-gradient(135deg, #3b82f6, #0ea5e9, #fb923c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-bottom: 4px;
  filter: drop-shadow(0 0 30px rgba(59, 130, 246, 0.3));
}
.co-tag {
  text-align: center;
  color: var(--on-glass-muted);
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 28px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.co-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 20px 22px;
  margin-bottom: 12px;
  animation: fadeUp 0.22s ease;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}
.co-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 60%);
  pointer-events: none;
}
.co-card h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  color: var(--purple);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--divider);
}

.co-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid var(--row-border);
  background: var(--row-bg);
  margin-bottom: 7px;
  transition: all 0.18s cubic-bezier(0.34, 1.2, 0.64, 1);
  position: relative;
  overflow: hidden;
}
.co-file::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 60%);
  pointer-events: none;
}
.co-file:hover {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(59, 130, 246, 0.15);
}
.co-file-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}
.co-file-name {
  font-weight: 800;
  font-size: 0.84rem;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--on-glass);
}
.co-file-meta {
  font-size: 0.69rem;
  color: var(--on-glass-faint);
  flex-shrink: 0;
  font-weight: 600;
}
.co-info-row {
  display: flex;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 0.5px solid var(--divider);
  font-size: 0.84rem;
}
.co-info-row:last-child {
  border-bottom: none;
}
.co-info-label {
  font-weight: 800;
  color: var(--on-glass-muted);
  width: 90px;
  flex-shrink: 0;
}
.co-info-val {
  font-weight: 700;
  color: var(--on-glass);
}
.ws-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 6px;
}
.ws-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  color: var(--text);
}
.ws-sub {
  font-size: 0.88rem;
  color: #ddd;
  font-weight: 600;
  max-width: 340px;
  line-height: 1.65;
}
.ws-hint {
  font-size: 0.78rem;
  color: #ccc;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 6px 14px;
}

/* AI SIDE PANEL */
#aiTab {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 85;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  border-radius: 12px 0 0 12px;
  padding: 14px 5px;
  writing-mode: vertical-rl;
  font-family: 'Fredoka One', cursive;
  font-size: 0.72rem;
  cursor: pointer;
  letter-spacing: 0.08em;
  box-shadow: -3px 0 10px rgba(37, 99, 235, 0.3);
  transition: opacity 0.2s;
}
#aiTab.hidden {
  opacity: 0;
  pointer-events: none;
}
#aiHoverZone {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 16px;
  z-index: 80;
  cursor: pointer;
}
#aiPanel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition:
    width 0.32s cubic-bezier(0.34, 1.2, 0.64, 1),
    border-color 0.28s,
    box-shadow 0.28s;
  z-index: 50;
}
#aiPanel.visible {
  width: var(--ai-w);
  border-left: 1px solid rgba(37, 99, 235, 0.25);
  box-shadow: -8px 0 40px rgba(37, 99, 235, 0.2);
}
/* ── AI PANEL ─────────────────────────────── */
/* ── AI PANEL — Glass redesign ───────────── */
#aiPanel {
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}
#aiPanel.visible {
  box-shadow: -8px 0 40px rgba(37, 99, 235, 0.15);
}
.ai-hdr {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(37, 99, 235, 0.18);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  background: rgba(37, 99, 235, 0.1);
  flex-shrink: 0;
}
.ai-av-wrap {
  position: relative;
  flex-shrink: 0;
}
.ai-av {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}
.ai-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #06d6a0;
  border: 2px solid var(--card);
  box-shadow: 0 0 6px rgba(6, 214, 160, 0.6);
}
.ai-hdr-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.ai-hdr h3 {
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  color: var(--purple);
  line-height: 1;
}
.ai-hdr p {
  font-size: 0.67rem;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-hdr-actions {
  display: flex;
  gap: 5px;
  align-items: center;
}
.ai-icon-btn {
  width: 30px;
  height: 30px;
  border: 1.5px solid rgba(37, 99, 235, 0.3);
  border-radius: 9px;
  background: rgba(37, 99, 235, 0.1);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.14s;
  font-weight: 800;
}
.ai-icon-btn:hover {
  background: rgba(37, 99, 235, 0.18);
}
.ai-close {
  width: 30px;
  height: 30px;
  border: 1.5px solid rgba(14, 165, 233, 0.4);
  border-radius: 9px;
  background: rgba(14, 165, 233, 0.12);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--pink);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.14s;
  font-weight: 800;
}
.ai-close:hover {
  background: rgba(14, 165, 233, 0.3);
  border-color: rgba(14, 165, 233, 0.7);
}
.ai-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  scrollbar-width: thin;
  scrollbar-color: rgba(37, 99, 235, 0.25) transparent;
}
.ai-msgs::-webkit-scrollbar {
  width: 3px;
}
.ai-msgs::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.25);
  border-radius: 3px;
}
.ai-msg-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fadeUp 0.18s ease;
}
.ai-msg-wrap.user {
  align-items: flex-end;
}
.msg-sender {
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 2px;
}
.msg-sender.bot-sender {
  color: var(--purple);
}
.msg-sender.user-sender {
  color: #4cc9f0;
}
.msg-sender-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.msg-sender.bot-sender .msg-sender-dot {
  background: var(--purple);
}
.msg-sender.user-sender .msg-sender-dot {
  background: #4cc9f0;
}
.msg-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 94%;
}
.ai-msg-wrap.user .msg-body {
  align-items: flex-end;
}
.ai-bubble {
  padding: 11px 14px;
  font-size: 0.83rem;
  line-height: 1.65;
  word-break: break-word;
  border-radius: 14px;
  max-width: 100%;
}
.ai-bubble.bot {
  background: rgba(37, 99, 235, 0.07);
  border: 1px solid rgba(37, 99, 235, 0.13);
  color: var(--text);
}
body.night #aiPanel {
  background: rgba(15, 14, 23, 0.88);
}
body.night .ai-bubble.bot {
  background: rgba(37, 99, 235, 0.11);
  border-color: rgba(37, 99, 235, 0.2);
}
.ai-bubble.user {
  background: rgba(76, 201, 240, 0.08);
  border: 1px solid rgba(76, 201, 240, 0.18);
  color: var(--text);
}
body.night .ai-bubble.user {
  background: rgba(76, 201, 240, 0.1);
  border-color: rgba(76, 201, 240, 0.22);
}
.msg-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.ai-msg-wrap:hover .msg-meta {
  opacity: 1;
}
.msg-time {
  font-size: 0.61rem;
  color: var(--muted);
}
.msg-action-btn {
  font-size: 0.65rem;
  color: var(--muted);
  cursor: pointer;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.15);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  transition: all 0.14s;
}
.msg-action-btn:hover {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
}
.user-btn {
  background: rgba(76, 201, 240, 0.08);
  border-color: rgba(76, 201, 240, 0.2);
  color: #4cc9f0;
}
.user-btn:hover {
  background: #4cc9f0 !important;
  color: #fff !important;
  border-color: #4cc9f0 !important;
}
.ai-bubble b,
.ai-bubble strong {
  font-weight: 700;
  color: var(--text);
}
.ai-bubble em {
  font-style: italic;
}
.ai-bubble code {
  background: rgba(37, 99, 235, 0.1);
  border-radius: 5px;
  padding: 1px 5px;
  font-family: 'Courier New', monospace;
  font-size: 0.8em;
  color: var(--purple);
}
.ai-bubble .md-h {
  font-weight: 700;
  color: var(--text);
  margin: 14px 0 6px;
  line-height: 1.3;
}
.ai-bubble .md-h1 {
  font-size: 1.05rem;
}
.ai-bubble .md-h2 {
  font-size: 0.97rem;
}
.ai-bubble .md-h3 {
  font-size: 0.88rem;
}
.ai-bubble .md-p {
  margin: 0;
  line-height: 1.7;
}
.ai-bubble .md-gap {
  height: 8px;
}
.ai-bubble .md-ul,
.ai-bubble .md-ol {
  padding-left: 20px;
  margin: 4px 0 8px;
}
.ai-bubble .md-ul li,
.ai-bubble .md-ol li {
  margin-bottom: 5px;
  line-height: 1.65;
}
.ai-bubble .md-bq {
  border-left: 3px solid var(--purple);
  margin: 8px 0;
  padding: 6px 12px;
  background: rgba(37, 99, 235, 0.06);
  border-radius: 0 6px 6px 0;
  color: var(--muted);
  font-style: italic;
}
.ai-bubble .md-hr {
  border: none;
  border-top: 1px solid rgba(37, 99, 235, 0.2);
  margin: 12px 0;
}
.ai-bubble .md-code-block {
  background: var(--dp-solid);
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 8px;
  margin: 10px 0;
  overflow: hidden;
}
.ai-bubble .md-code-lang {
  background: rgba(37, 99, 235, 0.12);
  padding: 3px 10px;
  font-size: 0.7rem;
  font-family: 'Courier New', monospace;
  color: var(--purple);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.ai-bubble .md-code-block pre {
  margin: 0;
  padding: 10px 12px;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text);
}
.typing-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ai-bubble .katex-display,
.aip-bubble .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 0;
  margin: 8px 0;
}
.ai-bubble .katex,
.aip-bubble .katex {
  font-size: 1em;
}
.ai-bubble .md-math-block,
.aip-bubble .md-math-block {
  overflow-x: auto;
  padding: 4px 0;
  margin: 6px 0;
  text-align: center;
}
.ai-action-bar {
  display: flex;
  gap: 7px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.ai-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid rgba(37, 99, 235, 0.3);
  background: rgba(37, 99, 235, 0.07);
  color: var(--purple);
  font-size: 0.73rem;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  transition:
    background 0.13s,
    border-color 0.13s;
}
.ai-action-btn:hover {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(37, 99, 235, 0.5);
}
.aip-msg-row .ai-action-bar {
  margin-top: 8px;
}
.aip-msg-row .ai-action-btn {
  font-size: 0.72rem;
}
.typing-bubble {
  background: rgba(37, 99, 235, 0.07);
  border: 1px solid rgba(37, 99, 235, 0.13);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  gap: 5px;
  align-items: center;
  width: fit-content;
}
body.night .typing-bubble {
  background: rgba(37, 99, 235, 0.11);
}
.typing-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: dotBounce 1.2s ease-in-out infinite;
}
.typing-bubble span:nth-child(1) {
  background: var(--purple);
}
.typing-bubble span:nth-child(2) {
  background: var(--pink);
  animation-delay: 0.2s;
}
.typing-bubble span:nth-child(3) {
  background: var(--orange);
  animation-delay: 0.4s;
}
.ai-sel-banner {
  background: rgba(37, 99, 235, 0.05);
  border-radius: 12px;
  padding: 10px 13px;
  font-size: 0.78rem;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-left: 3px solid var(--purple);
  margin: 0 0 4px;
}
body.night .ai-sel-banner {
  background: rgba(37, 99, 235, 0.09);
}
.ai-sel-banner b {
  color: var(--purple);
  display: block;
  margin-bottom: 3px;
  font-size: 0.8rem;
}
.ai-sel-banner em {
  color: var(--muted);
  font-style: normal;
  display: block;
  font-size: 0.73rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-sel-actions {
  display: flex;
  gap: 5px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.ai-sel-btn {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  border: none;
  border-radius: 8px;
  padding: 5px 11px;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.72rem;
  cursor: pointer;
  transition: opacity 0.13s;
}
.ai-sel-btn:hover {
  opacity: 0.85;
}
.ai-sel-dismiss {
  background: rgba(37, 99, 235, 0.07);
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 8px;
  padding: 5px 11px;
  color: var(--purple);
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.72rem;
  cursor: pointer;
}
.ai-input-area {
  padding: 14px;
  border-top: 1px solid rgba(37, 99, 235, 0.1);
  flex-shrink: 0;
  background: rgba(37, 99, 235, 0.03);
}
.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}
.ai-tip {
  background: rgba(37, 99, 235, 0.07);
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--purple);
  cursor: pointer;
  transition: all 0.14s;
  user-select: none;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
body.night .ai-tip {
  background: rgba(37, 99, 235, 0.11);
  border-color: rgba(37, 99, 235, 0.22);
}
.ai-tip:hover {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.ai-input-box {
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.65);
  transition: all 0.15s;
  overflow: hidden;
  backdrop-filter: blur(12px);
}
body.night .ai-input-box {
  background: rgba(26, 24, 38, 0.75);
  border-color: rgba(37, 99, 235, 0.22);
}
.ai-input-box:focus-within {
  border-color: var(--purple);
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.1),
    0 4px 20px rgba(37, 99, 235, 0.12);
}
.ai-textarea {
  width: 100%;
  border: none;
  background: transparent;
  padding: 11px 14px 4px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.83rem;
  resize: none;
  min-height: 48px;
  max-height: 120px;
  color: var(--text);
  outline: none;
  line-height: 1.5;
}
.ai-textarea::placeholder {
  color: var(--muted);
}
/* scroll-to-bottom button */
.ai-scroll-btn {
  position: relative;
  display: none;
  margin: 0 auto 4px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid rgba(37, 99, 235, 0.28);
  background: var(--card);
  color: var(--purple);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.18);
  transition:
    opacity 0.18s,
    transform 0.18s;
  flex-shrink: 0;
}
.ai-scroll-btn:hover {
  background: rgba(37, 99, 235, 0.1);
  transform: translateY(1px);
}
.ai-scroll-btn.visible {
  display: flex;
}
body.night .ai-scroll-btn {
  background: #0f172a;
  border-color: rgba(37, 99, 235, 0.35);
}
.ai-bottom-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 8px;
}
.ai-char-count {
  font-size: 0.63rem;
  color: var(--muted);
  flex: 1;
}
/* ── Mode toggle pill ───────────────────────────────────────────────── */
.ai-mode-pill {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}
.ai-mode-pill input[type='checkbox'] {
  display: none;
}
.ai-mode-pill .ai-mode-on,
.ai-mode-pill .ai-mode-off {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1.5px solid rgba(37, 99, 235, 0.3);
  background: rgba(37, 99, 235, 0.09);
  color: var(--purple);
  transition:
    background 0.15s,
    opacity 0.15s;
  white-space: nowrap;
}
.ai-mode-pill .ai-mode-off {
  display: none;
}
/* when unchecked (general mode) — swap labels */
.ai-mode-pill input:not(:checked) ~ .ai-mode-on {
  display: none;
}
.ai-mode-pill input:not(:checked) ~ .ai-mode-off {
  display: inline-flex;
  background: rgba(99, 179, 237, 0.1);
  border-color: rgba(99, 179, 237, 0.35);
  color: #3a9ec7;
}
.ai-mode-pill:hover .ai-mode-on,
.ai-mode-pill:hover .ai-mode-off {
  background: rgba(37, 99, 235, 0.18);
}
body.night .ai-mode-pill .ai-mode-on,
body.night .ai-mode-pill .ai-mode-off {
  border-color: rgba(37, 99, 235, 0.25);
}
/* attach + snip buttons */
.ai-attach-btn {
  width: 28px;
  height: 28px;
  border: 1.5px solid rgba(37, 99, 235, 0.22);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.07);
  color: var(--purple);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s,
    box-shadow 0.15s;
  flex-shrink: 0;
  padding: 0;
}
.ai-attach-btn:hover {
  background: rgba(37, 99, 235, 0.18);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}
body.night .ai-attach-btn {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.28);
}
/* snip button — desktop only */
@media (hover: none), (pointer: coarse) {
  .ai-snip-btn {
    display: none;
  }
}
/* attached image preview */
.ai-img-preview {
  display: none;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 8px 12px 4px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(37, 99, 235, 0.3) transparent;
}
.ai-img-preview::-webkit-scrollbar {
  height: 4px;
}
.ai-img-preview::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.3);
  border-radius: 2px;
}
.ai-img-thumb-wrap {
  position: relative;
  flex-shrink: 0;
}
.ai-img-thumb-wrap img {
  display: block;
  height: 68px;
  width: auto;
  max-width: 110px;
  border-radius: 10px;
  border: 1.5px solid rgba(37, 99, 235, 0.28);
  object-fit: cover;
  background: #f0ecff;
  box-shadow: 0 3px 12px rgba(37, 99, 235, 0.18);
}
.ai-img-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  background: rgba(30, 20, 50, 0.65);
  color: #fff;
  font-size: 0.58rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  backdrop-filter: blur(4px);
}
.ai-img-remove:hover {
  background: rgba(220, 40, 30, 0.85);
}
/* in-chat image thumbnails (above user bubble) */
.ai-msg-imgs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}
.ai-msg-img {
  height: 60px;
  width: auto;
  max-width: 90px;
  border-radius: 8px;
  object-fit: cover;
  border: 1.5px solid rgba(76, 201, 240, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}
.ai-msg-img:hover {
  opacity: 0.88;
}
/* snip overlay */
#snipOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  cursor: crosshair;
  background: rgba(0, 0, 0, 0.38);
  user-select: none;
}
#snipHint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 12, 28, 0.82);
  color: #fff;
  padding: 11px 20px;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  pointer-events: none;
  white-space: nowrap;
  border: 1px solid rgba(37, 99, 235, 0.4);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
#snipSel {
  position: fixed;
  display: none;
  border: 2px solid var(--purple);
  background: rgba(37, 99, 235, 0.12);
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.3);
}
/* file chip bar */
.ai-file-chip-bar {
  padding: 7px 14px;
  border-bottom: 1px solid rgba(37, 99, 235, 0.1);
  flex-shrink: 0;
}
.ai-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 20px;
  padding: 4px 10px 4px 8px;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--purple);
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}
.ai-file-chip svg {
  flex-shrink: 0;
  opacity: 0.7;
}
.ai-file-chip #aiFileChipName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-file-chip.empty {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}
body.night .ai-file-chip {
  background: rgba(37, 99, 235, 0.13);
  border-color: rgba(37, 99, 235, 0.28);
}
body.night .ai-file-chip.empty {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.07);
}
/* send / stop morph button */
.ai-send {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  aspect-ratio: 1;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.28s ease,
    box-shadow 0.28s ease,
    border 0.28s ease;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.ai-send:hover:not(.is-stop) {
  transform: scale(1.07);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}
.ai-send.is-stop {
  background: rgba(255, 70, 40, 0.12);
  box-shadow: 0 4px 14px rgba(255, 70, 40, 0.18);
  border: 1.5px solid rgba(255, 90, 55, 0.38);
  border-radius: 10px;
}
.ai-send.is-stop:hover {
  background: rgba(255, 70, 40, 0.22);
  box-shadow: 0 4px 18px rgba(255, 70, 40, 0.32);
}
.ai-send:disabled:not(.is-stop) {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.ai-btn-icon {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}
.ai-icon-plane {
  opacity: 1;
  transform: scale(1);
}
.ai-icon-stop {
  opacity: 0;
  transform: scale(0.45);
  color: #ff5030;
}
.ai-send.is-stop .ai-icon-plane {
  opacity: 0;
  transform: scale(0.45);
}
.ai-send.is-stop .ai-icon-stop {
  opacity: 1;
  transform: scale(1);
}
.ai-row {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}
.think-bubble {
  background: rgba(37, 99, 235, 0.06);
  border: 1px dashed rgba(37, 99, 235, 0.22);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.73rem;
  color: var(--muted);
  max-width: 220px;
  line-height: 1.6;
  backdrop-filter: blur(4px);
}
body.night .think-bubble {
  background: rgba(37, 99, 235, 0.09);
}
.think-label {
  font-weight: 800;
  color: var(--purple);
  display: block;
  margin-bottom: 3px;
  font-size: 0.72rem;
}
.think-text {
  display: block;
  font-style: italic;
  color: var(--muted);
  min-height: 16px;
}
.stream-cursor {
  display: inline-block;
  background: var(--purple);
  width: 2px;
  height: 1em;
  margin-left: 1px;
  vertical-align: middle;
  border-radius: 1px;
  animation: blink 0.7s ease-in-out infinite;
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}
@keyframes rippleOut {
  from {
    transform: scale(0);
    opacity: 1;
  }
  to {
    transform: scale(1.8);
    opacity: 0;
  }
}
.pdf-zoom-pct {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--purple);
  background: #ede0ff;
  padding: 4px 8px;
  border-radius: 7px;
  min-width: 42px;
  text-align: center;
  font-family: 'Nunito', sans-serif;
}
body.night .pdf-zoom-pct {
  background: #334155;
}

/* Sub-option drawer */
.chip-drawer {
  max-height: 0;
  overflow: hidden;
  transition:
    max-height 0.22s ease,
    opacity 0.18s ease;
  opacity: 0;
  margin-top: 0;
}
.chip-drawer.open {
  max-height: 80px;
  opacity: 1;
  margin-top: 6px;
}
.chip-drawer-inner {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.chip-drawer-label {
  font-size: 0.63rem;
  font-weight: 800;
  color: var(--muted);
  margin-right: 4px;
  white-space: nowrap;
}
.chip-sub {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: 20px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.14s;
  white-space: nowrap;
}
.chip-sub:hover {
  filter: brightness(0.92);
  transform: translateY(-1px);
}
.chip-sub-s {
  background: #e0f5ee;
  color: #085041;
  border-color: #5dcaa5;
}
.chip-sub-m {
  background: #ede0ff;
  color: #3c3489;
  border-color: #afa9ec;
}
.chip-sub-t {
  background: #faeeda;
  color: #633806;
  border-color: #ef9f27;
}
.chip-sub-e {
  background: #eaf3de;
  color: #27500a;
  border-color: #97c459;
}
.chip-sub-h {
  background: #fcebeb;
  color: #791f1f;
  border-color: #f09595;
}
body.night .chip-drawer-inner {
  background: #0f172a;
  border-color: #334155;
}
body.night .chip-sub-s {
  background: #085041;
  color: #9fe1cb;
  border-color: #1d9e75;
}
body.night .chip-sub-m {
  background: #26215c;
  color: #cecbf6;
  border-color: #7f77dd;
}
body.night .chip-sub-t {
  background: #412402;
  color: #fac775;
  border-color: #ba7517;
}
body.night .chip-sub-e {
  background: #173404;
  color: #c0dd97;
  border-color: #639922;
}
body.night .chip-sub-h {
  background: #501313;
  color: #f7c1c1;
  border-color: #e24b4a;
}

/* ── INTERACTIVE EFFECTS ─────────────────────────────────────────── */

/* 1. Message entrance — slide + fade */
@keyframes msgSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.ai-msg-wrap {
  animation: msgSlideIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* 2. Pulsing glow on status dot */
@keyframes statusPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(6, 214, 160, 0.6);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(6, 214, 160, 0);
  }
}
.ai-status-dot {
  animation: statusPulse 2.2s ease-in-out infinite;
}

/* 3. AI avatar shimmer on hover */
.ai-av {
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.ai-av:hover {
  transform: scale(1.08) rotate(-4deg);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.55);
}

/* 4. Input box — glow border trace */
@keyframes borderGlow {
  0% {
    box-shadow:
      0 0 0 0 rgba(37, 99, 235, 0),
      0 0 0 3px rgba(37, 99, 235, 0.08);
  }
  50% {
    box-shadow:
      0 0 20px rgba(37, 99, 235, 0.2),
      0 0 0 3px rgba(37, 99, 235, 0.15);
  }
  100% {
    box-shadow:
      0 0 0 0 rgba(37, 99, 235, 0),
      0 0 0 3px rgba(37, 99, 235, 0.08);
  }
}
.ai-input-box:focus-within {
  animation: borderGlow 2s ease-in-out infinite;
}

/* 5. Send button — ripple + morph */
.ai-send {
  position: relative;
  overflow: hidden;
}
.ai-send::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0);
  opacity: 0;
  transition:
    transform 0.4s,
    opacity 0.4s;
}
.ai-send:active::after {
  transform: scale(2.5);
  opacity: 0;
  transition: none;
}

/* 6. Chip hover — lift with glow */
.ai-tip {
  position: relative;
  overflow: hidden;
}
.ai-tip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  opacity: 0;
  transition: opacity 0.18s;
  border-radius: 20px;
}
.ai-tip:hover::before {
  opacity: 1;
}
.ai-tip:hover span,
.ai-tip:hover {
  color: #fff;
  position: relative;
  z-index: 1;
}

/* 7. Message bubble hover glow */
.ai-bubble {
  transition:
    box-shadow 0.18s,
    transform 0.18s;
}
.ai-bubble.bot:hover {
  box-shadow: 0 2px 16px rgba(37, 99, 235, 0.14);
  transform: translateX(2px);
}
.ai-bubble.user:hover {
  box-shadow: 0 2px 16px rgba(76, 201, 240, 0.14);
  transform: translateX(-2px);
}

/* 8. Thinking bubble animated border */
@keyframes dashMove {
  to {
    stroke-dashoffset: -20;
  }
}
.think-bubble {
  position: relative;
}

/* 9. Dot bounce improved */
@keyframes dotBounce {
  0%,
  80%,
  100% {
    transform: scale(0.5) translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: scale(1.1) translateY(-4px);
    opacity: 1;
  }
}

/* 10. Sender label slide */
.msg-sender {
  animation: msgSlideIn 0.18s ease both;
  animation-delay: 0.04s;
}

/* 11. Cursor blink */
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}
.stream-cursor {
  display: inline-block;
  background: var(--purple);
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: middle;
  border-radius: 1px;
  animation: blink 0.65s ease-in-out infinite;
}

/* 12. Panel slide in — spring */
#aiPanel {
  transition:
    width 0.32s cubic-bezier(0.34, 1.2, 0.64, 1),
    border 0.28s;
}

/* 13. Quick action sub-option hover */
.chip-sub {
  transition: all 0.14s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.chip-sub:hover {
  transform: translateY(-2px) scale(1.06);
}

/* 14. Scroll-to-bottom glow pulse on new message */
@keyframes scrollHint {
  0% {
    box-shadow: 0 -4px 16px rgba(37, 99, 235, 0);
  }
  50% {
    box-shadow: 0 -4px 16px rgba(37, 99, 235, 0.25);
  }
  100% {
    box-shadow: 0 -4px 16px rgba(37, 99, 235, 0);
  }
}
.ai-msgs.new-msg {
  animation: scrollHint 0.6s ease;
}

/* 15. AI tab pulse */
@keyframes tabPulse {
  0%,
  100% {
    box-shadow: -3px 0 10px rgba(37, 99, 235, 0.3);
  }
  50% {
    box-shadow: -3px 0 18px rgba(37, 99, 235, 0.6);
  }
}
#aiTab {
  animation: tabPulse 2.5s ease-in-out infinite;
}

/* 16. Night mode toggle spin */
#nightBtn {
  transition: none;
}

/* 17. Stop button pulse when active */
#stopBtn {
  transition: all 0.15s;
}
#stopBtn:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

/* 18. Message action buttons — stagger */
.msg-action-btn {
  transition: all 0.14s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.msg-action-btn:hover {
  transform: translateY(-1px) scale(1.05);
}

/* 19. Frosted panel shimmer sweep on open */
@keyframes shimmerSweep {
  from {
    background-position: -200% 0;
  }
  to {
    background-position: 200% 0;
  }
}
#aiPanel.visible::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(37, 99, 235, 0.6),
    rgba(14, 165, 233, 0.6),
    transparent
  );
  background-size: 200% 100%;
  animation: shimmerSweep 0.8s ease forwards;
  border-radius: 0;
  pointer-events: none;
  z-index: 2;
}
#aiPanel {
  overflow: visible;
}
/* When panel is closed (width:0), its overflow content must not block clicks */
#aiPanel:not(.visible) {
  pointer-events: none;
  overflow: hidden;
}
/* AI panel resize handle — desktop only */
#aiResizeHandle {
  position: absolute;
  left: -4px;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 60;
  border-radius: 4px;
  transition: background 0.18s;
  pointer-events: auto;
}
#aiResizeHandle:hover,
#aiResizeHandle.dragging {
  background: rgba(37, 99, 235, 0.28);
}
@media (hover: none), (pointer: coarse) {
  #aiResizeHandle {
    display: none;
  }
}
/* STUDIP DASHBOARD */
.sd-section-label {
  font-family: 'Fredoka One', cursive;
  font-size: 0.72rem;
  color: var(--section-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.sd-glass-card {
  background: var(--card-inner);
  border: 1px solid var(--card-inner-border);
  border-radius: 20px;
  padding: 18px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}
.sd-glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, transparent 60%);
  pointer-events: none;
}
.sd-course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.sd-course-card {
  background: var(--card-inner);
  border: 1px solid var(--card-inner-border);
  border-radius: 16px;
  padding: 18px 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.2, 0.64, 1);
  position: relative;
  overflow: hidden;
}
.sd-course-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0%, transparent 60%);
  pointer-events: none;
}
.sd-course-card:hover {
  transform: translateY(-4px);
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(59, 130, 246, 0.2);
}
.sd-course-bar {
  width: 100%;
  height: 3px;
  border-radius: 3px;
  margin-bottom: 12px;
}
.sd-course-name {
  font-weight: 800;
  font-size: 0.86rem;
  color: var(--on-glass);
  margin-bottom: 4px;
  line-height: 1.35;
}
.sd-course-meta {
  font-size: 0.68rem;
  color: var(--on-glass-faint);
  font-weight: 600;
}
.sd-course-badge {
  display: inline-block;
  font-size: 0.64rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 20px;
  margin-top: 10px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  color: var(--badge-color);
}
.sd-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .sd-two-col {
    grid-template-columns: 1fr;
  }
}
.sd-tt-day {
  font-family: 'Fredoka One', cursive;
  font-size: 0.72rem;
  color: rgba(59, 130, 246, 0.8);
  margin: 10px 0 6px;
  position: relative;
  z-index: 1;
}
.sd-tt-day:first-child {
  margin-top: 0;
}
.sd-tt-slot {
  background: var(--slot-bg);
  border-left: 3px solid rgba(59, 130, 246, 0.5);
  border-radius: 0 10px 10px 0;
  padding: 7px 11px;
  margin-bottom: 5px;
  position: relative;
  z-index: 1;
}
.sd-tt-time {
  font-size: 0.63rem;
  font-weight: 800;
  color: var(--on-glass-faint);
}
.sd-tt-name {
  font-weight: 800;
  font-size: 0.76rem;
  color: var(--on-glass);
  margin: 2px 0;
}
.sd-tt-room {
  font-size: 0.63rem;
  color: var(--on-glass-faint);
}
.sd-mail {
  border-bottom: 1px solid var(--divider);
  padding: 10px 0;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: all 0.15s;
}
.sd-mail:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.sd-mail:first-child {
  padding-top: 0;
}
.sd-mail:hover .sd-mail-subj {
  color: rgba(59, 130, 246, 0.9);
}
.sd-mail-subj {
  font-weight: 800;
  font-size: 0.76rem;
  color: var(--on-glass);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sd-mail-unread {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3b82f6;
  flex-shrink: 0;
}
.sd-mail-date {
  font-size: 0.63rem;
  color: var(--on-glass-faint);
  margin-top: 2px;
}
.sd-mail-prev {
  font-size: 0.7rem;
  color: var(--on-glass-muted);
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sd-sem-btn {
  background: var(--glass-bg) !important;
  border-color: var(--glass-border) !important;
  color: var(--on-glass) !important;
}
.sd-sem-dd {
  background: var(--card) !important;
  border-color: var(--purple) !important;
}
.sd-sem-dd .sem-opt {
  color: var(--text);
  border-bottom-color: var(--divider) !important;
}
.sd-sem-dd .sem-opt:hover {
  background: rgba(37, 99, 235, 0.15) !important;
  color: var(--purple);
}
.sd-sem-dd .sem-opt.sel {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #3b82f6;
}

/* TOAST NOTIFICATION — moved to features/toast/toast.css */

.ext-install-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--row-bg);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 20px;
  padding: 20px 24px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.ext-install-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}
.ext-install-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}
.ext-install-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--on-glass);
  margin-bottom: 4px;
}
.ext-install-sub {
  font-size: 0.78rem;
  color: var(--on-glass-faint);
  line-height: 1.5;
}
.ext-install-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.ext-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 20px;
  padding: 8px 18px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.76rem;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.18s;
}
.ext-install-primary {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(14, 165, 233, 0.9));
  color: #fff;
}
.ext-install-primary:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}
.ext-install-secondary {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: rgba(59, 130, 246, 0.9);
}
.ext-install-secondary:hover {
  background: rgba(59, 130, 246, 0.22);
}
.ext-howto {
  background: var(--row-bg);
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 20px;
}
.ext-howto-title {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--on-glass);
  margin-bottom: 12px;
}
.ext-howto-steps {
  margin: 0 0 12px 0;
  padding-left: 22px;
  color: var(--on-glass-faint);
  font-size: 0.82rem;
  line-height: 2;
}
.ext-howto-steps li {
  margin-bottom: 2px;
}
.ext-howto-steps code {
  background: rgba(59, 130, 246, 0.15);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.8rem;
  color: rgba(59, 130, 246, 0.9);
}
.ext-howto-note {
  font-size: 0.78rem;
  color: var(--on-glass-faint);
  border-top: 1px solid rgba(59, 130, 246, 0.15);
  padding-top: 10px;
  line-height: 1.6;
}

/* EXTENSION DOWNLOAD BANNER */
.ext-banner {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 20px;
  padding: 20px 24px;
  margin-top: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  backdrop-filter: blur(20px);
  flex-wrap: wrap;
}
.ext-banner-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 200px;
}
.ext-banner-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(14, 165, 233, 0.2));
  border: 1px solid rgba(59, 130, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.ext-banner-text h3 {
  font-weight: 800;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 3px;
}
.ext-banner-text p {
  font-size: 0.75rem;
  color: var(--on-glass-muted);
  font-weight: 600;
  line-height: 1.5;
}
.ext-download-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  background: linear-gradient(135deg, #3b82f6, #0ea5e9);
  border: none;
  border-radius: 30px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.82rem;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  transition: all 0.2s cubic-bezier(0.34, 1.2, 0.64, 1);
  text-decoration: none;
}
.ext-download-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 28px rgba(59, 130, 246, 0.55);
}
.ext-steps {
  width: 100%;
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.ext-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 10px 14px;
  flex: 1;
  min-width: 140px;
}
.ext-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(14, 165, 233, 0.2));
  border: 1px solid rgba(59, 130, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: #3b82f6;
  flex-shrink: 0;
}
.ext-step-text {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
  line-height: 1.5;
}
.ext-step-text b {
  color: rgba(255, 255, 255, 0.8);
  display: block;
  margin-bottom: 1px;
}

@keyframes drift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(30px, -20px) scale(1.08);
  }
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes panelSlideIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.panel-enter {
  animation: panelSlideIn 400ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── PORTAL SECTIONS ──────────────────────────────────────────────── */
.portal-section {
  width: 100%;
  animation: fadeUp 0.25s ease both;
}

/* Profile */
.profile-card {
  display: flex;
  gap: 32px;
  width: 100%;
  flex-wrap: wrap;
}
.profile-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.profile-avatar-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 3px rgba(59, 130, 246, 0.3),
    0 0 32px rgba(59, 130, 246, 0.25);
}
.profile-initials {
  font-family: 'Fredoka One', cursive;
  font-size: 2.2rem;
  color: #fff;
}
.profile-avatar-edit {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.15s;
}
.profile-avatar-edit:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.profile-info {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.profile-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.profile-field label {
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.profile-field input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  outline: none;
  transition: border-color 0.15s;
}
.profile-field input:focus {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.08);
}
.profile-save-btn {
  margin-top: 6px;
  padding: 11px 24px;
  background: linear-gradient(135deg, #3b82f6, #0ea5e9);
  border: none;
  border-radius: 30px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  cursor: pointer;
  align-self: flex-start;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.35);
  transition: all 0.2s;
}
.profile-save-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(59, 130, 246, 0.5);
}

/* Settings */
.settings-card {
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.settings-section-title {
  font-family: 'Fredoka One', cursive;
  font-size: 0.95rem;
  color: rgba(59, 130, 246, 0.85);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.settings-row:last-of-type {
  border-bottom: none;
}
.settings-row-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
}
.settings-row-label span {
  font-size: 1rem;
}
.settings-toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.settings-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.settings-toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}
.settings-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.settings-toggle input:checked + .settings-toggle-slider {
  background: linear-gradient(135deg, #3b82f6, #0ea5e9);
}
.settings-toggle input:checked + .settings-toggle-slider::before {
  transform: translateX(18px);
}
.settings-select {
  background: #1a2540;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  padding: 6px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  outline: none;
  cursor: pointer;
}
.settings-danger-btn {
  background: rgba(255, 107, 55, 0.12);
  border: 1px solid rgba(255, 107, 55, 0.3);
  border-radius: 9px;
  padding: 7px 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  color: rgba(255, 107, 55, 0.85);
  cursor: pointer;
  transition: all 0.15s;
}
.settings-danger-btn:hover {
  background: rgba(255, 107, 55, 0.25);
  color: #ff6b35;
}
.settings-save-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #3b82f6, #0ea5e9);
  border: none;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
  margin-top: 4px;
}
.settings-save-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}
/* ── View Transitions: dark/light mode circular reveal ── */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

/* Settings — light mode overrides */
body:not(.night) .settings-section-title {
  color: #2563eb;
  border-bottom-color: rgba(37, 99, 235, 0.2);
}
body:not(.night) .settings-row {
  border-bottom-color: rgba(37, 99, 235, 0.15);
}
body:not(.night) .settings-row-label {
  color: #3b1a6b;
}
body:not(.night) .settings-toggle-slider {
  background: rgba(37, 99, 235, 0.2);
}
body:not(.night) .settings-toggle-slider::before {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
body:not(.night) .settings-select {
  background: rgba(37, 99, 235, 0.07);
  border-color: rgba(37, 99, 235, 0.25);
  color: #3b1a6b;
}
body:not(.night) .settings-danger-btn {
  background: rgba(255, 107, 55, 0.08);
  border-color: rgba(255, 107, 55, 0.35);
  color: #d9480f;
}
body:not(.night) .settings-danger-btn:hover {
  background: rgba(255, 107, 55, 0.16);
  color: #c0390a;
}

/* Subscription */
.sub-current {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 16px;
  padding: 18px 22px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.sub-badge {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(14, 165, 233, 0.2));
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 20px;
  padding: 5px 16px;
  font-weight: 800;
  font-size: 0.82rem;
  color: #3b82f6;
  flex-shrink: 0;
}
.sub-desc {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 600;
  flex: 1;
}
.sub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
}
@media (max-width: 500px) {
  .sub-grid {
    grid-template-columns: 1fr;
  }
}
.sub-plan {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}
.sub-plan-pro {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 0 40px rgba(59, 130, 246, 0.1);
}
.sub-plan-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #3b82f6, #0ea5e9);
  border-radius: 20px;
  padding: 3px 14px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
}
.sub-plan-name {
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
}
.sub-plan-price {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  color: #fff;
}
.sub-plan-price span {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.4);
  font-family: 'Nunito', sans-serif;
}
.sub-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}
.sub-feat {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
}
.sub-feat.dim {
  color: rgba(255, 255, 255, 0.25);
}
.sub-btn {
  padding: 11px 0;
  border-radius: 30px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  width: 100%;
}
.sub-btn-current {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.4);
}
.sub-btn-upgrade {
  background: linear-gradient(135deg, #3b82f6, #0ea5e9);
  color: #fff;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}
.sub-btn-upgrade:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(59, 130, 246, 0.55);
}

/* Hide native browser password reveal button */
input[type='password']::-ms-reveal,
input[type='password']::-ms-clear,
input[type='password']::-webkit-textfield-decoration-container {
  display: none;
}
input::-webkit-credentials-auto-fill-button {
  visibility: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   NEW PORTAL SHELL — floating sidebar + main layout
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════
   PORTAL — matches preview_option2_midnight.html exactly
   ═══════════════════════════════════════════════════════ */

/* Color variables scoped to portal — dark (night) mode */
body.night #portal {
  --dp-bg: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  --glass-bg: rgba(30, 41, 59, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-top: rgba(255, 255, 255, 0.12);
  --on-glass: #f1f5f9;
  --on-glass-muted: #94a3b8;
  --on-glass-faint: rgba(148, 163, 184, 0.4);
  --card-inner: rgba(255, 255, 255, 0.04);
  --card-inner-border: rgba(255, 255, 255, 0.08);
  --row-bg: rgba(255, 255, 255, 0.04);
  background: var(--dp-bg);
}
/* Color variables scoped to portal — light mode */
body:not(.night) #portal {
  --dp-bg: linear-gradient(135deg, #eff6ff 0%, #f8fafc 50%, #f5f3ff 100%);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-border-top: rgba(255, 255, 255, 0.9);
  --on-glass: #0f172a;
  --on-glass-muted: #64748b;
  --on-glass-faint: rgba(100, 116, 139, 0.4);
  --card-inner: rgba(0, 0, 0, 0.03);
  --card-inner-border: rgba(0, 0, 0, 0.07);
  --row-bg: rgba(0, 0, 0, 0.03);
  background: var(--dp-bg);
}

/* ═══════════════════════════════════════════════════════════════════════
   AI PANEL — dark portal redesign
   Overrides the light-theme defaults so the panel matches the portal UI.
   ═══════════════════════════════════════════════════════════════════════ */

#portal #aiPanel {
  /* Detached from DOM flow by ai-bubble.js — position:fixed is set inline */
  background: rgba(10, 14, 30, 0.96);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 20px;
  /* Kill the old width-slide transition — width is now set inline */
  transition: opacity 0.22s ease, transform 0.22s ease !important;
  /* Kill old absolute sizing that would override fixed */
  width: auto !important;
  height: auto !important;
  max-height: 80vh;
  min-width: 280px;
  min-height: 360px;
}
#portal #aiPanel.visible {
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(59, 130, 246, 0.2);
}

/* Header */
#portal .ai-hdr {
  background: rgba(59, 130, 246, 0.12);
  border-bottom: 1px solid rgba(59, 130, 246, 0.22);
}
#portal .ai-hdr h3 {
  color: #93c5fd;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
}
#portal .ai-hdr p {
  color: rgba(255, 255, 255, 0.45);
}
#portal .ai-av {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}
#portal .ai-status-dot {
  border-color: rgba(10, 14, 30, 0.95);
}
#portal .ai-icon-btn {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}
#portal .ai-icon-btn:hover {
  background: rgba(59, 130, 246, 0.22);
}
#portal .ai-close {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
#portal .ai-close:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.55);
}

/* File chip bar */
#portal .ai-file-chip-bar {
  background: rgba(59, 130, 246, 0.06);
  border-bottom: 1px solid rgba(59, 130, 246, 0.15);
}
#portal .ai-file-chip {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
#portal .ai-file-chip svg { stroke: #93c5fd; }
#portal .ai-file-chip.empty { opacity: 0.55; }

/* Messages area */
#portal .ai-msgs {
  scrollbar-color: rgba(59, 130, 246, 0.3) transparent;
}
#portal .ai-msgs::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.3);
}

/* Sender labels */
#portal .msg-sender.bot-sender  { color: #93c5fd; }
#portal .msg-sender.user-sender { color: #67e8f9; }
#portal .msg-sender.bot-sender  .msg-sender-dot { background: #93c5fd; }
#portal .msg-sender.user-sender .msg-sender-dot { background: #67e8f9; }

/* Message bubbles */
#portal .ai-bubble.bot {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #e2e8f0;
}
#portal .ai-bubble.user {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  color: #e2e8f0;
}
#portal .ai-bubble b,
#portal .ai-bubble strong { color: #f1f5f9; }
#portal .ai-bubble code {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}
#portal .ai-bubble .md-bq {
  border-left-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  color: rgba(255, 255, 255, 0.55);
}
#portal .ai-bubble .md-hr { border-top-color: rgba(59, 130, 246, 0.25); }
#portal .ai-bubble .md-code-block {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(59, 130, 246, 0.2);
}
#portal .ai-bubble .md-code-lang { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
#portal .ai-bubble .md-code-block pre { color: #e2e8f0; }

/* Action buttons (copy, regen, etc.) */
#portal .msg-action-btn {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}
#portal .msg-action-btn:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
#portal .msg-time { color: rgba(255, 255, 255, 0.35); }
#portal .user-btn {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.22);
  color: #67e8f9;
}
#portal .user-btn:hover {
  background: #0891b2 !important;
  border-color: #0891b2 !important;
  color: #fff !important;
}

/* Action bar (copy, regen, export below each message) */
#portal .ai-action-btn {
  background: rgba(59, 130, 246, 0.09);
  border-color: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}
#portal .ai-action-btn:hover {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(59, 130, 246, 0.5);
}

/* Typing indicator */
#portal .typing-bubble {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
}
#portal .typing-bubble span:nth-child(1) { background: #60a5fa; }
#portal .typing-bubble span:nth-child(2) { background: #93c5fd; }
#portal .typing-bubble span:nth-child(3) { background: #bfdbfe; }

/* Scroll-to-bottom button */
#portal .ai-scroll-btn {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(59, 130, 246, 0.35);
  color: #93c5fd;
}
#portal .ai-scroll-btn:hover { background: rgba(59, 130, 246, 0.15); }

/* Selection banner */
#portal .ai-sel-banner {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
  border-left-color: #3b82f6;
}
#portal .ai-sel-banner b   { color: #93c5fd; }
#portal .ai-sel-banner em  { color: rgba(255, 255, 255, 0.45); }
#portal .ai-sel-btn {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
}
#portal .ai-sel-dismiss {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}

/* Input area */
#portal .ai-input-area {
  background: rgba(59, 130, 246, 0.05);
  border-top: 1px solid rgba(59, 130, 246, 0.18);
}
#portal .ai-input-box {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(59, 130, 246, 0.25);
}
#portal .ai-input-box:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12), 0 4px 20px rgba(59, 130, 246, 0.1);
}
#portal .ai-textarea {
  color: #e2e8f0;
}
#portal .ai-textarea::placeholder { color: rgba(255, 255, 255, 0.3); }

/* Chips */
#portal .ai-chips { gap: 6px; }
#portal .ai-tip {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}
#portal .ai-tip:hover {
  background: #2563eb;
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

/* Chip drawers */
#portal .chip-drawer { border-top: 1px solid rgba(59, 130, 246, 0.15); }
#portal .chip-drawer-label { color: rgba(255, 255, 255, 0.45); }
#portal .chip-sub {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}
#portal .chip-sub:hover, #portal .chip-sub.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

/* Mode pill */
#portal .ai-mode-pill .ai-mode-on,
#portal .ai-mode-pill .ai-mode-off {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}
#portal .ai-mode-pill input:not(:checked) ~ .ai-mode-off {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.3);
  color: #67e8f9;
}

/* Char count */
#portal .ai-char-count { color: rgba(255, 255, 255, 0.35); }

/* Attach / snip buttons */
#portal .ai-attach-btn {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}
#portal .ai-attach-btn:hover {
  background: rgba(59, 130, 246, 0.22);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

/* Send button */
#portal .ai-send {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  border: none;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}
#portal .ai-send:hover { opacity: 0.88; }

/* Image preview thumbnails */
#portal .ai-img-thumb {
  border-color: rgba(99, 102, 241, 0.3);
}
#portal .ai-img-remove {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

/* Resize handle */
#portal #aiResizeHandle {
  background: rgba(99, 102, 241, 0.15);
  border-right: 1px solid rgba(99, 102, 241, 0.2);
}
#portal #aiResizeHandle:hover {
  background: rgba(99, 102, 241, 0.28);
}
