:root {
  --bg: #f4f6fa;
  --surface: #fff;
  --text: #1d2433;
  --muted: #5b6475;
  --line: #e3e7ef;
  --primary: #2f6fed;
  --danger: #c92a2a;
  --command: #2f6fed;
  --event: #f08c00;
  --view: #2f9e44;
  --radius: 7px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --el-r: 8px;
  --el-head-h: 36px;
  --el-pad-x: 12px;
  --el-row-h: 24px;
  --el-max-rows: 3;
  --el-tg-h: 28px;
  --el-thumb-h: 128px;
  --el-name-c: #4a5263;
  --el-tg-c: #1f4fb5;
  --el-div: #e3e7ef;
  --el-shadow: 0 1px 2px rgba(29, 36, 51, 0.10), 0 1px 1px rgba(29, 36, 51, 0.06);
  --el-shadow-hover: 0 6px 16px -4px rgba(29, 36, 51, 0.24), 0 1px 3px rgba(29, 36, 51, 0.12);
  --el-shadow-float: 0 20px 44px -10px rgba(29, 36, 51, 0.45), 0 6px 14px -2px rgba(29, 36, 51, 0.18);
  --el-float-z: 40;
  --cmd-band: #bcd6fb; --cmd-ink: #0b2a5b; --cmd-edge: #4f80cc; --cmd-pill: #eaf2ff;
  --ev-band: #f8b35e; --ev-ink: #3a1d00; --ev-edge: #b8691a; --ev-pill: #fff1df;
  --rm-band: #b3dfbf; --rm-ink: #0b3a1a; --rm-edge: #3f8a55; --rm-pill: #e7f5eb;
  --au-band: #dfe3ea; --au-ink: #1d2433; --au-edge: #7d8798;
  --ex-band: #f3c4dd; --ex-ink: #4a0f2e; --ex-edge: #b8507f; --ex-pill: #fcebf4;
  --ui-band: #eef1f6; --ui-ink: #1d2433; --ui-edge: #7d8798;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { display: flex; gap: 3px; }
.logo i { width: 9px; height: 14px; border-radius: 2px; }
.logo .c { background: var(--command); }
.logo .e { background: var(--event); }
.logo .v { background: var(--view); }
.nav { font-size: 14px; margin-left: 16px; color: var(--muted); }
.nav[aria-current="page"] { color: var(--text); font-weight: 600; }
.sp { flex: 1; }
.av {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--text); color: #fff;
  font-size: 12px; font-weight: 600;
  display: grid; place-items: center;
}
button.av { border: 0; padding: 0; font-family: inherit; cursor: pointer; }
button.av:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.acct { position: relative; }
.acct-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 220px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--el-shadow-hover); padding: 6px;
}
.acct-menu[hidden] { display: none; }
.acct-who { padding: 6px 8px 8px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.acct-who b { display: block; font-size: 14px; color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.acct-out {
  display: block; width: 100%; text-align: left; font: inherit; font-size: 14px;
  padding: 7px 8px; border: 0; border-radius: 5px; background: none; color: var(--text); cursor: pointer;
}
.acct-out:hover, .acct-out:focus-visible { background: var(--bg); }

.main { max-width: 720px; margin: 0 auto; padding: 28px 24px; }
h1 { font-size: 26px; font-weight: 700; margin: 0 0 4px; line-height: 1.2; }
.sub { color: var(--muted); margin: 0 0 20px; max-width: 60ch; }

.input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  font: inherit;
  color: inherit;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.input:focus { outline: none; border-color: var(--primary); }
.input[aria-invalid="true"] { border-color: var(--danger); }

.btn {
  border: 0;
  border-radius: var(--radius);
  padding: 9px 16px;
  font: 600 14px system-ui, sans-serif;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}
.btn.sec { background: var(--surface); color: var(--text); border: 1px solid #cfd5e1; }
.btn.dan { background: var(--danger); }
.btn.sm { padding: 6px 14px; font-size: 14px; }
.btn.sec.sm { color: var(--primary); }
.btn.warn { background: var(--surface); color: var(--danger); border: 1px solid #e8b4b4; }
.lnk { border: 0; background: none; padding: 4px 0; font: 600 14px system-ui, sans-serif; color: var(--danger); cursor: pointer; }
.lnk:hover { text-decoration: underline; }
.toast { display: inline-block; background: var(--text); color: #fff; padding: 9px 14px; border-radius: 8px; font-size: 14px; margin: 0 0 18px; }
.toast b { color: #8ce99a; margin-right: 6px; }
.cnt { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.btn:disabled { opacity: 0.6; cursor: progress; }

.hint { font-size: 13px; color: var(--muted); margin: 6px 0 20px; }
.err { font-size: 13px; color: var(--danger); margin: 6px 0 20px; }
.alert-bar { margin: 0 0 20px; padding: 12px 14px; border: 1px solid #e8b4b4; border-left: 4px solid var(--danger); border-radius: 8px; background: #fdf3f3; color: var(--text); font-size: 14px; line-height: 1.45; }
.alert-bar b { color: var(--danger); }
.alert-bar .why { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.ok { font-size: 13px; color: var(--view); margin: 6px 0 20px; }

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.row { display: flex; align-items: center; gap: 14px; padding: 13px 18px; margin: 0; }
.row + .row { border-top: 1px solid var(--line); }
.nm { flex: 1; min-width: 0; }
.nm b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.muted { color: var(--muted); font-size: 13px; }

.dlg {
  width: min(440px, calc(100vw - 32px));
  border: 0;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(29, 36, 51, 0.3);
}
.dlg::backdrop { background: rgba(29, 36, 51, 0.5); }
.dlg h2 { font-size: 20px; font-weight: 700; margin: 0 0 8px; overflow-wrap: anywhere; }
.dlg-text { color: var(--muted); font-size: 14px; margin: 0; }
.dlg .err { margin: 12px 0 0; }
.dlg-ft { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* Bare pages (sign-in): no app bar, a centred card on a dotted canvas. */
body.bare { background: var(--bg) radial-gradient(#d8dde7 1px, transparent 1px) 0 0 / 20px 20px; }
body.bare .bar { display: none; }
body.bare .main { padding-top: 90px; }
.card {
  display: block;
  max-width: 400px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
}
.card h1 { font-size: 24px; margin-bottom: 6px; }
.card .sub { font-size: 14px; margin-bottom: 22px; }
.card .progress { font-size: 13px; color: var(--muted); margin: -10px 0 0; }
.card a.btn { display: block; text-align: center; text-decoration: none; }
.card label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.card .input { width: 100%; }
.card .hint, .card .err, .card .ok { margin: 8px 0 0; }
.logo.lg { margin-bottom: 20px; gap: 4px; }
.logo.lg i { width: 14px; height: 22px; border-radius: 3px; }
.btn.wide { display: block; width: 100%; margin-top: 16px; padding: 10px 16px; font-size: 15px; }
.inline-lnk { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--primary); cursor: pointer; }
.inline-lnk:hover { text-decoration: underline; }
.env {
  display: block; position: relative; overflow: hidden;
  width: 56px; height: 40px; margin-bottom: 20px;
  border: 2px solid var(--view); border-radius: 6px;
}
.env::after {
  content: ""; position: absolute; left: 6px; top: -22px;
  width: 40px; height: 40px; border: 2px solid var(--view); transform: rotate(45deg);
}

[hidden] { display: none !important; }

.signing-in { text-align: center; padding-top: 30px; }
.signing-in h1 { font-size: 22px; margin: 22px 0 6px; }
.logo.bounce { display: inline-flex; gap: 5px; align-items: flex-end; }
.logo.bounce i { width: 14px; height: 22px; border-radius: 3px; }
.logo.bounce .e { height: 30px; }
@media (prefers-reduced-motion: no-preference) {
  .logo.bounce i { animation: bounce 1s ease-in-out infinite alternate; }
  .logo.bounce .e { animation-delay: 0.2s; }
  .logo.bounce .v { animation-delay: 0.4s; }
  @keyframes bounce { to { transform: translateY(-6px); } }
}
.ic {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; margin-bottom: 18px;
  font-weight: 700; border: 2px solid currentColor;
}
.ic.warn { color: var(--event); }
.ic.bad { color: var(--danger); }
a.btn { text-align: center; }

.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumb a:hover { text-decoration: underline; }
.av { flex: none; }
.av.b { background: var(--muted); }
.role { font-size: 12px; padding: 2px 10px; border-radius: 99px; background: #e7f0ff; color: var(--primary); font-weight: 600; }
.role.m { background: #eef1f6; color: var(--muted); }

.board-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
}
.board-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.board-card .strip {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px;
  padding: 14px; background: #f7f9fc; border-bottom: 1px solid var(--line);
}
.board-card .strip i { height: 14px; border-radius: 3px; background: var(--line); }
.board-card .strip .c { background: var(--command); }
.board-card .strip .e { background: var(--event); }
.board-card .strip .v { background: var(--view); }
.board-card .bd { padding: 14px 16px; }
.board-card h2 { font-size: 16px; font-weight: 650; margin: 0; overflow-wrap: anywhere; }
.board-card .muted { margin: 2px 0 0; }
.board-card .acts { display: flex; gap: 14px; margin-top: 10px; font-size: 14px; }
.tag { white-space: nowrap; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #eef1f6; color: var(--muted); }
.tag.sh { background: #ebf7ee; color: #2b8a3e; }

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 4px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 0; }
.field-label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
.input.wide { width: 100%; }

.narrow { max-width: 640px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.panel h2 { font-size: 16px; font-weight: 650; margin: 0 0 12px; }
.panel .hint, .panel .err, .panel .ok { margin: 6px 0 0; }
.panel .muted { font-size: 14px; margin: 0; }

.page-head .inline-lnk { font-size: 14px; padding-bottom: 8px; }
.mini { display: grid; grid-template-columns: repeat(4, 8px); gap: 2px; opacity: 0.45; flex: none; }
.mini i { height: 10px; border-radius: 2px; background: #cfd5e1; }

@media (max-width: 520px) {
  .bar { padding: 10px 16px; }
  .main { padding: 20px 16px; }
}

/* Board canvas (chapter 3) */
a.btn { display: inline-block; }
.board-card h2 a:hover { text-decoration: underline; }
.board-card .acts { align-items: center; }
body.full { overflow-x: clip; }
body.full .main { max-width: 100%; overflow-x: clip; padding: 16px 24px 24px; }
body.wide .main { max-width: 1180px; }
body.wide allow-email-form, body.wide .sub { max-width: 720px; }
.canvas-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; row-gap: 8px; margin: 6px 0 12px; }
.canvas-tools .inline-lnk { font-size: 14px; }
.canvas-tools > :not(.sp) { flex-shrink: 0; }
.canvas-tools .btn { white-space: nowrap; }
.canvas {
  position: relative; overflow: auto; height: calc(100vh - 190px); min-height: 360px;
  background: var(--bg) radial-gradient(#d8dde7 1px, transparent 1px) 0 0 / 20px 20px;
  border: 1px solid var(--line); border-radius: 10px;
}
.canvas:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.canvas-plane { position: relative; min-width: 3000px; min-height: 2000px; }
.canvas-msg { position: absolute; left: 24px; top: 20px; margin: 0; font-size: 14px; }
.chapter {
  position: absolute; background: var(--surface); border: 1px solid #d5dbe6; border-radius: 10px;
  padding: 12px 14px; box-shadow: 0 2px 8px rgba(29, 36, 51, 0.06); min-width: 200px;
}
.chapter .t { font-size: 15px; font-weight: 650; margin: 0 0 8px; overflow-wrap: anywhere; max-width: 32ch; }
.chapter.draft { border: 2px solid var(--primary); box-shadow: 0 10px 30px rgba(47, 111, 237, 0.18); cursor: grab; touch-action: none; }
.chapter.draft.dragging { cursor: grabbing; opacity: 0.9; }
.chapter .name-in {
  display: block; border: 2px solid var(--primary); border-radius: 6px; padding: 3px 8px; margin-bottom: 8px;
  font: 600 15px system-ui, sans-serif; color: var(--text); min-width: 180px; width: 100%;
}
.chapter .name-in:focus { outline: none; }
.chapter .lanes { display: grid; grid-template-columns: auto repeat(var(--slices, 1), 40px); gap: 4px 8px; align-items: center; font-size: 11px; color: var(--muted); }
.chapter .lanes .cell { height: 14px; border-radius: 3px; background: #eef1f6; }
.chapter .lanes .cell.screen { background: var(--surface); border: 1px solid #cfd5e1; }
.chapter .hint, .chapter .err { font-size: 12px; margin: 8px 0 0; max-width: 24ch; }
board-canvas { display: block; }
.chapter .g { display: grid; grid-template-columns: repeat(4, 40px); gap: 4px; }
.chapter .g i { height: 14px; border-radius: 3px; background: #eef1f6; }
.chapter .g i.s { background: var(--surface); border: 1px solid #cfd5e1; }
.chapter .g i.c { background: var(--command); }
.chapter .g i.v { background: var(--view); }
.chapter .g i.e { background: var(--event); }
.chapter .t.editable { cursor: text; border-radius: 4px; }
.chapter .t.editable:hover { background: #eef1f6; }
.chapter .t.editable:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.chapter .rename .name-in { margin-bottom: 4px; min-width: 200px; }
.chapter .rename .name-in[aria-invalid="true"] { border-color: var(--danger); }
.chapter .rename .hint, .chapter .rename .err { margin: 0 0 8px; }
move-chapter + [data-chapter-count]::before { content: "·"; margin-right: 10px; }
.chapter[data-chapter-id] .t { cursor: grab; touch-action: none; user-select: none; }
.chapter.lifted { box-shadow: 0 18px 40px rgba(29, 36, 51, 0.22); transform: rotate(-1deg); z-index: 2; }
.chapter.lifted .t { cursor: grabbing; }
.chapter.ghost { background: transparent; border: 2px dashed #cfd5e1; box-shadow: none; min-width: 0; }
.canvas-plane .pos { position: absolute; z-index: 3; background: var(--text); color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 6px; pointer-events: none; }
.chapter [data-move-error] { margin: 8px 0 0; }
.chapter .t { padding-right: 28px; }
.ch-menu-btn {
  position: absolute; top: 8px; right: 8px; border: 0; background: none; border-radius: 6px;
  padding: 2px 6px; font: 700 14px system-ui, sans-serif; letter-spacing: 1px; color: var(--muted); cursor: pointer;
}
.ch-menu-btn:hover, .ch-menu-btn[aria-expanded="true"] { background: #eef1f6; color: var(--text); }
.ch-menu {
  position: absolute; top: 36px; right: -150px; z-index: 4; width: 190px; padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 30px rgba(29, 36, 51, 0.18);
}
.ch-menu button {
  display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 6px;
  font: 14px system-ui, sans-serif; color: var(--text); cursor: pointer;
}
.ch-menu button:hover, .ch-menu button:focus-visible { background: #eef1f6; outline: none; }
.ch-menu button.dz { color: var(--danger); font-weight: 600; }
.ch-menu button.dz:hover, .ch-menu button.dz:focus-visible { background: #fdf1f1; }

/* Chapter grid (chapter 4) */
.grid-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; row-gap: 8px; margin: 4px 0 14px; position: relative; }
.grid-tools h1 { font-size: 22px; margin: 0 12px 0 0; max-width: 100%; overflow-wrap: anywhere; }
.grid-tools > :not(.sp) { flex-shrink: 0; }
.grid-tools .btn { white-space: nowrap; }
.grid-zoom { display: inline-flex; align-items: stretch; border-radius: 6px; overflow: hidden; background: var(--surface); }
.grid-zoom button {
  height: 32px; border: 1px solid #cfd5e1; border-radius: 0; background: var(--surface);
  color: var(--text); padding: 0 10px; font: 600 14px/1 system-ui, sans-serif; cursor: pointer;
}
.grid-zoom button + button { border-left-width: 0; }
.grid-zoom [data-zoom-reset] { min-width: 58px; font-variant-numeric: tabular-nums; text-align: center; }
.grid-zoom button[aria-disabled="true"] { color: #9aa3b2; background: #eef1f6; cursor: default; }
.grid-zoom button[aria-disabled="true"]:hover { color: #9aa3b2; background: #eef1f6; }
.grid-zoom button:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
.cgrid-wrap {
  --cgrid-rail: 40px;
  --cgrid-cell-w: 400px;
  --cgrid-cell-pad-x: 32px;
  --cgrid-cell-pad-top: 40px;
  --cgrid-cell-pad-bottom: 24px;
  --cgrid-spec-pad-x: 16px;
  --cgrid-lane-min: 184px;
  --cgrid-el-gap: 16px;
  --grid-line: #b8c0cd;
  --lane-sep: #7d8798;
  --rail-bg: #f1f3f7;
  --head-bg: #f8f9fb;
  --tint-actor: #fafbfc;
  --tint-auto: #f7f8fa;
  --tint-sys: #f4f8ff;
  --tint-ev: #fff8ef;
  --tint-ext: #fdf5f9;
  --lane-title-c: #8a93a3;
  --badge-bg: #eef1f6;
  --badge-bd: #b8c0cd;
  --badge-c: #3d4556;
  --el-r: 8px;
  --el-head-h: 36px;
  --el-pad-x: 12px;
  --el-row-h: 24px;
  --el-max-rows: 3;
  --el-tg-h: 28px;
  --el-thumb-h: 128px;
  --el-name-c: #4a5263;
  --el-tg-c: #1f4fb5;
  --el-div: #e3e7ef;
  --el-shadow: 0 1px 2px rgba(29, 36, 51, 0.10), 0 1px 1px rgba(29, 36, 51, 0.06);
  --el-shadow-hover: 0 6px 16px -4px rgba(29, 36, 51, 0.24), 0 1px 3px rgba(29, 36, 51, 0.12);
  --el-shadow-float: 0 20px 44px -10px rgba(29, 36, 51, 0.45), 0 6px 14px -2px rgba(29, 36, 51, 0.18);
  --el-float-z: 40;
  --cmd-band: #bcd6fb; --cmd-ink: #0b2a5b; --cmd-edge: #4f80cc; --cmd-pill: #eaf2ff;
  --ev-band: #f8b35e; --ev-ink: #3a1d00; --ev-edge: #b8691a; --ev-pill: #fff1df;
  --rm-band: #b3dfbf; --rm-ink: #0b3a1a; --rm-edge: #3f8a55; --rm-pill: #e7f5eb;
  --au-band: #dfe3ea; --au-ink: #1d2433; --au-edge: #7d8798;
  --ex-band: #f3c4dd; --ex-ink: #4a0f2e; --ex-edge: #b8507f; --ex-pill: #fcebf4;
  --ui-band: #eef1f6; --ui-ink: #1d2433; --ui-edge: #7d8798;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  isolation: isolate;
  overflow-x: auto; overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  min-width: 0; max-width: 100%; padding-bottom: 8px;
  scroll-padding-left: var(--cgrid-rail);
  background: var(--surface); box-shadow: 0 0 0 1px var(--line); border-radius: 10px;
  scrollbar-width: auto;
}
.cgrid-wrap:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
@media (max-width: 767px) {
  .cgrid-wrap {
    --cgrid-cell-w: min(400px, calc(100vw - var(--cgrid-rail) - 16px));
    --cgrid-cell-pad-x: 16px;
    --cgrid-spec-pad-x: 8px;
    border-radius: 0;
    scroll-snap-type: x proximity;
  }
  body.full:has(.grid-layout) .main { padding-left: 0; padding-right: 0; }
  .grid-tools, .crumb, .conn-warn { padding-left: 16px; padding-right: 16px; }
}
.cgrid {
  display: grid; width: max-content; min-height: 56px; position: relative;
  isolation: isolate;
  z-index: 1;
  transform: scale(var(--cgrid-zoom, 1));
  transform-origin: 0 0;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--surface);
  grid-template-columns: var(--cgrid-rail) repeat(var(--slices, 0), var(--cgrid-cell-w));
  grid-template-rows: auto;
  grid-auto-rows: minmax(var(--cgrid-lane-min), auto);
}
.cgrid .sh, .cgrid .ce { box-shadow: inset -1px 0 var(--grid-line), inset 0 -1px var(--lane-sep); }
.cgrid-rail {
  position: sticky; left: 0; z-index: 3;
  width: calc(var(--cgrid-rail) * var(--cgrid-zoom, 1));
  height: 0;
  overflow: visible;
  pointer-events: none;
}
.cgrid-wrap:has(.el.is-open) .cgrid { z-index: 4; }
.cgrid-rail-inner {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  width: var(--cgrid-rail);
  transform: scale(var(--cgrid-zoom, 1));
  transform-origin: 0 0;
  background: var(--rail-bg); border-right: 1px solid var(--lane-sep);
}
.cgrid-rail .corner { min-height: 56px; box-sizing: border-box; }
.cgrid-rail .lh { box-sizing: border-box; width: var(--cgrid-rail); }
@media (prefers-reduced-motion: no-preference) { .cgrid-rail-inner { transition: box-shadow 0.12s ease-out; } }
.cgrid-wrap.is-scrolled .cgrid-rail-inner { box-shadow: 6px 0 8px -6px rgba(29, 36, 51, 0.30); }
.cgrid-rail .corner, .cgrid .corner { box-shadow: inset 0 -1px var(--lane-sep); }
.cgrid-wrap.is-scrolled .cgrid-rail .corner { box-shadow: inset 0 -1px var(--lane-sep), 6px 0 8px -6px rgba(29, 36, 51, 0.30); }
.cgrid-rail .lh, .cgrid .lh {
  position: relative;
  display: flex; flex-direction: column; align-items: center; padding: 8px 0; min-width: 0;
}
.cgrid-rail .lh .lane-l, .cgrid-rail .lh .lane-sz, .cgrid .lh .lane-l, .cgrid .lh .lane-sz {
  writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap;
  font-size: 11px; font-weight: 600; line-height: 16px; letter-spacing: 0.08em;
  text-transform: uppercase; color: #3d4556;
}
.cgrid-rail .lh .lane-l, .cgrid .lh .lane-l {
  position: absolute; top: 40px; bottom: 8px; left: 50%; width: 16px; margin-left: -8px;
  overflow: hidden; text-overflow: ellipsis; text-align: center;
}
.cgrid-rail .lh .lane-sz, .cgrid .lh .lane-sz { visibility: hidden; margin-top: 8px; max-height: calc(var(--cgrid-lane-min) - 48px); overflow: hidden; }
.cgrid .sh {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 8px 16px; min-height: 56px; min-width: 0; background: var(--head-bg); scroll-snap-align: start;
}
.cgrid .sh-k {
  flex: none; display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px;
  border-radius: 6px; background: #e3e8f0; color: var(--text); font: 700 12px/1 var(--mono);
}
.cgrid .sh-b { min-width: 0; }
.cgrid .sh b { display: block; font-size: 14px; line-height: 20px; font-weight: 700; overflow-wrap: anywhere; }
.cgrid .chip { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 9px; background: #eef1f6; color: var(--muted); }
.cgrid .ce {
  position: relative; min-width: 0; display: flex; flex-direction: column;
  align-items: stretch; justify-content: flex-start; gap: var(--cgrid-el-gap);
  padding: var(--cgrid-cell-pad-top) var(--cgrid-cell-pad-x) var(--cgrid-cell-pad-bottom);
  background-color: var(--lane-bg, var(--surface));
  background-image: radial-gradient(#d3d9e3 1px, transparent 1.2px); background-size: 16px 16px; background-position: 8px 8px;
}
.cgrid .ce[data-lane-kind="actor"] { --lane-bg: var(--tint-actor); }
.cgrid .ce[data-lane-kind="automation"] { --lane-bg: var(--tint-auto); }
.cgrid .ce[data-lane-kind="system boundary"] { --lane-bg: var(--tint-sys); padding-bottom: calc(var(--cgrid-cell-pad-bottom) + 56px); }
.cgrid .ce[data-lane-kind="event"] { --lane-bg: var(--tint-ev); }
.cgrid .ce[data-lane-kind="external events"] { --lane-bg: var(--tint-ext); }
.cgrid .ce-lane {
  position: absolute; z-index: 2; top: 10px; left: 50%; transform: translateX(-50%);
  max-width: calc(100% - 112px); pointer-events: none; user-select: none;
  font-size: 11px; line-height: 20px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--el-name-c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 6px; border-radius: 4px; background: var(--lane-bg, var(--surface));
}
.cgrid .lane-ico { width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; }
.cgrid .cgrid-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2; box-sizing: border-box;
  height: 20px; width: 28px; min-width: 28px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  font: 600 11px/1 var(--mono); font-variant-numeric: tabular-nums;
  color: var(--badge-c); background: var(--badge-bg); border: 1px solid var(--badge-bd); border-radius: 6px;
  pointer-events: none;
}
.cgrid .nw { background-color: #f3f7ff; }
.cgrid .sh .name-in { display: block; width: 100%; border: 2px solid var(--primary); border-radius: 6px; padding: 4px 8px; font: 13px system-ui, sans-serif; margin-bottom: 6px; }
.cgrid .sh .name-in:focus { outline: none; }
.cgrid .sh .x { color: var(--muted); font-size: 12px; margin-left: 6px; }
.cgrid .sh .err { font-size: 12px; margin: 6px 0 0; }
chapter-grid { display: block; }
.chapter { cursor: pointer; }
.chapter .open-grid { display: block; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--primary); }
.chapter .open-grid:hover { text-decoration: underline; }
.cgrid [data-slice-name].editable, .cgrid [data-lane-name].editable { cursor: text; border-radius: 4px; }
.cgrid [data-slice-name].editable:hover, .cgrid [data-lane-name].editable:hover { background: #eef1f6; }
.cgrid .inline-edit .name-in { display: block; width: 100%; border: 2px solid var(--primary); border-radius: 6px; padding: 3px 8px; font: 600 13px system-ui, sans-serif; }
.cgrid .inline-edit .name-in:focus { outline: none; }
.cgrid .inline-edit .name-in[aria-invalid="true"] { border-color: var(--danger); }
.cgrid .inline-edit .hint, .cgrid .inline-edit .err { font-size: 11px; margin: 3px 0 0; }
.cgrid { position: relative; }
.cgrid .sh[data-slice-id] { cursor: grab; user-select: none; touch-action: none; }
.cgrid .gh { opacity: 0.35; outline: 2px dashed #9aa3b2; outline-offset: -4px; }
.cgrid .slice-ins { position: absolute; top: 0; bottom: 0; width: 5px; background: var(--primary); border-radius: 3px; z-index: 3; pointer-events: none; }
.slice-drag {
  position: fixed; z-index: 10; width: 170px; padding: 9px 12px; background: var(--surface); border: 2px solid var(--primary);
  border-radius: 8px; box-shadow: 0 10px 24px rgba(29, 36, 51, 0.22); transform: rotate(-2deg); pointer-events: none; font-size: 13px;
}
.slice-drag b { display: block; }
.slice-drag .chip { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 9px; background: #eef1f6; color: var(--muted); }
.slice-pos { position: fixed; z-index: 10; background: var(--text); color: #fff; font-size: 12px; padding: 3px 9px; border-radius: 12px; pointer-events: none; }
.cgrid .sh [data-move-error] { font-size: 11px; margin: 4px 0 0; }
.cgrid .sh { position: relative; }
.cgrid .sh.op { outline: 2px solid var(--primary); outline-offset: -2px; z-index: 4; }
add-lane-button { position: relative; }
add-lane-button .btn.on { outline: 2px solid var(--primary); outline-offset: 1px; }
.lane-pop {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 6; width: 290px; padding: 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(29, 36, 51, 0.18);
}
.lane-pop h2 { font-size: 15px; margin: 0 0 10px; }
.lane-pop .seg { display: flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; margin-bottom: 10px; }
.lane-pop .seg button { flex: 1; border: 0; background: var(--surface); padding: 6px; font: 13px system-ui, sans-serif; color: var(--muted); cursor: pointer; }
.lane-pop .seg button[aria-checked="true"] { background: var(--primary); color: #fff; font-weight: 600; }
.lane-pop .input { margin: 0; }
.lane-pop .hint, .lane-pop .err { font-size: 12px; margin: 6px 0 10px; }
.cgrid .lh.nw, .cgrid-rail .lh.nw { color: var(--primary); }
.cgrid .lh.nw .lane-l, .cgrid-rail .lh.nw .lane-l { color: var(--primary); }
.cgrid .lh .inline-edit, .cgrid-rail .lh .inline-edit {
  position: absolute; left: calc(100% + 8px); top: 8px; z-index: 6; width: 220px;
  padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 20px rgba(29, 36, 51, 0.16);
}
.inline-edit.pop {
  position: fixed; z-index: 40; width: 220px;
  padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 20px rgba(29, 36, 51, 0.16);
}
.cgrid .lh .inline-edit .name-in, .cgrid-rail .lh .inline-edit .name-in, .inline-edit.pop .name-in { font-weight: 600; writing-mode: horizontal-tb; transform: none; }
.cgrid .lh .lane-more, .cgrid-rail .lh .lane-more {
  flex: none; width: 24px; height: 24px; display: grid; place-items: center;
  border: 0; background: none; border-radius: 4px; padding: 0;
  font: 16px/1 system-ui, sans-serif; letter-spacing: 0; color: var(--muted); cursor: pointer;
}
.cgrid .lh .lane-more:hover, .cgrid .lh .lane-more:focus-visible,
.cgrid-rail .lh .lane-more:hover, .cgrid-rail .lh .lane-more:focus-visible { background: #eef1f6; color: var(--text); }
.cgrid .lh .lane-more:focus-visible, .cgrid-rail .lh .lane-more:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

/* Elements on the grid (chapter 5) */
.grid-layout { display: flex; gap: 0; align-items: flex-start; min-width: 0; max-width: 100%; }
.grid-layout chapter-grid { flex: 1; min-width: 0; max-width: 100%; }
.side-panel {
  position: sticky; top: 12px; width: 360px; flex: none; margin-left: 16px; max-height: calc(100vh - 120px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; box-shadow: 0 6px 18px rgba(29, 36, 51, 0.08);
}
.side-panel[hidden] { display: none; }
.side-panel .pnl-x { float: right; border: 0; background: none; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 2px; }
.side-panel h2 { font-size: 17px; margin: 0 0 2px; overflow-wrap: anywhere; }
.side-panel .tg { font-size: 12px; color: var(--muted); margin: 0 0 14px; }
.side-panel .hint { font-size: 12px; color: var(--muted); margin: 12px 0 0; }
.side-panel .err { font-size: 12px; margin: 10px 0 0; }
.side-panel .opts { display: flex; flex-wrap: wrap; gap: 8px; }
.side-panel .opt { flex: 1; min-width: 120px; padding: 12px 10px; border-radius: 8px; border: 0; font: 600 13px system-ui, sans-serif; color: var(--text); cursor: pointer; }
.side-panel .opt:hover, .side-panel .opt:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.side-panel .opt:disabled { opacity: 0.6; cursor: default; }
.cgrid .ce { cursor: pointer; }
.cgrid .ce:has(.el) { cursor: default; }
.cgrid .el, .cgrid .scn { width: 100%; min-width: 0; }
.cgrid .ce:not(:has(.el)):hover { background-color: color-mix(in srgb, var(--lane-bg, var(--surface)) 92%, #1d2433); }
.cgrid .ce.pick { outline: 2px dashed var(--primary); outline-offset: -3px; background-color: #f3f7ff; }
/* Quick-add strip: the element types an empty cell offers, in its upper-left corner. */
.cgrid .ce.pick .ce-lane { visibility: hidden; }
.cgrid .ce-add {
  position: absolute; z-index: 4; top: 8px; left: 8px; right: 44px;
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; cursor: default;
}
.cgrid .ce-add-b {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 9px;
  border: 1px solid var(--edge, #7d8798); border-radius: 8px; box-shadow: 0 1px 2px rgba(29, 36, 51, 0.12);
  font: 600 13px/1 system-ui, sans-serif; color: var(--ink, var(--text)); cursor: pointer;
}
.cgrid .ce-add-b svg { width: 12px; height: 12px; flex: none; }
.cgrid .ce-add-b.k-cmd { --edge: var(--cmd-edge); --ink: var(--cmd-ink); background: var(--cmd-band); }
.cgrid .ce-add-b.k-rm { --edge: var(--rm-edge); --ink: var(--rm-ink); background: var(--rm-band); }
.cgrid .ce-add-b.k-ev { --edge: var(--ev-edge); --ink: var(--ev-ink); background: var(--ev-band); }
.cgrid .ce-add-b.k-ext { --edge: var(--ex-edge); --ink: var(--ex-ink); background: var(--ex-band); }
.cgrid .ce-add-b.k-auto { --edge: var(--au-edge); --ink: var(--au-ink); background: var(--au-band); }
.cgrid .ce-add-b.k-ui { --edge: var(--ui-edge); --ink: var(--ui-ink); background: var(--ui-band); }
.cgrid .ce-add-b:hover { filter: brightness(0.96); }
.cgrid .ce-add-b:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.cgrid .ce-add-b:disabled { opacity: 0.6; cursor: default; }
.cgrid .ce-add-why { margin: 0; padding: 6px 10px; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--grid-line); border-radius: 8px; }
.cgrid .ce-add .err { flex-basis: 100%; margin: 0; font-size: 12px; }
@media (pointer: coarse) { .cgrid .ce-add-b { height: 44px; } }
.cgrid .el, .el-drag .el {
  position: relative; z-index: 3; min-height: 40px; background: var(--surface);
  border: 1px solid var(--edge, #7d8798); border-radius: var(--el-r); cursor: pointer;
  overflow-wrap: anywhere; box-shadow: var(--el-shadow); color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.cgrid .el.k-cmd, .el-drag .el.k-cmd { --band: var(--cmd-band); --ink: var(--cmd-ink); --edge: var(--cmd-edge); --pill: var(--cmd-pill); }
.cgrid .el.k-ev, .el-drag .el.k-ev { --band: var(--ev-band); --ink: var(--ev-ink); --edge: var(--ev-edge); --pill: var(--ev-pill); }
.cgrid .el.k-rm, .el-drag .el.k-rm { --band: var(--rm-band); --ink: var(--rm-ink); --edge: var(--rm-edge); --pill: var(--rm-pill); }
.cgrid .el.k-auto, .el-drag .el.k-auto { --band: var(--au-band); --ink: var(--au-ink); --edge: var(--au-edge); }
.cgrid .el.k-ext, .el-drag .el.k-ext { --band: var(--ex-band); --ink: var(--ex-ink); --edge: var(--ex-edge); --pill: var(--ex-pill); }
.cgrid .el.k-ui, .el-drag .el.k-ui { --band: var(--ui-band); --ink: var(--ui-ink); --edge: var(--ui-edge); }
@media (hover: hover) {
  .cgrid .el:hover { box-shadow: var(--el-shadow-hover); border-color: var(--ink); }
  .cgrid .el-tg:hover { background: #f3f6fb; }
  .cgrid .el-tg:hover .tg-l { text-decoration: underline; text-underline-offset: 2px; }
}
.cgrid .el-h, .el-drag .el-h {
  display: flex; align-items: flex-start; gap: 8px; min-height: var(--el-head-h);
  padding: 8px var(--el-pad-x); background: var(--band); color: var(--ink);
  border-radius: calc(var(--el-r) - 1px) calc(var(--el-r) - 1px) 0 0;
}
.cgrid .el.k-auto .el-h, .cgrid .el-h:only-child, .el-drag .el.k-auto .el-h, .el-drag .el-h:only-child {
  border-radius: calc(var(--el-r) - 1px);
}
.cgrid .el-i, .el-drag .el-i { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.cgrid .el-n, .el-drag .el-n {
  flex: 1; min-width: 0; font-size: 13px; line-height: 20px; font-weight: 650; overflow-wrap: anywhere;
}
.cgrid .el:not(.is-open) .el-n { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.cgrid .el .el-f, .el-drag .el .el-f {
  margin: 0; padding: 6px var(--el-pad-x);
  display: grid; grid-template-columns: fit-content(42%) minmax(0, 1fr); font-size: 12px;
}
.cgrid .el .fr, .el-drag .el .fr {
  grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center;
  min-height: var(--el-row-h); border-top: 1px solid var(--el-div);
}
.cgrid .el .fr:first-child, .el-drag .el .fr:first-child { border-top: 0; }
.cgrid .el .fr[hidden], .el-drag .el .fr[hidden] { display: none; }
.cgrid .el .fr dt, .el-drag .el .fr dt {
  padding-right: 8px; color: var(--el-name-c); line-height: 16px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cgrid .el .fr dd, .el-drag .el .fr dd {
  margin: 0; min-width: 0; padding: 2px 0 2px 8px; border-left: 1px solid var(--el-div);
}
.cgrid .el .fv, .el-drag .el .fv {
  display: inline-block; max-width: 100%; vertical-align: middle; padding: 1px 6px; border-radius: 4px;
  background: var(--pill, #f1f3f7); color: var(--text); font: 500 12px/18px var(--mono);
}
.cgrid .el .fv.nv, .el-drag .el .fv.nv {
  background: none; padding: 1px 2px; color: var(--el-name-c); font-family: system-ui, sans-serif; font-weight: 400;
}
.cgrid .el-f[data-state="collapsed"] .fv { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cgrid .el-f[data-state="collapsed"] wbr { display: none; }
.cgrid .el-f[data-state="expanded"] .fv { overflow-wrap: anywhere; }
.cgrid .el-f[data-state="expanded"] dt { white-space: normal; overflow-wrap: anywhere; }
.cgrid .el-empty, .el-drag .el-empty {
  margin: 0; padding: 8px var(--el-pad-x); font-size: 12px; line-height: 16px; color: var(--el-name-c);
}
.cgrid .el-tg, .el-drag .el-tg {
  all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 4px;
  width: 100%; height: var(--el-tg-h);
  border-top: 1px solid var(--el-div); border-radius: 0 0 calc(var(--el-r) - 1px) calc(var(--el-r) - 1px);
  font: 600 12px/1 system-ui, sans-serif; color: var(--el-tg-c); cursor: pointer;
  touch-action: auto; user-select: none; -webkit-tap-highlight-color: transparent;
}
.cgrid .el-tg:active { background: #e8edf6; }
.cgrid .el-tg:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
.cgrid .el-tg .chev, .el-drag .el-tg .chev { width: 14px; height: 14px; flex: none; }
.cgrid .el-tg[aria-expanded="true"] .chev { transform: rotate(180deg); }
.cgrid .el.sel { outline: 2px solid var(--primary); outline-offset: 2px; }
.cgrid .el:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.cgrid .el .lk, .el-drag .el .lk { font-style: normal; margin-right: 3px; }
.cgrid .el-ph { flex: none; border-radius: var(--el-r); border: 1px dashed transparent; }
.cgrid .el.is-open {
  position: absolute; z-index: var(--el-float-z); display: flex; flex-direction: column;
  border-color: var(--ink); box-shadow: 0 0 0 1px rgba(29, 36, 51, 0.12), var(--el-shadow-float); cursor: default;
}
.cgrid .el.is-open .el-b { overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
.cgrid .el.is-open.is-scroll .el-b { scrollbar-gutter: stable; }
.cgrid .el-b:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
.cgrid .el.is-open .el-h, .cgrid .el.is-open .el-tg { flex: none; }
.cgrid .el-scrim {
  position: absolute; inset: 0; z-index: 39; background: rgba(29, 36, 51, 0.10);
  cursor: default; -webkit-tap-highlight-color: transparent;
}
.cgrid .el-scrim[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .cgrid .el-tg .chev { transition: transform 0.12s ease-out; }
  .cgrid .el.is-open { animation: el-pop 0.14s ease-out; }
  .cgrid .el.is-open[data-flip="up"] { animation-name: el-pop-up; }
  .cgrid .el-scrim { animation: el-fade 0.12s ease-out; }
}
@keyframes el-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes el-pop-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes el-fade { from { opacity: 0; } to { opacity: 1; } }
@media (pointer: coarse) { .cgrid-wrap { --el-tg-h: 44px; } }
.k-cmd { background: #cfe0ff; }
.k-ev { background: #ffe2b8; }
.k-rm { background: #d3ecd8; }
.k-ui { background: #fff; border: 1px solid #9aa3b2; }
.k-auto { background: #e9ecf2; }
.k-ext { background: #f6d6e8; }
.cgrid .chip.t-c { background: #e3ecfe; color: var(--command); }
.cgrid .chip.t-v { background: #e3f3e6; color: #2b8a3e; }
.cgrid .chip.t-a { background: #eef1f6; color: #3d4556; }
.cgrid .chip.t-x { background: #efeafb; color: #6b4fbf; }
.side-panel .ktag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.side-panel .ktag i { width: 10px; height: 13px; border-radius: 2px; }
.side-panel .ds { font-size: 13px; color: var(--muted); margin: 4px 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.side-panel .sec { border-top: 1px solid var(--line); padding: 10px 0; margin-top: 8px; }
.side-panel .sec:empty { display: none; }
.side-panel .lb { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.side-panel .fr { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 2px 0; }
.side-panel .fr b { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 500; overflow-wrap: anywhere; }
.side-panel .fr span { color: var(--muted); text-align: right; }
.side-panel .none { font-size: 12px; margin: 0; }
.side-panel .pl { font-size: 12px; padding: 3px 0; }
.side-panel .lkb { font-size: 10px; background: #eef1f6; color: var(--muted); border-radius: 8px; padding: 0 6px; margin-left: 6px; }
.side-panel .acts { display: flex; flex-wrap: wrap; gap: 8px; }
.side-panel .lnk { border: 0; background: none; color: var(--primary); font: 600 12px system-ui, sans-serif; cursor: pointer; padding: 0; }
.side-panel [data-element-title].editable { cursor: text; border-radius: 4px; }
.side-panel [data-element-title].editable:hover { background: #eef1f6; }
.side-panel .inline-edit .name-in { display: block; width: 100%; border: 2px solid var(--primary); border-radius: 6px; padding: 4px 8px; font: 600 16px system-ui, sans-serif; }
.side-panel .inline-edit .name-in:focus { outline: none; }
.side-panel .inline-edit .name-in[aria-invalid="true"] { border-color: var(--danger); }
.side-panel .inline-edit .hint, .side-panel .inline-edit .err { font-size: 11px; margin: 3px 0 6px; }
.side-panel textarea { display: block; width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font: 13px/1.45 system-ui, sans-serif; resize: vertical; }
.side-panel textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.side-panel .row-btns { display: flex; gap: 8px; margin-top: 8px; }
.side-panel .btn.sm { padding: 5px 12px; font-size: 13px; }
.side-panel [data-section="description"] { margin-bottom: 6px; }
.side-panel.wide { width: 520px; }
@media (max-width: 767px) {
  .side-panel, .side-panel.wide {
    position: fixed; top: 12px; left: 12px; right: 12px; width: auto; margin-left: 0;
    z-index: 30; max-height: calc(100vh - 24px);
  }
  add-lane-button { position: static; }
  .lane-pop { left: 0; width: min(290px, calc(100vw - 48px)); max-width: 100%; }
  .ch-menu { right: 8px; }
}
.side-panel .fhead, .side-panel .frow { display: grid; grid-template-columns: 1.2fr 0.9fr auto 1fr 18px; gap: 5px; align-items: center; }
.side-panel .fhead { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.side-panel .frow { margin-bottom: 5px; }
.side-panel .f { min-width: 0; width: 100%; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; font: 12px system-ui, sans-serif; background: var(--surface); }
.side-panel input.f[data-name] { font-family: ui-monospace, Menlo, Consolas, monospace; }
.side-panel .f.ex { border-style: dashed; }
.side-panel .f.bad { border: 2px solid var(--danger); }
.side-panel .flags { display: flex; gap: 3px; }
.side-panel .flag { padding: 1px 6px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: #9aa3b2; font: 10px system-ui, sans-serif; cursor: pointer; }
.side-panel .flag.y { background: var(--text); border-color: var(--text); color: #fff; }
.side-panel .rm { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 0; }
.side-panel .rm:hover { color: var(--danger); }
.side-panel textarea.code { font: 12px/1.6 ui-monospace, Menlo, Consolas, monospace; background: #1d2433; color: #e3e7ef; border-color: #1d2433; white-space: pre; }
.side-panel textarea.code.bad { outline: 2px solid var(--danger); }
.side-panel .meta { font-size: 11px; color: var(--muted); margin: 5px 0 8px; }
.side-panel .meta.over { color: var(--danger); }
.side-panel iframe.pv { display: block; width: 100%; height: 180px; border: 1px dashed #9aa3b2; border-radius: 8px; background: #fff; }
.cgrid .el .thumb, .el-drag .el .thumb {
  position: relative; height: 128px; overflow: hidden; background: #f7f8fb;
  border-radius: 0 0 calc(var(--el-r) - 1px) calc(var(--el-r) - 1px);
}
.cgrid .el .thumb > .wf, .cgrid .el .thumb > iframe,
.el-drag .el .thumb > .wf, .el-drag .el .thumb > iframe {
  position: absolute; left: 0; top: 0; border: 0;
  width: calc(100% / .62); height: calc(100% / .62);
  transform: scale(.62); transform-origin: 0 0;
  padding: 14px 20px; box-sizing: border-box;
  pointer-events: none;
}
.cgrid .el .thumb > .wf, .el-drag .el .thumb > .wf {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; line-height: 18px; color: var(--muted);
}
.cgrid .el .wf-t, .el-drag .el .wf-t { font-size: 15px; font-weight: 700; color: var(--text); }
.cgrid .el .wf-r, .el-drag .el .wf-r { display: flex; gap: 10px; align-items: center; width: 100%; }
.cgrid .el .wf-l, .el-drag .el .wf-l { flex: 1; font-size: 12px; line-height: 14px; }
.cgrid .el .wf-in, .el-drag .el .wf-in {
  flex: 1; min-width: 0; height: 28px; border: 1px solid #b8c0cd; border-radius: 4px;
  background: #fff; padding: 4px 8px; color: #3d4556; white-space: nowrap; overflow: hidden;
}
.cgrid .el .wf-btn, .el-drag .el .wf-btn {
  flex: none; padding: 4px 14px; border-radius: 4px; background: #2458c4; color: #fff; font-weight: 600;
}
.cgrid .el .wf-note, .el-drag .el .wf-note { font-size: 12px; color: var(--muted); }
.cgrid .el .wf-sp, .el-drag .el .wf-sp { flex: 1; }
.cgrid .el .thumb-empty, .el-drag .el .thumb-empty {
  margin: 0; height: 100%; display: grid; place-items: center;
  font-size: 12px; line-height: 16px; color: var(--el-name-c); text-align: center;
}
.pick-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--text); color: #fff; border-radius: 9px; padding: 9px 14px; font-size: 13px; margin-bottom: 12px; width: max-content; max-width: 100%; }
.pick-banner .kdot { width: 9px; height: 12px; border-radius: 2px; background: var(--event); }
.pick-banner .muted-l { color: #9aa3b2; }
.pick-banner .lnk { color: #8fb4ff; }
.pick-banner .pick-err { flex-basis: 100%; color: #ffb3b3; }
.cgrid.picking .ce { cursor: not-allowed; }
.cgrid.picking .ce.ok { cursor: copy; }
.cgrid.picking .ce.ok:hover { outline: 2px dashed var(--view); outline-offset: -3px; background-color: #f2faf3; }
.cgrid.picking .ce.no:hover { outline: 2px dashed var(--danger); outline-offset: -3px; background-color: #fff5f5; }
.cgrid .el { touch-action: none; user-select: none; }
.cgrid .el.moving { opacity: 0.35; outline: 2px dashed #9aa3b2; }
.el-drag { position: fixed; z-index: 20; pointer-events: none; }
.el-drag .el {
  opacity: 0.9; box-shadow: 0 8px 20px rgba(29, 36, 51, 0.25); min-height: 40px;
  border-radius: var(--el-r);
}
.el-drag .mini, .el-drag .thumb { display: none; }
.cgrid .ce.drop-ok { outline: 2px dashed var(--view); outline-offset: -3px; background-color: #f2faf3; }
.cgrid .ce.drop-no { outline: 2px dashed var(--danger); outline-offset: -3px; background-color: #fff5f5; }
.move-tip { position: fixed; z-index: 21; max-width: 260px; background: var(--surface); border: 1px solid #f1b5b5; border-radius: 8px; padding: 8px 11px; font-size: 12px; color: var(--danger); box-shadow: 0 6px 16px rgba(29, 36, 51, 0.12); }
.el-toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 10px; background: var(--text); color: #fff; padding: 11px 16px; border-radius: 9px; font-size: 13px; box-shadow: 0 8px 24px rgba(29, 36, 51, 0.25); }
.el-toast .ok { width: 18px; height: 18px; border-radius: 50%; background: var(--view); display: grid; place-items: center; font-size: 11px; }
.el-toast span { color: #9aa3b2; }
.side-panel .warn-box { background: #fff6e5; border: 1px solid #f5d08a; border-radius: 8px; padding: 9px 11px; font-size: 12px; margin: 6px 0 8px; }
/* Hand over only clean slices (chapter 10): a change sent Ready slices back to In progress */
.reopened-notice { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 31; display: flex; align-items: flex-start; gap: 10px; max-width: min(560px, calc(100vw - 32px)); background: #fff6e5; color: var(--text); border: 1px solid #f5d08a; padding: 10px 14px; border-radius: 9px; font-size: 13px; box-shadow: 0 8px 24px rgba(29, 36, 51, 0.18); }
.reopened-notice p { margin: 0; overflow-wrap: anywhere; }
.reopened-notice .bad { flex: none; width: 18px; height: 18px; border-radius: 50%; background: #e0a42b; color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.reopened-notice [data-dismiss-reopened] { flex: none; font-size: 16px; line-height: 1; }

/* Access tokens (chapter 6) */
.tokens-page { max-width: 760px; }
.token-dlg { width: min(560px, calc(100vw - 32px)); }
.token-key { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 9px 12px; margin-top: 12px; background: #fff6e5; border: 1px solid #f5d08a; border-radius: 8px; }
.token-key code { font: 13px ui-monospace, Menlo, monospace; overflow-wrap: anywhere; }
.token-h3 { font-size: 15px; margin: 18px 0 0; }
.token-cmd { background: var(--text); color: #e3e7ef; padding: 12px; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; font: 12px/1.5 ui-monospace, Menlo, monospace; }
.token-table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.token-table th, .token-table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.token-table tr:last-child td { border-bottom: 0; }
.token-table th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f7f9fc; }
.token-table code { font: 12px ui-monospace, Menlo, monospace; color: var(--muted); }
.token-table .revoked td { color: #8a93a5; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 8px; background: #e6f4ea; color: #2f9e44; white-space: nowrap; }
.pill.off { background: #eef1f6; color: var(--muted); }
.tokens-empty { text-align: center; padding: 36px 16px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.tokens-empty .btn { margin-top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.token-toast { position: fixed; right: 20px; bottom: 20px; z-index: 30; background: var(--text); color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 13px; border-left: 4px solid var(--view, #2f9e44); box-shadow: 0 8px 24px rgba(29, 36, 51, 0.25); }
.token-toast.warn { border-left-color: var(--danger); }

/* Scenarios (chapter 7): cards in the specifications lane, the scenario side panel */
.cgrid .ce[data-lane-kind="specifications"] {
  cursor: default; background-color: #fafbfd; overflow-x: hidden; min-width: 0; gap: 0;
  padding: var(--cgrid-cell-pad-top) var(--cgrid-spec-pad-x) var(--cgrid-cell-pad-bottom);
}
.cgrid .ce[data-lane-kind="specifications"]:hover { background-color: #fafbfd; }
.cgrid .ce[data-lane-kind="specifications"] .scn-count {
  position: absolute; top: 8px; left: var(--cgrid-spec-pad-x); margin: 0; line-height: 20px;
}
.scn-count { font-size: 11px; color: var(--muted); margin: 0 0 4px; }
.scn-empty { font-size: 11px; color: var(--muted); margin: 0; padding: 8px; border: 1px dashed #c9d0dc; border-radius: 6px; background: var(--surface); }
.scn { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 0; margin-bottom: 4px; font-size: 11px; min-width: 0; container-type: inline-size; }
.scn:hover { border-color: #b8c2d6; }
.scn.sel { outline: 2px solid var(--primary); outline-offset: 1px; }
.scn.flagged { border-color: #e6c36a; }
.scn-hd { margin: 0; font-size: inherit; font-weight: inherit; }
.scn-h {
  display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; min-height: 40px;
  margin: 0; padding: 4px 7px; border: 0; background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer; border-radius: 5px;
}
@media (pointer: coarse) { .scn-h { min-height: 44px; } }
.scn-h:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.scn:has(.scn-h:focus-visible) { outline: 2px solid #2563eb; outline-offset: 2px; }
.scn-chevron {
  flex: none; width: 0; height: 0;
  border-style: solid; border-width: 4px 0 4px 6px;
  border-color: transparent transparent transparent var(--muted);
  transform: rotate(0deg);
  transition: transform 0.15s ease;
}
.scn-h[aria-expanded="true"] .scn-chevron { transform: rotate(90deg); }
.scn-title {
  flex: 1 1 0%; min-width: 0; font-size: 12px; font-weight: 650; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: anywhere;
}
.scn-h[aria-expanded="true"] .scn-title {
  display: block; -webkit-box-orient: unset; -webkit-line-clamp: none;
  overflow: visible; overflow-wrap: anywhere;
}
.scn-hint { flex: none; }
.scn-dot { width: 8px; height: 8px; border-radius: 50%; display: block; box-sizing: border-box; }
.scn-dot.ev { background: var(--event); }
.scn-dot.err { background: var(--danger); }
.scn-dot.rm { background: var(--view); }
.scn-dot.none { background: transparent; border: 1.5px solid #9aa3b2; }
.scn-flag {
  display: inline-flex; align-items: center; gap: 3px; max-width: 100%;
  font-size: 10px; font-weight: 700; letter-spacing: 0.01em; line-height: 16px;
  color: #6b4500; background: #ffe9b0; border-radius: 4px; padding: 0 5px; white-space: nowrap;
}
.scn-flag-ico { font-family: "Segoe UI Symbol", "Apple Symbols", sans-serif; font-weight: 700; }
.scn-body { padding: 0 7px 7px; overflow-wrap: break-word; }
.scn-body[hidden] { display: none; }
.scn-open { display: inline-block; margin-top: 6px; font-size: 11px; color: #2563eb; }
.cgrid .lnk.scn-open { color: #2563eb; }
.gwt { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 2px 5px; min-width: 0; }
.gwt > span { color: var(--muted); }
.gwt > div { min-width: 0; overflow-wrap: break-word; }
.gwt code { display: block; font: 10.5px/1.4 ui-monospace, Menlo, Consolas, monospace; border-radius: 3px; padding: 2px 4px; margin-bottom: 1px; overflow-wrap: anywhere; }
.side-panel .gwt { grid-template-columns: 48px 1fr; font-size: 12px; }
.side-panel .gwt code { font-size: 12px; }
.scn-body .gwt { grid-template-columns: 38px minmax(0, 1fr); }
@container (max-width: 200px) {
  .scn-body .gwt { grid-template-columns: minmax(0, 1fr); }
}
.scn-body .gwt > div { overflow-wrap: anywhere; }
.scn-body .gwt code {
  min-width: 0; max-width: 100%;
  overflow-wrap: anywhere; word-break: normal; hyphens: none;
}
.scn-en { display: block; font-weight: 700; min-width: 0; overflow-wrap: anywhere; word-break: normal; }
.scn-body .gwt .scn-tok, .scn-rej .scn-tok { overflow-wrap: anywhere; max-width: 100%; }
.scn-f { display: block; min-width: 0; }
.scn-k { white-space: nowrap; }
.scn-f-tok { display: block; min-width: 0; }
.scn-f-tok .scn-tok { overflow-wrap: anywhere; }
.scn-f-wrap { overflow-wrap: anywhere; }
.scn-val { overflow-wrap: anywhere; }
.scn-proc {
  display: block; background: #e9ecf2; color: #3d4556; border-radius: 4px;
  padding: 3px 6px; font-weight: 650; margin-bottom: 1px;
}
.scn-rej { border: 1px solid var(--danger); border-radius: 4px; padding: 4px 6px; color: var(--danger); }
.scn-rej b { display: block; font: 650 11px ui-monospace, Menlo, Consolas, monospace; }
.scn-err { color: var(--danger); }
.scn-rows { display: block; color: var(--muted); font: 10.5px/1.4 ui-monospace, Menlo, Consolas, monospace; }
.scn-none { font-size: 11px; margin: 0; }
.scn-note { margin: 4px 0 0; color: var(--muted); font-style: italic; white-space: pre-wrap; overflow-wrap: anywhere; }
.scn-warn { font-size: 11px; margin: 5px 0 0; padding: 5px 7px; }
.add-scn { font-size: 12px; margin-top: 2px; }
.cgrid .lnk.add-scn { color: var(--primary); }
.cgrid .add-err { font-size: 11px; margin: 4px 0 0; }
@media (prefers-reduced-motion: reduce) {
  .scn-chevron { transition: none; }
}
.side-panel [data-scenario-heading].editable { cursor: text; border-radius: 4px; }
.side-panel [data-scenario-heading].editable:hover { background: #eef1f6; }
.steps-ed .k { font-size: 12px; font-weight: 650; color: var(--muted); margin: 10px 0 4px; }
.steps-ed .stp { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; margin-bottom: 4px; font-size: 12px; }
.steps-ed .stp-h { display: flex; justify-content: space-between; align-items: center; }
.steps-ed .stp-h b { display: inline-block; font-size: 11px; padding: 2px 6px; border-radius: 4px; }
.steps-ed .stp-f { display: grid; grid-template-columns: 90px 1fr; gap: 3px 8px; margin-top: 5px; align-items: center; }
.steps-ed .stp-f label { color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.steps-ed input, .steps-ed select { border: 1px solid #c9d0dc; border-radius: 4px; padding: 3px 6px; font: 12px system-ui, sans-serif; min-width: 0; width: 100%; }
.steps-ed .stp-free { margin-top: 5px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.steps-ed .step-add { width: auto; color: var(--primary); font-weight: 600; border-style: dashed; background: var(--surface); }
.side-panel .pnl-x.sm { float: none; font-size: 16px; }
.ex-rows { width: 100%; border-collapse: collapse; font-size: 12px; }
.ex-rows th { text-align: left; font-weight: 600; color: var(--muted); padding: 2px 3px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.ex-rows td { padding: 2px 3px; }
.side-panel [data-save-steps] { margin-top: 10px; }
.ok-note { font-size: 12px; color: #2b8a3e; margin: 8px 0 0; }
.side-panel .seg { display: inline-flex; border: 1px solid #c9d0dc; border-radius: 7px; overflow: hidden; }
.side-panel .seg button { border: 0; background: var(--surface); padding: 5px 12px; font: 13px system-ui, sans-serif; cursor: pointer; color: var(--text); }
.side-panel .seg button[aria-checked="true"] { background: var(--text); color: #fff; }
.side-panel .seg button:disabled { color: #9aa3b2; cursor: not-allowed; }
.side-panel .fl { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.side-panel .in { display: block; width: 100%; border: 1px solid #c9d0dc; border-radius: 6px; padding: 6px 9px; font: 13px system-ui, sans-serif; }
.side-panel .in.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.side-panel .in[aria-invalid="true"] { border: 2px solid var(--danger); }
.side-panel [data-save-outcome], .side-panel [data-save-note] { margin-top: 10px; }
.side-panel .then-off { margin: 0 0 4px; }
.gwt .x, .gwt code.x { text-decoration: line-through; color: var(--danger); }
.gwt code.x { background: #fdecec; }

/* Connections (chapter 8): arrows over the grid, the connections list, connecting */
.cgrid svg.conn-layer { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; z-index: 1; }
.conn-layer .conn { pointer-events: stroke; cursor: pointer; }
.conn-layer .hit { stroke: transparent; stroke-width: 12; }
.conn-layer .ln { stroke-width: 1.5; fill: none; }
.conn-layer .c-inferred .ln { stroke: #6b7486; }
.conn-layer .c-manual .ln { stroke: var(--primary); stroke-width: 2.5; }
.conn-layer .c-problem .ln { stroke: var(--danger); stroke-width: 2.5; stroke-dasharray: 6 4; }
.conn-layer .c-selected .ln { stroke: var(--primary); stroke-width: 5; }
.conn-layer .c-event-rm .ln {
  stroke: #a35200; stroke-width: 2; stroke-dasharray: 6 3; stroke-linecap: round; fill: none;
}
.conn-layer .c-event-rm.c-selected .ln { stroke: #a35200; stroke-width: 3.5; }
.conn-layer .ah-inferred { fill: #9aa3b5; }
.conn-layer .ah-manual, .conn-layer .ah-selected { fill: var(--primary); }
.conn-layer .ah-problem { fill: var(--danger); }
.conn-layer .rm-ah { fill: #a35200; }
.conn-layer .port { fill: #fff; stroke: #a35200; stroke-width: 2; }
.conn-layer .conn:hover .ln { stroke-width: 4; }
.conn-layer .c-event-rm:hover .ln { stroke-width: 3; }
.cgrid.is-tracing .conn { opacity: 0.2; }
.cgrid.is-tracing .conn.is-lit { opacity: 1; }
.cgrid.is-tracing .conn.is-lit .ln { stroke-width: 2.5; }
.cgrid.is-tracing .rm-ah { opacity: 0.2; }
.cgrid.is-tracing .rm-ah.is-lit { opacity: 1; }
.cgrid .el.trace-on { outline: 2px solid #c46a00; outline-offset: 2px; }
.cgrid .el.trace-on:focus-visible { outline: 2px solid #c46a00; outline-offset: 2px; }
.conn-layer .conn, .conn-layer .ln, .conn-layer .rm-ah, .cgrid .el {
  transition: opacity 120ms ease-out, stroke-width 120ms ease-out, outline-color 120ms ease-out, outline-width 120ms ease-out, outline-offset 120ms ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .conn-layer .conn, .conn-layer .ln, .conn-layer .rm-ah, .cgrid .el { transition-duration: 0s; }
}
.cgrid .el { position: relative; z-index: 3; }
.conn-list .conn-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.conn-list .conn-row .warn-box { flex-basis: 100%; margin: 2px 0 0; }
.conn-list .pill.m { background: #e3ecfe; color: var(--primary); }
.conn-list .pill.i { background: #eef1f6; color: var(--muted); }
.cgrid.connecting .el.fit { outline: 3px solid #2f9e44; outline-offset: 2px; cursor: crosshair; }
.cgrid.connecting .el.unfit { opacity: 0.55; cursor: not-allowed; }
.cgrid.connecting .el.src { outline: 2px dashed var(--primary); outline-offset: 2px; }
.conn-menu { position: fixed; z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(29, 36, 51, 0.15); padding: 6px; font-size: 13px; min-width: 190px; max-width: calc(100vw - 16px); }
.conn-menu .cm-t { margin: 2px 6px 6px; font-size: 12px; color: var(--muted); }
.conn-menu .cm-rm { display: block; width: 100%; text-align: left; border: 0; border-radius: 5px; padding: 6px 10px; color: var(--danger); background: #fdecec; font: 600 13px system-ui, sans-serif; cursor: pointer; }
.conn-menu .err { font-size: 12px; margin: 6px; }
.conn-menu { max-width: min(320px, calc(100vw - 16px)); }
.cm-copy { border-bottom: 1px solid var(--line); margin: 0 0 6px; padding-bottom: 6px; }
.cm-cp { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; border-radius: 5px; padding: 6px 10px; background: transparent; color: var(--text, #1d2433); font: 13px system-ui, sans-serif; cursor: pointer; }
.cm-cp:hover:not(:disabled), .cm-cp:focus-visible { background: #eef3fd; }
.cm-cp:disabled { color: #8a93a5; cursor: default; }
.cm-b { font-size: 11px; padding: 1px 6px; border-radius: 9px; background: #e6f4ea; color: #1e6b34; white-space: nowrap; }
.cm-b.warn { background: #fdf2dc; color: #8a5a00; }
.cm-cp:disabled .cm-b { background: #eef0f4; color: #8a93a5; }
.cm-note { margin: 4px 10px; font-size: 12px; color: var(--muted); min-height: 0; }
.cm-note:empty { display: none; }
.cm-map { display: flex; align-items: center; gap: 6px; margin: 4px 10px 0; font-size: 12px; color: var(--muted); }
.side-panel .fr { flex-wrap: wrap; }
.side-panel .fr .mf { flex-basis: 100%; font-size: 11px; color: #2f9e44; font-family: ui-monospace, Menlo, Consolas, monospace; }
.side-panel .fr .mf.none-m { color: var(--muted); font-family: system-ui, sans-serif; }
.side-panel .fr .warn-m, .side-panel .map-pick.warn-m { color: #8a5a00; background: #fff6e5; border-radius: 4px; padding: 1px 5px; }
.side-panel .map-pick { flex-basis: 100%; margin-top: 3px; border: 1px solid #c9d0dc; border-radius: 5px; padding: 3px 6px; font: 12px system-ui, sans-serif; color: var(--text); }
.side-panel .fr .mf.cmp-m { color: #1c7ed6; font-family: system-ui, sans-serif; }
.side-panel .rule-box { flex-basis: 100%; display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.side-panel .rule-box textarea { border: 1px solid #c9d0dc; border-radius: 5px; padding: 4px 6px; font: 12px system-ui, sans-serif; color: var(--text); background: var(--surface, #fff); resize: vertical; }
.side-panel .rule-box button { align-self: flex-start; }
.conn-warn { font-size: 13px; margin: 0 0 12px; max-width: 760px; }
.conn-warn p { margin: 2px 0; }

/* History (chapter 9) */
.history-drawer { position: fixed; top: 64px; right: 16px; bottom: 16px; width: min(420px, calc(100vw - 32px)); z-index: 35; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; box-shadow: 0 10px 30px rgba(29, 36, 51, 0.18); }
.history-drawer h2 { font-size: 17px; margin: 0 0 10px; }
.history-drawer .pnl-x { float: right; border: 0; background: none; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; }
.hist-filters { display: flex; gap: 6px; margin-bottom: 10px; }
.chip-f { font: 12px system-ui, sans-serif; padding: 3px 10px; border-radius: 12px; border: 1px solid #c9d0dc; background: var(--surface); cursor: pointer; }
.chip-f.on { background: var(--text); color: #fff; border-color: var(--text); }
.hist-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; }
.hist-av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; background: var(--text); }
.hist-av.ag { background: #7048e8; }
.hist-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hist-badge { font-size: 11px; padding: 0 6px; border-radius: 8px; background: #efe9ff; color: #5f3dc4; }
.hist-x { text-decoration: line-through; color: #8a93a5; }
.hist-empty { padding: 30px 10px; text-align: center; color: var(--muted); font-size: 13px; }
.hist-row [data-actions] { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.hist-row .hist-err { grid-column: 2 / 4; color: var(--danger); font-size: 12px; background: #fdecec; border-radius: 6px; padding: 6px 8px; }
.cgrid .status-chip { display: inline-block; margin-left: 4px; border: 0; font: 11px system-ui, sans-serif; padding: 1px 8px; border-radius: 9px; cursor: pointer; }
.st-ip { background: #eef1f6; color: var(--muted); }
.st-rr { background: #fff3d6; color: #8a5a00; }
.st-dn { background: #d3ecd8; color: #1f7a34; }
.status-menu { position: fixed; z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(29, 36, 51, 0.15); padding: 4px; min-width: 210px; }
.status-menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; border-radius: 5px; padding: 6px 10px; font: 13px system-ui, sans-serif; cursor: pointer; }
.status-menu button:hover, .status-menu button.on { background: #f2f5fa; }
.status-menu button.on { font-weight: 600; }
.status-menu i { width: 10px; height: 10px; border-radius: 50%; }
.status-menu .err { font-size: 12px; margin: 6px; }
/* Build status (chapter 12) */
.cgrid .sh .build-chip { order: 1; display: inline-block; margin-left: 4px; border: 0; font: 11px system-ui, sans-serif; padding: 1px 8px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.bs-nb { background: #eef1f6; color: var(--muted); }
.bs-bg { background: #e3ecfd; color: #2451a6; }
.bs-bt { background: #d3ecd8; color: #1f7a34; }
.bs-od { background: #fdecec; color: #a51d1d; }
.bs-bl { background: #fff3bf; color: #8f5b00; }
/* Scenario test results (chapter 21) */
.scn-test { margin-left: auto; flex-shrink: 0; font: 700 12px system-ui, sans-serif; width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; }
.st-passing { background: #d3ecd8; color: #1f7a34; }
.st-failing { background: #fdecec; color: #a51d1d; }
.st-changed { background: #fff3bf; color: #8f5b00; }
.st-not-run { background: #eef1f6; color: var(--muted); }
.scn-test-msg { margin: 2px 10px 6px; font-size: 11px; color: #a51d1d; overflow-wrap: anywhere; }
.cgrid .sh .tests-chip { order: 1; display: inline-block; margin-left: 4px; font: 11px system-ui, sans-serif; padding: 1px 8px; border-radius: 9px; white-space: nowrap; }
.tests-chip.all { background: #d3ecd8; color: #1f7a34; }
.tests-chip.some { background: #fff3bf; color: #8f5b00; }
.tests-chip.fail { background: #fdecec; color: #a51d1d; }
.build-menu .build-menu-h { margin: 4px 10px 2px; font-size: 11px; color: var(--muted); }
.build-menu .build-ref { display: block; width: calc(100% - 12px); margin: 6px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font: 12px system-ui, sans-serif; }
.build-menu button:disabled { opacity: 0.45; cursor: not-allowed; }
.review-table td, .review-table th { font-size: 13px; }
.side-panel .done-warn { font-size: 12px; margin: 0 0 10px; }
.el-toast .undo { color: #8fb3ff; margin-left: 12px; font-weight: 600; background: none; border: 0; cursor: pointer; }
.el-toast.bad .ok { background: var(--danger); }
.hist-row .rv { color: var(--primary); font: 600 12px system-ui, sans-serif; }
.hist-row.hist-hl { background: #fff6e5; }
.hist-err .lnk { color: var(--primary); font: 600 12px system-ui, sans-serif; }

/* Model check (chapter 10) */
.check-badge { border-radius: 7px; padding: 5px 11px; font: 600 13px system-ui, sans-serif; cursor: pointer; border: 1px solid #c9d0dc; background: var(--surface); }
.check-badge.bad { border-color: #f1b5b5; background: #fdecec; color: #a51d1d; }
.check-badge.warn { border-color: #f5d08a; background: #fff6e5; color: #8a5a00; }
.check-badge.ok { border-color: #b2dfbe; background: #e6f4ea; color: #1f7a34; }
.chk-group { font-size: 12px; font-weight: 650; color: var(--muted); margin: 12px 0 4px; }
.chk-row { display: grid; grid-template-columns: 16px 1fr auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; }
.chk-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }
.chk-dot.er { background: var(--danger); }
.chk-dot.wn { background: #f08c00; }
.chk-fix { font-size: 12px; color: var(--muted); }
.chk-row [data-actions] { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.chk-row .lnk { color: var(--primary); font: 600 12px system-ui, sans-serif; }
.chk-ok { padding: 30px 10px; text-align: center; color: #1f7a34; font-size: 14px; }
.chk-ignored { margin-top: 12px; font-size: 12px; color: var(--muted); }
.chk-ignored summary { cursor: pointer; }
.cgrid .err-badge { font-size: 11px; padding: 1px 7px; border-radius: 9px; background: #fdecec; color: #a51d1d; margin-left: 4px; }
.status-menu button:disabled { color: #aab1bf; cursor: not-allowed; background: none; }
.status-menu .status-blocked { margin: 4px; padding: 6px 8px; border-radius: 5px; background: #fdecec; color: var(--danger); font-size: 12px; max-width: 280px; }
.status-menu .status-blocked .lnk { display: inline; width: auto; padding: 0; color: var(--primary); font: 600 12px system-ui, sans-serif; text-decoration: underline; }
.export-dlg { width: min(620px, calc(100vw - 32px)); }
.export-dlg .seg { display: inline-flex; border: 1px solid #c9d0dc; border-radius: 7px; overflow: hidden; }
.export-dlg .seg button { border: 0; background: var(--surface); padding: 5px 12px; font: 13px system-ui, sans-serif; cursor: pointer; }
.export-dlg .seg button[aria-pressed="true"] { background: var(--text); color: #fff; }
.export-preview { background: #f4f6fa; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: 11.5px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; margin: 12px 0 0; max-height: 240px; overflow: auto; }
.export-dlg .warn-box { font-size: 12px; margin: 8px 0 0; }

/* Comments (chapter 11) */
.ptabs { display: flex; gap: 14px; border-bottom: 1px solid var(--line, #e3e7ef); margin: 6px 0 12px; }
.ptab { border: 0; background: none; padding: 6px 0; font: 13px system-ui, sans-serif; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.ptab.on { color: var(--text); font-weight: 600; border-bottom-color: var(--primary); }
.th { border: 1px solid #e3e7ef; border-radius: 8px; padding: 6px 10px; margin: 0 0 10px; }
.th.resolved { background: #f7f8fb; }
.th summary { font-size: 12px; color: var(--muted); cursor: pointer; padding: 4px 0; }
.cm { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 6px 0; font-size: 13px; }
.cm .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; background: var(--text); }
.cm .ic.ag { background: #7048e8; }
.cm.del .ic { background: #c9d0dc; }
.cm .m { font-size: 12px; color: var(--muted); }
.cm-t { white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-del { color: #8a93a5; font-style: italic; padding-top: 3px; }
.cm .mt, .cm-t .mt { color: var(--primary); font-weight: 600; }
.cm-acts { display: flex; gap: 10px; }
.th .lnk, .cm .lnk { font-size: 12px; color: var(--primary); }
.th .lnk.danger, .cm .lnk.danger { color: var(--danger); }
.th .lnk.ok { color: var(--view); }
.th-ft, .rs [data-thread-actions] { display: flex; justify-content: space-between; gap: 10px; }
.rs { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding: 4px 0; }
.cm-form { position: relative; margin: 6px 0; }
.cm-form .ta, [data-edit-box] .ta { width: 100%; box-sizing: border-box; padding: 7px 9px; border: 1.5px solid #c9d0dc; border-radius: 6px; font: 13px/1.45 system-ui, sans-serif; resize: vertical; }
.cm-form .ta:focus, [data-edit-box] .ta:focus { outline: none; border-color: var(--primary); }
.cm-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.cm-row .hint { margin: 0; font-size: 12px; }
.cm-form .err, [data-edit-box] .err { margin: 4px 0 0; font-size: 12px; }
.cm-empty { padding: 18px 8px; text-align: center; font-size: 13px; border: 1px dashed #c9d0dc; border-radius: 8px; }
.mention-list { position: absolute; z-index: 5; left: 8px; top: 64px; min-width: 180px; background: var(--surface, #fff); border: 1px solid #e3e7ef; border-radius: 8px; box-shadow: 0 6px 20px rgba(29, 36, 51, 0.15); padding: 4px; }
.mention-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 5px 8px; border-radius: 5px; font: 13px system-ui, sans-serif; cursor: pointer; }
.mention-list button:hover, .mention-list button:focus { background: #e3ecfe; }
.cgrid .el, .cgrid .scn { position: relative; }
.cm-bb { position: absolute; right: -8px; top: -8px; background: var(--primary); color: #fff; font-size: 10px; border-radius: 9px; padding: 1px 6px; z-index: 2; cursor: pointer; }
.sh-cm { border: 0; background: none; font-size: 12px; cursor: pointer; padding: 0 2px; color: var(--muted); }
.chips-f { display: flex; gap: 6px; margin: 0 0 12px; }
.gone-badge { font-size: 11px; padding: 0 6px; border-radius: 8px; background: #fff3d6; color: #8a5a00; }
/* Remove slice (chapter 4) */
.cgrid .sh .slice-more {
  order: 2; flex: none; margin-left: auto; width: 24px; height: 24px; display: grid; place-items: center;
  border: 0; background: none; border-radius: 4px; padding: 0; font: 16px/1 system-ui, sans-serif; color: var(--muted); cursor: pointer;
}
.cgrid .sh .slice-more:hover, .cgrid .sh .slice-more:focus-visible { background: #eef1f6; color: var(--text); }
.cgrid .sh .slice-more:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

/* Chapter 14 · Screens: full view of a screen, screen stylesheet setting. */
.cgrid .el .el-fs { margin-left: auto; flex: none; border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 5px; width: 24px; height: 24px; padding: 0; font-size: 14px; line-height: 1; cursor: pointer; opacity: 0; }
.cgrid .el:hover .el-fs, .cgrid .el:focus-within .el-fs { opacity: 1; }
.cgrid .el .el-fs:hover, .cgrid .el .el-fs:focus-visible { background: var(--surface); border-color: var(--line); color: var(--text); opacity: 1; }
.sfv { width: 94vw; height: 92vh; max-width: none; max-height: none; padding: 0; border: none; border-radius: 10px; background: #1d2433; color: #fff; overflow: hidden; }
.sfv[open] { display: flex; flex-direction: column; }
.sfv::backdrop { background: rgba(10, 14, 22, 0.7); }
.sfv-h { display: flex; align-items: center; gap: 16px; padding: 10px 14px; flex-wrap: wrap; }
.sfv-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sfv-t strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sfv-t span { font-size: 12px; color: #b8c0cd; }
.sfv-w, .sfv-n { display: flex; gap: 4px; }
.sfv-h button { background: #2d3648; color: #fff; border: 1px solid #3d475c; border-radius: 6px; padding: 5px 10px; font: 13px system-ui, sans-serif; cursor: pointer; }
.sfv-h button[aria-pressed="true"] { background: #fff; color: #1d2433; }
.sfv-h button:disabled { opacity: 0.4; cursor: default; }
.sfv-b { flex: 1; overflow: auto; padding: 0 14px 14px; display: flex; justify-content: center; }
.sfv-f { max-width: 100%; height: 100%; background: #fff; border-radius: 6px; overflow: hidden; flex: none; }
.sfv-f iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.sfv-f .err { color: #c92a2a; padding: 16px; }
.sfv-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #5b6475; font: 15px system-ui, sans-serif; border: 2px dashed #c9d0dc; border-radius: 6px; box-sizing: border-box; }
.sfv-empty span { font-weight: 650; color: #1d2433; }
/* Chapter 15 · Screen highlights: the list beside the full view. */
.sfv-b { gap: 14px; justify-content: safe center; }
.sfv-s { flex: none; width: 280px; overflow: auto; background: #273044; border-radius: 6px; padding: 10px 12px; font: 13px/1.45 system-ui, sans-serif; color: #e6e9ef; }
.sfv-s h4 { margin: 12px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #b8c0cd; }
.sfv-s ul { margin: 0; padding-left: 16px; }
.sfv-s li { margin: 3px 0; }
.sfv-s code { font-size: 11.5px; background: #1d2433; padding: 0 4px; border-radius: 4px; color: #fff; }
.sfv-s input { width: 100%; box-sizing: border-box; margin: 3px 0; padding: 3px 6px; border-radius: 4px; border: 1px solid #3d475c; background: #1d2433; color: #fff; font: 12px system-ui, sans-serif; }
.sfv-s button[data-unmark] { background: none; border: 0; color: #ff8787; cursor: pointer; padding: 0; font: 12px system-ui, sans-serif; }
.sfv-role { margin: 0; font-weight: 600; }
.sfv-chip { display: inline-block; padding: 1px 8px; border-radius: 9px; color: #fff; font-size: 12px; }
.sfv-hint { margin: 4px 0; color: #b8c0cd; font-size: 12px; }
.sfv-warn { margin: 10px 0 0; padding: 6px 8px; border-radius: 6px; background: #4a3b12; color: #ffe8a3; font-size: 12px; }
.sfv-note { margin: 8px 0 0; color: #ffd8a8; font-size: 12px; min-height: 1em; }
.sfv-act { margin-top: 8px; display: flex; gap: 6px; }
.sfv-h [data-mark-toggle][aria-pressed="true"] { background: #2874f0; border-color: #2874f0; color: #fff; }
@media (max-width: 900px) { .sfv-b { flex-direction: column; align-items: center; } .sfv-s { width: auto; align-self: stretch; } }
.ss-kinds { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.ss-kind { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ss-kind .muted { font-size: 13px; flex-basis: 100%; padding-left: 22px; }
.ss-css { width: 100%; box-sizing: border-box; margin-bottom: 10px; }

/* Field tracing (chapter 17) */
.ft-btn { margin: 0 auto 0 -4px; font-size: 13px; color: #7a3fc2; }
.ft-used { display: block; flex-basis: 100%; font-size: 11px; color: var(--muted); margin-top: 2px; }
.ft { margin-top: 10px; padding: 10px; border: 1px solid #d9c7f0; border-radius: 8px; background: #faf6ff; font-size: 12.5px; }
.ft-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.ft-lb { margin: 8px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.ft ol, .ft ul { list-style: none; margin: 0; padding: 0; }
.ft-s, .ft-here, .ft-d { padding: 2px 0; overflow-wrap: anywhere; }
.ft-here { font-weight: 600; }
.ft-l { color: var(--muted); font-size: 11.5px; padding-left: 10px; }
.ft-same { color: #8a5a00; }
.ft-k { font-size: 10.5px; color: var(--muted); }
.ft-ch { color: #7a3fc2; font-size: 11px; }
.ft-tag { font-size: 10.5px; padding: 1px 6px; border-radius: 9px; background: #e6f4ea; color: #1e6b34; }
.ft-tag.ft-gap { background: #fdecec; color: var(--danger); }
.ft-rule { color: var(--muted); font-style: italic; }
.ft-d { padding-left: calc(var(--d, 0) * 12px); }
.ft-map { font-size: 11.5px; margin-left: 4px; }
.ft-hist { color: #7048e8; }
.ft-sugg { list-style: none; margin: 0; padding: 0; }
.ft-sugg li { padding: 3px 0; overflow-wrap: anywhere; }
.ft-take { margin-top: 4px; padding: 3px 10px; font-size: 12px; }
.ft-follow { margin: 10px 0 0; font-size: 12.5px; }
.cgrid .el.ft-on { outline: 2px solid #7a3fc2; outline-offset: 2px; }
.cmp-btn[aria-pressed="true"] { background: #eef3fd; border-color: var(--primary); }
.cmp-legend { display: flex; flex-wrap: wrap; flex-basis: 100%; width: 100%; justify-content: flex-start; gap: 8px 14px; align-items: center; font-size: 12.5px; margin: 0 0 8px; }
.cmp-k::before { content: ''; display: inline-block; width: 18px; height: 3px; margin-right: 6px; vertical-align: middle; background: currentColor; }
.cmp-k.cmp-ok { color: #1e8e3e; }
.cmp-k.cmp-nm { color: #c98a00; }
.cmp-k.cmp-ms { color: #d93025; }
.cmp-gaps { color: var(--muted); }

/* Board history export & import (chapter 18) */
.hist-exp { margin: 8px 0; display: grid; gap: 6px; }
.hist-exp .chk { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.imp-dlg input[type="file"] { margin: 4px 0 10px; max-width: 100%; }
.imp-dlg [data-pass] { display: flex; flex-wrap: wrap; gap: 6px; align-items: end; margin-bottom: 8px; }
.imp-dlg [data-pass][hidden] { display: none; }
.imp-dlg [data-pass] .field-label { flex-basis: 100%; }
.imp-preview { font-size: 13px; background: #f6f8fb; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.imp-people { list-style: none; margin: 6px 0 0; padding: 0; }

/* ---- Proposals (chapter 19) ---------------------------------------------------- */
.prop-count { margin-left: 6px; font-size: 11px; padding: 0 6px; border-radius: 8px; background: #fff3bf; color: #8f5b00; }
.prop-row { grid-template-columns: 1fr auto; }
.prop-main b { font-weight: 600; }
.prop-note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.prop-status { font-size: 11px; padding: 0 6px; border-radius: 8px; background: #e7f5ff; color: #1864ab; }
.prop-status.accepted { background: #ebfbee; color: #2b8a3e; }
.prop-status.rejected { background: #fff5f5; color: #c92a2a; }
.prop-form { display: grid; gap: 8px; padding: 10px 0 12px; border-bottom: 1px solid var(--line); }
.prop-form .lbl { display: grid; gap: 4px; font-size: 13px; }
.prop-form .row-btns { display: flex; gap: 6px; }
[data-start] { display: block; margin-bottom: 8px; }
proposal-banner { display: block; margin: 0 0 10px; }
proposal-banner[hidden] { display: none; }
.prop-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 12px; border: 1px solid #a5d8ff; background: #e7f5ff; border-radius: 8px; font-size: 13px; }
.prop-banner .sp { flex: 1; }
.prop-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #fff; background: #1c7ed6; border-radius: 4px; padding: 1px 6px; }
.prop-conflict { color: #c92a2a; }
.prop-details { margin-top: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; max-height: 40vh; overflow: auto; }
.prop-details ol, .prop-details ul { margin: 4px 0 4px 18px; padding: 0; }
.prop-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; }
.prop-confirm .sp { flex: 1; }
.prop-confirm .grow { flex: 1; display: grid; gap: 4px; min-width: 220px; }
.prop-confirm .err { flex-basis: 100%; margin: 0; }
.btn.danger { color: #c92a2a; }
.btn.danger:not(.sec) { background: #c92a2a; color: #fff; }
.el.prop-added { outline: 3px solid #2f9e44; outline-offset: 2px; }
.el.prop-changed { outline: 3px solid #f08c00; outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* ---- Chapter list (chapter 20) -------------------------------------------------- */
board-canvas[hidden], chapter-list-view[hidden], [data-canvas-only][hidden] { display: none; }
chapter-list-view { display: block; }
.seg { display: inline-flex; border: 1px solid #cfd5e1; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { font: inherit; font-size: 13px; padding: 5px 12px; border: 0; background: none; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--text); color: #fff; }
.cl-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.cl-search { width: auto; min-width: 220px; padding: 6px 10px; font-size: 14px; }
.cl-legend { display: inline-flex; gap: 10px; font-size: 12px; color: var(--muted); }
.cl-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 4px; vertical-align: -1px; }
.cl-legend .d, .cl-stack .d { background: var(--view); }
.cl-legend .r, .cl-stack .r { background: var(--primary); }
.cl-legend .p { background: #c3cad6; }
.cl-count { margin-left: auto; font-size: 13px; }
.cl-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.cl-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 980px; }
.cl-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfd; cursor: pointer; user-select: none; }
.cl-table th:hover { color: var(--text); }
.cl-table .num { text-align: right; }
.cl-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cl-table tbody tr[data-chapter] { cursor: pointer; }
.cl-table tbody tr[data-chapter]:hover, .cl-table tbody tr[data-chapter]:focus { background: #f7f9fd; outline: none; }
.cl-table tfoot td { font-size: 13px; color: var(--muted); background: #fafbfd; border-bottom: 0; }
.cl-name { font-weight: 650; min-width: 210px; }
.cl-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.cl-prog { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.cl-stack { flex: 1; display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #c3cad6; min-width: 100px; }
.cl-stack span { display: block; height: 100%; }
.cl-t { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 62px; }
.cl-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 8px; border-radius: 10px; white-space: nowrap; }
.cl-badge.err { background: #fff5f5; color: var(--danger); }
.cl-badge.wrn { background: #fff4e6; color: #a35200; }
.cl-badge.ok { background: #ebfbee; color: #2b8a3e; }
.cl-badge.nb { background: #f1f3f7; color: var(--muted); }
.cl-who { font-size: 13px; white-space: nowrap; }
.cl-who .hist-badge { margin-left: 4px; }
.cl-when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.cl-empty { padding: 30px; text-align: center; color: var(--muted); }
@media (max-width: 760px) {
  .cl-wrap { background: none; border: 0; }
  .cl-table, .cl-table tbody, .cl-table tr, .cl-table td { display: block; min-width: 0; }
  .cl-table thead, .cl-table tfoot { display: none; }
  .cl-table tbody tr { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 6px 4px; }
  .cl-table td { border: 0; padding: 4px 12px; text-align: left; }
  .cl-table td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 92px; color: var(--muted); font-size: 12px; }
  .cl-search { min-width: 0; width: 100%; }
}

/* ---- Add slice next to a cell -------------------------------------------------- */
.cgrid .ce .add-slice-beside {
  position: absolute; top: 50%; z-index: 6; transform: translateY(-50%);
  font: 600 12px system-ui, sans-serif; letter-spacing: .02em; white-space: nowrap;
  padding: 3px 9px; border-radius: 12px; cursor: pointer;
  color: var(--primary); background: var(--surface); border: 1px solid #9db8f2;
  box-shadow: 0 2px 6px rgba(29, 36, 51, 0.16);
}
.cgrid .ce:has(.add-slice-beside) { z-index: 2; }
.cgrid .ce .add-slice-beside.before { left: -18px; }
.cgrid .ce .add-slice-beside.before.inset { left: 3px; }
.cgrid .ce .add-slice-beside.after { right: -18px; }
.cgrid .ce .add-slice-beside:hover, .cgrid .ce .add-slice-beside:focus-visible { background: var(--primary); color: #fff; border-color: var(--primary); outline: none; }
.cgrid .ce .add-slice-beside:disabled { opacity: .5; cursor: wait; }
.cgrid .ce .add-slice-err { position: absolute; top: calc(50% + 16px); z-index: 6; max-width: 220px; margin: 0; padding: 6px 8px; border-radius: 6px; background: #fff5f5; border: 1px solid #ffc9c9; color: var(--danger); font-size: 12px; box-shadow: 0 2px 6px rgba(29, 36, 51, 0.16); }
.cgrid .ce .add-slice-err.before { left: 3px; }
.cgrid .ce .add-slice-err.after { right: 3px; }

/* ---- Access details (chapter 22) ----------------------------------------------- */
.acc-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.acc-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 860px; }
.acc-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfd; }
.acc-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.acc-table tbody tr:last-child td { border-bottom: 0; }
.acc-table .num { text-align: right; }
.acc-tag { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 8px; background: #eef1f6; color: var(--muted); white-space: nowrap; }
.acc-tag.admin { background: #e3ecfd; color: #2451a6; }
.acc-tag.delivered { background: #d3ecd8; color: #1f7a34; }
.acc-tag.sent, .acc-tag.requested { background: #eef1f6; color: var(--muted); }
.acc-tag.bounced, .acc-tag.failed { background: #fdecec; color: #a51d1d; }
@media (max-width: 760px) {
  .acc-wrap { background: none; border: 0; }
  .acc-table, .acc-table tbody, .acc-table tr, .acc-table td { display: block; min-width: 0; }
  .acc-table thead { display: none; }
  .acc-table tbody tr { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 6px 4px; }
  .acc-table td { border: 0; padding: 3px 12px; }
  .acc-table td.num { text-align: left; }
  .acc-table td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 104px; color: var(--muted); font-size: 12px; }
}

/* ---- Follow a property (chapter 24) ---------------------------------------- */
.pj-pick { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 4px 0 12px; }
.pj-prop { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.pj-prop input { font: inherit; font-weight: 600; color: var(--text); padding: 6px 10px; border: 1px solid #cfd5e1; border-radius: var(--radius); background: var(--surface); width: 220px; max-width: 60vw; }
.pj-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pj-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 5px 12px; font-size: 13px; color: var(--muted); }
.pj-stat b { color: var(--text); font-size: 16px; margin-right: 5px; }
.pj-stat.bad b { color: var(--danger); }
.pj-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .pj-layout { grid-template-columns: minmax(0, 1fr); } }
.pj-map { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.pj-canvas { position: relative; padding: 6px 16px 12px; width: max-content; min-width: 100%; }
.pj-links { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.pj-links path { fill: none; stroke: #8a93a6; stroke-width: 1.6; }
.pj-links path.same { stroke-dasharray: 5 4; stroke-width: 1.4; }
.pj-links path.hist { stroke: #7048e8; stroke-width: 2; stroke-dasharray: 2 4; }
.pj-links path.dim { opacity: 0.15; }
.pj-row { display: flex; gap: 20px; align-items: center; padding: 12px 0; border-top: 1px dashed var(--line); }
.pj-row:first-child { border-top: 0; }
.pj-lab { flex: none; width: 150px; font-size: 12px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.pj-lab b { display: block; color: var(--text); font-size: 13px; }
.pj-cols { display: flex; gap: 34px; align-items: center; }
.pj-col { display: flex; flex-direction: column; gap: 10px; }
.pj-n { position: relative; z-index: 1; display: block; width: 168px; padding: 0; text-align: left; font: inherit; font-size: 12px; border-radius: 7px; overflow: hidden; border: 1px solid transparent; background: var(--surface); box-shadow: var(--el-shadow); cursor: pointer; color: inherit; }
.pj-n .pj-h { display: block; padding: 3px 8px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj-n .pj-f { display: flex; justify-content: space-between; gap: 6px; padding: 3px 8px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.pj-n .pj-f i { font-style: normal; font-family: system-ui, sans-serif; white-space: nowrap; }
.pj-n.C .pj-h { background: var(--cmd-band); color: var(--cmd-ink); }
.pj-n.E .pj-h { background: var(--ev-band); color: var(--ev-ink); }
.pj-n.R .pj-h { background: var(--rm-band); color: var(--rm-ink); }
.pj-n.U .pj-h, .pj-n.A .pj-h { background: var(--au-band); color: var(--au-ink); }
.pj-n.X .pj-h { background: #f3c4d6; color: #4a0f26; }
.pj-n.gap { border-color: var(--danger); }
.pj-n.gap .pj-f i { color: var(--danger); font-weight: 700; }
.pj-n.sel { outline: 2px solid var(--primary); outline-offset: 2px; }
.pj-n.dim { opacity: 0.35; }
.pj-n:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pj-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--muted); padding: 8px 16px; border-top: 1px solid var(--line); }
.pj-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pj-legend i { display: inline-block; width: 26px; border-top: 2px solid #8a93a6; }
.pj-legend i.same { border-top-style: dashed; }
.pj-legend i.hist { border-top: 2px dotted #7048e8; }
.pj-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; font-size: 14px; position: sticky; top: 12px; overflow-wrap: anywhere; }
@media (max-width: 900px) { .pj-panel { position: static; } }
.pj-panel h2 { font-size: 15px; margin: 2px 0 0; }
.pj-panel h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 14px 0 6px; }
.pj-hop { border-left: 3px solid var(--line); padding: 2px 0 2px 10px; margin: 6px 0; font-size: 13px; }
.pj-hop.hist { border-color: #7048e8; }
.pj-hop.bad { border-color: var(--danger); color: var(--danger); }
.pj-take { margin-top: 6px; }
