/* The look of the UI (ADR-0031).

   The palette, type, spacing and the look of the top bar, cards, buttons,
   fields and tables are adapted from the console of pblumer/atlas
   (api/web/app.css, AGPL-3.0-only, the same license as this project; see
   THIRD_PARTY_NOTICES.md), so the two products look alike. atlas has a light
   theme only; the dark values in dark.css are this project's own, kept
   because the UI followed the system's dark mode before (ADR-0070). No font files: the system
   typeface keeps the page within its content-security policy (ADR-0014). */

:root {
  /* A calm, airy palette: a light grey page, white surfaces, soft
     borders and one accent (ADR-0065). */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e6e8ec;
  --border-strong: #d2d6dd;
  --text: #111827;
  --muted: #6b7280;
  --accent: #0b5cff;
  --accent-hover: #0a4ad1;
  --accent-soft: #edf2ff;
  --accent-ink: #ffffff; /* text on an accent fill */
  --danger: #c0392b;
  --danger-hover: #a5322a;
  --danger-soft: #fdecea;
  --success: #1a7f37;
  --success-soft: #e9f6ec;
  --warning: #9a6700;
  --warning-soft: #fff6e0;
  --row-hover: #f8f9fb;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --topbar-h: 56px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.10), 0 2px 6px rgba(16, 24, 40, 0.05);
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  color-scheme: light dark;
}


* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 14px/1.5 var(--font-sans);
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
b, strong { font-weight: 600; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; }
code, pre { font-family: var(--font-mono); font-size: 13px; }
code { word-break: break-all; }

.muted { color: var(--muted); }
.error { color: var(--danger); }
.notice {
  padding: 10px 12px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 6px 6px 0;
}

/* ---------- Top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  min-height: var(--topbar-h);
  display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; color: var(--text); }
.brand img { display: block; height: 24px; width: auto; } /* the logo (docs/brand) */
.brand:hover { text-decoration: none; }
#nav { display: flex; align-items: center; gap: 2px 4px; flex-wrap: wrap; flex: 1; }
#nav > a, #nav > button.link {
  display: inline-flex; align-items: center; min-height: var(--topbar-h);
  padding: 0 10px; color: var(--muted); font-weight: 500;
  border-bottom: 2px solid transparent;
}
#nav > a:hover, #nav > button.link:hover { color: var(--text); text-decoration: none; }
#nav .search { margin: 0 8px; flex: 0 1 18rem; }
#nav .search input { width: 100%; padding: 5px 10px; }

/* ---------- Module switcher (as in the atlas console) ---------- */
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; margin: 0 -6px 0 -8px; padding: 0;
  border: none; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--bg); color: var(--text); border-color: transparent; }
.icon-btn.grid { color: var(--text); }
#scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.25); z-index: 30; }
#drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 260px; z-index: 31;
  background: var(--surface); border-right: 1px solid var(--border);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.12); display: flex; flex-direction: column;
}
.drawer-head {
  display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-head .icon-btn { margin: 0 0 0 -8px; }
#drawer-apps { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
#drawer-apps a { display: flex; align-items: center; padding: 10px 12px; border-radius: 6px; color: var(--text); font-weight: 500; }
#drawer-apps a:hover { background: var(--bg); text-decoration: none; }
#drawer-apps a.active { background: var(--accent-soft); color: var(--accent); }

/* ---------- Content ---------- */
/* The whole width of the window: a page tree, the text and the side column
   need it side by side. */
main { padding: 22px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin: 0 0 18px;
}
.card:has(> table) { overflow-x: auto; }
.narrow { max-width: 24rem; margin: 3rem auto; }

/* ---------- Buttons ---------- */
button, .button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; margin: 2px 6px 2px 0;
  border: 1px solid var(--accent); border-radius: 6px;
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
button.link {
  background: none; border: none; padding: 0; margin: 0;
  color: var(--accent); font-weight: inherit;
}
button.link:hover { background: none; text-decoration: underline; }

/* ---------- Fields ---------- */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 6px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.65; font-style: italic; }
select { cursor: pointer; }
textarea { width: 100%; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.field > span { font-size: 12px; color: var(--muted); }
form.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input.title { font-size: 20px; font-weight: 600; flex: 1; min-width: 12rem; }

/* ---------- Tables ---------- */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--border); }
thead th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--bg); padding: 8px 12px; }
tbody tr:hover { background: var(--row-hover); }
table.props th { width: 12rem; font-weight: 500; color: var(--muted); }
table.history td { font-size: 13px; }

.list { padding-left: 1.2rem; }

/* ---------- Rich-text editor (ADR-0032) ---------- */
.pm-wrap { border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); }
.pm-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.pm-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 6px; border-bottom: 1px solid var(--border); background: var(--bg);
  border-radius: 6px 6px 0 0;
}
.pm-toolbar button {
  margin: 0; padding: 4px 10px; font-size: 12px; border-radius: 5px;
  background: var(--surface); color: var(--text); border-color: var(--border-strong);
}
.pm-toolbar button:hover { background: var(--bg); }
.pm-toolbar select, .pm-toolbar input { padding: 4px 8px; font-size: 12px; }
.pm-target { flex: 1; min-width: 10rem; }
.pm-editor .ProseMirror { min-height: 6rem; padding: 12px 16px; outline: none; white-space: pre-wrap; word-wrap: break-word; font-variant-ligatures: none; counter-reset: ordered; }
.pm-editor .ProseMirror > * { margin: 6px 0; }
.pm-editor .ProseMirror > :not(.pm-ordered) { counter-reset: ordered; }
.pm-bullet { padding-left: 1.4rem; position: relative; }
.pm-bullet::before { content: "•"; position: absolute; left: 0.4rem; }
.pm-ordered { padding-left: 1.8rem; position: relative; counter-increment: ordered; }
.pm-ordered::before { content: counter(ordered) "."; position: absolute; left: 0.2rem; }
.pm-editor blockquote { border-left: 3px solid var(--border-strong); padding-left: 12px; color: var(--muted); }
.pm-editor pre { background: var(--bg); padding: 8px 12px; border-radius: 6px; overflow-x: auto; }
.pm-unsupported { border: 1px dashed var(--danger); border-radius: 6px; }
.pm-embed { padding: 8px 12px; border: 1px dashed var(--border-strong); border-radius: 6px; background: var(--bg); }
.pm-embed.ProseMirror-selectednode { outline: 2px solid var(--accent); }
.pm-mention { background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 3px; }
.ProseMirror-hideselection *::selection { background: transparent; }

.footer { padding: 8px 22px 22px; font-size: 11px; color: var(--muted); }
.footer:empty { display: none; }

/* ---------- Board (ADR-0036) ---------- */
.board { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.board-column {
  flex: 0 0 260px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; min-height: 120px;
}
.board-column.drop { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.board-column h2 { display: flex; justify-content: space-between; margin-bottom: 10px; }
.board-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.card-item {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; cursor: grab;
}
.card-title { margin: 2px 0 4px; overflow-wrap: anywhere; }
.card-actions { font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
/* A kanban's board with the details of a card beside it, and its settings
   (ADR-0076). */
.kanban-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.kanban-layout:has(.kanban-detail:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }
.kanban-detail {
  position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px;
}
.kanban-detail-head { display: flex; justify-content: space-between; align-items: center; }
.kanban-detail-head button { font-size: 20px; line-height: 1; }
.kanban-detail h2 { margin: 4px 0 8px; overflow-wrap: anywhere; }
.kanban-detail .props { width: 100%; }
.kanban-detail .props input, .kanban-detail .props select, .kanban-detail .props textarea { width: 100%; }
.kanban-detail-body { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }
.card-item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.card-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.card-key { font-size: 11px; color: var(--muted); }
.card-facts { display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; margin: 4px 0; font-size: 12px; }
.card-facts dt { color: var(--muted); }
.card-facts dd { margin: 0; overflow-wrap: anywhere; }
.board-column.own-column { border-style: dashed; }
.kanban-settings { margin: 8px 0 14px; }
.kanban-settings summary { cursor: pointer; font-weight: 600; }
.kanban-columns-edit { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.kanban-columns-edit li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.kanban-columns-edit input { width: 14rem; }
@media (max-width: 900px) {
  .kanban-layout:has(.kanban-detail:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
  .kanban-detail { position: static; max-height: none; }
}

/* ---------- Governance (ADR-0040) ---------- */
input.days { width: 6rem; padding: 4px 8px; }

/* ---------- Link check (ADR-0039) ---------- */
td.href { overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 12px; }

/* ---------- Comments (ADR-0035) ---------- */
.comments { list-style: none; padding: 0; margin: 0 0 12px; }
.comment { padding: 10px 0; border-bottom: 1px solid var(--border); }
.comment-text { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form textarea { display: block; }
/* Inline comments (ADR-0047): the passage in the body and its thread. */
.comment-anchor { background: color-mix(in srgb, #f5b400 28%, transparent); border-bottom: 2px solid #f5b400; cursor: pointer; }
.comment-anchor.comment-focus, .thread.comment-focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.threads { list-style: none; padding: 0; margin: 0 0 12px; }
.thread { border-bottom: 1px solid var(--border); padding: 4px 0 8px; }
.thread .comment { border-bottom: 0; }
.replies { margin-left: 24px; border-left: 2px solid var(--border); padding-left: 12px; }
.comment-quote { margin: 8px 0 0; padding: 2px 10px; border-left: 3px solid #f5b400; color: var(--muted); overflow-wrap: anywhere; }
.comment-quote .link { text-align: left; color: inherit; }
.thread-tools { margin: 0; }
.resolved-threads summary { cursor: pointer; color: var(--muted); margin: 8px 0; }

/* ---------- Search (ADR-0033) ---------- */
.hits li { margin-bottom: 12px; }
.hits .snippet { margin: 4px 0 0; color: var(--muted); white-space: pre-wrap; }

/* ---------- Live editing (ADR-0010) ---------- */
.pm-locked { background: color-mix(in srgb, var(--muted) 12%, transparent); border-radius: 4px; }
.pm-holder { font-size: 12px; color: var(--muted); user-select: none; margin-top: 8px; }
.live-presence, .live-status { margin: 4px 0; font-size: 13px; }

/* The page tree (ADR-0041): a sidebar beside a space's views on wide
   screens, a block that folds away above them on narrow ones. */
.with-tree { display: grid; grid-template-columns: clamp(220px, 16vw, 320px) minmax(0, 1fr); gap: 24px; align-items: start; }
.tree-box {
  position: sticky; top: 12px; max-height: calc(100vh - var(--topbar-h) - 24px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px;
}
.tree-box > summary { font-weight: 600; cursor: pointer; padding: 2px 4px 6px; }
ul.tree, ul.tree ul { list-style: none; margin: 0; padding: 0; }
ul.tree ul { padding-left: 14px; }
.tree-row { display: flex; align-items: center; gap: 2px; border-radius: 4px; }
.tree-row:hover { background: var(--row-hover); }
.tree-row a { flex: 1; min-width: 0; padding: 3px 4px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-row a.current { font-weight: 600; background: var(--accent-soft); border-radius: 4px; }
.tree-toggle {
  flex: none; justify-content: center; width: 20px; height: 20px; min-width: 0; margin: 0; padding: 0; border: 0; background: none;
  color: var(--muted); font-size: 12px; line-height: 20px; text-align: center; cursor: pointer;
}
span.tree-toggle { cursor: default; }
.tree-row.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.tree-row.drop-into { background: var(--accent-soft); }
@media (max-width: 800px) {
  .with-tree { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .tree-box { position: static; max-height: none; }
}
.tree-toggle:hover { background: none; color: var(--text); }

/* Block kinds of ADR-0042. */
.pm-task { display: flex; align-items: baseline; gap: 6px; margin: 2px 0; }
.pm-task-box { flex: none; }
.pm-task-box input { margin: 0; }
.pm-task-text { flex: 1; min-width: 0; }
.pm-task[data-checked="true"] .pm-task-text { color: var(--muted); text-decoration: line-through; }
.pm-panel {
  --tone: var(--accent); --tone-soft: var(--accent-soft);
  margin: 8px 0; padding: 8px 12px; border-left: 4px solid var(--tone); border-radius: 4px; background: var(--tone-soft);
}
.pm-panel[data-tone="note"] { --tone: #8250df; --tone-soft: #f3eefc; }
.pm-panel[data-tone="warning"] { --tone: #bf8700; --tone-soft: #fff8e1; }
.pm-panel[data-tone="tip"] { --tone: #1a7f37; --tone-soft: #e9f6ec; }
.pm-panel[data-tone="error"] { --tone: var(--danger); --tone-soft: var(--danger-soft); }
/* Consecutive panels of one tone read as one box. */
.pm-panel[data-tone="info"] + .pm-panel[data-tone="info"],
.pm-panel[data-tone="note"] + .pm-panel[data-tone="note"],
.pm-panel[data-tone="warning"] + .pm-panel[data-tone="warning"],
.pm-panel[data-tone="tip"] + .pm-panel[data-tone="tip"],
.pm-panel[data-tone="error"] + .pm-panel[data-tone="error"] { margin-top: -8px; border-top-left-radius: 0; border-top-right-radius: 0; }
.pm-table { margin: 8px 0; overflow-x: auto; }
.pm-table table { border-collapse: collapse; min-width: 50%; }
.pm-table th, .pm-table td { border: 1px solid var(--border-strong); padding: 4px 8px; text-align: left; vertical-align: top; }
.pm-table th { background: var(--bg); font-weight: 600; }
.pm-table input { width: 100%; min-width: 6em; border: 0; padding: 2px; background: transparent; font: inherit; color: inherit; }
.pm-table-tools button.link { margin-right: 10px; font-size: 12px; }
.pm-toc, .pm-children { margin: 8px 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.pm-box-title { margin: 0 0 4px; font-weight: 600; }
.pm-toc ul, .pm-children ul { margin: 0; padding-left: 18px; }
.pm-toc button.link { padding: 0; margin: 0; font-weight: normal; }
.pm-toc-2 { margin-left: 14px; }
.pm-toc-3 { margin-left: 28px; }
.pm-table.ProseMirror-selectednode, .pm-toc.ProseMirror-selectednode, .pm-children.ProseMirror-selectednode { outline: 2px solid var(--accent); }

/* Comparing versions of a body (ADR-0043). */
.diff { font-family: var(--font-mono); font-size: 13px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.diff-row { padding: 2px 10px; white-space: pre-wrap; word-break: break-word; }
.diff-row::before { display: inline-block; width: 1.2em; color: var(--muted); }
.diff-same { color: var(--muted); }
.diff-same::before { content: " "; }
.diff-add { background: #e6f4ea; }
.diff-add::before { content: "+"; }
.diff-del { background: var(--danger-soft); text-decoration: line-through; }
.diff-del::before { content: "−"; }
.diff-change::before { content: "~"; }
.diff ins { background: #c7ebd1; text-decoration: none; }
.diff del { background: #f6c9c4; }

/* Labels (ADR-0044). */
.labels { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 10px; }
.label {
  display: inline-flex; align-items: center; gap: 2px; padding: 1px 8px; border-radius: 999px;
  background: var(--accent-soft); font-size: 12px; line-height: 20px;
}
.label a { color: var(--accent); }
.label-remove {
  margin: 0; padding: 0 2px; min-width: 0; border: 0; background: none; color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer;
}
.label-remove:hover { background: none; color: var(--danger); }
.label-count { color: var(--muted); font-size: 12px; }
.label-add { display: inline-flex; margin: 0; }
.label-add input { padding: 2px 8px; font-size: 12px; border-radius: 999px; }

/* Attachments and images (ADR-0045). */
ul.attachments { list-style: none; padding: 0; margin: 0 0 8px; }
li.attachment { padding: 4px 0; border-bottom: 1px solid var(--border); }
li.attachment button.link { margin-left: 8px; }
label.upload { display: inline-flex; align-items: center; gap: 8px; }
.pm-image { margin: 10px 0; text-align: center; }
.pm-image img { max-width: 100%; height: auto; border-radius: 4px; border: 1px solid var(--border); }
.pm-image figcaption { margin-top: 4px; color: var(--muted); font-size: 13px; }
.pm-image figcaption input { width: 60%; text-align: center; border: 0; border-bottom: 1px dashed var(--border-strong); background: transparent; color: inherit; font: inherit; }
.pm-image.ProseMirror-selectednode img { outline: 2px solid var(--accent); }

/* Watching and notifications (ADR-0046). */
#nav > a.unread { color: var(--accent); font-weight: 600; }
/* The notification bell and its count. */
#nav > a.bell { position: relative; display: inline-flex; align-items: center; padding: 6px 8px; }
#nav > a.bell .count { position: absolute; top: 0; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
ul.notifications { list-style: none; padding: 0; margin: 0 0 10px; }
ul.notifications li { padding: 6px 0; border-bottom: 1px solid var(--border); }
ul.notifications li.unread { font-weight: 600; }
ul.notifications li.unread::before { content: "● "; color: var(--accent); }
button.secondary { background: var(--surface); color: var(--accent); }
button.secondary:hover { background: var(--accent-soft); color: var(--accent); }

/* Creating and finding actions (discoverability): a view's heading with
   its main actions, role badges, the tree's "new page" link. */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.page-head h1, .page-head form { margin: 0; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
a.button { display: inline-block; }
.badge { display: inline-block; padding: 0 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.8em; }
.tree-new { display: block; margin: 4px 0 8px; font-weight: 600; }
.card.empty { text-align: left; }
.notice-card { border-left: 4px solid var(--accent); }
label.check { display: flex; align-items: center; gap: 6px; margin: 8px 0; }
#nav-new { white-space: nowrap; }
details.card > summary { cursor: pointer; font-weight: 600; }
/* Copyable settings (the MCP page). */
.copyable { display: flex; gap: 8px; align-items: flex-start; }
.copyable .snippet { flex: 1; margin: 0; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  font-family: var(--font-mono); font-size: 0.85em; white-space: pre-wrap; overflow-wrap: anywhere; }
.tools li { margin: 4px 0; }
/* Administration: a table of contents, members of groups. */
.admin-toc { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 12px; }
.member { display: inline-flex; align-items: center; gap: 2px; margin-right: 10px; }
.card h3 { margin: 16px 0 8px; }
/* The task inbox (ADR-0049). */
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; margin: 8px 0 12px; }
.tabs .tab { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; }
.tabs .tab.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tabs select { margin-left: auto; }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.task-actions { white-space: nowrap; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; }
#relations form.inline input { width: auto; }
/* On a phone the navigation takes its own row below the logo, the search
   a full line of it. */
@media (max-width: 640px) {
  #nav { flex-basis: 100%; padding-bottom: 6px; }
  #nav .search { flex: 1 1 100%; margin: 0 0 4px; }
  #nav > a, #nav > button.link { min-height: 40px; }
}
/* The account menu and profile pictures (ADR-0050). */
.account { position: relative; }
.account-button { display: inline-flex; align-items: center; padding: 2px; border-radius: 50%; background: none; border: 2px solid transparent; }
.account-button:hover, .account-button[aria-expanded="true"] { background: none; border-color: var(--accent); }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; overflow: hidden; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-32 { width: 32px; height: 32px; font-size: 13px; }
.avatar-40 { width: 40px; height: 40px; font-size: 15px; }
.avatar-64 { width: 64px; height: 64px; font-size: 24px; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px; padding: 6px 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px 10px; }
.menu [role=menuitem] { display: block; width: 100%; padding: 8px 14px; text-align: left; color: var(--text); background: none; border: 0; border-radius: 0; font: inherit; }
.menu [role=menuitem]:hover, .menu [role=menuitem]:focus { background: var(--accent-soft); color: var(--accent); text-decoration: none; outline: none; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.avatar-row { display: flex; gap: 16px; align-items: center; }
/* The bell and the account sit at the right end of the header, so the
   account menu opens inward on every width. */
#nav > #nav-notifications { margin-left: auto; }
.menu { max-width: calc(100vw - 32px); }
/* Initials where there is no picture, drawn from an attribute so they are
   no part of the name's text; faces beside comments and history. */
.avatar[data-initials]::before { content: attr(data-initials); }
.avatar-20 { width: 20px; height: 20px; font-size: 9px; }
.avatar-24 { width: 24px; height: 24px; font-size: 10px; }
.comment-head, .who { display: inline-flex; align-items: center; gap: 6px; }
/* Watching an item or a space: a black bell, filled while one watches,
   outlined while one does not (ADR-0046). */
button.watch-bell { display: inline-flex; align-items: center; justify-content: center; padding: 6px; min-width: 36px; min-height: 36px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); }
button.watch-bell:hover { background: var(--row-hover); color: var(--text); border-color: var(--border-strong); }
button.watch-bell svg { width: 20px; height: 20px; }
/* An item: its text, read or edited in place, and a column of what
   belongs to it (ADR-0051). */
.item-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 24vw, 440px); gap: 20px; align-items: start; }
.item-main { min-width: 0; }
.item-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.side-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.side-card > h2, .item-side > section > h2 { font-size: 15px; margin: 0 0 8px; }
.item-side > section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 0; }
.item-side table { width: 100%; font-size: 13px; }
.item-side table.history td { padding: 4px 6px; overflow-wrap: anywhere; }
.item-side .props th { width: 35%; }
.item-side .props input, .item-side .props select { max-width: 100%; }
#body.reading .pm-editor .ProseMirror { min-height: 0; }
#body.editing { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--radius); }
.item-title { display: inline-flex; align-items: center; gap: 8px; }
.item-title .lock { color: #a15c00; }
/* The access bar: an open lock on calm green while everyone in the space may
   read; a closed lock on amber when access is narrowed. */
#access.access-open { border-color: #b7dfc3; background: #f1faf3; }
#access.access-open .access-bar { color: #1d6b34; }
#access.access-restricted { border-color: #f0bf73; background: #fff5e6; }
#access.access-restricted .access-bar { color: #8a4b00; }
.access-bar { display: flex; align-items: center; gap: 8px; }
@media (max-width: 1100px) {
  .item-layout { grid-template-columns: minmax(0, 1fr); }
}
/* Fields in the side column: the name above, the value and its button
   beside each other, so nothing reaches past the card. */
.item-side .props, .item-side .props tbody { display: block; }
.item-side .props tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.item-side .props th { grid-column: 1 / -1; width: auto; padding: 0; font-weight: 500; color: var(--muted); }
.item-side .props td { padding: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.item-side .props td input, .item-side .props td select { width: 100%; }
.item-side .props td:last-child button:not(.link) { padding: 6px 10px; font-size: 13px; }
.item-side .upload { display: flex; flex-direction: column; gap: 4px; }
.item-side .upload input { max-width: 100%; }
.item-side form.inline { flex-wrap: wrap; }
/* The corporate design's settings (ADR-0052). */
.brand-logo { display: block; height: 28px; width: auto; max-width: 220px; object-fit: contain; }
.design-assets { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.design-asset { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.design-preview { max-width: 100%; max-height: 80px; object-fit: contain; align-self: flex-start; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 12px 12px; }
.design-colours { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 16px; }
.design-colour input[type=color] { width: 44px; height: 32px; padding: 0; border: 1px solid var(--border); }
textarea.code { font-family: var(--font-mono); font-size: 13px; }

/* The drawing editor (ADR-0053): a dialog almost as large as the window,
   with the drawing page in a frame. */
dialog.drawing { width: calc(100vw - 32px); height: calc(100vh - 32px); max-width: none; max-height: none; padding: 0; border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; background: var(--surface); color: inherit; }
dialog.drawing:not([open]) { display: none; }
dialog.drawing::backdrop { background: rgba(20, 22, 26, .45); }
.drawing-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.drawing-bar .error { margin-left: auto; }
.drawing-bar .error:empty + button { margin-left: auto; }
.drawing-frame { flex: 1; width: 100%; border: 0; }
.pm-redraw { font-size: 13px; }

/* The album (ADR-0054): a grid of pictures with their items. */
.album-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.album-filters input[type=search] { flex: 1 1 240px; }
.album-grid { list-style: none; margin: 12px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.album-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.album-card figure { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.album-card img { width: 100%; height: 140px; object-fit: contain; background: #fff; border-radius: 4px; }
.album-card figcaption { display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; }
.album-name { font-weight: 600; overflow-wrap: anywhere; }
.album-item { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-card .chip { align-self: flex-start; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
dialog.album-dialog { width: min(960px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: inherit; }
dialog.album-dialog::backdrop { background: rgba(20, 22, 26, .45); }
.album-dialog-body { padding: 12px; overflow: auto; max-height: calc(100vh - 130px); }
.album-dialog .drawing-bar button { margin-left: auto; }

/* Contrast warnings of the corporate design (ADR-0052). */
.notice.warning { background: var(--danger-soft); border-color: var(--danger); }
#design-contrast ul { margin: 6px 0; padding-left: 0; list-style: none; }
#design-contrast li { margin: 4px 0; }
.design-pair { display: inline-block; min-width: 2.4em; padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; font-weight: 600; text-align: center; }
.att-origin .chip { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); }
.pm-take-over { font-size: 13px; }

/* Image sizes (ADR-0056): the frame takes the width, the corner handle
   resizes while editing. */
.pm-image-frame { position: relative; display: inline-block; max-width: 100%; vertical-align: top; }
.pm-image-frame img { display: block; margin: 0 auto; }
.pm-resize { display: none; position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px; border-radius: 3px; background: var(--accent); border: 2px solid var(--surface); cursor: nwse-resize; touch-action: none; }
.pm-image.pm-sizable:hover .pm-resize, .pm-image.pm-sizable.ProseMirror-selectednode .pm-resize { display: block; }
.pm-image-size { font-size: 13px; padding: 2px 4px; }

/* Column filters of the task list. */
#tasks tr.filters td { padding: 4px 6px; background: var(--row-hover); }
#tasks tr.filters input, #tasks tr.filters select { width: 100%; min-width: 6em; font-size: 13px; padding: 3px 6px; box-sizing: border-box; }
.tasks-foot { display: flex; gap: 12px; align-items: baseline; }

/* An "i" that explains a column or heading. The selectors outweigh the
   general button style, whose fill and padding would hide the letter. */
.info-tip { position: relative; display: inline-block; vertical-align: middle; margin-left: 2px; }
.info-tip button.info-btn { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; min-width: 0; padding: 0; margin: 0; border-radius: 50%;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font: italic 700 12px/1 Georgia, "Times New Roman", serif; cursor: pointer; text-transform: none; letter-spacing: 0; box-shadow: none; }
.info-tip button.info-btn:hover, .info-tip button.info-btn[aria-expanded=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.info-pop { position: absolute; z-index: 30; top: 24px; left: -8px; width: min(380px, calc(100vw - 48px)); padding: 10px 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; font-weight: 400; font-style: normal; text-align: left; white-space: normal; text-transform: none; letter-spacing: 0; }
.info-pop p { margin: 0 0 6px; }
.info-pop p:last-child { margin-bottom: 0; }
.info-pop ul { margin: 0 0 6px; padding-left: 18px; }
.info-pop li { margin: 2px 0; }
th:last-child .info-pop, th:nth-last-child(2) .info-pop { left: auto; right: -8px; }

/* Open governance findings (ADR-0057): an amber dot on the bell, and the
   list on the notifications page. */
#nav > a.bell.findings::after { content: ""; position: absolute; bottom: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: #e8a317; border: 2px solid var(--surface); }
#my-findings .chip { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #fff4e5; color: #8a5300; }
#my-findings h2 a { font-size: 13px; font-weight: 400; margin-left: 8px; }
.notifications li.governance { border-left: 3px solid #e8a317; padding-left: 8px; }

/* Data protection review (ADR-0058). */
section.hold { margin: 8px 0 12px; }
section.hold ul { margin: 6px 0; padding-left: 18px; }
section.hold .chip, #governance .chip { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #fff4e5; color: #8a5300; }
.hold-release { display: flex; flex-direction: column; gap: 6px; max-width: 640px; margin-top: 8px; }
.hold-release button { align-self: flex-start; }
.regulation { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin: 10px 0; background: var(--surface); }
.regulation h3 { margin: 0 0 6px; }
.regulation-form { display: flex; flex-direction: column; gap: 6px; }
#governance tr.held td { background: #fff8ec; }

/* The fuller editor (ADR-0059): grouped toolbar, pressed states,
   alignment, divider, highlight and floated pictures. */
.pm-toolbar .pm-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--border); }
.pm-toolbar .pm-group:last-of-type { border-right: 0; }
.pm-toolbar button[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pm-toolbar button:disabled { opacity: .4; }
.pm-toolbar mark { padding: 0 2px; }
.pm-ico { display: inline-flex; flex-direction: column; gap: 2px; width: 14px; vertical-align: middle; }
.pm-ico i { display: block; height: 2px; background: currentColor; border-radius: 1px; }
.pm-ico i:nth-child(odd) { width: 100%; }
.pm-ico i:nth-child(even) { width: 64%; }
.pm-ico-center { align-items: center; }
.pm-ico-right { align-items: flex-end; }
.pm-ico-justify i:nth-child(even) { width: 100%; }
.pm-align-center { text-align: center; }
.pm-align-right { text-align: right; }
.pm-align-justify { text-align: justify; hyphens: auto; }
.pm-editor hr.pm-divider { border: 0; border-top: 1px solid var(--border-strong); margin: 14px 0; }
.pm-editor hr.pm-divider.ProseMirror-selectednode { border-top-color: var(--accent); }
.pm-editor mark { background: #fff1a8; color: inherit; padding: 0 1px; border-radius: 2px; }
.pm-editor .ProseMirror::after { content: ""; display: block; clear: both; }
.pm-image.pm-image-left { float: left; margin: 4px 18px 8px 0; text-align: left; }
.pm-image.pm-image-right { float: right; margin: 4px 0 8px 18px; text-align: right; }
.pm-image.pm-image-left figcaption, .pm-image.pm-image-right figcaption { text-align: inherit; }
.pm-image-align { font-size: 13px; padding: 2px 4px; }
@media (max-width: 640px) { .pm-image.pm-image-left, .pm-image.pm-image-right { float: none; width: auto !important; margin: 10px 0; } }

/* The start page: a welcome, quick access and the spaces as tiles. */
.welcome { display: flex; align-items: center; gap: 24px; padding: 28px 32px; margin-bottom: 18px; border-radius: 14px;
  background: linear-gradient(120deg, var(--surface) 0%, var(--accent-soft) 100%); border: 1px solid var(--border); }
.welcome-text { flex: 1; min-width: 0; }
.welcome h1 { margin: 0 0 8px; font-size: 28px; }
.welcome-lead { margin: 0 0 16px; font-size: 15px; color: var(--muted); max-width: 62ch; }
.welcome-art { flex: none; width: min(360px, 34vw); height: auto; }
.home-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 22px; }
.home-tile, .space-tile { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--border); color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
.home-tile:hover, .space-tile:hover { border-color: var(--accent); text-decoration: none; }
.home-tile .chip { align-self: flex-start; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #fff4e5; color: #8a5300; }
.space-tiles { list-style: none; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.space-key { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--accent); }
.space-tile .badge { align-self: flex-start; }
.first-steps ol { margin: 6px 0 0; padding-left: 20px; }
@media (max-width: 720px) { .welcome { flex-direction: column-reverse; padding: 20px; } .welcome-art { width: 70%; } }
.welcome .button:not(.primary) { background: var(--surface); color: var(--accent); }
.welcome .button:not(.primary):hover { background: var(--accent-soft); }

/* Kanbans (ADR-0060). */
.kanban-tools { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 6px 0 12px; }
.kanban-tools .inline-form { display: flex; gap: 6px; align-items: center; }
.kanban-tools .inline-form input { min-width: 16rem; }
.kanban-admin { margin-left: auto; font-size: 13px; }
.kanban-off { font-size: 12px; color: var(--muted); }
#new-kanban .form-row { display: flex; flex-wrap: wrap; gap: 10px; }
#new-kanban .form-row .field { flex: 1 1 200px; }

/* Account requests (ADR-0061): a dot on the account button while requests
   wait for an administrator, and the way to ask on the sign-in page. */
.account-button.pending { position: relative; }
.account-button.pending::after { content: ""; position: absolute; top: 0; right: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
#login-card .login-more { margin-top: 16px; font-size: 14px; }
#account-requests td { vertical-align: top; }
#account-requests td:last-child { white-space: nowrap; }
/* An info note may hold an example of several lines. */
.info-pop p { white-space: pre-line; }

/* Spaces on the start page (ADR-0062): tiles or a list, each with the
   space's icon or, without one, its key. */
.segmented { display: inline-flex; margin: 0 0 12px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented .segment { border: 0; border-radius: 0; background: var(--surface); color: var(--text); padding: 4px 12px; font-size: 13px; }
.segmented .segment[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink, #fff); }
.space-tile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.space-icon { flex: none; border-radius: 8px; object-fit: contain; background: var(--surface); }
.space-icon-24 { width: 24px; height: 24px; border-radius: 5px; }
.space-icon-48 { width: 48px; height: 48px; }
.space-icon-64 { width: 64px; height: 64px; }
.space-icon-key { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--accent); background: var(--bg); border: 1px solid var(--border); }
.space-icon-24.space-icon-key { font-size: 9px; }
.space-icon-48.space-icon-key { font-size: 14px; }
.space-icon-64.space-icon-key { font-size: 18px; }
.space-list { width: 100%; margin-bottom: 22px; }
.space-list .space-link { display: inline-flex; align-items: center; gap: 8px; }

/* The calendar button of a date field sits left, before the date. Only
   Chromium-based browsers let a page move it; elsewhere it stays where
   the browser puts it. */
input[type="date"] { position: relative; padding-left: 34px; }
input[type="date"]::-webkit-calendar-picker-indicator { position: absolute; left: 10px; margin: 0; cursor: pointer; }

/* The comment overview (ADR-0063). */
.comment-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.comment-entry { display: flex; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.comment-entry.resolved { opacity: .75; }
.comment-entry-main { flex: 1; min-width: 0; }
.comment-entry-head { font-size: 14px; }
.comment-entry .comment-text { margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-quote { margin: 6px 0; padding: 2px 10px; border-left: 3px solid var(--border-strong); color: var(--muted, #6b7280); font-size: 13px; }
.comment-entry-why { display: flex; flex-wrap: wrap; gap: 6px; }
.comment-entry-why .chip { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); }
.comment-entry-why .why-mentions { border-color: var(--accent); color: var(--accent); }

/* Message delivery (ADR-0064): the outcome per channel. */
.delivery-results { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; }
.delivery-results li.ok strong { color: #1a7f37; }
.delivery-results li.failed strong { color: #b42318; }
.copyable { display: block; margin-top: 6px; padding: 6px 8px; overflow-wrap: anywhere; user-select: all; background: var(--bg); border-radius: 6px; }

/* ==========================================================================
   The uniform system (ADR-0065). Every view has the same frame: a crumb
   line, a heading with its lead and its actions on the right, then cards.
   Buttons have three weights: primary (the one main action, filled),
   secondary (outlined, the default) and link. Everything else follows the
   tokens above. Later rules here win over the older ones above.
   ========================================================================== */

body { font-size: 14.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1 { font-size: 26px; line-height: 1.25; font-weight: 650; letter-spacing: -0.015em; margin: 0 0 6px; }
h2 { font-size: 16px; line-height: 1.35; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 600; margin: 18px 0 8px; }
main { padding: 28px clamp(16px, 3vw, 40px) 40px; max-width: 1680px; margin: 0 auto; }
:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- The frame of a view ---------- */
.crumbs, main p:has(> a[href="#/"]:first-child) {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px;
  margin: 0 0 10px; font-size: 13px; color: var(--muted);
}
.crumbs a, main p:has(> a[href="#/"]:first-child) a { color: var(--muted); }
.crumbs a:hover, main p:has(> a[href="#/"]:first-child) a:hover { color: var(--accent); }
/* A heading directly in a view, and the paragraph after it as its lead. */
#app > h1 { margin-bottom: 6px; }
#app > h1 + p.muted, #app > h1 + p, .page-lead { margin: 0 0 22px; max-width: 72ch; color: var(--muted); font-size: 15px; }
#app > h1:last-of-type:not(:has(+ p)) { margin-bottom: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin: 0 0 20px; }
.page-head + p.muted { margin-top: -12px; margin-bottom: 22px; }
.page-head .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.page-head .actions button, .page-head .actions .button { margin: 0; }

/* ---------- Surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: var(--space-5); margin: 0 0 var(--space-4);
}
.card > h2:first-child, .card > summary + h2, .card > header > h2 { margin-top: 0; }
.card h3:first-child { margin-top: 0; }
details.card > summary { list-style: none; display: flex; align-items: center; gap: 8px; font-size: 15px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.card[open] > summary::before { transform: rotate(90deg); }
details.card[open] > summary { margin-bottom: 14px; }
.side-card, .item-side > section { border-radius: var(--radius); padding: var(--space-4) 18px; box-shadow: var(--shadow); }
.notice { border-radius: var(--radius-sm); border-left-width: 3px; padding: 12px 14px; }
.notice-card { border-left: 4px solid var(--accent); }
.narrow { max-width: 26rem; margin: 8vh auto; }
.narrow.card { padding: 32px; box-shadow: var(--shadow-lg); }

/* ---------- Buttons ---------- */
button, .button {
  min-height: 36px; padding: 7px 14px; margin: 2px 6px 2px 0;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; line-height: 1.2;
  box-shadow: 0 1px 1px rgba(16, 24, 40, 0.04);
  transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s;
}
button:hover, .button:hover { background: var(--row-hover); border-color: var(--border-strong); color: var(--text); text-decoration: none; }
button.primary, .button.primary, button[type=submit]:not(.link):not(.secondary):not(.danger) {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
button.primary:hover, .button.primary:hover, button[type=submit]:not(.link):not(.secondary):not(.danger):hover {
  background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink);
}
button.secondary, .button.secondary { background: var(--surface); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); }
button.secondary:hover, .button.secondary:hover { background: var(--accent-soft); color: var(--accent); }
button.danger, .button.danger { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border-strong)); }
button.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
button.link, button.link:hover { min-height: 0; box-shadow: none; font-weight: 500; }
button:disabled, button:disabled:hover { opacity: .55; cursor: not-allowed; }

/* ---------- Fields ---------- */
input, select, textarea {
  min-height: 38px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color .12s, box-shadow .12s;
}
input[type=checkbox], input[type=radio] { min-height: 0; width: 16px; height: 16px; accent-color: var(--accent); }
input[type=color] { padding: 2px; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--border-strong)); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--focus); }
input::placeholder, textarea::placeholder { font-style: normal; opacity: .7; }
.field { gap: 6px; margin: 0 0 14px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text); }
form > button[type=submit] { margin-top: 4px; }
input.title { min-height: 44px; font-size: 24px; font-weight: 650; letter-spacing: -0.01em; border-color: transparent; background: transparent; padding: 4px 8px; margin-left: -8px; }
input.title:hover { border-color: var(--border); background: var(--surface); }
input.title:focus { background: var(--surface); }

/* ---------- Tables ---------- */
table { border-collapse: separate; border-spacing: 0; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
thead th, table:not(.props) > tr:first-child > th {
  font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-2); padding: 10px 14px;
}
tbody tr, table > tr { transition: background-color .1s; }
tbody tr:hover, table > tr:hover { background: var(--row-hover); }
tr:last-child > td { border-bottom: 0; }
/* A table standing in a view, not in a card, gets the card's frame. */
main table:not(.card table, .side-card table, .item-side table, .pm-editor table, .props, .board table, .menu table) {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
#tasks { overflow-x: auto; }

/* ---------- Tabs: one line under the heading ---------- */
.tabs { gap: 2px; margin: 0 0 20px; padding: 0; border-bottom: 1px solid var(--border); }
.tabs .tab {
  margin-bottom: -1px; padding: 9px 14px; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  color: var(--muted); font-weight: 500; background: none;
}
.tabs .tab:hover { color: var(--text); text-decoration: none; }
.tabs .tab.active { background: none; color: var(--accent); border-color: var(--accent); font-weight: 600; }

/* ---------- Chips and badges ---------- */
.badge, .chip, .label { border-radius: 999px; font-size: 12px; line-height: 20px; padding: 0 9px; font-weight: 500; }
.badge { background: var(--accent-soft); color: var(--accent); }

/* ---------- Top bar ---------- */
.top { min-height: var(--topbar-h); padding: 0 clamp(12px, 2vw, 24px); gap: 6px 14px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border); }
#nav .search { flex: 0 1 26rem; }
#nav .search input { min-height: 36px; padding: 6px 14px 6px 36px; border-radius: 999px; background: var(--bg) no-repeat 12px center / 16px 16px;
  background-image: url("icons/search.svg");
  border-color: transparent; }
#nav .search input:focus { background-color: var(--surface); border-color: var(--accent); }
#nav-new { min-height: 36px; border-radius: 999px; padding: 6px 16px; }
.icon-btn { width: 36px; height: 36px; border-radius: var(--radius-sm); }

/* ---------- The module drawer, with an icon per module ---------- */
#drawer { width: 280px; box-shadow: var(--shadow-lg); border-right: 0; }
.drawer-head { height: var(--topbar-h); }
#drawer-apps { padding: 12px; gap: 2px; }
#drawer-apps a { gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); }
#drawer-apps a svg { width: 20px; height: 20px; flex: none; color: var(--muted); }
#drawer-apps a.active svg { color: var(--accent); }

/* ---------- Tiles ---------- */
.home-tile, .space-tile { border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s, transform .12s; }
.home-tile:hover, .space-tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.welcome { border-radius: 16px; }

/* ---------- Administration: contents on the left ---------- */
.admin-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.admin-layout .admin-toc {
  position: sticky; top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column; gap: 2px; margin: 0;
  padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.admin-layout .admin-toc button.link { display: block; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); text-align: left; color: var(--text); }
.admin-layout .admin-toc button.link:hover { background: var(--row-hover); text-decoration: none; }
.admin-layout .admin-toc button.link.current { background: var(--accent-soft); color: var(--accent); }
.admin-layout section.card { scroll-margin-top: calc(var(--topbar-h) + 16px); }
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .admin-layout .admin-toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .admin-layout .admin-toc button.link { width: auto; }
}

/* ---------- Item properties save as they change ---------- */
.item-side .props td .saved { color: var(--success); font-size: 13px; }
.item-side .props td .saving { color: var(--muted); font-size: 13px; }

/* ---------- Lists ---------- */
ul.notifications li, .comment, li.attachment, .thread { padding: 10px 0; }
.comment-entry, .home-tile, .space-tile, .board-column, .tree-box { border-color: var(--border); }
.board-column { border-radius: var(--radius); background: var(--surface-2); }
.card-item { background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 10px 12px; }
.tree-box { border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; }
.tree-row a { padding: 5px 6px; border-radius: 6px; }
.tree-row a.current { color: var(--accent); }
.footer { text-align: center; padding: 8px 22px 28px; }

/* ---------- Details ---------- */
.pm-toolbar button { min-height: 30px; padding: 4px 9px; box-shadow: none; border-radius: 6px; font-weight: 600; }
.pm-toolbar select, .pm-toolbar input { min-height: 30px; }
.pm-wrap { border-radius: var(--radius); }
.pm-toolbar { border-radius: var(--radius) var(--radius) 0 0; padding: 8px; gap: 6px; }
input[type=file] { min-height: 0; padding: 0; border: 0; background: none; box-shadow: none; font-size: 13px; color: var(--muted); }
input[type=file]::file-selector-button {
  margin-right: 10px; padding: 7px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--row-hover); }
/* Forms in cards keep a readable width; code fields and tables use it all. */
.card .field:not(:has(textarea.code)) { max-width: 640px; }
.card form.inline .field { max-width: none; }
.item-side .props th { font-size: 12px; font-weight: 500; color: var(--muted); }
.item-side .props td .error { font-size: 13px; }
button.info-btn { min-height: 0; box-shadow: none; margin: 0 0 0 4px; }
.tree-toggle, .label-remove, button.segment { min-height: 0; box-shadow: none; }
.admin-sections { min-width: 0; }
.admin-sections .card { overflow-x: auto; }

/* The sign-in page (ADR-0030, ADR-0061, ADR-0064): single sign-on first,
   then username and password, then the two ways of help. */
#login-card h1 { margin-bottom: 4px; }
.login-lead { margin: 0 0 20px; }
.login-sso { display: flex; justify-content: center; width: 100%; margin: 0; min-height: 42px; }
.login-sso svg { width: 18px; height: 18px; }
.login-or { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; color: var(--muted); font-size: 13px; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
#login .field input { width: 100%; }
.login-submit { width: 100%; justify-content: center; min-height: 42px; margin: 6px 0 0; }
.login-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 14px; }
/* The administration's overview of the sign-in page. */
.setup-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.setup-list li { display: grid; grid-template-columns: 10px minmax(0, 14rem) minmax(0, 1fr); align-items: baseline; gap: 4px 10px; }
.setup-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); align-self: center; }
.setup-list li.on .setup-dot { background: var(--success); }
.setup-list li.off .setup-dot { background: var(--warning); }
.info-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.15em; height: 1.15em; border-radius: 50%;
  border: 1.5px solid var(--accent); color: var(--accent); font: italic 700 0.8em/1 Georgia, serif; flex: none; }
.info-button { background: none; border: 0; padding: 0 2px; cursor: pointer; line-height: 1; vertical-align: -0.15em; font-size: inherit; }
.info-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 50%; }
.env-help { margin: 0 0 18px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.env-help summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.env-help h4 { margin: 14px 0 4px; }
.env-vars { padding-left: 18px; }
.env-vars li { margin: 4px 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .setup-list li { grid-template-columns: 10px minmax(0, 1fr); } .setup-list li > .muted { grid-column: 2; } }
/* The start page: a larger picture, and the installed version in a corner. */
.welcome { position: relative; overflow: hidden; }
.welcome-art { width: min(440px, 38vw); }
.welcome-version { position: absolute; right: 16px; bottom: 12px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
  padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 75%, transparent); border: 1px solid var(--border); }
@media (max-width: 720px) { .welcome-art { width: 86%; } .welcome-version { position: static; align-self: flex-start; } }
/* Sign-in with Microsoft or Google (ADR-0066): neutral buttons with the
   provider's mark, as their sign-in guidelines ask. */
.login-sso-list { display: flex; flex-direction: column; gap: 10px; }
.login-sso { justify-content: center; gap: 10px; background: var(--surface); color: var(--text); border-color: var(--border-strong); font-weight: 600; }
.login-sso:hover { background: var(--row-hover); color: var(--text); }
.login-sso svg { width: 18px; height: 18px; flex: none; }
a.button.login-sso { display: flex; gap: 10px; }
/* Copying and moving a page (ADR-0067). */
.relocate-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.relocate-form h3 { margin-top: 0; }
.relocate-form select, .relocate-form input:not([type=checkbox]) { width: 100%; }

/* The consent page's choice of access (ADR-0068). */
#oauth-access { display: grid; gap: 8px; margin: 16px 0; padding: 0; border: 0; }
#oauth-access legend { margin-bottom: 8px; padding: 0; font-weight: 600; }

/* Export (ADR-0071): a small menu on a page, and its printed form, which
   is the page as PDF without the surroundings. */
.export-menu { position: relative; display: inline-block; }
.export-menu > summary { list-style: none; cursor: pointer; }
.export-menu > summary::-webkit-details-marker { display: none; }
.export-list { position: absolute; right: 0; z-index: 20; display: flex; flex-direction: column; gap: 2px; min-width: 15rem; margin-top: 6px;
  padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.export-list a, .export-list button.link { display: block; padding: 6px 10px; border-radius: 6px; text-align: left; color: var(--text); text-decoration: none; }
.export-list a:hover, .export-list button.link:hover { background: var(--row-hover); }
@media print {
  :root { color-scheme: light; }
  body { background: #fff !important; }
  header.top, #drawer, #footer, .with-tree > :first-child, .crumbs, .page-head .actions, .status, .item-side > :not(#details),
  #details .actions-row, #details button, .pm-menu, .comment-mark-gutter { display: none !important; }
  .with-tree, .with-tree-main, .item-layout { display: block !important; margin: 0 !important; padding: 0 !important; }
  .side-card, .item-main { border: none !important; box-shadow: none !important; background: none !important; }
  a { color: inherit; text-decoration: underline; }
  table, figure, .pm-image, pre { break-inside: avoid; }
  h1, h2, h3 { break-after: avoid; }
}

/* The relevance of a search hit (ADR-0072). */
.stars { display: inline-flex; margin-right: 8px; font-size: 14px; letter-spacing: 1px; cursor: help; vertical-align: 1px; }
.stars-on { color: #e3a008; }
.stars-off { color: var(--border-strong); }
/* The frame a page's printable form loads in, to print it (ADR-0071). */
.export-frame { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; border: 0; opacity: 0; }
.export-handbook:empty { display: none; }
.export-handbook { display: contents; }

/* Account requests among an administrator's open work (ADR-0061). */
a.requests-notice { display: block; margin: 0 0 18px; color: inherit; text-decoration: none; }
a.requests-notice:hover { border-color: var(--accent); }
.requests-card { margin: 0 0 18px; border-left: 3px solid var(--warning); }
.requests-card h2 { margin-top: 0; }

/* Catalogs (ADR-0074): where a mirrored item is kept, and web addresses. */
.notice.origin { margin: 0 0 14px; }
.prop-link { margin-left: 6px; white-space: nowrap; }
.catalog-run { margin: 6px 0; }
.catalog-run summary { cursor: pointer; }
.catalog-problems { font-size: 13px; }
.format-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0 12px; max-height: 22rem; overflow: auto; margin-bottom: 12px; }
