:root {
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:#24342d;
  background:#fafbf8;
  font-size:14px;
  --sidebar-width:260px;
  --green:#275c46;
  --line:#e0e6dd;
  --muted:#6d7b71;
}
* {
  box-sizing:border-box;
}
body {
  margin:0;
}
a {
  color:var(--green);
  text-decoration:none;
}
a:hover {
  text-decoration:underline;
}
button,input,select,textarea {
  font:inherit;
}
button,.upload-button {
  cursor:pointer;
  border:1px solid var(--line);
  background:white;
  color:#334b3d;
  border-radius:6px;
  padding:9px 13px;
  font-weight:550;
}
button:hover,.upload-button:hover {
  background:#edf2ea;
}
button:disabled {
  opacity:.45;
  cursor:default;
}
.primary {
  background:var(--green);
  border-color:var(--green);
  color:white;
}
.primary:hover {
  background:#194832;
}
input,select {
  border:1px solid #cfd8ce;
  border-radius:5px;
  padding:9px 10px;
  background:white;
  min-width:0;
}
input:focus,select:focus,textarea:focus {
  outline:2px solid #84ae91;
  outline-offset:1px;
}
label {
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:12px;
  font-weight:600;
  color:#647166;
}
h1,h2,h3 {
  letter-spacing:-.025em;
  line-height:1.2;
}
h1 {
  font-size:34px;
  font-weight:600;
  margin:14px 0 22px;
}
h2 {
  font-size:20px;
  font-weight:600;
  margin-top:25px;
}
p,li {
  line-height:1.75;
}
.sidebar {
  width:var(--sidebar-width);
  position:fixed;
  inset:0 auto 0 0;
  background:#f1f4ed;
  border-right:1px solid var(--line);
  display:flex;
  flex-direction:column;
  padding:28px 20px;
}
.brand {
  display:flex;
  gap:12px;
  align-items:center;
  color:#233d2d;
  font-size:23px;
  letter-spacing:.1em;
  font-weight:700;
}
.brand:hover {
  text-decoration:none;
}
.brand small {
  display:block;
  font-size:8px;
  letter-spacing:.09em;
  margin-top:4px;
}
.brand-mark {
  background:#2d5942;
  color:white;
  font-size:25px;
  width:40px;
  height:43px;
  display:grid;
  place-items:center;
  border-radius:9px;
}
.workspace-label {
  font-size:10px;
  font-weight:700;
  letter-spacing:.12em;
  color:#7b877b;
  margin-top:49px;
  display:flex;
  justify-content:space-between;
}
.workspace-label span {
  background:#e1e8da;
  padding:3px 6px;
  border-radius:4px;
  font-size:8px;
}
.tabs {
  display:flex;
  background:#e5eadf;
  padding:3px;
  border-radius:7px;
  margin:14px 0 20px;
}
.tabs button {
  flex:1;
  background:none;
  border:0;
  font-size:12px;
  padding:8px;
}
.tabs button.selected {
  background:#fff;
  box-shadow:0 1px 4px #0000000a;
}
#explorer {
  overflow:auto;
  flex:1;
  font-size:12px;
}
#explorer ul {
  list-style:none;
  padding-left:12px;
}
#explorer>ul {
  padding:0;
}
#explorer li {
  margin:5px 0;
}
#explorer a {
  display:inline-block;
  padding:6px 4px;
  color:#415344;
}
summary {
  cursor:pointer;
  line-height:1.8;
}
.sidebar-bottom {
  border-top:1px solid #dce3d5;
  padding-top:20px;
  font-size:12px;
}
.sidebar-bottom p {
  color:#85907f;
  font-size:11px;
  margin-top:25px;
}
.workspace {
  margin-left:var(--sidebar-width);
  min-height:100vh;
  display:flex;
  flex-direction:column;
}
.topbar {
  height:78px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--line);
  padding:0 42px;
  background:#fff;
}
#search-form {
  display:flex;
  gap:8px;
  width:min(580px,70%);
}
#search-form input {
  flex:1;
  border:0;
  background:#f6f8f4;
  font-size:12px;
}
.connection {
  font-size:11px;
  color:var(--muted);
  white-space:nowrap;
}
.connection i {
  display:inline-block;
  width:6px;
  height:6px;
  background:#6c9673;
  border-radius:50%;
  margin-right:7px;
}
.toolbar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:26px 42px;
  font-size:11px;
  color:var(--muted);
}
.toolbar div {
  display:flex;
  gap:7px;
}
.toolbar button {
  font-size:11px;
}
main {
  padding:12px 52px 60px;
  max-width:1360px;
  width:100%;
  margin:0 auto;
  flex:1;
}
article>header {
  border-bottom:1px solid var(--line);
  padding-bottom:22px;
  margin-bottom:28px;
}
.context-bar {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.badge {
  display:inline-block;
  font-size:10px;
  font-weight:650;
  letter-spacing:.03em;
  background:#eaf0e5;
  color:#426244;
  padding:4px 8px;
  border-radius:4px;
  line-height:1.5;
}
.QUALITY_ALERT .badge,.badge.QUALITY_ALERT {
  background:#fae8e1;
  color:#a7452d;
}
.SOP .badge,.badge.SOP {
  background:#e5eef7;
  color:#3e6592;
}
.TOOLING .badge,.badge.TOOLING {
  background:#f8eccc;
  color:#80681d;
}
.markdown {
  font-size:14px;
  line-height:1.8;
  overflow-wrap:anywhere;
}
.markdown h1 {
  font-size:28px;
}
.markdown h2 {
  margin-top:30px;
  font-size:22px;
}
.markdown table {
  border-collapse:collapse;
  width:100%;
}
.markdown td,.markdown th {
  border:1px solid var(--line);
  padding:8px 12px;
}
.markdown img,.wiki-video {
  max-width:100%;
  max-height:650px;
  border-radius:8px;
}
.markdown pre {
  overflow:auto;
  background:#edf1ea;
  padding:20px;
  border-radius:6px;
}
.markdown code {
  font-size:12px;
}
.markdown blockquote {
  margin-left:0;
  border-left:3px solid #809e7a;
  padding-left:20px;
  color:var(--muted);
}
.markdown .badge {
  font-size:11px;
}
.backlinks {
  border-top:1px solid var(--line);
  margin-top:44px;
  padding-top:10px;
}
.backlinks h2 {
  font-size:12px;
  color:var(--muted);
}
.backlinks ul {
  padding-left:18px;
  font-size:12px;
}
footer {
  border-top:1px solid var(--line);
  padding:22px 42px;
  font-size:9px;
  letter-spacing:.1em;
  color:#82907f;
  display:flex;
  justify-content:space-between;
}
.eyebrow {
  font-size:10px;
  letter-spacing:.12em;
  color:var(--muted);
  font-weight:650;
}
.structure-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:32px;
  border-bottom:1px solid var(--line);
  padding-bottom:25px;
}
.structure-grid h2 {
  font-size:16px;
}
.bom-tree,.bom-tree ul {
  list-style:none;
  padding-left:16px;
}
.bom-tree {
  padding-left:0;
}
.bom-tree li {
  font-size:12px;
  margin:10px 0;
}
.knowledge-card {
  background:white;
  border:1px solid var(--line);
  border-left:3px solid #8b9e83;
  border-radius:7px;
  margin:18px 0;
  padding:24px;
}
.knowledge-card.QUALITY_ALERT {
  border-left-color:#b85c43;
}
.knowledge-card.SOP {
  border-left-color:#7197bd;
}
.knowledge-card.TOOLING {
  border-left-color:#bda355;
}
.knowledge-card h2 {
  font-size:18px;
  margin:12px 0;
}
.knowledge-card .markdown h2 {
  font-size:16px;
}
#notice,#search-results {
  margin:0 42px 15px;
  padding:14px 18px;
  background:#e8efe1;
  border:1px solid var(--line);
  border-radius:6px;
}
#search-results.searching { color:var(--muted); }
#search-results .search-count {
  padding:2px 8px 8px;
  color:var(--muted);
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.05em;
}
#search-results .search-empty { margin:4px 8px; color:var(--muted); }
#notice.error,#conflict-banner {
  background:#fff0ea;
  color:#9b3f27;
}
#search-results .search-result {
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
}
#search-results .search-result:last-of-type { border-bottom: 0; }
#search-results a {
  display:block;
  padding:4px 0;
}
#search-results .search-snippet {
  margin:2px 0 7px;
  color:#59665f;
  font-size:13px;
  line-height:1.45;
}
dialog {
  border:1px solid var(--line);
  border-radius:12px;
  box-shadow:0 24px 100px #1e342d30;
  padding:26px;
  max-width:95vw;
  color:#24342d;
}
dialog::backdrop {
  background:#12251dd0;
  backdrop-filter:blur(2px);
}
#editor-dialog {
  width:1280px;
  max-height:94vh;
}
.dialog-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:20px;
}
.dialog-heading h2 {
  margin:5px 0;
}
.metadata-grid {
  display:grid;
  grid-template-columns:2fr 1fr 1.5fr 1fr 1fr 1fr;
  gap:10px;
  margin-bottom:20px;
}
.editor-split {
  display:grid;
  grid-template-columns:1fr 1fr;
  border:1px solid var(--line);
  border-radius:6px;
  overflow:hidden;
}
.editor-split section {
  min-width:0;
}
.editor-split section+section {
  border-left:1px solid var(--line);
}
.pane-heading {
  font-size:9px;
  letter-spacing:.1em;
  color:var(--muted);
  padding:12px;
  background:#f1f4ed;
  display:flex;
  justify-content:space-between;
}
.pane-heading span {
  letter-spacing:0;
  font-size:10px;
}
#editor {
  width:100%;
  height:42vh;
  resize:vertical;
  border:0;
  background:#fbfcf9;
  padding:20px;
  font:12px/1.75 ui-monospace,monospace;
}
#preview {
  padding:20px;
  height:42vh;
  overflow:auto;
}
#preview h1 {
  font-size:24px;
}
.editor-actions {
  display:flex;
  gap:14px;
  align-items:end;
  margin-top:20px;
}
.editor-actions label {
  flex:1;
}
.editor-actions .upload-button {
  flex:0 0 auto;
  padding:10px 14px;
}
.upload-button input {
  display:none;
}
#editor-status {
  font-size:12px;
  margin-top:10px;
  min-height:18px;
}
#conflict-banner {
  padding:12px;
  border:1px solid #efc4af;
  border-radius:5px;
  margin-bottom:16px;
}
#new-dialog {
  width:440px;
}
.dialog-buttons {
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:25px;
}
#history-dialog {
  width:680px;
}
#history-list section {
  padding:15px 0;
  border-top:1px solid var(--line);
}
#history-list code {
  font-size:10px;
}
#shopfloor-form {
  display:flex;
  gap:12px;
  align-items:end;
  flex-wrap:wrap;
}
[hidden] {
  display:none!important;
}
@media(max-width:1000px) {
  :root { --sidebar-width:210px; }
  .sidebar {
    width:var(--sidebar-width);
    padding:22px 14px;
  }
  .workspace {
    margin-left:var(--sidebar-width);
  }
  .topbar,.toolbar {
    padding-left:25px;
    padding-right:25px;
  }
  main {
    padding-left:25px;
    padding-right:25px;
  }
  .metadata-grid {
    grid-template-columns:1fr 1fr 1fr;
  }
  .connection {
    display:none;
  }
  #search-form {
    width:100%;
  }
  .structure-grid {
    grid-template-columns:1fr;
  }
}
@media(max-width:650px) {
  :root { --sidebar-width:0px; }
  .sidebar {
    position:static;
    width:auto;
    max-height:300px;
  }
  .brand {
    font-size:19px;
  }
  .workspace-label,.sidebar-bottom {
    display:none;
  }
  .tabs {
    margin:15px 0 0;
  }
  #explorer {
    max-height:140px;
  }
  .workspace {
    margin-left:0;
  }
  #sidebar-resizer { display:none; }
  .toolbar {
    padding:16px;
    gap:8px;
  }
  #breadcrumb {
    display:none;
  }
  main {
    padding:15px;
  }
  .editor-split {
    grid-template-columns:1fr;
  }
  .editor-split section+section {
    display:none;
  }
  .metadata-grid {
    grid-template-columns:1fr 1fr;
  }
  .editor-actions {
    flex-wrap:wrap;
  }
  .editor-actions label {
    flex-basis:40%;
  }
  dialog {
    padding:16px;
  }
  .topbar {
    height:60px;
  }
  footer {
    padding:20px;
  }
  footer span {
    display:none;
  }
}
/* The visual editor is a Markdown document view; its own DOM is not persisted. */
.editor-mode-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.editor-mode-bar > div { display: flex; gap: 5px; }
.editor-mode-bar span { font-size: 11px; color: var(--muted); }
.editor-mode-bar button[aria-pressed="true"] { background: var(--green); color: white; border-color: var(--green); }
#visual-pane { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
#format-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; background: #f1f4ed; border-bottom: 1px solid var(--line); }
#format-toolbar button, #format-toolbar select { padding: 6px 8px; font-size: 11px; }
#format-toolbar button[aria-pressed="true"] { background: #d3e4cc; border-color: #7b9a73; }
#visual-editor { height: 42vh; min-height: 230px; overflow: auto; background: white; }
.ProseMirror { position: relative; min-height: 100%; padding: 20px 26px; overflow-wrap: break-word; white-space: pre-wrap; white-space: break-spaces; font-variant-ligatures: none; }
.ProseMirror:focus { outline: none; box-shadow: inset 0 0 0 2px #84ae91; }
.ProseMirror p:first-child, .ProseMirror h1:first-child { margin-top: 0; }
.ProseMirror li { position: relative; }
.ProseMirror-selectednode { outline: 2px solid #84ae91; }
.ProseMirror-hideselection *::selection { background: transparent; }
.ProseMirror-hideselection { caret-color: transparent; }
.ProseMirror img.ProseMirror-separator { display: inline !important; border: none !important; margin: 0 !important; }
.ProseMirror .wiki-link-token { color: var(--green); background: #edf3e8; padding: 1px 4px; border-radius: 3px; }
.ProseMirror .task-item { list-style: none; display: flex; gap: 8px; }
.ProseMirror .task-item > div { flex: 1; min-width: 0; }
.ProseMirror .task-box { cursor: pointer; user-select: none; }
.ProseMirror .task-item p { margin: 0; }
.ProseMirror table { table-layout: fixed; overflow: hidden; }
.ProseMirror td, .ProseMirror th { position: relative; min-width: 60px; vertical-align: top; }
.ProseMirror .selectedCell::after { content: ""; position: absolute; inset: 0; background: #84ae9133; pointer-events: none; }
.ProseMirror [data-align="left"] { text-align: left; }
.ProseMirror [data-align="center"] { text-align: center; }
.ProseMirror [data-align="right"] { text-align: right; }
#link-dialog { width: 420px; }
#link-dialog label { margin-top: 12px; }
.link-error { color: #9b3f27; font-size: 12px; }
@media (max-width: 650px) {
  .editor-mode-bar span { display: none; }
  #format-toolbar { gap: 3px; padding: 6px; }
  .ProseMirror { padding: 16px; }
}
/* Formula and diagram output stays separate from the stored Markdown. */
.math-display { display: block; overflow-x: auto; margin: 1em 0; }
.math-inline { white-space: nowrap; }
.render-error { color: #9b3f27; white-space: pre-wrap; overflow-wrap: anywhere; }
.mermaid-diagram { margin: 20px 0; overflow-x: auto; text-align: center; }
.mermaid-diagram svg { max-width: none; height: auto; }
.diagram-scratch { position: absolute; left: -100000px; top: 0; visibility: hidden; }
.ProseMirror .math-token { cursor: default; }
.wavedrom-diagram { margin: 20px 0; overflow-x: auto; background: white; padding: 12px; border-radius: 6px; }
.markdown .wavedrom-diagram img { max-width: none; max-height: none; border-radius: 0; display: block; }

.graphviz-diagram { margin: 20px 0; overflow-x: auto; background: white; padding: 12px; border-radius: 6px; }
.markdown .graphviz-diagram img { max-width: 100%; max-height: none; border-radius: 0; display: block; }

.gnuplot-diagram { margin: 20px 0; overflow-x: auto; background: white; padding: 12px; border-radius: 6px; }
.markdown .gnuplot-diagram img { max-width: 100%; max-height: none; border-radius: 0; display: block; }
.echarts-diagram { margin: 20px 0; overflow-x: auto; background: white; padding: 12px; border-radius: 6px; }
.markdown .echarts-diagram img { max-width: 100%; max-height: none; border-radius: 0; display: block; }
.tscircuit-diagram { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; margin: 20px 0; }
.tscircuit-view { min-width: 0; overflow: auto; background: #f5f1ed; border: 1px solid #ded8d2; border-radius: 8px; padding: 10px; }
.tscircuit-view figcaption { color: #45413d; font-size: 13px; font-weight: 650; margin: 0 0 8px; }
.markdown .tscircuit-view img { display: block; width: 100%; max-width: 100%; max-height: none; border-radius: 0; }

/* Align the workspace with the Confluence instance's blue and neutral look. */
:root {
  color: #172b4d;
  background: #fff;
  --green: #0052cc;
  --line: #dfe1e6;
  --muted: #626f86;
}
.sidebar { width: var(--sidebar-width); }
.workspace { margin-left: var(--sidebar-width); }
a { color: #0052cc; }
button,.upload-button { color: #172b4d; border-color: #dfe1e6; border-radius: 4px; }
button:hover,.upload-button:hover { background: #f4f5f7; }
.primary,.editor-mode-bar button[aria-pressed="true"] {
  color: #fff;
  background: #0747a6;
  border-color: #0747a6;
}
.primary:hover { background: #0052cc; }
.sidebar {
  background: #f4f5f7;
  border-right-color: #dfe1e6;
  padding-top: 22px;
}
.brand { color: #172b4d; letter-spacing: .04em; }
.brand-mark { background: #0747a6; border-radius: 5px; }
.workspace-label { color: #626f86; }
.workspace-label span { color: #42526e; background: #ebecf0; }
.tabs { background: #ebecf0; border-radius: 4px; }
.tabs button { color: #42526e; border-radius: 3px; }
.tabs button.selected { color: #0747a6; box-shadow: 0 1px 3px #091e4220; }
#explorer a { color: #344563; border-radius: 3px; }
#explorer a:hover, #explorer summary:hover { color: #0747a6; background: #ebecf0; text-decoration: none; }
#explorer li.tree-entry { position:relative; padding-right:30px; }
#explorer li.tree-entry > a { max-width:100%; overflow:hidden; text-overflow:ellipsis; vertical-align:middle; }
#explorer li.tree-entry > details { min-width:0; }
.tree-actions { position:absolute; z-index:4; right:0; top:0; }
.tree-actions-trigger { width:26px; height:28px; padding:0; border:0; background:transparent; color:#626f86; font-size:20px; line-height:1; opacity:0; }
.tree-entry:hover > .tree-actions .tree-actions-trigger,
.tree-entry:focus-within > .tree-actions .tree-actions-trigger { opacity:1; }
.tree-actions-trigger:focus-visible { opacity:1; outline:2px solid #4c9aff; }
.tree-actions-menu { position:absolute; top:25px; right:0; z-index:10; min-width:190px; padding:4px; background:#fff; border:1px solid #dfe1e6; border-radius:5px; box-shadow:0 4px 14px #091e4233; }
.tree-actions-menu[hidden] { display:none; }
.tree-actions-menu button { display:block; width:100%; text-align:left; padding:8px 10px; border:0; background:#fff; white-space:nowrap; }
.tree-actions-menu button:hover { color:#bf2600; background:#ffebe6; }
.delete-history-note { color:var(--muted); font-size:13px; }
#delete-error { padding:9px 11px; color:#bf2600; background:#ffebe6; border-radius:4px; }
.delete-fields { display:grid; gap:12px; margin:18px 0; }
.delete-fields label { display:grid; gap:5px; font-size:13px; }
.delete-fields input { min-width:0; padding:9px 10px; border:1px solid var(--line); border-radius:4px; }
button.danger { color:#fff; background:#bf2600; border-color:#bf2600; }
button.danger:disabled { opacity:.5; cursor:not-allowed; }
@media (hover:none) { .tree-actions-trigger { opacity:1; } }
.sidebar-bottom { border-top-color: #dfe1e6; }
.workspace { background: #fff; }
.topbar {
  height: 64px;
  background: #0747a6;
  border-bottom: 0;
  color: #fff;
}
#search-form input {
  color: #172b4d;
  background: #fff;
  border-radius: 4px;
}
#search-form button { color: #fff; background: #3572b0; border-color: #3572b0; }
#search-form button:hover { background: #0052cc; }
.connection { color: #deebff; }
.connection i { background: #57d9a3; }
.toolbar { padding-top: 20px; padding-bottom: 18px; }
main { max-width: none; padding: 8px clamp(24px, 3vw, 56px) 60px; }
article>header { border-bottom-color: #dfe1e6; padding-bottom: 20px; }
h1,h2,h3 { color: #172b4d; letter-spacing: -.015em; }
h1 { font-weight: 600; }
.markdown { color: #172b4d; line-height: 1.7; }
.markdown h2 { font-size: 20px; margin-top: 28px; }
.badge { color: #0747a6; background: #deebff; border-radius: 3px; }
.markdown pre { color: #172b4d; background: #f4f5f7; border: 1px solid #dfe1e6; }
.markdown blockquote { border-left-color: #0052cc; color: #42526e; }
.markdown th { background: #f4f5f7; color: #172b4d; text-align: left; }
.knowledge-card { border-color: #dfe1e6; border-left-color: #3572b0; border-radius: 4px; box-shadow: 0 1px 2px #091e4214; }
.backlinks { border-top-color: #dfe1e6; }
footer { border-top-color: #dfe1e6; color: #626f86; }
#notice,#search-results { background: #deebff; border-color: #b3d4ff; border-radius: 4px; }
.tscircuit-view,.wavedrom-diagram,.graphviz-diagram,.gnuplot-diagram,.echarts-diagram {
  background: #f4f5f7;
  border-color: #dfe1e6;
  border-radius: 4px;
}
#sidebar-resizer {
  position: absolute;
  z-index: 6;
  top: 0;
  right: -4px;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  touch-action: none;
}
#sidebar-resizer:hover,#sidebar-resizer:focus-visible,#sidebar-resizer.dragging {
  background: #0052cc55;
  outline: none;
}
body.sidebar-resizing { cursor: col-resize; user-select: none; }
@media(max-width:650px) {
  .sidebar { width:auto; }
  .workspace { margin-left:0; }
  #sidebar-resizer { display:none; }
  main { padding:15px; }
}

.cytoscape-diagram { margin:20px 0; padding:14px; border:1px solid #dfe1e6; border-radius:8px; background:#fff; min-width:0; }
.cytoscape-diagram figcaption { font-weight:650; font-size:16px; margin-bottom:10px; color:#172b4d; }
.cytoscape-toolbar { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:10px; }
.cytoscape-toolbar button { padding:5px 10px; font-size:12px; }
.cytoscape-canvas { width:100%; position:relative; background:#f8fafc; border:1px solid #e2e8f0; border-radius:5px; }
.cytoscape-info { font-size:12px; color:#475569; min-height:1.5em; }
.cytoscape-legend { display:flex; flex-wrap:wrap; gap:16px; padding-bottom:10px; font-size:12px; }
.cytoscape-legend span { border-left:4px solid; padding-left:7px; }
.cytoscape-diagram details { font-size:12px; }

.tabulator-diagram { margin:20px 0; min-width:0; padding:14px; border:1px solid #dfe1e6; border-radius:8px; background:#fff; }
.tabulator-diagram figcaption { font-size:16px; font-weight:650; color:#172b4d; margin-bottom:12px; }
.tabulator-toolbar { display:flex; flex-wrap:wrap; align-items:end; gap:12px; margin-bottom:12px; }
.tabulator-toolbar label { display:flex; flex-direction:column; gap:5px; font-size:12px; flex:1 1 200px; max-width:380px; }
.tabulator-toolbar input { width:100%; padding:7px 9px; box-sizing:border-box; }
.tabulator-toolbar button { padding:7px 10px; font-size:12px; }
.tabulator-grid.tabulator { font-size:13px; background:#fff; border-color:#dfe1e6; }
.tabulator-grid.tabulator .tabulator-header { background:#f1f5f9; color:#172b4d; }
.tabulator-status { color:#475569; font-size:12px; margin:10px 0 0; }

/* Declarative server-rendered wiki macros. */
.wiki-toc { border: 1px solid var(--border, #dfe1e6); border-radius: 6px; padding: 16px 20px; margin: 20px 0; background: var(--panel, #f7f8fa); overflow-wrap: anywhere; }
.wiki-toc-title { font-weight: 650; margin: 0 0 8px; }
.wiki-toc ul { margin: 6px 0; padding-left: 24px; }
.wiki-toc li { margin: 4px 0; }
.wiki-macro-error { border-left: 4px solid #c9372c; padding: 12px; margin: 16px 0; background: #fff1f0; overflow-wrap: anywhere; }
.markdown :is(h1,h2,h3,h4,h5,h6)[id] { scroll-margin-top: 90px; }
#macro-dialog { width: min(520px, 94vw); }
#macro-dialog label { display: block; margin-top: 12px; }
#macro-dialog input, #macro-dialog select, #macro-dialog textarea { display: block; width: 100%; margin-top: 4px; }
#macro-dialog [hidden] { display: none; }
#macro-dialog textarea { font-family: monospace; }

/* Accounts and role administration. */
.account-bar { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 12px; }
.account-bar span { overflow: hidden; text-overflow: ellipsis; max-width: 260px; white-space: nowrap; }
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #f4f5f7; padding: 24px; }
.login-card { flex: 0 1 460px; max-width: 460px; width: min(460px, 100%); padding: 32px; border: 1px solid #dfe1e6; border-radius: 12px; background: white; }
.login-card .brand { padding: 0; margin-bottom: 28px; }
.login-card h1 { font-size: 24px; }
.login-card label, #account-dialog label, #users-dialog label { display: block; margin: 12px 0; }
.login-card input, #account-dialog input, #users-dialog input, #users-dialog select { display: block; width: 100%; margin-top: 4px; }
.login-card button { width: 100%; margin-top: 12px; }
#login-error, #account-error { color: #ae2a19; overflow-wrap: anywhere; }
#account-dialog { width: min(620px, 94vw); }
#users-dialog { width: min(920px, 96vw); }
.account-actions { display: flex; gap: 12px; }
#token-list { padding-left: 20px; }
#token-list li { margin: 10px 0; display: flex; justify-content: space-between; gap: 12px; }
#created-token { white-space: pre-wrap; overflow-wrap: anywhere; background: #f1f8ff; padding: 16px; user-select: all; }
.users-layout { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(260px, 1fr); gap: 24px; }
#user-list { list-style: none; padding: 0; max-height: 520px; overflow-y: auto; }
#user-list button { width: 100%; text-align: left; margin-bottom: 8px; overflow-wrap: anywhere; }
#users-dialog .checkbox-label { display: flex; align-items: center; gap: 8px; }
#users-dialog input[type=checkbox] { width: auto; margin: 0; }
[hidden] { display: none !important; }
@media (max-width: 650px) { .users-layout { grid-template-columns: 1fr; } .account-bar span { max-width: 110px; } .login-card { padding: 24px; } }

/* Provider-based workspace navigation. */
#perspective-tabs { flex-wrap: wrap; }
.structure-label { background: none; border: 0; padding: 2px 0; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.structure-selected > a, .structure-selected > details > summary > a,
.structure-selected > .structure-label { color: var(--accent, #1769aa); font-weight: 600; }
.structure-status { font-size: 12px; color: #64748b; padding: 5px 0; }
.structure-node small { color: #a45a00; }
