/* ══════════════════════════════════════════════════════════════
   WRITER — Mellio manuscript editor styles
   ══════════════════════════════════════════════════════════════ */

/* ── Layout ── */

#writerMode {
  display: flex;
  flex: 1;
  min-height: 0;
}

.writer-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  background: radial-gradient(ellipse at top, rgba(239, 228, 213, 0.85), rgba(245, 241, 233, 0.95) 60%);
}

.writer-shell-top {
  flex-shrink: 0;
}

.writer-shell-actions {
  margin-left: auto;
}

.writer-sub {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.writer-sub.active {
  display: flex;
}

.writer-panel-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 8px;
}


/* ══════════════════════════════════════════
   DASHBOARD
   ══════════════════════════════════════════ */

.writer-dash-shell {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.writer-dash-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px 32px 18px;
  flex-shrink: 0;
}

.writer-title {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.writer-title em {
  font-style: italic;
}

.writer-subtitle {
  font-size: 13px;
  color: var(--text-muted, var(--ink-3));
  margin-top: 4px;
}

.writer-dash-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Document grid */
.writer-doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  padding: 0 32px 32px;
  overflow-y: auto;
  flex: 1;
}

.writer-doc-card {
  background: var(--white);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  border: 1px solid rgba(22, 20, 14, 0.06);
  box-shadow: 0 1px 3px rgba(22, 20, 14, 0.04);
  transition: box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.writer-doc-card:hover {
  box-shadow: 0 2px 8px rgba(22, 20, 14, 0.08);
  border-color: rgba(22, 20, 14, 0.12);
}

.writer-doc-card-title {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.writer-doc-card-meta {
  font-size: 12px;
  color: var(--text-muted, var(--ink-3));
  display: flex;
  gap: 8px;
  align-items: center;
}

.writer-doc-card-preview {
  font-size: 13px;
  color: var(--text-muted, var(--ink-3));
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  margin-top: 4px;
}

.writer-doc-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
}

.writer-doc-card-style {
  font-size: 11px;
  color: var(--green);
  font-weight: 500;
  background: rgba(74, 124, 89, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
}

.writer-doc-card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.writer-doc-card:hover .writer-doc-card-actions {
  opacity: 1;
}

.writer-doc-card-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted, var(--ink-3));
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.writer-doc-card-btn:hover {
  background: rgba(22, 20, 14, 0.06);
  color: var(--ink);
}

.writer-doc-card-btn.danger:hover {
  background: rgba(231, 76, 60, 0.08);
  color: #e74c3c;
}

/* Empty state */
.writer-empty,
.writer-signin-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  text-align: center;
  flex: 1;
}

.writer-empty-icon {
  color: var(--text-muted, var(--ink-3));
  opacity: 0.4;
  margin-bottom: 16px;
}

.writer-empty h3,
.writer-signin-prompt h3 {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 8px;
}

.writer-empty p,
.writer-signin-prompt p {
  font-size: 14px;
  color: var(--text-muted, var(--ink-3));
  margin: 0 0 20px;
}


/* ══════════════════════════════════════════
   NEW DOCUMENT DIALOG
   ══════════════════════════════════════════ */

.writer-new-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 20, 14, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.writer-new-dialog {
  background: var(--white);
  border-radius: 14px;
  padding: 32px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(22, 20, 14, 0.15);
}

.writer-new-dialog h3 {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 20px;
  color: var(--ink);
}

.writer-new-dialog label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}

.writer-new-dialog input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(22, 20, 14, 0.12);
  border-radius: 8px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  background: var(--white);
  color: var(--ink);
  margin-bottom: 16px;
  box-sizing: border-box;
}

.writer-new-dialog input[type="text"]:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(74, 124, 89, 0.15);
}

.writer-style-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.writer-style-option {
  padding: 10px;
  border: 1px solid rgba(22, 20, 14, 0.1);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: var(--white);
  transition: all 0.15s;
}

.writer-style-option:hover {
  border-color: var(--green);
}

.writer-style-option.selected {
  border-color: var(--green);
  background: rgba(74, 124, 89, 0.06);
  color: var(--green);
}

.writer-new-dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}


/* ══════════════════════════════════════════
   EDITOR — DOC NAME (breadcrumb in e-top)
   ══════════════════════════════════════════ */

.writer-doc-name-input {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #6a6460;
  background: none;
  border: none;
  padding: 2px 6px;
  border-radius: 4px;
  max-width: 200px;
  text-overflow: ellipsis;
  overflow: hidden;
  transition: background 0.15s;
}
.writer-doc-name-input:hover {
  background: rgba(22, 20, 14, 0.04);
}
.writer-doc-name-input:focus {
  outline: none;
  background: rgba(22, 20, 14, 0.06);
  color: #3a3530;
}
.writer-doc-name-input::placeholder {
  color: #b5b0a8;
}
.writer-doc-name-sep {
  color: #c5bfb5;
}

/* Save status hidden — auto-save is silent */
.writer-save-dot,
.writer-save-text,
.writer-save-text + .writer-wc-sep {
  display: none;
}


/* ══════════════════════════════════════════
   EDITOR — TOOLBAR DOCK (content-aligned)
   ══════════════════════════════════════════ */

.writer-toolbar-dock {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8vh 32px 4px;
}

.writer-toolbar-row {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  width: 100%;
  max-width: 760px;
  flex-wrap: wrap;
  overflow: visible;
  /* visual container — adapted from .fig-annotation-toolbar */
  background: rgba(245, 242, 235, 0.7);
  border: 1px solid rgba(212, 206, 196, 0.45);
  border-radius: 8px;
}

/* ── Tool groups (no labels) ── */
.writer-tb-labeled-group {
  display: flex;
  align-items: center;
  position: relative;
}

/* ── Button groups ── */
.writer-tb-group {
  display: flex;
  gap: 1px;
}

.writer-tb-btn {
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  color: #6a6460;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s;
}

.writer-tb-btn:hover {
  background: #ebe7de;
  color: #3a3530;
}

.writer-tb-btn.active {
  color: #2d5a27;
  background: rgba(74, 124, 89, 0.1);
  border-color: rgba(74, 124, 89, 0.15);
}

.writer-tb-letter {
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.writer-tb-div {
  width: 1px;
  height: 28px;
  background: #d4cec4;
  margin: 0 4px;
  align-self: flex-end;
  margin-bottom: 4px;
}

/* ── Dropdown trigger ── */
.writer-tb-dropdown-wrap {
  position: relative;
}

.writer-tb-dropdown-trigger {
  gap: 4px;
}

.writer-tb-dropdown-text {
  font-size: 12px;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Dropdown menu ── */
.writer-tb-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  border: 1px solid rgba(22, 20, 14, 0.1);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(22, 20, 14, 0.12);
  padding: 4px;
  min-width: 140px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.writer-tb-dropdown-menu-right {
  left: auto;
  right: 0;
  transform: none;
}

.writer-tb-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  background: none;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
  text-align: left;
  width: 100%;
}

.writer-tb-dropdown-item:hover,
.writer-tb-dropdown-item:focus {
  background: rgba(22, 20, 14, 0.05);
  outline: none;
}

.writer-tb-dropdown-item.active {
  color: #2d5a27;
  background: rgba(74, 124, 89, 0.08);
}


/* ══════════════════════════════════════════
   EDITOR — FIND & REPLACE
   ══════════════════════════════════════════ */

.writer-find-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  flex-shrink: 0;
  width: 100%;
  max-width: 760px;
}

.writer-find-bar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(22, 20, 14, 0.08);
  border-radius: 10px;
  padding: 6px 12px;
  box-shadow: 0 1px 4px rgba(22, 20, 14, 0.04);
}

.writer-find-input {
  padding: 5px 10px;
  border: 1px solid rgba(22, 20, 14, 0.12);
  border-radius: 6px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  width: 180px;
  background: var(--white);
  color: var(--ink);
}

.writer-find-input:focus {
  outline: none;
  border-color: var(--green);
}

.writer-find-count {
  font-size: 12px;
  color: var(--text-muted, var(--ink-3));
  min-width: 50px;
}

.writer-find-btn {
  background: none;
  border: 1px solid rgba(22, 20, 14, 0.1);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
}

.writer-find-btn:hover {
  background: rgba(22, 20, 14, 0.04);
}

.writer-find-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-muted, var(--ink-3));
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
}

.writer-find-close:hover {
  background: rgba(22, 20, 14, 0.06);
  color: var(--ink);
}


/* ══════════════════════════════════════════
   EDITOR — LAYOUT (editor + sidebar)
   ══════════════════════════════════════════ */

.writer-editor-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.writer-editor-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}


/* ══════════════════════════════════════════
   EDITOR — WRITING SURFACE
   ══════════════════════════════════════════ */

.writer-surface {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 232px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.writer-writing-shell {
  width: 100%;
  max-width: 1260px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 18px;
}

.writer-paper-stage {
  position: relative;
  flex: 1 1 760px;
  max-width: 760px;
  min-width: 0;
}

.writer-paper {
  position: relative;
  background: var(--white);
  width: 100%;
  min-height: 600px;
  padding: 72px 72px;
  border-radius: 4px;
  border: 1px solid rgba(22, 20, 14, 0.10);
  box-shadow: 0 1px 3px rgba(22, 20, 14, 0.06), 0 8px 24px rgba(22, 20, 14, 0.06);
}

/* ── Page break indicators ── */
.writer-page-break {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px dashed rgba(93, 72, 46, 0.18);
  pointer-events: none;
  z-index: 2;
}
.writer-page-break::after {
  content: attr(data-page-label);
  position: absolute;
  right: 12px;
  top: -10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  color: rgba(93, 72, 46, 0.35);
  background: var(--white);
  padding: 0 6px;
  letter-spacing: 0.5px;
}

/* ── Page indicator in bottom bar ── */
.writer-page-indicator {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: rgba(93, 72, 46, 0.5);
  margin-left: 12px;
}

.writer-quick-insert {
  position: absolute;
  top: 18px;
  left: calc(100% + 16px);
  width: 320px;
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(93, 72, 46, 0.12);
  background: rgba(251, 247, 241, 0.97);
  box-shadow: 0 12px 30px rgba(22, 20, 14, 0.12);
  backdrop-filter: blur(10px);
  z-index: 4;
}

.writer-quick-insert.open {
  display: flex;
}

.writer-quick-insert-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.writer-quick-insert-eyebrow,
.writer-asset-picker-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 6px;
}

.writer-quick-insert-head h3 {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  margin: 0;
}

.writer-quick-insert-close,
.writer-asset-picker-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, var(--ink-3));
  padding: 6px 8px;
  border-radius: 8px;
}

.writer-quick-insert-close:hover,
.writer-asset-picker-close:hover {
  background: rgba(22, 20, 14, 0.06);
  color: var(--ink);
}

.writer-quick-insert-tabs {
  display: inline-flex;
  align-self: flex-start;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(22, 20, 14, 0.05);
}

.writer-quick-tab {
  border: none;
  background: transparent;
  color: var(--text-muted, var(--ink-3));
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.writer-quick-tab.active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(22, 20, 14, 0.08);
}

.writer-quick-insert-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(22, 20, 14, 0.1);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-muted, var(--ink-3));
}

.writer-quick-insert-search:focus-within {
  border-color: rgba(74, 124, 89, 0.45);
  box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.1);
}

.writer-quick-insert-search input,
.writer-asset-search-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
}

.writer-quick-insert-search input:focus,
.writer-asset-search-input:focus {
  outline: none;
}

.writer-quick-insert-hint {
  font-size: 11px;
  color: var(--text-muted, var(--ink-3));
}

.writer-quick-insert-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.writer-quick-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.74);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, background 0.12s, transform 0.12s;
}

.writer-quick-result:hover,
.writer-quick-result.active {
  background: rgba(74, 124, 89, 0.08);
  border-color: rgba(74, 124, 89, 0.18);
  transform: translateY(-1px);
}

.writer-quick-result-main {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.writer-quick-result-meta {
  font-size: 12px;
  color: var(--text-muted, var(--ink-3));
}

.writer-quick-insert-empty {
  padding: 20px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-muted, var(--ink-3));
  font-size: 13px;
  text-align: center;
}

.writer-quick-insert-foot {
  display: flex;
  justify-content: flex-start;
}

.writer-quick-insert-browse {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
}

.writer-quick-insert-browse:hover {
  color: var(--ink);
}


/* ── TipTap editor content ── */

#writerEditorContent {
  outline: none;
}

#writerEditorContent .tiptap {
  outline: none;
}

#writerEditorContent .tiptap:focus {
  outline: none;
}

#writerEditorContent .tiptap p {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 0.75em;
}

#writerEditorContent .tiptap h1 {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  margin: 1.5em 0 0.5em;
  line-height: 1.3;
}

#writerEditorContent .tiptap h2 {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin: 1.25em 0 0.4em;
  line-height: 1.3;
}

#writerEditorContent .tiptap h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin: 1em 0 0.4em;
  line-height: 1.4;
}

#writerEditorContent .tiptap ul,
#writerEditorContent .tiptap ol {
  padding-left: 24px;
  margin: 0 0 0.75em;
}

#writerEditorContent .tiptap li {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 0.25em;
}

#writerEditorContent .tiptap hr {
  border: none;
  border-top: 1px solid rgba(22, 20, 14, 0.1);
  margin: 1.5em 0;
}

#writerEditorContent .tiptap blockquote {
  border-left: 3px solid var(--green);
  padding-left: 16px;
  margin: 1em 0;
  color: var(--text-muted, var(--ink-3));
}

#writerEditorContent .tiptap code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: rgba(22, 20, 14, 0.04);
  padding: 2px 4px;
  border-radius: 3px;
}

/* Placeholder */
#writerEditorContent .tiptap p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--text-muted, var(--ink-3));
  opacity: 0.5;
  pointer-events: none;
  height: 0;
  font-style: italic;
}

/* Find & replace highlight */
.writer-search-highlight {
  background: rgba(255, 213, 79, 0.4);
  border-radius: 2px;
}

.writer-search-highlight-current {
  background: rgba(255, 152, 0, 0.5);
  border-radius: 2px;
}


/* ══════════════════════════════════════════
   EDITOR — STATUS (in bottom bar)
   ══════════════════════════════════════════ */

.writer-eb-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted, var(--ink-3));
}

/* Hide section count + its preceding separator in bottom bar */
.writer-eb-status #writerSectionCount,
.writer-eb-status .writer-wc-sep ~ .writer-wc-sep {
  display: none;
}

.writer-wc-sep {
  opacity: 0.4;
}


/* ══════════════════════════════════════════
   EDITOR — DOCUMENT TRAY
   ══════════════════════════════════════════ */

/* Bottom bar */
.writer-e-bottom {
  position: fixed;
  bottom: 0;
  left: 56px;
  right: 0;
  height: 50px;
  background: var(--cream);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 32px;
  z-index: 20;
}

/* Toggle button */
.writer-tray-toggle {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #3a3530;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
}
.writer-tray-toggle:hover { opacity: 0.8; }
.writer-tray-badge {
  font-family: system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: white;
  background: var(--green);
  padding: 1px 7px;
  border-radius: 10px;
}
.writer-tray-arrow {
  font-size: 16px;
  color: #9a9490;
  line-height: 1;
}

/* Tray panel — hidden by default via height:0 + overflow:hidden */
.writer-doc-tray {
  position: fixed;
  bottom: 50px;
  left: 56px;
  right: 0;
  height: 0;
  overflow: hidden;
  background: var(--cream);
  border-top: none;
  padding: 0 32px;
  z-index: 19;
  display: flex;
  flex-direction: column;
  transition: height 0.25s ease, padding 0.25s ease;
}
.writer-doc-tray.writer-doc-tray-open {
  border-top: 1px solid var(--line);
  padding: 14px 32px 12px;
  overflow: visible;
}

/* Resize handle */
.writer-tray-resize {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 64px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ns-resize;
  z-index: 3;
}
.writer-tray-resize-pill {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  transition: all 0.15s;
}
.writer-tray-resize:hover .writer-tray-resize-pill,
.writer-tray-resize.tray-dragging .writer-tray-resize-pill {
  background: var(--ink-3);
  width: 44px;
}

/* Category pills */
.writer-tray-pills {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  flex-shrink: 0;
}
.writer-tray-pill {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.writer-tray-pill:hover { background: var(--cream-2); }
.writer-tray-pill.active { background: var(--green); color: white; border-color: var(--green); }

/* Tray body */
.writer-tray-body {
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  min-height: 0;
  position: relative;
}

/* Empty state */
.writer-doc-tray-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-width: 100%;
  color: var(--ink-3);
  font-size: 12px;
}

/* Drawer cards container */
.writer-doc-drawer {
  display: flex;
  gap: 8px;
  align-items: stretch;
  height: 100%;
}

/* Individual card */
.writer-doc-tray-card {
  min-width: calc(210px * var(--tray-scale, 1));
  max-width: calc(240px * var(--tray-scale, 1));
  background: #fdfcf8;
  border: 1px solid #d4cec4;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(70, 55, 25, 0.08);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.18s ease;
}
.writer-doc-tray-card:hover {
  border-color: var(--green-rule);
  box-shadow: 0 4px 18px rgba(26, 74, 56, 0.14), 0 0 0 2px rgba(26, 74, 56, 0.06);
  transform: translateY(-2px) scale(1.02);
}

/* Card head */
.writer-doc-tray-card .dc-card-head {
  border-bottom: none;
  background: transparent;
  padding: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.writer-doc-tray-card .dc-card-name {
  font-family: system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: #3a3530;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.writer-doc-tray-style {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--green);
  background: rgba(74, 124, 89, 0.08);
  border-radius: 999px;
  padding: 2px 6px;
  flex-shrink: 0;
}

/* Card body */
.writer-doc-tray-card .dc-card-body {
  padding: 0;
  min-height: 0;
  max-height: calc(80px * var(--tray-scale, 1));
  overflow: hidden;
  flex: 1;
}

/* Mini document preview (scaled) */
.writer-doc-mini-preview {
  transform: scale(calc(0.5 * var(--tray-scale, 1)));
  transform-origin: top left;
  width: calc(200% / var(--tray-scale, 1));
  pointer-events: none;
  max-height: 400px;
  overflow: hidden;
  padding: 8px 10px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 241, 233, 0.92));
  border: 1px solid rgba(22, 20, 14, 0.06);
}
.writer-doc-mini-preview h1,
.writer-doc-mini-preview h2,
.writer-doc-mini-preview h3 {
  font-family: var(--serif, Georgia, serif);
  color: var(--ink);
  margin: 0 0 3px;
  line-height: 1.3;
}
.writer-doc-mini-preview h1 { font-size: 14px; }
.writer-doc-mini-preview h2 { font-size: 12px; }
.writer-doc-mini-preview h3 { font-size: 11px; }
.writer-doc-mini-preview p {
  font-size: 10px;
  line-height: 1.45;
  color: var(--ink-2);
  margin: 0 0 2px;
}
.writer-doc-mini-preview ul,
.writer-doc-mini-preview ol {
  font-size: 10px;
  line-height: 1.45;
  color: var(--ink-2);
  margin: 0 0 2px;
  padding-left: 14px;
}

/* Card foot */
.writer-doc-tray-card .dc-card-foot {
  font-size: 9px;
  color: #8d8579;
  border-top: none;
  padding: 4px 0 0;
  margin-top: 4px;
  flex-shrink: 0;
}

/* Editing state */
.writer-doc-tray-card.dc-editing {
  border-color: var(--green);
  border-width: 2px;
}
.writer-doc-tray-card .dc-editing-badge {
  font-size: 9px;
  font-weight: 600;
  color: white;
  background: var(--green);
  padding: 1px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* Color label */
.writer-doc-tray-card[data-label] {
  border-left: 3.5px solid var(--card-label);
}

/* Delete button (hover reveal) */
.writer-doc-delete {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--white);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  color: var(--ink-3);
  z-index: 2;
  padding: 0;
}
.writer-doc-tray-card:hover .writer-doc-delete { opacity: 1; }
.writer-doc-delete:hover { background: #fde8e8; color: #c0392b; border-color: #c0392b; }


/* ══════════════════════════════════════════
   SLASH COMMAND MENU
   ══════════════════════════════════════════ */

.writer-slash-menu {
  position: absolute;
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(22, 20, 14, 0.12), 0 1px 4px rgba(22, 20, 14, 0.06);
  border: 1px solid rgba(22, 20, 14, 0.08);
  padding: 4px;
  min-width: 200px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
}

.writer-slash-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink);
  transition: background 0.1s;
}

.writer-slash-item:hover,
.writer-slash-item.active {
  background: rgba(74, 124, 89, 0.06);
}

.writer-slash-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(22, 20, 14, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-muted, var(--ink-3));
  flex-shrink: 0;
}

.writer-slash-label {
  font-weight: 500;
}

.writer-slash-desc {
  font-size: 11px;
  color: var(--text-muted, var(--ink-3));
}


/* ══════════════════════════════════════════
   ASSET PICKER (inline sidebar)
   ══════════════════════════════════════════ */

.writer-asset-picker {
  width: 340px;
  max-height: min(72vh, 760px);
  position: sticky;
  top: 18px;
  align-self: flex-start;
  background: rgba(252, 249, 244, 0.96);
  border: 1px solid rgba(93, 72, 46, 0.12);
  border-radius: 20px;
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(22, 20, 14, 0.1);
  backdrop-filter: blur(10px);
}

.writer-asset-picker.open {
  display: flex;
}

.writer-asset-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 10px;
  flex-shrink: 0;
}

.writer-asset-picker-titlewrap {
  min-width: 0;
}

.writer-asset-picker-head h3 {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 500;
  margin: 0 0 4px;
  color: var(--ink);
}

.writer-asset-picker-head p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted, var(--ink-3));
  max-width: 28ch;
}

.writer-asset-picker-tabs {
  display: flex;
  gap: 6px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.writer-asset-tab {
  flex: 0 0 auto;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-muted, var(--ink-3));
  background: rgba(22, 20, 14, 0.04);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  text-align: center;
}

.writer-asset-tab.active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(74, 124, 89, 0.18);
  box-shadow: 0 4px 12px rgba(22, 20, 14, 0.06);
}

.writer-asset-picker-search {
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.writer-asset-search-input {
  padding: 10px 12px;
  border: 1px solid rgba(22, 20, 14, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  box-sizing: border-box;
}

.writer-asset-search-input:focus {
  border-color: rgba(74, 124, 89, 0.45);
  box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.1);
}

.writer-asset-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
  display: grid;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(152, 143, 132, 0.85) rgba(22, 20, 14, 0.06);
}

/* Rich preview cards */
.writer-asset-card {
  border: 1px solid rgba(22, 20, 14, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  overflow: hidden;
  margin-bottom: 0;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.writer-asset-card:hover {
  border-color: rgba(22, 20, 14, 0.15);
  box-shadow: 0 8px 18px rgba(22, 20, 14, 0.06);
  transform: translateY(-1px);
}

.writer-asset-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 6px;
}

.writer-asset-card-copy {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.writer-asset-card-copy strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.writer-asset-card-copy span {
  font-size: 12px;
  color: var(--text-muted, var(--ink-3));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.writer-asset-card-meta {
  padding: 0 12px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: rgba(36, 94, 68, 0.86);
}

.writer-asset-card-preview {
  padding: 0 12px 12px;
  min-height: 138px;
  max-height: 220px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(36, 94, 68, 0.9) rgba(36, 94, 68, 0.12);
}

/* Scaled HTML table preview (matches hub .dc-mini-table style) */
.writer-mini-table {
  transform: scale(0.45);
  transform-origin: top left;
  pointer-events: none;
  width: 222%;  /* 100% / 0.45 to fill container width */
  max-height: 400px;
  overflow: hidden;
}

.writer-asset-table-preview-canvas {
  min-width: max-content;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.writer-asset-table-preview-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(104px, 1fr);
  gap: 6px;
  min-width: max-content;
}

.writer-asset-preview-cell {
  min-width: 104px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(22, 20, 14, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-size: 10px;
  line-height: 1.35;
  text-align: left;
  box-sizing: border-box;
}

.writer-asset-preview-cell.stub {
  min-width: 136px;
  font-weight: 600;
}

.writer-asset-preview-cell.header {
  background: rgba(239, 234, 226, 0.92);
  font-weight: 700;
}

.writer-asset-preview-cell.section {
  background: rgba(245, 241, 235, 0.96);
  font-style: italic;
}

.writer-asset-preview-placeholder {
  color: rgba(152, 143, 132, 0.85);
  font-weight: 600;
}

.writer-asset-preview-more {
  min-width: 42px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px dashed rgba(22, 20, 14, 0.14);
  border-radius: 10px;
  background: rgba(247, 244, 238, 0.9);
  color: var(--text-muted, var(--ink-3));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 700;
  box-sizing: border-box;
}

.writer-asset-preview-overflow {
  padding: 8px 10px;
  border: 1px dashed rgba(36, 94, 68, 0.18);
  border-radius: 10px;
  background: rgba(36, 94, 68, 0.06);
  color: rgba(36, 94, 68, 0.86);
  font-size: 11px;
  font-weight: 600;
  align-self: flex-start;
}

.writer-asset-card-preview-figure {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 164px;
  background: linear-gradient(180deg, rgba(22, 20, 14, 0.02), rgba(22, 20, 14, 0.03));
  border-radius: 12px;
}

.writer-asset-card-preview-figure img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 10px;
  display: block;
  object-fit: contain;
}

.writer-asset-card-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 132px;
  border: 1px dashed rgba(22, 20, 14, 0.12);
  border-radius: 12px;
  background: rgba(247, 244, 238, 0.82);
  color: var(--text-muted, var(--ink-3));
  font-size: 12px;
}

.writer-asset-insert-btn {
  flex: 0 0 auto;
  min-width: 84px;
  padding: 9px 14px;
  border: 1px solid rgba(36, 94, 68, 0.16);
  border-radius: 999px;
  background: #245e44;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(36, 94, 68, 0.18);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.writer-asset-insert-btn:hover {
  background: #1d4f39;
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(36, 94, 68, 0.22);
}

.writer-asset-insert-btn:active {
  transform: translateY(0);
  box-shadow: 0 6px 12px rgba(36, 94, 68, 0.16);
}

.writer-asset-picker-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted, var(--ink-3));
  font-size: 13px;
}

.writer-asset-list::-webkit-scrollbar,
.writer-asset-card-preview::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.writer-asset-list::-webkit-scrollbar-track {
  background: rgba(22, 20, 14, 0.06);
  border-radius: 999px;
}

.writer-asset-card-preview::-webkit-scrollbar-track {
  background: rgba(36, 94, 68, 0.12);
  border-radius: 999px;
}

.writer-asset-list::-webkit-scrollbar-thumb {
  background: rgba(152, 143, 132, 0.85);
  border-radius: 999px;
}

.writer-asset-card-preview::-webkit-scrollbar-thumb {
  background: rgba(36, 94, 68, 0.9);
  border-radius: 999px;
}

/* ══════════════════════════════════════════
   REVIEWER COLOR TOKENS
   ══════════════════════════════════════════ */

:root {
  --reviewer-a: #4A7C59;
  --reviewer-b: #6B5B95;
  --reviewer-c: #D2691E;
  --reviewer-d: #2980B9;
  --reviewer-e: #C0392B;
  --reviewer-f: #16A085;
  --reviewer-g: #8E44AD;
  --reviewer-h: #E67E22;
}

/* ══════════════════════════════════════════
   REVIEW PANEL (inline sidebar)
   ══════════════════════════════════════════ */

.writer-review-panel {
  width: 340px;
  max-height: min(72vh, 760px);
  position: sticky;
  top: 18px;
  align-self: flex-start;
  background: rgba(252, 249, 244, 0.96);
  border: 1px solid rgba(93, 72, 46, 0.12);
  border-radius: 20px;
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(22, 20, 14, 0.1);
  backdrop-filter: blur(10px);
}

.writer-review-panel.open {
  display: flex;
}

.writer-writing-shell.has-review {
  max-width: 1200px;
}

.writer-review-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 10px;
  flex-shrink: 0;
}

.writer-review-panel-titlewrap {
  min-width: 0;
}

.writer-review-panel-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted, var(--ink-3));
  margin-bottom: 2px;
}

.writer-review-panel-head h3 {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 500;
  margin: 0;
  color: var(--ink);
}

.writer-review-panel-close {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid rgba(22, 20, 14, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink-3);
  cursor: pointer;
  flex-shrink: 0;
}

.writer-review-panel-close:hover {
  background: rgba(255, 255, 255, 1);
  color: var(--ink);
}

.writer-review-panel-tabs {
  display: flex;
  gap: 6px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.writer-review-tab {
  flex: 0 0 auto;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-muted, var(--ink-3));
  background: rgba(22, 20, 14, 0.04);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  text-align: center;
}

.writer-review-tab.active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(74, 124, 89, 0.18);
  box-shadow: 0 4px 12px rgba(22, 20, 14, 0.06);
}

.writer-review-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
}

.writer-review-panel-list::-webkit-scrollbar {
  width: 10px;
}

.writer-review-panel-list::-webkit-scrollbar-track {
  background: rgba(22, 20, 14, 0.06);
  border-radius: 999px;
}

.writer-review-panel-list::-webkit-scrollbar-thumb {
  background: rgba(152, 143, 132, 0.85);
  border-radius: 999px;
}

.writer-review-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted, var(--ink-3));
  font-size: 13px;
}

/* ── Review Cards ── */

.writer-review-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(22, 20, 14, 0.08);
  border-left: 3px solid var(--card-reviewer-color, var(--reviewer-a));
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.writer-review-card:hover {
  box-shadow: 0 4px 12px rgba(22, 20, 14, 0.08);
  border-color: rgba(22, 20, 14, 0.14);
}

.writer-review-card.active {
  border-color: rgba(74, 124, 89, 0.4);
  box-shadow: 0 4px 12px rgba(74, 124, 89, 0.12);
}

.writer-review-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.writer-review-card-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--card-reviewer-color, var(--reviewer-a));
  flex-shrink: 0;
}

.writer-review-card-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.writer-review-card-time {
  font-size: 11px;
  color: var(--text-muted, var(--ink-3));
  margin-left: auto;
}

.writer-review-card-kind {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted, var(--ink-3));
  padding: 2px 6px;
  background: rgba(22, 20, 14, 0.05);
  border-radius: 4px;
  margin-left: 6px;
}

.writer-review-card-quote {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
  background: rgba(22, 20, 14, 0.03);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 8px;
  font-style: italic;
  border-left: 2px solid rgba(22, 20, 14, 0.1);
}

.writer-review-card-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 8px;
}

.writer-review-card-suggestion {
  font-size: 12px;
  line-height: 1.5;
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.writer-review-card-suggestion-old {
  background: rgba(231, 76, 60, 0.08);
  text-decoration: line-through;
  color: var(--ink-3);
}

.writer-review-card-suggestion-new {
  background: rgba(46, 204, 113, 0.08);
  color: var(--ink);
  margin-top: 4px;
}

.writer-review-card-state {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.writer-review-card-state[data-state="accepted"] {
  color: #27ae60;
  background: rgba(39, 174, 96, 0.08);
}

.writer-review-card-state[data-state="rejected"] {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.08);
}

.writer-review-card-state[data-state="resolved"] {
  color: var(--ink-3);
  background: rgba(22, 20, 14, 0.05);
}

.writer-review-card-actions {
  display: flex;
  gap: 6px;
}

.writer-review-action-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(22, 20, 14, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.writer-review-action-btn:hover {
  background: rgba(255, 255, 255, 1);
  color: var(--ink);
}

.writer-review-action-btn.accept {
  color: #27ae60;
  border-color: rgba(39, 174, 96, 0.2);
}

.writer-review-action-btn.accept:hover {
  background: rgba(39, 174, 96, 0.08);
}

.writer-review-action-btn.reject {
  color: #e74c3c;
  border-color: rgba(231, 76, 60, 0.2);
}

.writer-review-action-btn.reject:hover {
  background: rgba(231, 76, 60, 0.08);
}

/* ── Inline Review Popover ── */

.writer-review-popover {
  min-width: 220px;
  max-width: 340px;
  background: #fff;
  border: 1px solid rgba(22, 20, 14, 0.12);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(22, 20, 14, 0.12), 0 1px 4px rgba(22, 20, 14, 0.08);
  padding: 10px 12px;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, sans-serif);
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-3, #6b6552);
}

.writer-review-popover-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.writer-review-popover-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.writer-review-popover-name {
  font-weight: 600;
  color: var(--ink, #16140e);
  font-size: 12px;
}

.writer-review-popover-kind {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(22, 20, 14, 0.06);
  color: var(--ink-3, #6b6552);
}

.writer-review-popover-time {
  font-size: 11px;
  color: var(--ink-4, #9e9a8d);
  margin-left: auto;
}

.writer-review-popover-state {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
}

.writer-review-popover-state--accepted {
  background: rgba(39, 174, 96, 0.1);
  color: #27ae60;
}

.writer-review-popover-state--rejected {
  background: rgba(231, 76, 60, 0.1);
  color: #e74c3c;
}

.writer-review-popover-state--resolved {
  background: rgba(22, 20, 14, 0.06);
  color: var(--ink-3, #6b6552);
}

.writer-review-popover-body {
  margin-bottom: 6px;
  color: var(--ink-2, #3e3b32);
  word-break: break-word;
}

.writer-review-popover-quote {
  font-style: italic;
  color: var(--ink-4, #9e9a8d);
}

.writer-review-popover-diff {
  margin-bottom: 4px;
}

.writer-review-popover-diff del {
  color: #e74c3c;
  text-decoration: line-through;
  background: rgba(231, 76, 60, 0.06);
  padding: 0 2px;
  border-radius: 2px;
}

.writer-review-popover-diff ins {
  color: #27ae60;
  text-decoration: none;
  background: rgba(39, 174, 96, 0.06);
  padding: 0 2px;
  border-radius: 2px;
}

.writer-review-popover-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(22, 20, 14, 0.08);
}

.writer-review-popover-btn {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(22, 20, 14, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.writer-review-popover-btn:hover {
  background: #fff;
  color: var(--ink);
}

.writer-review-popover-btn--accept {
  color: #27ae60;
  border-color: rgba(39, 174, 96, 0.2);
}

.writer-review-popover-btn--accept:hover {
  background: rgba(39, 174, 96, 0.08);
}

.writer-review-popover-btn--reject {
  color: #e74c3c;
  border-color: rgba(231, 76, 60, 0.2);
}

.writer-review-popover-btn--reject:hover {
  background: rgba(231, 76, 60, 0.08);
}

.writer-review-popover-btn--resolve {
  color: var(--brand, #4A7C59);
  border-color: rgba(74, 124, 89, 0.2);
}

.writer-review-popover-btn--resolve:hover {
  background: rgba(74, 124, 89, 0.08);
}

/* ── Review Toolbar ── */

.writer-tb-toggle.active {
  background: rgba(74, 124, 89, 0.12);
  color: var(--brand, #4A7C59);
}

.writer-review-badge {
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: var(--brand, #4A7C59);
  border-radius: 999px;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
  padding: 0 3px;
  position: absolute;
  top: -2px;
  right: -4px;
  display: none;
}

.writer-review-badge:not(:empty) {
  display: block;
}

/* ── Inline Review Marks ── */

.review-change-mark {
  position: relative;
}

.review-change-mark[data-kind="track_insert"] {
  text-decoration: underline;
  text-decoration-color: var(--reviewer-color, var(--reviewer-a));
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  background: rgba(46, 204, 113, 0.06);
}

.review-change-mark[data-kind="track_delete"] {
  text-decoration: line-through;
  text-decoration-color: var(--reviewer-color, var(--reviewer-a));
  text-decoration-thickness: 2px;
  color: var(--ink-3);
  opacity: 0.7;
}

.review-change-mark[data-kind="suggestion"] {
  text-decoration: underline dashed;
  text-decoration-color: var(--reviewer-color, var(--reviewer-a));
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

.review-comment-mark {
  background: rgba(245, 200, 66, 0.2);
  border-radius: 2px;
}

.review-comment-mark[data-state="resolved"] {
  background: rgba(245, 200, 66, 0.08);
}

.review-badge-widget {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: rgba(245, 200, 66, 0.85);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  vertical-align: super;
  margin-left: 1px;
  cursor: pointer;
  user-select: none;
}

/* ── Comment Input (inline) ── */

.writer-review-input-wrap {
  padding: 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(74, 124, 89, 0.2);
  border-radius: 10px;
  margin-bottom: 8px;
}

.writer-review-input-wrap textarea {
  width: 100%;
  min-height: 60px;
  border: 1px solid rgba(22, 20, 14, 0.1);
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.writer-review-input-wrap textarea:focus {
  outline: none;
  border-color: rgba(74, 124, 89, 0.4);
}

.writer-review-input-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  justify-content: flex-end;
}

.writer-review-input-submit {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  background: var(--brand, #4A7C59);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.writer-review-input-submit:hover {
  opacity: 0.9;
}

.writer-review-input-cancel {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  color: var(--ink-3);
  border: 1px solid rgba(22, 20, 14, 0.1);
  border-radius: 6px;
  cursor: pointer;
}

/* ── Share Popover ── */

.w-share-wrap {
  position: relative;
}

.writer-share-popover {
  display: none;
  flex-direction: column;
  gap: 12px;
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 8px;
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(22, 20, 14, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(22, 20, 14, 0.14);
  padding: 16px;
  z-index: 500;
}

.writer-share-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.writer-share-section-head {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3, #999);
}

.writer-share-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.writer-share-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.writer-share-toggle input[type="checkbox"] {
  accent-color: var(--brand, #4A7C59);
}

.writer-share-copy-btn {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  background: var(--brand, #4A7C59);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.writer-share-copy-btn:hover {
  opacity: 0.9;
}

.writer-share-members-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.writer-share-member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}

.writer-share-member-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
}

.writer-share-member-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.writer-share-member-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3, #999);
  text-transform: capitalize;
}

.writer-share-member-remove {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--ink-3, #999);
  cursor: pointer;
  font-size: 12px;
  border-radius: 4px;
}

.writer-share-member-remove:hover {
  background: rgba(200, 50, 50, 0.1);
  color: #c83232;
}

.writer-share-invite-row {
  display: flex;
  gap: 6px;
}

.writer-share-invite-row input {
  flex: 1;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid rgba(22, 20, 14, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
}

.writer-share-invite-row input:focus {
  outline: none;
  border-color: rgba(74, 124, 89, 0.3);
}

.writer-share-invite-row select {
  padding: 7px 8px;
  font-size: 12px;
  border: 1px solid rgba(22, 20, 14, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  cursor: pointer;
}

.writer-share-search-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.writer-share-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  width: 100%;
}

.writer-share-search-result:hover {
  background: rgba(74, 124, 89, 0.06);
}

.writer-share-search-add {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand, #4A7C59);
}

.writer-share-no-members,
.writer-share-no-results {
  padding: 8px 0;
  font-size: 12px;
  color: var(--ink-3, #999);
  text-align: center;
}

/* ── @Mentions ── */

.mellio-mention {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 8px 1px 6px;
  background: rgba(74, 124, 89, 0.12);
  border: 1px solid rgba(74, 124, 89, 0.18);
  border-radius: 999px;
  font-size: 0.92em;
  font-weight: 600;
  color: var(--brand, #4A7C59);
  white-space: nowrap;
  cursor: default;
  user-select: all;
}

.mellio-mention::before {
  content: '@';
  font-weight: 700;
  opacity: 0.6;
}

.writer-mention-menu {
  position: fixed;
  z-index: 9999;
  min-width: 180px;
  max-width: 280px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(22, 20, 14, 0.1);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(22, 20, 14, 0.12);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.writer-mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: none;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-1, #221F1A);
  text-align: left;
  width: 100%;
}

.writer-mention-item:hover,
.writer-mention-item.active {
  background: rgba(74, 124, 89, 0.08);
}

.writer-mention-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
}

.writer-mention-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.writer-mention-empty {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--ink-3, #999);
  text-align: center;
}

/* ── Review Input Quote ── */

.writer-review-input-quote {
  padding: 6px 10px;
  margin-bottom: 8px;
  background: rgba(22, 20, 14, 0.03);
  border-left: 3px solid rgba(22, 20, 14, 0.12);
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  font-style: italic;
  color: var(--ink-3, #999);
  max-height: 60px;
  overflow: hidden;
}

.writer-review-input-head {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink-1, #221F1A);
}

@media (max-width: 1120px) {
  .writer-writing-shell {
    max-width: 760px;
    flex-direction: column;
    align-items: stretch;
  }

  .writer-paper-stage {
    max-width: none;
  }

  .writer-asset-picker {
    width: 100%;
    position: static;
    top: auto;
    max-height: none;
  }

  .writer-review-panel {
    width: 100%;
    position: static;
    top: auto;
    max-height: none;
  }

  .writer-asset-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .writer-asset-insert-btn {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .writer-dash-head {
    flex-direction: column;
    gap: 16px;
    padding: 22px 16px 14px;
  }

  .writer-doc-grid {
    padding: 0 16px 20px;
  }

  .writer-toolbar-dock {
    padding: 4vh 12px 2px;
  }

  .writer-surface {
    padding: 20px 12px 20px;
  }

  .writer-paper-stage {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .writer-quick-insert {
    position: static;
    left: auto;
    top: auto;
    width: 100%;
  }

  .writer-paper {
    min-height: 0;
    padding: 34px 22px;
  }

  .writer-e-bottom,
  .writer-doc-tray {
    position: static;
    left: auto;
    right: auto;
  }

  .writer-e-bottom {
    padding: 10px 12px;
    height: auto;
    border-top: 1px solid var(--line);
  }

  .writer-doc-tray {
    position: static;
    padding: 0 12px;
  }
  .writer-doc-tray.writer-doc-tray-open {
    padding: 12px;
  }
}

/* Legacy simple list items (kept for backwards compat) */
.writer-asset-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid rgba(22, 20, 14, 0.06);
  margin-bottom: 8px;
  transition: all 0.15s;
}

.writer-asset-item:hover {
  border-color: var(--green);
  background: rgba(74, 124, 89, 0.03);
}

.writer-asset-thumb {
  width: 60px;
  height: 44px;
  border-radius: 6px;
  background: rgba(22, 20, 14, 0.04);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted, var(--ink-3));
}

.writer-asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.writer-asset-info {
  flex: 1;
  min-width: 0;
}

.writer-asset-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.writer-asset-type {
  font-size: 11px;
  color: var(--text-muted, var(--ink-3));
}


/* ══════════════════════════════════════════
   EMBEDDED NODES (mellioTable, mellioFigure)
   ══════════════════════════════════════════ */

.mellio-embed {
  margin: 1.5em 0;
  border: 1px solid rgba(22, 20, 14, 0.1);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.mellio-embed.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(74, 124, 89, 0.15);
}

.mellio-embed-caption {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: rgba(22, 20, 14, 0.02);
  border-bottom: 1px solid rgba(22, 20, 14, 0.06);
}

.mellio-embed-content {
  padding: 12px;
  overflow-x: auto;
}

.mellio-embed-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.mellio-embed:hover .mellio-embed-actions {
  opacity: 1;
}

.mellio-embed-action-btn {
  background: var(--white);
  border: 1px solid rgba(22, 20, 14, 0.1);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-muted, var(--ink-3));
}

.mellio-embed-action-btn:hover {
  background: rgba(22, 20, 14, 0.04);
  color: var(--ink);
}

/* Figure structured caption (header above, notes below) */
.mellio-embed-figure-header {
  padding: 10px 12px 4px;
  font-size: 12px;
  color: var(--ink);
  line-height: 1.5;
}

.mellio-embed-figure-notes {
  padding: 4px 12px 10px;
  font-size: 11px;
  color: var(--ink);
  line-height: 1.5;
  border-top: 1px solid rgba(22, 20, 14, 0.06);
}

.mellio-embed-figure-header .fig-preview-label,
.mellio-embed-figure-header .fig-preview-title,
.mellio-embed-figure-notes .fig-preview-note,
.mellio-embed-figure-notes .fig-preview-source {
  font-size: inherit;
}


/* ── Table of Contents node ── */

.mellio-toc-wrapper {
  background: rgba(74, 124, 89, 0.04);
  border: 1px solid rgba(74, 124, 89, 0.15);
  border-radius: 8px;
  padding: 20px 24px;
  margin: 20px 0;
  position: relative;
  cursor: default;
}

.mellio-toc-wrapper:hover {
  border-color: rgba(74, 124, 89, 0.3);
}

.mellio-toc-title {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
  letter-spacing: 0.01em;
}

.mellio-toc-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mellio-toc-entry {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.6;
  padding: 2px 0;
}

.mellio-toc-level-1 {
  font-weight: 600;
  padding-left: 0;
}

.mellio-toc-level-2 {
  font-weight: 400;
  padding-left: 18px;
}

.mellio-toc-level-3 {
  font-weight: 400;
  padding-left: 36px;
  font-size: 12px;
  color: var(--ink-3, #6e695e);
}

.mellio-toc-empty {
  font-size: 13px;
  color: var(--ink-3, #6e695e);
  font-style: italic;
}

.mellio-node-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
}

.mellio-toc-wrapper:hover .mellio-node-actions {
  display: flex;
}

.mellio-node-action-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(22, 20, 14, 0.06);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-3, #6e695e);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mellio-node-action-btn:hover {
  background: rgba(22, 20, 14, 0.12);
  color: var(--ink);
}


/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */

@media (max-width: 900px) {
  .writer-editor-layout {
    flex-direction: column;
  }
  .writer-asset-picker {
    width: 100%;
    border-left: none;
    border-top: 1px solid rgba(22, 20, 14, 0.06);
    max-height: 320px;
  }
  .writer-paper {
    padding: 32px 24px;
  }
}

/* ══════════════════════════════════════════
   LAUNCHER
   ══════════════════════════════════════════ */

.writer-launcher {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
  padding: 12vh 40px 70px;
  flex: 1;
  overflow-y: auto;
}

.writer-launcher-head {
  text-align: center;
  margin-bottom: 36px;
}

.writer-launcher-head .writer-panel-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #2d5a27;
  margin-bottom: 6px;
}

.writer-launcher-head .writer-title {
  font-size: 28px;
  font-weight: 700;
  color: #3a3530;
  margin: 0 0 8px;
}

.writer-launcher-head .writer-title em {
  font-style: italic;
  font-weight: 400;
  color: #6a6460;
}

.writer-launcher-head .writer-subtitle {
  font-size: 14px;
  color: #9a9490;
  line-height: 1.5;
}

.writer-launcher-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  margin-bottom: 24px;
}

.writer-launcher-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 16px 24px;
  background: white;
  border: 1px solid rgba(22, 20, 14, 0.08);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.writer-launcher-card:hover {
  border-color: #2d5a27;
  box-shadow: 0 2px 8px rgba(45, 90, 39, 0.08);
}

.writer-launcher-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(45, 90, 39, 0.06);
  border-radius: 12px;
  color: #2d5a27;
}

.writer-launcher-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #3a3530;
}

.writer-launcher-card-desc {
  font-size: 12px;
  color: #9a9490;
  line-height: 1.4;
}

/* Template list */
.writer-template-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-bottom: 16px;
}

.writer-template-option {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  background: white;
  border: 1px solid rgba(22, 20, 14, 0.08);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.writer-template-option:hover {
  border-color: #2d5a27;
  background: rgba(45, 90, 39, 0.02);
}

.writer-template-name {
  font-size: 13px;
  font-weight: 600;
  color: #3a3530;
}

.writer-template-desc {
  font-size: 12px;
  color: #9a9490;
  line-height: 1.4;
}


/* ── Writer Label Picker (anchored to labeled group) ── */
.writer-label-picker {
  position: absolute;
  top: 100%;
  right: 0;
  left: auto;
  margin-top: 6px;
  z-index: 100;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .writer-launcher-cards {
    grid-template-columns: 1fr;
  }
  .writer-launcher {
    padding: 6vh 16px 70px;
  }
}

/* ── Toolbar responsive ── */
@media (max-width: 768px) {
  .writer-tb-find-group { display: none; }
  .writer-tb-more-find-item { display: flex !important; }
  .writer-doc-name-input { max-width: 120px; }
}
@media (max-width: 560px) {
  .writer-toolbar-row { gap: 1px; padding: 4px 4px; }
  .writer-toolbar-dock { padding: 2vh 8px 2px; }
  .writer-tb-div-more { display: none; }
  .writer-tb-insert-group { order: 10; }
  #writerLabelGroup { order: 11; }
  .writer-tb-div:last-of-type { display: none; }
  .writer-doc-name-input { display: none !important; }
  .writer-doc-name-sep { display: none !important; }
}

/* ══════════════════════════════════════════
   WRITER-SCOPED BOTTOM BAR
   ══════════════════════════════════════════ */

.writer-e-bottom {
  position: fixed;
  bottom: 0;
  left: 56px;
  right: 0;
  height: 50px;
  background: var(--cream);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 20;
}

.w-eb-btn {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #6a6460;
  background: transparent;
  border: 1px solid #c5bfb5;
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.w-eb-btn:hover {
  background: rgba(0, 0, 0, 0.03);
}

.w-eb-btn-green {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: white;
  background: #2d5a27;
  border: none;
  border-radius: 8px;
  padding: 6px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.w-eb-btn-green:hover {
  background: #245020;
}

.w-eb-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.w-eb-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.w-eb-tray-toggle {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #3a3530;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
}

.w-eb-tray-label {
  font-size: 13px;
}

.w-eb-tray-badge {
  font-family: system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: white;
  background: #2d5a27;
  padding: 1px 7px;
  border-radius: 10px;
}

.w-eb-tray-arrow {
  font-size: 16px;
  color: #9a9490;
  line-height: 1;
}

.w-eb-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Export dropdown */
.w-export-wrap {
  position: relative;
}

.w-export-menu {
  position: absolute;
  bottom: 44px;
  right: 0;
  min-width: 240px;
  background: white;
  border: 1px solid rgba(22, 20, 14, 0.1);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  padding: 6px;
  z-index: 30;
}

.w-em-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}

.w-em-item:hover {
  background: rgba(45, 90, 39, 0.04);
}

.w-em-icon {
  font-size: 18px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.w-em-info {
  flex: 1;
  min-width: 0;
}

.w-em-name {
  font-size: 13px;
  font-weight: 600;
  color: #3a3530;
}

.w-em-desc {
  font-size: 11px;
  color: #9a9490;
  margin-top: 1px;
}

@media (max-width: 600px) {
  .writer-e-bottom {
    left: 0;
    padding: 0 12px;
  }
  .w-eb-tray-label {
    display: none;
  }
}
