/* x.ai inspired: stark monochrome, minimal */
:root {
  --bg: #050505;
  --bg-elevated: #0f0f0f;
  --bg-hover: #171717;
  --border: #262626;
  --border-light: #333;
  --text: #fafafa;
  --text-muted: #a3a3a3;
  --text-dim: #737373;
  --accent: #ffffff;
  --user-bubble: #1a1a1a;
  --agent-bubble: #111;
  --highlight: #fef08a22;
  --highlight-border: #fef08a66;
  --danger: #f87171;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  --radius: 10px;
  --sidebar-w: 280px;
  --anno-w: 340px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.app { display: flex; flex-direction: column; height: 100vh; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 280px; }
.brand-mark {
  width: 36px; height: 36px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
}
.brand h1 { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.brand-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.chain-tabs { display: flex; gap: 4px; flex: 1; }
.chain-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  transition: 0.15s;
}
.chain-tab:hover { color: var(--text); background: var(--bg-hover); }
.chain-tab.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}
.chain-tab-sub {
  opacity: 0.5;
  font-size: 10px;
  margin-left: 6px;
}
.chain-tab.coming-soon {
  cursor: default;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  user-select: none;
}
.chain-tab.coming-soon em {
  font-style: normal;
  font-size: 10px;
  margin-left: 8px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.sync-status {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
  min-width: 0;
  white-space: nowrap;
}
.sync-status:empty { display: none; }
.sync-status.sync-synced { color: #86efac; }
.sync-status.sync-syncing { color: #fde047; }
.sync-status.sync-error { color: var(--danger); }
.sync-status.sync-offline { color: var(--text-dim); }

/* Coach subbar: 场景清单 / 测试脚本 */
.coach-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.view-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.view-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 7px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.15s;
}
.view-tab:hover { color: var(--text); }
.view-tab.active {
  background: var(--accent);
  color: #000;
}
.view-source {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}

.btn {
  border: 1px solid var(--border-light);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.15s;
}
.btn:hover { background: var(--bg-hover); border-color: #444; }
.btn.primary { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: #e5e5e5; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 11px; }
.icon-btn {
  background: none; border: none; color: var(--text-muted);
  font-size: 22px; cursor: pointer; line-height: 1;
}

/* Layout */
.layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  flex-shrink: 0;
  min-height: 0;
  overflow: hidden;
}

.sidebar-head {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.search {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}
.search:focus { border-color: #555; }
.sidebar-stats {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sidebar-empty {
  padding: 16px;
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
}

.stage-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 8px 0;
  overscroll-behavior: contain;
}

.stage-group {
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
}
.stage-group:last-child { border-bottom: none; }
.stage-toggle {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: 0.12s;
}
.stage-toggle:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.stage-chev {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.5;
  transition: transform 0.15s;
  margin-top: 1px;
}
.stage-group:not(.open) .stage-chev { transform: rotate(-90deg); }
.stage-title-text {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.01em;
}
.stage-count {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-dim);
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-top: 1px;
}
.stage-group:not(.open) .stage-items { display: none; }
.stage-items { padding-bottom: 4px; }

.scene-item {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 5px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px 6px 24px;
  cursor: pointer;
  font-size: 12px;
  border-left: 2px solid transparent;
  transition: 0.12s;
}
.scene-item .item-main {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
  font-size: 12px;
}
.scene-item .item-sub {
  flex-shrink: 0;
  font-size: 9px;
  color: var(--text-dim);
  font-family: var(--mono);
  padding-left: 0;
}
.anno-badge {
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fef08a22;
  border: 1px solid var(--highlight-border);
  color: #fef08a;
  flex-shrink: 0;
}
.scene-item:hover { background: var(--bg-hover); color: var(--text); }
.scene-item.active {
  color: var(--text);
  background: var(--bg-elevated);
  border-left-color: var(--accent);
}
.scene-item .num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  flex-shrink: 0;
  min-width: 22px;
}
.scene-item .badge {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--highlight-border);
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
}

.main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 28px;
  min-width: 0;
  min-height: 0;
  overscroll-behavior: contain;
}

.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 15px;
}
.empty-hint {
  font-size: 12px;
  color: var(--text-dim);
  max-width: 320px;
  text-align: center;
  line-height: 1.5;
}

.scene-header { margin-bottom: 24px; }
.scene-meta {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.meta-pill-wrap,
.title-wrap,
.subtitle-wrap {
  min-width: 0;
}
.title-wrap { flex: 1; min-width: 200px; }
.subtitle-wrap { max-width: 720px; margin-top: 4px; }

.content-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 18px;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
  background: #ffffff06;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.content-tip strong { color: var(--text); font-weight: 600; }
.tip-icon { flex-shrink: 0; line-height: 1.4; }

.panel-hint {
  font-weight: 400;
  color: var(--text-dim);
  font-size: 12px;
}
.dialog-hint {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}

.pill {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-muted);
}
.scene-header h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.03em; }
.scene-desc { color: var(--text-muted); max-width: 720px; margin-top: 8px; white-space: pre-wrap; }
.scene-desc.muted { font-size: 13px; }
.scenario-body-wrap { max-width: 720px; margin-top: 8px; }
.cross-link { margin-top: 14px; }
.content-view.hidden { display: none; }
.panel-head-static {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.trigger-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.trigger-tags span {
  font-size: 11px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
}

/* Panels */
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  background: var(--bg-elevated);
}
.panel-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.panel-toggle:hover { background: var(--bg-hover); }
.panel:not(.open) .panel-body { display: none; }
.panel:not(.open) .chev { transform: rotate(-90deg); }
.chev { transition: 0.15s; color: var(--text-dim); font-size: 12px; }
.panel-body { padding: 0 16px 16px; border-top: 1px solid var(--border); }

.annotatable {
  padding: 12px 0;
  cursor: pointer;
  border-radius: 6px;
  transition: 0.12s;
  position: relative;
}
.annotatable:hover {
  background: #ffffff06;
  outline: 1px dashed var(--border-light);
  outline-offset: 4px;
}
.pill.annotatable {
  padding: 3px 8px;
  display: inline-block;
}
.pill.annotatable:hover { outline-offset: 2px; }
h2.annotatable {
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 8px;
}
.scene-desc.annotatable { padding: 8px 6px; margin: 0 -6px; }
.annotatable.has-anno::after {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--highlight-border);
  border-radius: 2px;
}
.block.muted { color: var(--text-muted); font-size: 13px; white-space: pre-wrap; }

/* Inline annotations (visible under content) */
.inline-annos {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.inline-anno {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px 10px;
  padding: 8px 10px;
  background: #fef08a12;
  border: 1px solid var(--highlight-border);
  border-radius: 8px;
  font-size: 12px;
}
.inline-anno-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #ca8a04;
  font-weight: 600;
  flex-shrink: 0;
}
.inline-anno-text {
  flex: 1;
  min-width: 0;
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
}
.inline-anno-edit,
.inline-anno-del {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.inline-anno-edit:hover { color: var(--text); }
.inline-anno-del:hover { color: var(--danger); }
.inline-anno-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Dialog */
.dialog { display: flex; flex-direction: column; gap: 14px; padding-top: 14px; }
.msg-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.msg-wrap .msg.user { align-self: flex-end; }
.msg-wrap .msg.agent { align-self: flex-start; }
.msg-wrap .inline-annos {
  max-width: 88%;
  align-self: flex-start;
}
.msg-wrap:has(.msg.user) .inline-annos {
  align-self: flex-end;
}
.msg {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: 0.12s;
}
.msg:hover {
  border-color: #444;
  outline: 1px dashed var(--highlight-border);
  outline-offset: 2px;
}
.msg:hover .msg-speaker::after {
  content: " · 点击批注";
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-dim);
}
.msg.has-anno { box-shadow: inset 0 0 0 1px var(--highlight-border); }
.msg.user {
  align-self: flex-end;
  background: var(--user-bubble);
  border-bottom-right-radius: 4px;
}
.msg.agent {
  align-self: flex-start;
  background: var(--agent-bubble);
  border-bottom-left-radius: 4px;
}
.msg-speaker {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 600;
}
.msg-content {
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-content strong { font-weight: 600; color: var(--text); }
.msg-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.msg-actions .btn.sm { font-size: 10px; padding: 4px 8px; }

/* KB demo */
.kb-demo-panel {
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 8px;
  background: #080808;
}
.kb-demo-head h3 { font-size: 13px; font-weight: 600; }
.kb-demo-head p { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.kb-demo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.kb-stream { margin-top: 16px; }
.kb-stream-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.kb-cards { display: flex; flex-direction: column; gap: 8px; }
.kb-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  animation: fadeUp 0.35s ease both;
}
.kb-card-source {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.kb-card-body { font-size: 12px; color: var(--text-muted); }

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

/* Annotation panel */
.anno-panel {
  width: var(--anno-w);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  flex-shrink: 0;
  min-height: 0;
  overflow: hidden;
}
.anno-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.anno-head h3 { font-size: 13px; font-weight: 600; }
.anno-count {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
}
.anno-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  overscroll-behavior: contain;
}
.anno-hint {
  padding: 10px 14px;
  font-size: 10px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  line-height: 1.4;
  flex-shrink: 0;
}

.anno-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: 0.12s;
  background: var(--bg-elevated);
}
.anno-card:hover {
  border-color: #444;
  background: var(--bg-hover);
}
.anno-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.anno-card.active { border-color: var(--accent); }
.anno-card-type {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.anno-card-text {
  font-size: 12px;
  margin-top: 4px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.anno-card-meta {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 6px;
  font-family: var(--mono);
}
.anno-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.anno-card-actions button {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 10px;
  cursor: pointer;
  padding: 0;
}
.anno-card-actions button:hover { color: var(--text); }
.anno-card-actions .del:hover { color: var(--danger); }
.anno-empty {
  padding: 16px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: #000000cc;
}
.modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(520px, 92vw);
  max-height: 90vh;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 14px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 14px;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 16px;
}
.modal-target {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  max-height: 100px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.modal-card label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.modal-card select,
.modal-card textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
}
.modal-card textarea { resize: vertical; min-height: 80px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}
.modal-footer .spacer { flex: 1; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.modal-actions .spacer { flex: 1; }
.btn.danger { color: var(--danger); border-color: #7f1d1d44; }
.btn.danger:hover { background: #7f1d1d22; border-color: var(--danger); color: #fca5a5; }

/* Login gate */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}
.login-gate.hidden { display: none; }
#app.login-locked { visibility: hidden; height: 100vh; overflow: hidden; }
.login-card {
  width: min(400px, 92vw);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 28px 24px;
  background: var(--bg-elevated);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.login-brand h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.login-brand p {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}
.login-card label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.login-card input[type="password"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 8px;
}
.login-error {
  min-height: 18px;
  font-size: 12px;
  color: var(--danger);
  margin-bottom: 4px;
}
.login-dev-hint {
  font-size: 11px;
  color: #86efac;
  margin-bottom: 8px;
  line-height: 1.4;
}
.login-dev-hint.hidden { display: none; }
.login-submit { width: 100%; margin-top: 4px; }
.reply-section {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.reply-section h4 { font-size: 11px; color: var(--text-dim); margin-bottom: 10px; font-weight: 500; letter-spacing: 0.02em; }
.reply-item {
  font-size: 12px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 6px;
  color: var(--text-muted);
  border: 1px solid transparent;
}
.reply-item.is-editing {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
}
.reply-item-body { white-space: pre-wrap; word-break: break-word; margin-top: 4px; }
.reply-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.reply-item time { font-size: 10px; color: var(--text-dim); flex: 1; min-width: 0; }
.reply-item-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.reply-item-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.reply-item-actions button:hover { color: var(--text); }
.reply-item-actions .del { color: #f87171; }
.reply-item-actions .del:hover { color: #fca5a5; }
.reply-empty { font-size: 11px; color: var(--text-dim); margin: 0 0 8px; }
.reply-form { margin-top: 8px; }
.reply-form-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.reply-form-row textarea {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  resize: vertical;
}
.reply-form-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.reply-form textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
}

@media (max-width: 1100px) {
  :root {
    --sidebar-w: 220px;
    --anno-w: 280px;
  }
  .view-source { display: none; }
  .main { padding: 16px; }
}

@media (max-width: 900px) {
  .anno-panel {
    width: var(--anno-w);
    max-height: none;
    border-left: 1px solid var(--border);
    border-top: none;
  }
}
