/* BAVORA OS · Vollbild-Vertragseditor (Vertrag erstellen, Entwurf, Vorlage)
   Links bearbeiten, rechts Live-PDF im finalen Dokumentdesign. Nutzt --bv-crm-* aus bavora-crm-unified.css. */
html.cs-locked, html.cs-locked body { overflow: hidden; }
/* Gedämpfter Text mit ausreichendem Kontrast auf Weiß (6:1) und auf der grauen Vorschaufläche (5:1). */
.cs-overlay, .cs-design { --cs-muted: #5f645f; }

.cs-overlay {
  position: fixed; inset: 0; z-index: 900;
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  background: var(--bg, #faf8f5); color: var(--ink, #1a1a1a);
}

/* ---------- Kopfleiste ---------- */
.cs-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; min-height: 64px;
  background: #fff; border-bottom: 1px solid var(--bv-crm-line, #d5e1d8);
}
.cs-bar__title { min-width: 0; flex: 1 1 auto; }
.cs-bar__title .eyebrow { margin: 0 0 2px; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--cs-muted); }
.cs-bar__title h2 { margin: 0; font-family: var(--font-serif); font-size: 22px; font-weight: 400; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-bar__actions { display: flex; gap: 8px; flex: 0 0 auto; }
.cs-tabs { display: none; }

/* ---------- Zweispaltiger Arbeitsbereich ---------- */
.cs-body {
  display: grid; min-height: 0;
  grid-template-columns: minmax(380px, 1fr) minmax(440px, clamp(440px, 48vw, 920px));
}
.cs-pane { min-width: 0; min-height: 0; }
.cs-pane--edit {
  overflow: auto; padding: 18px 22px 40px;
  display: flex; flex-direction: column; gap: 14px;
  border-right: 1px solid var(--bv-crm-line, #d5e1d8);
}

/* Angaben (Kunde, Vorlage, Titel …) – einklappbar, damit der Text Platz bekommt */
.cs-meta { background: #fff; border: 1px solid var(--bv-crm-line, #d5e1d8); border-radius: 12px; }
.cs-meta > summary {
  cursor: pointer; list-style: none; padding: 12px 16px;
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--cs-muted);
}
.cs-meta > summary::-webkit-details-marker { display: none; }
.cs-meta > summary::after { content: '▾'; float: right; }
.cs-meta:not([open]) > summary::after { content: '▸'; }
.cs-meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; padding: 0 16px 16px; }
.cs-meta-grid .field { display: grid; gap: 5px; margin: 0; min-width: 0; }
.cs-meta-grid .field > span { font-size: 12px; font-weight: 600; color: var(--ink-soft, #3d3d3d); }
.cs-meta-grid .select, .cs-meta-grid .input { width: 100%; min-width: 0; }
.cs-static { padding: .6rem 0; font-size: 14px; }
.cs-check { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 13px; }

/* Texteditor: wächst mit, keine feste Maximalhöhe mehr */
.cs-editor { display: flex; flex-direction: column; }
.contract-editor--studio { gap: 10px; }
.contract-editor--studio .contract-editor__surface {
  min-height: 56vh !important; max-height: none !important;
  background: #fff !important; border: 1px solid var(--bv-crm-line, #d5e1d8) !important; border-radius: 12px !important;
  padding: 22px 24px !important; font-size: 15px !important; line-height: 1.7 !important;
}
.contract-editor--studio .contract-editor__surface:focus-visible { outline: 2px solid var(--bv-crm-focus, #2e865c); outline-offset: 2px; }
.contract-editor--studio [role="toolbar"] { position: sticky; top: -18px; z-index: 2; background: #fff; }

/* Logo im Vertrag */
.cs-logo { margin: 0 16px 16px; padding-top: 14px; border-top: 1px solid var(--bv-crm-line, #d5e1d8); }
.cs-logo__head { font-size: 12px; font-weight: 600; color: var(--ink-soft, #3d3d3d); margin-bottom: 8px; }
.cs-logo__row { display: flex; gap: 14px; align-items: flex-start; }
.cs-logo__thumb {
  flex: 0 0 132px; height: 56px; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--bv-crm-secondary-line, #8eaa97); border-radius: 8px; background: #fff; padding: 6px;
}
.cs-logo__img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cs-logo__img[hidden], .cs-logo__empty[hidden] { display: none !important; }
.cs-logo__empty { font-size: 12px; color: var(--cs-muted); }
.cs-logo__body { min-width: 0; flex: 1 1 auto; display: grid; gap: 8px; }
.cs-logo__status { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-soft, #3d3d3d); }
.cs-logo__status[data-state="warn"] { color: #7a5a12; }
.cs-logo__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.cs-logo__toggle { grid-column: auto; }
@media (max-width: 1000px) { .cs-logo { margin: 0 14px 14px; } .cs-logo__thumb { flex-basis: 104px; } }

/* Vertragsdesign (Logo, Kopf, Fußzeile) */
.cs-design { background: #fff; border: 1px solid var(--bv-crm-line, #d5e1d8); border-radius: 12px; }
.cs-design > summary {
  cursor: pointer; list-style: none; padding: 12px 16px; display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--cs-muted);
}
.cs-design > summary::-webkit-details-marker { display: none; }
.cs-design > summary::after { content: '▸'; margin-left: auto; }
.cs-design[open] > summary::after { content: '▾'; }
.cs-design__badge { padding: 2px 8px; border-radius: 999px; background: #faf0dd; color: #7a5a12; font-size: 10.5px; letter-spacing: .04em; text-transform: none; }
.cs-design__badge[hidden] { display: none; }
.cs-design__body { padding: 0 16px 16px; display: grid; gap: 16px; }
.cs-design__group { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--bv-crm-line-soft, #e6ede8); }
.cs-design__group h4 { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink, #1a1a1a); }
.cs-design__grid { padding: 0 !important; }
.cs-design__grid .cs-span { grid-column: 1 / -1; }
.cs-design__grid .textarea { min-height: 64px; resize: vertical; }
.cs-design__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 14px; border-top: 1px solid var(--bv-crm-line-soft, #e6ede8); }
.cs-design__note { flex: 1 1 100%; margin: 0; font-size: 12px; color: var(--cs-muted); }
.cs-seg { display: inline-flex; border: 1px solid var(--bv-crm-secondary-line, #8eaa97); border-radius: 8px; overflow: hidden; width: max-content; max-width: 100%; }
.cs-seg__btn { all: unset; cursor: pointer; padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--bv-crm-primary, #17523b); background: #fff; }
.cs-seg__btn + .cs-seg__btn { border-left: 1px solid var(--bv-crm-secondary-line, #8eaa97); }
.cs-seg__btn[aria-checked="true"] { background: var(--bv-crm-primary, #17523b); color: #fff; }
.cs-seg__btn:focus-visible { outline: 3px solid var(--bv-crm-focus, #2e865c); outline-offset: -3px; }
.cs-seg__btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Vorschau ---------- */
.cs-pane--preview {
  display: grid; grid-template-rows: auto auto minmax(0, 1fr);
  background: #e7ebe8; padding: 14px 18px 18px;
}
.cs-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.cs-muted { color: var(--cs-muted); }
.cs-preview-tools { display: flex; align-items: center; gap: 12px; }
.cs-status { font-size: 12px; color: var(--cs-muted); }
.cs-status::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: currentColor; vertical-align: 1px; }
.cs-status[data-state="ok"] { color: var(--bv-crm-primary, #17523b); }
.cs-status[data-state="busy"] { color: #8a6d1f; }
.cs-status[data-state="error"] { color: var(--danger, #8f2f2f); }
.cs-open { font-size: 12px; font-weight: 600; color: var(--bv-crm-primary, #17523b); }
.cs-hint { margin: 8px 0 10px; font-size: 12.5px; color: var(--ink-soft, #3d3d3d); min-height: 1.2em; }
.cs-hint[data-state="warn"] { color: #7a5a12; }
.cs-hint[data-state="error"] { color: var(--danger, #8f2f2f); font-weight: 600; }
.cs-paper { position: relative; min-height: 0; border-radius: 6px; overflow: hidden; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 12px 32px rgba(9,43,37,.12); }
/* Der PDF-Viewer zeichnet einen dunklen Rand um die Seite – leicht überstehend zuschneiden. */
.cs-frame { position: absolute; top: -6px; left: -6px; width: calc(100% + 12px); height: calc(100% + 12px); border: 0; background: #fff; }
.cs-frame[hidden] { display: block !important; visibility: hidden; }

/* Kein eingebetteter PDF-Viewer verfügbar */
.cs-fallback { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; color: var(--ink-soft, #3d3d3d); }
.cs-fallback p { max-width: 34ch; margin: 0; }

/* ---------- Schmale Bildschirme: Umschalter Bearbeiten / Vorschau ---------- */
@media (max-width: 1000px) {
  .cs-bar { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .cs-bar__title { flex: 1 1 100%; order: 0; }
  .cs-bar__title h2 { font-size: 19px; }
  .cs-tabs { display: inline-flex; order: 1; border: 1px solid var(--bv-crm-secondary-line, #8eaa97); border-radius: 8px; overflow: hidden; }
  .cs-tab { all: unset; cursor: pointer; padding: 8px 14px; min-height: 22px; font-size: 13px; font-weight: 600; color: var(--bv-crm-primary, #17523b); background: #fff; }
  .cs-tab[aria-pressed="true"] { background: var(--bv-crm-primary, #17523b); color: #fff; }
  .cs-tab:focus-visible { outline: 3px solid var(--bv-crm-focus, #2e865c); outline-offset: -3px; }
  .cs-bar__actions { order: 2; margin-left: auto; }
  .cs-body { grid-template-columns: minmax(0, 1fr); }
  .cs-overlay[data-view="edit"] .cs-pane--preview { display: none; }
  .cs-overlay[data-view="preview"] .cs-pane--edit { display: none; }
  .cs-pane--edit { border-right: 0; padding: 14px 14px 32px; }
  .cs-meta-grid { grid-template-columns: minmax(0, 1fr); }
  .contract-editor--studio .contract-editor__surface { min-height: 50vh !important; padding: 16px !important; }
  .cs-pane--preview { padding: 10px; }
}
@media (max-width: 420px) {
  .cs-bar__actions .btn { padding-left: .7rem; padding-right: .7rem; }
}

/* ---------- Buchungsseite bearbeiten (gleicher Vollbild-Rahmen) ---------- */
.bps-edit { gap: 16px; }
.bps-group { background: #fff; border: 1px solid var(--bv-crm-line, #d5e1d8); border-radius: 12px; padding: 16px; display: grid; gap: 12px; }
.bps-group > h3 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--cs-muted); font-family: inherit; }
.bps-note { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--cs-muted); }
.bps-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.bps-grid .field { display: grid; gap: 5px; margin: 0; min-width: 0; }
.bps-grid .field > span { font-size: 12px; font-weight: 600; color: var(--ink-soft, #3d3d3d); }
.bps-grid .input, .bps-grid .select, .bps-grid .textarea { width: 100%; min-width: 0; }
.bps-span { grid-column: 1 / -1; }
.bps-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.bps-color { display: flex; align-items: center; gap: 8px; }
.bps-swatch { flex: 0 0 40px; width: 40px; height: 40px; padding: 2px; border: 1px solid var(--bv-crm-line, #d5e1d8); border-radius: 8px; background: #fff; cursor: pointer; }
.bps-swatch.is-unset { background: repeating-linear-gradient(45deg, #fff 0 6px, #eef2ef 6px 12px); }
.bps-swatch.is-unset::-webkit-color-swatch { opacity: .15; }
.bps-color .input[aria-invalid] { border-color: var(--danger, #b42318) !important; }
.bps-stage { position: relative; min-height: 0; display: flex; justify-content: center; }
.bps-device { position: relative; width: 100%; height: 100%; border-radius: 6px; overflow: hidden; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 12px 32px rgba(9,43,37,.12); transition: width .2s ease; }
.bps-stage[data-size="mobile"] .bps-device { width: 390px; max-width: 100%; border-radius: 22px; border: 8px solid #1b2622; }
.bps-frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
@media (max-width: 560px) { .bps-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .bps-overlay .cs-preview-tools .cs-seg { display: none; } }

/* Formattext ohne Datenfelder (Angebotstext) */
.contract-editor--studio.contract-editor--compact .contract-editor__surface { min-height: 180px !important; }
.cs-design-note { margin: 0; padding: 10px 14px; font-size: 12.5px; color: var(--cs-muted); background: #fff; border: 1px dashed var(--bv-crm-line, #d5e1d8); border-radius: 10px; }

/* ---------- Design-Editor (Einstellungen): alle Dokumente + Kundenportal ---------- */
.ds-types { position: sticky; top: -18px; z-index: 3; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; margin: -4px 0 2px;
  background: #fff; border: 1px solid var(--bv-crm-line, #d5e1d8); border-radius: 12px; }
.ds-type { all: unset; cursor: pointer; padding: 8px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--bv-crm-primary, #17523b); }
.ds-type:hover { background: #eef4f0; }
.ds-type[aria-selected="true"] { background: var(--bv-crm-primary, #17523b); color: #fff; }
.ds-type:focus-visible { outline: 3px solid var(--bv-crm-focus, #2e865c); outline-offset: 1px; }
.ds-edit-body { display: grid; gap: 16px; }
.ds-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.ds-template { all: unset; cursor: pointer; display: grid; gap: 4px; padding: 10px; border: 1px solid var(--bv-crm-line, #d5e1d8); border-radius: 10px; background: #fff; font-size: 12.5px; color: var(--cs-muted); }
.ds-template strong { font-size: 13.5px; color: var(--ink, #1a1a1a); }
.ds-template[aria-checked="true"] { border-color: var(--bv-crm-primary, #17523b); box-shadow: 0 0 0 2px #88aa99; }
.ds-template:focus-visible { outline: 3px solid var(--bv-crm-focus, #2e865c); outline-offset: 2px; }
.ds-template__sample { display: block; height: 46px; border-radius: 4px; background: #faf8f3 linear-gradient(#b9b0a6, #b9b0a6) 9px 10px / 55% 5px no-repeat; border: 1px solid #ece6de; }
.ds-template--bold .ds-template__sample, .ds-template--noir .ds-template__sample { border-top: 14px solid #233d36; }
.ds-template--atelier .ds-template__sample { border-left: 7px solid #967252; }
.ds-template--heritage .ds-template__sample { outline: 3px double #ad9475; outline-offset: -4px; }
.ds-template--minimal .ds-template__sample { border-top: 1px solid #233d36; background-color: #fff; }
.ds-blocks { display: grid; gap: 6px; }
.ds-block { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 8px 6px 12px; border: 1px solid var(--bv-crm-line, #d5e1d8); border-radius: 9px; background: #fff; }
.ds-block.is-off { background: #f6f6f4; color: var(--cs-muted); }
.ds-block .cs-check { grid-column: auto; }
.ds-block__move { display: inline-flex; gap: 4px; }
.ds-general > summary { cursor: pointer; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--cs-muted); }
.ds-general[open] > summary { margin-bottom: 4px; }
.bps-group .field > small.bps-note { font-size: 12px; }
.cs-design-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
/* Einstellungen: Design-Übersicht je Dokument */
.ds-overview .tabs { margin-bottom: 12px; }
.ds-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 18px; margin: 12px 0 16px; }
.ds-summary__row { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--bv-crm-line, #d5e1d8); border-radius: 10px; background: #fff; }
.ds-summary__row dt { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #5f645f; }
.ds-summary__row dd { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; overflow-wrap: anywhere; }
.ds-swatch { flex: 0 0 18px; width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(0,0,0,.15); }
.ds-overview-actions { gap: 12px; align-items: center; flex-wrap: wrap; }
.ds-palette { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.ds-palette__swatch { all: unset; cursor: pointer; width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.18); }
.ds-palette__swatch:focus-visible { outline: 3px solid var(--bv-crm-focus, #2e865c); outline-offset: 2px; }
.ds-palette--logo { align-items: center; padding: 6px 8px; border-radius: 8px; background: var(--bg-alt, #f3efe9); }
.ds-palette--logo[hidden] { display: none; }
.ds-palette__label { font-size: 12px; color: var(--ink-muted, #6b665e); margin-right: 4px; }
.ds-palette--logo .ds-palette__swatch { width: 26px; height: 26px; }
/* hidden muss gegen display-Regeln gewinnen (Umschalten PDF ↔ Portal im Design-Editor) */
.ds-overlay .cs-seg[hidden], .ds-overlay .pds-stage[hidden], .ds-overlay .cs-paper[hidden] { display: none !important; }

/* Live-Formatierung im Vertrags-/Angebotseditor: Markdown bleibt gespeichert, wird aber direkt so dargestellt. */
.contract-editor__surface .cmd-b { font-weight: 700; }
.contract-editor__surface .cmd-i { font-style: italic; }
.contract-editor__surface .cmd-u { text-decoration: underline; text-underline-offset: 2px; }
.contract-editor__surface .cmd-h1 { font-size: 1.45em; font-weight: 700; line-height: 1.35; }
.contract-editor__surface .cmd-h2 { font-size: 1.25em; font-weight: 700; line-height: 1.4; }
.contract-editor__surface .cmd-h3 { font-size: 1.08em; font-weight: 700; }
.contract-editor__surface .cmd-li .cmd-mark--block { color: var(--bv-crm-accent, #2e865c); opacity: 1; font-weight: 700; }
.contract-editor__surface .cmd-link { text-decoration: underline; text-underline-offset: 2px; color: var(--bv-crm-accent, #17523b); }
.contract-editor__surface .cmd-link-target { font-size: .78em; }
.contract-editor__surface .cmd-tmark { display: inline-block; font-size: .75em; letter-spacing: .08em; color: var(--bv-crm-muted, #77736f); }
.contract-editor__surface .cmd-tmark.cmd-pagebreak { display: block; border-top: 1px dashed var(--line, #e8e3db); padding-top: 2px; }
.contract-editor__surface .cmd-tgrid { display: grid; align-items: stretch; border-bottom: 1px solid var(--line, #e8e3db); }
.contract-editor__surface .cmd-tgrid.cmd-tfirst { border-top: 1px solid var(--line, #e8e3db); }
.contract-editor__surface .cmd-tgrid.cmd-thead { background: var(--bg-alt, #f3efe9); font-weight: 600; }
.contract-editor__surface .cmd-tgrid > .cmd-mark--pipe { display: block; font-size: 0; line-height: 0; color: transparent; background: var(--line, #e8e3db); opacity: 1; margin: 0; }
.contract-editor__surface .cmd-tgrid > .cmd-cell { display: block; min-height: 1.7em; padding: 2px 8px; min-width: 0; overflow-wrap: anywhere; }
.contract-editor__surface .cmd-tgrid > .cmd-nl, .contract-editor__surface .cmd-tgrid > .cmd-ttail { display: none; }
.contract-editor__surface .cmd-trow .cmd-mark--pipe { display: inline-block; margin: 0 .55em; }
.contract-editor__surface .cmd-mark { opacity: .38; font-weight: 400; font-style: normal; text-decoration: none; font-size: .9em; }
.contract-editor__surface .cmd-h1 > .cmd-mark, .contract-editor__surface .cmd-h2 > .cmd-mark, .contract-editor__surface .cmd-h3 > .cmd-mark { font-size: .7em; }
@media (forced-colors: active) { .contract-editor__surface .cmd-mark { opacity: 1; } }

/* Fußzeile im Design-Editor: bis zu drei Spalten, Platzhalter, Zeilenzähler (10.11.2026) */
.ds-footer__cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ds-footer__text { font-family: var(--font-mono, ui-monospace, monospace); font-size: 12.5px; line-height: 1.45; resize: vertical; }
.ds-footer__count { display: block; margin-top: 4px; font-variant-numeric: tabular-nums; }
.ds-footer__count.is-error { color: var(--bv-crm-danger, #8f2f2f); font-weight: 600; }
.ds-footer__tokens { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 12px; }
.ds-footer__heading { margin: 16px 0 4px; font-size: 14px; }
@media (max-width: 900px) { .ds-footer__cols { grid-template-columns: 1fr; } }

/* Tabellen im Editor: ⋯-Menü, Breitenleiste, Ziehen der Spaltengrenzen (11.11.2026) */
.contract-editor { position: relative; }
.contract-editor__surface .cmd-tmark.cmd-theadline { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.contract-editor__surface .cmd-table-menu { font-size: .8rem; letter-spacing: .02em; color: var(--bv-crm-text, #1c1b19); background: var(--surface, #fff);
  border: 1px solid var(--line, #e8e3db); border-radius: 999px; padding: 2px 10px; cursor: pointer; user-select: none; white-space: nowrap; line-height: 1.6; }
.contract-editor__surface .cmd-table-menu:hover, .contract-editor__surface .cmd-table-menu:focus-visible { border-color: var(--bv-crm-accent, #17523b); color: var(--bv-crm-accent, #17523b); outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--bv-crm-accent, #17523b) 25%, transparent); }
.contract-editor__surface .cmd-tgrid > .cmd-mark--pipe { position: relative; }
.contract-editor__surface .cmd-tgrid > .cmd-mark--pipe:not(:first-child):not(:nth-last-child(1)):not(:nth-last-child(2))::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -5px; width: 11px; cursor: col-resize; }
.contract-editor__surface .cmd-tgrid > .cmd-mark--pipe:hover { background: var(--bv-crm-accent, #17523b); }
.contract-editor .ct-drag-tip { position: absolute; z-index: 31; pointer-events: none; font-size: .78rem; padding: 2px 8px; border-radius: 6px;
  background: var(--bv-crm-text, #1c1b19); color: #fff; white-space: nowrap; }
.contract-editor .ct-table-menu { position: absolute; z-index: 30; width: 380px; max-width: calc(100vw - 32px); max-height: 70vh; overflow: auto;
  display: flex; flex-direction: column; gap: 12px; padding: 14px; background: var(--surface, #fff); border: 1px solid var(--line, #e8e3db);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(28, 27, 25, .16); }
.contract-editor .ct-table-menu[hidden] { display: none; }
.contract-editor .ct-table-menu:focus { outline: none; }
.contract-editor .ct-menu-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.contract-editor .ct-menu-section { display: flex; flex-direction: column; gap: 6px; }
.contract-editor .ct-menu-label { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--bv-crm-muted, #77736f); }
.contract-editor .ct-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.contract-editor .ct-presets .btn[aria-pressed="true"] { border-color: var(--bv-crm-accent, #17523b); color: var(--bv-crm-accent, #17523b); font-weight: 600; }
.contract-editor .ct-wbar { display: flex; height: 34px; border: 1px solid var(--line, #e8e3db); border-radius: 6px; overflow: hidden; touch-action: none; user-select: none; }
.contract-editor .ct-wseg { display: flex; align-items: center; justify-content: center; min-width: 0; font-size: .78rem; color: var(--bv-crm-muted, #77736f); background: var(--bg-alt, #f6f3ee); }
.contract-editor .ct-whandle { flex: 0 0 10px; cursor: col-resize; background: linear-gradient(90deg, transparent 4px, var(--bv-crm-accent, #17523b) 4px, var(--bv-crm-accent, #17523b) 6px, transparent 6px); }
.contract-editor .ct-whandle:focus-visible { outline: 2px solid var(--bv-crm-accent, #17523b); outline-offset: -2px; }
.contract-editor .ct-winputs { display: flex; flex-wrap: wrap; gap: 8px; }
.contract-editor .ct-winput { display: inline-flex; align-items: center; gap: 4px; font-size: .82rem; }
.contract-editor .ct-winput .input { width: 64px; padding: 4px 6px; }
.contract-editor .ct-border { display: inline-flex; align-items: center; gap: 6px; }
.contract-editor .ct-border-icon { width: 16px; height: 12px; display: inline-block; }
.contract-editor .ct-border-icon--all { border: 1.5px solid currentColor; background: linear-gradient(90deg, transparent 6.5px, currentColor 6.5px, currentColor 8px, transparent 8px), linear-gradient(transparent 4.5px, currentColor 4.5px, currentColor 6px, transparent 6px); }
.contract-editor .ct-border-icon--rows { border-top: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; background: linear-gradient(transparent 4.5px, currentColor 4.5px, currentColor 6px, transparent 6px); }
.contract-editor .ct-border-icon--none { border: 1.5px dashed color-mix(in srgb, currentColor 40%, transparent); }
@media (max-width: 640px) {
  .contract-editor .ct-table-menu { position: fixed; left: 8px !important; right: 8px; bottom: 8px; top: auto !important; width: auto; max-height: 75vh; }
}
.contract-editor .ct-menu-check { display: flex; flex-direction: row; align-items: center; gap: 8px; font-size: .9rem; text-align: left; }
.contract-editor .ct-menu-check input { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; }
