/* PHRASING — NONFICTION WRITING STUDIO
   Desktop Workspace Design System (v2.0 Aesthetics) */

@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700;800&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;0,8..60,700;1,8..60,400;1,8..60,600&display=swap');

:root {
  --bg-app: #0b1324;
  --bg-sidebar: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #273549;
  --bg-input: #1e293b;
  --bg-nested: #0b1324;
  --bg-paper: #f8fafc;
  --text-paper: #1e293b;
  --bg-canvas: #0b1324;
  --text-canvas: #e2e8f0;
  --text-canvas-muted: #94a3b8;
  --heading-canvas: #f8fafc;
  --bq-bg: rgba(56, 189, 248, 0.08);
  --bq-border: #38bdf8;
  --code-bg: rgba(255, 255, 255, 0.08);
  --code-color: #38bdf8;
  --border-canvas-subtle: rgba(255, 255, 255, 0.1);

  --border-subtle: #243247;
  --border-card: #334155;
  --border-focus: #38bdf8;

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #a8b5c9;
  --text-subtle: #64748b;

  --accent-sky: #38bdf8;
  --accent-sky-hover: #0ea5e9;
  --accent-sky-subtle: rgba(56, 189, 248, 0.14);

  --accent-emerald: #34d399;
  --accent-emerald-dark: #059669;
  --accent-emerald-subtle: rgba(52, 211, 153, 0.14);

  --accent-amber: #fbbf24;
  --accent-amber-subtle: rgba(251, 191, 36, 0.14);

  --accent-purple: #a5b4fc;
  --accent-purple-subtle: rgba(165, 180, 252, 0.16);

  --accent-red: #fca5a5;
  --accent-red-badge: #dc2626;
  --accent-red-subtle: rgba(248, 113, 113, 0.16);

  --font-ui: 'Figtree', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-prose: 'Source Serif 4', Georgia, serif;
}

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

body {
  font-family: var(--font-ui);
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==========================================================================
   TOP BAR: GLOBAL HEADER
   ========================================================================== */
.top-bar {
  height: 52px;
  flex-shrink: 0;
  background-color: var(--bg-app);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  user-select: none;
  z-index: 50;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.01em;
  cursor: pointer;
}

.brand-badge img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
  display: block;
}

.brand-badge .brand-name {
  color: #f1f5f9;
  font-weight: 700;
  font-size: 15px;
}

.header-divider {
  width: 1px;
  height: 22px;
  background: var(--border-card);
}

.project-title-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #f1f5f9;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.project-title-btn:hover {
  background: var(--bg-card);
}

.top-bar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.search-command-bar {
  width: 440px;
  max-width: 100%;
  height: 36px;
  box-sizing: border-box;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s;
}

.search-command-bar:hover {
  border-color: rgba(56, 189, 248, 0.4);
}

.search-command-bar span.placeholder {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kbd-shortcut {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--bg-sidebar);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.synced-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border-radius: 15px;
  background: var(--accent-emerald-subtle);
  color: #6ee7b7;
  font-size: 13px;
  font-weight: 600;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 4px;
  background: var(--accent-emerald);
}

.phone-sync-btn {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-card);
  border-radius: 10px;
  background: transparent;
  color: #f1f5f9;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.phone-sync-btn:hover {
  background: var(--bg-card);
}

.badge-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: 10px;
  background: var(--accent-amber);
  color: #1c1300;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-compile-primary {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--accent-sky);
  color: #0f172a;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, transform 0.05s;
}

.btn-compile-primary:hover {
  background: #7dd3fc;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-icon:hover {
  background: var(--bg-card);
  color: #f1f5f9;
}

/* ==========================================================================
   WORKSPACE LAYOUT
   ========================================================================== */
.workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  background: var(--bg-app);
}

@media (min-width: 901px) {
  .workspace { position: relative; overflow: hidden; }
  body.panel-left-hidden .workspace .binder-panel,
  body.panel-right-hidden .workspace .right-panel { display: none; }
  body.panel-left-auto .workspace .binder-panel,
  body.panel-right-auto .workspace .right-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 30;
    height: 100%;
    pointer-events: none;
    transition: transform 180ms ease;
    box-shadow: 8px 0 22px rgba(0, 0, 0, 0.28);
  }
  body.panel-left-auto .workspace .binder-panel { left: 0; transform: translateX(-100%); }
  body.panel-right-auto .workspace .right-panel { right: 0; transform: translateX(100%); box-shadow: -8px 0 22px rgba(0, 0, 0, 0.28); }
  body.panel-left-auto.panel-left-visible .workspace .binder-panel,
  body.panel-right-auto.panel-right-visible .workspace .right-panel {
    transform: translateX(0);
    pointer-events: auto;
  }
  body.panel-left-auto .panel-edge-left,
  body.panel-right-auto .panel-edge-right { display: flex; }
  body.panel-left-pinned .panel-edge-left,
  body.panel-right-pinned .panel-edge-right { display: none; }
  .binder-toggle,
  .panel-toggle { flex-shrink: 0; }
}

@media (max-width: 900px) {
  .binder-toggle,
  .panel-toggle,
  .panel-layout-trigger,
  .panel-edge-trigger,
  .panel-layout-menu { display: none !important; }
}

.panel-toggle[aria-expanded="false"],
.binder-toggle[aria-expanded="false"] { opacity: 0.6; }
.panel-layout-menu[hidden] { display: none; }
.panel-layout-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 44px;
  z-index: 220;
  width: min(300px, calc(100vw - 24px));
  padding: 16px;
  border: 2px solid #11131a;
  border-radius: 12px;
  background: #262a37;
  color: #fff3dd;
  box-shadow: 6px 6px 0 #11131a;
  font-size: 12px;
}
.panel-layout-title { font-size: 15px; font-weight: 800; }
.panel-layout-menu p { margin: 6px 0 12px; line-height: 1.4; color: #c9cbd3; }
.panel-layout-menu fieldset {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0;
  border: 0;
  border-top: 1px solid #51515d;
}
.panel-layout-menu legend { float: left; width: 100%; margin-bottom: 8px; font-weight: 800; color: #d9eeab; }
.panel-layout-menu label { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; cursor: pointer; }
.panel-layout-menu input { accent-color: #d9eeab; }
.panel-layout-menu .panel-layout-hint { margin-bottom: 0; font-size: 11px; }
.panel-edge-trigger {
  position: absolute;
  top: 64px;
  bottom: 64px;
  z-index: 35;
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  border: 0;
  background: #d9eeab;
  color: #171920;
  font: 800 10px var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  cursor: pointer;
}
.panel-edge-left { left: 0; border-radius: 0 8px 8px 0; transform: rotate(180deg); }
.panel-edge-right { right: 0; border-radius: 8px 0 0 8px; }
.panel-edge-trigger:focus-visible { outline: 3px solid #ffb58f; outline-offset: -2px; }

/* ==========================================================================
   LEFT PANEL: BINDER
   ========================================================================== */
.binder-panel {
  width: 288px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  user-select: none;
}

.binder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px 18px;
}

.binder-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.binder-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.binder-btn-icon {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--accent-sky);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.binder-btn-icon:hover {
  background: var(--border-card);
}

.binder-progress-box {
  padding: 0 18px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.binder-progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.binder-progress-track {
  height: 4px;
  border-radius: 2px;
  background: var(--border-card);
  overflow: hidden;
}

.binder-progress-bar {
  height: 100%;
  background: var(--accent-emerald);
  transition: width 0.3s ease;
}

.tree-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* TREE NODES */
.tree-node {
  border-radius: 8px;
  transition: background 0.15s;
}

.tree-node-content {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
}

.tree-node-content:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #f1f5f9;
}

.tree-node.active > .tree-node-content {
  background: var(--bg-card);
  color: #f1f5f9;
  font-weight: 600;
}

.tree-node-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.node-status-indicator {
  width: 9px;
  height: 9px;
  border-radius: 5px;
  flex-shrink: 0;
}

.status-done-dot {
  background: var(--accent-emerald);
  border-radius: 5px;
}

.status-draft-dot {
  background: var(--accent-amber);
  border-radius: 2px;
}

.status-needs_review-dot {
  background: var(--accent-purple);
  border-radius: 1px;
}

.status-outlined-dot {
  background: #94a3b8;
  border-radius: 5px;
}

.tree-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-node-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tree-word-count {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.tree-children {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* FROM YOUR PHONE SECTION */
.phone-section {
  margin: 14px 18px 0 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.phone-section-title {
  margin: 0 0 4px 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.phone-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.phone-review-link {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-sky);
  cursor: pointer;
}

.phone-review-link:hover {
  text-decoration: underline;
}

/* PRE-FLIGHT ABSTRACT DRAWER */
.preflight-drawer {
  margin: 12px 14px 14px 14px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  font-size: 12px;
}

.preflight-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preflight-synopsis {
  color: var(--text-secondary);
  line-height: 1.45;
  font-size: 12.5px;
  max-height: 80px;
  overflow-y: auto;
}

/* ==========================================================================
   CENTER PANEL: EDITOR WORKSPACE
   ========================================================================== */
.editor-panel {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
}

.editor-subbar {
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-app);
}

.node-title-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: #f1f5f9;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  outline: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-title-input:focus {
  border-bottom: 1px solid var(--accent-sky);
}

.node-status-select {
  height: 28px;
  padding: 0 10px;
  border-radius: 11px;
  background: var(--accent-amber-subtle);
  color: var(--accent-amber);
  font-size: 12.5px;
  font-weight: 600;
  border: 0;
  outline: none;
  cursor: pointer;
  font-family: inherit;
}

.editor-formatting-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.format-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.format-btn:hover {
  background: var(--bg-card);
  color: #f1f5f9;
}

.format-btn.cite-btn {
  width: auto;
  padding: 0 12px;
  background: var(--bg-card);
  color: var(--accent-sky);
  font-size: 13px;
  font-weight: 700;
}

.format-btn.cite-btn:hover {
  background: var(--border-card);
}

.subbar-divider {
  width: 1px;
  height: 22px;
  background: var(--border-card);
}

.word-count-metrics {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.word-count-metrics strong {
  color: #f1f5f9;
  font-weight: 600;
}

.voice-meter-badge {
  padding: 3px 10px;
  border-radius: 11px;
  background: var(--accent-emerald-subtle);
  color: #6ee7b7;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: opacity 0.15s;
}

.voice-meter-badge:hover {
  opacity: 0.85;
}

.save-status-pill {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.save-now-btn {
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid #353841;
  border-radius: 7px;
  background: #323744;
  color: #fff3dd;
  font: 700 11px var(--font-ui);
  cursor: pointer;
}
.save-now-btn:focus-visible { outline: 2px solid #d5ed73; outline-offset: 2px; }

/* ==========================================================================
   CANVAS CONTAINER & SEAMLESS NOTION-STYLE EDITOR CANVAS
   ========================================================================== */
.canvas-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  background: var(--bg-canvas, #0b1324);
  width: 100%;
  box-sizing: border-box;
  scroll-behavior: smooth;
}

/* Canvas Theme Modifiers */
body.canvas-theme-dark .canvas-container,
.canvas-theme-dark {
  --bg-canvas: #0b1324;
  --text-canvas: #e2e8f0;
  --text-canvas-muted: #94a3b8;
  --heading-canvas: #f8fafc;
  --bq-bg: rgba(56, 189, 248, 0.08);
  --bq-border: var(--accent-sky);
  --code-bg: rgba(255, 255, 255, 0.08);
  --code-color: #38bdf8;
  --border-canvas-subtle: rgba(255, 255, 255, 0.1);
}

body.canvas-theme-light .canvas-container,
.canvas-theme-light {
  --bg-canvas: #ffffff;
  --text-canvas: #1e293b;
  --text-canvas-muted: #64748b;
  --heading-canvas: #0f172a;
  --bq-bg: #f8fafc;
  --bq-border: #0284c7;
  --code-bg: #f1f5f9;
  --code-color: #0369a1;
  --border-canvas-subtle: #e2e8f0;
}

body.canvas-theme-ivory .canvas-container,
.canvas-theme-ivory {
  --bg-canvas: #fbfaf8;
  --text-canvas: #27272a;
  --text-canvas-muted: #71717a;
  --heading-canvas: #18181b;
  --bq-bg: #f4f1ea;
  --bq-border: #d97706;
  --code-bg: #f5f2eb;
  --code-color: #b45309;
  --border-canvas-subtle: #e5e0d8;
}

.canvas-paper {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  box-sizing: border-box;
  background: transparent !important;
  color: var(--text-canvas, #e2e8f0);
  border-radius: 0;
  box-shadow: none !important;
  padding: 44px 44px 280px 44px;
  min-height: 100%;
  flex-grow: 1;
  flex-shrink: 0;
  outline: none;
  font-family: var(--font-prose);
  position: relative;
  font-size: 18px;
  line-height: 1.72;
}

.canvas-paper h1 {
  margin: 0 0 20px 0;
  font-family: var(--font-prose);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--heading-canvas, #f8fafc);
  letter-spacing: -0.015em;
}

.canvas-paper h2 {
  margin: 36px 0 16px 0;
  font-family: var(--font-prose);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--heading-canvas, #f8fafc);
  letter-spacing: -0.01em;
}

.canvas-paper h3 {
  margin: 28px 0 12px 0;
  font-family: var(--font-prose);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--heading-canvas, #f8fafc);
}

.canvas-paper p {
  margin: 0 0 20px 0;
  font-family: var(--font-prose);
  font-size: 18px;
  line-height: 1.72;
  color: var(--text-canvas, #e2e8f0);
}

.canvas-paper blockquote {
  margin: 24px 0;
  padding: 14px 22px;
  border-left: 3px solid var(--bq-border, var(--accent-sky));
  background: var(--bq-bg, rgba(56, 189, 248, 0.08));
  font-style: italic;
  border-radius: 0 8px 8px 0;
  font-size: 17.5px;
  line-height: 1.65;
  color: var(--text-canvas-muted, #94a3b8);
}

/* DIFF HIGHLIGHTS */
span[data-type="insertion"], .diff-insertion {
  background: #d5f5e6;
  color: #065f46;
  border-bottom: 2px solid #059669;
  padding: 1px 2px;
  border-radius: 2px;
}

span[data-type="deletion"], .diff-deletion {
  background: #fde2e2;
  color: #9f1239;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  padding: 1px 2px;
  border-radius: 2px;
}

/* CITATION PILLS */
.cite-pill, .citation-pill {
  display: inline-block;
  margin-left: 5px;
  padding: 0 8px;
  border-radius: 10px;
  background: #dbeafe;
  color: #1e40af;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 20px;
  vertical-align: 2px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s, box-shadow 0.1s;
}

.cite-pill:hover, .citation-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(30, 64, 175, 0.25);
}

.needs-grounding-pill {
  display: inline-block;
  margin-left: 5px;
  padding: 0 8px;
  border-radius: 10px;
  background: #fef3c7;
  color: #b45309;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  vertical-align: 2px;
}

/* ==========================================================================
   FLOATING INTERACTIVE UI (DIFF BUBBLE & INLINE PROMPT)
   ========================================================================== */
#floating-diff-bubble {
  display: none;
  position: absolute;
  z-index: 100;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  border: 1px solid #334155;
  user-select: none;
}

.bubble-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: #f1f5f9;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.bubble-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.bubble-btn.bubble-accept {
  color: #34d399;
}

.bubble-btn.bubble-reject {
  color: #fca5a5;
}

.bubble-btn.bubble-iterate {
  color: #38bdf8;
}

.bubble-hotkey {
  padding: 1px 6px;
  border-radius: 4px;
  background: #334155;
  font-size: 11px;
  color: #cbd5e1;
}

#inline-prompt-bar {
  display: none;
  position: absolute;
  z-index: 100;
  width: 400px;
  max-width: 90vw;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  font-family: var(--font-ui);
}

.prompt-actions-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.quick-action-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 14px;
  border: 1px solid #334155;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}

.quick-action-btn.active, .quick-action-btn:hover {
  border-color: var(--accent-sky);
  color: var(--accent-sky);
  background: var(--accent-sky-subtle);
}

.prompt-input-row {
  display: flex;
  gap: 6px;
}

.prompt-input {
  flex: 1;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  color: #f1f5f9;
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
}

.prompt-input:focus {
  border-color: var(--accent-sky);
}

/* ==========================================================================
   RIGHT PANEL: CO-AUTHOR, VAULT, CODEX, VOICE, AUDIT
   ========================================================================== */
.right-panel {
  width: 372px;
  flex-shrink: 0;
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
}

.right-tablist {
  display: flex;
  padding: 0 10px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
}

.tab-btn {
  height: 52px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: color 0.15s;
}

.tab-btn:hover {
  color: #f1f5f9;
}

.tab-btn.active {
  border-bottom-color: var(--accent-sky);
  color: #f1f5f9;
  font-weight: 700;
}

.tab-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  box-sizing: border-box;
  border-radius: 9px;
  background: var(--accent-red-badge);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-content {
  display: none;
  flex: 1;
  min-height: 0;
  padding: 16px;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.tab-content.active {
  display: flex;
}

/* CO-AUTHOR TAB */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.switch-toggle {
  position: relative;
  width: 40px;
  height: 24px;
  border: 0;
  border-radius: 12px;
  background: var(--accent-emerald-dark);
  padding: 0;
  cursor: pointer;
}

.switch-knob {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #fff;
  transition: transform 0.15s;
}

.suggestion-card {
  padding: 14px;
  border-radius: 14px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.suggestion-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.suggestion-pill {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-sky);
}

.suggestion-meta {
  font-size: 12.5px;
  color: var(--text-muted);
}

.suggestion-quote-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-sidebar);
  font-size: 13px;
  color: var(--text-secondary);
}

.suggestion-quote-box .quote-text {
  font-family: var(--font-prose);
  font-size: 13.5px;
  line-height: 1.45;
  color: #f1f5f9;
}

.suggestion-actions {
  display: flex;
  gap: 8px;
}

.btn-accept-sug {
  flex: 1.3;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: var(--accent-emerald);
  color: #052e22;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-secondary-sug {
  flex: 1;
  height: 40px;
  border: 1px solid #475569;
  border-radius: 10px;
  background: transparent;
  color: #f1f5f9;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.chips-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-chip {
  height: 34px;
  padding: 0 13px;
  border-radius: 17px;
  border: 1px solid var(--border-card);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.action-chip:hover {
  border-color: var(--accent-sky);
  color: var(--accent-sky);
}

.coauthor-input-card {
  border-radius: 14px;
  border: 1px solid var(--border-card);
  background: var(--bg-nested);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.coauthor-textarea {
  width: 100%;
  background: transparent;
  border: 0;
  color: #f1f5f9;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  outline: none;
  resize: none;
  height: 52px;
}

.coauthor-textarea::placeholder {
  color: var(--text-muted);
}

.floating-coauthor {
  display: none;
  position: absolute;
  z-index: 40;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 48px));
  padding: 10px 12px 8px;
  border: 2px solid #11131a;
  border-radius: 15px;
  background: #262a37;
  color: #fff5e7;
  box-shadow: 5px 5px 0 #11131a, 0 14px 32px rgba(0, 0, 0, 0.24);
  flex-direction: column;
  gap: 7px;
}
.floating-coauthor-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
.floating-coauthor-heading strong { color: #d9eeab; font-size: 13px; }
.floating-coauthor-heading span { color: #c9cbd3; font-size: 11px; }
.floating-coauthor-entry { display: flex; align-items: flex-end; gap: 7px; }
.floating-coauthor-entry textarea {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  max-height: 108px;
  padding: 8px 10px;
  border: 1px solid #626673;
  border-radius: 9px;
  background: #1b1e29;
  color: #fff5e7;
  font: 13px/1.4 var(--font-ui);
  resize: vertical;
}
.floating-coauthor-entry textarea::placeholder { color: #b9b8bd; }
.floating-coauthor-entry button {
  flex: 0 0 36px;
  height: 36px;
  border: 2px solid #11131a;
  border-radius: 10px;
  color: #171920;
  cursor: pointer;
}
.floating-coauthor-mic { background: #d9eeab; }
.floating-coauthor-mic[aria-pressed="true"] { background: #ff8d96; }
#btn-coauthor-dictate[aria-pressed="true"] { background: #ff8d96; color: #171920 !important; }
.floating-coauthor-send { background: #ffb58f; }
.floating-coauthor-entry button:disabled { opacity: 0.55; cursor: wait; }
.floating-coauthor-status { min-height: 14px; color: #c9cbd3; font-size: 11px; }
body.coauthor-suggestion-active .floating-coauthor { display: none !important; }

@media (min-width: 901px) {
  body.panel-right-hidden .floating-coauthor,
  body.panel-right-auto:not(.panel-right-visible) .floating-coauthor { display: flex; }
}

/* VAULT & CODEX CARDS */
.source-card {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.source-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.source-card-title {
  font-weight: 600;
  color: #cbd5e1;
}

.source-card-quote {
  margin: 0;
  font-family: var(--font-prose);
  font-size: 14px;
  line-height: 1.45;
  color: #f1f5f9;
}

.vault-dropzone {
  min-height: 52px;
  border-radius: 12px;
  border: 1.5px dashed #475569;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  padding: 12px;
  text-align: center;
  transition: border-color 0.15s;
}

.vault-dropzone:hover {
  border-color: var(--accent-sky);
  color: #f1f5f9;
}

.codex-card {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.codex-term-title {
  font-family: var(--font-prose);
  font-size: 16px;
  font-weight: 600;
  color: #f1f5f9;
}

.strict-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-sky-subtle);
  color: var(--accent-sky);
  font-size: 11.5px;
  font-weight: 700;
}

.codex-term-def {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* AUDIT CARDS */
.issue-card {
  padding: 14px;
  border-radius: 14px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.issue-badge-critical {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-red);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.issue-badge-warning {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fcd34d;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.issue-fix-box {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-sidebar);
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer-bar {
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

/* ==========================================================================
   BUTTONS & MODALS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  color: #f1f5f9;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover {
  background: var(--border-card);
}

.btn-primary {
  background: var(--accent-sky);
  border-color: var(--accent-sky);
  color: #0f172a;
  font-weight: 700;
}

.btn-primary:hover {
  background: #7dd3fc;
  border-color: #7dd3fc;
}

.btn-emerald {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #052e22;
  font-weight: 700;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-card {
  width: 540px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  font-family: var(--font-ui);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}


/* ==========================================================================
   COMMAND PALETTE (CTRL+K / CMD+K)
   ========================================================================== */
.command-palette-card {
  width: 640px;
  max-width: 94vw;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-ui);
}

.palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #243247;
  background: #0b1324;
}

.palette-input-wrap svg {
  color: var(--accent-sky);
  flex-shrink: 0;
}

.palette-input {
  flex: 1;
  background: transparent;
  border: 0;
  color: #f1f5f9;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  outline: none;
}

.palette-input::placeholder {
  color: #64748b;
}

.palette-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.palette-category {
  padding: 8px 12px 4px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94a3b8;
  text-transform: uppercase;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  color: #cbd5e1;
  font-size: 13.5px;
  transition: all 0.1s ease;
}

.palette-item:hover, .palette-item.active {
  background: #1e293b;
  color: #f1f5f9;
}

.palette-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #0b1324;
  color: var(--accent-sky);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.palette-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.palette-item-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette-item-subtitle {
  font-size: 11.5px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette-item-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: #0b1324;
  color: #cbd5e1;
  border: 1px solid #334155;
  flex-shrink: 0;
}

.palette-footer {
  padding: 10px 18px;
  border-top: 1px solid #243247;
  background: #0b1324;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #64748b;
}

.palette-footer kbd {
  background: #1e293b;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #334155;
  color: #94a3b8;
  font-family: inherit;
  font-size: 11px;
}

/* ==========================================================================
   ONBOARDING WIZARD MODAL
   ========================================================================== */
.onboard-card {
  width: 680px;
  max-width: 95vw;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-ui);
}

.onboard-header {
  padding: 24px 28px 18px 28px;
  border-bottom: 1px solid #243247;
  background: #0b1324;
  display: flex;
  align-items: center;
  gap: 16px;
}

.onboard-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.25);
}

.onboard-title-group h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #f1f5f9;
}

.onboard-title-group p {
  margin: 4px 0 0 0;
  font-size: 13px;
  color: #94a3b8;
}

.onboard-steps-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: #131d33;
  border-bottom: 1px solid #243247;
  font-size: 12px;
}

.step-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-weight: 600;
}

.step-indicator.active {
  color: var(--accent-sky);
}

.step-indicator.completed {
  color: #34d399;
}

.step-num {
  width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.step-indicator.active .step-num {
  background: var(--accent-sky);
  color: #0f172a;
}

.step-indicator.completed .step-num {
  background: #34d399;
  color: #052e22;
}

.onboard-body {
  padding: 24px 28px;
  max-height: 520px;
  overflow-y: auto;
}

.onboard-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.onboard-mode-card {
  padding: 18px 16px;
  border-radius: 14px;
  background: #1e293b;
  border: 1.5px solid #334155;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.15s ease;
  user-select: none;
}

.onboard-mode-card:hover {
  border-color: #475569;
  transform: translateY(-2px);
}

.onboard-mode-card.selected {
  border-color: var(--accent-sky);
  background: rgba(56, 189, 248, 0.08);
  box-shadow: 0 4px 18px rgba(56, 189, 248, 0.18);
}

.onboard-mode-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.onboard-mode-title {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
}

.onboard-mode-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.45;
}

.onboard-footer {
  padding: 16px 28px;
  border-top: 1px solid #243247;
  background: #0b1324;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   MOBILE COMPANION SYNC MODAL
   ========================================================================== */
.mobile-sync-card {
  width: 660px;
  max-width: 95vw;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-ui);
}

.mobile-item-card {
  padding: 16px;
  border-radius: 14px;
  background: #1e293b;
  border: 1px solid #334155;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s;
}

.mobile-item-card:hover {
  border-color: #475569;
}

.mobile-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mobile-item-title {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-badge-voice {
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-sky);
  font-size: 11px;
  font-weight: 700;
}

.mobile-badge-scan {
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.15);
  color: var(--accent-amber);
  font-size: 11px;
  font-weight: 700;
}

.mobile-transcript-box {
  padding: 12px 14px;
  border-radius: 10px;
  background: #0b1324;
  font-family: var(--font-prose);
  font-size: 13.5px;
  line-height: 1.5;
  color: #cbd5e1;
  border-left: 3px solid var(--accent-sky);
}

.mobile-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: #64748b;
}

.mobile-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* ==========================================================================
   SOURCE INSPECTOR MODAL
   ========================================================================== */
.source-inspect-card {
  width: 700px;
  max-width: 95vw;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-ui);
}

.source-chunk-item {
  padding: 14px 16px;
  border-radius: 12px;
  background: #1e293b;
  border: 1px solid #334155;
  font-family: var(--font-prose);
  font-size: 14px;
  line-height: 1.55;
  color: #cbd5e1;
}

/* ==========================================================================
   MULTI-MANUSCRIPT PROJECT SWITCHER
   ========================================================================== */
.project-switcher-menu {
  position: absolute;
  top: 48px;
  left: 120px;
  z-index: 150;
  width: 340px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 14px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.7);
  padding: 8px;
  font-family: var(--font-ui);
}

.switcher-header {
  padding: 6px 10px 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94a3b8;
  text-transform: uppercase;
}

.switcher-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 0;
}

.switcher-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: #cbd5e1;
  font-size: 13.5px;
  transition: all 0.1s ease;
}

.switcher-item:hover {
  background: #1e293b;
  color: #f1f5f9;
}

.switcher-item.active {
  background: rgba(56, 189, 248, 0.14);
  color: #38bdf8;
  font-weight: 600;
}

.switcher-item-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.switcher-item-words {
  font-size: 11.5px;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.switcher-divider {
  height: 1px;
  background: #243247;
  margin: 6px 0;
}

.switcher-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.switcher-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.1s ease;
}

.switcher-action-btn:hover {
  background: #1e293b;
  color: var(--accent-sky);
}


/* ==========================================================================
   NOTION-STYLE RICH TEXT ELEMENTS IN CANVAS PAPER
   ========================================================================== */
.canvas-paper ul, .canvas-paper ol {
  margin: 14px 0 22px 32px;
  font-family: var(--font-prose);
  font-size: 18px;
  line-height: 1.7;
  color: var(--text-canvas, #e2e8f0);
}

.canvas-paper li {
  margin-bottom: 6px;
  padding-left: 4px;
}

.canvas-paper hr {
  margin: 36px 0;
  border: none;
  height: 1px;
  background: var(--border-canvas-subtle, rgba(255, 255, 255, 0.1));
}

.canvas-paper code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 15px;
  background: var(--code-bg, rgba(255, 255, 255, 0.08));
  color: var(--code-color, #38bdf8);
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: baseline;
}

.canvas-paper pre {
  background: #060b16;
  border: 1px solid var(--border-card);
  color: #f1f5f9;
  padding: 18px 22px;
  border-radius: 8px;
  font-size: 14.5px;
  line-height: 1.55;
  overflow-x: auto;
  margin: 24px 0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

.canvas-paper pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
}

.canvas-paper a {
  color: var(--accent-sky);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

.canvas-paper .cite-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-sky);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  user-select: none;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1.3;
  margin: 0 3px;
  transition: all 0.15s ease;
}

.canvas-paper .cite-pill:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: var(--accent-sky);
  color: #7dd3fc;
}

.canvas-paper .cite-warning-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--accent-amber);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  user-select: none;
  vertical-align: middle;
  line-height: 1.3;
  margin: 0 3px;
}

.canvas-paper .notion-callout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: rgba(30, 41, 59, 0.7);
  border-radius: 8px;
  border-left: 4px solid var(--accent-sky);
  margin: 24px 0;
  font-size: 17px;
  color: var(--text-canvas, #e2e8f0);
}

.canvas-paper .notion-callout-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1;
}

.canvas-paper .notion-callout-content {
  flex: 1;
  line-height: 1.55;
}

/* ==========================================================================
   WORKSPACE ACTIONS DRAWER & TOP BAR MINIMALISM
   ========================================================================== */
.workspace-drawer {
  position: absolute;
  top: 56px;
  right: 16px;
  width: 330px;
  background: #0f172a;
  border: 1px solid var(--border-card);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: drawerFadeIn 0.15s ease-out;
}

@keyframes drawerFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.workspace-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #0b1324;
  border-bottom: 1px solid var(--border-subtle);
}

.workspace-drawer-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.drawer-group-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  text-transform: uppercase;
  padding: 8px 10px 4px 10px;
}

.drawer-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s ease;
  width: 100%;
}

.drawer-action-btn:hover {
  background: #1e293b;
  color: #f1f5f9;
}

.drawer-action-btn i {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.drawer-btn-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.drawer-btn-label {
  font-weight: 600;
  color: inherit;
}

.drawer-btn-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-close-modal {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
  transition: all 0.1s ease;
}

.btn-close-modal:hover {
  background: #1e293b;
  color: #f1f5f9;
}

.onboard-project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #1e293b;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.onboard-project-item:hover {
  border-color: var(--accent-sky);
  background: #273549;
}

.onboard-project-item-title {
  font-weight: 600;
  font-size: 13.5px;
  color: #f1f5f9;
}

.onboard-project-item-meta {
  font-size: 12px;
  color: var(--text-muted);
}

:root {
  --bg-app: #1b1e29;
  --bg-sidebar: #262a37;
  --bg-card: #343947;
  --bg-card-hover: #414656;
  --bg-input: #343947;
  --bg-nested: #1b1e29;
  --text-primary: #fff5e7;
  --text-secondary: #e1ddd8;
  --text-muted: #b9b8bd;
  --text-subtle: #a5a3aa;
  --border-subtle: #474a57;
  --border-card: #5a5c69;
  --border-focus: #ffad83;
  --accent-sky: #ffad83;
  --accent-sky-hover: #ff926a;
  --accent-sky-subtle: rgba(255, 173, 131, 0.17);
  --accent-emerald: #c7e889;
  --accent-emerald-subtle: rgba(199, 232, 137, 0.17);
  --accent-amber: #ffd17d;
  --accent-amber-subtle: rgba(255, 209, 125, 0.18);
  --accent-purple: #c5b8ff;
  --accent-red: #ff8d96;
  --accent-red-badge: #e85569;
}

body.canvas-theme-dark .canvas-container {
  --bg-canvas: #20242f;
  --text-canvas: #f5ead9;
  --text-canvas-muted: #b9b8bd;
  --heading-canvas: #fff8ec;
  --bq-bg: rgba(255, 173, 131, 0.1);
  --code-color: #ffd17d;
}

.top-bar {
  height: 62px;
  background: #ffb58f;
  border-bottom: 3px solid #171920;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
}

.brand-badge,
.brand-badge .brand-name {
  color: #171920;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.055em;
}

.brand-badge img {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 2px solid #171920;
  box-shadow: 2px 2px 0 #171920;
}

.brand-period { color: #9d3045; }
.top-bar .header-divider { background: #171920; opacity: 0.4; }
.top-bar .project-title-btn { color: #171920; font-weight: 800; }
.top-bar .project-title-btn:hover { background: rgba(255, 255, 255, 0.3); }
.top-bar .search-command-bar {
  background: #fff3dc;
  color: #30303a;
  border: 2px solid #171920;
  box-shadow: 3px 3px 0 #171920;
}
.top-bar .kbd-shortcut { color: #30303a; }
.top-bar .synced-badge {
  color: #171920;
  background: #d9eeab;
  border: 2px solid #171920;
  border-radius: 8px;
}
.top-bar .status-dot { background: #557d22; }
.top-bar .btn-icon { color: #171920; }
.top-bar .btn-icon:hover { color: #171920; background: rgba(255, 255, 255, 0.3); }
.btn-compile-primary,
.btn-primary {
  background: #d9eeab;
  color: #171920;
  border: 2px solid #171920;
  border-radius: 9px;
  box-shadow: 3px 3px 0 #171920;
}
.btn-compile-primary:hover,
.btn-primary:hover {
  background: #ebf6c6;
  border-color: #171920;
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #171920;
}
.btn-compile-primary:active,
.btn-primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #171920; }

.binder-panel { border-right: 3px solid #171920; }
.right-panel { border-left: 3px solid #171920; }
.binder-title,
.drawer-group-title { color: #ffd17d; }
.binder-btn-icon {
  border: 2px solid #171920;
  background: #ffb58f;
  color: #171920;
  box-shadow: 2px 2px 0 #171920;
}
.editor-subbar { border-bottom: 2px solid #171920; }
.node-title-input { color: #fff5e7; font-weight: 700; }
.tab-btn.active { color: #fff5e7; border-bottom-width: 4px; }
.modal-card,
.onboard-card,
.workspace-drawer,
.command-palette-card {
  background: #262a37;
  border: 2px solid #11131a;
  box-shadow: 8px 8px 0 #11131a;
}
.onboard-header {
  background: #ffb58f;
  border-bottom: 3px solid #171920;
}
.onboard-title-group h2 { color: #171920; font-weight: 800; letter-spacing: -0.04em; }
.onboard-title-group p { color: #34303a; }
.onboard-logo { border: 2px solid #171920; box-shadow: 3px 3px 0 #171920; }
.canvas-paper ::selection { background: #ffad83; color: #171920; }
:focus-visible { outline: 3px solid #d9eeab; outline-offset: 3px; }

@media (max-width: 1180px) {
  .binder-panel { width: 244px; }
  .right-panel { width: 308px; }
  .canvas-paper { padding-left: 30px; padding-right: 30px; }
}

@media (max-width: 900px) {
  .save-now-btn { min-height: 44px; min-width: 52px; }
  body { height: auto; min-height: 100vh; overflow: auto; }
  .workspace { display: flex; flex-direction: column; overflow: visible; }
  .binder-panel,
  .right-panel { width: 100%; flex-shrink: 0; border-left: 0; border-right: 0; }
  .binder-panel { max-height: 270px; border-bottom: 3px solid #171920; }
  .editor-panel { min-height: 600px; flex: none; }
  .canvas-container { min-height: 480px; }
  .right-panel { min-height: 370px; border-top: 3px solid #171920; }
  .top-bar-center { display: none; }
  .top-bar-left { min-width: 0; flex: 1; }
  .project-title-btn { overflow: hidden; max-width: 42vw; }
  .project-title-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 600px) {
  .top-bar { padding: 0 10px; gap: 6px; }
  .brand-badge .brand-name { font-size: 18px; }
  .brand-badge img { width: 28px; height: 28px; }
  .top-bar .synced-badge { display: none; }
  .top-bar .btn-compile-primary { padding: 0 8px; }
  .header-divider { display: none; }
  .project-title-btn { max-width: 36vw; font-size: 12px; }
  .editor-subbar { height: auto; min-height: 54px; padding: 8px 12px; flex-wrap: wrap; }
  .canvas-paper { padding: 24px 18px 180px; font-size: 17px; }
  .right-tablist { overflow-x: auto; }
  .tab-btn { flex-shrink: 0; }
  .modal-card,
  .onboard-card { max-width: calc(100vw - 20px); max-height: calc(100dvh - 24px); }
}
.export-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin: 0 0 18px;
  color: var(--text-secondary);
  font-size: 13px;
}

.export-options label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.export-options input {
  accent-color: var(--accent-sky);
}
.capture-file-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.capture-file-controls label {
  display: flex;
  flex: 1 1 180px;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.capture-file-controls input {
  max-width: 100%;
  font-size: 12px;
}

.capture-preview {
  display: block;
  max-width: 100%;
  max-height: 220px;
  margin: 8px 0;
  border-radius: 8px;
}

.capture-review-text {
  width: 100%;
  min-height: 88px;
  margin: 8px 0;
}

.mobile-navigation { display: none; }

.editor-command-trigger { width: auto; padding: 0 10px; font-family: var(--font-ui); font-weight: 700; }
.editor-command-menu[hidden] { display: none; }
.editor-command-menu {
  position: fixed;
  z-index: 180;
  width: min(340px, calc(100vw - 20px));
  max-height: min(440px, 70dvh);
  overflow: auto;
  padding: 10px;
  border: 2px solid #11131a;
  border-radius: 12px;
  background: #262a37;
  box-shadow: 6px 6px 0 #11131a;
}
.editor-command-menu input { width: 100%; }
.editor-command-results { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.editor-command-result {
  width: 100%;
  min-height: 48px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff5e7;
  text-align: left;
  font-family: var(--font-ui);
  cursor: pointer;
}
.editor-command-result[aria-selected="true"],
.editor-command-result:hover { background: #424250; }
.editor-command-result strong,
.editor-command-result small { display: block; }
.editor-command-result small { color: #c0c4ce; margin-top: 2px; font-size: 11px; }
.editor-command-empty { padding: 12px; color: #c0c4ce; font-size: 12px; }

@media (max-width: 900px) {
  body { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .footer-bar { display: none; }
  .workspace { min-height: calc(100dvh - 132px - env(safe-area-inset-bottom)); }
  .workspace .binder-panel,
  .workspace .editor-panel,
  .workspace .right-panel { display: none; }
  body[data-mobile-view="outline"] .workspace .binder-panel,
  body[data-mobile-view="write"] .workspace .editor-panel,
  body[data-mobile-view="research"] .workspace .right-panel { display: flex; width: 100%; }
  body[data-mobile-view="outline"] .workspace .binder-panel { max-height: none; min-height: 68dvh; }
  body[data-mobile-view="research"] .workspace .right-panel { min-height: 68dvh; }
  body[data-mobile-view="write"] .workspace .editor-panel { min-height: 68dvh; }
  body[data-mobile-view="write"] .floating-coauthor {
    display: flex;
    position: fixed;
    right: 12px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    left: 12px;
    transform: none;
    width: auto;
  }
  .mobile-navigation {
    position: fixed;
    z-index: 100;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: stretch;
    gap: 6px;
    min-height: 68px;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    background: #171920;
    border-top: 2px solid #0b0c10;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
  }
  .mobile-destinations { display: flex; flex: 1; min-width: 0; }
  .mobile-destinations button,
  .mobile-capture-action {
    min-width: 0;
    min-height: 48px;
    border: 0;
    border-radius: 10px;
    font: 700 11px var(--font-ui);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
  }
  .mobile-destinations button { flex: 1; color: #b9bbca; background: transparent; }
  .mobile-destinations button[aria-current="page"] { color: #171920; background: #d9eeab; }
  .mobile-destinations i,
  .mobile-capture-action i { font-size: 17px; }
  .mobile-capture-action {
    flex: 0 0 76px;
    color: #171920;
    background: #ffb58f;
    border: 2px solid #0b0c10;
    box-shadow: 2px 2px 0 #0b0c10;
  }
  .mobile-sync-card { max-height: calc(100dvh - 16px); overflow-y: auto; }
  #mobile-inbox-items-container { min-height: 0; max-height: 32dvh !important; }
}

.save-conflict-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 10, 16, 0.88);
}
.save-conflict-panel {
  width: min(100%, 1050px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 20px;
  border: 2px solid #0b0c10;
  border-radius: 14px;
  background: #22252f;
  color: #f4f4f6;
  box-shadow: 8px 8px 0 #0b0c10;
}
.save-conflict-panel h2 { margin: 0 0 8px; font-size: 20px; }
.save-conflict-panel p { color: #ced2df; }
.save-conflict-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.save-conflict-columns section { min-width: 0; }
.save-conflict-columns h3 { font-size: 13px; }
.save-conflict-columns pre {
  min-height: 180px;
  max-height: 50dvh;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 12px;
  border: 1px solid #565a68;
  border-radius: 8px;
  background: #141720;
  font: 13px/1.5 var(--font-ui);
}
.save-conflict-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.save-conflict-actions button { min-height: 44px; padding: 9px 14px; border-radius: 7px; cursor: pointer; }
.save-conflict-actions button:first-child { background: #d9eeab; color: #171920; }
.account-panel { max-width: 680px; }
.account-panel h3 { margin: 18px 0 8px; }
.account-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #4c5260;
}
.account-session button { min-height: 40px; padding: 8px 12px; }
@media (max-width: 700px) {
  .save-conflict-columns { grid-template-columns: 1fr; }
  .save-conflict-columns pre { min-height: 100px; max-height: 25dvh; }
}
