﻿:root {
  --sidebar-bg: #091225;
  --sidebar-bg-2: #0c1730;
  --sidebar-line: rgba(255,255,255,0.05);
  --main-bg: #eef3f7;
  --card-bg: #ffffff;
  --text: #151b2f;
  --muted: #7a7f92;
  --purple: #1f6feb;
  --purple-2: #4a8dff;
  --green: #bff5da;
  --green-text: #2f8c5a;
  --red: #ef5a61;
  --shadow: 0 8px 24px rgba(16, 23, 42, 0.06);
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: "Manrope", "Noto Sans SC", sans-serif; color: var(--text); }
body.console-body {
  background:
    radial-gradient(circle at top left, rgba(101, 88, 245, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 24%),
    linear-gradient(180deg, #f6f7ff 0%, #eef3fb 46%, var(--main-bg) 100%);
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.console-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
}

.console-sidebar {
  min-height: 100vh;
  background: linear-gradient(180deg, #0a1024 0%, #101735 42%, #121d40 100%);
  color: rgba(255,255,255,0.92);
  padding: 10px 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid rgba(255,255,255,0.04);
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.03);
  overflow-y: auto;
}
.console-sidebar > div:first-child {
  display: grid;
  gap: 6px;
  align-content: start;
}

.console-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(101, 88, 245, 0.22), transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.03) 100%);
}

.console-brand-logo {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(101, 88, 245, 0.34) 0%, rgba(59, 130, 246, 0.26) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14);
  font-size: 12px;
}

.console-brand-title { font-size: 16px; font-weight: 800; color: #c9d4ff; }
.console-brand-subtitle { margin-top: 2px; font-size: 11px; color: rgba(255,255,255,0.6); }
.console-nav-group {
  margin-top: 0;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.07);
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
}
.console-nav-label {
  padding: 4px 6px 2px;
  margin-bottom: 2px;
  font-size: 9px;
  color: rgba(255,255,255,0.36);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.console-nav-subhead {
  padding: 5px 6px 2px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(201,212,255,0.72);
}

.console-nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 12px; margin-bottom: 1px;
  color: rgba(255,255,255,0.82);
  border: 1px solid transparent;
  font-size: 13px;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.console-nav-item:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.08);
  transform: translateX(2px);
}
.console-nav-item.is-active {
  background: linear-gradient(135deg, rgba(101, 88, 245, 0.3) 0%, rgba(59, 130, 246, 0.2) 100%);
  border-color: rgba(151, 146, 255, 0.24);
  box-shadow: 0 14px 26px rgba(12, 20, 44, 0.3);
}
.console-nav-item.is-muted { opacity: 0.8; }
.console-nav-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  text-align: center;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.68);
}
.console-nav-item.is-active .console-nav-icon {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.18);
  color: #ffffff;
}
.console-nav-item-split { align-items: flex-start; }
.console-nav-item-split .console-nav-icon {
  width: 28px;
  font-size: 12px;
}
.console-nav-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.console-nav-copy > span { font-weight: 700; }
.console-nav-copy small {
  color: rgba(255,255,255,0.48);
  font-size: 11px;
  line-height: 1.35;
}
.console-nav-item.is-active .console-nav-copy small { color: rgba(255,255,255,0.82); }

.console-sidebar-footer {
  display: grid;
  gap: 8px;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.07);
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
  margin-top: 6px;
}
.console-runtime-card {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.05); border-radius: 10px; padding: 8px 10px;
  font-size: 12px;
}
.console-runtime-dot { width: 7px; height: 7px; border-radius: 999px; background: #45d48f; }
.console-runtime-meta { font-size: 11px; color: rgba(255,255,255,0.48); line-height: 1.5; }
.console-lang-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.console-lang-switch form { margin: 0; }
.console-lang-switch .lang-btn { width: 100%; }
.lang-btn {
  border: 1px solid rgba(255,255,255,0.07); border-radius: 8px; padding: 6px 0;
  background: rgba(255,255,255,0.03); color: rgba(255,255,255,0.68); font-size: 12px;
}
.lang-btn.is-active { background: rgba(101, 88, 245, 0.24); color: #fff; border-color: rgba(151,146,255,0.24); }

.console-main { padding: 24px 28px 40px; min-width: 0; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 800; }
.page-head p { margin: 10px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 10px; margin: 18px 0 22px; flex-wrap: wrap; align-items: center; }
.alert, .console-alert {
  padding: 14px 16px; border-radius: 14px; margin-bottom: 16px; font-weight: 600;
}
.alert-ok, .console-alert.ok { background: #ecfdf3; color: #146c43; border: 1px solid #cdeedb; }
.alert-error, .console-alert.error { background: #fff1f2; color: #b42318; border: 1px solid #fecdd3; }

.console-alert {
  padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 600;
}
.console-alert.ok { background: rgba(59,178,115,0.12); color: #23754a; }
.console-alert.error { background: rgba(239,90,97,0.12); color: #b5323a; }

.console-card, .chat-board, .list-row-card, .task-row-card, .workspace-overview-card, .workspace-panel, .status-metric-card, .empty-panel {
  background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.console-card { padding: 18px; }
.console-card.compact { padding: 16px; }
.console-card-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }

.chat-console-layout { display: grid; grid-template-columns: 330px 1fr; gap: 22px; align-items: start; }
.chat-console-layout--focus { grid-template-columns: minmax(0, 1fr); }
.chat-rail { display: grid; gap: 18px; }
.chat-stage { min-width: 0; display: grid; gap: 18px; }
.chat-stage-full { max-width: 1320px; width: 100%; margin: 0 auto; }
.chat-board { padding: 22px; min-height: 420px; max-height: calc(100vh - 260px); overflow-y: auto; display: grid; gap: 16px; align-content: start; }
.chat-stage-full .chat-board { min-height: 520px; max-height: calc(100vh - 235px); }
.chat-focus-strip { display: grid; gap: 16px; }
.chat-focus-strip-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.chat-focus-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chat-focus-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.chat-focus-stat { border: 1px solid #edf0f3; border-radius: 14px; padding: 14px 16px; background: #fbfcfe; display: grid; gap: 8px; }
.chat-focus-stat span { color: var(--muted); font-size: 13px; }
.chat-focus-stat strong { font-size: 22px; color: var(--text); }
.chat-session-strip { border-top: 1px solid #eceef2; padding-top: 14px; }
.session-pill-list { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.session-pill { min-width: 220px; max-width: 280px; border: 1px solid #e6eaf0; border-radius: 14px; background: #fff; padding: 12px 14px; text-decoration: none; color: inherit; display: grid; gap: 6px; }
.session-pill.active { border-color: var(--purple); box-shadow: 0 8px 22px rgba(101, 88, 245, 0.14); }
.session-pill-title { font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-pill-meta { font-size: 12px; color: var(--muted); }
.chat-row { display: flex; gap: 14px; margin-bottom: 18px; align-items: flex-start; }
.chat-row.user { justify-content: flex-end; align-items: center; max-width: min(920px, 100%); margin-left: auto; }
.avatar-circle {
  width: 34px; height: 34px; border-radius: 999px; background: #24344f; color: #fff;
  display: grid; place-items: center; font-weight: 700; flex: 0 0 auto;
}
.assistant-panel {
  width: min(820px, 100%);
  border: 1px solid #e8ebef; border-radius: 16px; background: #fff;
}
.assistant-section { padding: 18px 20px; }
.assistant-section.split-line { border-top: 1px solid #eceef2; }
.assistant-title { font-size: 16px; font-weight: 800; margin-bottom: 10px; }
.assistant-text { color: #2f3546; line-height: 1.8; white-space: pre-wrap; }
.question-list { margin: 0; padding-left: 22px; line-height: 1.9; }
.user-bubble {
  max-width: 720px; background: linear-gradient(135deg, var(--purple) 0%, var(--purple-2) 100%);
  color: #fff; padding: 14px 18px; border-radius: 16px; line-height: 1.7; box-shadow: 0 10px 22px rgba(101,88,245,0.2);
}
.user-tag {
  width: 32px; height: 32px; border-radius: 999px; background: var(--purple); color: #fff;
  display: grid; place-items: center; font-weight: 700;
}
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat-card { padding: 20px; background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 700; }
.stat-value { margin-top: 8px; font-size: 28px; font-weight: 800; color: var(--text); }
.stat-meta { margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.chat-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 22px; align-items: start; }
.timeline-panel, .chat-panel, .panel-card {
  padding: 20px; background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.stack-md { display: grid; gap: 16px; }
.section-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section-header h2, .section-header h3 { margin: 0; }
.section-desc { color: var(--muted); line-height: 1.7; }
.soft-block {
  border: 1px solid #eceff3; border-radius: 14px; background: #f8fafc; padding: 14px 16px; line-height: 1.8; white-space: pre-wrap;
}
.soft-text { color: #495165; line-height: 1.8; white-space: pre-wrap; }
.readiness-bar { height: 12px; border-radius: 999px; overflow: hidden; background: #edf1f6; }
.readiness-fill { height: 100%; background: linear-gradient(90deg, var(--purple) 0%, var(--purple-2) 100%); }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; padding: 7px 12px; border-radius: 999px; background: #eef2ff; color: var(--purple); font-size: 12px; font-weight: 800; }
.pill-active { background: #ecfdf3; color: #137a43; }
.pill-confirmed { background: #eef2ff; color: #4d58f2; }
.pill-cancelled { background: #fff1f2; color: #d13a53; }
.chat-stream { display: grid; gap: 16px; }
.chat-bubble {
  max-width: min(860px, 100%); border: 1px solid #e8ebef; border-radius: 16px; background: #fff; padding: 18px 20px; line-height: 1.8;
}
.chat-bubble.chat-user {
  margin-left: auto; background: linear-gradient(135deg, var(--purple) 0%, var(--purple-2) 100%); color: #fff; border-color: transparent;
}
.chat-bubble.chat-assistant { margin-right: auto; }
.chat-role { font-weight: 800; margin-bottom: 10px; }
.is-pending { opacity: 0.88; }
.typing-dots::after {
  content: ""; display: inline-block; width: 1.2em; text-align: left; animation: typing-dots 1.2s steps(4, end) infinite;
}
@keyframes typing-dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
  100% { content: ""; }
}
.chat-input-form {
  margin-top: 18px; background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 16px;
}
.chat-input-form textarea, textarea, input, select {
  width: 100%; border: 1px solid #dde2ea; border-radius: 12px; padding: 12px 14px; background: #fff;
}
.chat-input-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.primary-btn, .ghost-btn, .mini-btn {
  border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn {
  border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn-primary { background: var(--purple); color: #fff; }
.btn-outline { background: #fff; color: #30374a; border: 1px solid #dfe4ed; }
.btn-xs { padding: 8px 12px; font-size: 12px; }
.primary-btn { background: var(--purple); color: #fff; }
.primary-btn.secondary { background: var(--purple); }
.ghost-btn, .mini-btn { background: #fff; color: #30374a; border: 1px solid #dfe4ed; }
.mini-btn.primary { background: var(--purple); color: #fff; border-color: transparent; }
.mini-btn.danger { background: #f86066; color: #fff; border-color: transparent; }

.status-stack { display: grid; gap: 10px; }
.status-line { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.status-line strong { color: var(--text); }
.empty-note, .empty-panel { padding: 16px; color: var(--muted); }

.list-page { display: grid; gap: 14px; }
.list-row-card, .task-row-card { padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.list-row-card h3, .task-row-card h3 { margin: 0 0 8px; font-size: 16px; }
.row-meta { color: var(--muted); font-size: 13px; }
.row-actions-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.slim-pill, .mini-badge {
  padding: 7px 12px; border-radius: 999px; background: #f2f4f7; color: #5f6678; font-size: 12px; font-weight: 700;
}

.workspace-head {
  position: relative;
  overflow: hidden;
  padding: 28px 30px;
  border-radius: 30px;
  background:
    radial-gradient(circle at top left, rgba(100, 86, 245, 0.18), transparent 34%),
    linear-gradient(135deg, #f7efe3 0%, #eef5ff 52%, #f8fbff 100%);
  border: 1px solid rgba(82, 101, 142, 0.14);
  box-shadow: 0 26px 60px rgba(15, 23, 42, 0.08);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 320px;
  gap: 22px;
  align-items: start;
}
.workspace-eyebrow,
.workspace-section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #725944;
}
.workspace-head h1 {
  margin: 10px 0 0;
  font-size: clamp(28px, 3.2vw, 42px);
  line-height: 1.1;
}
.workspace-head p {
  margin-top: 14px;
  max-width: 840px;
  font-size: 15px;
  line-height: 1.85;
  color: #5c6880;
}
.workspace-hero-summary {
  display: grid;
  gap: 12px;
}
.workspace-hero-pill {
  padding: 18px 18px 16px;
  border-radius: 20px;
  border: 1px solid rgba(79, 98, 138, 0.12);
  background: rgba(255,255,255,0.78);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
  display: grid;
  gap: 8px;
}
.workspace-hero-pill span,
.workspace-hero-pill small { color: var(--muted); }
.workspace-hero-pill strong {
  font-size: 24px;
  line-height: 1.2;
  color: #15213a;
}
.workspace-switchboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}
.workspace-mode-card {
  border: 1px solid rgba(42, 63, 99, 0.08);
  border-radius: 24px;
  padding: 22px 22px 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.94) 0%, rgba(247,250,254,0.96) 100%);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
  display: grid;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.workspace-mode-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.1);
}
.workspace-mode-card.is-active {
  transform: translateY(-2px);
  border-color: rgba(90, 103, 235, 0.28);
  box-shadow: 0 24px 52px rgba(56, 72, 116, 0.16);
}
.workspace-mode-card-manuscript.is-active {
  background: linear-gradient(135deg, #fffaf0 0%, #fff 48%, #f5f2eb 100%);
}
.workspace-mode-card-memory.is-active {
  background: linear-gradient(135deg, #f2f8ff 0%, #fff 48%, #eef6ff 100%);
}
.workspace-mode-card-head,
.workspace-overview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.workspace-mode-card-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #816451;
}
.workspace-mode-card-tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(18, 24, 39, 0.05);
  color: #5a6479;
  font-size: 11px;
  font-weight: 700;
}
.workspace-mode-card strong {
  font-size: 28px;
  line-height: 1.15;
}
.workspace-mode-card p {
  margin: 0;
  color: #536078;
  line-height: 1.8;
}
.workspace-mode-card-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.workspace-mode-card-meta span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.84);
  border: 1px solid rgba(76, 94, 130, 0.1);
  color: #33415d;
  font-size: 12px;
  font-weight: 700;
}
.workspace-overview-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) 360px;
  gap: 18px;
  margin-top: 18px;
}
.workspace-overview-card { padding: 22px; }
.workspace-overview-card h2 { margin: 6px 0 0; font-size: 22px; }
.workspace-overview-card-primary {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(249,250,253,0.98) 100%);
}
.workspace-overview-card-side {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(246,249,255,0.98) 100%);
  border: 1px solid rgba(45, 72, 132, 0.08);
}
.workspace-side-note {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(244, 247, 252, 0.9);
  border: 1px solid rgba(84, 104, 146, 0.08);
  display: grid;
  gap: 8px;
}
.workspace-side-note-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.workspace-path-code {
  display: block;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 12px;
  line-height: 1.7;
}
.workspace-notes-tight { margin-top: 14px; }
.overview-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 14px; }
.overview-box { border: 1px solid #edf0f3; border-radius: 14px; padding: 16px; display: grid; gap: 8px; }
.overview-box span, .overview-box small { color: var(--muted); }
.overview-box strong { font-size: 30px; }
.workspace-notes { margin: 16px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.8; }
.workspace-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.workspace-panel { padding: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.memory-bank-list, .file-list { display: grid; gap: 10px; }
.memory-bank-item, .file-item {
  border: 1px solid #eceff3; border-radius: 12px; padding: 12px 14px; display: flex; justify-content: space-between; gap: 12px; align-items: center;
}
.memory-bank-name, .file-name { font-weight: 700; }
.workspace-mode-switch {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  box-shadow: var(--shadow);
  margin-top: 18px;
}
.workspace-mode-btn {
  border: 0;
  border-radius: 14px;
  padding: 10px 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.workspace-mode-btn.is-active {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-2) 100%);
  color: #fff;
}
.workspace-studio-shell { margin-top: 18px; display: grid; gap: 18px; }
.workspace-mode-panel { display: none; }
.workspace-mode-panel.is-active { display: grid; gap: 18px; }
.workspace-panel-banner {
  border-radius: 28px;
  padding: 24px 26px;
  border: 1px solid rgba(47, 62, 95, 0.08);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.workspace-panel-banner-manuscript {
  background: linear-gradient(135deg, #fff4e6 0%, #fffdf8 48%, #f5f0e8 100%);
}
.workspace-panel-banner-memory {
  background: linear-gradient(135deg, #eef7ff 0%, #ffffff 48%, #eef5ff 100%);
}
.workspace-panel-banner-copy {
  display: grid;
  gap: 8px;
  max-width: 820px;
}
.workspace-panel-banner-copy h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}
.workspace-panel-banner-copy p {
  margin: 0;
  color: #56647d;
  line-height: 1.85;
}
.workspace-panel-banner-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.workspace-panel-banner-stats span {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(56, 73, 110, 0.08);
  color: #33415d;
  font-size: 12px;
  font-weight: 700;
}
.workspace-studio-grid { display: grid; gap: 18px; align-items: start; }
.manuscript-studio-grid { grid-template-columns: 300px minmax(0, 1fr) 320px; }
.memory-studio-grid { grid-template-columns: 260px minmax(0, 1fr) 420px; }
.memory-bank-column { display: grid; gap: 18px; }
.chapter-rail, .memory-group-list, .memory-entry-list { display: grid; gap: 12px; }
.chapter-rail-item, .memory-group-card, .memory-bank-card, .memory-entry-card {
  width: 100%;
  border: 1px solid #e6eaf2;
  border-radius: 16px;
  padding: 14px 16px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.chapter-rail-item:hover, .memory-group-card:hover, .memory-bank-card:hover, .memory-entry-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(16, 23, 42, 0.08);
}
.chapter-rail-item.is-active, .memory-group-card.is-active, .memory-bank-card.is-active, .memory-entry-card.is-active {
  border-color: rgba(31,111,235,0.42);
  box-shadow: 0 10px 24px rgba(31,111,235,0.12);
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
}
.chapter-rail-kicker, .memory-group-kicker {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}
.chapter-rail-meta, .memory-group-meta, .memory-entry-card-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.chapter-rail-preview, .memory-bank-card-preview, .memory-entry-card-preview {
  color: #374151;
  line-height: 1.7;
}
.memory-command-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.memory-command-card {
  padding: 18px 18px 16px;
  border-radius: 22px;
  border: 1px solid rgba(41, 68, 123, 0.1);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(245,248,253,0.98) 100%);
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.06);
  display: grid;
  gap: 10px;
  min-height: 176px;
}
.memory-command-card span,
.memory-command-card small {
  color: var(--muted);
}
.memory-command-card strong {
  font-size: 22px;
  line-height: 1.2;
}
.memory-command-card p {
  margin: 0;
  color: #405069;
  line-height: 1.7;
}
.memory-command-card-zone {
  background:
    radial-gradient(circle at top right, rgba(31, 111, 235, 0.12), transparent 34%),
    linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}
.memory-command-card-bank {
  background:
    radial-gradient(circle at top right, rgba(15, 159, 123, 0.12), transparent 34%),
    linear-gradient(180deg, #f4fbf8 0%, #ffffff 100%);
}
.memory-command-card-layer {
  background:
    radial-gradient(circle at top right, rgba(219, 124, 31, 0.12), transparent 34%),
    linear-gradient(180deg, #fff9f1 0%, #ffffff 100%);
}
.memory-command-card-bilingual {
  background:
    radial-gradient(circle at top right, rgba(79, 98, 138, 0.12), transparent 34%),
    linear-gradient(180deg, #f7f9fc 0%, #ffffff 100%);
}
.manuscript-toolbar, .manuscript-footer, .memory-entry-board-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.manuscript-paper {
  min-height: 720px;
  padding: 34px 44px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(249,248,244,0.98) 100%),
    repeating-linear-gradient(180deg, transparent 0, transparent 31px, rgba(18, 24, 39, 0.03) 31px, rgba(18, 24, 39, 0.03) 32px);
  border: 1px solid rgba(18, 24, 39, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.72), 0 20px 50px rgba(15, 23, 42, 0.08);
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 18px;
}
.manuscript-paper-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #8a7561;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.manuscript-paper h3 {
  margin: 0;
  font-size: 28px;
  line-height: 1.3;
  font-weight: 800;
}
.manuscript-paper-body {
  white-space: pre-wrap;
  line-height: 2;
  font-size: 17px;
  color: #221f1a;
}
.manuscript-footer-meta { color: var(--muted); }
.memory-bank-grid, .memory-editor-stack { display: grid; gap: 14px; }
.memory-bank-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.memory-bank-card-head, .memory-entry-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.memory-bank-card-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.memory-entry-board {
  border: 1px solid #edf0f3;
  border-radius: 18px;
  background: #fbfcfe;
  padding: 14px;
  display: grid;
  gap: 12px;
}
.workspace-inline-status {
  min-height: 22px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.workspace-inline-status.is-ok { color: #23754a; }
.workspace-inline-status.is-error { color: #b5323a; }
.memory-taxonomy-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
}
.memory-taxonomy-panel h3 {
  margin: 8px 0 0;
  font-size: 22px;
}
.memory-taxonomy-panel p {
  margin: 14px 0 0;
  color: #46536a;
  line-height: 1.8;
}
.memory-taxonomy-meta {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
}
.memory-bank-detail-list {
  display: grid;
  gap: 12px;
}
.memory-bank-detail-card {
  width: 100%;
  border: 1px solid rgba(41, 68, 123, 0.09);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.memory-bank-detail-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}
.memory-bank-detail-card.is-active {
  border-color: rgba(31, 111, 235, 0.32);
  box-shadow: 0 16px 34px rgba(31, 111, 235, 0.12);
}
.memory-bank-detail-head,
.status-provider-head,
.status-job-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.memory-bank-detail-body {
  color: #405069;
  line-height: 1.7;
}
.memory-bank-detail-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.memory-guide-panel {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(243, 247, 255, 0.98) 0%, rgba(255,255,255,0.98) 100%);
  border: 1px solid rgba(41, 68, 123, 0.1);
}
.memory-guide-steps {
  display: grid;
  gap: 12px;
}
.memory-guide-step {
  padding: 14px 14px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(41, 68, 123, 0.08);
  display: grid;
  gap: 8px;
}
.memory-guide-step span {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 800;
  color: #725944;
}
.memory-guide-step strong {
  font-size: 16px;
}
.memory-guide-step p {
  margin: 0;
  color: #49576d;
  line-height: 1.7;
}

.manuscript-intel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.manuscript-intel-panel,
.manuscript-reader-panel,
.manuscript-rail-panel,
.manuscript-side-panel,
.workspace-support-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(247,244,238,0.98) 100%);
  border: 1px solid rgba(113, 90, 62, 0.08);
}
.workspace-mode-panel-memory .workspace-panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(244,247,252,0.98) 100%);
  border: 1px solid rgba(25, 61, 122, 0.08);
}
.manuscript-card-list {
  display: grid;
  gap: 12px;
}
.manuscript-intel-card {
  padding: 14px 15px;
  border-radius: 16px;
  border: 1px solid rgba(20, 28, 44, 0.08);
  background: rgba(255,255,255,0.9);
  display: grid;
  gap: 8px;
}
.manuscript-intel-card.warm {
  background: linear-gradient(180deg, #fffaf2 0%, #fff 100%);
}
.manuscript-intel-card.paper {
  background: linear-gradient(180deg, #f8f3ea 0%, #fffdfa 100%);
}
.manuscript-intel-card.cool {
  background: linear-gradient(180deg, #f2f7ff 0%, #fff 100%);
}
.manuscript-intel-card-head {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #725e4a;
}
.manuscript-intel-card-meta {
  font-size: 12px;
  color: var(--muted);
}
.manuscript-intel-card-body {
  line-height: 1.7;
  color: #283142;
}
.manuscript-planning-paper {
  min-height: 720px;
  padding: 34px 42px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,251,244,0.98) 0%, rgba(252,247,238,0.98) 100%),
    repeating-linear-gradient(180deg, transparent 0, transparent 31px, rgba(90, 68, 45, 0.04) 31px, rgba(90, 68, 45, 0.04) 32px);
  border: 1px dashed rgba(128, 101, 73, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.74), 0 18px 40px rgba(15, 23, 42, 0.06);
  display: grid;
  gap: 18px;
}
.manuscript-paper-body-planning {
  color: #45311f;
}
.chapter-rail-status {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}
.chapter-rail-status.is-drafted {
  background: rgba(12, 163, 94, 0.12);
  color: #137a43;
}
.chapter-rail-status.is-planned {
  background: rgba(31, 111, 235, 0.12);
  color: #1f6feb;
}
.memory-group-copy {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 4px;
}
.manuscript-rail-panel,
.manuscript-side-panel,
.memory-groups-panel {
  position: sticky;
  top: 24px;
}
.manuscript-edit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) repeat(2, minmax(0, 0.85fr));
  gap: 18px;
}
.manuscript-edit-grid-featured {
  margin-top: 18px;
}
.manuscript-edit-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,254,0.98) 100%);
  border: 1px solid rgba(41, 68, 123, 0.08);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.07);
}
.manuscript-edit-panel-draft {
  background:
    radial-gradient(circle at top right, rgba(31, 111, 235, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(247,250,255,0.98) 0%, rgba(255,255,255,0.98) 100%);
}
.manuscript-edit-panel-draft textarea,
.manuscript-edit-panel textarea {
  min-height: 220px;
  resize: vertical;
}
.workspace-support-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}
.workspace-file-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.workspace-support-card.is-empty .card-stack,
.manuscript-reader-panel.is-empty,
.manuscript-rail-panel.is-empty {
  align-content: start;
}
.workspace-support-card.is-empty .empty-note,
.manuscript-reader-panel.is-empty .empty-note {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.86);
  border: 1px solid rgba(41, 68, 123, 0.08);
}
.manuscript-reader-panel.is-empty .manuscript-planning-paper {
  min-height: 360px;
  padding: 26px 30px;
}
.manuscript-rail-panel.is-empty {
  min-height: 0;
}
.manuscript-rail-panel.is-empty #chapter-rail {
  min-height: 120px;
}
.workspace-lane-grid {
  display: grid;
  gap: 14px;
}
.workspace-lane-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(45, 62, 97, 0.08);
  display: grid;
  gap: 10px;
}
.workspace-lane-card-manuscript {
  background: linear-gradient(180deg, #fff9f0 0%, #ffffff 100%);
}
.workspace-lane-card-memory {
  background: linear-gradient(180deg, #f3f8ff 0%, #ffffff 100%);
}
.workspace-lane-card h4 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.status-hero {
  padding: 28px 30px;
  border-radius: 30px;
  background:
    radial-gradient(circle at top left, rgba(31, 111, 235, 0.18), transparent 34%),
    linear-gradient(135deg, #f3f8ff 0%, #fff8ef 52%, #ffffff 100%);
  border: 1px solid rgba(41, 68, 123, 0.1);
  box-shadow: 0 26px 60px rgba(15, 23, 42, 0.08);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.status-hero-copy {
  max-width: 860px;
}
.status-hero h1 {
  margin: 10px 0 0;
  font-size: clamp(28px, 3.1vw, 42px);
  line-height: 1.1;
}
.status-hero p {
  margin-top: 14px;
  color: #58657d;
  line-height: 1.85;
}
.status-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.status-spotlight-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.status-spotlight-card {
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(41, 68, 123, 0.08);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.06);
  display: grid;
  gap: 10px;
}
.status-spotlight-card span,
.status-spotlight-card small {
  color: var(--muted);
}
.status-spotlight-card strong {
  font-size: 28px;
  line-height: 1.15;
}
.status-spotlight-card-runtime {
  background: linear-gradient(180deg, #f5f9ff 0%, #ffffff 100%);
}
.status-spotlight-card-health {
  background: linear-gradient(180deg, #f4fcf8 0%, #ffffff 100%);
}
.status-spotlight-card-memory {
  background: linear-gradient(180deg, #fffaf2 0%, #ffffff 100%);
}
.status-spotlight-card-jobs {
  background: linear-gradient(180deg, #f8f9fd 0%, #ffffff 100%);
}
.status-dashboard-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.status-panel {
  padding: 22px;
}
.status-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.status-kpi-card {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid rgba(41, 68, 123, 0.08);
  display: grid;
  gap: 8px;
}
.status-kpi-card span {
  color: var(--muted);
  font-size: 13px;
}
.status-kpi-card strong {
  font-size: 24px;
}
.status-provider-list,
.status-job-list,
.status-session-list {
  display: grid;
  gap: 12px;
}
.status-provider-card,
.status-job-card,
.status-session-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(41, 68, 123, 0.08);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  display: grid;
  gap: 10px;
}
.status-provider-meta,
.status-job-card .module-snippet,
.status-session-card .module-snippet {
  color: #44526a;
  line-height: 1.7;
}
.status-provider-meta {
  display: grid;
  gap: 6px;
}
.status-badge-ok {
  background: rgba(19, 122, 67, 0.12);
  color: #137a43;
}
.status-badge-muted {
  background: rgba(113, 121, 137, 0.12);
  color: #5d6677;
}
.status-job-card-running {
  background: linear-gradient(180deg, #f3f8ff 0%, #ffffff 100%);
}
.status-job-card-failed {
  background: linear-gradient(180deg, #fff4f4 0%, #ffffff 100%);
}
.status-job-card-completed {
  background: linear-gradient(180deg, #f4fcf8 0%, #ffffff 100%);
}
.status-inline-error {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(239, 90, 97, 0.1);
  color: #b5323a;
  line-height: 1.6;
}

.storyboard-hero {
  padding: 28px 30px;
  border-radius: 30px;
  background:
    radial-gradient(circle at top left, rgba(219, 124, 31, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(31, 111, 235, 0.14), transparent 26%),
    linear-gradient(135deg, #fff8ef 0%, #f7fbff 54%, #ffffff 100%);
  border: 1px solid rgba(41, 68, 123, 0.1);
  box-shadow: 0 26px 60px rgba(15, 23, 42, 0.08);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.storyboard-hero-copy {
  max-width: 920px;
}
.storyboard-hero h1 {
  margin: 10px 0 0;
  font-size: clamp(30px, 3.3vw, 44px);
  line-height: 1.08;
}
.storyboard-hero p {
  margin-top: 14px;
  color: #56657d;
  line-height: 1.9;
  font-size: 16px;
}
.storyboard-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.storyboard-spotlight-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.storyboard-spotlight-card {
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(41, 68, 123, 0.08);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.06);
  display: grid;
  gap: 10px;
}
.storyboard-spotlight-card span,
.storyboard-spotlight-card small {
  color: var(--muted);
}
.storyboard-spotlight-card strong {
  font-size: 26px;
  line-height: 1.18;
}
.storyboard-spotlight-card p {
  margin: 0;
  color: #43516a;
  line-height: 1.75;
  font-size: 14px;
}
.storyboard-spotlight-card-outline {
  background: linear-gradient(180deg, #fffaf2 0%, #ffffff 100%);
}
.storyboard-spotlight-card-beats {
  background: linear-gradient(180deg, #f7fbff 0%, #ffffff 100%);
}
.storyboard-spotlight-card-chapters {
  background: linear-gradient(180deg, #f4fcf8 0%, #ffffff 100%);
}
.storyboard-spotlight-card-brief {
  background: linear-gradient(180deg, #f9f8fd 0%, #ffffff 100%);
}
.storyboard-board-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) 380px;
  gap: 18px;
  align-items: start;
}
.storyboard-main-panel,
.storyboard-side-panel,
.storyboard-chapter-card,
.storyboard-memory-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(249,250,253,0.98) 100%);
  border: 1px solid rgba(41, 68, 123, 0.08);
}
.storyboard-side-column {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 24px;
}
.storyboard-outline-stack,
.storyboard-beat-list,
.storyboard-guide-list {
  display: grid;
  gap: 14px;
}
.storyboard-outline-card {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(41, 68, 123, 0.08);
  display: grid;
  gap: 10px;
}
.storyboard-outline-card-global {
  background:
    radial-gradient(circle at top right, rgba(219, 124, 31, 0.12), transparent 24%),
    linear-gradient(180deg, #fffaf1 0%, #ffffff 100%);
}
.storyboard-outline-card-chapter {
  background:
    radial-gradient(circle at top right, rgba(31, 111, 235, 0.1), transparent 24%),
    linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}
.storyboard-outline-head,
.storyboard-chapter-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}
.storyboard-outline-chip {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(18, 24, 39, 0.05);
  color: #7a5b3b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.storyboard-outline-card h4,
.storyboard-chapter-card h4 {
  margin: 10px 0 0;
  font-size: 22px;
  line-height: 1.28;
}
.storyboard-outline-meta {
  font-size: 13px;
}
.storyboard-outline-summary,
.storyboard-chapter-summary,
.storyboard-beat-summary {
  color: #33415d;
  line-height: 1.85;
  font-size: 15px;
}
.storyboard-expand {
  border-top: 1px solid rgba(41, 68, 123, 0.08);
  padding-top: 10px;
}
.storyboard-expand summary {
  cursor: pointer;
  color: #6a7488;
  font-size: 13px;
  font-weight: 700;
}
.storyboard-outline-detail {
  margin-top: 10px;
  white-space: pre-wrap;
  color: #3c475d;
  line-height: 1.85;
  font-size: 14px;
}
.storyboard-beat-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(41, 68, 123, 0.08);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 14px;
}
.storyboard-beat-index {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1f6feb 0%, #4a8dff 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
}
.storyboard-beat-copy {
  display: grid;
  gap: 8px;
}
.storyboard-beat-copy strong {
  font-size: 18px;
  line-height: 1.3;
}
.storyboard-side-panel-guide {
  background: linear-gradient(180deg, #fffaf1 0%, #ffffff 100%);
}
.storyboard-guide-step {
  padding: 14px 14px 12px;
  border-radius: 16px;
  border: 1px solid rgba(41, 68, 123, 0.08);
  background: rgba(255,255,255,0.92);
  display: grid;
  gap: 8px;
}
.storyboard-guide-step span {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 800;
  color: #7a5b3b;
}
.storyboard-guide-step strong {
  font-size: 17px;
}
.storyboard-guide-step p {
  margin: 0;
  color: #49576d;
  line-height: 1.75;
}
.storyboard-chapter-shell {
  margin-top: 18px;
  display: grid;
  gap: 16px;
}
.storyboard-chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.storyboard-chapter-card {
  padding: 18px;
  border-radius: 20px;
  display: grid;
  gap: 12px;
}
.storyboard-memory-panel {
  margin-top: 18px;
  padding: 22px;
}
.storyboard-memory-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.storyboard-memory-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #e6ebf2;
  background: #f8fafc;
  display: grid;
  gap: 6px;
}
.storyboard-memory-card.is-active {
  border-color: rgba(31, 111, 235, 0.16);
  background: linear-gradient(180deg, #f7fbff 0%, #ffffff 100%);
}
.storyboard-memory-card code {
  font-size: 12px;
  color: #66758d;
}
.storyboard-memory-card strong {
  font-size: 24px;
}

@media (max-width: 1280px) {
  .workspace-head,
  .workspace-overview-shell,
  .workspace-support-grid,
  .workspace-switchboard,
  .storyboard-spotlight-grid,
  .storyboard-board-grid,
  .storyboard-chapter-grid,
  .storyboard-memory-grid,
  .memory-command-grid,
  .manuscript-intel-grid,
  .manuscript-studio-grid,
  .manuscript-edit-grid,
  .memory-studio-grid,
  .memory-taxonomy-grid,
  .status-spotlight-grid,
  .status-dashboard-grid,
  .status-kpi-grid {
    grid-template-columns: 1fr;
  }
  .manuscript-rail-panel,
  .manuscript-side-panel,
  .memory-groups-panel,
  .storyboard-side-column {
    position: static;
  }
}

.status-card-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.status-metric-card { padding: 20px; min-height: 118px; display: grid; align-content: center; gap: 10px; }
.status-metric-card span { color: var(--muted); font-size: 14px; }
.status-metric-card strong { font-size: 22px; }
.status-metric-card.ok { background: linear-gradient(180deg, #fff 0%, #f5fff8 100%); }

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 12% 10%, rgba(31, 111, 235, 0.14), transparent 24%),
    radial-gradient(circle at 88% 8%, rgba(74, 141, 255, 0.12), transparent 22%),
    linear-gradient(180deg, #f6f9ff 0%, #eef3fb 48%, #f5f7fb 100%);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: rgba(255,255,255,0.82);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.container {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}
.topbar-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
}
.brand::before {
  content: "MA";
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-2) 100%);
  box-shadow: 0 8px 18px rgba(31, 111, 235, 0.24);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.user-email {
  color: var(--muted);
  font-size: 14px;
}
.page-shell {
  padding: 28px 0 40px;
}
.hero {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px 26px;
  margin-bottom: 18px;
}
.hero h1 {
  margin: 0 0 12px;
  font-size: 32px;
}
.hero p {
  margin: 0;
  line-height: 1.75;
}
.grid.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}
.key-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.key-form {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid #e6ebf3;
  border-radius: 16px;
  background: #fbfdff;
}
.key-form h3 {
  margin: 0;
}
.key-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.table-wrap {
  overflow-x: auto;
}
.sep-line {
  border: 0;
  border-top: 1px solid #e8edf4;
  margin: 20px 0;
}
.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #d7deea;
  background: #fff;
  color: #273246;
  font-weight: 700;
}
.link-btn:hover {
  background: #f6f9ff;
  border-color: #c4d0e3;
}

.hero.compact, .card {
  background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px 22px;
}
.hero.compact { margin-bottom: 18px; }
.hero.compact h1 { margin: 0 0 12px; }
.card { margin-bottom: 18px; }
.card h2 { margin: 0 0 12px; font-size: 20px; }
.job-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 18px; align-items: start; }
.job-stack { display: grid; gap: 18px; }
.job-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.job-kpi { border: 1px solid #edf0f3; border-radius: 14px; padding: 16px; background: #fbfcfe; }
.job-kpi-label { color: var(--muted); font-size: 13px; font-weight: 700; }
.job-kpi-value { margin-top: 8px; font-size: 24px; font-weight: 800; }
.idea-block, .output-box {
  border: 1px solid #e7ebf1; border-radius: 14px; background: #f8fafc; padding: 14px 16px; line-height: 1.8; white-space: pre-wrap; word-break: break-word;
}
.progress-track { height: 12px; border-radius: 999px; background: #edf1f6; overflow: hidden; margin-top: 14px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--purple) 0%, var(--purple-2) 100%); }
.log-box, .error-block, .chapter-box {
  background: #0f172a; color: #e5eefc; border-radius: 14px; padding: 14px 16px; overflow: auto; white-space: pre-wrap; word-break: break-word; line-height: 1.7;
}
.log-box { min-height: 140px; max-height: 360px; }
.chapter-item { border: 1px solid #e8ebef; border-radius: 14px; padding: 16px; background: #fff; margin-bottom: 14px; }
.chapter-item h3 { margin: 0 0 8px; }
.chapter-box { margin-top: 12px; max-height: 360px; }
.trace-list { display: grid; gap: 10px; }
.trace-item { border: 1px solid #e8ebef; border-radius: 12px; padding: 12px 14px; background: #fff; }
.trace-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 8px; }
.trace-event { font-weight: 800; }
.trace-time { color: var(--muted); font-size: 12px; }
.trace-detail { color: #3a4458; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.trace-item.claw { border-color: rgba(93, 76, 255, 0.28); background: rgba(93, 76, 255, 0.05); }
.trace-item.claw .trace-event { color: var(--purple); }
.trace-item.generic { background: #fff; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.inline-form { display: inline-flex; }
.form-stack { display: grid; gap: 12px; }

.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 12%, rgba(44, 124, 255, 0.18), transparent 24%),
    radial-gradient(circle at 90% 14%, rgba(255, 170, 68, 0.18), transparent 22%),
    radial-gradient(circle at 50% 100%, rgba(28, 179, 152, 0.12), transparent 28%),
    linear-gradient(180deg, #f3f7ff 0%, #fffaf2 52%, #f4f8ff 100%);
}
.auth-shell {
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 42px;
  display: grid;
  gap: 22px;
}
.auth-shell.auth-shell-claw {
  --auth-accent: #0f8b7f;
  --auth-accent-2: #126d97;
  --auth-accent-soft: rgba(15, 139, 127, 0.12);
}
.auth-shell.auth-shell-multiagent {
  --auth-accent: #3159df;
  --auth-accent-2: #7f52d9;
  --auth-accent-soft: rgba(49, 89, 223, 0.12);
}
.auth-topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 14px 18px;
  border-radius: 24px;
  border: 1px solid rgba(77, 98, 136, 0.12);
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px rgba(22, 32, 68, 0.08);
}
.auth-brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.auth-brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--auth-accent) 0%, var(--auth-accent-2) 100%);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 18px 34px color-mix(in srgb, var(--auth-accent) 28%, transparent);
}
.auth-brand-copy {
  display: grid;
  gap: 4px;
}
.auth-brand-copy strong {
  font-size: 18px;
  color: #16243b;
}
.auth-brand-copy span,
.auth-topbar-note {
  color: #607087;
  font-size: 13px;
  line-height: 1.6;
}
.auth-topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.auth-lang-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid rgba(77, 98, 136, 0.12);
  background: rgba(243, 247, 255, 0.86);
}
.auth-lang-switch form { margin: 0; }
.auth-lang-btn {
  min-width: 70px;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: transparent;
  color: #67768a;
  font-weight: 800;
  cursor: pointer;
}
.auth-lang-btn.is-active {
  background: linear-gradient(135deg, var(--auth-accent) 0%, var(--auth-accent-2) 100%);
  color: #fff;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--auth-accent) 24%, transparent);
}
.auth-mode-stage {
  display: grid;
  grid-template-columns: minmax(0, 0.96fr) minmax(0, 1.04fr);
  gap: 18px;
  align-items: stretch;
}
.auth-mode-intro,
.auth-mode-grid {
  border-radius: 30px;
  border: 1px solid rgba(77, 98, 136, 0.12);
  background: rgba(255,255,255,0.74);
  backdrop-filter: blur(14px);
  box-shadow: 0 22px 48px rgba(22, 32, 68, 0.08);
}
.auth-mode-intro {
  padding: 28px 30px;
  background:
    radial-gradient(circle at top right, var(--auth-accent-soft), transparent 34%),
    rgba(255,255,255,0.78);
}
.auth-mode-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--auth-accent-soft);
  color: var(--auth-accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.auth-mode-intro h1 {
  margin: 16px 0 0;
  font-size: clamp(30px, 3vw, 46px);
  line-height: 1.04;
  color: #122035;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
.auth-mode-intro p {
  margin: 16px 0 0;
  color: #56647a;
  line-height: 1.9;
  font-size: 15px;
}
.auth-mode-grid {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.auth-mode-tab {
  min-height: 198px;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(87, 103, 137, 0.1);
  background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(246,249,255,0.94) 100%);
  display: grid;
  gap: 12px;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.auth-mode-tab:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(22, 32, 68, 0.1);
}
.auth-mode-tab.is-active {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--auth-accent) 42%, white);
  background:
    radial-gradient(circle at top right, var(--auth-accent-soft), transparent 38%),
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(244,248,255,0.98) 100%);
  box-shadow: 0 22px 46px color-mix(in srgb, var(--auth-accent) 20%, transparent);
}
.auth-mode-tab-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.auth-mode-tab-kicker {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4f5f79;
}
.auth-mode-tab-badge {
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(24, 37, 61, 0.06);
  color: #50617a;
  font-size: 11px;
  font-weight: 800;
}
.auth-mode-tab strong {
  font-size: 28px;
  line-height: 1.08;
  color: #16233a;
}
.auth-mode-tab p {
  margin: 0;
  color: #5e6e85;
  line-height: 1.75;
}
.auth-wrap {
  width: 100%;
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: 0;
}
.auth-hero,
.auth-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.auth-wrap-portal {
  overflow: hidden;
  border-radius: 34px;
  border: 1px solid rgba(77, 98, 136, 0.12);
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(14px);
  box-shadow: 0 34px 90px rgba(22, 32, 68, 0.14);
}
.auth-hero.auth-hero-portal,
.auth-card.auth-card-portal {
  min-height: 620px;
  border-radius: 0;
  box-shadow: none;
}
.auth-hero.auth-hero-portal {
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.12), transparent 36%),
    linear-gradient(155deg, #173763 0%, #1f5d92 42%, #0f8b7f 100%);
  color: #fff;
  display: grid;
  align-content: start;
  gap: 22px;
  padding: 40px 40px 42px;
}
.auth-hero.auth-hero-portal h2 {
  margin: 0;
  font-size: clamp(34px, 3vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.04em;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
.auth-hero.auth-hero-portal p {
  margin: 0;
  color: rgba(255,255,255,0.92);
  line-height: 1.82;
}
.auth-hero-copy {
  max-width: 540px;
  font-size: 15px;
}
.auth-hero-badge {
  display: inline-flex;
  width: fit-content;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.16);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.auth-hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.auth-hero-metric {
  padding: 18px 16px;
  border-radius: 22px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.16);
  display: grid;
  gap: 8px;
}
.auth-hero-metric span {
  font-size: 12px;
  color: rgba(255,255,255,0.72);
}
.auth-hero-metric strong {
  font-size: 28px;
  line-height: 1;
}
.auth-hero-stack {
  display: grid;
  gap: 12px;
}
.auth-hero-pill {
  padding: 18px 18px;
  border-radius: 22px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.96);
  font-weight: 700;
  line-height: 1.72;
}
.auth-card.auth-card-portal {
  background:
    radial-gradient(circle at top right, var(--auth-accent-soft), transparent 28%),
    rgba(255,255,255,0.96);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 38px;
}
.auth-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.auth-card-kicker {
  color: var(--auth-accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.auth-card.auth-card-portal h1 {
  margin: 10px 0 0;
  font-size: 34px;
  line-height: 1.12;
  color: #182742;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
.auth-card-subtitle {
  margin: 12px 0 0;
  color: #6a778a;
  line-height: 1.7;
}
.auth-top-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 118px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--auth-accent-soft);
  border: 1px solid color-mix(in srgb, var(--auth-accent) 16%, white);
  color: var(--auth-accent);
  font-weight: 800;
  text-decoration: none;
}
.auth-form-row {
  display: grid;
  gap: 8px;
}
.auth-form-row label {
  color: #243549;
  font-weight: 700;
}
.auth-form-row input {
  height: 54px;
  border-radius: 18px;
  border: 1px solid #d8e3f1;
  background: #f4f8ff;
  color: #20324d;
  padding: 0 16px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.auth-form-row input:focus {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--auth-accent) 62%, white);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--auth-accent) 16%, transparent);
}
.auth-submit.btn.btn-primary {
  margin-top: 8px;
  min-height: 56px;
  border-radius: 18px;
  border: 0;
  background: linear-gradient(135deg, var(--auth-accent) 0%, var(--auth-accent-2) 100%);
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 18px 34px color-mix(in srgb, var(--auth-accent) 24%, transparent);
}
.auth-support-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.auth-support-card {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(77, 98, 136, 0.12);
  background: rgba(248, 250, 255, 0.92);
  display: grid;
  gap: 6px;
}
.auth-support-card span {
  font-size: 12px;
  color: #718095;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.auth-support-card strong {
  font-size: 20px;
  line-height: 1.2;
  color: #192742;
}
.auth-link-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.auth-link-row a,
.auth-footnote a,
.auth-top-link:hover {
  text-decoration: none;
}
.auth-link-row a {
  color: var(--auth-accent);
  font-weight: 800;
}
.auth-footnote { margin-top: 16px; color: var(--muted); }

@media (max-width: 1200px) {
  .chat-console-layout, .workspace-grid, .auth-wrap, .status-card-grid, .overview-grid, .job-grid, .job-kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid.two-col,
  .key-grid { grid-template-columns: 1fr; }
  .chat-focus-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manuscript-studio-grid, .memory-studio-grid { grid-template-columns: 1fr; }
  .memory-command-grid,
  .status-spotlight-grid,
  .status-dashboard-grid,
  .status-kpi-grid,
  .storyboard-spotlight-grid,
  .storyboard-chapter-grid,
  .storyboard-memory-grid { grid-template-columns: 1fr 1fr; }
  .auth-shell { width: min(1100px, calc(100% - 32px)); }
  .auth-mode-stage { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero.auth-hero-portal,
  .auth-card.auth-card-portal { min-height: auto; }
}
@media (max-width: 980px) {
  .console-shell { grid-template-columns: 1fr; }
  .console-sidebar { min-height: auto; }
  .chat-console-layout, .workspace-grid, .auth-wrap, .status-card-grid, .overview-grid, .job-grid, .job-kpi-grid { grid-template-columns: 1fr; }
  .container { width: min(100% - 24px, 1180px); }
  .topbar-inner,
  .user-menu { align-items: flex-start; }
  .topbar-inner { padding: 12px 0; flex-direction: column; }
  .hero { padding: 22px 20px; }
  .hero h1 { font-size: 26px; }
  .auth-shell { width: min(720px, calc(100% - 24px)); padding: 18px 0 28px; }
  .auth-topbar { padding: 16px; }
  .auth-topbar,
  .auth-topbar-actions,
  .auth-card-head { flex-direction: column; align-items: flex-start; }
  .auth-mode-grid { grid-template-columns: 1fr; }
  .auth-mode-intro,
  .auth-hero.auth-hero-portal,
  .auth-card.auth-card-portal { padding: 24px 20px; }
  .auth-wrap-portal { border-radius: 28px; }
  .auth-hero-metrics,
  .auth-support-grid { grid-template-columns: 1fr; }
  .auth-card-head { flex-direction: column; align-items: flex-start; }
  .chat-focus-stats { grid-template-columns: 1fr 1fr; }
  .chat-stage-full .chat-board { max-height: none; min-height: 420px; }
  .chat-focus-strip-head { flex-direction: column; }
  .session-pill { min-width: 200px; }
  .list-row-card, .task-row-card { flex-direction: column; align-items: flex-start; }
  .workspace-head { padding: 24px 20px; }
  .workspace-mode-switch { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .workspace-mode-card { padding: 18px; }
  .workspace-panel-banner { padding: 22px 18px; }
  .manuscript-paper { min-height: 520px; padding: 24px 20px; }
  .memory-bank-grid,
  .memory-command-grid,
  .memory-taxonomy-grid,
  .status-spotlight-grid,
  .status-dashboard-grid,
  .status-kpi-grid,
  .storyboard-spotlight-grid,
  .storyboard-board-grid,
  .storyboard-chapter-grid,
  .storyboard-memory-grid { grid-template-columns: 1fr; }
  .status-hero { padding: 24px 20px; }
  .storyboard-hero { padding: 24px 20px; }
}


.console-runtime-meta { margin-top: 10px; color: rgba(255,255,255,0.62); font-size: 12px; }
.vertical { display: grid !important; align-items: start !important; justify-content: stretch !important; }
.project-mini-title { font-size: 22px; font-weight: 800; line-height: 1.3; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.manuscript-overview-grid { grid-template-columns: repeat(5, minmax(0,1fr)); }
.manuscript-card { align-items: stretch !important; }
.manuscript-preview { max-height: 220px; overflow: auto; padding-right: 4px; }
.file-item.vertical, .list-row-card.vertical, .task-row-card.vertical { align-items: stretch; }
.file-item.vertical .row-meta, .list-row-card.vertical .row-meta, .task-row-card.vertical .row-meta { margin-top: 4px; }
@media (max-width: 1200px) {
  .manuscript-overview-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
  .manuscript-overview-grid { grid-template-columns: 1fr; }
}

.chat-input-form textarea { min-height: 96px; resize: vertical; }
.chat-input-form textarea:disabled, .chat-input-form button:disabled { opacity: 0.72; cursor: wait; }
.console-alert[hidden] { display: none; }
.chat-inline-status { margin-top: 12px; }
.session-mini-list { display: grid; gap: 10px; }
.session-mini-item { border: 1px solid #e6eaf2; border-radius: 14px; padding: 12px; background: #fff; }
.session-mini-item.active { border-color: var(--purple); background: #f6f4ff; }
.session-mini-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.session-mini-title { font-weight: 700; line-height: 1.5; }
.session-mini-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.current-session-meta { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.current-session-meta .overview-box strong { font-size: 20px; }
@media (max-width: 980px) { .current-session-meta { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .current-session-meta { grid-template-columns: 1fr; } }


.module-card-grid { display: grid; gap: 16px; }
.module-card-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.module-card-grid.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-stack { display: grid; gap: 14px; }
.module-card {
  border: 1px solid #e7ebf1; border-radius: 16px; background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
  padding: 16px 18px; display: grid; gap: 12px;
}
.module-card.is-live { border-color: rgba(101,88,245,0.35); box-shadow: 0 10px 24px rgba(101,88,245,0.08); }
.module-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.module-card-title { font-size: 17px; font-weight: 800; color: var(--text); }
.module-snippet {
  border: 1px solid #eef1f5; border-radius: 12px; background: #f8fafc; padding: 12px 14px;
  color: #3a4458; line-height: 1.8; white-space: pre-wrap; word-break: break-word;
}
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field-grid.single-row { grid-template-columns: 1fr; }
.field-row {
  display: grid; gap: 6px; padding: 12px 14px; border: 1px solid #edf0f3; border-radius: 12px; background: #fff;
}
.field-row span { color: var(--muted); font-size: 12px; font-weight: 700; }
.field-row strong { color: var(--text); line-height: 1.7; }
.details-panel {
  border-top: 1px solid #edf0f3; padding-top: 10px;
}
.details-panel summary {
  cursor: pointer; color: var(--purple); font-weight: 700; list-style: none;
}
.details-panel summary::-webkit-details-marker { display: none; }
.timeline-card { position: relative; overflow: hidden; }
.timeline-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--purple) 0%, var(--purple-2) 100%);
}
.timeline-card { padding-left: 18px; }
.workspace-notes.compact { margin: 0; }
.character-card .pill { background: #f4f2ff; }
@media (max-width: 1200px) {
  .module-card-grid.two-col, .module-card-grid.three-col { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
  .module-card-grid.two-col, .module-card-grid.three-col, .field-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   OpenClaw Trace — step-by-step agent action stream
   ========================================================= */
.trace-list { display: grid; gap: 8px; }
.trace-empty { color: var(--muted); font-size: 13px; padding: 10px 0; }

.trace-item {
  border-radius: 12px;
  padding: 10px 14px;
  border-left: 3px solid #d0d5dd;
  background: #f9fafb;
  font-size: 13px;
  display: grid;
  gap: 4px;
}
.trace-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.trace-title { font-weight: 700; color: var(--text); }
.trace-stamp { color: var(--muted); font-size: 11px; white-space: nowrap; }
.trace-body { color: #4a5568; line-height: 1.6; word-break: break-word; }

/* Kind-based accent colours */
.trace-loop-start { border-left-color: var(--purple); background: #f5f3ff; }
.trace-loop-start .trace-title { color: var(--purple); }
.trace-decision { border-left-color: #3b82f6; background: #eff6ff; }
.trace-result { border-left-color: #10b981; background: #f0fdf4; }
.trace-write { border-left-color: #8b5cf6; background: #faf5ff; }
.trace-quality { border-left-color: #f59e0b; background: #fffbeb; }
.trace-ask { border-left-color: #ef4444; background: #fef2f2; }
.trace-reply { border-left-color: #06b6d4; background: #ecfeff; }
.trace-finalize { border-left-color: #22c55e; background: #f0fdf4; }
.trace-complete { border-left-color: #22c55e; background: #f0fdf4; }
.trace-outline, .trace-plan { border-left-color: #64748b; background: #f8fafc; }

/* =========================================================
   OpenClaw ask_user — agent question card
   ========================================================= */
.agent-question-card {
  border: 2px solid #ef4444;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
  padding: 18px 20px;
  display: grid;
  gap: 14px;
  animation: pulse-border 2s ease-in-out infinite;
}
@keyframes pulse-border {
  0%, 100% { border-color: #ef4444; box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  50%        { border-color: #dc2626; box-shadow: 0 0 0 6px rgba(239,68,68,0.12); }
}
.agent-question-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 14px;
  color: #dc2626;
}
.agent-question-icon { font-size: 22px; }
.agent-question-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  font-weight: 600;
}
.agent-question-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}
.agent-question-textarea {
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 10px 14px;
  resize: vertical;
  background: #fff;
  color: var(--text);
  line-height: 1.6;
}
.agent-question-textarea:focus {
  outline: none;
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.12);
}
.agent-question-status {
  font-size: 13px;
  color: #16a34a;
  font-weight: 600;
}

/* =========================================================
   Skills / Agents page improvements
   ========================================================= */
.skill-icon { font-size: 20px; }
.skill-badge-claw { background: rgba(101,88,245,0.12); color: var(--purple); border-radius: 8px; padding: 3px 8px; font-size: 11px; font-weight: 700; }
.skill-badge-core { background: rgba(34,197,94,0.12); color: #15803d; border-radius: 8px; padding: 3px 8px; font-size: 11px; font-weight: 700; }
.skill-badge-support { background: rgba(100,116,139,0.10); color: #475569; border-radius: 8px; padding: 3px 8px; font-size: 11px; font-weight: 700; }

/* Agent live badge */
.agent-live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  margin-right: 6px;
  vertical-align: middle;
}
.agent-idle-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  margin-right: 6px;
  vertical-align: middle;
}

/* MCP connector card */
.connector-card {
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  padding: 14px 16px;
  background: #f8fafc;
  display: grid;
  gap: 8px;
}
.connector-card-title { font-weight: 700; font-size: 15px; }
.connector-status-future { color: #94a3b8; font-size: 12px; font-weight: 700; }
.connector-status-live { color: #22c55e; font-size: 12px; font-weight: 700; }

/* =========================================================
   OpenClaw Real Agent UI — Tool-Call Cards
   Based on shadcn/ui AI, Open-WebUI, LangSmith patterns
   ========================================================= */

/* Shimmer animation for in-progress states */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.shimmer {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
  display: inline-block;
}

/* Tool-call card — one card per tool invocation */
.tool-call-card {
  border: 1px solid #e4e8ef;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  font-size: 13px;
  transition: box-shadow 0.2s;
}
.tool-call-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,0.07); }

.tool-call-card.tc-running {
  border-color: rgba(101,88,245,0.35);
  box-shadow: 0 0 0 3px rgba(101,88,245,0.08);
}
.tool-call-card.tc-complete { border-color: rgba(34,197,94,0.3); }
.tool-call-card.tc-error    { border-color: rgba(239,68,68,0.3); }
.tool-call-card.tc-ask      { border-color: rgba(239,68,68,0.5); animation: pulse-border 2s ease-in-out infinite; }

/* Card header row */
.tool-call-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  background: #fafbfc;
  border-bottom: 1px solid transparent;
}
.tool-call-card.tc-running .tool-call-header { background: #f5f3ff; border-bottom-color: rgba(101,88,245,0.1); }
.tool-call-card.tc-complete .tool-call-header { background: #f0fdf4; border-bottom-color: rgba(34,197,94,0.1); }
.tool-call-card.tc-ask .tool-call-header { background: #fef2f2; border-bottom-color: rgba(239,68,68,0.15); }

.tool-call-icon { font-size: 18px; flex-shrink: 0; }
.tool-call-name { font-weight: 800; color: var(--text); flex: 1; }
.tool-call-step { font-size: 11px; color: var(--muted); }

/* Status badge */
.tc-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.tc-badge-running  { background: rgba(101,88,245,0.12); color: #6558f5; }
.tc-badge-complete { background: rgba(34,197,94,0.12); color: #15803d; }
.tc-badge-pending  { background: #f1f5f9; color: #64748b; }
.tc-badge-error    { background: rgba(239,68,68,0.12); color: #dc2626; }

/* Chevron toggle */
.tc-chevron {
  color: var(--muted);
  font-size: 11px;
  transition: transform 0.18s;
  flex-shrink: 0;
}
.tool-call-card[open] .tc-chevron,
.tool-call-card.tc-open .tc-chevron { transform: rotate(90deg); }

/* Card body — params / result */
.tool-call-body {
  padding: 12px 14px;
  display: none;
  border-top: 1px solid #edf0f3;
}
.tool-call-card.tc-open .tool-call-body { display: block; }

.tc-params-label, .tc-result-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}
.tc-result-label { margin-top: 10px; }

.tc-params-block, .tc-result-block {
  background: #f8fafc;
  border: 1px solid #edf0f3;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  color: #374151;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
}
.tc-result-block.tc-ok   { background: #f0fdf4; border-color: rgba(34,197,94,0.2); }
.tc-result-block.tc-fail { background: #fef2f2; border-color: rgba(239,68,68,0.2); }

/* Running spinner line */
.tc-spinner-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 12px;
  color: #6558f5;
  font-weight: 600;
  background: linear-gradient(90deg, rgba(101,88,245,0.04) 0%, rgba(101,88,245,0.08) 50%, rgba(101,88,245,0.04) 100%);
  background-size: 200% 100%;
  animation: shimmer-purple 1.8s infinite;
}
@keyframes shimmer-purple {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.tc-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(101,88,245,0.2);
  border-top-color: #6558f5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Loop-start banner */
.claw-loop-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6558f5 0%, #7668ff 100%);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.claw-loop-banner-icon { font-size: 22px; }
.claw-loop-banner-meta { font-size: 12px; opacity: 0.82; font-weight: 500; margin-top: 2px; }

/* Finalize / complete banner */
.claw-complete-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

/* Status pill between tool cards */
.tc-status-pill {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 2px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.tc-status-pill::before,
.tc-status-pill::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e4e8ef;
}

/* =========================================================
   Between-chapter checkpoint card
   ========================================================= */
.chapter-checkpoint-card {
  border: 2px solid #6558f5;
  border-radius: 18px;
  background: linear-gradient(135deg, #faf8ff 0%, #f0edff 100%);
  padding: 20px 22px;
  display: grid;
  gap: 14px;
  animation: pulse-border-purple 2.5s ease-in-out infinite;
}
@keyframes pulse-border-purple {
  0%, 100% { border-color: #6558f5; box-shadow: 0 0 0 0 rgba(101,88,245,0); }
  50%       { border-color: #7668ff; box-shadow: 0 0 0 8px rgba(101,88,245,0.1); }
}

.chapter-checkpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chapter-checkpoint-icon { font-size: 28px; }
.chapter-checkpoint-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--purple);
}
.chapter-checkpoint-subtitle {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

.chapter-checkpoint-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.checkpoint-chip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(101,88,245,0.25);
  background: rgba(101,88,245,0.07);
  color: #6558f5;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.checkpoint-chip:hover { background: rgba(101,88,245,0.15); }

.chapter-checkpoint-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}
.chapter-checkpoint-memory-box {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.62);
  border: 1px solid rgba(101,88,245,0.14);
}
.chapter-checkpoint-memory-row {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: 10px;
  align-items: start;
}
.chapter-checkpoint-memory-list {
  display: grid;
  gap: 8px;
}
.checkpoint-memory-pill {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(101,88,245,0.08);
  color: #403673;
  font-size: 12px;
}
.checkpoint-memory-pill span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.checkpoint-memory-remove {
  border: 0;
  background: transparent;
  color: #6558f5;
  cursor: pointer;
  font-weight: 800;
}
.chapter-checkpoint-textarea {
  border: 1px solid rgba(101,88,245,0.3);
  border-radius: 12px;
  padding: 10px 14px;
  resize: vertical;
  background: #fff;
  color: var(--text);
  line-height: 1.6;
  min-height: 72px;
}
.chapter-checkpoint-textarea:focus {
  outline: none;
  border-color: #6558f5;
  box-shadow: 0 0 0 3px rgba(101,88,245,0.12);
}
.chapter-checkpoint-status {
  font-size: 12px;
  font-weight: 600;
  color: #16a34a;
}
.chapter-checkpoint-skip {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  cursor: pointer;
}
.chapter-checkpoint-skip:hover { color: var(--text); }
@media (max-width: 980px) {
  .chapter-checkpoint-memory-row { grid-template-columns: 1fr; }
  .claw-progress-fallback-grid { grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   Claw Execution Timeline — grouped chat block
   All tool calls appear inside ONE assistant row
   ========================================================= */

/* Body of the grouped execution row */
.claw-timeline-body {
  display: grid;
  gap: 8px;
  padding-top: 4px;
  min-width: 0;
}

/* Waiting placeholder */
.claw-exec-waiting {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
  font-style: italic;
}
.claw-progress-fallback {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f7fbff 0%, #ffffff 100%);
  border: 1px solid rgba(31, 111, 235, 0.12);
}
.claw-progress-fallback.is-stalled {
  background: linear-gradient(180deg, #fff7f7 0%, #ffffff 100%);
  border-color: rgba(239, 68, 68, 0.18);
}
.claw-progress-fallback-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.claw-progress-fallback-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.claw-progress-metric {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(41, 68, 123, 0.08);
  display: grid;
  gap: 6px;
}
.claw-progress-metric span,
.claw-progress-fallback-meta {
  color: var(--muted);
  font-size: 12px;
}
.claw-progress-metric strong {
  font-size: 18px;
  color: #15213a;
}
.claw-progress-track {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e8eef8;
}
.claw-progress-track-fill {
  height: 100%;
  background: linear-gradient(90deg, #1f6feb 0%, #4a8dff 100%);
}
.claw-progress-fallback-note {
  color: #42516a;
  line-height: 1.7;
}
.claw-exec-error {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff1f2;
  border: 1px solid rgba(239, 68, 68, 0.22);
  color: #991b1b;
  font-size: 13px;
  line-height: 1.65;
}
.claw-exec-error-body {
  white-space: pre-wrap;
  word-break: break-word;
  color: #7f1d1d;
}

/* Full timeline wrapper */
.claw-execution-timeline {
  display: grid;
  gap: 8px;
}

/* Loop-start mini banner */
.claw-loop-banner-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6558f5 0%, #7668ff 100%);
  color: #fff;
}
.claw-loop-mini-icon { font-size: 18px; flex-shrink: 0; }
.claw-loop-mini-title { font-weight: 700; font-size: 13px; }
.claw-loop-mini-meta { font-size: 11px; opacity: 0.82; font-weight: 500; margin-top: 2px; word-break: break-all; }

/* Complete mini banner */
.claw-complete-banner-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
}
.claw-complete-mini-title { font-weight: 700; font-size: 13px; }
.claw-complete-mini-body { font-size: 11px; opacity: 0.85; margin-top: 2px; }

/* Status / event pill rows */
.claw-status-pill-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 2px;
}
.claw-status-pill-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  margin-top: 5px;
}
.claw-status-pill-body {
  color: var(--muted);
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 360px;
  display: inline-block;
}

/* =========================================================
   Manuscript Studio — word count chip + chapter rail bars
   ========================================================= */
.manuscript-word-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

/* Chapter rail row head (kicker + word count) */
.chapter-rail-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.chapter-rail-len-chip {
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

/* Relative chapter length bar */
.chapter-rail-bar {
  height: 3px;
  border-radius: 999px;
  background: #edf1f6;
  overflow: hidden;
  margin-top: 4px;
}
.chapter-rail-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple) 0%, var(--purple-2) 100%);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* =========================================================
   Memory Studio — group dots, count bars, kind badges
   ========================================================= */

/* Group card inner layout: dot + content */
.memory-group-card-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

/* Color dot for each memory group */
.memory-group-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

/* Count pill inside group card */
.memory-group-count-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

/* Bank entry count bar */
.memory-bank-count-bar {
  height: 4px;
  border-radius: 999px;
  background: #edf1f6;
  overflow: hidden;
  margin: 6px 0;
}
.memory-bank-count-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
  opacity: 0.7;
}

/* Memory kind badge — base */
.memory-kind-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
}

/* Kind-specific colors */
.mkind-chapter   { background: #eff6ff; color: #2563eb; }
.mkind-scene     { background: #f0fdf4; color: #15803d; }
.mkind-entity    { background: #f5f3ff; color: #7c3aed; }
.mkind-relation  { background: #fff7ed; color: #ea580c; }
.mkind-world     { background: #fffbeb; color: #d97706; }
.mkind-fact      { background: #fef2f2; color: #dc2626; }
.mkind-revision  { background: #f8fafc; color: #475569; }
.mkind-work      { background: #ecfeff; color: #0891b2; }
.mkind-note      { background: #faf5ff; color: #7c3aed; }
.mkind-manual    { background: #f0fdf4; color: #15803d; }
.mkind-default   { background: #f1f5f9; color: #64748b; }

/* Small chip for chapter number / source in entry list */
.memory-entry-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
}

/* ================================================================
   ENV SETTINGS PAGE
   ================================================================ */

/* Page-level grid: 2 columns on wide screens, 1 on narrow */
.env-settings-form { display: contents; }
.env-page-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
  padding: 0 32px 24px;
}
@media (max-width: 960px) {
  .env-page-grid { grid-template-columns: 1fr; padding: 0 16px 24px; }
}

/* Base section card */
.env-section {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(16,23,42,0.06);
  border-left: 4px solid transparent;
}

/* Section header */
.env-section-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.env-section-head--clickable {
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.env-section-head--clickable::-webkit-details-marker { display: none; }
.env-section-expand-hint {
  margin-left: auto;
  color: #94a3b8;
  font-size: 13px;
  transition: transform 0.2s;
}
details[open] .env-section-expand-hint { transform: rotate(90deg); }

.env-section-icon {
  font-size: 22px;
  line-height: 1;
  margin-top: 2px;
  flex-shrink: 0;
}
.env-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #151b2f;
  line-height: 1.3;
}
.env-section-sub {
  font-size: 12px;
  color: #7a7f92;
  margin-top: 2px;
  line-height: 1.4;
}

/* ---- Claw Engine — purple ---- */
.env-section-claw { border-left-color: #6558f5; }
.env-section-claw .env-section-head { background: linear-gradient(90deg,#f5f3ff 0%,#fff 100%); }
.env-section-claw .env-range { accent-color: #6558f5; }

/* ---- Chapter Writing — blue ---- */
.env-section-chapter { border-left-color: #3b82f6; }
.env-section-chapter .env-section-head { background: linear-gradient(90deg,#eff6ff 0%,#fff 100%); }
.env-section-chapter .env-range { accent-color: #3b82f6; }

/* ---- Performance — amber ---- */
.env-section-perf { border-left-color: #f59e0b; }
.env-section-perf .env-section-head { background: linear-gradient(90deg,#fffbeb 0%,#fff 100%); }
.env-section-perf .env-toggle-track { background: #fde68a; }
.env-section-perf input[type=checkbox]:checked + .env-toggle-track { background: #f59e0b; }

/* ---- LLM — green ---- */
.env-section-llm { border-left-color: #10b981; }
.env-section-llm .env-section-head { background: linear-gradient(90deg,#ecfdf5 0%,#fff 100%); }
.env-section-llm .env-range { accent-color: #10b981; }

/* ---- Memory — slate ---- */
.env-section-memory { border-left-color: #64748b; }
.env-section-memory .env-section-head { background: linear-gradient(90deg,#f8fafc 0%,#fff 100%); }

/* ---- Debug — red ---- */
.env-section-debug { border-left-color: #ef4444; grid-column: 1 / -1; }
.env-section-debug .env-section-head { background: linear-gradient(90deg,#fef2f2 0%,#fff 100%); }
.env-debug-warn {
  margin: 12px 20px 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
}

/* Field grid inside each section */
.env-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px 20px 20px;
}
.env-field-grid--narrow {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 600px) {
  .env-field-grid, .env-field-grid--narrow { grid-template-columns: 1fr; }
}

/* Individual field */
.env-field { display: flex; flex-direction: column; gap: 6px; }
.env-field-toggle { gap: 8px; }

.env-label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.env-label-badge {
  font-size: 10px;
  font-weight: 700;
  font-family: "Fira Mono", monospace;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #64748b;
  letter-spacing: 0.3px;
}

.env-input {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #151b2f;
  background: #f8fafc;
  transition: border-color 0.15s;
}
.env-input:focus { outline: none; border-color: #6558f5; background: #fff; }

.env-select {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #151b2f;
  background: #f8fafc;
  appearance: auto;
}
.env-select:focus { outline: none; border-color: #6558f5; }

.env-hint {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.5;
}

/* Slider row */
.env-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.env-range {
  flex: 1;
  height: 4px;
  cursor: pointer;
  accent-color: #6558f5;
}
.env-range-val {
  font-size: 13px;
  font-weight: 700;
  font-family: "Fira Mono", monospace;
  color: #374151;
  min-width: 36px;
  text-align: right;
}

/* Toggle switch */
.env-toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.env-toggle-checkbox { display: none; }
.env-toggle-track {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: #e2e8f0;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.env-toggle-checkbox:checked + .env-toggle-track { background: #6558f5; }
.env-section-perf .env-toggle-checkbox:checked + .env-toggle-track { background: #f59e0b; }
.env-section-llm .env-toggle-checkbox:checked + .env-toggle-track { background: #10b981; }
.env-section-memory .env-toggle-checkbox:checked + .env-toggle-track { background: #64748b; }
.env-section-debug .env-toggle-checkbox:checked + .env-toggle-track { background: #ef4444; }
.env-toggle-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: left 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.env-toggle-checkbox:checked + .env-toggle-track .env-toggle-thumb { left: 21px; }
.env-toggle-label {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

/* Info box (memory section explanation) */
.env-info-box {
  margin: 0 20px;
  padding: 12px 14px;
  border-radius: 10px;
  display: flex;
  gap: 10px;
  font-size: 12px;
  line-height: 1.6;
  color: #475569;
}
.env-info-box--slate {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.env-info-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.env-info-body strong { display: block; font-size: 12px; font-weight: 700; color: #334155; margin-bottom: 4px; }

/* Details/summary for debug section */
.env-details { padding: 0; }
.env-details > summary { display: flex; }

/* Save bar */
.env-save-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 32px 32px;
}
.env-save-btn { min-width: 160px; }
.env-save-hint {
  font-size: 12px;
  color: #94a3b8;
}

/* =========================================================
   Console sidebar + chat workspace refresh
   ========================================================= */
.console-sidebar-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.console-sidebar-head .console-brand {
  flex: 1;
  min-width: 0;
}
.sidebar-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  cursor: pointer;
  flex: 0 0 auto;
}
body.sidebar-collapsed .console-shell { grid-template-columns: 72px 1fr; }
body.sidebar-collapsed .console-sidebar { padding-left: 10px; padding-right: 10px; }
body.sidebar-collapsed .console-sidebar-head {
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
body.sidebar-collapsed .console-nav-group,
body.sidebar-collapsed .console-sidebar-footer { padding-left: 6px; padding-right: 6px; }
body.sidebar-collapsed .console-brand {
  flex: 0 0 auto;
  justify-content: center;
  width: 40px;
  padding-left: 0;
  padding-right: 0;
  border-radius: 18px;
}
body.sidebar-collapsed .console-sidebar-head .console-brand {
  min-width: 40px;
}
body.sidebar-collapsed .sidebar-toggle {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}
body.sidebar-collapsed .console-brand > div:last-child,
body.sidebar-collapsed .console-nav-label,
body.sidebar-collapsed .console-nav-subhead,
body.sidebar-collapsed .console-nav-item > span:not(.console-nav-icon),
body.sidebar-collapsed .console-nav-copy,
body.sidebar-collapsed .console-runtime-meta,
body.sidebar-collapsed .console-runtime-card span:last-child,
body.sidebar-collapsed .console-lang-switch { display: none; }
body.sidebar-collapsed .console-nav-item,
body.sidebar-collapsed .console-runtime-card { justify-content: center; }
body.sidebar-collapsed .console-nav-item-split { align-items: center; }
body.sidebar-collapsed .console-nav-icon { width: auto; }

.chat-stage-full { max-width: 1440px; }
.chat-workspace-shell {
  display: grid;
  gap: 14px;
  min-height: calc(100vh - 96px);
}
.chat-focus-strip--slim {
  padding: 14px 16px;
  gap: 12px;
}
.chat-focus-strip--slim .console-card-title { margin-bottom: 6px; }
.chat-focus-stats--slim { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.chat-focus-strip--slim .chat-focus-stat {
  padding: 12px 14px;
  gap: 4px;
}
.chat-focus-strip--slim .chat-focus-stat strong { font-size: 18px; }

.chat-session-ribbon {
  display: grid;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 20px;
  border: 1px solid rgba(40, 61, 102, 0.08);
  background: linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(245,249,255,0.96) 100%);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}
.chat-session-ribbon-main,
.chat-session-ribbon-stats {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.chat-session-ribbon-title {
  font-size: 15px;
  font-weight: 800;
}
.chat-session-ribbon-note {
  color: #536078;
  line-height: 1.7;
}

.chat-workspace-panel {
  min-height: calc(100vh - 238px);
  padding: 16px;
  border-radius: 26px;
  border: 1px solid rgba(35, 58, 102, 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.78) 0%, rgba(247,250,254,0.96) 100%);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 12px;
}
.chat-workspace-panel > .chat-board {
  height: 100%;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 20px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.94) 0%, #f8fbff 100%);
  border: 1px solid rgba(39, 60, 99, 0.08);
}
.chat-composer-stack {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 10px;
}
.chat-composer-stack .chat-input-form {
  margin-top: 0;
  border: 1px solid rgba(37, 58, 102, 0.08);
  background: rgba(255,255,255,0.96);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}
.chat-input-actions--start {
  justify-content: flex-start;
  margin-bottom: 10px;
}
.chat-run-passive-note,
.chat-empty-card {
  border-radius: 18px;
}
.chat-run-passive-note {
  padding: 14px 16px;
  border: 1px solid rgba(31, 111, 235, 0.14);
  background: rgba(255,255,255,0.88);
  color: #41516b;
  line-height: 1.7;
}

.chat-runtime-controls[hidden] { display: none !important; }
.claw-interrupt-bar {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(31, 111, 235, 0.16);
  background: linear-gradient(135deg, rgba(232, 243, 255, 0.98) 0%, rgba(255,255,255,0.98) 100%);
  box-shadow: 0 10px 26px rgba(31, 111, 235, 0.08);
}
.claw-interrupt-copy {
  display: grid;
  gap: 4px;
}
.claw-interrupt-copy span,
.claw-interrupt-status { color: #51617d; }
.claw-interrupt-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.claw-interrupt-textarea {
  min-height: 72px;
  resize: vertical;
}
.claw-user-interrupt-row {
  margin-left: auto;
  max-width: min(480px, 100%);
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 18px 18px 6px 18px;
  background: linear-gradient(135deg, #1f6feb 0%, #4a8dff 100%);
  color: #fff;
  box-shadow: 0 12px 26px rgba(31, 111, 235, 0.18);
}
.claw-user-interrupt-label {
  font-size: 11px;
  font-weight: 800;
  opacity: 0.82;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.claw-user-interrupt-body {
  white-space: pre-wrap;
  line-height: 1.65;
}

.tool-call-card {
  border: 1px solid rgba(35, 58, 102, 0.08);
  border-left-width: 4px;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255,255,255,0.94);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}
.tool-call-card.tc-running { border-left-color: #1f6feb; }
.tool-call-card.tc-complete { border-left-color: #16a34a; }
.tool-call-card.tc-ask { border-left-color: #d97706; }
.tool-call-header {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 0;
  padding: 12px 14px;
  background: transparent;
  text-align: left;
}
.tool-call-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.05);
  color: #22324b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.tool-call-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool-call-meta {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.tc-badge-ask { background: rgba(217,119,6,0.14); color: #92400e; }
.tc-section-label {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.tool-call-card.tc-open .tool-call-body {
  display: grid;
  gap: 8px;
}
.tc-code-block {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(35, 58, 102, 0.08);
  color: #334155;
  font: 12px/1.65 "Consolas", "SFMono-Regular", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.tc-code-block-result {
  background: #f7fbff;
}
.tc-empty-note {
  font-size: 12px;
  color: #64748b;
}
.tc-spinner-line {
  background: linear-gradient(90deg, rgba(31,111,235,0.05) 0%, rgba(31,111,235,0.11) 50%, rgba(31,111,235,0.05) 100%);
  background-size: 200% 100%;
  animation: shimmer-purple 1.8s linear infinite;
}
.tc-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(31,111,235,0.2);
  border-top-color: #1f6feb;
  animation: spin 0.8s linear infinite;
}

.claw-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 14px;
}
.claw-banner-info {
  background: linear-gradient(135deg, #1f6feb 0%, #4a8dff 100%);
  color: #fff;
}
.claw-banner-success {
  background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
  color: #fff;
}

.checkpoint-memory-heading { font-weight: 700; color: #374151; }

@media (max-width: 1100px) {
  .chat-focus-stats--slim { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .claw-interrupt-input-row { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .console-sidebar-head { align-items: center; }
  .chat-workspace-shell { min-height: auto; }
  .chat-workspace-panel {
    min-height: auto;
    grid-template-rows: auto auto auto;
    padding: 12px;
  }
  .chat-workspace-panel > .chat-board {
    min-height: 420px;
    padding: 16px;
  }
  .chat-focus-strip--slim .chat-focus-strip-head,
  .chat-session-ribbon-main,
  .chat-session-ribbon-stats {
    flex-direction: column;
    align-items: flex-start;
  }
  .chat-focus-stats--slim { grid-template-columns: 1fr; }
  .chat-composer-stack { position: static; }
  .tool-call-header {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .tool-call-meta {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* ═══════════════════════════════════════════════════════
   COMMON PAGE DESIGN SYSTEM (pg-*)
   ═══════════════════════════════════════════════════════ */

.pg-root {
  padding: 28px 32px 48px;
  max-width: 1280px;
}

.pg-root-fluid {
  width: min(100%, 1480px);
  max-width: none;
  margin: 0 auto;
  padding: clamp(20px, 2.6vw, 32px);
}

.pg-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 20px;
}
.pg-head-fluid {
  flex-wrap: wrap;
  align-items: flex-end;
}
.pg-title { font-size: 22px; font-weight: 800; color: var(--text); margin: 0; }
.pg-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.pg-stats {
  display: flex; align-items: center; gap: 0;
  background: var(--card-bg); border: 1px solid #e5eaf2;
  border-radius: 12px; overflow: hidden;
  margin-bottom: 24px;
}
.pg-stats-fluid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0;
}
.pg-stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 20px; border-right: 1px solid #e5eaf2;
  min-width: 0;
}
.pg-stat:last-child { border-right: none; }
.pg-stats-fluid .pg-stat {
  min-height: 82px;
}
.pg-stats-fluid .pg-stat:not(:last-child) {
  border-right: 1px solid #e5eaf2;
}
.pg-stat-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pg-stat-value { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1; }
.pg-stat-value.ok { color: var(--purple); }

.pg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.pg-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.pg-grid-full { grid-template-columns: 1fr; }
.pg-grid-main { grid-template-columns: minmax(0,1fr) 320px; }
.pg-grid-cards {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.pg-grid-world {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.pg-card {
  background: var(--card-bg); border: 1px solid #e5eaf2;
  border-radius: 14px; overflow: hidden;
}
.pg-card-empty {
  min-height: 180px;
}
.pg-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #e5eaf2;
}
.pg-card-title { font-size: 13px; font-weight: 700; color: var(--text); }
.pg-card-badge {
  font-size: 11px; background: #e8eef6; color: var(--muted);
  border-radius: 9px; padding: 2px 8px; font-weight: 700;
}
.pg-card-badge.ok { background: #dbe8ff; color: var(--purple); }
.pg-card-badge.green { background: #d1fae5; color: #15803d; }
.pg-card-body { padding: 16px 18px; }
.pg-card-body-scroll { padding: 12px; overflow-y: auto; }

.pg-empty {
  padding: 28px; text-align: center;
  font-size: 13px; color: var(--muted); line-height: 1.6;
}
.pg-empty-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.pg-raw-toggle {
  margin-top: 10px;
  border-top: 1px solid rgba(44, 58, 87, 0.09);
  padding-top: 10px;
}
.pg-raw-toggle summary {
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}
.pg-raw-body {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.65;
  color: #374151;
  white-space: pre-wrap;
  word-break: break-word;
}

/* character / world cards */
.char-card {
  background: #faf8ff; border: 1px solid rgba(101,88,245,.2);
  border-radius: 18px; padding: 18px;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.char-card-name {
  font-size: 16px; font-weight: 800; color: var(--text);
  line-height: 1.35;
}
.char-card-time { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.char-card-body { font-size: 13px; color: #374151; line-height: 1.7; }
.char-card-fields {
  display: grid; gap: 6px; border-top: 1px solid rgba(101,88,245,.1);
  padding-top: 10px; margin-top: 10px;
}
.char-field { display: grid; grid-template-columns: minmax(72px, auto) minmax(0, 1fr); gap: 8px; font-size: 12px; align-items: start; }
.char-field span { color: var(--muted); }
.char-field strong { color: var(--text); }
.char-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.char-tag {
  font-size: 11px; padding: 4px 9px; border-radius: 999px;
  background: rgba(101,88,245,.1); color: #6558f5;
}

.world-setting-card {
  background: #faf8ff; border: 1px solid rgba(101,88,245,.18);
  border-radius: 16px; padding: 16px;
}
.world-fact-card {
  background: #f0fdf4; border: 1px solid rgba(34,197,94,.2);
  border-radius: 16px; padding: 16px;
}
.world-entry-card {
  min-width: 0;
}
.world-panel,
.world-bank-panel {
  min-width: 0;
}
.world-panel-body {
  display: grid;
  gap: 10px;
}
.world-field-grid {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(101,88,245,.08);
  display: grid;
  gap: 6px;
}
.world-field-row {
  display: grid;
  grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  font-size: 12px;
}
.world-field-row span {
  color: var(--muted);
}
.world-field-row strong {
  color: var(--text);
}
.world-card-title { font-size: 14px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.world-card-meta { font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.world-card-body { font-size: 13px; color: #374151; line-height: 1.7; }
.world-card-type {
  display: inline-block; font-size: 10px; padding: 1px 6px;
  border-radius: 5px; background: rgba(34,197,94,.15); color: #15803d; font-weight: 700;
  margin-bottom: 4px;
}

/* memory bank status strip */
.mem-bank-strip {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.mem-bank-strip-fluid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, max-content));
  gap: 10px;
}
.mem-bank-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 9px;
  border: 1px solid #e5eaf2; background: #f9fbfd;
}
.mem-bank-chip.has-data { border-color: rgba(101,88,245,.2); background: #faf8ff; }
.mem-bank-chip code { font-size: 11px; color: var(--muted); font-weight: 700; }
.mem-bank-chip.has-data code { color: #6558f5; }
.mem-bank-chip strong { font-size: 14px; font-weight: 800; color: var(--muted); }
.mem-bank-chip.has-data strong { color: #6558f5; }

@media (max-width: 960px) {
  .pg-stats-fluid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pg-stats-fluid .pg-stat:nth-child(2n) {
    border-right: none;
  }
}

@media (max-width: 640px) {
  .pg-root-fluid {
    padding: 18px 16px 28px;
  }
  .pg-head-fluid,
  .pg-actions {
    align-items: flex-start;
  }
  .pg-stats-fluid,
  .pg-grid-cards,
  .pg-grid-world {
    grid-template-columns: 1fr;
  }
  .pg-stats-fluid .pg-stat {
    border-right: none;
    border-bottom: 1px solid #e5eaf2;
  }
  .pg-stats-fluid .pg-stat:last-child {
    border-bottom: none;
  }
  .char-field,
  .world-field-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .mem-bank-strip-fluid {
    grid-template-columns: 1fr;
  }
}

/* link button */
.pg-link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 9px; border: 1px solid #dde4f0;
  background: var(--card-bg); font-size: 12px; font-weight: 600;
  color: var(--text); text-decoration: none; transition: all .12s;
}
.pg-link-btn:hover { background: #f0f4f9; border-color: #c5cfdf; }
.pg-link-btn.primary {
  background: var(--purple); color: #fff; border-color: var(--purple);
}
.pg-link-btn.primary:hover { opacity: .88; }

/* storyboard */
.sb-grid { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 16px; align-items: start; }
.sb-outline-card {
  border: 1px solid #e5eaf2; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 8px;
}
.sb-outline-card-global { border-left: 3px solid var(--purple); }
.sb-outline-card-chapter { border-left: 3px solid #0f9f7b; }
.sb-chip {
  display: inline-block; font-size: 10px; padding: 2px 7px;
  border-radius: 6px; background: #e8eef6; color: var(--muted);
  font-weight: 700; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em;
}
.sb-outline-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.sb-outline-meta { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.sb-outline-summary { font-size: 13px; color: #374151; line-height: 1.6; }

.sb-beat-item {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid #f0f4f9;
}
.sb-beat-item:last-child { border-bottom: none; }
.sb-beat-num {
  font-size: 11px; font-weight: 800; color: var(--muted);
  width: 24px; flex-shrink: 0; padding-top: 2px;
}
.sb-beat-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.sb-beat-summary { font-size: 12px; color: #374151; line-height: 1.5; }
.sb-beat-meta { font-size: 10px; color: var(--muted); margin-bottom: 3px; }

.sb-chapter-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.sb-chapter-card {
  background: var(--card-bg); border: 1px solid #e5eaf2;
  border-radius: 10px; padding: 14px;
}
.sb-chapter-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.sb-chapter-meta { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.sb-chapter-summary { font-size: 12px; color: #374151; line-height: 1.5; }

/* style page */
.style-summary { font-size: 14px; line-height: 1.7; color: var(--text); }
.style-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.style-tag {
  padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
  background: #eef3f9; color: var(--text); border: 1px solid #dde4f0;
}
.style-questions ol { margin: 0; padding-left: 20px; }
.style-questions li { font-size: 13px; color: var(--text); padding: 5px 0; line-height: 1.6; }

/* status page KPIs */
.kpi-strip {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0; background: var(--card-bg); border: 1px solid #e5eaf2; border-radius: 12px; overflow: hidden;
}
.kpi-cell {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px; border-right: 1px solid #e5eaf2;
  border-bottom: 1px solid #e5eaf2;
}
.kpi-label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 24px; font-weight: 800; color: var(--text); line-height: 1; }

.provider-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid #f0f4f9; gap: 12px;
}
.provider-card:last-child { border-bottom: none; }
.provider-name { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.provider-meta { font-size: 11px; color: var(--muted); }
.provider-status {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 7px;
  flex-shrink: 0;
}
.provider-status.ok { background: #d1fae5; color: #15803d; }
.provider-status.warn { background: #fef3c7; color: #92400e; }

.job-row {
  padding: 12px 0; border-bottom: 1px solid #f0f4f9;
}
.job-row:last-child { border-bottom: none; }
.job-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.job-id { font-size: 12px; font-weight: 700; color: var(--text); }
.job-status {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px;
  background: #e8eef6; color: var(--muted);
}
.job-status.running { background: #dbe8ff; color: var(--purple); }
.job-status.done { background: #d1fae5; color: #15803d; }
.job-status.canceled { background: #fee2e2; color: #dc2626; }
.job-run-id { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.job-preview { font-size: 12px; color: #374151; line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* chat page (dashboard) overrides */
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; background: var(--card-bg); border-bottom: 1px solid #e5eaf2; flex-shrink: 0; }
.chat-head-left { display: flex; align-items: center; gap: 12px; }
.chat-head-session { display: flex; align-items: center; gap: 8px; }
.chat-head-session-id { font-size: 12px; font-weight: 700; color: var(--muted); }
.chat-head-pills { display: flex; gap: 6px; }
.chat-status-pill {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 7px;
  background: #f0f4f9; color: var(--muted); border: 1px solid #e5eaf2;
}
.chat-status-pill.active { background: #dbe8ff; color: var(--purple); border-color: #a8caff; }
.chat-head-actions { display: flex; gap: 8px; }

/* ws-root overrides for rail items in new layout */
.ws-root .chapter-rail { display: flex; flex-direction: column; gap: 4px; }
.ws-root .memory-group-list { display: flex; flex-direction: column; gap: 4px; }
.ws-root .memory-entry-list { display: flex; flex-direction: column; gap: 4px; }
.ws-root .chapter-rail-item { width: 100%; border-radius: 8px; }
.ws-root .memory-group-card { width: 100%; border-radius: 8px; }
.ws-root .memory-bank-grid { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 8px; }
.ws-root .memory-bank-card { flex: 0 1 auto; min-width: 100px; }

/* manuscript intel cards inside accordion */
.ws-card-list .manuscript-intel-card {
  border-radius: 8px; padding: 10px 12px; font-size: 12px; margin-bottom: 6px;
}
.manuscript-intel-card.warm { background: #fff8f0; border: 1px solid #ffe4b0; }
.manuscript-intel-card.paper { background: #f8faff; border: 1px solid #d8e6ff; }
.manuscript-intel-card.cool { background: #f5fffe; border: 1px solid #b0e8e0; }
.ws-card-list .manuscript-intel-card {
  width: 100%;
  display: grid;
  gap: 6px;
  text-align: left;
  cursor: pointer;
  appearance: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.ws-card-list .manuscript-intel-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
.ws-card-list .manuscript-intel-card.is-active {
  border-color: rgba(31, 111, 235, 0.42) !important;
  box-shadow: 0 0 0 2px rgba(31, 111, 235, 0.12), 0 14px 28px rgba(15, 23, 42, 0.1);
}
.manuscript-intel-card-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(31, 111, 235, 0.1);
  color: #2456c9;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.manuscript-intel-card-foot {
  font-size: 11px;
  color: rgba(26,25,40,0.44);
}

.ws-root {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 0px);
  overflow: hidden;
  background: var(--main-bg);
}

/* ── top bar ── */
.ws-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--card-bg);
  border-bottom: 1px solid #e5eaf2;
  flex-shrink: 0;
  gap: 12px;
}
.ws-topbar-left { display: flex; align-items: center; gap: 12px; }
.ws-topbar-right { display: flex; align-items: center; gap: 16px; }
.ws-tabs { display: flex; gap: 4px; background: #f0f4f9; border-radius: 10px; padding: 4px; }
.ws-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 7px; border: none; background: transparent;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
  transition: all .15s;
}
.ws-tab.is-active { background: var(--card-bg); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.ws-tab-count {
  background: #e8eef6; color: var(--muted); border-radius: 10px;
  padding: 1px 6px; font-size: 11px; font-weight: 700;
}
.ws-tab.is-active .ws-tab-count { background: #dbe8ff; color: var(--purple); }

.ws-run-pill {
  font-size: 11px; font-weight: 600; background: #f0f4f9;
  border: 1px solid #dde4f0; border-radius: 8px; padding: 3px 10px;
  color: var(--muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ws-topbar-link {
  font-size: 13px; font-weight: 600; color: var(--purple);
}
.ws-topbar-link:hover { text-decoration: underline; }

/* ── panels ── */
.ws-panel { display: none; flex: 1; overflow: hidden; }
.ws-panel.is-active { display: flex; flex-direction: column; }

/* ── layout: three-col (manuscript) ── */
.ws-three-col {
  display: grid;
  grid-template-columns: 200px 1fr 280px;
  gap: 0;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.ws-two-col {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── columns ── */
.ws-col {
  display: flex; flex-direction: column;
  overflow: hidden;
  border-right: 1px solid #e5eaf2;
}
.ws-col:last-child { border-right: none; }
.ws-col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 10px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
  border-bottom: 1px solid #e5eaf2; flex-shrink: 0;
}

.ws-count {
  background: #e8eef6; color: var(--muted);
  border-radius: 9px; padding: 1px 7px; font-size: 11px; font-weight: 700;
}

/* rail */
.ws-col-rail { background: #f9fbfd; }
.ws-rail {
  overflow-y: auto; flex: 1; padding: 8px;
}
.ws-rail-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text);
  margin-bottom: 2px; transition: background .12s;
}
.ws-rail-item:hover { background: #eef3f9; }
.ws-rail-item.is-active { background: #dbe8ff; color: var(--purple); }
.ws-rail-badge {
  font-size: 10px; padding: 1px 5px; border-radius: 6px;
  background: #e8eef6; color: var(--muted); font-weight: 700;
}
.ws-rail-item.is-active .ws-rail-badge { background: #c3d9ff; color: var(--purple); }

/* reader */
.ws-col-reader {
  background: var(--card-bg);
  overflow-y: auto;
  padding: 0;
}
.ws-reader-toolbar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 20px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid #e5eaf2;
  backdrop-filter: blur(8px);
}
.ws-btn-group { display: flex; gap: 4px; }
.ws-btn {
  padding: 5px 12px; border-radius: 7px; border: 1px solid #dde4f0;
  background: var(--card-bg); font-size: 12px; font-weight: 600;
  color: var(--text); cursor: pointer; transition: all .12s;
}
.ws-btn:hover { background: #f0f4f9; border-color: #c5cfdf; }
.ws-btn.ws-btn-primary {
  background: var(--purple); color: #fff; border-color: var(--purple);
}
.ws-btn.ws-btn-primary:hover { opacity: .88; }
.ws-btn.ws-btn-xs { padding: 3px 9px; font-size: 11px; }

.ws-reader-meta { font-size: 12px; font-weight: 600; color: var(--muted); }
.ws-word-chip {
  font-size: 11px; background: #f0f4f9; border-radius: 6px;
  padding: 2px 8px; color: var(--muted); font-weight: 600;
}

.ws-paper {
  padding: 28px 32px;
  max-width: 680px;
  margin: 0 auto;
}
.ws-paper-kicker {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: .05em;
}
.ws-paper-title {
  font-size: 20px; font-weight: 700; color: var(--text);
  margin: 0 0 20px; line-height: 1.4;
}
.ws-paper-body {
  font-size: 15px; line-height: 1.8; color: #2a3146;
  white-space: pre-wrap;
}
.ws-paper-body-muted { color: var(--muted); font-style: italic; }

.ws-reader-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 32px;
  border-top: 1px solid #e5eaf2;
  font-size: 12px;
}
.ws-muted { color: var(--muted); }
.ws-link { color: var(--purple); font-weight: 600; font-size: 12px; }
.ws-link:hover { text-decoration: underline; }

/* edit sidebar */
.ws-col-edit {
  background: #f9fbfd;
  overflow-y: auto;
  padding: 0;
}
.ws-accordion { padding: 8px; }
.ws-accordion-item {
  border: 1px solid #e5eaf2; border-radius: 10px;
  background: var(--card-bg); margin-bottom: 6px; overflow: hidden;
}
.ws-accordion-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text);
  list-style: none;
  user-select: none;
}
.ws-accordion-head::-webkit-details-marker { display: none; }
.ws-accordion-item[open] .ws-accordion-head { border-bottom: 1px solid #e5eaf2; }
.ws-badge {
  font-size: 10px; background: #e8eef6; color: var(--muted);
  border-radius: 8px; padding: 1px 6px; font-weight: 700;
}
.ws-form {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px;
}
.ws-form input[type="text"],
.ws-form textarea {
  width: 100%; border: 1px solid #dde4f0; border-radius: 8px;
  padding: 8px 10px; font-size: 13px; background: var(--card-bg);
  color: var(--text); resize: vertical;
  transition: border-color .12s;
}
.ws-form input[type="text"]:focus,
.ws-form textarea:focus {
  outline: none; border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(31,111,235,.1);
}

.ws-status-line {
  font-size: 12px; color: var(--green-text); padding: 6px 12px;
  min-height: 28px; flex-shrink: 0;
}

/* ── memory panel ── */
.ws-col-memory-nav {
  background: #f9fbfd;
  overflow-y: auto;
}
.ws-group-list { padding: 6px; flex: 0 0 auto; }
.ws-group-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text);
  margin-bottom: 2px; transition: background .12s;
}
.ws-group-item:hover { background: #eef3f9; }
.ws-group-item.is-active { background: #dbe8ff; color: var(--purple); font-weight: 600; }

.ws-bank-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 6px 8px;
}
.ws-bank-chip {
  padding: 5px 10px; border-radius: 8px; border: 1px solid #dde4f0;
  font-size: 12px; font-weight: 600; background: var(--card-bg); color: var(--text);
  cursor: pointer; transition: all .12s;
}
.ws-bank-chip:hover { background: #eef3f9; border-color: #c5cfdf; }
.ws-bank-chip.is-active { background: #dbe8ff; color: var(--purple); border-color: #a8caff; }

.ws-bank-detail-list { padding: 4px 8px; }
.ws-bank-detail-item {
  padding: 6px 8px; font-size: 12px; color: var(--text);
  cursor: pointer; border-radius: 7px;
}
.ws-bank-detail-item:hover { background: #eef3f9; }
.ws-bank-detail-item.is-active { background: #dbe8ff; color: var(--purple); }

.ws-col-memory-editor {
  overflow-y: auto;
  padding: 0;
  background: var(--card-bg);
}
.ws-memory-editor-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid #e5eaf2;
  flex-shrink: 0; position: sticky; top: 0;
  background: rgba(255,255,255,.96); backdrop-filter: blur(6px);
  z-index: 1;
}
.ws-memory-editor-title { font-size: 14px; font-weight: 700; color: var(--text); }

.ws-form-inline { padding: 16px 20px; }
.ws-form-inline input[type="text"],
.ws-form-inline textarea {
  width: 100%; border: 1px solid #dde4f0; border-radius: 8px;
  padding: 8px 12px; font-size: 13px; background: #f9fbfd;
  color: var(--text); resize: vertical; transition: border-color .12s;
}
.ws-form-inline input[type="text"]:focus,
.ws-form-inline textarea:focus {
  outline: none; border-color: var(--purple);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px rgba(31,111,235,.1);
}

.ws-entry-list-head {
  padding: 10px 20px 6px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
}
.ws-entry-list { padding: 0 12px; }
.ws-entry-item {
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; margin-bottom: 4px;
  transition: all .12s;
}
.ws-entry-item:hover { background: #f0f4f9; border-color: #dde4f0; }
.ws-entry-item.is-active { background: #dbe8ff; border-color: #a8caff; }
.ws-entry-topic {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px;
}
.ws-entry-body {
  font-size: 13px; color: var(--text); line-height: 1.5;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}

.ws-form-edit { padding: 0 20px 20px; }
.ws-form-edit input[type="text"],
.ws-form-edit textarea {
  width: 100%; border: 1px solid #dde4f0; border-radius: 8px;
  padding: 8px 12px; font-size: 13px; background: #f9fbfd;
  color: var(--text); resize: vertical; transition: border-color .12s;
  margin-bottom: 8px;
}
.ws-form-edit input[type="text"]:focus,
.ws-form-edit textarea:focus {
  outline: none; border-color: var(--purple);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px rgba(31,111,235,.1);
}

/* ── shared empty note ── */
.ws-empty-note {
  padding: 20px; font-size: 13px; color: var(--muted); text-align: center;
  line-height: 1.6;
}

/* card list inside accordion */
.ws-card-list { display: flex; flex-direction: column; gap: 4px; }
.ws-card-item {
  padding: 8px 10px; border-radius: 8px; font-size: 12px;
  background: #f5f8fc; border: 1px solid #e8eef6;
  color: var(--text); line-height: 1.5;
}
.ws-card-item-label {
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px;
}

/* ── workspace responsive ── */
@media (max-width: 1100px) {
  .ws-three-col { grid-template-columns: 180px 1fr 240px; }
}
@media (max-width: 860px) {
  .ws-three-col { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .ws-two-col { grid-template-columns: 1fr; }
  .ws-col { border-right: none; border-bottom: 1px solid #e5eaf2; }
}

/* 2026-03-12 chat + workspace UI refresh */
.chat-stage-full { max-width: 1520px; }
.chat-shell-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  min-height: calc(100vh - 108px);
}
.chat-side-panel {
  display: grid;
  gap: 14px;
  align-content: start;
  position: sticky;
  top: 28px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding-right: 4px;
}
.chat-side-card,
.chat-thread-card,
.ws-card-panel,
.ws-shell-head {
  border: 1px solid rgba(39, 54, 88, 0.08);
  background: rgba(255,255,255,0.84);
  box-shadow: 0 22px 52px rgba(37, 48, 91, 0.1);
  backdrop-filter: blur(12px);
}
.chat-side-card {
  border-radius: 24px;
  padding: 18px;
  display: grid;
  gap: 12px;
}
.chat-side-card--hero {
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 36%),
    linear-gradient(135deg, rgba(255, 251, 244, 0.98) 0%, rgba(247, 250, 255, 0.98) 58%, rgba(240, 247, 255, 0.98) 100%);
}
.chat-side-card--empty {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.98) 0%, rgba(255,255,255,0.98) 100%);
}
.chat-side-kicker,
.chat-thread-kicker,
.ws-shell-kicker,
.ws-section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6558f5;
}
.chat-side-title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.08;
  color: #182133;
}
.chat-side-meta,
.chat-side-note {
  color: #627089;
  line-height: 1.7;
}
.chat-side-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.chat-side-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #738199;
}
.chat-side-headline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.chat-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.chat-mini-stat {
  border-radius: 18px;
  padding: 14px 15px;
  background: linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
  border: 1px solid rgba(45, 61, 94, 0.08);
  display: grid;
  gap: 6px;
}
.chat-mini-stat span {
  font-size: 12px;
  color: #7a869b;
}
.chat-mini-stat strong {
  font-size: 20px;
  color: #162032;
  line-height: 1.1;
}
.chat-brief-block {
  min-height: 132px;
  border-radius: 18px;
  padding: 16px;
  background: #f7f9fc;
  border: 1px solid rgba(43, 58, 87, 0.08);
  color: #2d3950;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-brief-wrap {
  display: grid;
  gap: 10px;
}
.chat-brief-block.is-collapsed {
  max-height: 320px;
  overflow: hidden;
  position: relative;
}
.chat-brief-block.is-collapsed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  background: linear-gradient(180deg, rgba(247,249,252,0) 0%, rgba(247,249,252,0.96) 82%);
  pointer-events: none;
}
.chat-brief-block.is-expanded {
  max-height: none;
}
.chat-brief-block.is-expanded::after {
  display: none;
}
.chat-brief-toggle {
  justify-self: start;
  border: 1px solid rgba(31, 111, 235, 0.14);
  background: rgba(255,255,255,0.86);
  color: #1f5ec7;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.chat-readiness-value {
  font-size: 22px;
  color: #0f766e;
}
.chat-readiness-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.08);
}
.chat-readiness-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e 0%, #38bdf8 100%);
}
.chat-side-list {
  margin: 0;
  padding-left: 20px;
  color: #314058;
  line-height: 1.8;
}
.chat-main-panel {
  min-width: 0;
  display: grid;
  gap: 14px;
}
.chat-thread-card {
  border-radius: 28px;
  padding: 16px;
  display: grid;
  gap: 14px;
  min-height: calc(100vh - 128px);
}
.chat-thread-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 6px 4px 0;
  flex-wrap: wrap;
}
.chat-thread-head h1 {
  margin: 8px 0 0;
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.02;
}
.chat-thread-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.chat-board--thread {
  min-height: 540px;
  max-height: calc(100vh - 286px);
  margin: 0;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(39, 54, 88, 0.08);
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.06), transparent 22%),
    linear-gradient(180deg, rgba(252,253,255,0.98) 0%, rgba(246,249,252,0.98) 100%);
}
.chat-board--thread .chat-row {
  margin-bottom: 0;
}
.assistant-panel {
  width: min(900px, 100%);
  border-radius: 22px;
  border: 1px solid rgba(39, 54, 88, 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,253,0.98) 100%);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.05);
}
.assistant-section {
  padding: 18px 20px;
}
.assistant-title {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6d7b92;
}
.assistant-text,
.question-list {
  color: #2f3a4d;
}
.user-bubble {
  background: linear-gradient(135deg, #153b72 0%, #1f6feb 52%, #4da8ff 100%);
  border-radius: 22px 22px 8px 22px;
  box-shadow: 0 16px 34px rgba(31, 111, 235, 0.2);
}
.avatar-circle {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #132038 0%, #284163 100%);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
}
.chat-run-feed {
  display: grid;
  gap: 14px;
}
.chat-runtime-controls {
  display: grid;
  gap: 12px;
}
.chat-composer-stack {
  position: static;
}
.chat-input-form--floating {
  margin-top: 0;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(37, 58, 102, 0.08);
  background: rgba(255,255,255,0.92);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
}
.chat-input-topline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.chat-input-topline label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.chat-input-topline select {
  max-width: 260px;
}

.ws-root {
  display: grid;
  gap: 18px;
  min-height: 0;
  height: auto;
  overflow: visible;
  background: transparent;
  max-width: 1520px;
  margin: 0 auto;
}
.ws-shell-head {
  position: relative;
  overflow: hidden;
  border-radius: 32px;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 400px);
  gap: 18px;
  align-items: start;
  background:
    radial-gradient(circle at top right, rgba(101, 88, 245, 0.22), transparent 30%),
    radial-gradient(circle at bottom left, rgba(59, 130, 246, 0.14), transparent 28%),
    linear-gradient(135deg, rgba(244, 242, 255, 0.98) 0%, rgba(248,251,255,0.98) 52%, rgba(240,246,255,0.98) 100%);
}
.ws-shell-head::after {
  content: "";
  position: absolute;
  right: -48px;
  bottom: -84px;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(145, 136, 255, 0.18) 0%, rgba(255,255,255,0) 72%);
  pointer-events: none;
}
.ws-shell-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
}
.ws-shell-copy h1 {
  margin: 0;
  font-size: clamp(30px, 2.7vw, 40px);
  line-height: 1.05;
  color: #172133;
}
.ws-shell-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.ws-shell-meta span {
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(101, 88, 245, 0.1);
  color: #4f5e7b;
  font-size: 11px;
  font-weight: 700;
}
.ws-shell-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  align-self: stretch;
  position: relative;
  z-index: 1;
}
.ws-shell-stat {
  border-radius: 18px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.84) 0%, rgba(245,247,255,0.92) 100%);
  border: 1px solid rgba(101, 88, 245, 0.1);
  display: grid;
  gap: 6px;
}
.ws-shell-stat span {
  font-size: 12px;
  color: #67779a;
}
.ws-shell-stat strong {
  font-size: 22px;
  line-height: 1;
  color: #182133;
}
.ws-topbar {
  border-radius: 22px;
  padding: 12px 16px;
  border: 1px solid rgba(39, 54, 88, 0.08);
  background: rgba(255,255,255,0.84);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
  position: sticky;
  top: 16px;
  z-index: 8;
}
.ws-panel {
  overflow: visible;
}
.ws-panel.is-active {
  display: block;
}
.ws-manuscript-shell {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.ws-panel-sidebar,
.ws-memory-sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
}
.ws-section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 18px 20px 14px;
}
.ws-section-head h2,
.ws-section-head h3 {
  margin: 6px 0 0;
  font-size: 20px;
  line-height: 1.2;
}
.ws-section-desc {
  margin: 8px 0 0;
  color: #67748a;
  line-height: 1.75;
}
.ws-rail {
  padding: 0 16px 18px;
  max-height: calc(100vh - 212px);
}
.ws-root .chapter-rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ws-root .chapter-rail-item {
  width: 100%;
  text-align: left;
  padding: 16px 16px 14px;
  border-radius: 22px;
  border: 1px solid rgba(40, 56, 86, 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(244,247,251,0.98) 100%);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.ws-root .chapter-rail-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.08);
}
.ws-root .chapter-rail-item.is-active {
  border-color: rgba(185, 124, 46, 0.2);
  box-shadow: 0 18px 34px rgba(185, 124, 46, 0.12);
  background: linear-gradient(180deg, rgba(255,248,239,0.98) 0%, rgba(255,255,255,0.98) 100%);
}
.chapter-rail-row-head,
.memory-bank-card-head,
.memory-bank-detail-head,
.memory-entry-card-head,
.memory-group-card-inner {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.chapter-rail-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #78859a;
}
.chapter-rail-status {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}
.chapter-rail-status.is-drafted {
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
}
.chapter-rail-status.is-planned {
  background: rgba(31, 111, 235, 0.1);
  color: #1f6feb;
}
.chapter-rail-item strong {
  display: block;
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.4;
}
.chapter-rail-meta,
.chapter-rail-preview {
  display: block;
  margin-top: 8px;
  color: #66748c;
  line-height: 1.6;
}
.chapter-rail-meta {
  font-size: 12px;
}
.chapter-rail-preview {
  font-size: 13px;
}
.chapter-rail-bar {
  margin-top: 12px;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.08);
}
.chapter-rail-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f6feb 0%, #38bdf8 100%);
}
.ws-manuscript-main,
.ws-memory-main {
  min-width: 0;
  display: grid;
  gap: 18px;
}
.ws-reader-stage {
  overflow: hidden;
}
.ws-reader-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 22px 14px;
  background: transparent;
  border-bottom: none;
}
.ws-reader-toolbar-left,
.ws-reader-toolbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.ws-paper {
  width: min(100%, 960px);
  max-width: 960px;
  margin: 0 auto;
  padding: 30px 34px 42px;
  border-radius: 30px;
  border: 1px solid rgba(40, 56, 86, 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(251,248,243,0.98) 100%);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.08);
}
.ws-paper-title {
  font-size: clamp(26px, 2.3vw, 34px);
  line-height: 1.2;
}
.ws-paper-body {
  font-size: 16px;
  line-height: 1.95;
  min-height: 360px;
}
.ws-reader-footer {
  padding: 16px 22px 22px;
  border-top: none;
  background: transparent;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ws-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.ws-accordion-item {
  margin: 0;
  border-radius: 22px;
  border: 1px solid rgba(39, 54, 88, 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,253,0.98) 100%);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.05);
}
.ws-accordion-head {
  padding: 16px 18px;
}
.ws-accordion-item[open] .ws-accordion-head {
  background: rgba(248, 250, 252, 0.92);
}
.ws-form {
  padding: 18px;
  gap: 10px;
}
.ws-form input[type="text"],
.ws-form textarea {
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(250, 251, 253, 0.98);
}
.ws-planning-counts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ws-subcount-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: #f3f6fa;
  border: 1px solid rgba(40, 56, 86, 0.08);
  font-size: 12px;
  font-weight: 700;
  color: #5d6a81;
}
.ws-subcount-chip strong {
  color: #162032;
}
.ws-card-list {
  display: grid;
  gap: 10px;
}
.ws-card-list .manuscript-intel-card {
  border-radius: 16px;
  margin-bottom: 0;
  padding: 14px 16px;
}
.ws-status-line {
  padding: 0 8px 2px;
}
.ws-memory-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.ws-memory-sidebar {
  display: grid;
  gap: 10px;
}
.ws-memory-block {
  padding: 0 18px 18px;
  display: grid;
  gap: 10px;
}
.ws-memory-block-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #2f3a4d;
}
.ws-memory-summary {
  padding: 20px 22px;
}
.ws-memory-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.ws-memory-summary-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.ws-pill-stat {
  min-width: 130px;
  padding: 14px 16px;
  border-radius: 18px;
  background: #f5f7fa;
  border: 1px solid rgba(40, 56, 86, 0.08);
  display: grid;
  gap: 6px;
}
.ws-pill-stat small {
  color: #738199;
}
.ws-pill-stat strong {
  color: #162032;
  font-size: 16px;
  line-height: 1.35;
}
.ws-memory-latest,
.ws-side-note {
  padding: 14px 16px;
  border-radius: 16px;
  background: #f5f7fa;
  border: 1px solid rgba(40, 56, 86, 0.08);
  color: #506078;
  line-height: 1.7;
}
.ws-memory-main-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.ws-memory-main-grid > :last-child {
  grid-column: 1 / -1;
}
.memory-group-list,
.memory-bank-grid,
.memory-bank-detail-list,
.memory-entry-list {
  display: grid;
  gap: 10px;
}
.memory-group-list,
.memory-entry-list {
  padding: 0 18px 18px;
}
.memory-group-card,
.memory-bank-card,
.memory-bank-detail-card,
.memory-entry-card {
  width: 100%;
  text-align: left;
  border-radius: 18px;
  border: 1px solid rgba(40, 56, 86, 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(247,249,252,0.98) 100%);
  padding: 14px 15px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.memory-group-card:hover,
.memory-bank-card:hover,
.memory-bank-detail-card:hover,
.memory-entry-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.07);
}
.memory-group-card.is-active,
.memory-bank-card.is-active,
.memory-bank-detail-card.is-active,
.memory-entry-card.is-active {
  border-color: rgba(31, 111, 235, 0.24);
  box-shadow: 0 12px 24px rgba(31, 111, 235, 0.12);
  background: linear-gradient(180deg, rgba(239,247,255,0.98) 0%, rgba(255,255,255,0.98) 100%);
}
.memory-group-card-inner {
  align-items: center;
}
.memory-group-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex: 0 0 auto;
  margin-top: 4px;
}
.memory-group-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
  flex: 1;
}
.memory-group-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #78859a;
}
.memory-group-copy strong,
.memory-bank-card strong,
.memory-bank-detail-card strong,
.memory-entry-card strong {
  color: #182133;
  line-height: 1.45;
}
.memory-group-meta,
.memory-bank-card-desc,
.memory-bank-card-preview,
.memory-bank-detail-body,
.memory-bank-detail-meta,
.memory-entry-card-preview,
.memory-entry-card-meta {
  color: #627089;
  line-height: 1.65;
}
.memory-group-meta,
.memory-bank-detail-meta,
.memory-entry-card-meta {
  font-size: 12px;
}
.memory-group-count-pill,
.memory-entry-chip,
.memory-kind-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef3f7;
  color: #5d6a81;
  font-size: 11px;
  font-weight: 800;
}

@media (max-width: 1240px) {
  .chat-shell-grid,
  .ws-manuscript-shell,
  .ws-memory-shell {
    grid-template-columns: 1fr;
  }
  .chat-side-panel,
  .ws-panel-sidebar,
  .ws-memory-sidebar {
    position: static;
    top: auto;
  }
  .chat-thread-card {
    min-height: 0;
  }
  .ws-memory-main-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 880px) {
  .ws-shell-head,
  .ws-editor-grid {
    grid-template-columns: 1fr;
  }
  .ws-shell-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .chat-shell-grid {
    min-height: auto;
  }
  .chat-thread-head,
  .ws-topbar,
  .ws-reader-toolbar,
  .ws-memory-summary-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .chat-mini-grid,
  .ws-shell-stats {
    grid-template-columns: 1fr 1fr;
  }
  .chat-board--thread {
    min-height: 420px;
    max-height: none;
    padding: 18px;
  }
  .ws-paper {
    padding: 26px 22px 34px;
  }
  .ws-rail {
    max-height: none;
  }
  .ws-topbar {
    top: 10px;
  }
}

@media (max-width: 560px) {
  .chat-mini-grid,
  .ws-shell-stats {
    grid-template-columns: 1fr;
  }
  .chat-thread-card,
  .chat-side-card,
  .ws-shell-head,
  .ws-card-panel {
    border-radius: 22px;
  }
}

/* 2026-03-12 layout refinement round 2 */
.chat-main-stack {
  display: grid;
  gap: 16px;
}
.chat-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 24px 28px;
  border-radius: 30px;
  border: 1px solid rgba(39, 54, 88, 0.08);
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.12), transparent 26%),
    linear-gradient(135deg, rgba(255, 249, 241, 0.98) 0%, rgba(248, 251, 255, 0.98) 54%, rgba(242, 248, 255, 0.98) 100%);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.08);
}
.chat-hero-copy h1 {
  margin: 8px 0 0;
  font-size: clamp(28px, 3.2vw, 46px);
  line-height: 1.02;
  color: #172133;
}
.chat-hero-kicker,
.chat-summary-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7f6751;
}
.chat-hero-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.chat-hero-meta span {
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255,255,255,0.8);
  border: 1px solid rgba(42, 58, 88, 0.08);
  color: #55637c;
  font-size: 12px;
  font-weight: 700;
}
.chat-hero-note {
  margin-top: 12px;
  color: #66748b;
  line-height: 1.7;
}
.chat-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.chat-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
}
.chat-summary-grid--start {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.9fr);
}
.chat-summary-card {
  min-width: 0;
  padding: 18px 20px;
  border-radius: 24px;
  border: 1px solid rgba(39, 54, 88, 0.08);
  background: rgba(255,255,255,0.86);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.06);
  display: grid;
  gap: 14px;
}
.chat-summary-card--brief {
  grid-column: span 1;
}
.chat-summary-card--start {
  min-height: 132px;
}
.chat-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.chat-inline-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.chat-inline-stat {
  min-width: 0;
  border-radius: 18px;
  padding: 14px 15px;
  background: #f7f9fc;
  border: 1px solid rgba(45, 61, 94, 0.08);
  display: grid;
  gap: 6px;
}
.chat-inline-stat span {
  font-size: 12px;
  color: #7a869b;
}
.chat-inline-stat strong {
  font-size: 20px;
  line-height: 1.15;
  color: #172133;
  word-break: break-word;
}
.chat-thread-card {
  min-height: 0;
}
.chat-thread-head h2 {
  margin: 8px 0 0;
  font-size: clamp(24px, 2.7vw, 40px);
  line-height: 1.04;
}
.chat-board--thread {
  min-height: 480px;
  max-height: calc(100vh - 310px);
}

.ws-manuscript-shell-v2 {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.ws-manuscript-rail {
  position: sticky;
  top: 88px;
  align-self: start;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,250,244,0.96) 0%, rgba(250,252,255,0.98) 100%);
}
.ws-reader-stage-v2 {
  overflow: hidden;
  min-height: 680px;
  display: grid;
  align-content: start;
  background: linear-gradient(180deg, rgba(247,249,253,0.92) 0%, rgba(255,255,255,0.98) 100%);
  position: relative;
}
.ws-reader-stage-v2::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.44) 0%, rgba(255,255,255,0) 18%),
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.08), transparent 28%);
  pointer-events: none;
}
.ws-editor-grid-v2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.ws-editor-column {
  display: grid;
  gap: 18px;
  align-content: start;
}
.ws-panel-grid {
  display: grid;
  gap: 18px;
  min-width: 0;
}
.ws-panel-grid-2 {
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.78fr);
  gap: 18px;
}
.ws-panel-grid-outline {
  grid-template-columns: minmax(340px, 400px) minmax(0, 1fr);
  align-items: start;
}
.ws-panel-grid-outline .ws-stack {
  position: sticky;
  top: 88px;
}
.ws-panel-grid-outline .ws-reader-stage-v2 {
  min-height: 760px;
}
.ws-reader-stage-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  min-height: 760px;
  padding: 18px;
  position: relative;
  z-index: 1;
}
.ws-reader-main {
  min-width: 0;
  display: grid;
  align-content: start;
}
.ws-reader-side {
  display: grid;
  gap: 14px;
  align-content: start;
}
.ws-reader-side-card {
  border-radius: 22px;
  border: 1px solid rgba(39, 54, 88, 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,253,0.98) 100%);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.05);
  padding: 16px 18px;
  display: grid;
  gap: 10px;
}
.ws-side-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6558f5;
}
.ws-side-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  color: #182133;
}
.ws-side-text {
  color: #4a5568;
  font-size: 13px;
  line-height: 1.75;
}
.ws-side-text-muted {
  color: #6b7280;
}
.ws-side-chip-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ws-side-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(31, 111, 235, 0.08);
  border: 1px solid rgba(31, 111, 235, 0.12);
  color: #2456c9;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}
.ws-panel-grid-outline .ws-paper {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 32px 36px 40px;
}
.ws-panel-grid-outline .ws-paper-title {
  font-size: clamp(24px, 2vw, 32px);
}
.ws-panel-grid-outline .ws-paper-body {
  min-height: 560px;
  font-size: 15.5px;
  line-height: 1.96;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ws-panel-grid-outline .ws-card-list {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 2px;
}
.ws-panel-grid-outline .ws-form textarea {
  min-height: 220px;
}
.ws-stack {
  display: grid;
  gap: 18px;
  align-content: start;
  min-width: 0;
}

.ws-memory-shell-v2 {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.ws-memory-zones,
.ws-memory-context,
.ws-memory-workbench {
  min-width: 0;
}
.ws-memory-shell-v2 > .ws-memory-workbench,
.ws-memory-shell-v2 > .ws-empty-panel {
  grid-column: 1 / -1;
}
.ws-memory-zones {
  position: sticky;
  top: 88px;
  align-self: start;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,250,244,0.96) 0%, rgba(250,252,255,0.98) 100%);
}
.ws-memory-zones .memory-group-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 0 16px 18px;
}
.ws-memory-context {
  padding: 18px 20px 22px;
  display: grid;
  gap: 16px;
  min-height: 480px;
  background: linear-gradient(180deg, rgba(247,249,253,0.92) 0%, rgba(255,255,255,0.98) 100%);
}
.ws-memory-context-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.96fr);
  gap: 18px;
}
.ws-memory-context-card {
  min-width: 0;
  border-radius: 20px;
  border: 1px solid rgba(40, 56, 86, 0.08);
  background: #f8fafc;
  padding: 16px;
  display: grid;
  gap: 10px;
}
.ws-memory-workbench {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(320px, 1fr) minmax(420px, 1.35fr);
  gap: 18px;
  align-items: start;
}
.ws-memory-intake,
.ws-memory-list-card,
.ws-memory-editor-card {
  min-width: 0;
}
.ws-memory-list-card .memory-entry-list {
  padding: 0 18px 18px;
  display: grid;
  gap: 10px;
  max-height: 720px;
  overflow-y: auto;
}
.ws-memory-editor-card .ws-form textarea {
  min-height: 320px;
}
.ws-memory-workbench-2 {
  grid-template-columns: minmax(340px, 0.9fr) minmax(420px, 1.1fr);
}

.ws-stage-empty {
  min-height: 680px;
  display: grid;
  place-items: center;
  padding: 32px;
}
.ws-stage-empty-shell {
  width: min(100%, 980px);
  display: grid;
  gap: 22px;
  padding: 30px;
  border-radius: 32px;
  border: 1px solid rgba(40, 56, 86, 0.08);
  background:
    radial-gradient(circle at top right, rgba(248, 185, 96, 0.14), transparent 28%),
    linear-gradient(135deg, rgba(255,255,255,0.98) 0%, rgba(255,249,241,0.98) 58%, rgba(246,250,255,0.98) 100%);
  box-shadow: 0 24px 54px rgba(15, 23, 42, 0.1);
}
.ws-stage-empty-copy {
  display: grid;
  gap: 10px;
}
.ws-stage-empty-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.76);
  border: 1px solid rgba(40, 56, 86, 0.08);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7f6751;
}
.ws-stage-empty-title {
  margin: 0;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.04;
  color: #182133;
}
.ws-stage-empty-body {
  margin: 0;
  max-width: 52ch;
  color: #5b6980;
  line-height: 1.75;
}
.ws-stage-empty-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.ws-stage-empty-card {
  min-height: 132px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(40, 56, 86, 0.08);
  background: rgba(255,255,255,0.76);
  display: grid;
  gap: 8px;
  align-content: start;
}
.ws-stage-empty-card span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7b879b;
}
.ws-stage-empty-card strong {
  font-size: 18px;
  line-height: 1.25;
  color: #172133;
}
.ws-stage-empty-card p {
  margin: 0;
  color: #65738a;
  line-height: 1.6;
}

.storyboard-page .sb-grid-fluid {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(320px, 0.88fr);
  gap: 18px;
  align-items: start;
}
.storyboard-page .sb-main-column,
.storyboard-page .sb-side-column {
  display: grid;
  gap: 18px;
}
.storyboard-page .sb-secondary-card {
  min-width: 0;
}
.pg-stat-value-project {
  font-size: 14px;
  line-height: 1.45;
  padding-top: 4px;
  word-break: break-word;
}

@media (max-width: 1360px) {
  .chat-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chat-summary-card--brief {
    grid-column: 1 / -1;
  }
  .ws-memory-workbench {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ws-memory-editor-card {
    grid-column: 1 / -1;
  }
  .ws-memory-shell-v2 {
    grid-template-columns: 320px minmax(0, 1fr);
  }
}

@media (max-width: 1240px) {
  .ws-manuscript-shell-v2,
  .ws-memory-shell-v2,
  .storyboard-page .sb-grid-fluid {
    grid-template-columns: 1fr;
  }
  .ws-panel-grid-2,
  .ws-memory-workbench-2 {
    grid-template-columns: 1fr;
  }
  .ws-shell-head {
    grid-template-columns: 1fr;
  }
  .ws-manuscript-rail {
    position: static;
    top: auto;
  }
  .ws-memory-zones {
    position: static;
    top: auto;
  }
  .ws-memory-context-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .chat-hero-card,
  .chat-summary-grid,
  .ws-editor-grid-v2,
  .ws-memory-workbench {
    grid-template-columns: 1fr;
  }
  .ws-stage-empty-grid {
    grid-template-columns: 1fr;
  }
  .chat-hero-actions {
    justify-content: flex-start;
  }
  .chat-inline-stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .chat-hero-card,
  .ws-shell-head,
  .ws-topbar {
    padding-left: 18px;
    padding-right: 18px;
  }
  .chat-inline-stats {
    grid-template-columns: 1fr;
  }
  .chat-board--thread {
    max-height: none;
    min-height: 420px;
  }
  .ws-stage-empty {
    padding: 20px;
  }
  .ws-stage-empty-shell {
    padding: 22px 18px;
  }
  .ws-stage-empty,
  .ws-reader-stage-v2 {
    min-height: auto;
  }
  .ws-memory-zones .memory-group-list {
    grid-template-columns: 1fr;
  }
}

/* 2026-03-12 focus-first shell cleanup */
.console-focus-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.04) 100%);
  border: 1px solid rgba(255,255,255,0.09);
}
.console-focus-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}
.console-focus-card > strong {
  font-size: 22px;
  color: #ffffff;
  line-height: 1.1;
}
.console-focus-meta {
  color: rgba(255,255,255,0.66);
  font-size: 13px;
  line-height: 1.6;
}
.console-focus-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.console-focus-grid div {
  padding: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
  display: grid;
  gap: 4px;
}
.console-focus-grid span {
  font-size: 11px;
  color: rgba(255,255,255,0.54);
}
.console-focus-grid strong {
  font-size: 18px;
  color: #ffffff;
}
.console-nav-drawer {
  display: grid;
  gap: 12px;
}
.console-nav-drawer-summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.025) 100%);
  color: rgba(255,255,255,0.88);
  font-weight: 700;
  cursor: pointer;
}
.console-nav-drawer-summary::-webkit-details-marker {
  display: none;
}
.console-nav-drawer-icon {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.07);
  transition: transform 0.18s ease;
}
.console-nav-drawer[open] .console-nav-drawer-icon {
  transform: rotate(45deg);
}
.console-nav-drawer-body {
  display: grid;
  gap: 12px;
}
.chat-main-stack--immersive {
  gap: 18px;
}
.chat-hero-card--compact {
  padding: 22px 26px;
}
.chat-shell-grid--command {
  min-height: 0;
  align-items: start;
}
.chat-side-panel--command {
  top: 18px;
  max-height: calc(100vh - 28px);
}
.chat-side-panel--command {
  gap: 10px;
}
.chat-side-panel--command .chat-side-card {
  padding: 14px;
  gap: 10px;
  border-radius: 18px;
}
.chat-side-panel--command .chat-side-title {
  font-size: 22px;
  line-height: 1.04;
}
.chat-side-panel--command .chat-side-kicker {
  font-size: 10px;
}
.chat-side-panel--command .chat-brief-wrap {
  gap: 7px;
}
.chat-side-panel--command .chat-brief-block {
  min-height: 0;
  padding: 12px 12px 14px;
  border-radius: 14px;
  font-size: 12px;
  line-height: 1.62;
}
.chat-side-panel--command .chat-brief-block.is-collapsed {
  max-height: 168px;
}
.chat-side-panel--command .chat-brief-block.is-collapsed::after {
  height: 40px;
}
.chat-side-panel--command .chat-mini-grid {
  gap: 8px;
}
.chat-side-panel--command .chat-mini-stat {
  padding: 10px 11px;
  border-radius: 14px;
  gap: 4px;
}
.chat-side-panel--command .chat-mini-stat span {
  font-size: 11px;
}
.chat-side-panel--command .chat-mini-stat strong {
  font-size: 16px;
}
.chat-side-panel--command .chat-side-note {
  font-size: 12px;
  line-height: 1.55;
  max-height: 78px;
  overflow-y: auto;
  padding-right: 2px;
}
.chat-side-panel--command .chat-side-list {
  max-height: 150px;
  overflow-y: auto;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.6;
}
.chat-side-panel--command .chat-side-actions {
  gap: 8px;
}
.chat-side-panel--command .chat-side-actions .ghost-btn,
.chat-side-panel--command .chat-session-item,
.chat-side-panel--command .inline-edit-btn,
.chat-side-panel--command .chat-brief-toggle {
  font-size: 11px;
}
.chat-side-panel--command .chat-session-list {
  max-height: 180px;
  overflow-y: auto;
  padding-right: 2px;
}
.chat-side-panel--command .chat-session-item {
  padding: 10px 11px;
  gap: 4px;
}
.chat-side-panel--command .inline-edit-form textarea {
  min-height: 84px;
  max-height: 160px;
}
.chat-stage-column {
  min-width: 0;
  display: grid;
  gap: 16px;
}
.chat-thread-card--command {
  min-height: 0;
}
.chat-composer-stack--docked {
  margin-top: 0;
}
.chat-composer-stack--docked .chat-input-form {
  margin-top: 0;
  border-radius: 24px;
  border: 1px solid rgba(39, 54, 88, 0.08);
  box-shadow: 0 20px 48px rgba(37, 48, 91, 0.08);
}
.chat-session-list {
  display: grid;
  gap: 10px;
}
.chat-session-item {
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid rgba(45, 61, 94, 0.08);
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.chat-session-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.07);
}
.chat-session-item.is-active {
  border-color: rgba(31, 111, 235, 0.22);
  box-shadow: 0 14px 28px rgba(31, 111, 235, 0.12);
}
.chat-session-item strong {
  color: #182133;
  line-height: 1.35;
}
.chat-session-item span {
  color: #66748c;
  font-size: 12px;
}
.ws-shell-head--studio {
  gap: 22px;
}
.ws-shell-note {
  margin: 14px 0 0;
  max-width: 56ch;
  color: #5f6e85;
  line-height: 1.8;
}
.ws-shell-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.ws-shell-actions .ghost-btn {
  background: rgba(255,255,255,0.72);
  border-color: rgba(40, 56, 86, 0.12);
}
.ws-topbar-note {
  color: #5f6e85;
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 980px) {
  .console-focus-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .chat-side-panel--command {
    position: static;
    top: auto;
  }
  .chat-hero-card--compact {
    grid-template-columns: 1fr;
  }
  .ws-shell-actions,
  .ws-topbar-right {
    align-items: flex-start;
  }
}

/* =========================================================
   CHARACTER PROFILES — redesigned living-document UI
   ========================================================= */

.chars-root {
  display: grid;
  gap: 28px;
  padding: 0 0 40px;
}

/* Header */
.chars-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
  padding: 26px 30px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(101,88,245,0.13), transparent 38%),
    linear-gradient(135deg, #f6f4ff 0%, #fff 52%, #f0f4ff 100%);
  border: 1px solid rgba(101,88,245,0.12);
  box-shadow: 0 20px 50px rgba(15,23,42,0.06);
}
.chars-header-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #6558f5;
  margin-bottom: 6px;
}
.chars-header h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 2.8vw, 36px);
  font-weight: 800;
  color: #15213a;
}
.chars-header p {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: #5c6880;
  max-width: 580px;
}
.chars-header-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}
.chars-stat-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.8);
  border: 1px solid rgba(101,88,245,0.1);
  min-width: 160px;
}
.chars-stat-pill span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.chars-stat-pill strong {
  font-size: 18px;
  font-weight: 800;
  color: #15213a;
}

/* Grid */
.chars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

/* Profile card */
.char-profile {
  background: #fff;
  border: 1px solid rgba(101,88,245,0.14);
  border-radius: 22px;
  padding: 22px;
  display: grid;
  gap: 14px;
  box-shadow: 0 8px 28px rgba(15,23,42,0.06);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.char-profile:hover {
  box-shadow: 0 14px 40px rgba(15,23,42,0.1);
  transform: translateY(-2px);
}
.char-profile--evolved {
  border-color: rgba(101,88,245,0.24);
  background: linear-gradient(180deg, #faf8ff 0%, #fff 100%);
}

/* Header row */
.char-profile-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.char-profile-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.char-profile-avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(101,88,245,0.28) 0%, rgba(59,130,246,0.22) 100%);
  border: 1px solid rgba(101,88,245,0.18);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  color: #4a38e8;
}
.char-profile-name {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 800;
  color: #15213a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.char-profile-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.char-chapter-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(101,88,245,0.1);
  color: #5141d8;
  font-size: 11px;
  font-weight: 800;
}
.char-evolution-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(59,178,115,0.1);
  color: #1d7a4a;
  font-size: 11px;
  font-weight: 700;
}
.char-time-badge {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

/* Live dot — shown on evolving characters */
.char-live-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #45d48f;
  flex-shrink: 0;
  margin-top: 4px;
  box-shadow: 0 0 0 3px rgba(69,212,143,0.22);
  animation: char-pulse 2.4s ease-in-out infinite;
}
@keyframes char-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(69,212,143,0.22); }
  50% { box-shadow: 0 0 0 6px rgba(69,212,143,0.1); }
}

/* Summary */
.char-profile-summary {
  font-size: 13px;
  line-height: 1.75;
  color: #374151;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #eceff3;
  border-radius: 12px;
}

/* Field grid */
.char-profile-fields {
  display: grid;
  gap: 7px;
  padding-top: 12px;
  border-top: 1px solid rgba(101,88,245,0.08);
}
.char-field-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 10px;
  font-size: 12px;
  align-items: baseline;
}
.char-field-label {
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.6;
}
.char-field-value {
  color: #2d3748;
  font-weight: 600;
  line-height: 1.6;
}

/* Tags */
.char-profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.char-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f3f4f7;
  border: 1px solid #e8eaef;
  font-size: 11px;
}
.char-tag-key {
  color: var(--muted);
  font-weight: 700;
}
.char-tag-val {
  color: #374151;
  font-weight: 600;
}

/* Evolution timeline */
.char-evolution {
  border-top: 1px solid rgba(101,88,245,0.08);
  padding-top: 10px;
}
.char-evolution-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  cursor: pointer;
  padding: 6px 0;
  font-size: 12px;
  font-weight: 700;
  color: #5141d8;
  user-select: none;
}
.char-evolution-toggle::-webkit-details-marker { display: none; }
.char-evolution-toggle::before {
  content: "▸ ";
  font-size: 10px;
  transition: transform 0.16s;
}
details[open] .char-evolution-toggle::before {
  content: "▾ ";
}
.char-evolution-count {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.char-evolution-timeline {
  display: grid;
  gap: 0;
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid rgba(101,88,245,0.15);
}
.char-timeline-node {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 0;
  position: relative;
}
.char-timeline-marker {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(101,88,245,0.5);
  margin-top: 5px;
  margin-left: -5px;
  flex-shrink: 0;
}
.char-timeline-body {
  min-width: 0;
  display: grid;
  gap: 5px;
}
.char-timeline-head {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.char-timeline-text {
  font-size: 12px;
  color: #4a5568;
  line-height: 1.6;
}

/* Raw toggle */
.char-raw-toggle {
  border-top: 1px solid #eceff3;
  padding-top: 8px;
}
.char-raw-toggle summary {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 4px 0;
}
.char-raw-toggle summary::-webkit-details-marker { display: none; }
.char-raw-body {
  margin-top: 8px;
  font-size: 12px;
  color: #4a5568;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #eceff3;
  max-height: 260px;
  overflow-y: auto;
}

/* Empty state */
.chars-empty {
  text-align: center;
  padding: 60px 24px;
  background: #fff;
  border-radius: 24px;
  border: 1px dashed rgba(101,88,245,0.2);
  box-shadow: 0 8px 28px rgba(15,23,42,0.04);
}
.chars-empty-icon {
  font-size: 36px;
  margin-bottom: 16px;
  color: rgba(101,88,245,0.4);
}
.chars-empty h2 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 800;
  color: #15213a;
}
.chars-empty p {
  margin: 0 auto 24px;
  max-width: 520px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--muted);
}
.chars-empty-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.chars-action-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  background: #fff;
  color: #30374a;
  border: 1px solid #dfe4ed;
  text-decoration: none;
  transition: background 0.14s, box-shadow 0.14s;
}
.chars-action-btn:hover {
  background: #f8f9fc;
  box-shadow: 0 4px 14px rgba(15,23,42,0.08);
}
.chars-action-btn--primary {
  background: var(--purple);
  color: #fff;
  border-color: transparent;
}
.chars-action-btn--primary:hover {
  background: var(--purple-2);
}

@media (max-width: 900px) {
  .chars-header {
    grid-template-columns: 1fr;
  }
  .chars-header-stats {
    flex-direction: row;
    flex-wrap: wrap;
  }
}
@media (max-width: 640px) {
  .chars-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════
   WriteClaw Identity System — 2026-03-13b
   Warm writing-studio atmosphere + new pages
   ═══════════════════════════════════════ */

:root {
  --amber: #c07a10;
  --amber-2: #e0930e;
  --ink: #1a1928;
  --paper: #fefcf5;
  --paper-2: #faf7ec;
}

/* Body — warm parchment studio */
body.console-body {
  background:
    radial-gradient(ellipse at 18% 0%, rgba(192,122,16,0.07), transparent 38%),
    radial-gradient(ellipse at 84% 5%, rgba(101,88,245,0.09), transparent 32%),
    radial-gradient(ellipse at 50% 100%, rgba(59,130,246,0.05), transparent 40%),
    linear-gradient(180deg, #f3f1eb 0%, #edeae0 40%, #efece4 100%);
}

/* Manuscript paper — genuine book-page feel */
.ws-paper {
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%) !important;
  border-color: rgba(178,145,76,0.18) !important;
  box-shadow: 0 2px 0 rgba(255,255,255,0.88), 0 28px 60px rgba(22,15,6,0.12), 0 0 0 1px rgba(255,255,255,0.55) !important;
}
.ws-paper-title { color: var(--ink) !important; letter-spacing: -0.01em; }
.ws-paper-body { font-size: 15.5px !important; line-height: 2.02 !important; color: #28251e !important; }

/* Page headers — atmospheric */
.ws-shell-head {
  background:
    radial-gradient(circle at 4% 65%, rgba(192,122,16,0.1), transparent 30%),
    radial-gradient(circle at top right, rgba(101,88,245,0.18), transparent 32%),
    linear-gradient(135deg, #f2efff 0%, #f8f5ff 52%, #eef4ff 100%) !important;
}
.ws-shell-head--studio {
  background:
    radial-gradient(circle at 4% 70%, rgba(192,122,16,0.12), transparent 32%),
    radial-gradient(circle at top right, rgba(101,88,245,0.14), transparent 30%),
    linear-gradient(135deg, #fdf9f0 0%, #f8f5ff 100%) !important;
}

/* Kickers — amber accent = WriteClaw identity */
.ws-shell-kicker,
.ws-section-kicker,
.chat-side-kicker,
.chat-thread-kicker { color: var(--amber) !important; }

/* Rails — warm parchment */
.ws-manuscript-rail,
.ws-memory-zones {
  background: linear-gradient(180deg, #fefcf6 0%, #faf8f0 100%) !important;
  border-color: rgba(188,152,82,0.16) !important;
}

/* Chapter active — amber highlight */
.ws-root .chapter-rail-item.is-active {
  border-color: rgba(210,140,40,0.28) !important;
  box-shadow: 0 10px 30px rgba(178,116,22,0.14) !important;
  background: linear-gradient(180deg, #fff9f0 0%, #fff5e2 100%) !important;
}

/* Reader stage warmer */
.ws-reader-stage-v2 { background: linear-gradient(180deg, #faf8f0 0%, #ffffff 100%) !important; }
.ws-reader-stage-v2::before {
  background:
    linear-gradient(180deg, rgba(255,252,242,0.5) 0%, transparent 22%),
    radial-gradient(ellipse at top right, rgba(192,122,16,0.05), transparent 32%) !important;
}

/* Empty state — inviting */
.ws-empty-note {
  background: linear-gradient(135deg, #fefcf8 0%, #f4f1ff 100%);
  border: 1px dashed rgba(140,116,200,0.3);
  border-radius: 20px;
  padding: 34px 26px;
  text-align: center;
  color: #6e7488;
  font-size: 14px;
  line-height: 1.82;
}

/* Shell stats */
.ws-shell-stat {
  background: linear-gradient(135deg, rgba(255,255,255,0.88) 0%, rgba(246,242,255,0.92) 100%) !important;
  border-color: rgba(101,88,245,0.11) !important;
}

/* pg- cards warmer */
.pg-card {
  background: linear-gradient(180deg, #ffffff 0%, #fdf9f3 100%) !important;
  border-color: rgba(39,54,88,0.07) !important;
  box-shadow: 0 8px 26px rgba(15,23,42,0.05) !important;
}
.pg-card-head {
  background: linear-gradient(180deg, rgba(254,252,248,1) 0%, rgba(255,255,255,0) 100%) !important;
  border-bottom-color: rgba(39,54,88,0.06) !important;
}
.pg-stats {
  background: linear-gradient(180deg, #fefcf8 0%, #fdf9f0 100%) !important;
  border-color: rgba(188,152,82,0.14) !important;
}

/* World cards */
.world-entry-card {
  background: linear-gradient(180deg, #fffcf7 0%, #fdfaf3 100%) !important;
  border-color: rgba(178,145,76,0.14) !important;
}

/* Accordion */
.ws-accordion-item { border-color: rgba(178,145,76,0.1) !important; }

/* Active nav — left accent stripe */
.console-nav-item.is-active {
  box-shadow: inset 3px 0 0 rgba(185,170,255,0.72), 0 8px 20px rgba(12,20,44,0.24) !important;
}

/* Brand logo — crisp */
.console-brand-logo {
  background: linear-gradient(138deg, #4e3ed4 0%, #2488f2 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.24), 0 4px 12px rgba(78,62,212,0.38) !important;
  font-weight: 900 !important;
  letter-spacing: -0.04em !important;
}

/* Chat cards — warm dual-tone */
.chat-hero-card {
  background:
    radial-gradient(circle at top right, rgba(101,88,245,0.08), transparent 30%),
    radial-gradient(circle at bottom left, rgba(192,122,16,0.06), transparent 32%),
    linear-gradient(135deg, #f5f2ff 0%, #fdfaf3 100%);
}
.chat-side-card--hero {
  background:
    radial-gradient(circle at 8% 95%, rgba(192,122,16,0.08), transparent 30%),
    radial-gradient(circle at top right, rgba(15,118,110,0.1), transparent 36%),
    linear-gradient(135deg, rgba(255,253,248,0.98) 0%, rgba(247,250,255,0.98) 100%) !important;
}
.console-focus-card { border-color: rgba(176,158,255,0.18) !important; }

/* ── Style Guide page ── */
.style-root { display: grid; gap: 22px; }
.style-header {
  position: relative; overflow: hidden; border-radius: 32px; padding: 22px 24px;
  background:
    radial-gradient(circle at 4% 70%, rgba(192,122,16,0.12), transparent 32%),
    radial-gradient(circle at top right, rgba(101,88,245,0.16), transparent 30%),
    linear-gradient(135deg, #fdf9f0 0%, #f4f0ff 52%, #ecf4ff 100%);
  border: 1px solid rgba(39,54,88,0.08);
  box-shadow: 0 22px 52px rgba(37,48,91,0.1);
  display: grid; grid-template-columns: minmax(0,1fr) minmax(260px,360px); gap: 18px; align-items: start;
}
.style-header-copy { position: relative; z-index: 1; display: grid; gap: 10px; }
.style-header-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 2px;
}
.style-header h1 { margin: 0; font-size: clamp(28px,3vw,40px); line-height: 1.08; color: var(--ink); letter-spacing: -0.02em; }
.style-header p { margin: 8px 0 0; font-size: 14px; line-height: 1.8; color: #5c6880; }
.style-header-stats {
  display: grid; grid-template-columns: repeat(2,minmax(100px,1fr)); gap: 10px; align-self: stretch;
}
.style-stat-pill {
  border-radius: 18px; padding: 14px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.86) 0%, rgba(244,241,255,0.92) 100%);
  border: 1px solid rgba(101,88,245,0.11); display: grid; gap: 5px;
}
.style-stat-pill span { font-size: 11px; color: #7a869b; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.style-stat-pill strong { font-size: 22px; line-height: 1; color: var(--ink); }
.style-body-grid { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(300px,1fr); gap: 20px; align-items: start; }
.style-summary-card,
.style-tags-card {
  border-radius: 28px; overflow: hidden;
  border: 1px solid rgba(39,54,88,0.08);
  background: linear-gradient(180deg, #ffffff 0%, #fdf9f3 100%);
  box-shadow: 0 14px 36px rgba(15,23,42,0.06);
}
.style-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 20px 14px;
  background: linear-gradient(180deg, rgba(254,252,248,1) 0%, rgba(255,255,255,0) 100%);
  border-bottom: 1px solid rgba(39,54,88,0.06);
}
.style-card-head h2 { margin: 0; font-size: 15px; font-weight: 800; }
.style-card-badge {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: rgba(101,88,245,0.1); color: var(--purple); font-weight: 800;
}
.style-card-body { padding: 18px 20px 22px; display: grid; gap: 14px; }
.style-summary-text { font-size: 14.5px; line-height: 1.9; color: #2e2b26; white-space: pre-wrap; word-break: break-word; }
.style-tags-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.style-tag-chip {
  display: inline-flex; align-items: center; padding: 5px 13px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(101,88,245,0.09) 0%, rgba(59,130,246,0.07) 100%);
  border: 1px solid rgba(101,88,245,0.14); color: #4054a8; font-size: 12px; font-weight: 700;
}
.style-questions-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.style-questions-list li {
  padding: 10px 14px; border-radius: 12px;
  border-left: 3px solid rgba(192,122,16,0.42);
  background: linear-gradient(135deg, rgba(254,252,248,1) 0%, rgba(252,249,242,1) 100%);
  font-size: 13.5px; line-height: 1.7; color: #2e2b26;
}
.style-empty-note {
  text-align: center; padding: 28px 20px;
  background: linear-gradient(135deg, #fefcf8 0%, #f4f1ff 100%);
  border: 1px dashed rgba(140,116,200,0.3); border-radius: 16px;
  color: #7a7f92; font-size: 13.5px; line-height: 1.8;
}
.style-edit-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 10px;
  border: 1px solid rgba(101,88,245,0.2); background: rgba(101,88,245,0.06);
  color: var(--purple); font-size: 12px; font-weight: 700; cursor: pointer;
  transition: background 0.12s, transform 0.12s;
}
.style-edit-btn:hover { background: rgba(101,88,245,0.12); transform: translateY(-1px); }

/* ── World page header ── */
.world-header {
  position: relative; overflow: hidden; border-radius: 32px; padding: 22px 24px;
  background:
    radial-gradient(circle at 4% 70%, rgba(192,122,16,0.1), transparent 32%),
    radial-gradient(circle at top right, rgba(59,130,246,0.14), transparent 30%),
    linear-gradient(135deg, #fdf9f0 0%, #eef4ff 100%);
  border: 1px solid rgba(39,54,88,0.08);
  box-shadow: 0 22px 52px rgba(37,48,91,0.1);
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px; align-items: center;
  margin-bottom: 22px;
}
.world-header-kicker {
  font-size: 11px; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--amber); margin-bottom: 8px;
}
.world-header h1 { margin: 0; font-size: clamp(26px,2.8vw,38px); line-height: 1.1; color: var(--ink); letter-spacing: -0.02em; }
.world-header p { margin: 8px 0 0; font-size: 14px; line-height: 1.8; color: #5c6880; }
.world-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Chat detail page ── */
.chat-detail-root { display: grid; gap: 20px; }
.chat-detail-header {
  position: relative; overflow: hidden; border-radius: 32px; padding: 22px 24px;
  background:
    radial-gradient(circle at 4% 60%, rgba(192,122,16,0.1), transparent 30%),
    radial-gradient(circle at top right, rgba(101,88,245,0.18), transparent 32%),
    linear-gradient(135deg, #f2efff 0%, #f8f5ff 52%, #fdf9f0 100%);
  border: 1px solid rgba(39,54,88,0.08);
  box-shadow: 0 22px 52px rgba(37,48,91,0.1);
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px; align-items: start;
}
.chat-detail-kicker {
  font-size: 11px; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--amber); margin-bottom: 8px;
}
.chat-detail-header h1 { margin: 0; font-size: clamp(24px,2.6vw,36px); line-height: 1.1; color: var(--ink); letter-spacing: -0.02em; }
.chat-detail-header p { margin: 8px 0 0; font-size: 14px; line-height: 1.78; color: #5c6880; }
.chat-detail-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.chat-detail-grid { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: 20px; align-items: start; }
.chat-detail-main { display: grid; gap: 16px; }
.chat-detail-side { display: grid; gap: 16px; position: sticky; top: 24px; }
.chat-brief-card {
  border-radius: 24px; overflow: hidden;
  border: 1px solid rgba(39,54,88,0.08);
  background: linear-gradient(180deg, #ffffff 0%, #fdf9f3 100%);
  box-shadow: 0 14px 36px rgba(15,23,42,0.06);
}
.chat-brief-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px 12px;
  background: linear-gradient(180deg, rgba(254,252,248,1) 0%, rgba(255,255,255,0) 100%);
  border-bottom: 1px solid rgba(39,54,88,0.06);
}
.chat-brief-head h3 { margin: 0; font-size: 14px; font-weight: 800; }
.chat-brief-body { padding: 16px 18px; }
.chat-brief-text {
  font-size: 14px; line-height: 1.85; color: #2e2b26; white-space: pre-wrap;
  word-break: break-word;
}
.chat-brief-empty { font-size: 13.5px; color: #9aa0b4; font-style: italic; }
.chat-stat-pill {
  border-radius: 14px; padding: 12px 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.88) 0%, rgba(246,242,255,0.92) 100%);
  border: 1px solid rgba(101,88,245,0.1); display: grid; gap: 4px;
}
.chat-stat-pill span { font-size: 11px; color: #7a869b; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.chat-stat-pill strong { font-size: 18px; line-height: 1; color: var(--ink); }

/* Editable field widget */
.inline-edit-wrap { position: relative; }
.inline-edit-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 9px;
  border: 1px solid rgba(101,88,245,0.2); background: rgba(101,88,245,0.06);
  color: var(--purple); font-size: 11px; font-weight: 700; cursor: pointer;
  transition: background 0.12s, transform 0.12s;
}
.inline-edit-btn:hover { background: rgba(101,88,245,0.13); transform: translateY(-1px); }
.inline-edit-form { display: none; margin-top: 10px; }
.inline-edit-form.is-open { display: grid; gap: 8px; }
.inline-edit-form textarea {
  width: 100%; border: 1px solid rgba(101,88,245,0.22); border-radius: 12px;
  padding: 10px 12px; background: rgba(250,248,255,0.9); font-size: 14px; line-height: 1.75;
  resize: vertical; min-height: 80px;
}
.inline-edit-actions { display: flex; gap: 8px; justify-content: flex-end; }
.inline-save-btn {
  padding: 7px 16px; border-radius: 10px; border: 0;
  background: var(--purple); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer;
}
.inline-cancel-btn {
  padding: 7px 14px; border-radius: 10px;
  border: 1px solid #dde2ea; background: #fff; color: #4a5568; font-size: 12px; font-weight: 700; cursor: pointer;
}
.inline-status { font-size: 12px; color: var(--muted); }
.inline-status.ok { color: #2a7a50; }
.inline-status.err { color: #b42318; }

/* Craft editor surfaces */
.craft-page {
  display: grid;
  gap: 20px;
}
.craft-page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}
.craft-page-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(40,56,86,0.08);
  background: rgba(255,255,255,0.78);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7f6751;
}
.craft-page-copy {
  display: grid;
  gap: 10px;
}
.craft-page-copy h1 {
  margin: 0;
  font-size: clamp(30px, 3vw, 46px);
  line-height: 1.04;
  color: #182133;
}
.craft-page-copy p {
  margin: 0;
  max-width: 880px;
  color: #5e6980;
  line-height: 1.7;
}
.craft-page-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.craft-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.craft-stat-card {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(40,56,86,0.08);
  background: linear-gradient(145deg, rgba(255,255,255,0.98) 0%, rgba(246,249,255,0.94) 100%);
}
.craft-stat-card span {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7a869b;
}
.craft-stat-card strong {
  font-size: 22px;
  line-height: 1;
  color: #182133;
}
.craft-grid {
  display: grid;
  gap: 20px;
}
.craft-grid-two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.craft-grid-aside {
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
  align-items: start;
}
.craft-side-stack,
.craft-editor-stack {
  display: grid;
  gap: 16px;
}
.craft-panel-body {
  display: grid;
  gap: 16px;
}
.craft-summary-block {
  padding: 18px 20px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(250,251,255,0.95) 0%, rgba(244,248,255,0.92) 100%);
  border: 1px solid rgba(40,56,86,0.08);
  color: #243044;
  line-height: 1.78;
  white-space: pre-wrap;
}
.craft-chip-block,
.craft-list-block {
  display: grid;
  gap: 10px;
}
.craft-subhead {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7a869b;
}
.craft-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.craft-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(21,112,239,0.08);
  border: 1px solid rgba(21,112,239,0.14);
  color: #1552b0;
  font-size: 12px;
  font-weight: 700;
}
.craft-note-list {
  display: grid;
  gap: 10px;
}
.craft-note-item,
.craft-empty-banner,
.craft-empty-state {
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(40,56,86,0.08);
  background: rgba(255,255,255,0.86);
  color: #243044;
  line-height: 1.7;
}
.craft-empty-banner,
.craft-empty-state {
  display: grid;
  gap: 6px;
}
.craft-empty-banner p,
.craft-empty-state p {
  margin: 0;
  color: #5e6980;
}
.craft-muted {
  color: #7a869b;
  line-height: 1.7;
}
.craft-editor-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(40,56,86,0.08);
  background: #f8fafc;
}
.craft-editor-head {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: start;
}
.craft-editor-head strong {
  color: #182133;
}
.craft-editor-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: #68748c;
  line-height: 1.6;
}
.craft-mini-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(15,159,123,0.1);
  color: #0c7a5d;
  font-size: 11px;
  font-weight: 800;
}
.craft-form {
  display: grid;
  gap: 12px;
}
.craft-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.craft-form input[type="text"],
.craft-form select,
.craft-form textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(40,56,86,0.14);
  background: rgba(255,255,255,0.92);
  padding: 11px 13px;
  color: #172133;
  resize: vertical;
}
.craft-form textarea {
  min-height: 110px;
  line-height: 1.65;
}
.craft-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.craft-form-status {
  min-height: 20px;
  font-size: 12px;
  color: #667085;
}
.craft-form-status.is-ok {
  color: #0c7a5d;
}
.craft-form-status.is-error {
  color: #b42318;
}
.craft-inline-details {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(40,56,86,0.08);
}
.craft-inline-details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: #1552b0;
}
.craft-beat-card {
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(40,56,86,0.08);
}
.craft-beat-body {
  display: grid;
  gap: 8px;
}

/* Scrollbar — brand tint */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(101,88,245,0.18); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(101,88,245,0.32); }

@media (max-width: 900px) {
  .craft-page-header,
  .craft-grid-two,
  .craft-grid-aside {
    grid-template-columns: 1fr;
  }
  .craft-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .craft-form-grid {
    grid-template-columns: 1fr;
  }
  .craft-page-actions {
    justify-content: flex-start;
  }
  .style-header, .style-body-grid,
  .chat-detail-grid { grid-template-columns: 1fr; }
  .style-header-stats { grid-template-columns: repeat(2,1fr); }
  .world-header { grid-template-columns: 1fr; }
  .chat-detail-side { position: static; }
}

/* ── Characters page: add amber accent to avatar ── */
.char-profile-avatar {
  background: linear-gradient(138deg, #4e3ed4 0%, #8856e8 100%) !important;
  box-shadow: 0 4px 12px rgba(78,62,212,0.3) !important;
  font-size: 15px !important;
  font-weight: 900 !important;
  letter-spacing: -0.02em !important;
}
.char-profile-name { color: var(--ink, #1a1928) !important; letter-spacing: -0.01em; }
.char-chapter-badge { background: rgba(192,122,16,0.12) !important; color: var(--amber, #c07a10) !important; border-color: rgba(192,122,16,0.2) !important; }
.char-live-dot { background: var(--amber, #c07a10) !important; }
@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192,122,16,0.4); }
  50% { box-shadow: 0 0 0 5px rgba(192,122,16,0); }
}
.char-live-dot { animation: pulse-amber 1.8s ease-in-out infinite !important; }

/* ── Chat input textarea focus ── */
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: rgba(101,88,245,0.4) !important;
  box-shadow: 0 0 0 3px rgba(101,88,245,0.1) !important;
}

/* ── Storyboard pg-stats warmer ── */
.pg-stat-value.pg-stat-value-project {
  font-size: 14px !important;
  font-weight: 700 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Chat brief block typography ── */
.chat-brief-block {
  font-size: 14px;
  line-height: 1.82;
  color: #2e2b26;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Chat hero kicker amber ── */
.chat-hero-kicker {
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
  color: var(--amber, #c07a10) !important;
}
.chat-hero-card h1 {
  font-size: clamp(24px, 2.6vw, 36px) !important;
  letter-spacing: -0.02em !important;
  color: var(--ink, #1a1928) !important;
}

/* ── Memory bank chip warmer ── */
.mem-bank-chip.has-data { border-color: rgba(192,122,16,0.2) !important; }

/* ── pg-link-btn style ── */
.pg-link-btn {
  display: inline-flex; align-items: center;
  padding: 8px 16px; border-radius: 10px; font-size: 13px; font-weight: 700;
  background: rgba(255,255,255,0.82); color: #30374a;
  border: 1px solid rgba(39,54,88,0.12);
  transition: background 0.12s, transform 0.12s;
}
.pg-link-btn:hover { background: rgba(255,255,255,0.96); transform: translateY(-1px); }
.pg-link-btn.primary { background: var(--purple); color: #fff; border-color: transparent; }

/* =================================================================
   PANEL HARMONY — 2026-03-13c
   Resolves floating-card isolation across all console pages.
   Two-column layouts sit inside a unified parchment-glass frame —
   no more orphaned cards floating on raw parchment background.
   ================================================================= */

/* ── Outer frame: manuscript & memory two-column grids ─────────── */
.ws-manuscript-shell-v2,
.ws-memory-shell-v2 {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(192,122,16,0.055), transparent 42%),
    linear-gradient(180deg, rgba(255,253,248,0.72) 0%, rgba(250,246,238,0.62) 100%) !important;
  border-radius: 28px !important;
  padding: 12px !important;
  border: 1px solid rgba(192,154,88,0.16) !important;
  box-shadow: 0 8px 32px rgba(15,12,6,0.055), inset 0 1px 0 rgba(255,255,255,0.72) !important;
  gap: 12px !important;
}

/* ── Outer frame: dashboard chat grid ───────────────────────────── */
.chat-shell-grid--command {
  background:
    radial-gradient(ellipse at 6% 0%, rgba(192,122,16,0.05), transparent 38%),
    linear-gradient(180deg, rgba(255,253,248,0.66) 0%, rgba(250,246,238,0.56) 100%) !important;
  border-radius: 28px !important;
  padding: 12px !important;
  border: 1px solid rgba(192,154,88,0.14) !important;
  box-shadow: 0 8px 32px rgba(15,12,6,0.05), inset 0 1px 0 rgba(255,255,255,0.68) !important;
  gap: 12px !important;
}

/* ── Outer frame: storyboard grid ──────────────────────────────── */
.storyboard-page .sb-grid-fluid {
  background:
    radial-gradient(ellipse at 12% 0%, rgba(192,122,16,0.05), transparent 40%),
    linear-gradient(180deg, rgba(255,253,248,0.62) 0%, rgba(250,246,238,0.52) 100%) !important;
  border-radius: 28px !important;
  padding: 12px !important;
  border: 1px solid rgba(192,154,88,0.13) !important;
  box-shadow: 0 8px 32px rgba(15,12,6,0.04), inset 0 1px 0 rgba(255,255,255,0.65) !important;
  gap: 12px !important;
}

/* ── Inner panel shadows softer — frame provides the depth ─────── */
.ws-manuscript-shell-v2 .ws-card-panel,
.ws-memory-shell-v2 .ws-card-panel {
  box-shadow: 0 2px 14px rgba(37,48,91,0.055) !important;
}
.chat-shell-grid--command .chat-side-card,
.chat-shell-grid--command .chat-thread-card {
  box-shadow: 0 2px 14px rgba(37,48,91,0.05) !important;
}
.storyboard-page .sb-grid-fluid .pg-card {
  box-shadow: 0 2px 14px rgba(37,48,91,0.05) !important;
}

/* ── Left rails — warm amber-tinted navigation zone ─────────────── */
.ws-manuscript-rail,
.ws-memory-zones {
  background: linear-gradient(165deg, #fefaf2 0%, #faf4e6 55%, #f6f1f7 100%) !important;
  border-color: rgba(192,154,88,0.22) !important;
}

/* ── Chat side panel: warmer, lighter card tones inside frame ───── */
.chat-side-panel--command .chat-side-card {
  background: rgba(255,254,250,0.96) !important;
  border-color: rgba(185,152,78,0.13) !important;
}
.chat-side-panel--command .chat-side-card--empty {
  background: linear-gradient(163deg, rgba(255,253,248,0.98) 0%, rgba(246,243,255,0.94) 100%) !important;
}
.chat-side-panel--command .chat-side-card--hero {
  background:
    radial-gradient(circle at 8% 90%, rgba(192,122,16,0.07), transparent 30%),
    radial-gradient(circle at top right, rgba(15,118,110,0.07), transparent 36%),
    linear-gradient(135deg, rgba(255,253,248,0.98) 0%, rgba(247,250,255,0.97) 100%) !important;
}

/* ── Thread card inside dashboard frame ─────────────────────────── */
.chat-thread-card--command {
  background: rgba(255,254,250,0.97) !important;
  border-color: rgba(185,152,78,0.1) !important;
}

/* ── Composer docked: warm, connected to frame ──────────────────── */
.chat-composer-stack--docked .chat-input-form--floating {
  background: rgba(255,254,250,0.97) !important;
  border-color: rgba(185,152,78,0.13) !important;
}

/* ── Right content panels: clean warm white ─────────────────────── */
.ws-reader-stage-v2 {
  background: linear-gradient(180deg, #fffdf9 0%, #ffffff 50%) !important;
}
.ws-memory-context {
  background: linear-gradient(180deg, #fffdf9 0%, #fefcf9 40%, #ffffff 100%) !important;
}

/* ── Shell head stats: tighter, more integrated ─────────────────── */
.ws-shell-stats {
  align-self: center !important;
  gap: 8px !important;
}
.ws-shell-stat {
  padding: 10px 12px !important;
}
.ws-shell-stat strong {
  font-size: 20px !important;
}

/* ── Desktop-only column width rebalancing ──────────────────────── */
/* Wrapping in min-width preserves responsive 1fr collapse at ≤1240px */
@media (min-width: 1241px) {
  /* Manuscript left rail: 360 → 280px, chapter list doesn't need that width */
  .ws-manuscript-shell-v2 {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  /* Memory zones: tighten slightly for better content ratio */
  .ws-memory-shell-v2 {
    grid-template-columns: 300px minmax(0, 1fr);
  }
  /* Chat sidebar: 340 → 300px, give more room to conversation */
  .chat-shell-grid {
    grid-template-columns: 276px minmax(0, 1fr);
  }
  /* Shell head stats column: narrower — less visual weight on right */
  .ws-shell-head {
    grid-template-columns: minmax(0, 1fr) minmax(210px, 270px);
    gap: 20px;
  }
}

/* ── pg-stats bar: warm, cohesive with parchment bg ─────────────── */
.pg-stats-fluid {
  background: rgba(255,253,248,0.72) !important;
  border-color: rgba(192,154,88,0.14) !important;
  border-radius: 20px !important;
  box-shadow: 0 3px 16px rgba(15,12,6,0.04) !important;
}
.pg-stats-fluid .pg-stat:not(:last-child) {
  border-right-color: rgba(192,154,88,0.12) !important;
}
.pg-link-btn.primary:hover { opacity: 0.9; }

/* =================================================================
   EMPTY STATE REDESIGN — 2026-03-14a
   Replaces the cramped three-column card row with three full-width
   sections that each breathe properly and read clearly.
   ================================================================= */

/* ── Full-panel container (injected into #manuscript-empty) ─────── */
.ws-empty-v2 {
  padding: 20px;
  display: grid;
  gap: 16px;
  min-height: 600px;
  align-content: start;
}

/* ── Header section ─────────────────────────────────────────────── */
.ws-empty-v2-header {
  padding: 24px 26px;
  border-radius: 22px;
  display: grid;
  gap: 10px;
  background:
    radial-gradient(ellipse at top right, rgba(192,122,16,0.07), transparent 40%),
    linear-gradient(135deg, rgba(255,252,246,0.98) 0%, rgba(247,244,255,0.96) 100%);
  border: 1px solid rgba(192,154,88,0.13);
}
.ws-empty-v2-title {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1.1;
  color: var(--ink, #1a1928);
  letter-spacing: -0.02em;
}
.ws-empty-v2-desc {
  margin: 0;
  color: #5b6980;
  line-height: 1.75;
  font-size: 14px;
}

/* ── Three-row sections container ──────────────────────────────── */
.ws-empty-v2-sections {
  display: grid;
  gap: 10px;
}

/* ── Individual row ─────────────────────────────────────────────── */
.ws-empty-v2-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 0 18px;
  align-items: center;
  padding: 20px 22px;
  border-radius: 18px;
  border: 1px solid rgba(40,56,86,0.07);
  background: rgba(255,255,255,0.9);
  min-height: 86px;
  transition: background 0.14s, border-color 0.14s, box-shadow 0.14s;
}
.ws-empty-v2-row:hover {
  background: rgba(255,253,248,0.98);
  border-color: rgba(192,154,88,0.16);
  box-shadow: 0 4px 18px rgba(15,12,6,0.05);
}

/* ── Number badge ────────────────────────────────────────────────── */
.ws-empty-v2-row-num {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--amber, #c07a10);
  background: rgba(192,122,16,0.08);
  border: 1px solid rgba(192,122,16,0.14);
  flex-shrink: 0;
}

/* ── Text body ──────────────────────────────────────────────────── */
.ws-empty-v2-row-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.ws-empty-v2-row-title {
  font-size: 16px;
  font-weight: 700;
  color: #182133;
  line-height: 1.3;
}
.ws-empty-v2-row-desc {
  margin: 0;
  font-size: 13px;
  color: #66748c;
  line-height: 1.6;
}

/* ── Status chip ────────────────────────────────────────────────── */
.ws-empty-v2-row-chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(232,230,248,0.9);
  border: 1px solid rgba(101,88,245,0.12);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #6558f5;
  white-space: nowrap;
  text-transform: uppercase;
}
.ws-empty-v2-row-chip--ok {
  background: rgba(230,248,234,0.9);
  border-color: rgba(22,163,74,0.14);
  color: #16a34a;
}

/* ── Keep ws-stage-empty-kicker reused inside v2 header ─────────── */
.ws-empty-v2-header .ws-stage-empty-kicker {
  color: var(--amber, #c07a10) !important;
  background: rgba(192,122,16,0.07) !important;
  border-color: rgba(192,122,16,0.12) !important;
}

/* ── Ensure manuscript-empty fills the reader stage properly ─────── */
#manuscript-empty:not(.hidden) {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  padding: 28px;
  position: relative;
  z-index: 1;
}

/* =================================================================
   SIDEBAR RESTRUCTURE — 2026-03-14b
   Sub-pages now always visible in sidebar under their group label.
   Sub-items (console-nav-item-sub) styled with left indent + connector.
   Empty state rows are clickable links.
   ================================================================= */

/* ── Sub-nav items: indent + connector line ─────────────────────── */
.console-nav-item-sub {
  padding-left: 28px !important;
  position: relative;
}
.console-nav-item-sub::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 1px;
  background: rgba(255,255,255,0.22);
  border-radius: 1px;
}
.console-nav-item-sub .console-nav-icon {
  font-size: 10px !important;
  opacity: 0.7;
  min-width: 22px !important;
}
.console-nav-item-sub:not(.is-active) {
  opacity: 0.82;
}
.console-nav-item-sub.is-active {
  opacity: 1;
}

/* ── Empty state rows as links ──────────────────────────────────── */
.ws-empty-v2-row--link {
  display: grid;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.ws-empty-v2-row--link:hover {
  background: rgba(255,252,245,0.98) !important;
  border-color: rgba(192,122,16,0.2) !important;
  box-shadow: 0 6px 22px rgba(15,12,6,0.07) !important;
  transform: translateY(-1px);
}
.ws-empty-v2-row--link:hover .ws-empty-v2-row-chip {
  background: rgba(192,122,16,0.12) !important;
  border-color: rgba(192,122,16,0.2) !important;
  color: var(--amber, #c07a10) !important;
}
.ws-empty-v2-row--link {
  transition: background 0.14s, border-color 0.14s, box-shadow 0.14s, transform 0.14s;
}

/* ═══════════════════════════════════════════════════════════════════
   v20260314d — Kicker corrections, no-rail, memory top-tab layout
   ═══════════════════════════════════════════════════════════════════ */

/* ── Outline / Planning: no chapter rail → single-column shell ── */
.ws-manuscript-shell-v2--no-rail {
  grid-template-columns: 1fr !important;
}

/* ── Memory: top-tab zone bar layout ──────────────────────────── */
.ws-memory-shell-v2--tabs {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
}

/* Tab bar container */
.ws-memory-zones--tabbar {
  width: 100% !important;
  min-height: 0 !important;
  padding: 14px 18px 10px !important;
  border-radius: 18px !important;
}

/* Topbar: label + tabs + refresh button in a row */
.ws-memory-zones-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ws-memory-zones-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--amber, #c07a10);
  white-space: nowrap;
  opacity: 0.85;
  flex-shrink: 0;
}

/* Memory group list → horizontal scrolling tab strip */
.ws-memory-shell-v2--tabs .memory-group-list {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  flex: 1 1 0;
  min-width: 0;
}

/* Make each zone card a compact horizontal tab */
.ws-memory-shell-v2--tabs .memory-group-list .memory-group-card {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 7px 14px !important;
  border-radius: 24px !important;
  border: 1px solid rgba(192,122,16,0.14) !important;
  background: rgba(255,252,248,0.7) !important;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
  text-align: left;
}
.ws-memory-shell-v2--tabs .memory-group-list .memory-group-card:hover {
  background: rgba(255,252,248,0.98) !important;
  border-color: rgba(192,122,16,0.28) !important;
}
.ws-memory-shell-v2--tabs .memory-group-list .memory-group-card.is-active {
  background: rgba(192,122,16,0.1) !important;
  border-color: rgba(192,122,16,0.36) !important;
  box-shadow: 0 2px 8px rgba(192,122,16,0.12) !important;
}

/* Inner layout of each tab (dot + copy) */
.ws-memory-shell-v2--tabs .memory-group-card-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ws-memory-shell-v2--tabs .memory-group-dot {
  width: 8px !important;
  height: 8px !important;
  border-radius: 50% !important;
  flex-shrink: 0;
}
.ws-memory-shell-v2--tabs .memory-group-copy {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.ws-memory-shell-v2--tabs .memory-group-kicker {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink, #1a1928);
}
.ws-memory-shell-v2--tabs .memory-group-copy > strong {
  display: none !important; /* hide verbose description in tab mode */
}
.ws-memory-shell-v2--tabs .memory-group-meta {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ws-memory-shell-v2--tabs .memory-group-count-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  line-height: 1.5;
}
.ws-memory-shell-v2--tabs .memory-group-meta > span:last-child {
  display: none !important; /* hide "entries" label in compact tab */
}

/* Zone desc shown as a small subtitle line below the tab bar */
.ws-memory-zone-desc-bar {
  margin-top: 6px !important;
  font-size: 12px !important;
  color: rgba(26,25,40,0.5) !important;
  min-height: 0 !important;
}
.ws-memory-zone-desc-bar:empty {
  display: none !important;
}

/* Content area takes full width in tab mode */
.ws-memory-shell-v2--tabs .ws-memory-context {
  width: 100% !important;
  min-width: 0 !important;
}
.ws-memory-shell-v2--tabs .ws-memory-workbench,
.ws-memory-shell-v2--tabs .ws-memory-workbench-2 {
  width: 100% !important;
}

/* ═══════════════════════════════════════════════════════════════════
   v20260314e — Compact empty state, memory redesign, no-redundancy
   ═══════════════════════════════════════════════════════════════════ */

/* ── Compact manuscript empty state (page-aware) ──────────────── */
.ws-empty-compact {
  width: min(100%, 760px);
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 30px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 260px;
  justify-content: center;
  align-items: center;
  text-align: center;
  border: 1px solid rgba(192,122,16,0.16);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(255,252,248,0.92) 100%);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.06);
}
.ws-empty-compact-note {
  max-width: 34ch;
  font-size: 16px;
  color: rgba(26,25,40,0.62);
  margin: 0;
  line-height: 1.8;
}
.ws-empty-compact-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.ws-empty-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 20px;
  border: 1px solid rgba(192,122,16,0.18);
  background: rgba(255,252,248,0.85);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink, #1a1928);
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}
.ws-empty-nav-link:hover {
  background: rgba(255,252,248,1);
  border-color: rgba(192,122,16,0.32);
  transform: translateY(-1px);
}
.ws-empty-nav-link > span {
  font-size: 11px;
  color: var(--amber, #c07a10);
  font-weight: 700;
}

/* ── Memory Banks page: clean bank-card grid ─────────────────── */
.mem-banks-content {
  padding: 18px 20px !important;
}
.mem-banks-zone-info {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(192,122,16,0.1);
  min-height: 24px;
}
.mem-banks-zone-info:empty,
.mem-banks-zone-title:empty + .mem-banks-zone-count {
  display: none;
}
.mem-banks-zone-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink, #1a1928);
}
.mem-banks-zone-title:empty ~ * { opacity: 0.4; }
.mem-banks-zone-count {
  font-size: 12px;
  color: rgba(26,25,40,0.45);
}
.mem-banks-zone-subdesc {
  width: 100%;
  font-size: 12px;
  color: rgba(26,25,40,0.45);
  margin: 2px 0 0;
  line-height: 1.5;
}
.mem-banks-zone-subdesc:empty { display: none; }

/* Bank detail cards in a responsive grid */
.mem-bank-detail-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
  gap: 10px !important;
}

/* Override base detail card style for the new grid context */
.mem-bank-detail-grid .memory-bank-detail-card {
  background: rgba(255,252,248,0.85) !important;
  border-color: rgba(192,122,16,0.1) !important;
  border-radius: 14px !important;
  padding: 14px 16px !important;
  gap: 6px !important;
}
.mem-bank-detail-grid .memory-bank-detail-card:hover {
  border-color: rgba(192,122,16,0.24) !important;
  background: rgba(255,252,248,1) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15,12,6,0.07) !important;
}
.mem-bank-detail-grid .memory-bank-detail-card.is-active {
  border-color: rgba(192,122,16,0.36) !important;
  background: rgba(192,122,16,0.06) !important;
  box-shadow: 0 4px 14px rgba(192,122,16,0.1) !important;
}
.mem-bank-detail-grid .memory-bank-detail-head strong {
  font-size: 13px;
  color: var(--ink, #1a1928);
}
.mem-bank-detail-grid .memory-bank-detail-body {
  font-size: 12px !important;
  color: rgba(26,25,40,0.55) !important;
  line-height: 1.55 !important;
}
.mem-bank-detail-grid .memory-bank-detail-meta {
  font-size: 11px !important;
  gap: 6px !important;
  margin-top: 2px;
}

/* ── Memory Entries page: bank selector strip ────────────────── */
.mem-bank-selector-panel {
  padding: 12px 18px 10px !important;
}
.mem-bank-selector-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.mem-bank-selector-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(26,25,40,0.35);
  flex-shrink: 0;
}
/* Compact bank chips in entries page */
.mem-bank-chips {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
}
.mem-bank-chips .memory-bank-card {
  padding: 5px 12px !important;
  border-radius: 20px !important;
  border: 1px solid rgba(192,122,16,0.12) !important;
  background: rgba(255,252,248,0.7) !important;
  font-size: 12px !important;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.mem-bank-chips .memory-bank-card:hover {
  background: rgba(255,252,248,1) !important;
  border-color: rgba(192,122,16,0.26) !important;
}
.mem-bank-chips .memory-bank-card.is-active {
  background: rgba(192,122,16,0.09) !important;
  border-color: rgba(192,122,16,0.32) !important;
}
.mem-bank-chips .memory-bank-card-head {
  display: flex;
  align-items: center;
  gap: 5px;
}
.mem-bank-chips .memory-bank-card-head strong { font-size: 12px; }
.mem-bank-chips .memory-bank-card-desc,
.mem-bank-chips .memory-bank-card-preview { display: none !important; }

/* Active bank info bar */
.mem-bank-active-bar {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(26,25,40,0.5);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  min-height: 20px;
}
.mem-bank-active-bar strong {
  font-size: 12.5px;
  color: var(--ink, #1a1928);
}
.mem-sep { color: rgba(26,25,40,0.22); }
.mem-latest-text:empty + .mem-latest-sep,
.mem-latest-text:empty { display: none; }

/* Entries workspace: 2-column list + add form */
.mem-entries-workspace {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 1100px) {
  .mem-entries-workspace { grid-template-columns: 1fr; }
}
.mem-entries-list-card { padding: 16px !important; }
.mem-entries-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(26,25,40,0.4);
}
.mem-entries-add-card { padding: 18px 16px !important; }
.mem-entries-add-title {
  margin: 4px 0 14px;
  font-size: 14px;
}
.mem-zone-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.mem-zone-banks-card {
  padding: 18px 20px !important;
}
.mem-zone-banks-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.mem-zone-banks-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink, #1a1928);
}
.mem-zone-banks-desc {
  margin: 0 0 16px;
  max-width: 72ch;
  font-size: 14px;
  line-height: 1.65;
  color: rgba(26,25,40,0.72);
}
.mem-zone-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mem-zone-active-panel {
  padding: 16px 18px !important;
  border: 1px solid rgba(127, 151, 202, 0.18) !important;
  background:
    linear-gradient(135deg, rgba(247, 249, 255, 0.98), rgba(255, 252, 247, 0.96)) !important;
}
.mem-zone-active-head {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.9fr);
  gap: 16px;
  align-items: start;
}
.mem-zone-active-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.mem-zone-active-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber, #c07a10);
}
.mem-zone-active-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.mem-zone-active-row strong {
  font-size: 22px;
  line-height: 1.1;
  color: var(--ink, #1a1928);
}
.mem-zone-count-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(127, 151, 202, 0.12);
  color: rgba(26,25,40,0.7);
  font-size: 12px;
  font-weight: 600;
}
.mem-zone-bank-desc {
  margin: 0;
  max-width: 72ch;
  font-size: 13.5px;
  line-height: 1.65;
  color: rgba(26,25,40,0.58);
}
.mem-zone-latest {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 15px;
  min-height: 100%;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(127, 151, 202, 0.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}
.mem-zone-latest-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(26,25,40,0.38);
}
.mem-zone-latest-text {
  font-size: 13px;
  line-height: 1.65;
  color: rgba(26,25,40,0.68);
}
.mem-zone-impact-note {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(127, 151, 202, 0.18);
  background: rgba(255,255,255,0.72);
  font-size: 12.5px;
  line-height: 1.65;
  color: rgba(26,25,40,0.62);
}
.mem-zone-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.85fr);
  gap: 16px;
  align-items: start;
}
.mem-zone-side-stack {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 22px;
}
.mem-zone-entries-card {
  padding: 0 !important;
  overflow: hidden;
}
.mem-zone-entries-card .ws-entry-list {
  padding: 14px 16px 16px;
}
.mem-entries-list-head {
  margin-bottom: 0;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(127, 151, 202, 0.12);
}
.mem-zone-add-card {
  padding: 18px 16px !important;
}
.mem-zone-edit-card {
  padding: 18px 16px !important;
}
.mem-entries-add-note {
  margin: -6px 0 14px;
  font-size: 12.5px;
  line-height: 1.55;
  color: rgba(26,25,40,0.52);
}
.mem-zone-side-stack .ws-status-line {
  padding: 0 4px;
}
.mem-zone-empty-state {
  display: flex;
  min-height: 220px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  border: 1px dashed rgba(127, 151, 202, 0.22);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.9), rgba(255, 252, 247, 0.78));
  text-align: center;
}
.mem-zone-empty-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(26,25,40,0.36);
}
.mem-zone-empty-state strong {
  font-size: 18px;
  line-height: 1.25;
  color: var(--ink, #1a1928);
}
.mem-zone-empty-state p {
  margin: 0;
  max-width: 48ch;
  font-size: 13.5px;
  line-height: 1.65;
  color: rgba(26,25,40,0.56);
}
@media (max-width: 1100px) {
  .mem-zone-active-head {
    grid-template-columns: 1fr;
  }
  .mem-zone-workspace {
    grid-template-columns: 1fr;
  }
  .mem-zone-side-stack {
    position: static;
    top: auto;
  }
  .ws-panel-grid-outline:not(.ws-outline-layout) {
    grid-template-columns: 1fr;
  }
  .ws-panel-grid-outline .ws-stack {
    position: static;
    top: auto;
  }
  .ws-reader-stage-split {
    grid-template-columns: 1fr;
  }
}

/* v20260323 manuscript readability + chapter rail density */
@media (min-width: 1241px) {
  .ws-manuscript-shell-v2:not(.ws-manuscript-shell-v2--no-rail) {
    grid-template-columns: 360px minmax(0, 1fr) !important;
  }
  .ws-shell-head {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px) !important;
  }
}

.ws-reader-stage-v2 {
  min-height: 760px !important;
}

.ws-paper {
  width: min(100%, 1080px) !important;
  max-width: 1080px !important;
  padding: 42px 46px 54px !important;
}

.ws-paper-title {
  font-size: clamp(28px, 2.4vw, 38px) !important;
  line-height: 1.18 !important;
}

.ws-paper-body {
  font-size: 17px !important;
  line-height: 2.08 !important;
  min-height: 520px !important;
}

/* -----------------------------------------------------------------
   Outline / Planning workspace rebalance — 20260324c
   Make the right side behave like a real reading workspace instead
   of a large blank white board with a narrow utility strip.
   ----------------------------------------------------------------- */
@media (min-width: 1241px) {
  .ws-panel-grid-outline {
    grid-template-columns: minmax(320px, 360px) minmax(0, 1fr) !important;
    gap: 22px !important;
  }

  .ws-reader-stage-split {
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.82fr) !important;
    gap: 22px !important;
    align-items: stretch !important;
  }
}

.ws-panel-grid-outline .ws-stack {
  gap: 16px !important;
  align-content: start !important;
}

.ws-panel-grid-outline .ws-card-list {
  max-height: 420px !important;
}

.ws-panel-grid-outline .ws-accordion-item {
  border-radius: 20px !important;
  border: 1px solid rgba(184, 153, 101, 0.13) !important;
  box-shadow: 0 8px 22px rgba(24, 32, 57, 0.045) !important;
  overflow: hidden !important;
}

.ws-panel-grid-outline .ws-accordion-head {
  padding: 14px 16px !important;
  background: linear-gradient(180deg, rgba(249, 251, 255, 0.98), rgba(255, 252, 247, 0.96)) !important;
}

.ws-panel-grid-outline .ws-form {
  gap: 12px !important;
}

.ws-panel-grid-outline .ws-form input,
.ws-panel-grid-outline .ws-form textarea {
  border-radius: 14px !important;
  background: rgba(248, 250, 255, 0.84) !important;
}

.ws-panel-grid-outline .ws-form textarea {
  min-height: 180px !important;
}

.ws-panel-grid-outline .ws-planning-counts {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.ws-panel-grid-outline .ws-subcount-chip {
  justify-content: center !important;
  min-height: 38px !important;
  border-radius: 999px !important;
}

.ws-panel-grid-outline .manuscript-intel-card {
  border-radius: 18px !important;
}

.ws-panel-grid-outline .ws-reader-stage-v2 {
  min-height: 820px !important;
  border-radius: 28px !important;
  border: 1px solid rgba(193, 160, 103, 0.14) !important;
  background:
    radial-gradient(circle at top right, rgba(136, 154, 255, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(255, 253, 249, 0.98) 0%, rgba(255, 255, 255, 0.98) 52%) !important;
  box-shadow: 0 18px 42px rgba(28, 33, 52, 0.06) !important;
}

.ws-reader-main,
.ws-reader-main #manuscript-reader-shell,
.ws-reader-main #manuscript-planning-shell {
  display: grid !important;
  align-content: start !important;
  min-height: 100% !important;
}

.ws-reader-main .ws-paper {
  width: 100% !important;
  max-width: none !important;
  min-height: 100% !important;
  margin: 0 !important;
  padding: 34px 38px 40px !important;
  border-radius: 24px !important;
  border: 1px solid rgba(189, 155, 93, 0.12) !important;
  background:
    linear-gradient(180deg, rgba(255, 254, 251, 0.99) 0%, rgba(255, 255, 255, 0.99) 100%) !important;
  box-shadow: 0 10px 28px rgba(24, 32, 57, 0.05) !important;
}

.ws-panel-grid-outline .ws-paper-title {
  max-width: 24ch !important;
  margin-bottom: 18px !important;
}

.ws-panel-grid-outline .ws-paper-body {
  min-height: 640px !important;
  max-width: 78ch !important;
  font-size: 16px !important;
  line-height: 2 !important;
  color: #2b2a28 !important;
}

.ws-panel-grid-outline .ws-paper-body-muted {
  color: #6f6b63 !important;
  font-style: normal !important;
}

.ws-reader-side {
  display: grid !important;
  gap: 16px !important;
  align-content: start !important;
  position: sticky !important;
  top: 18px !important;
}

.ws-reader-side-card {
  border-radius: 22px !important;
  border: 1px solid rgba(120, 137, 201, 0.16) !important;
  background:
    linear-gradient(180deg, rgba(248, 250, 255, 0.98) 0%, rgba(255, 253, 248, 0.96) 100%) !important;
  box-shadow: 0 10px 26px rgba(34, 45, 78, 0.06) !important;
  padding: 18px 18px 20px !important;
}

.ws-side-title {
  font-size: 18px !important;
  line-height: 1.3 !important;
}

.ws-side-text {
  font-size: 13.5px !important;
  line-height: 1.78 !important;
}

.ws-side-chip-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.ws-side-chip {
  justify-content: center !important;
  text-align: center !important;
  min-height: 42px !important;
  border-radius: 14px !important;
}

@media (max-width: 1240px) {
  .ws-panel-grid-outline:not(.ws-outline-layout) {
    grid-template-columns: 1fr !important;
  }

  .ws-reader-stage-split {
    grid-template-columns: 1fr !important;
  }

  .ws-reader-side {
    position: static !important;
    top: auto !important;
  }

  .ws-side-chip-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

.ws-root .chapter-rail {
  gap: 14px !important;
}

.ws-root .chapter-rail-item {
  padding: 18px 18px 16px !important;
  border-radius: 24px !important;
}

.chapter-rail-item strong {
  font-size: 18px !important;
  line-height: 1.46 !important;
}

.chapter-rail-meta {
  font-size: 12.5px !important;
}

.chapter-rail-preview {
  font-size: 13.5px !important;
  line-height: 1.7 !important;
}

.char-profile {
  gap: 16px !important;
}

.char-profile-summary {
  font-size: 14px !important;
  line-height: 1.82 !important;
}

.char-profile-fields {
  gap: 10px !important;
}

.char-field-row {
  grid-template-columns: 78px minmax(0, 1fr) !important;
  gap: 14px !important;
}

.char-field-label {
  font-size: 11.5px !important;
}

.char-field-value {
  font-size: 14px !important;
  line-height: 1.72 !important;
}

.craft-inline-details summary {
  font-size: 13px !important;
}

/* -----------------------------------------------------------------
   Outline workspace split refresh — 20260324e
   Left: planning packets
   Right: editor + preview workspace
   ----------------------------------------------------------------- */
.ws-outline-layout {
  display: grid;
  grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  min-width: 0;
}

.ws-outline-left-column,
.ws-outline-right-column {
  min-width: 0;
}

.ws-outline-left-column {
  position: sticky;
  top: 18px;
}

.ws-outline-right-column {
  display: grid;
  gap: 18px;
}

.ws-outline-layout .ws-accordion-item {
  border-radius: 24px !important;
  border: 1px solid rgba(182, 149, 95, 0.14) !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(255,252,247,0.96) 100%) !important;
  box-shadow: 0 16px 34px rgba(24, 32, 57, 0.06) !important;
  overflow: hidden;
}

.ws-outline-layout .ws-accordion-head {
  padding: 16px 18px !important;
  background:
    radial-gradient(circle at top right, rgba(116, 145, 240, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(249,251,255,0.98), rgba(255,252,247,0.96)) !important;
}

.ws-outline-layout .ws-form {
  gap: 14px !important;
}

.ws-outline-intro {
  display: grid;
  gap: 6px;
  padding: 2px 2px 4px;
}

.ws-outline-intro-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8c651d;
}

.ws-outline-intro-copy {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.72;
  color: rgba(34, 39, 52, 0.68);
}

.ws-outline-layout .ws-planning-counts {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px !important;
}

.ws-outline-layout .ws-subcount-chip {
  min-height: 42px;
  justify-content: center;
  border-radius: 16px !important;
}

.ws-outline-layout .ws-card-list {
  display: grid;
  gap: 8px;
  max-height: min(60vh, 680px);
  overflow-y: auto;
  padding-right: 4px;
}

.ws-outline-layout .manuscript-intel-card {
  border-radius: 18px !important;
}

.ws-outline-editor-form input,
.ws-outline-editor-form textarea {
  border-radius: 16px !important;
  background: rgba(248, 250, 255, 0.9) !important;
  border-color: rgba(125, 142, 188, 0.16) !important;
}

.ws-outline-editor-form textarea {
  min-height: 260px !important;
  resize: vertical;
}

.ws-outline-preview-stage {
  min-height: 760px !important;
  border-radius: 28px !important;
  border: 1px solid rgba(193, 160, 103, 0.14) !important;
  background:
    radial-gradient(circle at top right, rgba(136, 154, 255, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(255, 253, 249, 0.98) 0%, rgba(255, 255, 255, 0.98) 52%) !important;
  box-shadow: 0 18px 42px rgba(28, 33, 52, 0.06) !important;
}

.ws-outline-layout .ws-reader-stage-split {
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.82fr) !important;
  gap: 22px !important;
  min-height: 760px;
  align-items: stretch;
}

.ws-outline-layout .ws-reader-main,
.ws-outline-layout .ws-reader-main #manuscript-reader-shell,
.ws-outline-layout .ws-reader-main #manuscript-planning-shell {
  display: grid;
  align-content: start;
  min-height: 100%;
}

.ws-outline-layout .ws-paper {
  width: 100% !important;
  max-width: none !important;
  min-height: 100% !important;
  margin: 0 !important;
  padding: 34px 38px 40px !important;
  border-radius: 24px !important;
  border: 1px solid rgba(189, 155, 93, 0.12) !important;
  background:
    linear-gradient(180deg, rgba(255, 254, 251, 0.99) 0%, rgba(255, 255, 255, 0.99) 100%) !important;
  box-shadow: 0 10px 28px rgba(24, 32, 57, 0.05) !important;
}

.ws-outline-layout .ws-paper-title {
  max-width: 24ch;
  margin-bottom: 18px !important;
}

.ws-outline-layout .ws-paper-body {
  min-height: 620px !important;
  max-width: 78ch !important;
  font-size: 16px !important;
  line-height: 2 !important;
  color: #2b2a28 !important;
}

.ws-outline-layout .ws-paper-body-muted {
  color: #6f6b63 !important;
}

.ws-outline-layout .ws-reader-side {
  display: grid !important;
  gap: 16px !important;
  align-content: start !important;
  position: sticky !important;
  top: 18px !important;
}

.ws-outline-layout .ws-reader-side-card {
  border-radius: 22px !important;
  border: 1px solid rgba(120, 137, 201, 0.16) !important;
  background:
    linear-gradient(180deg, rgba(248, 250, 255, 0.98) 0%, rgba(255, 253, 248, 0.96) 100%) !important;
  box-shadow: 0 10px 26px rgba(34, 45, 78, 0.06) !important;
  padding: 18px 18px 20px !important;
}

.ws-outline-layout .ws-side-title {
  font-size: 18px !important;
  line-height: 1.3 !important;
}

.ws-outline-layout .ws-side-text {
  font-size: 13.5px !important;
  line-height: 1.78 !important;
}

.ws-outline-layout .ws-side-chip-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.ws-outline-layout .ws-side-chip {
  justify-content: center !important;
  text-align: center !important;
  min-height: 42px !important;
  border-radius: 14px !important;
}

@media (max-width: 1240px) {
  .ws-outline-layout {
    grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
    gap: 16px;
  }

  .ws-outline-left-column {
    position: static;
    top: auto;
  }

  .ws-outline-layout .ws-reader-stage-split {
    grid-template-columns: 1fr !important;
    min-height: 0;
  }

  .ws-outline-layout .ws-reader-side {
    position: static !important;
    top: auto !important;
  }

  .ws-outline-layout .ws-card-list {
    max-height: none;
  }
}

@media (max-width: 980px) {
  .ws-outline-layout {
    grid-template-columns: 1fr;
  }
}

/* MultiAgent workspace refresh */
.multiagent-body .page-bg {
  background:
    radial-gradient(circle at 12% 12%, rgba(216, 119, 6, 0.11), transparent 24%),
    radial-gradient(circle at 88% 10%, rgba(15, 118, 110, 0.12), transparent 26%),
    linear-gradient(180deg, #fffaf2 0%, #f6efe3 42%, #f4f1eb 100%);
}
.multiagent-body .topbar {
  background: rgba(255, 250, 242, 0.84);
  border-bottom-color: rgba(125, 88, 42, 0.08);
}
.multiagent-body .brand::before {
  content: "WF";
  background: linear-gradient(135deg, #bf6a02 0%, #0f766e 100%);
  box-shadow: 0 10px 24px rgba(191, 106, 2, 0.24);
}
.multiagent-brand-wrap {
  display: grid;
  gap: 4px;
}
.multiagent-brand-note {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8a6a44;
  font-weight: 700;
}
.ma-shell {
  display: grid;
  gap: 20px;
}
.ma-hero,
.ma-panel,
.ma-subpanel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(145, 118, 85, 0.14);
  border-radius: 24px;
  background: rgba(255, 252, 247, 0.92);
  box-shadow: 0 14px 40px rgba(104, 78, 48, 0.08);
}
.ma-hero::before,
.ma-panel::before,
.ma-subpanel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.75), rgba(255,255,255,0));
}
.ma-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  gap: 22px;
  padding: 28px;
}
.ma-hero-compact {
  padding: 24px;
}
.ma-hero-copy,
.ma-stat-grid,
.ma-panel > *,
.ma-subpanel > * {
  position: relative;
  z-index: 1;
}
.ma-kicker,
.ma-panel-kicker {
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9a6b2f;
  font-weight: 800;
}
.ma-hero h1 {
  margin: 10px 0 14px;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.14;
  font-family: "Source Serif 4", serif;
}
.ma-hero p {
  margin: 0;
  color: #586273;
  line-height: 1.8;
}
.ma-pill-row,
.ma-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.ma-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(191, 106, 2, 0.08);
  border: 1px solid rgba(191, 106, 2, 0.16);
  color: #7a581f;
  font-size: 12px;
  font-weight: 700;
}
.ma-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.ma-stat-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(145, 118, 85, 0.12);
  display: grid;
  gap: 6px;
}
.ma-stat-card span,
.ma-provider-head p {
  color: var(--muted);
  font-size: 12px;
}
.ma-stat-card strong {
  font-size: 28px;
  line-height: 1;
  color: #1f2937;
}
.ma-stat-card small {
  color: #66758b;
  line-height: 1.55;
}
.ma-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.ma-grid-main {
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
}
.ma-stack,
.ma-provider-stack,
.ma-stream,
.ma-history-list {
  display: grid;
  gap: 16px;
}
.ma-panel,
.ma-subpanel {
  padding: 22px;
}
.ma-panel-warm {
  background: linear-gradient(180deg, rgba(255, 248, 238, 0.97), rgba(255, 252, 247, 0.92));
}
.ma-panel-dark {
  background: linear-gradient(180deg, rgba(34, 43, 63, 0.98), rgba(46, 30, 12, 0.96));
  color: #eef2ff;
}
.ma-panel-dark .ma-panel-kicker,
.ma-panel-dark h2,
.ma-panel-dark p,
.ma-panel-dark strong,
.ma-panel-dark .ma-provider-meta,
.ma-panel-dark .ma-provider-head p,
.ma-panel-dark .muted {
  color: #eef2ff;
}
.ma-panel-dark input,
.ma-panel-dark select,
.ma-panel-dark textarea {
  background: rgba(255,255,255,0.92);
  color: #1f2937;
}
.ma-panel-soft {
  background: linear-gradient(180deg, rgba(247, 251, 255, 0.95), rgba(255, 252, 247, 0.9));
}
.ma-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.ma-panel-head h2 {
  margin: 6px 0 0;
  font-size: 24px;
  line-height: 1.2;
  font-family: "Source Serif 4", serif;
}
.ma-panel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.09);
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
}
.ma-provider-card,
.ma-stream-card,
.ma-history-card {
  border-radius: 18px;
  border: 1px solid rgba(145, 118, 85, 0.12);
  background: rgba(255, 255, 255, 0.86);
  padding: 16px;
}
.ma-provider-card-static {
  gap: 14px;
}
.ma-provider-card {
  display: grid;
  gap: 12px;
}
.ma-provider-head,
.ma-stream-head,
.ma-history-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.ma-provider-head strong,
.ma-stream-head strong,
.ma-history-head strong {
  font-size: 15px;
  color: var(--text);
}
.ma-provider-head span,
.ma-stream-head p,
.ma-history-head span,
.ma-provider-meta,
.ma-stream-meta {
  color: #68768b;
  font-size: 12px;
}
.ma-provider-meta,
.ma-stream-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.ma-stream-preview,
.ma-history-body {
  color: #334155;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
}
.ma-empty {
  padding: 22px;
  border-radius: 18px;
  border: 1px dashed rgba(145, 118, 85, 0.28);
  background: rgba(255,255,255,0.66);
  color: #66758b;
  line-height: 1.75;
}
.ma-empty-inline {
  padding: 14px 16px;
}
.ma-copy-block {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.ma-copy-block strong {
  font-size: 13px;
  color: #6f4f27;
}
.ma-question-list {
  margin: 0;
  padding-left: 22px;
  color: #334155;
  line-height: 1.75;
}
.ma-question-list.compact {
  margin-top: 10px;
}
.ma-history-card-assistant {
  border-left: 4px solid rgba(15, 118, 110, 0.34);
}
.ma-history-card-user {
  border-left: 4px solid rgba(191, 106, 2, 0.34);
}
.ma-form-divider {
  padding-top: 4px;
}

@media (max-width: 1080px) {
  .ma-hero,
  .ma-grid,
  .ma-grid-main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .ma-hero,
  .ma-panel,
  .ma-subpanel {
    padding: 20px;
  }
  .ma-stat-grid {
    grid-template-columns: 1fr;
  }
}

/* Auth portal compact refresh */
.alert-success {
  background: #ecfdf3;
  color: #146c43;
  border: 1px solid #cdeedb;
}

.auth-page-shell {
  --auth-accent: #1f4f86;
  --auth-accent-2: #16867a;
  --auth-accent-soft: rgba(31, 79, 134, 0.12);
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 44px;
  display: grid;
  gap: 18px;
}

.auth-page-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 24px;
  border: 1px solid rgba(91, 108, 142, 0.12);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 40px rgba(18, 28, 54, 0.08);
}

.auth-page-brand,
.auth-page-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #15243c;
  font-weight: 800;
  text-decoration: none;
}

.auth-page-brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #1f4f86 0%, #16867a 100%);
  box-shadow: 0 14px 28px rgba(31, 79, 134, 0.22);
}

.auth-register-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-locale-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  border: 1px solid rgba(91, 108, 142, 0.12);
  background: rgba(243, 247, 255, 0.92);
}

.auth-locale-switch form {
  margin: 0;
}

.auth-locale-switch .lang-btn {
  min-width: 84px;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: transparent;
  color: #66758b;
  font-weight: 800;
  cursor: pointer;
}

.auth-locale-switch .lang-btn.is-active {
  background: linear-gradient(135deg, #1f4f86 0%, #16867a 100%);
  color: #fff;
  box-shadow: 0 10px 20px rgba(31, 79, 134, 0.18);
}

.auth-wrap-register.auth-wrap-portal {
  max-width: 1080px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 30px;
  border: 1px solid rgba(91, 108, 142, 0.12);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(18, 28, 54, 0.12);
  grid-template-columns: minmax(360px, 0.92fr) minmax(380px, 0.88fr);
}

.auth-wrap-register .auth-hero-portal,
.auth-wrap-register .auth-card-portal {
  min-height: 560px;
  padding: 34px 34px 36px;
}

.auth-wrap-register .auth-hero-register {
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.16), transparent 34%),
    linear-gradient(160deg, #18365e 0%, #1f5b8d 46%, #138276 100%);
  gap: 20px;
}

.auth-wrap-register .auth-card-register {
  background:
    radial-gradient(circle at top right, rgba(40, 96, 168, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(249, 251, 255, 0.98) 100%);
  justify-content: center;
}

.auth-wrap-register .auth-hero-badge {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-wrap-register .auth-hero-portal h1 {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(32px, 3.1vw, 46px);
  line-height: 1.06;
  letter-spacing: -0.04em;
}

.auth-wrap-register .auth-hero-copy {
  max-width: 46ch;
  font-size: 15px;
  line-height: 1.86;
}

.auth-wrap-register .auth-hero-stack {
  gap: 10px;
}

.auth-wrap-register .auth-hero-pill {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  line-height: 1.68;
  font-size: 13px;
}

.auth-wrap-register .auth-card-head {
  margin-bottom: 18px;
}

.auth-wrap-register .auth-card-kicker {
  font-size: 12px;
  letter-spacing: 0.08em;
}

.auth-wrap-register .auth-card-portal h1 {
  margin: 8px 0 0;
  font-size: clamp(30px, 2.8vw, 38px);
  line-height: 1.1;
}

.auth-wrap-register .auth-card-subtitle {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.7;
}

.auth-wrap-register .auth-form-row {
  gap: 9px;
}

.auth-wrap-register .auth-form-row label {
  font-size: 13px;
  letter-spacing: 0.02em;
}

.auth-wrap-register .auth-form-row input {
  height: 56px;
  border-radius: 16px;
  border: 1px solid #d8e2ef;
  background: linear-gradient(180deg, #f7faff 0%, #f3f7fd 100%);
}

.auth-wrap-register .auth-form-row input[readonly] {
  color: #54657e;
  background: linear-gradient(180deg, #f2f5fa 0%, #edf2f8 100%);
}

.auth-field-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.auth-field-inline input {
  min-width: 0;
}

.auth-form-note {
  font-size: 12.5px;
  line-height: 1.7;
  color: #6a7990;
}

.auth-inline-action {
  min-height: 56px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid rgba(31, 79, 134, 0.14);
  background: #eef4fb;
  color: #1f4f86;
  font-weight: 800;
  white-space: nowrap;
}

.auth-inline-action:hover,
.auth-inline-action:focus-visible {
  background: #e4eef9;
  border-color: rgba(31, 79, 134, 0.24);
}

.auth-inline-action:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.auth-inline-action-wide {
  width: 100%;
  justify-content: center;
}

.auth-wrap-register .auth-submit.btn {
  min-height: 58px;
  border-radius: 18px;
  font-size: 17px;
}

.auth-wrap-register a.auth-submit.btn:not(.btn-primary) {
  border: 1px solid rgba(31, 79, 134, 0.14);
  background: #eef4fb;
  color: #1f4f86;
  box-shadow: none;
}

.auth-link-row-split {
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.auth-inline-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--auth-accent);
  font-weight: 800;
  cursor: pointer;
}

.auth-inline-link:hover,
.auth-link-row a:hover,
.auth-top-link:hover,
.auth-top-link-quiet:hover {
  text-decoration: underline;
}

.auth-top-link-quiet {
  min-width: 0;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(91, 108, 142, 0.12);
  color: #42536e;
  box-shadow: none;
}

.auth-page-shell .alert {
  margin-bottom: 0;
}

@media (max-width: 1180px) {
  .auth-page-shell {
    width: min(980px, calc(100% - 28px));
  }

  .auth-wrap-register.auth-wrap-portal {
    max-width: 820px;
    grid-template-columns: 1fr;
  }

  .auth-wrap-register .auth-hero-portal,
  .auth-wrap-register .auth-card-portal {
    min-height: auto;
  }
}

@media (max-width: 820px) {
  .auth-page-shell {
    width: min(100% - 20px, 720px);
    padding: 16px 0 28px;
    gap: 14px;
  }

  .auth-page-topbar,
  .auth-register-top-actions,
  .auth-wrap-register .auth-card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-page-topbar {
    padding: 14px;
    border-radius: 20px;
  }

  .auth-wrap-register.auth-wrap-portal {
    border-radius: 24px;
  }

  .auth-wrap-register .auth-hero-portal,
  .auth-wrap-register .auth-card-portal {
    padding: 24px 20px 26px;
  }

  .auth-wrap-register .auth-hero-portal h1,
  .auth-wrap-register .auth-card-portal h1 {
    max-width: none;
    font-size: 30px;
  }

  .auth-field-inline {
    grid-template-columns: 1fr;
  }

  .auth-inline-action {
    width: 100%;
    justify-content: center;
  }

  .auth-link-row-split {
    flex-direction: column;
    align-items: flex-start;
  }
}

.auth-mode-choice-grid {
  display: grid;
  gap: 14px;
}

.auth-mode-choice {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(91, 108, 142, 0.14);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
  display: grid;
  gap: 12px;
}

.auth-mode-choice.is-active {
  border-color: rgba(22, 131, 118, 0.22);
  background:
    radial-gradient(circle at top right, rgba(22, 131, 118, 0.08), transparent 30%),
    linear-gradient(180deg, #fbfffe 0%, #f3fbf8 100%);
  box-shadow: 0 18px 34px rgba(22, 131, 118, 0.08);
}

.auth-mode-choice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.auth-mode-choice-kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #58708f;
}

.auth-mode-choice h3 {
  margin: 8px 0 0;
  font-size: 22px;
  line-height: 1.2;
  color: #182742;
}

.auth-mode-choice-state {
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(31, 79, 134, 0.08);
  color: #1f4f86;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.auth-mode-choice.is-active .auth-mode-choice-state {
  background: rgba(22, 131, 118, 0.12);
  color: #12766c;
}

.auth-mode-choice-copy {
  margin: 0;
  color: #627187;
  line-height: 1.76;
  font-size: 14px;
}

.auth-mode-choice-cta {
  min-height: 54px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  text-decoration: none;
  font-weight: 800;
  font-size: 16px;
}

.auth-mode-choice-cta-primary {
  background: linear-gradient(135deg, #1f4f86 0%, #245fa1 100%);
  color: #fff;
  box-shadow: 0 16px 30px rgba(31, 79, 134, 0.18);
}

.auth-mode-choice-cta-secondary {
  border: 1px solid rgba(22, 131, 118, 0.16);
  background: #eef8f6;
  color: #12766c;
}

.auth-mode-choice-cta:hover {
  transform: translateY(-1px);
}

@media (max-width: 820px) {
  .auth-mode-choice {
    padding: 16px;
  }

  .auth-mode-choice-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
