/* ============================================================
   Companion Panel — Split-View, Per-Page Blocks, Rich Editor & Mermaid
   MISA Design System 2.0 Tokens Integration
   ============================================================ */

/* === Viewer Split Container === */
.viewer-split-container {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
  overflow: hidden;
  --companion-width: 440px;
}

/* Reader takes remaining space */
.viewer-split-container > .pdf-reader {
  flex: 1 1 0%;
  min-width: 320px;
}

/* === Split Resizer Gutter === */
.split-resizer {
  width: 8px;
  flex-shrink: 0;
  background: #e5e7eb;
  cursor: col-resize;
  user-select: none;
  touch-action: none;
  position: relative;
  z-index: 10;
  transition: background var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.split-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  right: -4px;
  cursor: col-resize;
}

.split-resizer:hover,
.split-resizer.active {
  background: var(--misa-brand-accent, #2662ff);
}

.split-resizer-handle {
  width: 2px;
  height: 28px;
  border-radius: 1px;
  background: #9ca3af;
  pointer-events: none;
}

.split-resizer:hover .split-resizer-handle,
.split-resizer.active .split-resizer-handle {
  background: #ffffff;
}

body.is-resizing-active {
  cursor: col-resize !important;
  user-select: none !important;
}

/* === Companion Panel Shell === */
.companion-panel {
  width: var(--companion-width);
  min-width: 300px;
  max-width: calc(100% - 320px);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  min-height: 0;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  z-index: 15;
}

/* Full-screen mode */
.companion-panel.is-fullscreen {
  position: absolute;
  inset: 0;
  z-index: 40;
  width: 100% !important;
  max-width: 100% !important;
  border-left: none;
  box-shadow: 0 0 40px rgba(0,0,0,0.25);
}

/* === Companion Header === */
.companion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  flex-shrink: 0;
  gap: 8px;
}

.companion-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.companion-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.companion-title-text {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.companion-title {
  font-size: var(--misa-text-sm, 13px);
  font-weight: var(--misa-fw-semibold, 600);
  color: var(--misa-text-dark, #1f2937);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.companion-badge {
  font-size: 11px;
  font-weight: var(--misa-fw-medium, 500);
  padding: 1px 6px;
  border-radius: 10px;
  background: #e0e7ff;
  color: #3730a3;
  white-space: nowrap;
}

.companion-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.companion-view-switch {
  display: inline-flex;
  border: 1px solid #d1d5db;
  border-radius: var(--misa-radius-sm, 4px);
  overflow: hidden;
  background: #ffffff;
}

.btn-companion-view {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: var(--misa-fw-medium, 500);
  color: var(--misa-text-secondary, #4b5563);
  background: transparent;
  border: none;
  cursor: pointer;
  line-height: 20px;
  transition: all var(--transition-fast);
}

.btn-companion-view + .btn-companion-view {
  border-left: 1px solid #d1d5db;
}

.btn-companion-view.active {
  background: var(--misa-bg-blue-tint, #eff6ff);
  color: var(--misa-brand-accent, #2662ff);
  font-weight: var(--misa-fw-semibold, 600);
}

.btn-companion-action {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d1d5db;
  border-radius: var(--misa-radius-sm, 4px);
  background: #ffffff;
  color: var(--misa-text-secondary, #4b5563);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-companion-action:hover {
  background: #f3f4f6;
  color: var(--misa-brand-accent, #2662ff);
  border-color: var(--misa-brand-accent, #2662ff);
}

.btn-companion-action.btn-companion-quick-add {
  width: auto;
  height: 26px;
  padding: 0 10px;
  background: var(--misa-brand-accent, #2662ff);
  color: #ffffff;
  border-color: var(--misa-brand-accent, #2662ff);
  font-size: 11px;
  font-weight: var(--misa-fw-semibold, 600);
  border-radius: var(--misa-radius-sm, 4px);
  gap: 4px;
}

.btn-companion-action.btn-companion-quick-add:hover {
  background: var(--misa-brand-hover, #1d4ed8);
  border-color: var(--misa-brand-hover, #1d4ed8);
  color: #ffffff;
}

/* === Companion Body & Blocks === */
.companion-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f1f5f9;
}

.companion-loading {
  text-align: center;
  color: #64748b;
  font-size: var(--misa-text-sm, 13px);
  padding: 24px;
}

/* Page Block Card */
.companion-page-block {
  background: #ffffff;
  border-radius: var(--misa-radius-md, 6px);
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.companion-page-block.active-page-block {
  border-color: var(--misa-brand-accent, #2662ff);
  box-shadow: 0 0 0 2px rgba(38, 98, 255, 0.16), 0 2px 6px rgba(0, 0, 0, 0.06);
}

.companion-page-block.is-editing {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.16);
}

/* Block Header */
.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #fafbfc;
  border-bottom: 1px solid #f1f5f9;
  gap: 8px;
}

.block-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.block-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.block-dot.filled { background: #10b981; }
.block-dot.empty { background: #cbd5e1; }

.block-badge-page {
  font-size: 11px;
  font-weight: var(--misa-fw-bold, 700);
  padding: 2px 6px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #334155;
  white-space: nowrap;
}

.block-badge-page.editing {
  background: #fef3c7;
  color: #92400e;
}

.block-header-title-snip {
  font-size: 12px;
  color: #475569;
  font-weight: var(--misa-fw-medium, 500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.block-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-block-action {
  padding: 3px 7px;
  font-size: 11px;
  border: 1px solid #d1d5db;
  border-radius: var(--misa-radius-sm, 4px);
  background: #ffffff;
  color: var(--misa-text-secondary, #4b5563);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-block-action:hover {
  background: #eff6ff;
  color: var(--misa-brand-accent, #2662ff);
  border-color: var(--misa-brand-accent, #2662ff);
}

.btn-block-action.btn-add-sec,
.btn-block-action.btn-block-quick-add {
  background: #eff6ff;
  color: var(--misa-brand-accent, #2662ff);
  border-color: #bfdbfe;
  font-weight: 600;
}
.btn-block-action.btn-add-sec:hover,
.btn-block-action.btn-block-quick-add:hover {
  background: #dbeafe;
}

.btn-block-action.btn-del-all:hover {
  background: #fef2f2;
  color: #ef4444;
  border-color: #ef4444;
}

.block-sections-count {
  font-size: 10px;
  color: #64748b;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
}

/* === Browser Tabs Bar in Page Block === */
.block-browser-tabs {
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  padding: 6px 8px 0 8px;
  overflow: hidden;
  user-select: none;
}

.tabs-scroll-container {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 0;
}

.tabs-scroll-container::-webkit-scrollbar {
  height: 3px;
}
.tabs-scroll-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

.browser-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  position: relative;
  margin-bottom: -1px;
}

.browser-tab:hover {
  background: #f8fafc;
  color: #1e293b;
}

.browser-tab.active {
  background: #ffffff;
  color: var(--misa-brand-accent, #2662ff);
  font-weight: 600;
  border-color: #cbd5e1;
  border-bottom: 1px solid #ffffff;
  border-top: 2px solid var(--misa-brand-accent, #2662ff);
  z-index: 2;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.04);
}

.browser-tab .tab-icon {
  font-size: 13px;
  line-height: 1;
}

.browser-tab .tab-label {
  font-size: 12px;
  line-height: 1;
}

.browser-tab .tab-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #10b981;
}

.btn-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  font-size: 10px;
  line-height: 1;
  color: #94a3b8;
  margin-left: 3px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-tab-close:hover {
  background: #fee2e2;
  color: #ef4444;
}

.btn-add-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  border-radius: 5px;
  border: 1px dashed #94a3b8;
  background: transparent;
  color: #475569;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 3px;
  margin-left: 4px;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.btn-add-tab:hover {
  background: #eff6ff;
  color: var(--misa-brand-accent, #2662ff);
  border-color: var(--misa-brand-accent, #2662ff);
  border-style: solid;
}

/* === Tab Body Content Area === */
.block-tab-content {
  padding: 12px;
  min-height: 80px;
  background: #ffffff;
  position: relative;
}

.tab-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed #e2e8f0;
}

.tab-pane-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-pane-title {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 5px;
}

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

.btn-tab-edit {
  font-size: 11px;
  font-weight: 500;
  color: var(--misa-brand-accent, #2662ff);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.btn-tab-edit:hover {
  background: #dbeafe;
}

.tab-empty-state {
  text-align: center;
  padding: 20px 12px;
  background: #fafbfc;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  color: #64748b;
}

.tab-empty-state .empty-icon {
  font-size: 24px;
  display: block;
  margin-bottom: 6px;
}

.tab-empty-state .empty-desc {
  font-size: 12px;
  margin-bottom: 12px;
  color: #64748b;
}

.tab-empty-state .btn-create-content {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  background: var(--misa-brand-accent, #2662ff);
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-empty-state .btn-create-content:hover {
  background: #1d4ed8;
}

.tab-quick-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 10px;
}

.btn-quick-tpl {
  font-size: 11px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
  color: #334155;
  transition: all var(--transition-fast);
}

.btn-quick-tpl:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

/* === Block Sections List & Mini-Section Cards === */
.block-sections-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mini-section-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.mini-section-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.mini-section-card.editing-new,
.mini-section-card.editing-existing {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.16);
  background: #fffdfa;
}

.mini-sec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #fafbfc;
  border-bottom: 1px solid #f1f5f9;
  gap: 8px;
}

.mini-sec-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.mini-sec-type {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.mini-sec-title {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-sec-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.btn-sec-action {
  padding: 2px 5px;
  font-size: 11px;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  background: #ffffff;
  cursor: pointer;
  line-height: 16px;
}
.btn-sec-action:hover {
  background: #eff6ff;
  color: var(--misa-brand-accent, #2662ff);
}
.btn-sec-action.btn-sec-del:hover {
  background: #fef2f2;
  color: #ef4444;
}

.mini-sec-quote-wrap {
  padding: 8px 10px 0 10px;
}

.mini-sec-quote {
  margin: 0;
  padding: 6px 10px;
  border-left: 3px solid var(--misa-brand-accent, #2662ff);
  background: #eff6ff;
  color: #1e40af;
  font-size: 12px;
  line-height: 1.5;
  font-style: italic;
  border-radius: 0 4px 4px 0;
}

.mini-sec-body {
  padding: 8px 10px;
}

/* Block Content Read-only Area (legacy fallback) */
.block-content-area {
  padding: 12px 14px;
}

.block-empty-state {
  text-align: center;
  padding: 16px 8px;
  color: #94a3b8;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  background: #fafbfc;
}

.block-empty-state .empty-icon { font-size: 20px; display: block; margin-bottom: 4px; }
.block-empty-state .empty-text { font-size: 12px; margin-bottom: 8px; }

.btn-add-note {
  font-size: 11px;
  font-weight: 600;
  color: var(--misa-brand-accent, #2662ff);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.btn-add-note:hover { background: #dbeafe; }

/* === Section Editor Fields === */
.editor-header-fields {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.editor-type-selector {
  flex-shrink: 0;
}

.editor-select-type {
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #334155;
  font-weight: 500;
  cursor: pointer;
}

.editor-quote-preview {
  margin-bottom: 8px;
}

.editor-quote-badge {
  font-size: 10px;
  font-weight: 700;
  color: #1e40af;
  text-transform: uppercase;
  margin-bottom: 2px;
  display: block;
}

.editor-quote-box {
  margin: 0;
  padding: 6px 10px;
  border-left: 3px solid var(--misa-brand-accent, #2662ff);
  background: #eff6ff;
  color: #1e40af;
  font-size: 12px;
  line-height: 1.5;
  font-style: italic;
  border-radius: 0 4px 4px 0;
  max-height: 80px;
  overflow-y: auto;
}

/* === Markdown Prose Styles === */
.companion-prose {
  font-size: 13px;
  line-height: 1.6;
  color: #334155;
  word-break: break-word;
}

.companion-prose p { margin: 0 0 8px 0; }
.companion-prose h1 { font-size: 16px; font-weight: 700; color: #0f172a; margin: 12px 0 6px 0; }
.companion-prose h2 { font-size: 14px; font-weight: 700; color: #0f172a; margin: 10px 0 4px 0; }
.companion-prose h3 { font-size: 13px; font-weight: 600; color: #1e293b; margin: 8px 0 4px 0; }
.companion-prose ul, .companion-prose ol { padding-left: 20px; margin: 4px 0 8px 0; }
.companion-prose li { margin-bottom: 3px; }
.companion-prose blockquote {
  border-left: 3px solid var(--misa-brand-accent, #2662ff);
  background: #f8fafc;
  padding: 6px 10px;
  margin: 8px 0;
  font-style: italic;
  color: #475569;
  border-radius: 0 4px 4px 0;
}
.companion-prose a { color: var(--misa-brand-accent, #2662ff); text-decoration: underline; }

.companion-figure {
  margin: 8px 0;
  text-align: center;
}
.companion-figure img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.companion-figure figcaption {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}

.table-wrap {
  overflow-x: auto;
  margin: 8px 0;
}
.companion-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.companion-table td, .companion-table th {
  border: 1px solid #cbd5e1;
  padding: 5px 8px;
  text-align: left;
}
.companion-table tr:nth-child(even) { background: #f8fafc; }

/* === Mermaid Diagram Styles === */
.mermaid-diagram-slot {
  margin: 10px 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px;
  overflow-x: auto;
  text-align: center;
}

.mermaid-svg-container {
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

.mermaid-svg-container svg {
  max-width: 100% !important;
  height: auto !important;
}

.mermaid-loading-pulse {
  font-size: 11px;
  color: #64748b;
  padding: 12px;
  font-style: italic;
}

.mermaid-error-box {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 8px 10px;
  text-align: left;
  font-size: 11px;
}
.mermaid-error-title { font-weight: 700; color: #92400e; margin-bottom: 2px; }
.mermaid-error-msg { color: #b45309; margin-bottom: 4px; }
.mermaid-error-raw {
  background: #fffbeb;
  padding: 4px;
  border-radius: 4px;
  font-size: 10px;
  overflow-x: auto;
  color: #78350f;
  margin: 0;
}

/* === Editor Styles === */
.companion-editor-wrap {
  padding: 10px;
}

.editor-field-title {
  margin-bottom: 8px;
}

.editor-input-title {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  box-sizing: border-box;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tb-btn {
  padding: 3px 6px;
  font-size: 11px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  line-height: 18px;
}
.tb-btn:hover { background: #e2e8f0; color: var(--misa-brand-accent, #2662ff); }

.tb-image, .tb-mermaid { font-weight: 600; }
.tb-mermaid { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* Mermaid Dropdown */
.tb-dropdown {
  position: relative;
  display: inline-block;
}
.tb-dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #ffffff;
  min-width: 180px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  z-index: 50;
  padding: 4px 0;
}
.tb-dropdown-content button {
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border: none;
  background: none;
  font-size: 11px;
  color: #334155;
  cursor: pointer;
}
.tb-dropdown-content button:hover {
  background: #eff6ff;
  color: var(--misa-brand-accent, #2662ff);
}
.tb-dropdown:hover .tb-dropdown-content {
  display: block;
}

/* Tabs */
.toolbar-tabs {
  margin-left: auto;
}
.tb-tab {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
}
.tb-tab.active {
  background: var(--misa-brand-accent, #2662ff);
  color: #ffffff;
  border-color: var(--misa-brand-accent, #2662ff);
}

.editor-panes {
  border: 1px solid #cbd5e1;
  border-radius: 0 0 4px 4px;
  background: #ffffff;
}

.editor-textarea {
  width: 100%;
  min-height: 220px;
  padding: 10px;
  border: none;
  outline: none;
  resize: vertical;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #1e293b;
  box-sizing: border-box;
}

.editor-pane-preview {
  min-height: 220px;
  padding: 10px;
  background: #fafbfc;
  box-sizing: border-box;
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 8px;
}

.editor-hint {
  font-size: 10px;
  color: #64748b;
}

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

.btn-editor-cancel {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
}
.btn-editor-cancel:hover { background: #f1f5f9; }

.btn-editor-save {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  background: var(--misa-brand-accent, #2662ff);
  color: #ffffff;
  cursor: pointer;
}
.btn-editor-save:hover { background: #1d4ed8; }

/* === Responsive Behavior (< 768px) === */
@media (max-width: 768px) {
  .viewer-split-container {
    position: relative;
  }
  .split-resizer {
    display: none !important;
  }
  .companion-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 100% !important;
    max-width: 100% !important;
    z-index: 35;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  }
}
