/* ============ Starlight — palette from brand refs ============
   deep navy   #0d1428  (ref 3)
   navy        #1b2740  (ref 2)
   gray-blue   #37465e  (ref 1)
   star white  #f5f7fa
================================================================ */

:root {
  --bg-deep: #0a1020;
  --bg-navy: #0d1428;
  --bg-panel: #141f38;
  --bg-card: #18233d;
  --line: #27354f;
  --gray-blue: #37465e;
  --accent: #6d8cc0;
  --accent-bright: #9db8e8;
  --text: #e8edf5;
  --text-dim: #8fa0ba;
  --star: #f5f7fa;
  --radius: 14px;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: radial-gradient(ellipse at 50% -20%, #16213c 0%, var(--bg-navy) 45%, var(--bg-deep) 100%);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
}

#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

main, .nav, .footer { position: relative; z-index: 1; }

/* ============ Wordmark & star ============ */
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--star);
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}

.star { fill: var(--star); flex-shrink: 0; }

.star--sm { width: 0.85em; height: 0.85em; margin: 0 0.03em; transform: translateY(0.08em); }

.star--hero {
  width: 0.82em; height: 0.82em;
  margin: 0 0.04em;
  transform: translateY(0.06em);
  filter: drop-shadow(0 0 18px rgba(157, 184, 232, 0.8));
  animation: starPulse 2.4s ease-in-out infinite;
}

.star--final { width: 0.82em; height: 0.82em; margin: 0 0.04em; transform: translateY(0.06em); filter: drop-shadow(0 0 12px rgba(157, 184, 232, 0.6)); }

.star--quote { width: 34px; height: 34px; margin-bottom: 1.4rem; filter: drop-shadow(0 0 14px rgba(157, 184, 232, 0.7)); }

.star--orbit { width: 46px; height: 46px; filter: drop-shadow(0 0 20px rgba(157, 184, 232, 0.9)); }

@keyframes starPulse {
  0%, 100% { filter: drop-shadow(0 0 14px rgba(157, 184, 232, 0.55)); }
  50% { filter: drop-shadow(0 0 30px rgba(157, 184, 232, 1)); }
}

/* ============ Nav ============ */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 4vw;
  position: sticky;
  top: 0;
  backdrop-filter: blur(14px);
  background: rgba(10, 16, 32, 0.72);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}

.nav__logo { text-decoration: none; flex: 1; }
.wordmark--sm { font-size: 1.35rem; }

.nav__links { display: flex; gap: 2rem; justify-content: center; flex: 1; }
.nav__links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.2s;
}
.nav__links a:hover { color: var(--accent-bright); }

.nav__actions { display: flex; gap: 0.75rem; flex: 1; justify-content: flex-end; align-items: center; }

/* ============ Mobile nav toggle ============ */
.nav__toggle {
  display: none;
  background: none;
  border: 1px solid var(--gray-blue);
  border-radius: 9px;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  color: var(--accent-bright);
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  transition: background 0.2s;
}
.nav__toggle:hover { background: rgba(55, 70, 94, 0.4); }
.nav__toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.nav__mobile {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  z-index: 49;
  background: rgba(10, 16, 32, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 5vw 1.5rem;
  flex-direction: column;
  gap: 0.2rem;
}
.nav__mobile a {
  color: var(--text-dim);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.9rem 1rem;
  border-radius: 8px;
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}
.nav__mobile a:hover { background: rgba(55, 70, 94, 0.3); color: var(--star); }
.nav__mobile .nav__mobile-actions { display: flex; gap: 0.75rem; margin-top: 0.8rem; }
.nav__mobile .nav__mobile-actions .btn { flex: 1; text-align: center; min-height: 44px; display: flex; align-items: center; justify-content: center; }

@media (max-width: 900px) {
  .nav__mobile.open { display: flex; }
}

/* ============ Buttons ============ */
.btn {
  display: inline-block;
  padding: 0.62rem 1.4rem;
  border-radius: 9px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, color 0.2s;
}
.btn--lg { padding: 0.85rem 2.1rem; font-size: 1.02rem; }

.btn--primary {
  background: linear-gradient(135deg, rgba(74, 101, 148, 0.85) 0%, rgba(50, 72, 112, 0.85) 100%);
  color: #fff;
  border: 1px solid rgba(109, 140, 192, 0.35);
  box-shadow: 0 4px 24px rgba(74, 101, 148, 0.3);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(74, 101, 148, 0.45); background: linear-gradient(135deg, rgba(84, 113, 163, 0.9) 0%, rgba(58, 82, 126, 0.9) 100%); }

.btn--ghost {
  color: var(--accent-bright);
  border: 1px solid var(--gray-blue);
  background: rgba(55, 70, 94, 0.18);
}
.btn--ghost:hover { background: rgba(55, 70, 94, 0.4); color: var(--star); }

/* ============ Hero ============ */
.hero {
  text-align: center;
  padding: 7rem 4vw 4rem;
  max-width: 1100px;
  margin: 0 auto;
}

.hero__eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 1.2rem;
}

.wordmark--hero { font-size: clamp(3.4rem, 10vw, 7rem); line-height: 1.05; }

.hero__tagline {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  color: var(--accent-bright);
  margin-top: 1rem;
  font-weight: 500;
}

.hero__sub {
  max-width: 640px;
  margin: 1.4rem auto 0;
  color: var(--text-dim);
  font-size: 1.05rem;
}

.hero__cta { margin-top: 2.4rem; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ============ Terminal ============ */
.hero__terminal { margin-top: 4.5rem; }

.terminal {
  max-width: 720px;
  margin: 0 auto;
  background: rgba(13, 20, 40, 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  text-align: left;
}

.terminal__bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0.7rem 1rem;
  background: rgba(24, 35, 61, 0.9);
  border-bottom: 1px solid var(--line);
}
.terminal__bar .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--gray-blue); }
.terminal__title { margin-left: 0.8rem; font-size: 0.78rem; color: var(--text-dim); font-family: var(--font-display); }

.terminal__body {
  padding: 1.2rem 1.4rem 1.5rem;
  font-family: "Consolas", "SF Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.9;
  overflow-x: auto;
}

.t-user { color: var(--accent-bright); font-weight: 600; }
.t-star { color: var(--star); font-weight: 600; }
.t-dim { color: var(--text-dim); }
.t-ok { color: #7fc9a8; }

.terminal__cursor {
  display: inline-block;
  width: 9px; height: 17px;
  background: var(--accent-bright);
  animation: blink 1.1s steps(1) infinite;
  vertical-align: text-bottom;
}
@keyframes blink { 50% { opacity: 0; } }

/* ============ Strip ============ */
.strip { text-align: center; padding: 3rem 4vw; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.strip p { color: var(--text-dim); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.25em; margin-bottom: 1.2rem; font-family: var(--font-display); }
.strip__items { display: flex; justify-content: center; flex-wrap: wrap; gap: 1.1rem; align-items: center; }
.strip__items span { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.12em; color: var(--accent-bright); font-size: 0.95rem; }
.strip__items i { color: var(--gray-blue); font-style: normal; font-size: 0.7rem; }

/* ============ Sections ============ */
.section { padding: 6.5rem 4vw; max-width: 1180px; margin: 0 auto; }

.section__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.12;
  font-weight: 700;
}
.accent { color: var(--accent-bright); }

.section__sub { color: var(--text-dim); max-width: 560px; margin-top: 1rem; font-size: 1.05rem; }

/* ============ Cards ============ */
.grid { display: grid; gap: 1.3rem; margin-top: 3rem; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }

.card {
  background: linear-gradient(160deg, var(--bg-card) 0%, rgba(20, 31, 56, 0.6) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.8rem 1.6rem;
  transition: transform 0.2s, border-color 0.25s, box-shadow 0.25s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 16px 48px rgba(109, 140, 192, 0.12);
}

.card__icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(109, 140, 192, 0.12);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 1.1rem;
}
.card__icon svg {
  width: 22px; height: 22px;
  fill: none;
  stroke: var(--accent-bright);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card h3 { font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 0.55rem; }
.card p { color: var(--text-dim); font-size: 0.94rem; }

/* ============ Split / Environment ============ */
.section--split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 4rem;
  align-items: center;
}

.split__text p { color: var(--text-dim); margin-top: 1.2rem; }

.checklist { list-style: none; margin: 1.6rem 0 2rem; }
.checklist li {
  padding-left: 1.7rem;
  position: relative;
  margin-bottom: 0.8rem;
  color: var(--text);
  font-size: 0.97rem;
}
.checklist li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--accent-bright);
  font-size: 0.8rem;
}

/* orbit visual */
.split__visual { display: flex; justify-content: center; }
.orbit { position: relative; width: 340px; height: 340px; }

.orbit__center {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
}

.orbit__ring {
  position: absolute;
  top: 50%; left: 50%;
  border: 1px dashed rgba(109, 140, 192, 0.35);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.orbit__ring--1 { width: 170px; height: 170px; animation: spin 14s linear infinite; }
.orbit__ring--2 { width: 250px; height: 250px; animation: spin 22s linear infinite reverse; }
.orbit__ring--3 { width: 330px; height: 330px; animation: spin 30s linear infinite; }

.orbit__chip {
  position: absolute;
  top: -13px; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  color: var(--accent-bright);
  border-radius: 999px;
  padding: 0.15rem 0.75rem;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
}

@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* ============ Skills ============ */
.skills__cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 2.6rem;
  max-width: 900px;
}
.skills__cloud span {
  background: rgba(55, 70, 94, 0.25);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 1.05rem;
  font-size: 0.88rem;
  color: var(--text-dim);
  font-family: var(--font-display);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.skills__cloud span:hover {
  color: var(--star);
  border-color: var(--accent);
  background: rgba(109, 140, 192, 0.15);
}

.stats { display: flex; gap: 4rem; margin-top: 3.4rem; flex-wrap: wrap; }
.stat strong {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--star);
  display: block;
}
.stat span { color: var(--text-dim); font-size: 0.9rem; }

/* ============ Quote ============ */
.section--quote { text-align: center; max-width: 860px; }

/* ============ Trust shield ============ */
.trust-shield {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 280px;
}
.trust-shield svg {
  width: 120px;
  height: 120px;
  color: var(--accent);
  filter: drop-shadow(0 0 24px rgba(109, 140, 192, 0.5));
  animation: starPulse 3s ease-in-out infinite;
}
.section--quote blockquote {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.4vw, 2.1rem);
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
}
.quote__attr { margin-top: 1.6rem; color: var(--text-dim); font-size: 0.95rem; }

/* ============ Pricing ============ */
.pricing { align-items: stretch; }

.price { display: flex; flex-direction: column; position: relative; }
.price h3 { font-size: 1.3rem; }

.price__amount {
  font-family: var(--font-display);
  font-size: 2.7rem;
  font-weight: 700;
  color: var(--star) !important;
  margin: 0.6rem 0 1.1rem;
}
.price__amount span { font-size: 1rem; color: var(--text-dim); font-weight: 400; }

.price ul { list-style: none; margin-bottom: 1.8rem; flex-grow: 1; }
.price ul li {
  color: var(--text-dim);
  font-size: 0.93rem;
  padding: 0.42rem 0 0.42rem 1.5rem;
  position: relative;
}
.price ul li::before { content: "✦"; position: absolute; left: 0; color: var(--accent); font-size: 0.75rem; }
.price__quota {
  margin-top: 0.6rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-weight: 600;
  color: var(--accent-bright) !important;
  font-size: 0.85rem !important;
}

.price .btn { text-align: center; }

.price--featured {
  border-color: var(--accent);
  box-shadow: 0 0 60px rgba(109, 140, 192, 0.18);
  transform: scale(1.03);
}

.price__badge {
  position: absolute;
  top: -13px; left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent) 0%, #4a67a0 100%);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 1rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* ============ Final CTA ============ */
.section--final { text-align: center; padding-bottom: 8rem; }
.wordmark--final { font-size: clamp(2.6rem, 7vw, 4.6rem); }
.section--final p { color: var(--text-dim); margin: 1.2rem 0 2.2rem; font-size: 1.1rem; }

/* ============ Footer ============ */
.footer {
  border-top: 1px solid var(--line);
  padding: 3.5rem 4vw;
  display: flex;
  justify-content: space-between;
  gap: 3rem;
  flex-wrap: wrap;
  background: rgba(10, 16, 32, 0.85);
}
.footer__brand p { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.8rem; }
.footer__cols { display: flex; gap: 4rem; flex-wrap: wrap; }
.footer__cols h4 { font-family: var(--font-display); font-size: 0.9rem; margin-bottom: 0.9rem; color: var(--text); }
.footer__cols a { display: block; color: var(--text-dim); text-decoration: none; font-size: 0.88rem; padding: 0.22rem 0; transition: color 0.2s; }
.footer__cols a:hover { color: var(--accent-bright); }

/* ============ Reveal on scroll ============ */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .nav__links { display: none; }
  .nav__toggle { display: flex; }
  .section--split { grid-template-columns: 1fr; gap: 3rem; }
  .split__visual { order: -1; }
  .orbit { width: 280px; height: 280px; }
  .orbit__ring--3 { width: 270px; height: 270px; }
  .stats { gap: 2.2rem; }
  .nav__actions .btn { padding: 0.7rem 1.2rem; min-height: 44px; display: flex; align-items: center; }
}

@media (max-width: 600px) {
  .terminal__body { font-size: 0.76rem; padding: 0.9rem 1rem; }
  .price--featured { transform: none; }
}

@media (max-width: 480px) {
  .section { padding: 4rem 5vw; }
  .hero { padding: 5rem 5vw 3rem; }
  .hero__cta { gap: 0.6rem; }
  .card { padding: 1.4rem 1.2rem; }
  .footer { gap: 2rem; }
  .footer__cols { gap: 2rem; }
}

@media (max-width: 400px) {
  .terminal__body { font-size: 0.68rem; }
}

/* ================================================================
   AUTH PAGE — split screen
================================================================ */
.auth-body { min-height: 100vh; }

.auth-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* --- brand panel --- */
.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem 2rem 1.25rem;
  overflow: hidden;
  background: radial-gradient(ellipse at 30% 20%, #1a2745 0%, var(--bg-navy) 55%, var(--bg-deep) 100%);
  border-right: 1px solid var(--line);
}
.auth-brand #starfield { position: absolute; inset: 0; }
.auth-brand__logo { position: relative; z-index: 1; text-decoration: none; }

.auth-brand__center { position: relative; z-index: 1; text-align: center; }
.auth-brand__star {
  width: 90px; height: 90px;
  fill: var(--star);
  filter: drop-shadow(0 0 30px rgba(157, 184, 232, 0.9));
  animation: starPulse 2.4s ease-in-out infinite, floatY 4.5s ease-in-out infinite;
}
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

.auth-brand__center h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  margin-top: 1.6rem;
}
.auth-brand__center p { color: var(--text-dim); margin-top: 0.7rem; font-size: 1.02rem; }

.auth-brand__quote {
  position: relative;
  z-index: 1;
  border-left: 2px solid var(--accent);
  padding-left: 1.1rem;
  max-width: 420px;
}
.auth-brand__quote p { color: var(--text); font-size: 0.93rem; font-style: italic; line-height: 1.6; }
.auth-brand__quote span { color: var(--text-dim); font-size: 0.8rem; display: block; margin-top: 0.5rem; }

/* --- form panel --- */
.auth-pane {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 4vw;
  background: var(--bg-deep);
}
.auth-pane__inner { width: 100%; max-width: 400px; }

.auth-pane h1 {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
}
.auth-pane__sub { color: var(--text-dim); font-size: 0.95rem; margin: 0.25rem 0 1.2rem; }

/* --- error box --- */
.auth-error {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(178, 82, 96, 0.12);
  border: 1px solid rgba(214, 108, 124, 0.45);
  color: #e8a2ae;
  border-radius: 9px;
  padding: 0.6rem 0.9rem;
  font-size: 0.87rem;
  margin-bottom: 1.2rem;
}
.auth-error svg {
  width: 17px; height: 17px;
  flex-shrink: 0;
  fill: none;
  stroke: #e8a2ae;
  stroke-width: 2;
  stroke-linecap: round;
}
.auth-error[hidden] { display: none; }
.auth-error.shake { animation: shake 0.3s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.auth-form { display: flex; flex-direction: column; gap: 0.7rem; }
.auth-form.hidden { display: none; }
.auth-switch.hidden, .auth-divider.hidden, .auth-social.hidden { display: none; }

.btn--block { width: 100%; display: block; }

.field__pass { position: relative; }
.field__pass input { padding-right: 3.4rem; }
.field__toggle {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.field__toggle:hover { color: var(--accent-bright); }

.pass-meter {
  height: 3px;
  background: rgba(55, 70, 94, 0.4);
  border-radius: 2px;
  margin-top: 0.55rem;
  overflow: hidden;
}
.pass-meter i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: #d66c7c;
  transition: width 0.3s, background 0.3s;
}
.pass-meter i[data-level="2"] { background: #d6a96c; }
.pass-meter i[data-level="3"] { background: #a9c47f; }
.pass-meter i[data-level="4"] { background: #7fc9a8; }

.auth-switch {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.88rem;
  margin-top: 1.6rem;
}
.auth-switch button {
  background: none;
  border: none;
  color: var(--accent-bright);
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
}
.auth-switch button:hover { text-decoration: underline; }

@media (max-width: 860px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  font-family: var(--font-display);
}
.field input {
  width: 100%;
  background: rgba(10, 16, 32, 0.65);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.6rem 0.9rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.94rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 140, 192, 0.15);
}
.field input::placeholder { color: #5b6b85; }

.auth-form .btn { border: 1px solid rgba(109, 140, 192, 0.35); text-align: center; cursor: pointer; font-size: 0.96rem; margin-top: 0.3rem; }

.auth-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}
.auth-meta a { color: var(--accent-bright); text-decoration: none; }
.auth-meta a:hover { text-decoration: underline; }

/* Custom Checkbox */
.custom-checkbox {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
  color: var(--text-dim);
}
.custom-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}
.custom-checkbox .checkmark {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.custom-checkbox:hover .checkmark {
  border-color: var(--accent);
}
.custom-checkbox input:focus-visible ~ .checkmark {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.custom-checkbox input:checked ~ .checkmark {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(116, 56, 255, 0.4);
}
.custom-checkbox .checkmark::after {
  content: "";
  display: none;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}
.custom-checkbox input:checked ~ .checkmark::after {
  display: block;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--text-dim);
  font-size: 0.78rem;
  margin: 0.75rem 0 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-social { display: flex; flex-direction: column; gap: 0.7rem; }
.auth-social .btn { text-align: center; font-size: 0.9rem; }

.auth-fine {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.76rem;
  margin-top: 1.5rem;
}
.auth-fine a { color: var(--accent-bright); text-decoration: none; }

/* ================================================================
   CHAT PAGE
================================================================ */
.chat-body {
  height: 100vh;
  display: flex;
  overflow: hidden;
}

.chat-sidebar {
  position: relative;
  z-index: 2;
  width: 264px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: rgba(10, 16, 32, 0.88);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--line);
  padding: 1.1rem 0.9rem;
  transition: width 0.2s ease, padding 0.2s ease;
  overflow: hidden;
}

.chat-sidebar.collapsed {
  width: 56px;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  cursor: pointer;
}

/* ---- collapsed: fade out text, icons stay put ---- */
.chat-sidebar.collapsed .btn-text,
.chat-sidebar.collapsed .chat-sidebar__label,
.chat-sidebar.collapsed .chat-list,
.chat-sidebar.collapsed .chat-search,
.chat-sidebar.collapsed .chat-user__info,
.chat-sidebar.collapsed .chat-settings-btn,
.chat-sidebar.collapsed .chat-sidebar__collapse {
  opacity: 0 !important;
  pointer-events: none;
}

/* ---- collapsed: shrink wordmark text to 0 width ---- */
.chat-sidebar.collapsed .wordmark__text {
  max-width: 0;
  opacity: 0;
  pointer-events: none;
}

.chat-sidebar__collapse {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
  z-index: 3;
}
.chat-sidebar__collapse svg { width: 16px; height: 16px; }
.chat-sidebar__collapse:hover { opacity: 1 !important; color: var(--text); background: rgba(255,255,255,0.06); }

.chat-sidebar__logo { text-decoration: none; padding: 0.2rem 0.5rem 1rem; display: block; transition: padding 0.2s ease; }
.chat-sidebar.collapsed .chat-sidebar__logo { padding-left: 0.5rem; padding-right: 0.5rem; display: flex; justify-content: center; align-items: center; }
.chat-sidebar.collapsed .chat-sidebar__logo .wordmark { justify-content: center; }

.chat-new {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  background: linear-gradient(135deg, rgba(74, 101, 148, 0.85) 0%, rgba(50, 72, 112, 0.85) 100%);
  border: 1px solid rgba(109, 140, 192, 0.35);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.52rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  transition: box-shadow 0.2s, padding 0.2s ease;
}
.chat-new:hover { box-shadow: 0 4px 20px rgba(74, 101, 148, 0.4); }
.chat-new svg { flex-shrink: 0; }

.chat-sidebar.collapsed .chat-new { padding-left: 0.5rem; padding-right: 0.5rem; justify-content: center; }
.chat-sidebar.collapsed .chat-new .btn-text { display: none; }

.btn-text { white-space: nowrap; transition: opacity 0.15s ease; }
.wordmark__text {
  display: inline-block;
  max-width: 60px;
  overflow: hidden;
  vertical-align: middle;
  white-space: nowrap;
  transition: max-width 0.2s ease, opacity 0.15s ease;
}

.chat-sidebar__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  font-family: var(--font-display);
  padding: 1.3rem 0.5rem 0.5rem;
  transition: opacity 0.15s ease;
}

.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; transition: opacity 0.15s ease; }
.chat-list a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s, color 0.15s;
}
.chat-list a:hover { background: rgba(55, 70, 94, 0.3); color: var(--text); }
.chat-list a.active { background: rgba(74, 101, 148, 0.32); color: var(--star); }

.chat-maintenance-notice {
  font-size: 0.7rem;
  color: var(--text-dim);
  opacity: 0.4;
  text-align: center;
  padding: 0.4rem 0.8rem;
  margin: 0;
}
.chat-sidebar.collapsed .chat-maintenance-notice { display: none; }

.chat-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.5rem 0.2rem;
  border-top: 1px solid var(--line);
  margin-top: 0.6rem;
  transition: padding 0.2s ease;
}
.chat-sidebar.collapsed .chat-user { padding-left: 0.5rem; padding-right: 0.5rem; justify-content: center; }
.chat-sidebar.collapsed .chat-user__info,
.chat-sidebar.collapsed .chat-settings-btn { display: none; }
.chat-user__avatar {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg-navy);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--star);
}
.chat-user__name { font-size: 0.86rem; font-weight: 500; }
.chat-user__plan { font-size: 0.72rem; color: var(--accent-bright); }

.chat-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.6rem;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 16, 32, 0.88);
}
.chat-header h1 { font-family: var(--font-display); font-size: 1rem; font-weight: 600; }

.chat-effort {
  display: flex;
  gap: 4px;
  background: rgba(10, 16, 32, 0.6);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
}
.chat-effort button {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.32rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.chat-effort button.active { background: rgba(74, 101, 148, 0.55); color: var(--star); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}
.chat-messages__inner { max-width: 760px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 1.4rem; }

.msg { display: flex; gap: 0.85rem; align-items: flex-start; }

.msg__avatar {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.msg--ai .msg__avatar {
  background: rgba(74, 101, 148, 0.3);
  border: 1px solid var(--line);
  border-radius: 50%;
}
.msg--ai .msg__avatar svg { width: 16px; height: 16px; fill: var(--star); filter: drop-shadow(0 0 6px rgba(157, 184, 232, 0.8)); }
.msg--user .msg__avatar {
  background: var(--bg-navy);
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--star);
}

.msg__body { min-width: 0; }
.msg__name { font-family: var(--font-display); font-size: 0.8rem; font-weight: 600; color: var(--accent-bright); margin-bottom: 0.25rem; }
.msg--user .msg__name { color: var(--text-dim); }

/* === ChatGPT/Claude-style layout: user right with bubble, AI left === */
.msg--user {
  flex-direction: row-reverse;
}
.msg--user .msg__avatar {
  display: none;
}
.msg--user .msg__body {
  max-width: 82%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.msg--user .msg__name {
  display: none;
}
.msg--user .msg__text {
  background: rgba(55, 70, 94, 0.35);
  border: 1px solid var(--line);
  border-radius: 16px 16px 4px 16px;
  padding: 0.65rem 1rem;
  word-break: break-word;
}
.msg__effort { font-family: var(--font-display); font-size: 0.72rem; font-weight: 400; color: var(--text-dim); margin-left: 0.5rem; }
.msg__copy {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  background: none;
  border: none;
  padding: 2px;
  margin-left: 0.3rem;
  cursor: pointer;
  color: var(--text-dim);
  opacity: 0.4;
  transition: opacity 0.18s ease, color 0.18s ease;
}
.msg__copy svg { width: 13px; height: 13px; }
.msg__copy:hover { opacity: 1; color: var(--accent-bright); }
.msg__copy.copied { color: #7ee787; opacity: 1; }
.msg__fork {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  opacity: 0.4;
  transition: opacity 0.18s ease, color 0.18s ease;
}
.msg__fork svg { width: 13px; height: 13px; }
.msg__fork:hover { opacity: 1; color: var(--accent-bright); }
.msg__text {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.65;
}
.msg__text code {
  background: rgba(13, 20, 40, 0.6);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1rem 0.38rem;
  font-size: 0.85em;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  color: var(--accent-bright);
}
.msg__text pre {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  overflow-x: auto;
  margin: 0.7rem 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(109, 140, 192, 0.04);
}
.msg__text pre code {
  background: none;
  border: none;
  padding: 0.85rem 1.1rem;
  font-size: 0.82em;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  display: block;
  line-height: 1.6;
  color: var(--text);
}

/* Code block with header bar */
.msg__text .code-block {
  border-radius: 10px;
  overflow: hidden;
}
.msg__text .code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.85rem;
  background: linear-gradient(180deg, rgba(20, 31, 56, 0.7) 0%, rgba(13, 20, 40, 0.4) 100%);
  border-bottom: 1px solid var(--line);
  font-size: 0.7rem;
}
.msg__text .code-block-lang {
  color: var(--text-dim);
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.62rem;
  font-weight: 600;
}
.msg__text .code-block-lang::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 0.45rem;
  vertical-align: middle;
  box-shadow: 0 0 6px rgba(109, 140, 192, 0.5);
}
.msg__text .code-block-copy {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  background: none;
  border: 1px solid transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.68rem;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.msg__text .code-block-copy svg {
  width: 12px;
  height: 12px;
  opacity: 0.7;
  transition: opacity 0.18s ease;
}
.msg__text .code-block-copy:hover {
  color: var(--accent-bright);
  background: rgba(109, 140, 192, 0.08);
  border-color: rgba(109, 140, 192, 0.2);
}
.msg__text .code-block-copy:hover svg {
  opacity: 1;
}
.msg__text .code-block-copy.copied {
  color: #7ee787;
  border-color: rgba(126, 231, 135, 0.2);
}
.msg__text .code-block-copy.copied:hover {
  background: rgba(126, 231, 135, 0.06);
}

/* Syntax highlighting — Starlight navy palette */
.msg__text .hljs-comment, .msg__text .hljs-quote { color: #4a5a76; font-style: italic; }
.msg__text .hljs-keyword, .msg__text .hljs-selector-tag, .msg__text .hljs-literal { color: #9db8e8; }
.msg__text .hljs-type, .msg__text .hljs-built_in, .msg__text .hljs-class .hljs-title { color: #6d8cc0; }
.msg__text .hljs-string, .msg__text .hljs-regexp, .msg__text .hljs-addition { color: #7ee787; }
.msg__text .hljs-number, .msg__text .hljs-variable, .msg__text .hljs-template-variable { color: #e8a87c; }
.msg__text .hljs-function .hljs-title, .msg__text .hljs-section, .msg__text .hljs-name { color: var(--accent-bright); }
.msg__text .hljs-attr, .msg__text .hljs-attribute, .msg__text .hljs-property { color: #c4b5fd; }
.msg__text .hljs-tag { color: var(--text-dim); }
.msg__text .hljs-tag .hljs-name, .msg__text .hljs-tag .hljs-attr { color: var(--accent-bright); }
.msg__text .hljs-deletion { color: #e8a2ae; background: rgba(232, 162, 174, 0.06); }
.msg__text .hljs-meta { color: #4a5a76; }
.msg__text .hljs-emphasis { font-style: italic; }
.msg__text .hljs-strong { font-weight: 700; }
.msg__text strong { font-weight: 700; color: var(--text); }
.msg__text em { font-style: italic; }
.msg__text ul, .msg__text ol {
  margin: 0.4rem 0;
  padding-left: 1.4rem;
}
.msg__text li { margin: 0.2rem 0; }
.msg__text li::marker { color: var(--accent-bright); }
.msg__text p { margin: 0.4rem 0; }
.msg__text p:first-child { margin-top: 0; }
.msg__text p:last-child { margin-bottom: 0; }
.msg__text h1, .msg__text h2, .msg__text h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin: 0.6rem 0 0.3rem;
  color: var(--text);
}
.msg__text a { color: var(--accent-bright); text-decoration: underline; }
.msg__text blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 0.8rem;
  margin: 0.5rem 0;
  color: var(--text-dim);
}
.msg__text hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0.6rem 0;
}

.msg--typing .msg__text::after {
  content: "";
  display: inline-block;
  width: 8px; height: 15px;
  background: var(--accent-bright);
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}

.typing-dots { display: inline-flex; gap: 5px; padding: 0.4rem 0; }
.typing-dots i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-bright);
  animation: dotPulse 0.9s ease-in-out infinite;
}
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dotPulse { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

.chat-composer { padding: 1rem 1.6rem 1.4rem; }
.chat-composer__inner {
  max-width: 760px;
  margin: 0 auto;
  background: rgba(20, 31, 56, 0.78);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem 0.6rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-composer__images {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.chat-composer__images:empty { display: none; }
.composer-image-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.composer-image-thumb img { width: 100%; height: 100%; object-fit: cover; }
.composer-image-thumb__remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  border: none;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.composer-image-thumb__remove:hover { background: rgba(255,0,0,0.8); }

.msg__images {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.msg__image-thumb {
  width: 320px;
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.msg__image-thumb img { width: 100%; display: block; }

.chat-composer__inner:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 140, 192, 0.12);
}

.chat-composer textarea {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  resize: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.5;
  max-height: 180px;
}
.chat-composer textarea::placeholder { color: #5b6b85; }

.chat-composer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.45rem;
}
.chat-composer__tools { display: flex; gap: 0.35rem; }
.chat-composer__tools button {
  background: none;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: 0.95rem;
  width: 30px; height: 30px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.chat-composer__tools button:hover { background: rgba(55, 70, 94, 0.35); color: var(--text); }

.chat-send {
  background: linear-gradient(135deg, rgba(74, 101, 148, 0.9) 0%, rgba(50, 72, 112, 0.9) 100%);
  border: 1px solid rgba(109, 140, 192, 0.35);
  color: #fff;
  width: 34px; height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex; align-items: center; justify-content: center;
  transition: box-shadow 0.2s, transform 0.15s;
}
.chat-send:hover { box-shadow: 0 4px 18px rgba(74, 101, 148, 0.45); transform: translateY(-1px); }

.chat-send--stop {
  background: linear-gradient(135deg, rgba(180, 60, 60, 0.9) 0%, rgba(140, 40, 40, 0.9) 100%);
  border: 1px solid rgba(200, 80, 80, 0.4);
  animation: stop-pulse 1.5s ease-in-out infinite;
}
.chat-send--stop:hover { box-shadow: 0 4px 18px rgba(180, 60, 60, 0.45); transform: translateY(-1px); }
.chat-send--stop svg { width: 14px; height: 14px; }

@keyframes stop-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200, 80, 80, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(200, 80, 80, 0); }
}

.msg--stopped .msg__text { opacity: 0.5; font-style: italic; }

.chat-hint {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.6rem;
}

.chat-mobile-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem;
  cursor: pointer;
  color: var(--text-dim);
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin-right: 0.6rem;
  transition: background 0.15s, color 0.15s;
}
.chat-mobile-toggle:hover { background: rgba(55, 70, 94, 0.3); color: var(--text); }
.chat-mobile-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.chat-overlay { display: none; }

@media (max-width: 760px) {
  .chat-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 280px;
    transform: translateX(-100%);
    z-index: 100;
    transition: transform 0.25s ease;
  }
  .chat-sidebar.open { transform: translateX(0); }
  .chat-sidebar.collapsed { width: 280px; padding-left: 0.9rem; padding-right: 0.9rem; }
  .chat-sidebar.collapsed .btn-text,
  .chat-sidebar.collapsed .chat-sidebar__label,
  .chat-sidebar.collapsed .chat-list,
  .chat-sidebar.collapsed .chat-search,
  .chat-sidebar.collapsed .chat-user__info,
  .chat-sidebar.collapsed .chat-settings-btn,
  .chat-sidebar.collapsed .chat-sidebar__collapse { opacity: 1 !important; pointer-events: auto; }
  .chat-sidebar.collapsed .wordmark__text { max-width: 60px; opacity: 1; pointer-events: auto; }
  .chat-sidebar__collapse { display: none; }
  .chat-mobile-toggle { display: flex; }
  .chat-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
  }
  .chat-overlay.open { display: block; }
  .chat-header { padding: 0.7rem 0.8rem; gap: 0.5rem; }
  .chat-header h1 { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-header__actions { gap: 0.2rem; }
  .chat-messages { padding: 1.2rem 0.8rem; }
  .chat-composer { padding: 0.6rem 0.8rem 1rem; }
  .chat-composer__inner { padding: 0.6rem 0.7rem 0.5rem; }
  .chat-composer__row { flex-wrap: wrap; gap: 0.4rem; }
  .chat-composer__tools { gap: 0.2rem; }
  .chat-composer__tools button { width: 32px; height: 32px; }
  .chat-composer__right { gap: 0.3rem; flex-wrap: wrap; justify-content: flex-end; }
  .effort-picker__btn { padding: 0.3rem 0.5rem; font-size: 0.72rem; gap: 0.3rem; }
  .effort-picker__btn svg { width: 11px; height: 11px; }
  .effort-picker__btn span { display: none; }
  .effort-picker__btn svg:last-child { display: none; }
  .effort-picker__menu { right: 0; min-width: 180px; }
  .effort-picker__menu--models { min-width: 200px; }
  .chat-send { width: 32px; height: 32px; }
  .chat-hint { font-size: 0.65rem; }
  .msg__image-thumb { width: 100%; }
  .skills-view, .plan-view, .memory-view, .sandbox-view, .sandbox-browser { left: 0; }
  .skills-view__head { flex-direction: column; align-items: stretch; gap: 0.8rem; padding: 1rem; }
  .skills-view__head-left { flex-wrap: wrap; gap: 0.6rem; }
  .skills-view__title { font-size: 1.2rem; padding-top: 0; }
  .skills-view__search { min-width: 0; width: 100%; }
  .skills-view__body { padding: 1rem; }
  .skills-view__tabs { padding: 0 1rem; }
  .plan-view__head { padding: 0.8rem 1rem; }
  .plan-view__head-left { gap: 0.6rem; }
  .plan-view__body { padding: 1rem; }
  .memory-view__head { padding: 1rem; flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .memory-view__head-left { flex-wrap: wrap; gap: 0.6rem; }
  .memory-view__title { font-size: 1.2rem; padding-top: 0; }
  .memory-view__body { padding: 1rem; }
  .sandbox-view__head { padding: 1rem; }
  .sandbox-view__head-left { flex-wrap: wrap; gap: 0.6rem; }
  .sandbox-view__title { font-size: 1.2rem; padding-top: 0; }
  .sandbox-view__body { padding: 1rem; }
  .sandbox-browser__body { flex-direction: column; }
  .sandbox-browser__tree { width: 100%; max-height: 200px; }
  .sandbox-browser__preview { width: 100%; }
  .pinned-panel { min-width: 280px; }
  .memory-add { flex-wrap: wrap; }
  .memory-add select { width: 100%; }
  .memory-add input { width: 100%; flex: 1 1 100%; }
  .skill-cards { grid-template-columns: 1fr; }
  .skills-online__search { flex-direction: column; }
  .skills-online__search input { width: 100%; }
  .modal-overlay { padding: 0.5rem; }
  .modal--lg { width: 100vw; max-height: 100vh; border-radius: 0; }
}

/* --- svg icon sizing in chat --- */
.chat-composer__tools button svg, .chat-send svg, .chat-settings-btn svg, .modal__close svg {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chat-composer__tools button, .chat-send { display: flex; align-items: center; justify-content: center; }

.chat-user__info { flex: 1; min-width: 0; white-space: nowrap; transition: opacity 0.15s ease; }
.chat-settings-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s, transform 0.3s, opacity 0.15s ease;
}
.chat-settings-btn:hover { background: rgba(55, 70, 94, 0.35); color: var(--text); transform: rotate(45deg); }

/* --- error message --- */
.msg--error .msg__avatar {
  background: rgba(178, 82, 96, 0.15);
  border: 1px solid rgba(214, 108, 124, 0.4);
  color: #e8a2ae;
}

/* --- Starlight cosmic avatars (initials) --- */
.avatar-gradient {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  position: relative;
  color: var(--star);
  font-family: "Outfit", var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  background: var(--bg-navy);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(157, 184, 232, 0.08);
}
.avatar-gradient::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
}
.avatar-gradient::after {
  content: "";
  position: absolute;
  top: -20%;
  right: -20%;
  width: 70%;
  height: 70%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(157, 184, 232, 0.15) 0%, transparent 70%);
  z-index: 0;
  pointer-events: none;
}
.avatar-gradient > * { position: relative; z-index: 1; }
.avatar-initials-text { display: inline-block; }
.avatar-gradient--0::before { background: linear-gradient(145deg, #0f1a35, #1c2d52); }
.avatar-gradient--1::before { background: linear-gradient(145deg, #0d1428, #1a1f42); }
.avatar-gradient--2::before { background: linear-gradient(145deg, #0a1020, #15203d); }
.avatar-gradient--3::before { background: linear-gradient(145deg, #0b0f1e, #181730); }

/* 36px avatars: 1 letter = 18px, 2 letters = 14px */
.chat-user__avatar .avatar-initials-1,
.msg__avatar .avatar-initials-1 { font-size: 18px; }
.chat-user__avatar .avatar-initials-2,
.msg__avatar .avatar-initials-2 { font-size: 13px; }

/* 72px settings avatar */
.settings-profile-avatar .avatar-initials-1 { font-size: 34px; }
.settings-profile-avatar .avatar-initials-2 { font-size: 26px; }
.msg--error .msg__name { color: #e8a2ae; }
.msg--error .msg__text {
  color: #e8a2ae;
  background: rgba(178, 82, 96, 0.1);
  border: 1px solid rgba(214, 108, 124, 0.3);
  border-radius: 9px;
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
}

/* --- empty state --- */
.chat-empty {
  text-align: center;
  margin: auto;
  padding: 4rem 1rem;
}
.chat-empty svg {
  width: 52px; height: 52px;
  fill: var(--star);
  filter: drop-shadow(0 0 22px rgba(157, 184, 232, 0.85));
  animation: starPulse 2.4s ease-in-out infinite;
}
.chat-empty h2 { font-family: var(--font-display); font-size: 1.5rem; margin-top: 1.2rem; }
.chat-empty p { color: var(--text-dim); margin-top: 0.4rem; }

/* --- settings modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 10, 20, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal-overlay[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  background: rgba(20, 31, 56, 0.45);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(39, 53, 79, 0.6);
  border-radius: var(--radius);
  padding: 1.6rem 1.7rem;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.18s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}
.modal__head h2 { font-family: var(--font-display); font-size: 1.25rem; }
.modal__close {
  background: none;
  border: none;
  color: var(--text-dim);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.modal__close:hover { background: rgba(55, 70, 94, 0.35); color: var(--text); }

.modal__section { padding: 1.1rem 0; border-top: 1px solid var(--line); }
.modal__section h3 {
  font-family: var(--font-display);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  margin-bottom: 0.9rem;
}
.modal__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  font-size: 0.92rem;
}
.modal__hint { color: var(--text-dim); font-size: 0.8rem; margin-top: 0.6rem; }
.modal__section--danger .modal__row span { color: var(--text-dim); }

.btn--sm { padding: 0.4rem 1rem; font-size: 0.82rem; }
.btn--danger {
  background: rgba(178, 82, 96, 0.18);
  border: 1px solid rgba(214, 108, 124, 0.5);
  color: #e8a2ae;
}
.btn--danger:hover { background: rgba(178, 82, 96, 0.32); }

/* --- toggle switch --- */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute;
  inset: 0;
  background: rgba(55, 70, 94, 0.6);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}
.switch i::before {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.switch input:checked + i { background: rgba(74, 101, 148, 0.8); }
.switch input:checked + i::before { transform: translateX(18px); background: var(--star); }

/* ================================================================
   SITE-WIDE ANIMATIONS
================================================================ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* --- hero entrance --- */
.hero__eyebrow, .hero .wordmark--hero, .hero__tagline, .hero__sub, .hero__cta, .hero__terminal {
  opacity: 0;
  animation: fadeUp 0.55s ease forwards;
}
.hero__eyebrow { animation-delay: 0.04s; }
.hero .wordmark--hero { animation-delay: 0.12s; }
.hero__tagline { animation-delay: 0.22s; }
.hero__sub { animation-delay: 0.32s; }
.hero__cta { animation-delay: 0.42s; }
.hero__terminal { animation-delay: 0.55s; }

/* --- terminal lines appear one by one --- */
.terminal__body p { opacity: 0; animation: fadeUp 0.28s ease forwards; }
.terminal__body p:nth-of-type(1) { animation-delay: 0.8s; }
.terminal__body p:nth-of-type(2) { animation-delay: 1.05s; }
.terminal__body p:nth-of-type(3) { animation-delay: 1.3s; }
.terminal__body p:nth-of-type(4) { animation-delay: 1.55s; }
.terminal__body p:nth-of-type(5) { animation-delay: 1.8s; }
.terminal__body p:nth-of-type(6) { animation-delay: 2.05s; }
.terminal__body p:nth-of-type(7) { animation-delay: 2.3s; }
.terminal__body p:nth-of-type(8) { animation-delay: 2.55s; }
.terminal__body p:nth-of-type(9) { animation-delay: 2.8s; }

/* --- nav link underline sweep --- */
.nav__links a { position: relative; }
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -5px;
  width: 100%; height: 1px;
  background: var(--accent-bright);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
.nav__links a:hover::after { transform: scaleX(1); }

.nav__logo .star--sm { transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.nav__logo:hover .star--sm { transform: translateY(0.08em) rotate(144deg); }

/* --- card icon lift --- */
.card__icon { transition: transform 0.18s ease, background 0.18s ease; }
.card:hover .card__icon { transform: translateY(-4px) rotate(-4deg); background: rgba(109, 140, 192, 0.22); }

/* --- auth entrance --- */
.auth-pane__inner > *:not(.auth-error) { opacity: 0; animation: fadeUp 0.4s ease forwards; }
.auth-error { opacity: 1; }
.auth-pane__inner > *:nth-child(1) { animation-delay: 0.03s; }
.auth-pane__inner > *:nth-child(2) { animation-delay: 0.08s; }
.auth-pane__inner > *:nth-child(3) { animation-delay: 0.13s; }
.auth-pane__inner > *:nth-child(4) { animation-delay: 0.18s; }
.auth-pane__inner > *:nth-child(5) { animation-delay: 0.23s; }
.auth-pane__inner > *:nth-child(6) { animation-delay: 0.28s; }
.auth-pane__inner > *:nth-child(7) { animation-delay: 0.33s; }
.auth-pane__inner > *:nth-child(8) { animation-delay: 0.38s; }
.auth-brand__center h2 { opacity: 0; animation: fadeUp 0.55s 0.2s ease forwards; }
.auth-brand__center p { opacity: 0; animation: fadeUp 0.55s 0.3s ease forwards; }
.auth-brand__quote { opacity: 0; animation: fadeUp 0.55s 0.4s ease forwards; }

/* --- chat entrances --- */
.msg { animation: fadeUp 0.22s ease; }
.chat-list a { animation: fadeUp 0.2s ease both; }
.chat-empty { animation: fadeUp 0.35s ease; }

/* ================================================================
   FAQ
================================================================ */
.faq { max-width: 780px; margin-top: 2.8rem; display: flex; flex-direction: column; gap: 0.8rem; }
.faq__item {
  background: linear-gradient(160deg, var(--bg-card) 0%, rgba(20, 31, 56, 0.6) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 1.4rem;
  transition: border-color 0.25s;
}
.faq__item:hover { border-color: var(--accent); }
.faq__item summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after {
  content: "+";
  color: var(--accent-bright);
  font-size: 1.3rem;
  font-weight: 400;
  transition: transform 0.18s ease;
}
.faq__item[open] summary::after { transform: rotate(45deg); }
.faq__item p { color: var(--text-dim); font-size: 0.92rem; padding-bottom: 1.2rem; animation: fadeUp 0.2s ease; }

/* ================================================================
   CHAT — help button, sidebar actions, effort picker, toast
================================================================ */
.chat-header__actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  position: relative;
}

.chat-export-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  opacity: 0.4;
  cursor: pointer;
  padding: 0.3rem;
  display: flex;
  align-items: center;
  border-radius: 8px;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.chat-export-btn svg {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chat-export-btn:hover { opacity: 0.75; color: var(--text); background: rgba(109, 140, 192, 0.08); }

.chat-export__menu {
  position: absolute;
  top: 100%;
  right: 32px;
  margin-top: 6px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 100;
  animation: fadeUp 0.13s ease;
}
.chat-export__menu[hidden] { display: none; }
.chat-export__menu button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 0.82rem;
  padding: 0.6rem 0.7rem;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.chat-export__menu button:hover {
  background: rgba(109, 140, 192, 0.1);
  color: var(--text);
}
.chat-export__menu button svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.chat-help {
  background: none;
  border: none;
  color: var(--text-dim);
  opacity: 0.4;
  cursor: pointer;
  padding: 0.3rem;
  display: flex;
  align-items: center;
  transition: opacity 0.15s, color 0.15s;
}
.chat-help svg {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chat-help:hover { opacity: 0.75; color: var(--text); }

/* --- Pin button --- */
.chat-pin-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text-dim);
  opacity: 0.4;
  cursor: pointer;
  padding: 0.3rem;
  display: flex;
  align-items: center;
  transition: opacity 0.15s, color 0.15s;
}
.chat-pin-btn svg {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chat-pin-btn:hover { opacity: 0.75; color: var(--text); }
.chat-pin-btn.has-pinned { opacity: 0.7; color: var(--accent); }
.chat-pin-btn__count {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #0a0e1a;
  font-size: 0.6rem;
  font-weight: 700;
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* --- Pinned panel (slide-over from right) --- */
.pinned-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  width: 340px;
  max-height: 70vh;
  background: rgba(20, 31, 56, 0.72);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(39, 53, 79, 0.6);
  border-radius: 12px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.pinned-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.pinned-panel[hidden] { display: none; }

.pinned-panel__head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.pinned-panel__title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}
.pinned-panel__count {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-display);
}
.pinned-panel__close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}
.pinned-panel__close svg { width: 14px; height: 14px; }
.pinned-panel__close:hover { color: var(--text); background: rgba(255,255,255,0.06); }

.pinned-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.pinned-panel__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1.5rem;
  gap: 0.5rem;
}
.pinned-panel__empty svg {
  width: 32px; height: 32px;
  color: var(--text-dim);
  opacity: 0.3;
}
.pinned-panel__empty p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 500;
}
.pinned-panel__empty span {
  font-size: 0.72rem;
  color: var(--text-dim);
  opacity: 0.6;
  line-height: 1.5;
}

.pinned-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.pinned-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(39, 53, 79, 0.4);
}
.pinned-item__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.pinned-item__role {
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pinned-item__role--user { color: var(--accent); }
.pinned-item__role--model { color: #c4b5fd; }
.pinned-item__time {
  font-size: 0.65rem;
  color: var(--text-dim);
  opacity: 0.6;
  margin-left: auto;
}
.pinned-item__unpin {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.pinned-item:hover .pinned-item__unpin { opacity: 0.6; }
.pinned-item__unpin:hover { opacity: 1 !important; color: #e8a2ae; }
.pinned-item__unpin svg { width: 12px; height: 12px; }
.pinned-item__text {
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.55;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  opacity: 0.85;
}
.pinned-item__note {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-style: italic;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  background: rgba(109, 140, 192, 0.08);
  border-left: 2px solid var(--accent);
}

/* --- Message pin icon --- */
.msg__pin {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  opacity: 0.4;
  transition: opacity 0.18s ease, color 0.18s ease;
}
.msg__pin svg { width: 13px; height: 13px; }
.msg__pin:hover { opacity: 1; color: var(--accent-bright); }
.msg__pin.pinned { opacity: 1; color: var(--accent); }
.msg__pin.pinned svg { fill: var(--accent); }
.msg__regen {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  margin-left: 0.3rem;
  opacity: 0.4;
  transition: opacity 0.18s ease, color 0.18s ease;
}
.msg__regen svg { width: 13px; height: 13px; }
.msg__regen:hover { opacity: 1; color: var(--accent-bright); }
.msg.pinned-msg {
  position: relative;
}
.msg.pinned-msg::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.5;
}

.chat-help__panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 240px;
  background: rgba(20, 31, 56, 0.45);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(39, 53, 79, 0.6);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5);
  z-index: 100;
  animation: fadeUp 0.13s ease;
}
.chat-help__panel[hidden] { display: none; }
.chat-help__title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}
.chat-help__panel dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.8rem;
  margin-bottom: 0.7rem;
}
.chat-help__panel dt {
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--text);
  white-space: nowrap;
}
.chat-help__panel dd {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.chat-help__panel a {
  display: inline-block;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.78rem;
  margin-right: 0.8rem;
  transition: color 0.15s;
}
.chat-help__panel a:hover { color: var(--accent-bright); }

.chat-actions { display: flex; flex-direction: column; gap: 2px; margin-top: 0.6rem; }
.chat-actions button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 0.88rem;
  padding: 0.52rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s, padding 0.2s ease;
}
.chat-sidebar.collapsed .chat-actions button { padding-left: 0.5rem; padding-right: 0.5rem; justify-content: center; }
.chat-sidebar.collapsed .chat-actions button .btn-text { display: none; }
.chat-actions button:hover { background: rgba(55, 70, 94, 0.3); color: var(--text); }
.chat-actions button svg {
  width: 15px; height: 15px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-search { margin-top: 0.5rem; animation: fadeUp 0.18s ease; transition: opacity 0.15s ease; }
.chat-search[hidden] { display: none; }
.chat-search input {
  width: 100%;
  background: rgba(10, 16, 32, 0.65);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.86rem;
  outline: none;
}
.chat-search input:focus { border-color: var(--accent); }

.chat-composer__right { display: flex; align-items: center; gap: 0.55rem; }

.effort-picker { position: relative; }
.effort-picker__btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  height: 30px;
  background: rgba(10, 16, 32, 0.5);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0 0.75rem;
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.effort-picker__btn:hover { color: var(--text); border-color: var(--accent); }
.effort-picker__btn svg {
  width: 13px; height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.effort-picker__menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 215px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  z-index: 30;
  animation: fadeUp 0.13s ease;
}
.effort-picker__menu[hidden] { display: none; }
.effort-picker__menu button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.5rem 0.7rem;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s;
}
.effort-picker__menu button span {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text-dim);
  font-size: 0.75rem;
}
.effort-picker__menu--models { min-width: 240px; }
.effort-picker__menu-label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  padding: 0.4rem 0.7rem 0.3rem;
  margin: 0;
}
.effort-picker__menu button:hover { background: rgba(55, 70, 94, 0.3); }
.effort-picker__menu button.active { background: rgba(74, 101, 148, 0.32); }

#mode-menu button {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}
#mode-menu button span {
  margin-top: 0;
  flex-basis: 100%;
  white-space: nowrap;
}

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.88rem;
  padding: 0.7rem 1.15rem;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 200;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Quota alert toast variants */
.toast--warning {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: rgba(60, 50, 20, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(251, 191, 36, 0.3);
  pointer-events: auto;
  max-width: 420px;
}
.toast--urgent {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: rgba(60, 20, 20, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(248, 113, 113, 0.3);
  pointer-events: auto;
  max-width: 420px;
}
.toast__icon {
  flex-shrink: 0;
  margin-top: 2px;
}
.toast--warning .toast__icon { color: #fbbf24; }
.toast--urgent .toast__icon { color: #f87171; }
.toast__icon svg { width: 18px; height: 18px; }
.toast__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.toast__msg {
  font-size: 0.85rem;
  line-height: 1.5;
}
.toast__actions {
  display: flex;
  gap: 0.5rem;
}
.toast__action {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  font-size: 0.75rem;
  font-family: var(--font-display);
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.toast--warning .toast__action:hover { background: rgba(251, 191, 36, 0.15); border-color: rgba(251, 191, 36, 0.4); }
.toast--urgent .toast__action:hover { background: rgba(248, 113, 113, 0.15); border-color: rgba(248, 113, 113, 0.4); }
.toast__close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  transition: color 0.15s;
}
.toast__close:hover { color: var(--text); }
.toast__close svg { width: 14px; height: 14px; }

/* social login buttons */
.auth-social .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}
.auth-social .btn svg { width: 17px; height: 17px; flex-shrink: 0; }

/* ================================================================
   LEGAL PAGES (Terms, Content Policy)
================================================================ */
.legal {
  max-width: 820px;
  margin: 0 auto;
  padding: 7rem 1.5rem 5rem;
  position: relative;
  z-index: 1;
}
.legal__inner { width: 100%; }
.legal__eyebrow {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: 0.6rem;
  opacity: 0;
  animation: fadeUp 0.4s ease forwards;
}
.legal__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.1;
  opacity: 0;
  animation: fadeUp 0.4s 0.06s ease forwards;
}
.legal__updated {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin-top: 0.5rem;
  opacity: 0;
  animation: fadeUp 0.4s 0.12s ease forwards;
}

.legal__toc {
  margin-top: 2.5rem;
  padding: 1.4rem 1.6rem;
  background: linear-gradient(160deg, var(--bg-card) 0%, rgba(20, 31, 56, 0.5) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  opacity: 0;
  animation: fadeUp 0.4s 0.18s ease forwards;
}
.legal__toc h2 {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.8rem;
}
.legal__toc ol {
  list-style: none;
  counter-reset: toc;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 1.5rem;
}
.legal__toc a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
}
.legal__toc a:hover { color: var(--accent-bright); }

.legal__section {
  margin-top: 2.8rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.legal__section.visible { opacity: 1; transform: none; }
.legal__section h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}
.legal__section p {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.75;
  margin-bottom: 1rem;
}
.legal__section p strong { color: var(--text); font-weight: 600; }
.legal__section ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.2rem 0;
}
.legal__section ul li {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.7;
  padding-left: 1.4rem;
  position: relative;
  margin-bottom: 0.5rem;
}
.legal__section ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.legal__section ul li strong { color: var(--text); font-weight: 600; }
.legal__section a {
  color: var(--accent-bright);
  text-decoration: none;
  transition: color 0.15s;
}
.legal__section a:hover { text-decoration: underline; }

.legal__footer {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 0.9rem;
}
.legal__footer a {
  color: var(--accent-bright);
  text-decoration: none;
}
.legal__footer a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .legal__toc ol { grid-template-columns: 1fr; }
}

/* ================================================================
   Model Picker (composer)
================================================================ */
.model-picker { position: relative; }
.model-picker__btn {
  display: flex; align-items: center; gap: 0.4rem;
  background: rgba(10, 16, 32, 0.6);
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-family: var(--font-display);
  cursor: pointer;
  transition: all 0.15s;
}
.model-picker__btn:hover { border-color: var(--accent); color: var(--text); }
.model-picker__btn svg { width: 14px; height: 14px; }
.model-picker__btn svg:last-child { width: 12px; height: 12px; opacity: 0.5; }
.model-picker__menu {
  position: absolute;
  bottom: calc(100% + 0.4rem);
  right: 0;
  min-width: 260px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.3rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 100;
}
.model-picker__menu button {
  display: flex; flex-direction: column; gap: 0.15rem;
  width: 100%; text-align: left;
  background: none; border: none;
  color: var(--text);
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.12s;
}
.model-picker__menu button:hover { background: rgba(255, 255, 255, 0.05); }
.model-picker__menu button.active { background: rgba(138, 127, 255, 0.12); }
.model-picker__menu button.disabled { opacity: 0.4; cursor: not-allowed; }
.model-picker__menu button span {
  font-size: 0.72rem; color: var(--text-dim);
}

/* ================================================================
   Chat List Items (with delete)
================================================================ */
.chat-list__item {
  display: flex; align-items: center; gap: 0.3rem;
  border-radius: 6px;
  transition: background 0.12s;
}
.chat-list__item:hover { background: rgba(255, 255, 255, 0.04); }
.chat-list__item.active { background: rgba(138, 127, 255, 0.1); }
.chat-list__item a {
  flex: 1;
  padding: 0.5rem 0.6rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.12s;
}
.chat-list__item.active a { color: var(--text); }
.chat-list__item:hover a { color: var(--text); }
.chat-list__delete {
  flex-shrink: 0;
  background: none; border: none;
  color: var(--text-dim);
  padding: 0.3rem;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s;
}
.chat-list__delete svg { width: 14px; height: 14px; }
.chat-list__item:hover .chat-list__delete { opacity: 0.6; }
.chat-list__delete:hover { opacity: 1 !important; color: #e8a2ae; background: rgba(232, 162, 174, 0.1); }

.chat-list__branch-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: 0.35rem;
  color: var(--accent);
  opacity: 0.6;
}
.chat-list__branch-badge svg { width: 12px; height: 12px; }

/* ================================================================
   Settings Modal — Large Layout
================================================================ */
.modal--lg { max-width: 760px; width: 92vw; max-height: 85vh; overflow: hidden; }
.modal--lg .modal__head { border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 0; }

.settings-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0;
  height: calc(85vh - 80px);
  overflow: hidden;
}

.settings-nav {
  display: flex; flex-direction: column;
  gap: 0.1rem;
  padding: 1rem 0.5rem;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-blue) transparent;
}
.settings-nav::-webkit-scrollbar {
  width: 6px;
}
.settings-nav::-webkit-scrollbar-track {
  background: transparent;
}
.settings-nav::-webkit-scrollbar-thumb {
  background: var(--gray-blue);
  border-radius: 3px;
}
.settings-nav::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
.settings-nav button {
  background: none; border: none;
  color: var(--text-dim);
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  text-align: left;
  font-size: 0.85rem;
  font-family: var(--font-display);
  cursor: pointer;
  transition: all 0.12s;
}
.settings-nav button:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.settings-nav button.active { background: rgba(138, 127, 255, 0.12); color: var(--accent-bright); }

.settings-panels {
  padding: 1.2rem 1.5rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-blue) transparent;
}
.settings-panels::-webkit-scrollbar {
  width: 6px;
}
.settings-panels::-webkit-scrollbar-track {
  background: transparent;
}
.settings-panels::-webkit-scrollbar-thumb {
  background: var(--gray-blue);
  border-radius: 3px;
}
.settings-panels::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
.settings-panel h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}
.settings-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 1.2rem;
  line-height: 1.5;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.settings-grid .field { display: flex; flex-direction: column; gap: 0.4rem; }
.settings-grid label { font-size: 0.78rem; color: var(--text-dim); font-weight: 500; }
.settings-grid input {
  background: rgba(10, 16, 32, 0.6);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font-inter);
}
.settings-grid input:disabled { opacity: 0.5; cursor: default; }
.settings-grid input:focus { outline: none; border-color: var(--accent); }

.plan-badge {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  background: rgba(138, 127, 255, 0.12);
  border: 1px solid rgba(138, 127, 255, 0.3);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-bright);
  font-family: var(--font-display);
}

.settings-plan-info {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(10, 16, 32, 0.4);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.settings-plan-info p { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 0.7rem; line-height: 1.5; }

/* Model cards */
.model-cards { display: flex; flex-direction: column; gap: 0.8rem; }
.model-card {
  padding: 1rem 1.2rem;
  background: rgba(10, 16, 32, 0.4);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.15s;
}
.model-card:hover { border-color: rgba(138, 127, 255, 0.3); }
.model-card--locked { opacity: 0.5; }
.model-card__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.model-card__name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.model-card__tag {
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  font-weight: 500;
}
.model-card__tag--available {
  background: rgba(80, 200, 120, 0.12);
  color: #5fc880;
}
.model-card__desc {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 0.6rem;
}
.model-card__specs {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.model-card__specs span {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  color: var(--text-dim);
}

/* Settings rows */
.settings-rows { display: flex; flex-direction: column; gap: 0.1rem; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.settings-row:last-child { border-bottom: none; }
.settings-row__info { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.settings-row__title { font-size: 0.88rem; font-weight: 500; color: var(--text); }
.settings-row__desc { font-size: 0.76rem; color: var(--text-dim); line-height: 1.4; max-width: 380px; }
.settings-row--danger .settings-row__title { color: #e8a2ae; }

/* Segmented control */
.seg-control {
  display: flex;
  background: rgba(10, 16, 32, 0.6);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.seg-control button {
  background: none; border: none;
  padding: 0.4rem 0.8rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.12s;
  font-family: var(--font-display);
}
.seg-control button:hover { color: var(--text); }
.seg-control button.active { background: rgba(138, 127, 255, 0.15); color: var(--accent-bright); }

@media (max-width: 640px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--line); }
  .settings-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   Font size & compact mode (applied via body classes)
================================================================ */
.font-sm .msg__text { font-size: 0.82rem; }
.font-md .msg__text { font-size: 0.92rem; }
.font-lg .msg__text { font-size: 1.02rem; }

.font-sm .msg__name { font-size: 0.72rem; }
.font-lg .msg__name { font-size: 0.88rem; }

.compact-mode .msg { padding: 0.6rem 1.2rem; }
.compact-mode .msg + .msg { margin-top: 0; }
.compact-mode .chat-messages { gap: 0; }

/* Midnight theme */
.theme-midnight { background: radial-gradient(ellipse at 50% -20%, #0a1020 0%, #05080f 45%, #03060d 100%); }
.theme-midnight .chat-sidebar { background: linear-gradient(160deg, #080d1a 0%, #05080f 100%); }

/* ================================================================
   Profile picture UI
================================================================ */
.settings-profile-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.settings-profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-navy);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--star);
  flex-shrink: 0;
  overflow: hidden;
  transition: border-color 0.2s;
}
.settings-profile-avatar.has-img { border-color: var(--accent); }
.settings-profile-avatar:not(.has-img):has(.avatar-gradient) { border: none; }
.settings-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.settings-profile-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.settings-profile-hint {
  width: 100%;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* Avatar images in sidebar and messages */
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  image-rendering: high-quality;
  -webkit-font-smoothing: antialiased;
}
.chat-user__avatar.has-img {
  overflow: hidden;
}
.msg--user .msg__avatar.has-img {
  overflow: hidden;
}

/* ================================================================
   Message enter animation (only for new messages)
================================================================ */
@keyframes msgEnter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.msg--enter {
  animation: msgEnter 0.25s ease-out;
}

/* Typewriter cursor */
.tw-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent-bright);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: twBlink 0.8s steps(2) infinite;
}
@keyframes twBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ================================================================
   Skill Library View
================================================================ */
.skills-view {
  position: fixed;
  top: 0;
  left: var(--sidebar-w, 280px);
  right: 0;
  bottom: 0;
  background: transparent;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.skills-view.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.skills-view[hidden] {
  display: none;
}

.skills-view__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 2rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.skills-view__head-left {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.skills-view__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font-body);
  padding: 0;
  transition: color 0.15s;
  position: absolute;
  top: 1.5rem;
  left: 2rem;
}
.skills-view__back:hover { color: var(--text); }
.skills-view__back svg { width: 16px; height: 16px; }

.skills-view__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  padding-top: 2rem;
}

.skills-view__count {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.skills-view__search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  min-width: 260px;
}
.skills-view__search:focus-within {
  border-color: rgba(138, 127, 255, 0.4);
}
.skills-view__search svg {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.skills-view__search input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font-body);
  outline: none;
}
.skills-view__search input::placeholder { color: var(--text-dim); }

.skills-view__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem 3rem;
}

.skills-view__grid {
  max-width: 900px;
  margin: 0 auto;
}

.skills-loading {
  text-align: center;
  color: var(--text-dim);
  padding: 3rem 0;
  font-size: 0.9rem;
}

.skill-category {
  margin-bottom: 2rem;
}
.skill-category__title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.skill-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 0.75rem;
}

.skill-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}
.skill-card.installed {
  border-color: rgba(138, 127, 255, 0.35);
  background: rgba(138, 127, 255, 0.04);
}

.skill-card__content {
  flex: 1;
  min-width: 0;
}

.skill-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.skill-card__title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}
.skill-card__plan {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.skill-card__plan.plan-drift { background: rgba(100, 200, 100, 0.15); color: #6ccc6c; }
.skill-card__plan.plan-orbit { background: rgba(138, 127, 255, 0.15); color: var(--accent-bright); }
.skill-card__plan.plan-nova { background: rgba(255, 180, 50, 0.15); color: #ffb432; }

.skill-card__desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.45;
  margin: 0 0 0.5rem;
}

.skill-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.skill-card__tags span {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

.skill-card__install {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.skill-card__install:hover {
  border-color: rgba(138, 127, 255, 0.4);
  color: var(--accent-bright);
}
.skill-card__install.installed {
  border-color: rgba(138, 127, 255, 0.4);
  color: var(--accent-bright);
  background: rgba(138, 127, 255, 0.1);
}

/* Locked skill cards (premium, above user's plan) */
.skill-card--locked {
  opacity: 0.55;
}
.skill-card--locked .skill-card__title {
  color: var(--text-dim);
}
.skill-card__install--locked {
  border-color: var(--line);
  color: var(--text-dim);
  cursor: not-allowed;
  opacity: 0.7;
}
.skill-card__install--locked:hover {
  border-color: var(--line);
  color: var(--text-dim);
}

/* Skill card badges container */
.skill-card__badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.skill-card__community-badge {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 170, 50, 0.15);
  color: #ffaa32;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.skill-card__uninstall {
  border-color: rgba(255, 100, 100, 0.25);
  color: rgba(255, 120, 120, 0.9);
}
.skill-card__uninstall:hover {
  border-color: rgba(255, 100, 100, 0.5);
  color: #ff6464;
  background: rgba(255, 100, 100, 0.08);
}

/* ================================================================
   Skill Library Tabs
================================================================ */
.skills-view__tabs {
  display: flex;
  gap: 0;
  padding: 0 2rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.skills-tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text-dim);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.skills-tab:hover {
  color: var(--text);
}
.skills-tab.active {
  color: var(--accent-bright);
  border-bottom-color: var(--accent-bright);
}

/* ================================================================
   Online Skill Search
================================================================ */
.skills-view__online {
  max-width: 900px;
  margin: 0 auto;
}
.skills-online__search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.skills-online__search input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.88rem;
  font-family: var(--font-body);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}
.skills-online__search input:focus {
  border-color: rgba(138, 127, 255, 0.4);
}
.skills-online__search input::placeholder {
  color: var(--text-dim);
}
.skills-online__search button {
  padding: 0.6rem 1.2rem;
  font-size: 0.85rem;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.skills-online__search button:hover {
  border-color: rgba(138, 127, 255, 0.4);
  color: var(--accent-bright);
}

.skills-online__hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.skills-online__results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.skills-online__loading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 2rem;
  color: var(--text-dim);
  font-size: 0.88rem;
  justify-content: center;
}
.skills-online__empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.6;
}
.skills-online__error {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  background: rgba(255, 100, 100, 0.08);
  border: 1px solid rgba(255, 100, 100, 0.2);
  color: #ff8080;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Online skill result card */
.online-skill-card {
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elevated);
  transition: border-color 0.15s ease;
}
.online-skill-card:hover {
  border-color: rgba(138, 127, 255, 0.25);
}
.online-skill-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}
.online-skill-card__name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.online-skill-card__stars {
  font-size: 0.75rem;
  color: #ffb432;
}
.online-skill-card__repo {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--accent-bright);
  text-decoration: none;
  margin-bottom: 0.2rem;
}
.online-skill-card__repo:hover {
  text-decoration: underline;
}
.online-skill-card__path {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: monospace;
  margin-bottom: 0.5rem;
}
.online-skill-card__desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.45;
  margin: 0 0 0.75rem;
}
.online-skill-card__preview {
  font-size: 0.8rem;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 0.4rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(138, 127, 255, 0.3);
  background: rgba(138, 127, 255, 0.08);
  color: var(--accent-bright);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.online-skill-card__preview:hover {
  background: rgba(138, 127, 255, 0.15);
  border-color: rgba(138, 127, 255, 0.5);
}

/* ================================================================
   Skill Preview Modal
================================================================ */
.skill-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.skill-preview-modal.open {
  opacity: 1;
  pointer-events: auto;
}
.skill-preview-modal[hidden] {
  display: none;
}
.skill-preview-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.skill-preview-modal__content {
  position: relative;
  width: min(700px, 90vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.skill-preview-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.skill-preview-modal__head h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.skill-preview-modal__close {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: color 0.15s ease;
}
.skill-preview-modal__close:hover {
  color: var(--text);
}
.skill-preview-modal__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--text-dim);
}
.preview-meta__item {
  white-space: nowrap;
}
.preview-meta__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  width: 100%;
}
.preview-tag {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-dim);
}
.skill-preview-modal__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}
.preview-content {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.55;
  margin-bottom: 1rem;
}
.preview-code {
  font-size: 0.75rem;
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  line-height: 1.5;
}
.skill-preview-modal__footer {
  display: flex;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--line);
}
.skill-preview-modal__install {
  font-size: 0.88rem;
  font-family: var(--font-body);
  font-weight: 600;
  padding: 0.55rem 1.5rem;
  border-radius: 8px;
  border: 1px solid rgba(138, 127, 255, 0.4);
  background: rgba(138, 127, 255, 0.12);
  color: var(--accent-bright);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.skill-preview-modal__install:hover {
  background: rgba(138, 127, 255, 0.2);
  border-color: rgba(138, 127, 255, 0.6);
}
.skill-preview-modal__install:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--accent-bright);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================================================================
   Memory View
================================================================ */
.memory-view {
  position: fixed;
  top: 0;
  left: var(--sidebar-w, 280px);
  right: 0;
  bottom: 0;
  background: transparent;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.memory-view.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.memory-view[hidden] {
  display: none;
}

.memory-view__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 2rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.memory-view__head-left {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.memory-view__head-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.memory-view__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font-body);
  padding: 0;
  transition: color 0.15s;
  position: absolute;
  top: 1.5rem;
  left: 2rem;
}
.memory-view__back:hover { color: var(--text); }
.memory-view__back svg { width: 16px; height: 16px; }

.memory-view__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  padding-top: 2rem;
}

.memory-view__count {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.memory-view__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem 3rem;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.memory-loading,
.memory-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 3rem 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.memory-section {
  margin-bottom: 2rem;
}

.memory-section__title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.memory-group {
  margin-bottom: 1.25rem;
}

.memory-group__label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-bright);
  margin-bottom: 0.5rem;
}

.memory-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 0.4rem;
  background: rgba(255, 255, 255, 0.02);
}

.memory-item__text {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.4;
}

.memory-item__input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(138, 127, 255, 0.3);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font-body);
  padding: 0.35rem 0.6rem;
  outline: none;
}

.memory-item__actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.memory-item__edit,
.memory-item__delete,
.memory-item__save,
.memory-item__cancel {
  font-size: 0.72rem;
  font-family: var(--font-body);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.memory-item__edit:hover {
  border-color: rgba(138, 127, 255, 0.4);
  color: var(--accent-bright);
}

.memory-item__delete:hover {
  border-color: rgba(255, 80, 80, 0.4);
  color: #ff6464;
}

.memory-item__save {
  border-color: rgba(138, 127, 255, 0.3);
  color: var(--accent-bright);
}

.memory-item__save:hover {
  background: rgba(138, 127, 255, 0.1);
}

.memory-item__cancel:hover {
  color: var(--text);
}

.memory-add {
  display: flex;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.memory-add select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.8rem;
  font-family: var(--font-body);
  padding: 0.5rem 0.6rem;
  outline: none;
  cursor: pointer;
}

.memory-add input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font-body);
  padding: 0.5rem 0.75rem;
  outline: none;
}
.memory-add input:focus {
  border-color: rgba(138, 127, 255, 0.4);
}

.memory-add button {
  font-size: 0.82rem;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  border: 1px solid rgba(138, 127, 255, 0.3);
  background: rgba(138, 127, 255, 0.1);
  color: var(--accent-bright);
  cursor: pointer;
  transition: background 0.15s ease;
}
.memory-add button:hover {
  background: rgba(138, 127, 255, 0.18);
}

/* ================================================================
   Skill badges in chat messages
================================================================ */
.msg__skills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}
.msg__skills-icon {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--text-dim);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.msg__skill-badge {
  font-size: 0.68rem;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(138, 127, 255, 0.08);
  color: var(--accent-bright);
  border: 1px solid rgba(138, 127, 255, 0.15);
}
.msg__skills-label {
  font-size: 0.68rem;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

/* ================================================================
   Tool call badges in chat messages — collapsible timeline
================================================================ */
.msg__tools {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}
.msg__tools-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.68rem;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 0;
  transition: color 0.15s;
}
.msg__tools-toggle:hover { color: var(--text); }
.msg__tools-toggle-icon {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}
.msg__tools.collapsed .msg__tools-toggle-icon {
  transform: rotate(-90deg);
}
.msg__tools-summary {
  letter-spacing: 0.02em;
}
.msg__tools-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  overflow: hidden;
  max-height: 200px;
  opacity: 1;
  transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.2s ease;
}
.msg__tools.collapsed .msg__tools-list {
  max-height: 0;
  opacity: 0;
  margin: 0;
}
.msg__tools-label {
  font-size: 0.68rem;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
.msg__tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(138, 127, 255, 0.08);
  color: var(--accent-bright);
  border: 1px solid rgba(138, 127, 255, 0.15);
  cursor: help;
  white-space: nowrap;
  position: relative;
}
.msg__tool-badge svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: var(--accent-bright);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.msg__tool-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 100;
  min-width: 240px;
  max-width: 360px;
  background: rgba(24, 35, 61, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--gray-blue);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font-size: 0.78rem;
  font-family: var(--font-body);
  color: var(--text);
  line-height: 1.5;
  white-space: normal;
  text-align: left;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}
.msg__tool-badge:hover .msg__tool-tooltip {
  opacity: 1;
  transform: translateY(0);
}
.msg__continue-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.62rem;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.08);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.15);
  cursor: help;
  white-space: nowrap;
  vertical-align: middle;
  margin-left: 0.4rem;
}
.msg__continue-icon {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.msg__tool-tooltip-title {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.45rem;
}
.msg__tool-tooltip-item {
  display: block;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--line);
}
.msg__tool-tooltip-item:last-child { border-bottom: none; }
.msg__tool-tooltip-item strong {
  display: block;
  font-weight: 500;
  color: var(--text);
  font-size: 0.76rem;
}
.msg__tool-tooltip-item span {
  display: block;
  color: var(--accent-bright);
  font-size: 0.7rem;
  margin-top: 0.1rem;
  word-break: break-all;
}

/* ================================================================
   Todo list (inline task checklist in AI messages)
================================================================ */
.msg__todo {
  margin-top: 0.5rem;
  padding: 0.7rem 0.85rem;
  background: var(--bg-elevated, rgba(255,255,255,0.03));
  border: 1px solid var(--line);
  border-radius: 0.6rem;
}
.msg__todo-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.55rem;
}
.msg__todo-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.msg__todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-family: var(--font-body);
  line-height: 1.4;
}
.todo-item__check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.1rem;
}
.todo-item__check svg {
  width: 16px;
  height: 16px;
}
.todo-item__text {
  color: var(--text);
}
.todo-item--completed .todo-item__check {
  color: var(--accent-bright, #8a7fff);
}
.todo-item--completed .todo-item__text {
  text-decoration: line-through;
  opacity: 0.5;
}
.todo-item--in_progress .todo-item__check {
  color: var(--accent, #6a5acd);
  animation: todo-pulse 1.5s ease-in-out infinite;
}
.todo-item--in_progress .todo-item__text {
  color: var(--accent-bright, #8a7fff);
  font-weight: 500;
}
.todo-item--pending .todo-item__check {
  color: var(--text-dim);
  opacity: 0.4;
}
@keyframes todo-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ================================================================
   Thinking indicator
================================================================ */
.thinking-indicator {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-family: var(--font-body);
  color: var(--text-dim);
  padding: 0.4rem 0;
}
.thinking-word {
  color: var(--accent-bright);
  font-weight: 500;
}
.thinking-time {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  display: inline-block;
}
.thinking-digit {
  display: inline-block;
  transition: opacity 0.2s ease;
}
.thinking-digit--out {
  opacity: 0;
}
.thinking-digit--in {
  animation: thinking-digit-in 0.2s ease forwards;
}
@keyframes thinking-digit-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.thinking-indicator::after {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-bright);
  margin-left: 0.4rem;
  align-self: center;
  animation: thinkPulse 1s ease-in-out infinite;
}
@keyframes thinkPulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}
.thinking-fact {
  font-size: 0.78rem;
  font-family: var(--font-body);
  color: var(--text-dim);
  margin-top: 0.15rem;
  padding: 0.25rem 0;
  max-width: 440px;
  line-height: 1.45;
  opacity: 1;
  transition: opacity 0.3s ease;
}
.thinking-fact::before {
  content: "✦ ";
  color: var(--accent);
  opacity: 0.7;
}
.thinking-fact--out {
  opacity: 0;
}

/* ================================================================
   Plan Management View
================================================================ */
.plan-view {
  position: fixed;
  top: 0;
  left: var(--sidebar-w, 280px);
  right: 0;
  bottom: 0;
  background: transparent;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.plan-view.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.plan-view[hidden] {
  display: none;
}
.plan-view__head {
  display: flex;
  align-items: center;
  padding: 0.9rem 1.6rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(10, 16, 32, 0.85);
  backdrop-filter: blur(12px);
  z-index: 2;
}
.plan-view__head-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.plan-view__back {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0;
  transition: color 0.15s ease;
}
.plan-view__back svg {
  width: 16px;
  height: 16px;
}
.plan-view__back:hover {
  color: var(--text);
}
.plan-view__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.plan-view__body {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.8rem 1.5rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  background: rgba(10, 16, 32, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.plan-view__body::-webkit-scrollbar {
  display: none;
}
.plan-view__current {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}
.plan-view__current strong {
  color: var(--accent-bright);
  font-weight: 600;
}
.plan-view__cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}
@media (max-width: 820px) {
  .plan-view__cards {
    grid-template-columns: 1fr;
  }
}
.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color 0.2s ease;
}
.plan-card:hover {
  border-color: rgba(138, 127, 255, 0.2);
}
.plan-card--featured {
  border-color: rgba(138, 127, 255, 0.3);
  background: rgba(138, 127, 255, 0.03);
}
.plan-card--featured:hover {
  border-color: rgba(138, 127, 255, 0.4);
}
.plan-card__badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-family: var(--font-body);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent-bright);
  color: var(--bg-deep);
  padding: 3px 12px;
  border-radius: 20px;
}
.plan-card__head {
  margin-bottom: 0.7rem;
}
.plan-card__head h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
}
.plan-card__price {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text);
}
.plan-card__price span {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-dim);
}
.plan-card__features {
  list-style: none;
  padding: 0;
  margin: 0 0 0.7rem;
  flex: 1;
}
.plan-card__features li {
  font-size: 0.78rem;
  color: var(--text-dim);
  padding: 0.14rem 0;
  padding-left: 1.2rem;
  position: relative;
}
.plan-card__features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-bright);
  opacity: 0.6;
}
.plan-card__btn {
  width: 100%;
  justify-content: center;
}
.plan-card__quota {
  margin-top: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-weight: 600;
  color: var(--accent-bright) !important;
  font-size: 0.8rem !important;
}
.plan-view__note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 1.5rem;
}
.plan-view__billing-actions {
  text-align: center;
  margin-top: 1rem;
}

/* ================================================================
   Sandbox Universe View
================================================================ */
.sandbox-view {
  position: fixed;
  top: 0;
  left: var(--sidebar-w, 280px);
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at 50% 30%, #0e1a3a 0%, #0a1020 50%, #060916 100%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.sandbox-view.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.sandbox-view[hidden] { display: none; }

.sandbox-view__stars {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.sandbox-view__head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem 1rem;
  flex-shrink: 0;
}
.sandbox-view__head-left {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.sandbox-view__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.85rem;
  transition: color 0.15s;
  position: absolute;
  top: 1.5rem;
  left: 2rem;
}
.sandbox-view__back:hover { color: var(--text); }
.sandbox-view__back svg { width: 16px; height: 16px; }

.sandbox-view__title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #9db8e8 0%, #6d8cc0 50%, #4a6b9e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-top: 2rem;
}
.sandbox-view__count {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.sandbox-view__refresh {
  background: rgba(20, 31, 56, 0.6);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  margin-top: 2rem;
}
.sandbox-view__refresh:hover {
  color: var(--accent-bright);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(109, 140, 192, 0.2);
}
.sandbox-view__refresh svg { width: 18px; height: 18px; }
.sandbox-view__refresh.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.sandbox-view__body {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  padding: 1rem 2rem 3rem;
}

/* --- Permanent orbit background --- */
.sandbox-orbit-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 400px;
  pointer-events: none;
  z-index: 0;
}
.sandbox-orbit-bg__core {
  position: absolute;
  top: 50%; left: 50%;
  width: 50px; height: 50px;
  margin: -25px 0 0 -25px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #9db8e8, #4a6b9e);
  box-shadow: 0 0 40px rgba(109, 140, 192, 0.5), 0 0 80px rgba(109, 140, 192, 0.2);
  animation: corePulse 3s ease-in-out infinite;
}
.sandbox-orbit-bg__ring {
  position: absolute;
  top: 50%; left: 50%;
  border-radius: 50%;
  border: 1px solid rgba(109, 140, 192, 0.12);
  transform: translate(-50%, -50%);
}
.sandbox-orbit-bg__ring--1 { width: 140px; height: 140px; animation: orbitSpin 8s linear infinite; }
.sandbox-orbit-bg__ring--2 { width: 240px; height: 240px; animation: orbitSpin 12s linear infinite reverse; }
.sandbox-orbit-bg__ring--3 { width: 360px; height: 360px; animation: orbitSpin 16s linear infinite; }
.sandbox-orbit-bg__ring::before {
  content: '';
  position: absolute;
  top: -4px; left: 50%;
  width: 8px; height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 10px rgba(157, 184, 232, 0.8);
}
@keyframes orbitSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* --- Empty state --- */
.sandbox-empty {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}
.sandbox-empty__title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.sandbox-empty__desc {
  font-size: 0.9rem;
  color: var(--text-dim);
  max-width: 400px;
}

/* --- Sandbox grid (planets) --- */
.sandbox-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.sandbox-planet {
  position: relative;
  background: linear-gradient(160deg, rgba(20, 31, 56, 0.9) 0%, rgba(14, 22, 42, 0.95) 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s ease;
  animation: planetAppear 0.5s ease forwards;
  opacity: 0;
  transform: scale(0.9) translateY(20px);
}
@keyframes planetAppear {
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.sandbox-planet:hover {
  border-color: rgba(109, 140, 192, 0.4);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 24px rgba(109, 140, 192, 0.15);
  transform: translateY(-2px);
}

.sandbox-planet__glow {
  position: absolute;
  top: -40%; left: -20%;
  width: 140%; height: 80%;
  background: radial-gradient(ellipse at center, rgba(109, 140, 192, 0.12) 0%, transparent 70%);
  pointer-events: none;
  animation: glowDrift 6s ease-in-out infinite alternate;
}
@keyframes glowDrift {
  to { transform: translateX(10%); }
}

.sandbox-planet__head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid rgba(39, 53, 79, 0.5);
}
.sandbox-planet__icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #6d8cc0, #2a3f5f);
  box-shadow: 0 0 12px rgba(109, 140, 192, 0.3);
  flex-shrink: 0;
  position: relative;
  animation: planetPulse 4s ease-in-out infinite;
}
.sandbox-planet__icon::after {
  content: '';
  position: absolute;
  top: -4px; left: 50%;
  width: 44px; height: 16px;
  margin-left: -22px;
  border: 1px solid rgba(109, 140, 192, 0.2);
  border-radius: 50%;
  transform: rotate(-20deg);
}
@keyframes planetPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(109, 140, 192, 0.3); }
  50% { box-shadow: 0 0 20px rgba(109, 140, 192, 0.5); }
}
.sandbox-planet__info { flex: 1; min-width: 0; }
.sandbox-planet__name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sandbox-planet__meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.sandbox-planet__status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  color: #fff;
  flex-shrink: 0;
}
.sandbox-planet__status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
  animation: statusBlink 2s ease-in-out infinite;
}
@keyframes statusBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.sandbox-planet__files {
  padding: 0.75rem 1.2rem;
  border-top: 1px solid rgba(39, 53, 79, 0.5);
}
.sandbox-planet__files-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
.sandbox-planet__file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.sandbox-planet__file {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  background: rgba(39, 53, 79, 0.3);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-family: var(--font-body);
}
.sandbox-planet__file-icon {
  width: 12px; height: 12px;
  flex-shrink: 0;
  opacity: 0.6;
}

.sandbox-planet__actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.2rem 1rem;
}
.sandbox-planet__btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--line);
  background: rgba(20, 31, 56, 0.5);
  color: var(--text-dim);
}
.sandbox-planet__btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(109, 140, 192, 0.1);
}
.sandbox-planet__btn--primary {
  background: linear-gradient(135deg, rgba(74, 101, 148, 0.8) 0%, rgba(50, 72, 112, 0.8) 100%);
  border-color: transparent;
  color: var(--text);
}
.sandbox-planet__btn--primary:hover {
  box-shadow: 0 0 16px rgba(109, 140, 192, 0.3);
  color: #fff;
}
.sandbox-planet__btn svg { width: 14px; height: 14px; }

/* --- Sandbox file browser --- */
.sandbox-browser {
  position: fixed;
  top: 0;
  left: var(--sidebar-w, 280px);
  right: 0;
  bottom: 0;
  background: var(--bg-deep);
  z-index: 30;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.sandbox-browser.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.sandbox-browser[hidden] { display: none; }

.sandbox-browser__body {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  overflow: hidden;
  padding: 0 2rem 2rem;
  gap: 1rem;
}

.sandbox-browser__tree {
  width: 340px;
  flex-shrink: 0;
  background: rgba(20, 31, 56, 0.5);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sandbox-browser__breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--text-dim);
  flex-wrap: wrap;
  min-height: 42px;
}
.sandbox-browser__breadcrumb span {
  cursor: pointer;
  transition: color 0.15s;
  white-space: nowrap;
}
.sandbox-browser__breadcrumb span:hover { color: var(--accent-bright); }
.sandbox-browser__breadcrumb span.current {
  color: var(--text);
  font-weight: 500;
  cursor: default;
}
.sandbox-browser__breadcrumb span.sep {
  color: var(--text-dim);
  opacity: 0.4;
  cursor: default;
}

.sandbox-browser__file-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.sandbox-file-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  border: 1px solid transparent;
}
.sandbox-file-item:hover {
  background: rgba(109, 140, 192, 0.08);
  border-color: rgba(109, 140, 192, 0.15);
}
.sandbox-file-item.active {
  background: rgba(109, 140, 192, 0.15);
  border-color: rgba(109, 140, 192, 0.3);
}
.sandbox-file-item__icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.6;
}
.sandbox-file-item__icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sandbox-file-item__name {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sandbox-file-item__size {
  font-size: 0.7rem;
  color: var(--text-dim);
  flex-shrink: 0;
}
.sandbox-file-item--dir .sandbox-file-item__name {
  font-weight: 500;
  color: var(--accent-bright);
}

.sandbox-browser__preview {
  flex: 1;
  background: rgba(20, 31, 56, 0.5);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sandbox-browser__preview-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  color: var(--text-dim);
  opacity: 0.4;
}
.sandbox-browser__preview-empty svg { width: 48px; height: 48px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sandbox-browser__preview-empty p { font-size: 0.85rem; }

.sandbox-browser__preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.sandbox-browser__preview-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sandbox-browser__preview-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.sandbox-browser__preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(20, 31, 56, 0.5);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 0.75rem;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  transition: all 0.15s;
}
.sandbox-browser__preview-btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(109, 140, 192, 0.1);
}
.sandbox-browser__preview-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.sandbox-browser__preview-content {
  flex: 1;
  overflow: auto;
  padding: 1rem;
}

.sandbox-browser__preview-content pre {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.sandbox-browser__preview-content pre code {
  font-family: inherit;
}
.sandbox-browser__preview-content img {
  max-width: 100%;
  border-radius: 8px;
}
.sandbox-browser__preview-content audio {
  width: 100%;
  margin-top: 0.5rem;
}
.sandbox-browser__preview-content video {
  max-width: 100%;
  border-radius: 8px;
}
.sandbox-browser__preview-content .preview-unsupported {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 100%;
  color: var(--text-dim);
}
.sandbox-browser__preview-content .preview-unsupported svg { width: 40px; height: 40px; opacity: 0.4; fill: none; stroke: currentColor; stroke-width: 1.5; }

/* --- Loading state --- */
.sandbox-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
}
.sandbox-loading__orbit {
  width: 60px; height: 60px;
  border: 2px solid rgba(109, 140, 192, 0.15);
  border-top-color: var(--accent-bright);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ============ Slash command autocomplete ============ */

.cmd-autocomplete {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 6px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
}
.cmd-autocomplete__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  transition: background 0.12s;
}
.cmd-autocomplete__item:hover,
.cmd-autocomplete__item.selected {
  background: rgba(109, 140, 192, 0.14);
}
.cmd-autocomplete__name {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-bright);
  white-space: nowrap;
  flex-shrink: 0;
}
.cmd-autocomplete__desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ Command mode badge ============ */

.cmd-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  margin-bottom: 0.5rem;
  background: rgba(109, 140, 192, 0.12);
  border: 1px solid rgba(109, 140, 192, 0.25);
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-bright);
}
.cmd-badge[hidden] { display: none; }

/* ============ Core 1.1 maintenance card ============ */

.msg--maintenance .msg__avatar--maintenance {
  background: rgba(109, 140, 192, 0.15);
  border: 1px solid rgba(109, 140, 192, 0.3);
  border-radius: 50%;
  color: var(--accent-bright);
}
.msg--maintenance .msg__avatar--maintenance svg {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.maintenance-card {
  background: linear-gradient(135deg, rgba(20, 31, 56, 0.9), rgba(24, 35, 61, 0.95));
  border: 1px solid rgba(109, 140, 192, 0.2);
  border-radius: 14px;
  padding: 1.75rem 1.5rem;
  max-width: 420px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
.maintenance-card__icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(109, 140, 192, 0.12);
  border: 1px solid rgba(109, 140, 192, 0.25);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-bright);
  margin-bottom: 0.25rem;
  animation: pulseGlow 2.5s ease-in-out infinite;
}
.maintenance-card__icon svg {
  width: 24px; height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(109, 140, 192, 0); }
  50% { box-shadow: 0 0 0 6px rgba(109, 140, 192, 0.1); }
}
.maintenance-card__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.maintenance-card__body {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.maintenance-card__hint {
  font-size: 0.78rem;
  color: var(--accent);
  margin-top: 0.15rem;
}
.maintenance-card__btn {
  margin-top: 0.5rem;
  padding: 0.5rem 1.2rem;
  background: linear-gradient(135deg, rgba(74, 101, 148, 0.9) 0%, rgba(50, 72, 112, 0.9) 100%);
  border: 1px solid rgba(109, 140, 192, 0.3);
  border-radius: 9px;
  color: var(--star);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.maintenance-card__btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.maintenance-card__btn:active {
  transform: translateY(0);
}

/* Model picker maintenance tag */
.model-maintenance-tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: #e8c47e;
  background: rgba(232, 196, 126, 0.12);
  border: 1px solid rgba(232, 196, 126, 0.25);
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cmd-badge svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============ Ask user card (mid-task questions) ============ */

.ask-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 4px;
  transition: opacity 0.3s ease;
}

.ask-card__question {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 14px;
}

.ask-card__options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ask-card__option {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ask-card__option:hover:not(.disabled) {
  background: var(--bg-navy);
  border-color: var(--accent);
  color: var(--accent-bright);
}

.ask-card__option.disabled {
  opacity: 0.4;
  cursor: default;
}

.ask-card__input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ask-card__input {
  flex: 1;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.15s ease;
}

.ask-card__input:focus {
  border-color: var(--accent);
}

.ask-card__input.disabled {
  opacity: 0.4;
}

.ask-card__send {
  background: var(--accent);
  border: none;
  color: var(--bg-deep);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.ask-card__send:hover:not(.disabled) {
  background: var(--accent-bright);
}

.ask-card__send svg {
  width: 18px;
  height: 18px;
}

.ask-card__send.disabled {
  opacity: 0.4;
  cursor: default;
}

.ask-card__answer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--text-dim);
}

.ask-card__answer-label {
  font-weight: 600;
  color: var(--accent-bright);
  margin-right: 4px;
}

.ask-card--answered .ask-card {
  opacity: 0.7;
}

.msg--ask .msg__name::after {
  content: " asked a question";
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 400;
}

/* ============ Quota exceeded card (in chat) ============ */

.msg--quota .msg__avatar--quota {
  background: rgba(138, 127, 255, 0.12);
  border: 1px solid rgba(138, 127, 255, 0.3);
  border-radius: 50%;
  color: var(--accent-bright);
}
.msg--quota .msg__avatar--quota svg {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quota-card {
  background: linear-gradient(135deg, rgba(20, 28, 56, 0.95), rgba(24, 33, 61, 0.98));
  border: 1px solid rgba(138, 127, 255, 0.2);
  border-radius: 14px;
  padding: 1.75rem 1.5rem;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.quota-card__icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(138, 127, 255, 0.1);
  border: 1px solid rgba(138, 127, 255, 0.25);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-bright);
  margin-bottom: 0.15rem;
  animation: quotaPulse 3s ease-in-out infinite;
}
.quota-card__icon svg {
  width: 26px; height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@keyframes quotaPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(138, 127, 255, 0); }
  50% { box-shadow: 0 0 0 6px rgba(138, 127, 255, 0.08); }
}
.quota-card__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.quota-card__body {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.55;
}
.quota-card__reset {
  font-size: 0.76rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.quota-card__reset svg {
  width: 13px; height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.quota-card__bars {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.3rem;
}
.quota-card__bar {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.quota-card__bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-dim);
}
.quota-card__bar-track {
  height: 6px;
  background: rgba(10, 16, 32, 0.6);
  border-radius: 3px;
  overflow: hidden;
}
.quota-card__bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}
.quota-card__bar-fill--daily {
  background: linear-gradient(90deg, #8a7fff, #6d8cc0);
}
.quota-card__bar-fill--weekly {
  background: linear-gradient(90deg, #6d8cc0, #9db8e8);
}
.quota-card__bar-fill--ultra {
  background: linear-gradient(90deg, #c4b5fd, #8a7fff);
}
.quota-card__bar-fill--depleted {
  background: linear-gradient(90deg, #e8a87c, #e8a2ae) !important;
}
.quota-card__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.quota-card__btn {
  padding: 0.5rem 1.2rem;
  background: linear-gradient(135deg, rgba(138, 127, 255, 0.9) 0%, rgba(109, 140, 192, 0.9) 100%);
  border: 1px solid rgba(138, 127, 255, 0.3);
  border-radius: 9px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.quota-card__btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.quota-card__btn:active { transform: translateY(0); }
.quota-card__btn--ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.quota-card__btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent-bright);
}

/* ============ Capacity card (429/503) ============ */

.capacity-card {
  background: linear-gradient(135deg, rgba(20, 28, 56, 0.95), rgba(24, 33, 61, 0.98));
  border: 1px solid rgba(138, 127, 255, 0.2);
  border-radius: 14px;
  padding: 1.2rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.capacity-card__icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(138, 127, 255, 0.1);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.15rem;
  animation: capacityPulse 3s ease-in-out infinite;
}
.capacity-card__icon svg {
  width: 26px; height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@keyframes capacityPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(138, 127, 255, 0); }
  50% { box-shadow: 0 0 0 6px rgba(138, 127, 255, 0.08); }
}
.capacity-card__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.capacity-card__body {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.55;
}
.capacity-card__upgrade {
  display: flex;
  gap: 0.7rem;
  padding: 0.8rem 0.9rem;
  background: rgba(138, 127, 255, 0.06);
  border: 1px solid rgba(138, 127, 255, 0.15);
  border-radius: 10px;
  margin-top: 0.2rem;
}
.capacity-card__upgrade-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(138, 127, 255, 0.12);
  color: var(--accent-bright);
  display: flex;
  align-items: center;
  justify-content: center;
}
.capacity-card__upgrade-icon svg {
  width: 18px; height: 18px;
  fill: currentColor;
}
.capacity-card__upgrade-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.capacity-card__upgrade-desc {
  font-size: 0.76rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.capacity-card__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.capacity-card__btn {
  padding: 0.5rem 1.2rem;
  background: linear-gradient(135deg, rgba(138, 127, 255, 0.9) 0%, rgba(109, 140, 192, 0.9) 100%);
  border: 1px solid rgba(138, 127, 255, 0.3);
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.capacity-card__btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.capacity-card__btn:active { transform: translateY(0); }
.capacity-card__btn--ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.capacity-card__btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent-bright);
}
.msg--capacity .msg__avatar--capacity {
  color: var(--accent);
  background: rgba(138, 127, 255, 0.1);
}

/* ============ Admin Test Panel ============ */

.admin-test-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(6, 10, 20, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: adminTestFadeIn 0.2s ease;
}
@keyframes adminTestFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.admin-test-panel {
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  background: linear-gradient(135deg, rgba(20, 28, 56, 0.98), rgba(24, 33, 61, 0.99));
  border: 1px solid rgba(138, 127, 255, 0.2);
  border-radius: 16px;
  padding: 1.5rem;
  animation: adminTestSlideIn 0.25s ease;
}
@keyframes adminTestSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.admin-test-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.admin-test-panel__title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}
.admin-test-panel__title svg {
  width: 22px; height: 22px;
  color: var(--accent-bright);
}
.admin-test-panel__close {
  background: none;
  border: none;
  color: var(--text-dim);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.admin-test-panel__close:hover {
  background: rgba(55, 70, 94, 0.35);
  color: var(--text);
}
.admin-test-panel__close svg {
  width: 18px; height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.admin-test-panel__sub {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 1.2rem;
  line-height: 1.5;
}
.admin-test-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
@media (max-width: 540px) {
  .admin-test-grid { grid-template-columns: 1fr; }
}
.admin-test-section {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-top: 0.8rem;
  margin-bottom: 0.1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}
.admin-test-section:first-child { margin-top: 0; }
.admin-test-btn {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 0.9rem;
  background: rgba(10, 16, 32, 0.5);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  text-align: left;
}
.admin-test-btn:hover {
  border-color: rgba(138, 127, 255, 0.35);
  background: rgba(138, 127, 255, 0.06);
  transform: translateY(-1px);
}
.admin-test-btn:active { transform: translateY(0); }
.admin-test-btn__label {
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text);
}
.admin-test-btn__desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* ============ Settings: Usage panel ============ */

.usage-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin: 1.2rem 0;
}
.usage-overview__card {
  background: linear-gradient(135deg, rgba(20, 31, 56, 0.6), rgba(24, 35, 61, 0.7));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.usage-overview__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
}
.usage-overview__value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.usage-overview__limit {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.usage-bars {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.usage-bar__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}
.usage-bar__title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
}
.usage-bar__pct {
  font-size: 0.76rem;
  color: var(--accent-bright);
  font-weight: 600;
  font-family: var(--font-display);
}
.usage-bar__track {
  height: 8px;
  background: rgba(10, 16, 32, 0.6);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(39, 53, 79, 0.5);
}
.usage-bar__fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #8a7fff, #6d8cc0);
  transition: width 0.5s ease;
}
.usage-bar__fill--accent {
  background: linear-gradient(90deg, #c4b5fd, #8a7fff);
}
.usage-bar__fill--warning {
  background: linear-gradient(90deg, #e8a87c, #e8a2ae) !important;
}
.usage-bar__detail {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

.usage-tokens {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}
.usage-tokens__item {
  background: rgba(10, 16, 32, 0.4);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.usage-tokens__label {
  font-size: 0.72rem;
  color: var(--text-dim);
}
.usage-tokens__value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-bright);
}

@media (max-width: 640px) {
  .usage-overview { grid-template-columns: 1fr; }
  .usage-tokens { grid-template-columns: 1fr; }
}


/* --- captcha modal --- */
.captcha-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 32, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.captcha-modal.hidden { display: none; }
.captcha-modal__inner {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
}


/* ================================================================
   Onboarding Modal
================================================================ */
.onboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: onboardFadeIn 0.3s ease;
}
.onboard-overlay[hidden] { display: none; }

@keyframes onboardFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.onboard-modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #0d1428 0%, #0a1020 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: onboardSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--gray-blue) transparent;
}
.onboard-modal::-webkit-scrollbar {
  width: 6px;
}
.onboard-modal::-webkit-scrollbar-track {
  background: transparent;
}
.onboard-modal::-webkit-scrollbar-thumb {
  background: var(--gray-blue);
  border-radius: 3px;
}
.onboard-modal::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

@keyframes onboardSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.onboard-modal__header {
  text-align: center;
  padding: 32px 28px 20px;
  border-bottom: 1px solid var(--line);
}
.onboard-modal__logo {
  margin-bottom: 16px;
}
.onboard-modal__logo .wordmark {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
}
.onboard-modal__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.onboard-modal__subtitle {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.onboard-modal__body {
  padding: 24px 28px;
}

.onboard-section {
  padding: 16px 0;
  border-bottom: 1px solid rgba(39, 53, 79, 0.5);
}
.onboard-section:last-child { border-bottom: none; }
.onboard-section__label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 4px;
}
.onboard-section__desc {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* Age verification */
.onboard-age {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.onboard-age__input {
  background: rgba(20, 31, 56, 0.3);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 0.95rem;
  color: var(--text);
  font-family: var(--font-display);
  color-scheme: dark;
  transition: border-color 0.2s, transform 0.15s;
  width: 100%;
}
.onboard-age__input:hover {
  border-color: var(--gray-blue);
}
.onboard-age__input:focus {
  outline: none;
  border-color: var(--accent-bright);
}
.onboard-age__input::placeholder {
  color: #5b6b85;
}
.onboard-age__error {
  color: #ff6b6b;
  font-size: 0.82rem;
  margin: 0;
  font-family: var(--font-body);
}

/* Theme showcase cards */
.onboard-themes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.onboard-theme-card {
  background: none;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: border-color 0.2s, transform 0.15s;
}
.onboard-theme-card:hover {
  transform: translateY(-2px);
}
.onboard-theme-card.active {
  border-color: var(--accent-bright);
}
.onboard-theme-swatch {
  width: 100%;
  height: 64px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 10px 12px;
  position: relative;
}
.onboard-theme-swatch--dark {
  background: linear-gradient(135deg, #0d1428, #141f38);
}
.onboard-theme-swatch--midnight {
  background: linear-gradient(135deg, #05080f, #0e1525);
}
.swatch-bar {
  height: 5px;
  border-radius: 3px;
  background: rgba(55, 70, 94, 0.6);
  width: 70%;
}
.swatch-bar--accent {
  background: var(--accent);
  width: 45%;
}
.swatch-dot {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--star);
  filter: drop-shadow(0 0 4px rgba(157, 184, 232, 0.6));
}
.onboard-theme-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

/* Preferences */
.onboard-prefs {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}
.onboard-pref {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.onboard-pref__info {
  flex: 1;
  min-width: 0;
}
.onboard-pref__title {
  display: block;
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 2px;
}
.onboard-pref__desc {
  display: block;
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.4;
}
.onboard-prefs__note {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 10px;
  opacity: 0.7;
}

/* Plan mini cards */
.onboard-plans {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.onboard-plan-mini {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(20, 31, 56, 0.3);
  transition: border-color 0.2s;
}
.onboard-plan-mini:hover {
  border-color: var(--gray-blue);
}
.onboard-plan-mini--current {
  border-color: var(--accent);
  background: rgba(109, 140, 192, 0.08);
}
.onboard-plan-mini__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}
.onboard-plan-mini__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
}
.onboard-plan-mini__price {
  font-size: 0.82rem;
  color: var(--accent-bright);
  font-weight: 600;
}
.onboard-plan-mini__desc {
  font-size: 0.76rem;
  color: var(--text-dim);
}
.onboard-plan-mini__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.onboard-tag {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(55, 70, 94, 0.25);
  border: 1px solid rgba(55, 70, 94, 0.4);
  color: var(--text-dim);
  white-space: nowrap;
}
.onboard-manage-plan-btn {
  margin-top: 10px;
  width: 100%;
}

.onboard-modal__footer {
  display: flex;
  gap: 12px;
  padding: 20px 28px 28px;
  justify-content: flex-end;
  align-items: center;
}
.onboard-modal__footer .btn {
  min-width: 100px;
}

@media (max-width: 520px) {
  .onboard-modal__header { padding: 24px 20px 16px; }
  .onboard-modal__body { padding: 20px; }
  .onboard-modal__footer { padding: 16px 20px 24px; flex-direction: column-reverse; }
  .onboard-modal__footer .btn { width: 100%; }
  .onboard-themes { grid-template-columns: 1fr 1fr; }
}

/* ================================================================
   Referral Card (Settings → Account)
   ================================================================ */
.referral-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
}
.referral-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.referral-card__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.referral-card__title svg {
  width: 18px;
  height: 18px;
  color: var(--accent-bright);
}
.referral-card__reward {
  font-size: 0.75rem;
  color: var(--accent-bright);
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.12);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-weight: 500;
}
.referral-card__code-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 10px;
}
.referral-code-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}
.referral-code-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.referral-code-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-bright);
  letter-spacing: 0.1em;
}
.referral-link-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 16px;
}
.referral-link-row input {
  flex: 1;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.referral-link-row input:focus { outline: none; border-color: var(--accent-bright); }
.referral-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.referral-stat {
  text-align: center;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 8px;
}
.referral-stat__num {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.referral-stat__label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}
.referral-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.referral-list__empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  padding: 16px 0;
}
.referral-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.82rem;
}
.referral-list__email {
  color: var(--text);
  font-family: var(--font-mono);
}
.referral-list__status {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.referral-list__status--pending {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
}
.referral-list__status--completed {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
}

/* ================================================================
   DOCUMENTARY / FORUM PAGE
================================================================ */
.nav__active {
  color: var(--accent-bright) !important;
  font-weight: 600;
}

.doc-page {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 4vw 4rem;
}

/* --- Page header --- */
.doc-header {
  text-align: center;
  margin-bottom: 3rem;
}
.doc-header__eyebrow {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: 0.8rem;
  opacity: 0;
  animation: fadeUp 0.4s ease forwards;
}
.doc-header__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--star);
  opacity: 0;
  animation: fadeUp 0.4s 0.06s ease forwards;
}
.doc-header__title .accent { color: var(--accent-bright); }
.doc-header__sub {
  color: var(--text-dim);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 1rem auto 0;
  opacity: 0;
  animation: fadeUp 0.4s 0.12s ease forwards;
}

/* --- Loading state --- */
.doc-loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
}
.star--loading {
  width: 40px; height: 40px;
  fill: var(--star);
  filter: drop-shadow(0 0 18px rgba(157, 184, 232, 0.7));
  animation: starPulse 2.4s ease-in-out infinite;
  margin: 0 auto 1rem;
  display: block;
}

.doc-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
}

/* --- Pinned section --- */
.doc-pinned {
  margin-bottom: 2.5rem;
}
.doc-pinned[hidden] { display: none; }
.doc-pinned__label {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-bright);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.doc-pinned__label svg {
  width: 16px; height: 16px;
  stroke: var(--accent-bright);
}
.doc-pinned__list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --- Feed --- */
.doc-feed__label {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1rem;
}
.doc-feed__list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --- Post card --- */
.doc-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.doc-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
}
.doc-card--pinned {
  border-color: rgba(109, 140, 192, 0.4);
  background: linear-gradient(135deg, var(--bg-card), rgba(109, 140, 192, 0.06));
}
.doc-card__top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}
.doc-card__pin {
  width: 15px; height: 15px;
  stroke: var(--accent-bright);
  flex-shrink: 0;
}
.doc-card__badge {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 5px;
  background: rgba(109, 140, 192, 0.15);
  color: var(--accent-bright);
}
.doc-card__badge--release { background: rgba(52, 211, 153, 0.12); color: #34d399; }
.doc-card__badge--update { background: rgba(251, 191, 36, 0.12); color: #fbbf24; }
.doc-card__badge--deep-dive { background: rgba(167, 139, 250, 0.12); color: #a78bfa; }
.doc-card__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--star);
  margin-bottom: 0.4rem;
  line-height: 1.3;
}
.doc-card__excerpt {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 0.8rem;
}
.doc-card__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.doc-card__author { font-weight: 500; color: var(--text); }
.doc-card__dot { opacity: 0.4; }
.doc-card__admin {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}
.doc-card__edit, .doc-card__delete {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.doc-card__edit:hover { border-color: var(--accent); color: var(--accent-bright); }
.doc-card__delete:hover { border-color: #f87171; color: #f87171; }

/* --- Admin composer --- */
.doc-composer {
  margin-bottom: 2.5rem;
}
.doc-composer[hidden] { display: none; }
.doc-composer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.doc-composer__head h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.doc-composer__toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: rgba(109, 140, 192, 0.1);
  color: var(--accent-bright);
  cursor: pointer;
  transition: all 0.15s;
}
.doc-composer__toggle:hover { background: rgba(109, 140, 192, 0.2); }
.doc-composer__toggle svg { width: 16px; height: 16px; }
.doc-composer__form {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.doc-composer__form[hidden] { display: none; }
.doc-composer__row {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}
.doc-composer__row input,
.doc-composer__row select {
  flex: 1;
  min-width: 150px;
  padding: 0.6rem 0.8rem;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
}
.doc-composer__row input:focus,
.doc-composer__row select:focus {
  outline: none;
  border-color: var(--accent);
}
.doc-composer__pin {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  white-space: nowrap;
  cursor: pointer;
}
.doc-composer textarea {
  width: 100%;
  padding: 0.8rem;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 0.82rem;
  resize: vertical;
  margin-bottom: 0.8rem;
}
.doc-composer textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.doc-composer__actions {
  display: flex;
  gap: 0.6rem;
}
.doc-composer__error {
  color: #f87171;
  font-size: 0.85rem;
  margin-top: 0.6rem;
}

/* ================================================================
   POST VIEWER (full post overlay)
================================================================ */
.doc-viewer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 4vw;
}
.doc-viewer[hidden] { display: none; }
.doc-viewer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 32, 0.85);
  backdrop-filter: blur(8px);
  animation: fadeUp 0.2s ease;
}
.doc-viewer__article {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  background: var(--bg-navy);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3rem 4rem;
  animation: fadeUp 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-blue) transparent;
}
.doc-viewer__article::-webkit-scrollbar {
  width: 6px;
}
.doc-viewer__article::-webkit-scrollbar-track {
  background: transparent;
}
.doc-viewer__article::-webkit-scrollbar-thumb {
  background: var(--gray-blue);
  border-radius: 3px;
}
.doc-viewer__article::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
.doc-viewer__close {
  position: sticky;
  top: 0;
  float: right;
  margin: -1rem -1rem 0 0;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  z-index: 10;
}
.doc-viewer__close:hover { border-color: var(--accent); color: var(--accent-bright); }
.doc-viewer__close svg { width: 18px; height: 18px; }

.doc-post__meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.doc-post__date {
  font-size: 0.85rem;
  color: var(--text-dim);
}
.doc-post__title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--star);
  margin-bottom: 0.5rem;
}
.doc-post__author {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

/* --- Post blocks --- */
.doc-block { margin-bottom: 2.5rem; }
.doc-block:last-child { margin-bottom: 0; }

/* Hero block */
.doc-hero {
  text-align: center;
  padding: 2rem 0 1rem;
}
.doc-hero__eyebrow {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: 0.8rem;
}
.doc-hero__badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 20px;
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  margin-bottom: 1rem;
}
.doc-hero__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--star);
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 30px rgba(157, 184, 232, 0.15));
}
.doc-hero__subtitle {
  color: var(--text-dim);
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 620px;
  margin: 0 auto;
}

/* Section block */
.doc-section__heading {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--star);
  margin-bottom: 0.8rem;
}
.doc-section__body {
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1.7;
}

/* Stats block */
.doc-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.2rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.doc-stat {
  text-align: center;
}
.doc-stat__value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-bright);
  line-height: 1;
  margin-bottom: 0.4rem;
}
.doc-stat__label {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.3;
}

/* Model cards */
.doc-models {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
}
.doc-model {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.8rem;
  position: relative;
  overflow: hidden;
}
.doc-model::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.doc-model--pulse::before { background: linear-gradient(90deg, #6d8cc0, #9db8e8); }
.doc-model--core::before { background: linear-gradient(90deg, #a78bfa, #6d8cc0); }
.doc-model__name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--star);
  margin-bottom: 0.3rem;
}
.doc-model__tagline {
  font-size: 0.85rem;
  color: var(--accent-bright);
  font-weight: 500;
  margin-bottom: 0.8rem;
}
.doc-model__desc {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1.2rem;
}
.doc-model__specs {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.doc-model__spec {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
}
.doc-model__spec-label {
  font-size: 0.82rem;
  color: var(--text-dim);
}
.doc-model__spec-value {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

/* Benchmarks */
.doc-bench__heading {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--star);
  margin-bottom: 0.5rem;
}
.doc-bench__sub {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
.doc-bench__cats {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.doc-bench__cat {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.doc-bench__cat-head {
  margin-bottom: 1rem;
}
.doc-bench__cat-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--star);
}
.doc-bench__cat-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}
.doc-bench__bars {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.doc-bench__row {
  display: grid;
  grid-template-columns: 160px 1fr 50px;
  align-items: center;
  gap: 0.8rem;
}
.doc-bench__model {
  font-size: 0.82rem;
  color: var(--text-dim);
  text-align: right;
}
.doc-bench__model--hl {
  color: var(--accent-bright);
  font-weight: 600;
}
.doc-bench__track {
  height: 24px;
  background: var(--bg-panel);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.doc-bench__bar {
  height: 100%;
  background: linear-gradient(90deg, #37465e, #6d8cc0);
  border-radius: 5px;
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.doc-bench__bar--highlight {
  background: linear-gradient(90deg, #6d8cc0, #9db8e8);
  box-shadow: 0 0 12px rgba(157, 184, 232, 0.4);
}
.doc-bench__score {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
}

/* Comparison table */
.doc-table-wrap {
  margin-bottom: 2.5rem;
}
.doc-table__heading {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--star);
  margin-bottom: 0.5rem;
}
.doc-table__sub {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-bottom: 1rem;
}
.doc-table-scroll {
  overflow-x: auto;
}
.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.doc-table th {
  padding: 0.7rem 0.8rem;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-dim);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
.doc-table__col-hl {
  color: var(--accent-bright) !important;
}
.doc-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
}
.doc-table__cell-hl {
  background: rgba(109, 140, 192, 0.08);
  color: var(--text);
  font-weight: 500;
}
.doc-table__yes { color: #34d399; font-weight: 700; }
.doc-table__no { color: #f87171; opacity: 0.5; }

/* Features grid */
.doc-features__heading {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--star);
  margin-bottom: 0.5rem;
}
.doc-features__sub {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-bottom: 1.5rem;
}
.doc-features__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
}
.doc-feature {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s;
}
.doc-feature:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.doc-feature__icon {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(109, 140, 192, 0.15);
  margin-bottom: 0.8rem;
}
.doc-feature__icon svg {
  width: 20px; height: 20px;
  stroke: var(--accent-bright);
}
.doc-feature__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--star);
  margin-bottom: 0.4rem;
}
.doc-feature__body {
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* Quote block */
.doc-quote {
  text-align: center;
  padding: 2.5rem 1rem;
}
.doc-quote .star--quote {
  width: 34px; height: 34px;
  fill: var(--star);
  filter: drop-shadow(0 0 14px rgba(157, 184, 232, 0.7));
  margin: 0 auto 1.2rem;
  display: block;
}
.doc-quote blockquote {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--star);
  font-style: italic;
  max-width: 560px;
  margin: 0 auto 0.8rem;
}
.doc-quote__attr {
  color: var(--text-dim);
  font-size: 0.88rem;
}

/* CTA block */
.doc-cta {
  text-align: center;
  padding: 2.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.doc-cta__heading {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--star);
  margin-bottom: 0.6rem;
}
.doc-cta__body {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 480px;
  margin: 0 auto 1.5rem;
}
.doc-cta__buttons {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Chat empty state doc link --- */
.chat-empty__doc-link {
  margin-top: 1.5rem;
  opacity: 0.35;
  transition: opacity 0.3s;
  font-size: 0.8rem;
}
.chat-empty__doc-link:hover {
  opacity: 0.8;
}
.chat-empty__doc-link a {
  color: var(--text-dim);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.chat-empty__doc-link a:hover {
  color: var(--accent-bright);
}

/* --- Responsive --- */
@media (max-width: 700px) {
  .doc-viewer__article { padding: 2rem 1.5rem; }
  .doc-bench__row {
    grid-template-columns: 110px 1fr 42px;
    gap: 0.5rem;
  }
  .doc-bench__model { font-size: 0.72rem; }
  .doc-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ============ Cookie consent banner ============ */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 4vw;
  background: rgba(10, 16, 32, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--text-dim);
  transform: translateY(100%);
  transition: transform 0.4s ease;
}

.cookie-banner.visible { transform: translateY(0); }

.cookie-banner.dismissing { transform: translateY(100%); opacity: 0; transition: transform 0.3s ease, opacity 0.3s ease; }

.cookie-banner__text { line-height: 1.5; }

.cookie-banner__text a {
  color: var(--accent-bright);
  text-decoration: none;
  transition: color 0.2s;
}
.cookie-banner__text a:hover { color: var(--star); }

.cookie-banner__btn { flex-shrink: 0; }

@media (max-width: 600px) {
  .cookie-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.9rem 5vw;
    font-size: 0.82rem;
  }
  .cookie-banner__btn { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .cookie-banner { transition: none; transform: translateY(0); }
  .cookie-banner.dismissing { display: none; }
}

/* ================================================================
   Support Page
================================================================ */
.support-page { max-width: 760px; }

.support-actions {
  margin: 2rem 0 1.5rem;
}

.support-ticket-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.support-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.support-ticket-card {
  display: block;
  text-decoration: none;
  background: linear-gradient(160deg, var(--bg-card) 0%, rgba(20, 31, 56, 0.5) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  transition: border-color 0.2s, transform 0.15s;
}
.support-ticket-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.support-ticket-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.support-ticket-card__subject {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}
.support-ticket-card__status {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}
.support-ticket-card__meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.4rem;
}

/* New ticket form */
.support-form {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.support-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.support-form__field label {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.support-form__field input,
.support-form__field textarea {
  padding: 0.8rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s;
}
.support-form__field input:focus,
.support-form__field textarea:focus {
  border-color: var(--accent);
}
.support-form__field textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.6;
}
.support-form__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Detail view */
.support-status-badge {
  display: inline-block;
  padding: 0.15rem 0.7rem;
  border: 1px solid;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  margin-right: 0.5rem;
}

.support-thread {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 2rem 0;
}

.support-msg {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
}
.support-msg--staff {
  background: linear-gradient(160deg, rgba(29, 44, 77, 0.6) 0%, rgba(20, 31, 56, 0.4) 100%);
  border-color: rgba(109, 140, 192, 0.25);
}
.support-msg__author {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.support-msg__body {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.support-msg__time {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.6rem;
}

/* Reply area */
.support-reply {
  margin-top: 1.5rem;
}
.support-reply textarea {
  width: 100%;
  min-height: 90px;
  padding: 0.8rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.92rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.6;
}
.support-reply textarea:focus { border-color: var(--accent); }
.support-reply__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

/* Back link */
.support-back {
  color: var(--accent-bright);
  text-decoration: none;
  transition: color 0.15s;
}
.support-back:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .support-page { max-width: 100%; }
  .support-form__actions { flex-direction: column-reverse; }
  .support-form__actions .btn { width: 100%; text-align: center; }
}

/* ================================================================
   Projects View (GitHub integration)
================================================================ */
.projects-view {
  position: fixed;
  top: 0;
  left: var(--sidebar-w, 280px);
  right: 0;
  bottom: 0;
  background: var(--bg, #0a0e1a);
  z-index: 50;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.projects-view.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.projects-view[hidden] { display: none; }

.projects-view__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem 1rem;
  flex-shrink: 0;
}
.projects-view__head-left {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.projects-view__head-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.projects-view__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  color: var(--text-dim, #8892b0);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font-body, 'Inter', sans-serif);
  padding: 0.4rem 0;
  transition: color 0.15s;
}
.projects-view__back:hover { color: var(--text, #e6edf3); }
.projects-view__back svg { width: 16px; height: 16px; }

.projects-view__title {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text, #e6edf3);
  padding-top: 2rem;
}
.projects-view__count {
  font-size: 0.8rem;
  color: var(--text-dim, #8892b0);
}
.projects-view__refresh {
  background: rgba(20, 31, 56, 0.6);
  border: 1px solid var(--line, rgba(109, 140, 192, 0.15));
  border-radius: 8px;
  color: var(--text-dim, #8892b0);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  transition: all 0.2s;
  margin-top: 2rem;
}
.projects-view__refresh:hover {
  color: var(--accent-bright, #8b9dc3);
  border-color: var(--accent, #6d8cc0);
  box-shadow: 0 0 12px rgba(109, 140, 192, 0.2);
}
.projects-view__refresh svg { width: 18px; height: 18px; }

.projects-view__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem 3rem;
}

/* Connect state */
.projects-connect {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  gap: 1.2rem;
}
.projects-connect__icon {
  color: var(--text-dim, #8892b0);
  opacity: 0.6;
}
.projects-connect__title {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text, #e6edf3);
  margin: 0;
}
.projects-connect__desc {
  color: var(--text-dim, #8892b0);
  font-size: 0.9rem;
  max-width: 420px;
  margin: 0;
  line-height: 1.5;
}

/* Connected state */
.projects-connected {
  max-width: 800px;
  margin: 0 auto;
}

.projects-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  background: rgba(20, 31, 56, 0.4);
  border: 1px solid var(--line, rgba(109, 140, 192, 0.15));
  border-radius: 12px;
  margin-bottom: 1.5rem;
}
.projects-profile__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--line, rgba(109, 140, 192, 0.2));
}
.projects-profile__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.projects-profile__name {
  font-weight: 600;
  color: var(--text, #e6edf3);
  font-size: 1rem;
}
.projects-profile__link {
  color: var(--text-dim, #8892b0);
  font-size: 0.8rem;
  text-decoration: none;
}
.projects-profile__link:hover { text-decoration: underline; }

.projects-actions {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.projects-clone-input,
.projects-clone-branch {
  background: rgba(20, 31, 56, 0.6);
  border: 1px solid var(--line, rgba(109, 140, 192, 0.15));
  border-radius: 8px;
  color: var(--text, #e6edf3);
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  font-family: var(--font-body, 'Inter', sans-serif);
  outline: none;
  transition: border-color 0.2s;
}
.projects-clone-input { flex: 1; min-width: 200px; }
.projects-clone-branch { width: 140px; }
.projects-clone-input:focus,
.projects-clone-branch:focus {
  border-color: var(--accent, #6d8cc0);
}

.projects-repos-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.projects-repos-head h3 {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text, #e6edf3);
  margin: 0;
}
.projects-repos-count {
  font-size: 0.75rem;
  color: var(--text-dim, #8892b0);
}

.projects-repos {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.projects-repo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  background: rgba(20, 31, 56, 0.3);
  border: 1px solid var(--line, rgba(109, 140, 192, 0.1));
  border-radius: 10px;
  transition: border-color 0.2s, background 0.2s;
}
.projects-repo:hover {
  border-color: var(--accent, #6d8cc0);
  background: rgba(20, 31, 56, 0.5);
}
.projects-repo__main {
  flex: 1;
  min-width: 0;
}
.projects-repo__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.projects-repo__name {
  font-weight: 600;
  color: var(--text, #e6edf3);
  font-size: 0.9rem;
}
.projects-repo__badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 500;
}
.projects-repo__badge--public {
  background: rgba(63, 185, 80, 0.15);
  color: #3fb550;
}
.projects-repo__badge--private {
  background: rgba(255, 165, 0, 0.15);
  color: #ffa500;
}
.projects-repo__desc {
  font-size: 0.8rem;
  color: var(--text-dim, #8892b0);
  margin: 0.2rem 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.projects-repo__meta {
  display: flex;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-dim, #8892b0);
}
.projects-repo__clone {
  flex-shrink: 0;
}

.projects-loading,
.projects-empty,
.projects-error {
  color: var(--text-dim, #8892b0);
  font-size: 0.85rem;
  padding: 1rem;
  text-align: center;
}
.projects-error { color: #ff6b6b; }

/* Toast */
.projects-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 31, 56, 0.95);
  border: 1px solid var(--accent, #6d8cc0);
  border-radius: 8px;
  color: var(--text, #e6edf3);
  padding: 0.8rem 1.5rem;
  font-size: 0.85rem;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  display: none;
}
.projects-toast--success { border-color: #3fb550; }
.projects-toast--error { border-color: #ff6b6b; }

@media (max-width: 768px) {
  .projects-view { left: 0; }
  .projects-view__head { padding: 1rem; flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .projects-view__head-left { flex-wrap: wrap; gap: 0.6rem; }
  .projects-view__title { font-size: 1.2rem; padding-top: 0; }
  .projects-view__body { padding: 1rem; }
  .projects-actions { flex-direction: column; }
  .projects-clone-input, .projects-clone-branch { width: 100%; }
}

/* ============ Shared Workspaces ============ */

.ws-page {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

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

.ws-header__logo { text-decoration: none; }

.ws-header__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--star);
}

.ws-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.ws-btn--primary {
  background: var(--accent);
  color: white;
}
.ws-btn--primary:hover { background: var(--accent-bright); }

.ws-btn--ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--line);
}
.ws-btn--ghost:hover { color: var(--text); border-color: var(--accent); }

.ws-btn--danger {
  background: transparent;
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.3);
}
.ws-btn--danger:hover { background: rgba(255, 107, 107, 0.1); }

.ws-btn--small { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.ws-btn--block { width: 100%; justify-content: center; }
.ws-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ws-list { display: flex; flex-direction: column; gap: 1rem; }

.ws-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
}
.ws-empty h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.ws-empty p { font-size: 0.9rem; max-width: 400px; margin: 0 auto; }

.ws-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}
.ws-card:hover { border-color: var(--accent); transform: translateY(-1px); }

.ws-card__header {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.ws-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(109, 140, 192, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-bright);
  flex-shrink: 0;
}

.ws-card__info { flex: 1; min-width: 0; }
.ws-card__name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--star);
  margin-bottom: 0.2rem;
}
.ws-card__desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ws-card__meta { font-size: 0.75rem; color: var(--text-dim); }

.ws-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ws-badge--owner { background: rgba(109, 140, 192, 0.2); color: var(--accent-bright); }
.ws-badge--editor { background: rgba(63, 181, 80, 0.15); color: #5cba6c; }
.ws-badge--viewer { background: rgba(255, 180, 0, 0.15); color: #e0a800; }
.ws-badge--info { background: rgba(109, 140, 192, 0.15); color: var(--accent); }

/* Modal */
.ws-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ws-modal[hidden] { display: none; }

.ws-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.ws-modal__panel {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.8rem;
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
}
.ws-modal__panel--wide { max-width: 680px; }

.ws-modal__title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--star);
  margin-bottom: 1.2rem;
}

.ws-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

/* Form elements */
.ws-form-group { margin-bottom: 1rem; }
.ws-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.ws-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}
.ws-input:focus { border-color: var(--accent); }
.ws-input--textarea { resize: vertical; min-height: 50px; }

.ws-select {
  padding: 0.4rem 0.6rem;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
}

.ws-radio-group { display: flex; flex-direction: column; gap: 0.6rem; }
.ws-radio {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  transition: border-color 0.2s;
}
.ws-radio:hover { border-color: var(--accent); }
.ws-radio input { margin-top: 0.2rem; }
.ws-radio__label { display: flex; flex-direction: column; gap: 0.1rem; }
.ws-radio__label strong { font-size: 0.85rem; color: var(--text); }
.ws-radio__label small { font-size: 0.75rem; color: var(--text-dim); }

/* Detail view */
.ws-detail__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.ws-detail__title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--star);
}
.ws-detail__desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 1.2rem;
}

.ws-detail__tabs {
  display: flex;
  gap: 0.2rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.ws-tab {
  padding: 0.5rem 0.9rem;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.ws-tab:hover { color: var(--text); }
.ws-tab--active { color: var(--accent-bright); border-bottom-color: var(--accent); }

.ws-tab-content { min-height: 100px; }

.ws-empty-text {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 1.5rem 0;
}

/* Members */
.ws-member {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(39, 53, 79, 0.5);
}
.ws-member:last-child { border-bottom: none; }
.ws-member__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.ws-member__info { flex: 1; min-width: 0; }
.ws-member__name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.ws-member__email { font-size: 0.75rem; color: var(--text-dim); }

/* Invites */
.ws-invite-create {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.ws-invite-create h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.6rem;
}
.ws-form-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.ws-form-row .ws-input { flex: 1; min-width: 120px; }

.ws-invite {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  flex-wrap: wrap;
}
.ws-invite__link { flex: 1; min-width: 200px; font-size: 0.8rem; }

/* Requests */
.ws-request {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(39, 53, 79, 0.5);
}
.ws-request:last-child { border-bottom: none; }

/* Settings */
.ws-settings { display: flex; flex-direction: column; gap: 1rem; }
.ws-settings__actions {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

/* Join page */
.ws-join-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.ws-join-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 2.5rem;
  max-width: 440px;
  width: 100%;
  text-align: center;
}

.ws-join-card__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.2rem;
  border-radius: 16px;
  background: rgba(109, 140, 192, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-bright);
}

.ws-join-card__title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--star);
  margin-bottom: 0.5rem;
}

.ws-join-card__desc {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

.ws-join-form { text-align: left; }

.ws-join-status {
  text-align: center;
  padding: 1rem 0;
}
.ws-join-status__icon {
  color: var(--accent-bright);
  margin-bottom: 0.8rem;
}
.ws-join-status h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--star);
  margin-bottom: 0.4rem;
}
.ws-join-status p { font-size: 0.85rem; color: var(--text-dim); }

.ws-join-error {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  color: #ff6b6b;
  margin-top: 1rem;
  text-align: left;
}

.ws-join-back {
  display: block;
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-decoration: none;
}
.ws-join-back:hover { color: var(--accent-bright); }

/* Workspace presence bar in chat */
.ws-presence-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  background: rgba(20, 31, 56, 0.6);
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--text-dim);
  overflow-x: auto;
  white-space: nowrap;
}
.ws-presence-bar__label { font-weight: 600; margin-right: 0.3rem; }
.ws-presence-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  background: rgba(63, 181, 80, 0.1);
  color: #5cba6c;
}
.ws-presence-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5cba6c;
}

/* Workspace switcher in sidebar */
.ws-switcher {
  padding: 0.5rem 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}
.ws-switcher select {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font-body);
  font-weight: 400;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 10px;
}
.ws-switcher select:hover {
  color: var(--text-primary);
}
.ws-switcher option { background: var(--bg-panel); }

/* Workspace badge in chat header */
.ws-chat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: rgba(109, 140, 192, 0.15);
  color: var(--accent-bright);
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

/* ============ In-app Notifications ============ */

.chat-notif-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.chat-notif-btn:hover {
  opacity: 0.75;
  color: var(--text);
  background: rgba(109, 140, 192, 0.08);
}
.chat-notif-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}
.chat-notif-badge[hidden] { display: none; }

.chat-notif-dropdown {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  width: 340px;
  max-height: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.chat-notif-dropdown.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.chat-notif-dropdown[hidden] { display: none; }

.chat-notif-dropdown__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
}
.chat-notif-dropdown__head button {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: var(--font-body);
  font-weight: 400;
}
.chat-notif-dropdown__head button:hover {
  text-decoration: underline;
}

.chat-notif-dropdown__list {
  overflow-y: auto;
  flex: 1;
}

.chat-notif-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.chat-notif-item:hover {
  background: var(--surface-hover);
}
.chat-notif-item--unread {
  background: rgba(108, 92, 231, 0.08);
}
.chat-notif-item--unread:hover {
  background: rgba(108, 92, 231, 0.14);
}

.chat-notif-item__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}
.chat-notif-item__body {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.chat-notif-item__time {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-top: 0.3rem;
}

.chat-notif-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  .chat-notif-dropdown {
    width: 300px;
  }
}

/* ============ Agent Mode Panel ============ */

.agent-panel {
  max-width: 760px;
  margin: 0 auto;
  padding: 0.6rem 1.6rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.agent-panel[hidden] { display: none; }

.agent-panel__header {
  display: flex;
  align-items: center;
  padding: 0.6rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.agent-panel__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-bright);
}

.agent-panel__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.agent-panel__plan {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.agent-plan__title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 0.15rem;
}

.agent-plan__step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--text);
  transition: all 0.2s;
}

.agent-plan__step--completed {
  opacity: 0.55;
  text-decoration: line-through;
}

.agent-plan__step--in_progress {
  border-color: var(--accent);
  background: rgba(109, 140, 192, 0.08);
}

.agent-plan__step-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.agent-plan__step--completed .agent-plan__step-icon { color: #4caf7d; }
.agent-plan__step--in_progress .agent-plan__step-icon { color: var(--accent-bright); }
.agent-plan__step--pending .agent-plan__step-icon { color: var(--text-dim); }

.agent-panel__tools {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 200px;
  overflow-y: auto;
}

.agent-tool-call {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.6rem;
  background: rgba(20, 31, 56, 0.6);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.76rem;
  animation: agentToolSlide 0.2s ease-out;
}

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

.agent-tool-call__icon {
  font-size: 0.85rem;
  opacity: 0.6;
  flex-shrink: 0;
}

.agent-tool-call__name {
  font-weight: 600;
  color: var(--accent-bright);
  font-family: var(--font-mono, monospace);
  font-size: 0.74rem;
  flex-shrink: 0;
}

.agent-tool-call__summary {
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.agent-tool-call__preview {
  color: var(--accent-bright);
  text-decoration: none;
  font-size: 0.72rem;
  flex-shrink: 0;
  transition: color 0.15s;
}

.agent-tool-call__preview:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .agent-panel {
    padding: 0.4rem 0.8rem 0;
  }
  .agent-panel__header {
    padding: 0.5rem 0.7rem;
  }
  .agent-tool-call__summary {
    max-width: 140px;
  }
}
