/* Cometavia - base styles */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #dfe1e6;
  --text: #172b4d;
  --muted: #5e6c84;
  --primary: #0b5cad;
  --primary-hover: #094a8c;
  --primary-soft: #e6f0fa;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #1d7a46;
  --ok-soft: #e7f5ec;
  --warn: #8a5a00;
  --warn-soft: #fff6db;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 15px; color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; }
code, pre, textarea.code { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { margin-left: auto; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.hidden, [hidden] { display: none !important; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); border-radius: var(--radius); cursor: pointer; font: inherit;
  font-size: 14px; line-height: 1.4; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f1f2f4; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: #f1b8b2; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 3px 8px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; margin-top: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=search], input[type=email], input:not([type]), select, textarea {
  font: inherit; font-size: 14px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; color: var(--text); max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
label > input, label > select, label > textarea { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; color: var(--text); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; height: 52px; display: flex; align-items: center; gap: 16px;
  padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 16px; }
.brand:hover { text-decoration: none; }
.logo-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .5px; }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 6px 10px; border-radius: var(--radius); color: var(--text); font-size: 14px; }
.topnav a:hover { background: #f1f2f4; text-decoration: none; }
.searchbox { margin-left: auto; }
.searchbox input { width: 260px; }
.usermenu { position: relative; }
.dropdown { position: absolute; right: 0; top: 40px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 6px 20px rgba(9, 30, 66, .15); min-width: 200px; padding: 4px; z-index: 30; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 7px 10px; color: var(--text);
  border: 0; background: none; font: inherit; font-size: 14px; cursor: pointer; border-radius: 4px; }
.dropdown a:hover, .dropdown button:hover { background: #f1f2f4; text-decoration: none; }
.dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: calc(100vh - 52px); }
.sidebar { width: 290px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  padding: 16px 8px 16px 12px; position: sticky; top: 52px; height: calc(100vh - 52px); overflow: auto; }
.main { flex: 1; min-width: 0; padding: 24px 40px 60px; }
.content-width { max-width: 980px; }
.loading { color: var(--muted); padding: 40px; }

.space-header { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.space-avatar { width: 32px; height: 32px; border-radius: 6px; background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.space-header .name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.side-links a { display: block; padding: 4px 8px; font-size: 14px; color: var(--text); border-radius: 4px; }
.side-links a:hover { background: #f1f2f4; text-decoration: none; }
.side-title { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; margin: 14px 8px 6px; }

/* ---------- page tree ---------- */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 14px; }
.tree-item { display: flex; align-items: center; gap: 2px; border-radius: 4px; }
.tree-item:hover { background: #f1f2f4; }
.tree-item.active { background: var(--primary-soft); }
.tree-item.active a { font-weight: 600; }
.tree-toggle { width: 20px; height: 22px; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 10px; flex-shrink: 0; padding: 0; }
.tree-toggle.empty { cursor: default; visibility: hidden; }
.tree-item a { flex: 1; padding: 3px 4px; color: var(--text); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-item a:hover { text-decoration: none; }

/* ---------- page ---------- */
.breadcrumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs span.sep { margin: 0 6px; }
.page-head { display: flex; gap: 16px; align-items: flex-start; }
.page-title { font-size: 30px; margin: 0 0 6px; font-weight: 700; word-break: break-word; }
.page-meta { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.page-actions { margin-left: auto; display: flex; gap: 6px; position: relative; flex-shrink: 0; }
.lock { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 3px; background: var(--warn-soft); color: var(--warn); margin-left: 6px; }

.wiki-content { font-size: 15.5px; line-height: 1.65; word-wrap: break-word; }
.wiki-content h1 { font-size: 24px; margin: 28px 0 10px; }
.wiki-content h2 { font-size: 20px; margin: 24px 0 8px; }
.wiki-content h3 { font-size: 17px; margin: 20px 0 6px; }
.wiki-content p { margin: 0 0 12px; }
.wiki-content img { max-width: 100%; height: auto; }
.wiki-content table { border-collapse: collapse; margin: 12px 0; min-width: 40%; }
.wiki-content th, .wiki-content td { border: 1px solid var(--border); padding: 6px 10px; vertical-align: top; text-align: left; }
.wiki-content th { background: #f4f5f7; font-weight: 600; }
.wiki-content pre { background: #f4f5f7; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; overflow: auto; }
.wiki-content code { background: #f4f5f7; padding: 1px 4px; border-radius: 3px; }
.wiki-content pre code { background: none; padding: 0; }
.wiki-content blockquote { margin: 12px 0; padding: 4px 16px; border-left: 4px solid var(--border); color: var(--muted); }
.wiki-content hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* macros (view) */
.panel { border-radius: var(--radius); padding: 10px 14px; margin: 12px 0; border-left: 4px solid; }
.panel-title { font-weight: 700; margin-bottom: 4px; }
.panel-body > :last-child { margin-bottom: 0; }
.panel-info { background: #e9f2ff; border-color: #1868db; }
.panel-note { background: var(--warn-soft); border-color: #e2a800; }
.panel-warning { background: var(--danger-soft); border-color: var(--danger); }
.panel-tip, .panel-success { background: var(--ok-soft); border-color: var(--ok); }
.status { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 1px 6px; border-radius: 3px; letter-spacing: .3px; }
.status-grey { background: #dfe1e6; color: #42526e; }
.status-blue { background: #cce0ff; color: #0747a6; }
.status-green { background: #dcfff1; color: #216e4e; }
.status-yellow { background: #fff7d6; color: #7f5f01; }
.status-red { background: #ffece8; color: #ae2e24; }
.toc { background: #fafbfc; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; margin: 12px 0; display: inline-block; min-width: 260px; }
.toc-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.toc ul { margin: 0; padding-left: 18px; }
.toc-l1 { margin-left: 16px; } .toc-l2 { margin-left: 32px; } .toc-l3 { margin-left: 48px; }
.expand { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; margin: 12px 0; }
.expand summary { cursor: pointer; font-weight: 600; }
.macro-error { background: var(--danger-soft); color: var(--danger); padding: 8px 12px; border-radius: var(--radius); margin: 8px 0; font-size: 14px; }
.included { border-left: 3px solid var(--border); padding-left: 12px; }
.page-list { padding-left: 20px; }

/* ---------- labels, attachments, comments ---------- */
.section { margin-top: 32px; border-top: 1px solid var(--border); padding-top: 16px; }
.section h3 { font-size: 15px; margin: 0 0 10px; }
.label-chip { display: inline-flex; align-items: center; gap: 4px; background: #f1f2f4; border-radius: 3px; padding: 1px 8px; font-size: 13px; margin: 2px 4px 2px 0; }
.label-chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 0 0 2px; font-size: 14px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); }
table.list th, table.list td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.list th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
table.list tr:hover td { background: #fafbfc; }
.comment { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; }
.comment.reply { margin-left: 32px; }
.comment-head { font-size: 13px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 8px; }
.comment-head b { color: var(--text); }
.comment-body p { margin: 0 0 6px; }
textarea.comment-input { width: 100%; min-height: 70px; }

/* ---------- editor ---------- */
.editor-title { width: 100%; font-size: 28px !important; font-weight: 700; border: 0 !important; padding: 6px 0 !important;
  background: transparent !important; outline: none !important; }
.toolbar { position: sticky; top: 52px; z-index: 10; display: flex; flex-wrap: wrap; gap: 2px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.toolbar button, .toolbar select { border: 1px solid transparent; background: none; padding: 4px 8px; border-radius: 4px;
  cursor: pointer; font: inherit; font-size: 13px; color: var(--text); min-width: 30px; }
.toolbar button:hover { background: #f1f2f4; border-color: var(--border); }
.toolbar .sep { width: 1px; background: var(--border); margin: 2px 4px; }
.editor-area { min-height: 420px; background: var(--surface); border: 1px solid var(--border); border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius); padding: 20px 24px; outline: none; }
.toolbar .source-btn { font-family: var(--mono); font-weight: 700; }
.editor-area [data-macro] { border: 1px dashed #8993a4; border-radius: 4px; padding: 6px 10px; margin: 8px 0; background: #fafbfc; position: relative; }
.editor-area div[data-macro]::before { content: "Macro: " attr(data-macro) "  " attr(data-params); display: block; font-size: 11px;
  font-family: var(--mono); color: var(--muted); margin-bottom: 4px; white-space: pre-wrap; }
.editor-area span[data-macro] { display: inline-block; padding: 0 6px; margin: 0; }
.editor-area span[data-macro]::before { content: "[" attr(data-macro) " " attr(data-params) "]"; font-size: 11px; font-family: var(--mono); color: var(--muted); }
.editor-area table { border-collapse: collapse; }
.editor-area th, .editor-area td { border: 1px solid var(--border); padding: 6px 10px; min-width: 60px; }
.editor-footer { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--border); margin-top: 12px; }
.editor-footer input { flex: 1; max-width: 420px; }

/* ---------- cards & dashboard ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
a.card { display: block; color: var(--text); }
a.card:hover { border-color: var(--primary); text-decoration: none; box-shadow: 0 2px 8px rgba(9, 30, 66, .08); }
.card h4 { margin: 8px 0 4px; font-size: 15px; }
.card p { margin: 0; font-size: 13px; color: var(--muted); }
.dash { display: grid; grid-template-columns: 1fr 320px; gap: 28px; }
.page-head-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.page-head-bar h1 { margin: 0; font-size: 24px; }
.recent-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.recent-item:last-child { border-bottom: 0; }
.search-result { padding: 12px 0; border-bottom: 1px solid var(--border); }
.search-result .t { font-size: 16px; font-weight: 600; }
.search-result mark { background: #fff1a8; padding: 0 1px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; }
.tabs a.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* ---------- diff ---------- */
.diff ins { background: #d3f5df; text-decoration: none; }
.diff del { background: #fbd5d1; }
.diff { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; line-height: 1.7; }

/* ---------- scripts ---------- */
textarea.code { width: 100%; min-height: 380px; tab-size: 4; line-height: 1.5; background: #1e2430; color: #e6e9ef; border-color: #1e2430; padding: 12px; }
textarea.code:focus { outline: 2px solid var(--primary); }
pre.output { background: #0f141c; color: #d7dde8; padding: 12px; border-radius: var(--radius); max-height: 420px; overflow: auto; white-space: pre-wrap; font-size: 13px; margin: 0; }
pre.output.err { color: #ffb4a9; }
.type-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 3px; background: #eef; color: #334; font-family: var(--mono); }
.ok-badge { color: var(--ok); font-weight: 700; } .err-badge { color: var(--danger); font-weight: 700; }
.help { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; font-size: 13px; }
.help code { background: #f4f5f7; padding: 0 4px; border-radius: 3px; }
.help pre { background: #f4f5f7; padding: 8px; border-radius: 4px; overflow: auto; }
.split { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }

/* ---------- modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(9, 30, 66, .45); z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 8px; width: 560px; max-width: 100%; max-height: 90vh; overflow: auto; padding: 20px 22px; box-shadow: 0 12px 40px rgba(9, 30, 66, .3); }
.modal h2 { margin: 0 0 14px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #172b4d; color: #fff; padding: 10px 18px; border-radius: var(--radius); z-index: 200; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 80vw; }
.toast.error { background: var(--danger); }
.empty { color: var(--muted); padding: 20px 0; }
.pick-list { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); margin-top: 8px; }
.pick-list div { padding: 6px 10px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 14px; }
.pick-list div:hover { background: var(--primary-soft); }

/* ---------- source editor (<>) ---------- */
body.se-open { overflow: hidden; }
.se-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(9, 30, 66, .55); display: grid; place-items: center; padding: 24px; }
.se-dialog { position: relative; display: flex; flex-direction: column; width: min(1280px, 100%); height: min(860px, 100%);
  background: var(--surface); border-radius: 8px; box-shadow: 0 16px 48px rgba(9, 30, 66, .35); overflow: hidden; }
.se-dialog.se-max { width: 100%; height: 100%; border-radius: 0; }
.se-overlay:has(.se-max) { padding: 0; }
.se-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.se-title { font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.se-icon { font-family: var(--mono); background: var(--primary); color: #fff; border-radius: 4px; padding: 0 6px; font-size: 13px; }
.se-tools { display: flex; flex-wrap: wrap; gap: 2px; margin-left: auto; align-items: center; }
.se-tools button, .se-tools select, .se-find button { border: 1px solid transparent; background: none; padding: 3px 8px; border-radius: 4px;
  cursor: pointer; font: inherit; font-size: 13px; color: var(--text); }
.se-tools select { border-color: var(--border); padding: 2px 4px; }
.se-tools button:hover, .se-find button:hover { background: #f1f2f4; border-color: var(--border); }
.se-tools button.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.se-sep { width: 1px; align-self: stretch; background: var(--border); margin: 2px 4px; }
.se-find { padding: 6px 12px; border-bottom: 1px solid var(--border); background: #fafbfc; display: grid; gap: 6px; }
.se-find-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.se-find-row input:not([type]) { width: 320px; max-width: 100%; font-family: var(--mono); font-size: 13px; padding: 4px 8px; }
.se-find-row label { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; margin: 0; cursor: pointer; white-space: nowrap; }
.se-find-row input.se-bad { border-color: var(--danger); background: var(--danger-soft); }
.se-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; }
.se-body.with-preview { grid-template-columns: 1fr 1fr; }
.se-code { min-height: 0; min-width: 0; }
.se-code .CodeMirror { height: 100%; font-family: var(--mono); font-size: 13px; line-height: 1.5; }
.se-preview { display: none; overflow: auto; padding: 16px 22px; border-left: 1px solid var(--border); background: var(--surface); color: var(--text); }
.se-body.with-preview .se-preview { display: block; }
.se-problems { max-height: 150px; overflow: auto; border-top: 1px solid var(--border); font-size: 13px; background: #fafbfc; }
.se-problems-head { position: sticky; top: 0; display: flex; justify-content: space-between; padding: 4px 12px; font-weight: 700; background: #f1f2f4; }
.se-problems-head button { border: 0; background: none; cursor: pointer; font-size: 16px; }
.se-problem { padding: 3px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.se-problem:hover { background: var(--primary-soft); }
.se-problem.err b { color: var(--danger); } .se-problem.warn b { color: var(--warn); }
.se-status { display: flex; gap: 18px; align-items: center; padding: 3px 12px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--border); font-family: var(--mono); background: #fafbfc; }
.se-path { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.se-valid.ok { color: var(--ok); font-weight: 700; } .se-valid.err { color: var(--danger); font-weight: 700; } .se-valid.warn { color: var(--warn); font-weight: 700; }
.se-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 8px 12px; border-top: 1px solid var(--border); }
.se-foot .muted { margin-right: auto; }
.se-issues { width: 16px; }
.se-marker { display: inline-block; width: 14px; height: 14px; line-height: 14px; border-radius: 50%; text-align: center;
  font-size: 10px; font-weight: 700; color: #fff; cursor: help; font-family: var(--font); }
.se-marker.err { background: #e5484d; } .se-marker.warn { background: #d99a00; }
.se-line-error { background: rgba(229, 72, 77, .12); }
.cm-se-match { background: rgba(255, 213, 0, .45); border-radius: 2px; }
.se-dark .cm-se-match { background: rgba(255, 213, 0, .35); color: #fff !important; }
/* show-hint.css (loaded later) sets z-index 10 - the list must be above the dialog */
body .CodeMirror-hints { z-index: 150; font-family: var(--mono); font-size: 13px; }
.se-help { position: absolute; top: 48px; right: 12px; bottom: 60px; width: 460px; max-width: calc(100% - 24px); overflow: auto; z-index: 5;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 28px rgba(9, 30, 66, .25); padding: 12px 16px; font-size: 13px; }
.se-help-head { display: flex; justify-content: space-between; align-items: center; }
.se-help-head button { border: 0; background: none; font-size: 18px; cursor: pointer; }
.se-help pre { background: #f4f5f7; padding: 8px; border-radius: 4px; overflow: auto; font-size: 12px; }
.se-help table.list th { white-space: nowrap; width: 1%; }
/* dark theme around the dark CodeMirror */
.se-dark .se-head, .se-dark .se-foot, .se-dark { background: #1f2329; color: #e6e9ef; }
.se-dark .se-head, .se-dark .se-foot, .se-dark .se-find, .se-dark .se-status, .se-dark .se-problems { border-color: #3a404a; }
.se-dark .se-tools button, .se-dark .se-tools select, .se-dark .se-find button { color: #e6e9ef; }
.se-dark .se-tools select { background: #2a2f37; border-color: #3a404a; }
.se-dark .se-tools button:hover, .se-dark .se-find button:hover { background: #2f3540; border-color: #4a515d; }
.se-dark .se-tools button.on { background: #22364d; border-color: #4c8fd6; color: #9ec8f5; }
.se-dark .se-find, .se-dark .se-status, .se-dark .se-problems { background: #191c21; color: #aab2bf; }
.se-dark .se-problems-head { background: #252a31; color: #e6e9ef; }
.se-dark .se-problems-head button { color: #e6e9ef; }
.se-dark .se-problem { border-color: #2f3540; }
.se-dark .se-problem:hover { background: #22364d; }
.se-dark .se-find-row input:not([type]) { background: #2a2f37; color: #e6e9ef; border-color: #3a404a; }
.se-dark .se-sep { background: #3a404a; }
.se-dark .muted { color: #9aa3b0; }
.se-dark .se-foot .btn:not(.btn-primary):not(.btn-danger) { background: #2a2f37; color: #e6e9ef; border-color: #3a404a; }
.se-dark .se-valid.ok { color: #4cc38a; } .se-dark .se-valid.err { color: #ff7b72; } .se-dark .se-valid.warn { color: #f0b72f; }
.se-dark .se-preview { border-color: #3a404a; }
@media (max-width: 900px) { .se-body.with-preview { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; } .se-overlay { padding: 0; } }

/* ---------- settings & modules ---------- */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 14px; }
.check-grid label.inline { display: flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; font-weight: normal; }
.check-grid label.inline input { width: auto; margin: 0; }
.module-panel h3 { margin-bottom: 8px; }
.module-widget:empty::before { content: "Loading..."; color: var(--muted); font-size: 13px; }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; background: var(--bg); }
.login-box { width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 28px; box-shadow: 0 6px 24px rgba(9, 30, 66, .08); }
.login-box label { margin-top: 12px; }
.login-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; margin-bottom: 14px; }
.login-msg { background: var(--danger-soft); color: var(--danger); padding: 8px 12px; border-radius: var(--radius); font-size: 14px; }
.login-msg.ok { background: var(--ok-soft); color: var(--ok); }
.login-box .btn-primary { margin-top: 18px; }

/* ---------- responsive & print ---------- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { padding: 16px; }
  .dash, .split, .form-grid { grid-template-columns: 1fr; }
  .searchbox input { width: 140px; }
  .topnav { display: none; }
}
@media print {
  .topbar, .sidebar, .page-actions, .section, .breadcrumbs { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
}


/* Cometavia Appearance v1 - shared tokens, shell and document editor */
:root {
  --cv-header:#0747a6; --cv-header-text:#ffffff; --cv-sidebar:#f4f5f7;
  --cv-hover:#ebecf0; --cv-input:#ffffff; --cv-shadow:0 3px 14px rgba(9,30,66,.08);
  --cv-code:#f4f5f7; --cv-header-height:58px; --cv-document-width:1000px;
}
:root[data-cv-skin="classic"] { --radius:4px; }
:root[data-cv-skin="modern"] {
  --bg:#edf2f8; --surface:#ffffff; --border:#dce4ef; --text:#182b49; --muted:#596b84;
  --primary:#2864dc; --primary-hover:#1d4fb3; --primary-soft:#e7efff;
  --cv-header:#ffffff; --cv-header-text:#182b49; --cv-sidebar:#f8faff;
  --cv-hover:#eaf0fa; --cv-input:#ffffff; --cv-code:#f0f4fa;
  --radius:9px; --cv-shadow:0 8px 28px rgba(20,47,87,.07);
}
:root[data-cv-skin="dark"] {
  --bg:#161a22; --surface:#222833; --border:#3b4554; --text:#e4eaf2; --muted:#aab8cb;
  --primary:#85b5ff; --primary-hover:#a7caff; --primary-soft:#293f60;
  --cv-header:#111722; --cv-header-text:#edf3ff; --cv-sidebar:#1b212c;
  --cv-hover:#303b4c; --cv-input:#1c2330; --cv-code:#1b2230;
  --danger:#ff9b94; --danger-soft:#482b30; --warn:#ffce75; --warn-soft:#493b25;
  --ok:#8edab0; --ok-soft:#254338; --radius:6px; --cv-shadow:0 5px 20px rgba(0,0,0,.2);
}
body { background:var(--bg); color:var(--text); }
.topbar { height:var(--cv-header-height); gap:18px; padding:0 24px; background:var(--cv-header); color:var(--cv-header-text); border-bottom:1px solid var(--border); }
.topbar .brand,.topbar .topnav a,.topbar #userBtn { color:var(--cv-header-text); }
.topbar .brand { font-size:19px; letter-spacing:-.4px; flex-shrink:0; }
.topbar .logo-mark { background:transparent; color:inherit; border:1px solid currentColor; }
.topbar .topnav a { padding:8px 11px; }
.topbar .topnav a:hover,.topbar #userBtn:hover { background:rgba(127,127,127,.18); }
.topbar #createBtn { background:var(--cv-header-text); color:var(--cv-header); border-color:transparent; font-weight:600; }
.topbar .searchbox input { width:230px; }
.layout { min-height:calc(100vh - var(--cv-header-height)); }
.sidebar { top:var(--cv-header-height); height:calc(100vh - var(--cv-header-height)); background:var(--cv-sidebar); width:274px; padding:20px 12px; }
.main { padding:28px 44px 64px; }
.content-width { max-width:var(--cv-document-width); margin-left:auto; margin-right:auto; }
.side-title { font-size:11px; letter-spacing:.8px; }
.side-links a { padding:7px 10px; }
.side-links a,.tree-item a,.tree-toggle { color:var(--text); }
.tree-item a { padding:6px 4px; }
.side-links a:hover,.tree-item:hover,.btn:hover,.dropdown a:hover,.dropdown button:hover,.pick-list div:hover { background:var(--cv-hover); }
.tree-item.active { background:var(--primary-soft); }
.tree-item.active a { color:var(--primary); }
.page-title { letter-spacing:-.7px; }
.breadcrumbs { margin-bottom:14px; }
.page-meta { color:var(--muted); }
.btn { border-radius:var(--radius); min-height:34px; padding:6px 12px; }
.btn-primary { color:var(--surface); background:var(--primary); }
.btn-primary:hover { background:var(--primary-hover); }
.btn-ghost { background:transparent; }
.dropdown,.modal,.card,.comment { background:var(--surface); color:var(--text); border-color:var(--border); }
.dropdown { box-shadow:var(--cv-shadow); }
.dropdown a,.dropdown button { color:var(--text); }
.card { box-shadow:var(--cv-shadow); }
a.card:hover { background:var(--cv-hover); }
input[type=text],input[type=password],input[type=search],input[type=email],input:not([type]),select,textarea {
  background:var(--cv-input); color:var(--text); border-color:var(--border);
}
input::placeholder,textarea::placeholder { color:var(--muted); opacity:.85; }
.wiki-content th,table.list th { background:var(--cv-code); color:var(--text); }
.wiki-content pre,.wiki-content code,.help code,.help pre { background:var(--cv-code); }
.wiki-content pre code { background:none; }
table.list tr:hover td { background:var(--cv-hover); }
.help,.pick-list { background:var(--surface); border-color:var(--border); }
.cv-editor-shell { max-width:1140px; }
.cv-editor-topline { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:18px; }
.cv-editor-topline .breadcrumbs { margin:0; }
.cv-editor-tag { display:inline-flex; padding:3px 9px; border-radius:4px; background:var(--primary-soft); color:var(--primary); font-size:12px; font-weight:600; }
.cv-editor-tools { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.cv-editor-document { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--cv-shadow); }
.cv-title-row { padding:28px 38px 20px; }
.cv-editor-document .editor-title { font-size:32px !important; color:var(--text); line-height:1.3; }
.cv-title-hint { color:var(--muted); font-size:12px; margin-top:6px; }
.cv-editor-document .toolbar { top:var(--cv-header-height); padding:8px 14px; gap:4px; border:0; border-top:1px solid var(--border); border-bottom:1px solid var(--border); border-radius:0; background:var(--surface); }
.toolbar button,.toolbar select { color:var(--text); border-radius:4px; min-height:32px; }
.toolbar button:hover { background:var(--cv-hover); border-color:var(--border); }
.toolbar button[aria-pressed="true"] { background:var(--primary-soft); color:var(--primary); border-color:var(--primary); }
.toolbar button:focus-visible,.btn:focus-visible,summary:focus-visible { outline:2px solid var(--primary); outline-offset:2px; }
.toolbar .cv-tool-icon { display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px; vertical-align:middle; }
.cv-tool-icon svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.cv-insert-menu { position:relative; }
.cv-insert-menu > summary { list-style:none; cursor:pointer; padding:6px 12px; font-size:13px; border:1px solid var(--border); border-radius:4px; }
.cv-insert-menu > summary::-webkit-details-marker { display:none; }
.cv-insert-items { position:absolute; top:38px; left:0; width:190px; display:grid; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:5px; box-shadow:var(--cv-shadow); z-index:25; }
.cv-insert-items button { text-align:left; display:flex; align-items:center; gap:10px; padding:7px 10px; }
.cv-editor-document .editor-area { min-height:510px; padding:32px 40px 60px; border:0; border-radius:0 0 var(--radius) var(--radius); font-size:16px; line-height:1.7; }
.cv-editor-document .editor-area:focus { box-shadow:inset 3px 0 var(--primary); }
.cv-editor-shell .editor-footer { padding:14px 0; background:var(--bg); align-items:center; z-index:9; flex-wrap:wrap; }
.cv-editor-shell .editor-footer #message { max-width:none; min-width:210px; }
.cv-editor-shell #draftInfo { font-size:12px; }
.cv-editor-actions { display:flex; gap:8px; flex-shrink:0; }
body.cv-focus .sidebar,body.cv-focus .topbar .topnav,body.cv-focus .topbar .searchbox { display:none !important; }
body.cv-focus .main { padding-left:24px; padding-right:24px; }
body.cv-focus .cv-editor-shell { max-width:1200px; }
#editor [data-macro][data-cv-macro-card] { border-color:var(--border); background:var(--surface); }
#editor [data-cv-macro-ui] { background:var(--primary-soft); color:var(--text); }
#editor [data-cv-macro-ui] small { color:var(--muted); }
#editor [data-cv-macro-ui] button { background:var(--surface); border-color:var(--border); color:var(--primary); }
#editor [data-cv-macro-ui] button[data-cv-action=remove] { color:var(--danger); }
.cv-appearance-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(280px,.85fr); gap:24px; align-items:start; }
.cv-appearance-fields { display:grid; gap:20px; }
.cv-appearance-fields .card { padding:22px; }
.cv-appearance-fields h2 { font-size:18px; margin:0 0 16px; }
.cv-local-notice { border-left:4px solid var(--primary); background:var(--primary-soft); padding:14px 18px; margin-bottom:22px; border-radius:var(--radius); font-size:14px; }
.cv-color-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.cv-color-row { display:flex; gap:8px; margin-top:5px; align-items:center; }
.cv-color-row input[type=color] { width:44px; height:36px; padding:2px; border:1px solid var(--border); background:var(--surface); border-radius:4px; }
.cv-color-row input[type=text] { width:110px; font-family:var(--mono); }
.cv-appearance-preview { position:sticky; top:80px; padding:22px; }
.cv-mini-window { border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; margin-top:14px; }
.cv-mini-header { background:var(--cv-header); color:var(--cv-header-text); padding:14px; font-weight:600; display:flex; align-items:center; gap:8px; }
.cv-mini-header img { max-width:90px; max-height:24px; object-fit:contain; }
.cv-mini-layout { display:grid; grid-template-columns:80px 1fr; min-height:180px; }
.cv-mini-sidebar { background:var(--cv-sidebar); border-right:1px solid var(--border); padding:14px 8px; font-size:11px; }
.cv-mini-document { background:var(--surface); padding:16px; font-size:13px; }
.cv-mini-document h3 { margin:0 0 10px; }
.cv-appearance-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:20px; }
.cv-brand-image { max-width:160px; max-height:32px; object-fit:contain; }
.cv-upload-label input { display:block; margin:8px 0; max-width:100%; }
:root[data-cv-skin="dark"] .panel-info { background:#233d5f; color:#e4efff; }
:root[data-cv-skin="dark"] .toc,:root[data-cv-skin="dark"] .toc-empty { background:var(--cv-code); }
:root[data-cv-skin="dark"] .panel-warning,:root[data-cv-skin="dark"] .panel-note { color:var(--text); }
:root[data-cv-skin="dark"] .label-chip,:root[data-cv-skin="dark"] .diff { background:var(--surface); }
:root[data-cv-skin="dark"] .diff ins { background:#254338; }
:root[data-cv-skin="dark"] .diff del { background:#482b30; }
@media(max-width:1100px) { .topbar { gap:10px; padding:0 14px; } .topbar .searchbox input { width:150px; } .main { padding:24px; } .sidebar { width:240px; } .cv-appearance-grid { grid-template-columns:1fr; } .cv-appearance-preview { position:static; } }
@media(max-width:760px) { .main { padding:16px 12px 44px; } .topbar { flex-wrap:wrap; height:auto; min-height:58px; padding:10px; } .topbar .topnav { display:none; } .topbar .searchbox { display:none; } .topbar .usermenu { margin-left:auto; } .cv-title-row { padding:20px; } .cv-editor-document .editor-title { font-size:26px !important; } .cv-editor-document .editor-area { padding:24px 20px; } .cv-editor-topline { align-items:flex-start; } .cv-color-grid { grid-template-columns:1fr; } .cv-editor-shell .editor-footer #message { flex-basis:100%; } .cv-editor-document .toolbar { position:relative; top:0; } }
@media print { .cv-editor-topline,.toolbar,.editor-footer { display:none !important; } .cv-editor-document { box-shadow:none; border:0; } }

.login-logo .cv-brand-image { max-width:190px; max-height:54px; object-fit:contain; }

/* Confluence-like structural layout. Global branding colours keep precedence. */
:root, :root[data-cv-skin="classic"] {
  --bg:#ffffff; --surface:#ffffff; --cv-header:#ffffff; --cv-header-text:#253858;
  --cv-sidebar:#ffffff; --cv-header-height:56px; --cv-shadow:none; --radius:3px;
}
:root { --cv-sidebar-width:320px; }
body.cv-confluence .topbar { height:var(--cv-header-height); min-height:var(--cv-header-height); flex-wrap:nowrap; padding:0 24px; gap:14px; }
body.cv-confluence .topbar .brand { font-size:17px; letter-spacing:0; }
body.cv-confluence .logo-mark { border:0; border-radius:0; font-size:20px; width:24px; }
body.cv-confluence .topnav a { padding:5px 8px; }
body.cv-confluence #createBtn { background:#c62828; border-color:#c62828; color:#fff; border-radius:3px; font-weight:500; min-height:32px; padding:4px 13px; }
body.cv-confluence #createBtn:hover { background:#a82020; }
body.cv-confluence .searchbox { position:relative; }
body.cv-confluence .searchbox::before { content:''; position:absolute; left:10px; top:10px; width:9px; height:9px; border:2px solid #8996a2; border-radius:50%; pointer-events:none; }
body.cv-confluence .searchbox::after { content:''; position:absolute; left:20px; top:21px; width:6px; height:2px; background:#8996a2; transform:rotate(45deg); pointer-events:none; }
body.cv-confluence .searchbox input { width:242px; padding:6px 10px 6px 32px; height:34px; border:1px solid #a5adb4; border-radius:3px; background:var(--cv-code); }
.cv-icon { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; vertical-align:middle; }
body.cv-confluence .cv-global-icon { min-width:28px; padding:3px; color:var(--cv-header-text); font-size:24px; justify-content:center; }
.cv-avatar { display:inline-flex; align-items:center; justify-content:center; border-radius:50%; width:28px; height:28px; font-size:11px; background:var(--primary-soft); color:var(--text); flex-shrink:0; }
body.cv-confluence #userBtn.cv-avatar { min-height:28px; padding:0; border:0; color:var(--text); }
body.cv-confluence .layout { min-height:calc(100vh - var(--cv-header-height)); }
body.cv-confluence .sidebar { display:block; width:var(--cv-sidebar-width); min-width:0; flex-basis:var(--cv-sidebar-width); padding:18px 8px 18px 16px; top:var(--cv-header-height); height:calc(100vh - var(--cv-header-height)); overflow:auto; background:var(--cv-sidebar); scrollbar-width:thin; scrollbar-gutter:stable; }
body.cv-confluence .sidebar[hidden] { display:none; }
body.cv-confluence .side-links a { padding:4px 8px; border-radius:0; }
body.cv-confluence .space-header { padding-bottom:14px; }
body.cv-confluence .space-avatar { border-radius:3px; }
body.cv-confluence .tree-item { border-radius:0; }
body.cv-confluence .tree-item a { padding:5px 4px; font-size:14px; color:var(--text); }
body.cv-confluence .tree-item.active { background:transparent; }
body.cv-confluence .tree-item.active a { font-weight:700; color:var(--text); }
body.cv-confluence .tree-toggle { font-size:9px; }
.cv-sidebar-rail { position:sticky; top:var(--cv-header-height); height:calc(100vh - var(--cv-header-height)); width:8px; flex:0 0 8px; z-index:12; }
.cv-sidebar-resize { position:absolute; inset:0; cursor:col-resize; touch-action:none; }
.cv-sidebar-resize:hover,.cv-sidebar-resize:focus-visible { background:var(--primary-soft); outline:1px solid var(--primary); }
.cv-sidebar-toggle { position:absolute; top:42%; left:-6px; width:20px; height:34px; border:1px solid var(--border); border-radius:3px; background:var(--surface); color:var(--muted); cursor:pointer; padding:0; font-size:22px; }
.cv-sidebar-toggle:focus-visible { outline:2px solid var(--primary); outline-offset:2px; }
body.cv-confluence.cv-sidebar-collapsed .sidebar { width:0; flex-basis:0; padding:0; border:0; overflow:hidden; }
body.cv-sidebar-collapsed .cv-sidebar-rail { flex-basis:20px; width:20px; border-right:1px solid var(--border); }
body.cv-sidebar-collapsed .cv-sidebar-toggle { left:0; }
body.cv-sidebar-collapsed .cv-sidebar-resize { pointer-events:none; }
body.cv-resizing { cursor:col-resize; user-select:none; }
body.cv-confluence .main { padding:20px 36px 64px; background:var(--surface); }
body.cv-confluence .content-width { max-width:none; margin-left:0; margin-right:0; }
body.cv-confluence .card,body.cv-confluence .cv-editor-document { box-shadow:none; border-radius:0; }
body.cv-confluence .cv-page-toolbar { display:flex; justify-content:flex-end; min-height:40px; margin-bottom:14px; }
body.cv-confluence .page-actions { flex-wrap:wrap; justify-content:flex-end; gap:8px; flex-shrink:1; }
body.cv-confluence .page-actions>.btn { border:0; background:transparent; border-radius:2px; min-height:28px; padding:3px 6px; font-size:14px; color:var(--text); font-weight:400; gap:5px; }
body.cv-confluence .page-actions>.btn:hover { background:var(--cv-hover); }
body.cv-confluence .page-actions>.btn[aria-pressed="true"] { color:var(--primary); }
body.cv-confluence #cvSaveLater[aria-pressed="true"] .cv-icon { fill:var(--primary-soft); }
body.cv-confluence .page-menu { top:36px; }
body.cv-confluence .breadcrumbs { display:flex; align-items:center; gap:0; flex-wrap:wrap; margin-bottom:10px; min-height:24px; font-size:14px; }
body.cv-confluence .breadcrumbs a { color:var(--primary); }
body.cv-confluence .breadcrumbs .sep { color:var(--text); margin:0 9px; }
.cv-crumb-menu { display:inline-block; position:relative; }
.cv-crumb-menu summary { list-style:none; cursor:pointer; min-width:22px; text-align:center; }
.cv-crumb-menu summary::-webkit-details-marker { display:none; }
.cv-crumb-list { position:absolute; left:0; top:26px; min-width:220px; max-width:70vw; z-index:16; border:1px solid var(--border); background:var(--surface); padding:8px; }
.cv-crumb-list a { display:block; padding:5px 8px; }
.cv-restrictions { display:inline-flex; align-items:center; justify-content:center; margin-left:12px; border:0; background:transparent; color:var(--text); cursor:pointer; padding:3px; }
.cv-restrictions:hover { background:var(--cv-hover); }
body.cv-confluence .page-head { display:block; }
body.cv-confluence .page-title { font-size:30px; line-height:1.25; letter-spacing:-.4px; margin:0 0 6px; }
body.cv-confluence .page-meta { display:flex; align-items:center; gap:4px; flex-wrap:wrap; font-size:12px; margin-bottom:28px; }
.cv-author-avatar { width:25px; height:25px; font-size:10px; margin:0 2px; }
body.cv-confluence .wiki-content { font-size:15px; line-height:1.6; }
body.cv-confluence .wiki-content h2 { font-size:22px; font-weight:500; }
body.cv-confluence .cv-editor-document { border:0; }
body.cv-confluence .cv-title-row { padding:12px 0 20px; }
body.cv-confluence .cv-title-hint { display:none; }
body.cv-confluence .cv-editor-shell { max-width:none; }
body.cv-confluence .cv-editor-document .editor-area { padding:24px 16px 60px; border:1px solid var(--border); border-top:0; border-radius:0; font-size:15px; }
body.cv-confluence .cv-editor-document .toolbar { border:1px solid var(--border); border-radius:0; }
body.cv-focus .cv-sidebar-rail { display:none !important; }
body.cv-confluence .cv-inline-panel { float:right; width:300px; max-width:100%; margin:0 0 24px 28px; border-left:1px solid var(--border); padding:0 0 12px 18px; overflow-wrap:anywhere; }
.cv-inline-panel h2 { font-size:18px; margin:0 0 12px; }
.cv-inline-panel textarea { width:100%; }
.cv-inline-panel form { margin-bottom:20px; }
.cv-inline-panel blockquote,.cv-quote { margin:8px 0; padding:6px 10px; background:var(--cv-code); border:0; border-left:3px solid var(--border); font:inherit; font-size:13px; color:var(--text); text-align:left; white-space:pre-wrap; }
.cv-inline-comment { padding:12px 0; border-top:1px solid var(--border); }
.cv-inline-comment p { white-space:pre-wrap; font-size:14px; }
.cv-quote { display:block; width:100%; cursor:pointer; }
::highlight(cv-inline) { background:#ffe08a; color:#172b4d; }
.cv-personal-list a { display:block; margin-top:14px; }
body.cv-confluence .section { clear:both; }
@media(max-width:1100px) {
  body.cv-confluence .topbar { padding:0 12px; gap:8px; }
  body.cv-confluence .topbar .searchbox input { width:170px; }
  body.cv-confluence .topnav a { padding:4px; }
  body.cv-confluence .main { padding:18px 24px 48px; }
}
@media(max-width:760px) {
  body.cv-confluence .topbar .brand { font-size:14px; }
  body.cv-confluence .topbar .searchbox { display:block; min-width:40px; }
  body.cv-confluence .topbar .searchbox input { width:100%; min-width:40px; }
  body.cv-confluence .topbar .cv-global-icon { display:none; }
  body.cv-confluence .main { padding:16px 16px 44px; }
  body.cv-confluence .page-title { font-size:26px; }
  body.cv-confluence .page-actions { gap:2px; }
  body.cv-confluence .page-actions>.btn { font-size:12px; padding:3px; }
  body.cv-confluence .cv-inline-panel { float:none; width:auto; margin:0 0 20px; }
}
@media print {
  .cv-sidebar-rail,.cv-page-toolbar,.cv-inline-panel { display:none !important; }
  body.cv-confluence .main { padding:0; }
  body.cv-confluence .wiki-content { color:#000; background:#fff; }
}

/* Editor sections v2. Persistent percentages are hydrated from validated metadata. */
body.cv-confluence .cv-sidebar-rail { width:12px; flex:0 0 12px; }
body.cv-confluence .cv-sidebar-resize { inset:0; width:12px; background:transparent; z-index:1; }
body.cv-confluence .cv-sidebar-resize::before { content:''; position:absolute; top:0; bottom:0; left:5px; width:2px; background:var(--border); }
body.cv-confluence .cv-sidebar-resize:hover::before,body.cv-confluence .cv-sidebar-resize:focus-visible::before { background:var(--primary); width:3px; }
body.cv-confluence .cv-sidebar-toggle { left:-4px; z-index:2; }
body.cv-confluence.cv-sidebar-collapsed .cv-sidebar-rail { width:20px; flex-basis:20px; }
body.cv-confluence.cv-sidebar-collapsed .cv-sidebar-toggle { left:0; }
body.cv-resizing *,body.cv-column-resizing * { cursor:col-resize !important; user-select:none !important; }
body.cv-resizing iframe,body.cv-column-resizing iframe { pointer-events:none; }
body.cv-confluence .cv-editor-v2 { max-width:none; }
body.cv-confluence .cv-editor-v2 .cv-editor-document { border:0; box-shadow:none; background:var(--surface); }
body.cv-confluence .cv-editor-v2 .toolbar { display:block; position:sticky; top:var(--cv-header-height); z-index:18; margin:-20px -36px 0; padding:0 18px; border:0; border-bottom:1px solid var(--border); border-radius:0; background:var(--surface); }
.cv-format-toolbar,.cv-layout-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:2px; min-height:42px; padding:4px 0; }
.cv-layout-toolbar { border-top:1px solid var(--border); min-height:40px; gap:4px; }
body.cv-confluence .cv-editor-v2 .toolbar button,body.cv-confluence .cv-editor-v2 .toolbar select { display:inline-flex; align-items:center; justify-content:center; gap:5px; font-size:13px; min-height:30px; border-radius:2px; padding:3px 6px; color:var(--text); }
body.cv-confluence .cv-editor-v2 .toolbar button:disabled,body.cv-confluence .cv-editor-v2 .toolbar select:disabled { opacity:.4; cursor:default; }
body.cv-confluence .cv-editor-v2 .toolbar .sep { width:1px; height:24px; align-self:center; flex-shrink:0; background:var(--border); margin:0 5px; }
body.cv-confluence .cv-editor-v2 .cv-insert-menu>summary { display:flex; align-items:center; justify-content:center; gap:5px; padding:0 7px; min-height:30px; min-width:42px; border:1px solid transparent; border-radius:2px; }
body.cv-confluence .cv-editor-v2 .cv-insert-menu>summary:hover { background:var(--cv-hover); }
.cv-insert-plus { font-size:24px; line-height:1; font-weight:400; }
body.cv-confluence .cv-editor-v2 .cv-insert-items { top:34px; min-width:210px; }
body.cv-confluence .cv-editor-v2 .cv-insert-items button { justify-content:flex-start; }
.cv-color-tool { display:inline-flex; align-items:center; justify-content:center; position:relative; width:30px; height:30px; color:var(--text); font-family:Georgia,serif; font-size:18px; cursor:pointer; border-bottom:3px solid var(--primary); }
.cv-color-tool:hover { background:var(--cv-hover); }
.cv-highlight-tool { border-color:#e2bd00; }
.cv-color-tool input[type=color] { position:absolute; inset:0; opacity:0; width:100%; height:100%; cursor:pointer; }
.cv-color-tool:focus-within { outline:2px solid var(--primary); outline-offset:1px; }
.cv-columns-label { display:inline-flex; align-items:center; gap:5px; font-size:13px; font-weight:400; color:var(--text); }
body.cv-confluence .toolbar .cv-columns-label select { width:46px; margin:0; }
#cvColumnPreset { max-width:215px; }
#cvSectionInfo { margin-left:8px; font-size:11px; white-space:normal; }
body.cv-confluence .cv-editor-v2 .toolbar .cv-focus-button { margin-left:auto; font-size:11px; }
body.cv-confluence .cv-editor-v2 .cv-editor-topline { display:block; padding-top:22px; margin:0 0 4px; }
body.cv-confluence .cv-editor-v2 .cv-title-row { padding:0 0 12px; }
body.cv-confluence .cv-editor-v2 .editor-title { font-size:30px !important; padding:3px 0 !important; }
body.cv-confluence .cv-editor-v2 .editor-area { border:0; box-shadow:none; padding:12px 0 64px; min-height:560px; line-height:1.6; font-size:15px; }
body.cv-confluence .cv-editor-v2 .editor-area:focus { box-shadow:none; }
.cv-layout-section { position:relative; display:grid; grid-template-columns:minmax(0,1fr); gap:18px; align-items:start; margin:18px 0; min-width:0; clear:both; }
.cv-layout-column { min-width:0; overflow-wrap:anywhere; }
.cv-layout-column>:first-child { margin-top:0; }
.cv-layout-column img { max-width:100%; height:auto; }
.cv-layout-column pre { max-width:100%; overflow:auto; }
#editor .cv-layout-section { padding:12px 0; margin:12px 0; border-top:1px dashed var(--border); border-bottom:1px dashed var(--border); }
#editor .cv-layout-column { min-height:80px; outline:1px dashed var(--border); outline-offset:5px; }
#editor .cv-layout-section[data-cv-layout-active] { border-color:var(--primary); }
#editor .cv-layout-section[data-cv-layout-active]>.cv-layout-column { outline-color:var(--primary); }
.cv-column-grip { position:absolute; top:0; bottom:0; width:12px; margin-left:-6px; cursor:col-resize; touch-action:none; z-index:3; border-radius:2px; }
.cv-column-grip::after { content:''; position:absolute; width:3px; top:30%; bottom:30%; min-height:24px; left:5px; background:var(--border); border-radius:2px; }
.cv-column-grip:hover,.cv-column-grip:focus-visible { background:var(--primary-soft); outline:1px solid var(--primary); }
.cv-column-grip:hover::after,.cv-column-grip:focus-visible::after { background:var(--primary); }
.cv-width-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(90px,1fr)); gap:12px; }
.cv-width-fields input { width:100%; }
#cvWidthsStatus { color:var(--danger); }
.cv-symbol-picker { display:grid; grid-template-columns:repeat(8,1fr); gap:6px; }
.cv-symbol-picker button { justify-content:center; font-size:20px; }
ul.cv-task-list { list-style:none; padding-left:0; }
li[data-cv-task] { position:relative; padding-left:26px; list-style:none; min-height:24px; }
li[data-cv-task]>input[data-cv-editor-ui=task] { position:absolute; left:2px; top:5px; margin:0; width:15px; height:15px; accent-color:var(--primary); }
li[data-cv-task=true] { text-decoration:line-through; }
li[data-cv-task]>input:disabled { opacity:1; }
@media(max-width:1100px) { body.cv-confluence .cv-editor-v2 .toolbar { margin-left:-24px; margin-right:-24px; padding:0 14px; } }
@media screen and (max-width:760px) {
 .cv-layout-section { grid-template-columns:minmax(0,1fr) !important; gap:20px; }
 #editor .cv-column-grip { display:none; }
 body.cv-confluence .cv-editor-v2 .toolbar { margin-left:-16px; margin-right:-16px; padding:0 8px; }
 .cv-layout-toolbar { row-gap:6px; }
 .cv-layout-column { min-width:0; }
}
@media print {
 .cv-column-grip,[data-cv-editor-ui=resize],#toolbar,.editor-footer { display:none !important; }
 #editor .cv-layout-section,#editor .cv-layout-column { border:0; outline:0; }
 .cv-layout-section { break-inside:auto; }
}

body.cv-confluence .sidebar .space-header>div:last-child { min-width:0; }
body.cv-confluence .sidebar .space-header .name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Tables v3 and the document footer; layout sections/sidebar are left unchanged. */
.cv-page-footer { display:flex; align-items:center; justify-content:space-between; gap:20px; margin:30px 0 14px; border-top:1px solid var(--border); padding-top:14px; }
.cv-footer-labels { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:8px; min-width:0; margin-left:auto; }
.cv-footer-labels #labels { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:5px; }
.cv-footer-label-title { color:var(--muted); font-size:12px; }
.cv-footer-labels .label-chip { margin:0; }
.cv-footer-likes { margin-right:auto; min-width:0; }
.cv-footer-likes:empty { display:none; }
.cv-footer-likes .likes-bar { justify-content:flex-start; flex-wrap:wrap; }
.cv-footer-likes .likes-bar>.muted { font-size:11px; text-align:left; }
.likes-total { margin-left:4px; font-variant-numeric:tabular-nums; }
.cv-page-footer-rule { border:0; border-top:1px solid var(--border); margin:0 0 22px; }
.cv-table-toolbar[hidden] { display:none !important; }
.cv-table-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:2px; border-top:1px solid var(--border); padding:4px 0; }
.cv-table-toolbar svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
body.cv-confluence .cv-table-toolbar button { width:29px; padding:3px !important; }
#cvTableStatus { margin-left:8px; font-size:11px; }
#editor { position:relative; }
#editor td[data-cv-table-selected],#editor th[data-cv-table-selected] { outline:2px solid var(--primary); outline-offset:-2px; }
.cv-table-picker-host { position:relative; display:inline-flex; }
.cv-table-picker { position:absolute; top:35px; left:0; width:244px; background:var(--surface); border:1px solid var(--border); border-radius:3px; padding:8px; box-shadow:var(--cv-shadow); z-index:40; }
.cv-table-picker-grid>div { display:flex; }
body.cv-confluence .cv-editor-v2 .cv-table-picker-grid button { flex:0 0 21px; width:21px; height:21px; min-height:21px; padding:0; margin:0; border:1px solid #87a4cc; border-radius:0; background:#fff; }
body.cv-confluence .cv-editor-v2 .cv-table-picker-grid button.selected { background:#cce0fc; }
body.cv-confluence .cv-editor-v2 .cv-table-picker-grid button:focus-visible { position:relative; outline:2px solid var(--primary); outline-offset:-2px; }
.cv-table-picker-size { text-align:center; font-size:13px; margin:6px 0; }
body.cv-confluence .cv-editor-v2 .cv-table-custom { width:100%; justify-content:center; }
.cv-table-resizers { position:absolute; pointer-events:none; z-index:6; }
.cv-table-column-grip { position:absolute; top:0; bottom:0; width:8px; margin-left:-4px; cursor:col-resize; touch-action:none; pointer-events:auto; }
.cv-table-column-grip:hover,.cv-table-column-grip:focus-visible { background:var(--primary-soft); outline:1px solid var(--primary); }
.wiki-content table.cv-table-responsive { width:100%; max-width:100%; table-layout:auto; }
.wiki-content table.cv-table-fixed,.wiki-content table[data-cv-table-widths] { width:100%; max-width:100%; table-layout:fixed; }
.wiki-content table.cv-table-fixed td,.wiki-content table.cv-table-fixed th,.wiki-content table[data-cv-table-widths] td,.wiki-content table[data-cv-table-widths] th { overflow-wrap:anywhere; }
.wiki-content td[data-cv-valign=top],.wiki-content th[data-cv-valign=top] { vertical-align:top; }
.wiki-content td[data-cv-valign=middle],.wiki-content th[data-cv-valign=middle] { vertical-align:middle; }
.wiki-content td[data-cv-valign=bottom],.wiki-content th[data-cv-valign=bottom] { vertical-align:bottom; }
.cv-insert-items hr { margin:4px 0; border:0; border-top:1px solid var(--border); }
body.cv-confluence .cv-editor-v2 .cv-insert-items { width:250px; max-height:70vh; overflow:auto; }
.cv-menu-glyph { flex:0 0 20px; width:20px; text-align:center; font-size:15px; }
.cv-menu-note { display:block; padding:7px 10px; font-size:11px; color:var(--muted); }
.cv-attachment-list { display:grid; gap:7px; max-height:280px; overflow:auto; margin:14px 0; }
.cv-table-error { color:var(--danger); }
.cv-date { display:inline-block; border-radius:3px; background:var(--primary-soft); padding:0 5px; white-space:nowrap; font-size:.9em; }
.cv-image-gallery { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(180px,100%),1fr)); gap:16px; margin:16px 0; }
.cv-image-gallery figure { margin:0; }
.cv-image-gallery img { max-width:100%; height:auto; display:block; }
.cv-image-gallery figcaption { color:var(--muted); font-size:12px; margin-top:5px; }
@media(max-width:700px) { .cv-page-footer { align-items:flex-start; flex-wrap:wrap; gap:12px; } .cv-footer-likes { flex:1 1 auto; } .cv-table-picker { left:auto; right:0; } }
@media print { .cv-table-resizers,.cv-table-toolbar { display:none !important; } #editor td[data-cv-table-selected],#editor th[data-cv-table-selected] { outline:0; } }

/* Profile / label chips / document minimum height / vertical column alignment. */
#content.wiki-content { min-height:420px; }
.cv-label-trigger { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; padding:4px; border:0; border-radius:3px; color:var(--muted); background:transparent; cursor:pointer; }
.cv-label-trigger svg { width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linejoin:round; }
.cv-label-trigger:hover { color:var(--primary); background:var(--primary-soft); }
.cv-label-trigger:focus-visible { outline:2px solid var(--primary); outline-offset:2px; }
.cv-label-inputbox { border:1px solid var(--border); border-radius:4px; padding:8px; }
.cv-label-inputbox:focus-within { outline:2px solid var(--primary-soft); border-color:var(--primary); }
.cv-label-draft { display:flex; flex-wrap:wrap; gap:5px; }
.cv-label-inputbox input { width:100%; border:0; outline:none; padding:8px 0; }
.cv-label-inputbox input:focus { outline:none; }
.cv-label-error { color:var(--danger); font-size:13px; }
.cv-avatar-image { width:100%; height:100%; object-fit:cover; border-radius:inherit; }
.cv-avatar-fallback { display:inline-grid; place-items:center; width:100%; height:100%; }
.cv-avatar:has(.cv-avatar-image) { padding:0; overflow:hidden; }
.cv-profile-picture-row { display:flex; align-items:center; gap:20px; margin-bottom:16px; }
.cv-profile-avatar { display:inline-grid; place-items:center; width:96px; height:96px; flex:0 0 96px; border-radius:50%; overflow:hidden; background:var(--primary-soft); color:var(--primary); font-size:32px; }
.cv-profile-picture p { margin:6px 0; }
#cvAvatarStatus { margin-top:12px; }
.cv-layout-section { align-items:stretch; }
.cv-layout-column { display:flex; flex-direction:column; justify-content:flex-start; min-height:120px; }
.cv-layout-column[data-cv-valign=middle] { justify-content:center; }
.cv-layout-column[data-cv-valign=bottom] { justify-content:flex-end; }
.cv-layout-column[data-cv-valign=top] { justify-content:flex-start; }
.cv-valign-control { display:inline-flex; align-items:center; gap:2px; font-weight:400; padding-left:4px; }
body.cv-confluence .cv-editor-v2 .toolbar .cv-valign-control select { margin:0; width:83px; }
@media(max-width:700px) { #content.wiki-content { min-height:320px; } .cv-profile-picture-row { align-items:flex-start; flex-wrap:wrap; } }
@media print { #content.wiki-content { min-height:0; } .cv-label-trigger { display:none; } }

.cv-layout-column>img { align-self:flex-start; }

.cv-layout-column>:last-child { margin-bottom:0; }

/* Native formatting core v1. Never accepts arbitrary user CSS. */
.cvf { --cvf-color:var(--cvf-accent,#0c66e4); border-radius:var(--cvf-radius,8px); margin:12px 0; min-width:0; color:var(--text,#172b4d); }
.cvf-accent {--cvf-color:var(--cvf-accent,#0c66e4)}
.cvf-neutral {--cvf-color:var(--cvf-neutral,#52647b)}
.cvf-warning {--cvf-color:var(--cvf-warning,#946000)}
.cvf-panel,.cvf-card,.cvf-hero {border:1px solid var(--border,#dfe1e6);border-top:4px solid var(--cvf-color);padding:18px;background:var(--surface,#fff)}
.cvf-card {box-shadow:var(--cvf-shadow,none)}
.cvf-hero {padding:36px;border-left:6px solid var(--cvf-color);border-top-width:1px}
.cvf-hero>.cvf-title {font-size:2rem}
.cvf .cvf-title {margin:0 0 12px;color:var(--text,#172b4d)}
.cvf-cards {display:grid;grid-template-columns:repeat(var(--cvf-columns,3),minmax(0,1fr));gap:var(--cvf-gap,16px)}
.cvf-cards>.cvf-card {margin:0}
.cvf-cards>p:empty {display:none}
.cvf-button {display:inline-block;background:var(--surface,#fff);color:var(--cvf-color)!important;border:2px solid var(--cvf-color);padding:9px 18px;border-radius:var(--cvf-radius,8px);text-decoration:none!important;font-weight:600}
.cvf-button:hover {text-decoration:underline!important}
.cvf-card-link {display:inline-block;margin-top:10px;color:var(--cvf-color)!important}
.cvf-section {margin:8px 0;border:1px solid var(--border,#dfe1e6);border-radius:var(--cvf-radius,8px);background:var(--surface,#fff)}
.cvf-section>summary {padding:12px;cursor:pointer;font-weight:600;border-left:3px solid var(--cvf-color)}
.cvf-section-body {padding:16px;min-width:0}
.cvf-tab-list {display:flex;gap:4px;overflow:auto;border-bottom:2px solid var(--border,#dfe1e6)}
.cvf-tab-list button {background:var(--surface,#fff);color:var(--text,#172b4d);border:0;border-bottom:3px solid transparent;padding:12px 16px;cursor:pointer;font:inherit;white-space:nowrap}
.cvf-tab-list button[aria-selected=true] {border-color:var(--cvf-color);font-weight:700}
.cvf-tabs-enhanced>.cvf-section>summary {display:none}
.cvf-tabs-enhanced>.cvf-section:not([open]) {display:none}
.cvf-tabs-enhanced.cvf-vertical {display:grid;grid-template-columns:minmax(100px,180px) minmax(0,1fr);gap:var(--cvf-gap,16px)}
.cvf-vertical>.cvf-tab-list {flex-direction:column;border-bottom:0}
.cvf-vertical>.cvf-tab-list button {text-align:left;white-space:normal}
.cvf-progress {height:16px;background:var(--border,#dfe1e6);overflow:hidden;border-radius:var(--cvf-radius,8px)}
.cvf-progress>span {display:block;height:100%;background:var(--cvf-color)}
.cvf-divider>hr {border:0;border-top:2px solid var(--cvf-color)}
.cvf-picker {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.cvf-preview {padding:16px;max-height:360px;overflow:auto;border:1px solid var(--border);background:var(--surface);border-radius:8px}
.cvf :focus-visible {outline:3px solid var(--cvf-color);outline-offset:3px}
.editor-area [data-macro^="format-"] {border:1px dashed var(--cvf-color);padding:14px;background:var(--surface);white-space:normal}
.editor-area [data-macro^="format-"]::before {display:none!important;content:none!important}
.editor-area .cvf-editor-head {display:flex;align-items:center;flex-wrap:wrap;gap:6px;font:12px var(--font,sans-serif);padding:6px;background:var(--bg);border-bottom:1px solid var(--border);margin-bottom:12px;color:var(--text)}
.editor-area .cvf-editor-head>span {flex:1;font-weight:600}
.editor-area .cvf-editor-head button {font:inherit;padding:3px 7px;border:1px solid var(--border);border-radius:4px;background:var(--surface);color:var(--text);cursor:pointer}
.editor-area .cvf-cards>.cvf-editor-head {grid-column:1/-1}
.editor-area .cvf-cols-1 {--cvf-columns:1}.editor-area .cvf-cols-2 {--cvf-columns:2}.editor-area .cvf-cols-3 {--cvf-columns:3}.editor-area .cvf-cols-4 {--cvf-columns:4}
.editor-area .cvf-tabs>details,.editor-area .cvf-accordion>details {border:1px solid var(--border);padding:10px;margin:8px 0}
@media(max-width:700px){.cvf-cards{grid-template-columns:1fr}.cvf-tabs-enhanced.cvf-vertical{display:block}.cvf-vertical>.cvf-tab-list{flex-direction:row}.cvf-picker{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media print{.cvf-tabs-enhanced>.cvf-section{display:block!important}.cvf-tabs-enhanced>.cvf-section>summary{display:block}.cvf-section:not([open])>div{display:block!important}.cvf-tab-list{display:none}.cvf-tabs-enhanced.cvf-vertical{display:block}}

/* Formatting v2: editor and reader use the same validated design tokens. */
.cvf {color:var(--cvf-text,var(--text,#172b4d));text-align:var(--cvf-align,left);max-width:var(--cvf-max-width,none);position:relative}
.cvf-panel,.cvf-card,.cvf-hero {display:flow-root;padding:var(--cvf-padding,18px);background:var(--cvf-bg,var(--surface,#fff));border:var(--cvf-border-width,1px) solid var(--cvf-border,var(--border,#dfe1e6));border-top:4px solid var(--cvf-color);box-shadow:var(--cvf-shadow,none)}
.cvf-hero {padding:calc(var(--cvf-padding,18px) * 2);border-left:6px solid var(--cvf-color);min-height:120px}.cvf .cvf-title {color:var(--cvf-text,var(--text,#172b4d))}
.cvf-button {background:var(--cvf-bg,var(--surface,#fff));border-radius:var(--cvf-radius,8px)}.cvf-variant-filled .cvf-button {background:var(--cvf-color);color:var(--cvf-button-text,#fff)!important}.cvf-variant-subtle .cvf-button {border-color:transparent;background:var(--cvf-bg,var(--surface,#fff));box-shadow:inset 0 0 0 1px var(--cvf-color)}
.cvf-size-small .cvf-button {font-size:.85rem;padding:5px 10px}.cvf-size-large .cvf-button {font-size:1.15rem;padding:14px 24px}.cvf-width-full {width:100%;box-sizing:border-box}.cvf-width-full .cvf-button {display:block;text-align:center}
.cvf-image {display:block;width:100%;height:var(--cvf-image-height,180px);object-fit:var(--cvf-image-fit,cover);object-position:var(--cvf-image-position,center);border-radius:var(--cvf-radius,8px);margin-bottom:16px}
.cvf-media-left>.cvf-image,.cvf-media-left>.cvf-image-editor {float:left;width:35%;margin:0 18px 12px 0}.cvf-media-right>.cvf-image,.cvf-media-right>.cvf-image-editor {float:right;width:35%;margin:0 0 12px 18px}.cvf-image-editor>.cvf-image {width:100%}
.cvf-media-background>.cvf-image,.cvf-media-background>.cvf-image-editor {position:absolute;inset:0;width:100%;height:100%;margin:0;z-index:0;overflow:hidden;border-radius:inherit}.cvf-media-background>.cvf-image-editor>.cvf-image {height:100%;border-radius:inherit}.cvf-media-background>:not(.cvf-image):not(.cvf-image-editor) {position:relative;z-index:1}
.cvf-section {background:var(--cvf-bg,var(--surface,#fff));color:var(--cvf-text,var(--text));border-color:var(--cvf-border,var(--border))}.cvf-section-body {padding:var(--cvf-padding,16px)}.cvf-tab-list button {color:var(--cvf-text,var(--text));background:var(--cvf-bg,var(--surface))}
.cvf-fields {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.cvf-dialog details {padding:10px;border:1px solid var(--border);border-radius:6px}.cvf-dialog summary {cursor:pointer;font-weight:600;margin-bottom:10px}.cvf-dialog fieldset {border:1px solid var(--border);padding:12px;margin-top:12px}.cvf-dialog fieldset:disabled {opacity:.55}
.cvf-section-manager {display:grid;gap:10px}.cvf-section-row {display:flex;align-items:center;gap:5px}.cvf-section-row input {flex:1;min-width:100px}.cvf-image-picker {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;max-height:240px;overflow:auto}.cvf-image-picker button {white-space:normal;overflow-wrap:anywhere}.cvf-image-picker img {width:100%;height:70px;object-fit:cover;display:block}
.cvf-template-list {display:grid;gap:12px;margin-top:16px}.cvf-template-editor {min-height:320px;border:1px solid var(--border);padding:18px;background:var(--surface)}
.editor-area [data-macro^="format-"] {border:var(--cvf-border-width,1px) solid var(--cvf-border,var(--border));border-top:4px solid var(--cvf-color);padding:var(--cvf-padding,18px);background:var(--cvf-bg,var(--surface));color:var(--cvf-text,var(--text));white-space:normal}
.editor-area .cvf-hero {padding:calc(var(--cvf-padding,18px) * 2)}.editor-area .cvf-editor-head {display:flex;clear:both;font-size:11px;opacity:.8;margin:0 0 12px;padding:4px;position:relative;z-index:2}.editor-area [data-macro]:focus-within>.cvf-editor-head,.editor-area [data-macro]:hover>.cvf-editor-head {opacity:1}.editor-area .cvf-cards>[data-cv-editor-ui] {grid-column:1/-1}
.editor-area .cvf-tabs>details[hidden] {display:none!important}.editor-area .cvf-tabs>details {padding:var(--cvf-padding,16px);border:1px solid var(--cvf-border,var(--border));background:var(--cvf-bg,var(--surface))}.editor-area .cvf-tabs>details>summary[hidden] {display:none}
.editor-area .cvf-editor-vertical {display:grid;grid-template-columns:minmax(100px,180px) minmax(0,1fr);gap:var(--cvf-gap,16px)}.editor-area .cvf-editor-vertical>.cvf-editor-head {grid-column:1/-1}.editor-area .cvf-editor-vertical>.cvf-tab-list {flex-direction:column;border-bottom:0;align-self:start}.editor-area .cvf-editor-vertical>.cvf-tab-list button {text-align:left;white-space:normal}
.editor-area .cvf-template {border-style:dashed;cursor:default}.editor-area .cvf-linked-preview {padding:8px}
@media(max-width:700px){.cvf-fields{grid-template-columns:1fr}.cvf-section-row{flex-wrap:wrap}.editor-area .cvf-editor-vertical{display:block}.editor-area .cvf-editor-vertical>.cvf-tab-list{flex-direction:row}.cvf-media-left>.cvf-image,.cvf-media-right>.cvf-image,.cvf-media-left>.cvf-image-editor,.cvf-media-right>.cvf-image-editor{float:none;width:100%;margin:0 0 12px}}

/* Content assets v1 */
.cm-wrap {overflow-wrap:anywhere;word-break:break-word}.cm-meta-field {margin:12px 0;padding:12px;border:1px solid var(--border);border-radius:6px}.cm-page-link {text-decoration:underline;text-underline-offset:2px}#attachments td .btn {margin:4px}#modalBox fieldset[data-field] {margin:12px 0;padding:12px;border:1px solid var(--border)}

/* Revision Archive v1 */
.cmh-compare{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.cmh-preview{display:block;max-width:100%;max-height:420px;object-fit:contain;border:1px solid var(--border)}.cmh-wrap{overflow-wrap:anywhere}.cmh-json{white-space:pre-wrap;overflow-wrap:anywhere;max-height:440px;overflow:auto;font-size:12px}.cmh-warning{border-left:4px solid #946000;padding:10px;background:var(--surface)}@media(max-width:700px){.cmh-compare{grid-template-columns:1fr}}
