:root {
  --bg: #f7fafc;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.1);
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --accent: #0d9488;
  --accent-2: #14b8a6;
  --accent-ink: #0f766e;
  --ok: #059669;
  --danger: #e11d48;
  --shadow: 0 20px 48px rgba(15, 23, 42, 0.08);
  --radius: 20px;
  --font: "DM Sans", "PingFang SC", "Noto Sans SC", sans-serif;
  --serif: "Noto Serif SC", "Songti SC", serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --code-fg: #0f172a;
  --code-bg: rgba(255, 255, 255, 0.94);
  --glow: 0 0 0 transparent;
  --text-glow: 0 1px 0 rgba(255,255,255,.95), 0 0 22px rgba(255,255,255,.55);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
}
body.app-mode { height: 100vh; height: 100dvh; }
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--mono); letter-spacing: .05em; }
.tiny { font-size: 12px; color: var(--muted); }
.hidden { display: none !important; }
.full { width: 100%; }
.center { text-align: center; }

.wallpaper {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.wallpaper-media { position: absolute; inset: -2%; }
.wallpaper-media video, .wallpaper-media img {
  width: 100%; height: 100%; object-fit: cover;
  filter: blur(var(--wp-blur, 3px)) saturate(1.05) brightness(1.05);
  transform: scale(1.03);
  opacity: .95;
}
.wallpaper-dim {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255,255,255,.35), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,.22), rgba(247,250,252,.38)),
    rgba(255,255,255, var(--wp-dim, 0.12));
}
.preset-cyber5 .wallpaper-media {
  background:
    radial-gradient(44% 40% at 14% 22%, rgba(45,212,191,.42), transparent 62%),
    radial-gradient(40% 36% at 86% 16%, rgba(56,189,248,.36), transparent 60%),
    radial-gradient(48% 42% at 52% 84%, rgba(251,146,60,.22), transparent 65%),
    linear-gradient(145deg, #ffffff 0%, #ecfeff 38%, #f0f9ff 72%, #fff7ed 100%);
  animation: cyber5 5s ease-in-out infinite;
}
.preset-cyber5 .wallpaper-media::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.04) 3px 4px);
  mix-blend-mode: soft-light;
  animation: scan 5s linear infinite;
  opacity: .5;
}
.preset-aurora .wallpaper-media {
  background:
    radial-gradient(900px 500px at 15% 20%, rgba(45,212,191,.32), transparent 60%),
    radial-gradient(700px 480px at 85% 15%, rgba(56,189,248,.28), transparent 55%),
    linear-gradient(160deg, #ffffff, #e0f2fe 52%, #f0fdfa);
  animation: cyber5 8s ease-in-out infinite;
}
.preset-ember .wallpaper-media {
  background:
    radial-gradient(700px 420px at 30% 30%, rgba(251,146,60,.34), transparent 60%),
    radial-gradient(900px 500px at 80% 70%, rgba(248,113,113,.18), transparent 55%),
    linear-gradient(150deg, #ffffff, #fff7ed);
}
.preset-ink .wallpaper-media {
  background:
    radial-gradient(600px 400px at 70% 20%, rgba(14,165,233,.16), transparent 60%),
    linear-gradient(180deg, #ffffff, #f1f5f9);
}
.preset-paper .wallpaper-media {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #ecfeff 100%);
}
@keyframes cyber5 {
  0% { transform: scale(1) translate3d(0,0,0); }
  50% { transform: scale(1.06) translate3d(-1.2%, .8%, 0); }
  100% { transform: scale(1) translate3d(0,0,0); }
}
@keyframes scan {
  0% { transform: translateY(-6%); }
  100% { transform: translateY(6%); }
}

.glass {
  background: var(--glass);
  border: 1px solid rgba(255,255,255,.72);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.75);
}
.glass-strong {
  background: var(--glass-strong);
  border: 1px solid rgba(255,255,255,.85);
}

button, .primary, .ghost, .icon-btn, .tab { font: inherit; cursor: pointer; }
.primary {
  border: 0; border-radius: 12px; padding: 11px 16px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; font-weight: 700;
  box-shadow: 0 10px 24px rgba(13,148,136,.28);
}
.primary.soft {
  background: rgba(13,148,136,.1); color: var(--accent-ink);
  border: 1px solid rgba(13,148,136,.22); box-shadow: none;
}
.ghost {
  border: 1px solid var(--line); background: rgba(255,255,255,.7);
  color: var(--ink); border-radius: 12px; padding: 8px 12px;
}
.icon-btn {
  width: 30px; height: 30px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
input, textarea, select {
  width: 100%; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255,255,255,.95); color: var(--ink);
  padding: 11px 12px; font: inherit; outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(13,148,136,.55);
  box-shadow: 0 0 0 3px rgba(13,148,136,.12);
}
label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.error { color: var(--danger); min-height: 1.2em; font-size: 13px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-soft); }
.switch input { width: auto; accent-color: var(--accent); }

.splash {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: linear-gradient(160deg, #ffffff, #ecfeff 55%, #f0f9ff);
  transition: opacity .55s ease, visibility .55s ease;
}
.splash.fade { opacity: 0; visibility: hidden; }
.splash-ring {
  position: absolute; width: 176px; height: 176px; border-radius: 50%;
  border: 1px solid rgba(13,148,136,.35); border-bottom-color: transparent;
  animation: spin 6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.splash-brand {
  font-family: var(--serif); font-size: clamp(42px, 7vw, 72px); font-weight: 700;
  letter-spacing: .18em; color: var(--ink);
  text-shadow: var(--text-glow);
}
.splash-sub { margin-top: 12px; color: var(--muted); font-size: 12px; }

.landing {
  position: relative; z-index: 20; height: 100vh; overflow: auto;
  display: grid; place-items: center; padding: 32px 20px 48px;
}
.landing-shell {
  width: min(1140px, 100%);
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 24px; align-items: stretch;
}
.hero-card, .auth-card { border-radius: 28px; padding: 32px; }
.hero-card h1 {
  margin: 14px 0 0; font-family: var(--serif); font-size: clamp(36px, 5vw, 52px);
  letter-spacing: .02em; color: var(--ink); text-shadow: var(--text-glow);
}
.hero-card .lead {
  margin: 14px 0 0; font-size: 16px; line-height: 1.75; color: var(--ink-soft);
  text-shadow: 0 1px 0 rgba(255,255,255,.8);
  max-width: 36em;
}
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  font-size: 12px; padding: 6px 11px; border-radius: 999px;
  background: rgba(255,255,255,.78); border: 1px solid var(--line); color: var(--ink-soft);
}
.feature-grid {
  margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.feature {
  border-radius: 16px; padding: 16px;
  background: rgba(255,255,255,.58); border: 1px solid rgba(255,255,255,.8);
}
.feature strong { display: block; margin-bottom: 6px; color: var(--ink); text-shadow: 0 1px 0 #fff; }
.feature p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.howto {
  margin-top: 24px; padding-top: 18px;
  border-top: 1px solid rgba(15,23,42,.08);
}
.howto h3 { margin: 0 0 10px; font-family: var(--serif); font-size: 18px; text-shadow: 0 1px 0 #fff; }
.howto ol { margin: 0; padding-left: 18px; color: var(--ink-soft); line-height: 1.75; font-size: 14px; }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.auth-brand h2 { margin: 0; font-family: var(--serif); font-size: 28px; text-shadow: var(--text-glow); }
.auth-brand p { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.logo-mark {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  font-family: var(--serif); font-size: 24px; font-weight: 700;
  background: linear-gradient(145deg, #2dd4bf, #0d9488); color: #fff;
  box-shadow: 0 12px 28px rgba(13,148,136,.28);
}
.logo-mark.sm { width: 36px; height: 36px; font-size: 16px; border-radius: 12px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; background: rgba(255,255,255,.45); border-radius: 12px; padding: 4px; }
.tab {
  flex: 1; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--muted); padding: 9px;
}
.tab.active { background: #fff; color: var(--ink); border-color: var(--line); box-shadow: 0 2px 8px rgba(15,23,42,.04); }
.auth-hint { font-size: 12px; color: var(--muted); line-height: 1.55; margin-top: 12px; }
.auth-links { display: flex; gap: 8px; margin-top: 12px; }

.app {
  position: relative; z-index: 10; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh;
  display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 14px; padding: 14px;
  overflow: hidden; min-height: 0;
}
.sidebar {
  border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: hidden;
}
.side-brand { display: flex; gap: 10px; align-items: center; }
.side-brand strong { text-shadow: var(--text-glow); }
.side-section { min-height: 0; display: flex; flex-direction: column; }
.side-section.grow { flex: 1; }
.side-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--muted); margin-bottom: 8px;
}
.list { overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.list-item {
  text-align: left; border: 1px solid transparent; background: transparent;
  color: var(--ink); border-radius: 12px; padding: 10px; font-size: 13px;
}
.list-item:hover { background: rgba(255,255,255,.72); }
.list-item.active {
  background: rgba(255,255,255,.92); border-color: rgba(13,148,136,.28);
  box-shadow: 0 4px 14px rgba(15,23,42,.05);
}
.list-item .meta { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.upload-box {
  border: 1px dashed rgba(15,23,42,.16); border-radius: 14px; padding: 10px;
  display: grid; gap: 8px; background: rgba(255,255,255,.48);
}
.side-foot { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.side-foot a.full { grid-column: 1 / -1; }

.main {
  min-width: 0; min-height: 0; overflow: hidden;
  display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 14px;
}
.topbar {
  border-radius: var(--radius); padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.crumb { font-size: 14px; color: var(--muted); }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.editor-wrap {
  border-radius: var(--radius); padding: 18px 20px;
  min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--glass-strong);
}
.note-title {
  border: 0; background: transparent; font-family: var(--serif);
  font-size: 30px; font-weight: 700; padding: 0; color: var(--ink);
  text-shadow: var(--text-glow);
  flex-shrink: 0;
}
.meta-line { font-size: 12px; color: var(--muted); min-height: 1em; flex-shrink: 0; }
.split {
  flex: 1 1 auto; min-height: 0; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr); gap: 14px;
}
.note-body {
  min-width: 0; min-height: 0; width: 100%; height: 100%;
  overflow: auto; overscroll-behavior: contain;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--code-bg); resize: none; font-size: 14.5px; line-height: 1.7;
  color: var(--code-fg); padding: 14px; font-family: var(--mono);
  text-shadow: var(--glow);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.preview {
  min-width: 0; min-height: 0; height: 100%;
  overflow: auto; overscroll-behavior: contain;
  border: 1px solid var(--line); border-radius: 14px;
  background: rgba(255,255,255,.86); padding: 18px 20px;
}
.prose h1, .prose h2, .prose h3 {
  font-family: var(--serif); line-height: 1.3; color: var(--ink);
  text-shadow: 0 1px 0 #fff, 0 0 14px rgba(255,255,255,.7);
}
.prose h1 { font-size: 1.8rem; }
.prose h2 { font-size: 1.35rem; margin-top: 1.4em; }
.prose p, .prose li { line-height: 1.75; color: #1e293b; }
.prose code {
  font-family: var(--mono); background: rgba(15,23,42,.05);
  padding: .1em .35em; border-radius: 6px; color: var(--code-fg); text-shadow: var(--glow);
}
.prose pre {
  background: #0b1220; color: #e2e8f0; padding: 12px 14px; border-radius: 12px; overflow: auto;
}
.prose pre code { background: transparent; color: inherit; text-shadow: none; }
.prose table { width: 100%; border-collapse: collapse; font-size: 13px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 8px; }
.prose blockquote { margin: 0; padding-left: 14px; border-left: 3px solid var(--accent); color: var(--muted); }

body.theme-matrix { --code-fg: #22c55e; --code-bg: rgba(4, 18, 10, .94); --glow: 0 0 10px rgba(34,197,94,.55); }
body.theme-matrix .note-body { color: #4ade80; }
body.theme-matrix .prose code { color: #16a34a; background: rgba(22,163,74,.08); }
body.theme-amber { --code-fg: #f59e0b; --code-bg: rgba(28, 16, 4, .92); --glow: 0 0 10px rgba(251,191,36,.5); }
body.theme-amber .note-body { color: #fbbf24; }
body.theme-ocean { --code-fg: #38bdf8; --code-bg: rgba(4, 18, 32, .92); --glow: 0 0 10px rgba(56,189,248,.5); }
body.theme-ocean .note-body { color: #7dd3fc; }
body.theme-ink { --code-fg: #0f172a; --code-bg: rgba(255,255,255,.96); --glow: none; }

.theme-swatch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.theme-swatch button {
  border-radius: 14px; border: 1px solid var(--line); padding: 14px; text-align: left;
  background: #fff; color: var(--ink);
}
.theme-swatch button.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13,148,136,.12); }
.theme-swatch .sample {
  font-family: var(--mono); font-size: 13px; margin-top: 6px;
}
.theme-swatch .sample.matrix { color: #4ade80; text-shadow: 0 0 8px rgba(34,197,94,.5); background: #04120a; padding: 8px; border-radius: 8px; }
.theme-swatch .sample.amber { color: #fbbf24; text-shadow: 0 0 8px rgba(251,191,36,.45); background: #1c1004; padding: 8px; border-radius: 8px; }
.theme-swatch .sample.ocean { color: #7dd3fc; text-shadow: 0 0 8px rgba(56,189,248,.45); background: #041220; padding: 8px; border-radius: 8px; }
.theme-swatch .sample.ink { color: #0f172a; background: #f8fafc; padding: 8px; border-radius: 8px; }

.modal {
  position: fixed; inset: 0; z-index: 60; background: rgba(15,23,42,.22);
  display: grid; place-items: center; padding: 20px;
}
.modal-card {
  width: min(560px, 100%); border-radius: 20px; padding: 22px;
  max-height: 80vh; overflow: auto; background: rgba(255,255,255,.94);
}
.modal-card h3 { margin: 0 0 12px; font-family: var(--serif); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 999px; font-size: 11px;
  background: rgba(15,23,42,.05); color: var(--muted);
}
.chip.ok { color: var(--ok); }
.chip.warn { color: #b45309; }
.ai-out {
  white-space: pre-wrap; background: rgba(255,255,255,.9);
  border: 1px solid var(--line); padding: 12px; border-radius: 12px;
  color: var(--ink); font-family: var(--mono); font-size: 13px; line-height: 1.6;
}

.blog-body { overflow: auto; background: transparent; }
.blog-nav {
  position: sticky; top: 14px; z-index: 20; margin: 14px auto 0;
  width: min(920px, calc(100% - 28px)); border-radius: 16px; padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.blog-nav .brand { display: flex; gap: 10px; align-items: center; }
.blog-main { position: relative; z-index: 10; width: min(920px, calc(100% - 28px)); margin: 18px auto 40px; display: grid; gap: 14px; }
.blog-card { border-radius: 18px; padding: 22px 24px; cursor: pointer; }
.blog-card h2 { margin: 0 0 8px; font-family: var(--serif); font-size: 24px; text-shadow: var(--text-glow); }
.blog-card .summary { color: var(--muted); line-height: 1.6; }
.blog-meta { margin-top: 12px; font-size: 12px; color: var(--muted); }
.blog-article { border-radius: 20px; padding: 28px; }
.blog-article h1 { margin-top: 0; font-family: var(--serif); font-size: 34px; text-shadow: var(--text-glow); }

.drop-mask {
  position: fixed; inset: 0; z-index: 90; background: rgba(255,255,255,.5);
  display: grid; place-items: center;
}
.drop-card {
  padding: 36px 48px; border-radius: 24px; text-align: center; font-size: 22px;
  border: 1px dashed rgba(13,148,136,.45); color: var(--ink);
}

.menu-btn { display: none; }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; z-index: 25;
  background: rgba(15,23,42,.28); border: 0; padding: 0; cursor: pointer;
}

@media (max-width: 980px) {
  .landing { padding: 16px 12px 28px; align-items: start; }
  .landing-shell { grid-template-columns: 1fr; gap: 14px; }
  .auth-card { order: -1; }
  .hero-card, .auth-card { border-radius: 20px; padding: 20px 16px; }
  .hero-card h1 { font-size: clamp(28px, 8vw, 36px); }
  .hero-card .lead { font-size: 14px; }
  .feature-grid { grid-template-columns: 1fr; }
  .howto ol { font-size: 13px; padding-left: 16px; }

  .menu-btn { display: inline-grid; place-items: center; }
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    padding: 8px;
    gap: 8px;
  }
  .sidebar {
    position: fixed; left: 8px; top: 8px; bottom: 8px; width: min(300px, calc(100vw - 40px));
    z-index: 30; transform: translateX(calc(-100% - 20px));
    transition: transform .22s ease; overflow: auto;
    max-height: none;
  }
  .app.sidebar-open .sidebar { transform: translateX(0); }
  .app.sidebar-open .sidebar-backdrop { display: block; }

  .main { min-height: 0; }
  .topbar {
    padding: 10px 12px; flex-wrap: wrap; align-items: flex-start;
  }
  .topbar .crumb-row { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
  .crumb { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-actions {
    width: 100%; justify-content: flex-start; gap: 6px;
  }
  .top-actions .switch { font-size: 11px; }
  .top-actions .ghost, .top-actions .primary { padding: 8px 10px; font-size: 13px; }

  .editor-wrap { padding: 12px; gap: 8px; }
  .note-title { font-size: 22px; }
  .split {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(140px, .9fr) minmax(180px, 1.1fr);
  }
  .note-body, .preview { min-height: 140px; font-size: 14px; }

  .blog-nav {
    width: calc(100% - 16px); margin: 8px auto 0; padding: 10px 12px;
    flex-wrap: wrap; gap: 8px;
  }
  .blog-main { width: calc(100% - 16px); margin: 12px auto 28px; }
  .blog-card { padding: 16px; }
  .blog-card h2 { font-size: 20px; }
  .blog-article { padding: 16px; }
  .blog-article h1 { font-size: 26px; }
  .modal { padding: 12px; align-items: end; }
  .modal-card { width: 100%; max-height: 88dvh; border-radius: 16px 16px 12px 12px; }
  .drop-card { padding: 24px 18px; font-size: 18px; margin: 12px; }
}

@media (max-width: 560px) {
  .side-foot { grid-template-columns: 1fr; }
  .top-actions .switch span, .top-actions .switch { }
}

.auth-links { flex-wrap: wrap; }
.tiny-btn { padding: 4px 8px; font-size: 11px; border-radius: 8px; }
.users-panel { flex: 0 0 auto; max-height: 160px; }
.user-list .list-item { padding: 8px 10px; cursor: default; }
.user-list .list-item .role-tag {
  display: inline-block; margin-left: 6px; font-size: 10px; padding: 1px 6px;
  border-radius: 999px; background: rgba(13,148,136,.1); color: var(--accent-ink);
}
.user-list .list-item .role-tag.owner { background: rgba(234,88,12,.12); color: #9a3412; }
.user-list .list-item .role-tag.admin { background: rgba(2,132,199,.12); color: #0369a1; }
.dir-count {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink-soft); margin-bottom: 10px;
}
.dir-count strong { color: var(--ink); font-size: 18px; }

.folders-panel { flex: 0 0 auto; max-height: 180px; }
.folder-list .list-item { padding: 7px 10px; font-size: 12px; }
.folder-list .list-item.depth-1 { padding-left: 18px; }
.folder-list .list-item.depth-2 { padding-left: 28px; }
.row-meta {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
}
.folder-pick { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); }
.folder-pick select { width: auto; min-width: 120px; padding: 6px 8px; font-size: 12px; }

.modal-card.chat-wide { width: min(920px, 100%); max-height: 88vh; display: flex; flex-direction: column; }
.chat-shell { display: grid; grid-template-columns: 200px 1fr; gap: 12px; min-height: 420px; max-height: 62vh; }
.chat-sessions { overflow: auto; border-right: 1px solid var(--line); padding-right: 8px; display: flex; flex-direction: column; gap: 6px; }
.chat-sessions .list-item { width: 100%; }
.chat-main { min-width: 0; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.chat-ctx {
  font-size: 12px; color: var(--muted);
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.chat-ctx .warn { color: #b45309; }
.chat-log {
  flex: 1; min-height: 220px; overflow: auto; border: 1px solid var(--line);
  border-radius: 14px; background: rgba(255,255,255,.82); padding: 12px; display: flex; flex-direction: column; gap: 10px;
}
.chat-bubble { max-width: 92%; padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.chat-bubble.user { align-self: flex-end; background: rgba(13,148,136,.12); color: var(--ink); }
.chat-bubble.assistant { align-self: flex-start; background: #0b1220; color: #e2e8f0; }
.chat-bubble .meta { display: block; margin-top: 4px; font-size: 11px; opacity: .7; }
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input-row textarea { flex: 1; min-height: 64px; resize: vertical; }
@media (max-width: 780px) {
  .chat-shell { grid-template-columns: 1fr; max-height: 70vh; }
  .chat-sessions { border-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 8px; max-height: 120px; }
}