/* ============================================================
   Orient Express — Documentation Theme
   Midnight navy · Brass gold · Ivory · Art Deco
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.78;
  background: #0a1628;
  color: #1a0f08;
}

/* --- Header — double gold rule --- */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #060e1c;
  color: #c9a843;
  padding: 0.55rem 1.5rem;
  font-family: 'Cinzel', 'Playfair Display', Georgia, serif;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px solid #c9a843;
  box-shadow: 0 3px 0 rgba(201,168,67,0.28);
}
#site-header a { color: #c9a843; text-decoration: none; }
#site-header a:hover { color: #e0c060; }

/* --- Layout --- */
#layout { display: flex; min-height: calc(100vh - 44px); }

/* --- Sidebar — dark sleeping-car panelling --- */
#sidebar {
  width: 272px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #0d1f38 0%, #091828 100%);
  border-right: 1px solid rgba(201,168,67,0.45);
  padding: 0.75rem 0 1.5rem;
  overflow-y: auto;
  position: sticky;
  top: 44px;
  height: calc(100vh - 44px);
}
#sidebar .track { margin-bottom: 1.25rem; }
#sidebar h3 {
  font-family: 'Cinzel', 'Playfair Display', Georgia, serif;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: #c9a843;
  margin: 1rem 1rem 0.4rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(201,168,67,0.22);
}
#sidebar ul { list-style: none; margin: 0; padding: 0; }
#sidebar li a {
  display: block;
  padding: 0.3rem 1rem;
  text-decoration: none;
  color: #9a8868;
  font-size: 0.875rem;
  font-family: 'EB Garamond', Georgia, serif;
  transition: background 0.15s, color 0.15s;
}
#sidebar li a:hover { background: rgba(201,168,67,0.09); color: #d4b860; }
#sidebar li a[aria-current="page"] {
  background: rgba(201,168,67,0.14);
  color: #c9a843;
  font-weight: 600;
  border-left: 2px solid #c9a843;
  padding-left: calc(1rem - 2px);
}

/* --- Search --- */
#nav-search {
  display: block;
  width: calc(100% - 2rem);
  margin: 0.7rem 1rem 0.9rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(201,168,67,0.3);
  border-radius: 1px;
  font-size: 0.85rem;
  font-family: 'EB Garamond', Georgia, serif;
  background: rgba(255,255,255,0.04);
  color: #c8b48a;
}
#nav-search::placeholder { color: rgba(200,180,138,0.38); }
#nav-search:focus { outline: 1px solid #c9a843; border-color: #c9a843; background: rgba(255,255,255,0.07); }
#search-results ul { list-style: none; margin: 0; padding: 0; }
#search-no-results { padding: 0.4rem 1rem; color: #6a5a3a; font-size: 0.85rem; margin: 0; }
.search-result a { display: block; padding: 0.5rem 1rem; text-decoration: none; border-bottom: 1px solid rgba(201,168,67,0.1); }
.search-result a:hover, .result-focused a { background: rgba(201,168,67,0.1); }
.result-focused a { outline: 1px solid #c9a843; outline-offset: -1px; }
.result-title { display: block; font-weight: 600; font-size: 0.88rem; color: #d4b860; font-family: 'Playfair Display', Georgia, serif; }
.result-heading { display: block; font-size: 0.75rem; color: #c9a843; margin-top: 0.1rem; }
.result-excerpt { display: block; font-size: 0.78rem; color: #7a6a4a; margin-top: 0.15rem; line-height: 1.4; }
mark { background: rgba(201,168,67,0.3); color: inherit; padding: 0 2px; border-radius: 1px; font-style: normal; }

/* --- Main — cartographic map grid --- */
main {
  flex: 1;
  padding: 2.5rem 3rem;
  background: #e4d8c0;
  background-image:
    linear-gradient(rgba(140,110,60,0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(140,110,60,0.14) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* --- Article — ivory card with Art Deco corner brackets --- */
article {
  max-width: 820px;
  margin: 0 auto;
  padding: 2.75rem 3rem;
  background:
    linear-gradient(to right,  #c9a843 28px, transparent 28px) top    left  / 46px 2px  no-repeat,
    linear-gradient(to bottom, #c9a843 28px, transparent 28px) top    left  / 2px  46px no-repeat,
    linear-gradient(to left,   #c9a843 28px, transparent 28px) top    right / 46px 2px  no-repeat,
    linear-gradient(to bottom, #c9a843 28px, transparent 28px) top    right / 2px  46px no-repeat,
    linear-gradient(to right,  #c9a843 28px, transparent 28px) bottom left  / 46px 2px  no-repeat,
    linear-gradient(to top,    #c9a843 28px, transparent 28px) bottom left  / 2px  46px no-repeat,
    linear-gradient(to left,   #c9a843 28px, transparent 28px) bottom right / 46px 2px  no-repeat,
    linear-gradient(to top,    #c9a843 28px, transparent 28px) bottom right / 2px  46px no-repeat,
    #faf6ec;
  box-shadow: 0 8px 40px rgba(6,14,28,0.32);
}

/* --- Headings --- */
h1, h2, h3, h4 { font-family: 'Playfair Display', Georgia, serif; color: #0d1f38; line-height: 1.3; }

h1 {
  font-size: 2.1rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 1.5rem;
  letter-spacing: 0.01em;
}
h1::after {
  content: '';
  display: block;
  margin-top: 0.5rem;
  height: 2px;
  background: linear-gradient(to right, #c9a843 0%, #c9a843 42%, transparent 100%);
}

h2 {
  font-size: 1.45rem;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
}
h2::after {
  content: '';
  display: block;
  margin-top: 0.3rem;
  height: 1px;
  background: linear-gradient(to right, rgba(201,168,67,0.7) 0%, rgba(201,168,67,0.1) 55%, transparent 100%);
}

h3 { font-size: 1.1rem; color: #1a3560; margin-top: 1.75rem; margin-bottom: 0.5rem; }
h4 { font-size: 0.95rem; color: #2a4570; margin-top: 1.25rem; }

p { margin: 0 0 1rem; color: #1a0f08; }

a { color: #7c1c2e; text-decoration: underline; text-decoration-color: rgba(124,28,46,0.3); }
a:hover { color: #a02030; text-decoration-color: rgba(160,32,48,0.6); }

/* --- HR — gold rule with hexagon ornament (18xx tile nod) --- */
hr {
  border: none;
  height: 18px;
  margin: 2rem 0;
  position: relative;
  text-align: center;
}
hr::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent 0%, #c9a843 12%, #c9a843 88%, transparent 100%);
}
hr::after {
  content: '\2B21';
  position: relative;
  z-index: 1;
  background: #faf6ec;
  padding: 0 0.75rem;
  color: #c9a843;
  font-size: 0.72rem;
  line-height: 18px;
}

/* --- Code --- */
pre, code { font-family: 'Fira Code', 'Cascadia Code', 'Courier New', monospace; }
pre {
  background: #060e1c;
  color: #e0d0a0;
  border-left: 2px solid #c9a843;
  border-radius: 0 2px 2px 0;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.6;
  margin: 1.25rem 0;
}
code {
  background: rgba(10,22,40,0.08);
  color: #0d1f38;
  padding: 0.1em 0.35em;
  border-radius: 2px;
  font-size: 0.86em;
}
pre code { background: none; padding: 0; color: inherit; font-size: inherit; }

/* --- Tables --- */
table { border-collapse: collapse; width: 100%; margin: 1.25rem 0; font-size: 0.9rem; }
th {
  background: #0d1f38;
  color: #c9a843;
  text-align: left;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.05em;
  font-size: 0.87rem;
}
th, td { padding: 0.45rem 0.85rem; border: 1px solid rgba(201,168,67,0.28); }
td { color: #1a0f08; }
tr:nth-child(even) td { background: rgba(201,168,67,0.04); }
tr:hover td { background: rgba(201,168,67,0.09); }

/* --- Images --- */
img {
  max-width: 100%;
  border: 1px solid rgba(201,168,67,0.45);
  border-radius: 1px;
  box-shadow: 2px 4px 12px rgba(6,14,28,0.24);
  display: block;
  margin: 0.75rem 0;
}

/* --- Blockquote --- */
blockquote {
  border-left: 2px solid #c9a843;
  margin: 1.25rem 0;
  padding: 0.5rem 1rem;
  background: rgba(201,168,67,0.06);
  color: #4a3a22;
  font-style: italic;
}

/* --- Lists --- */
ul, ol { padding-left: 1.5rem; margin: 0.5rem 0 1rem; }
li { margin-bottom: 0.25rem; }

/* --- Mermaid --- */
.mermaid { margin: 1.5rem 0; }

/* --- Confidence markers --- */
.confidence-low { color: #8a7a5a; }
.confidence-low code { color: #7a6a4a; }

/* --- Responsive --- */
@media (max-width: 960px) {
  #layout { flex-direction: column; }
  #sidebar { width: 100%; height: auto; position: static; border-right: none; border-bottom: 1px solid rgba(201,168,67,0.45); }
  main { padding: 1.25rem; }
  article { padding: 1.5rem 1.25rem; background: #faf6ec; }
}

/* --- Copy buttons --- */
.pre-wrap { position: relative; }
.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(201,168,67,0.1);
  color: #c9a843;
  border: 1px solid rgba(201,168,67,0.28);
  border-radius: 2px;
  padding: 0.18rem 0.55rem;
  font-size: 0.7rem;
  font-family: 'EB Garamond', Georgia, serif;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1.6;
}
.copy-btn:hover { background: rgba(201,168,67,0.22); color: #e0c060; border-color: rgba(201,168,67,0.5); }
.copy-btn.copied { background: rgba(60,140,60,0.2); color: #7ec87e; border-color: rgba(80,160,80,0.35); }

/* --- Anchor links --- */
.anchor-link {
  margin-left: 0.45rem;
  color: transparent;
  text-decoration: none;
  font-size: 0.72em;
  font-weight: 400;
  font-family: 'EB Garamond', Georgia, serif;
  vertical-align: middle;
  cursor: pointer;
  transition: color 0.15s;
  user-select: none;
}
h2:hover .anchor-link, h3:hover .anchor-link, h4:hover .anchor-link { color: rgba(201,168,67,0.55); }
.anchor-link:hover { color: #c9a843 !important; text-decoration: none; }
.anchor-link.anchor-copied { color: #7ec87e !important; }

/* --- Floating TOC --- */
#toc {
  position: fixed;
  right: 0.75rem;
  top: 52px;
  width: 188px;
  max-height: calc(100vh - 68px);
  overflow-y: auto;
  background: #0d1f38;
  border: 1px solid rgba(201,168,67,0.28);
  border-radius: 2px;
  padding: 0.6rem 0 0.75rem;
  z-index: 50;
  display: none;
}
#toc::-webkit-scrollbar { width: 4px; }
#toc::-webkit-scrollbar-track { background: transparent; }
#toc::-webkit-scrollbar-thumb { background: rgba(201,168,67,0.25); border-radius: 2px; }
.toc-header {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: #c9a843;
  padding: 0 0.75rem 0.45rem;
  border-bottom: 1px solid rgba(201,168,67,0.18);
  margin-bottom: 0.35rem;
}
#toc ul { list-style: none; margin: 0; padding: 0; }
#toc li a {
  display: block;
  padding: 0.22rem 0.75rem;
  color: #8a7858;
  text-decoration: none;
  font-size: 0.78rem;
  line-height: 1.4;
  font-family: 'EB Garamond', Georgia, serif;
  transition: color 0.15s, background 0.15s;
}
#toc li.toc-h3 a { padding-left: 1.2rem; color: #6a5840; font-size: 0.74rem; }
#toc li a:hover { color: #d4b860; background: rgba(201,168,67,0.07); }
#toc li a.toc-active { color: #c9a843; border-left: 2px solid #c9a843; padding-left: calc(0.75rem - 2px); }
#toc li.toc-h3 a.toc-active { padding-left: calc(1.2rem - 2px); }

#toc-toggle {
  position: fixed;
  right: 0.75rem;
  top: 52px;
  background: #0d1f38;
  color: #c9a843;
  border: 1px solid rgba(201,168,67,0.28);
  border-radius: 2px;
  width: 30px;
  height: 30px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  z-index: 51;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
#toc-toggle:hover { background: rgba(201,168,67,0.14); }

@media (min-width: 1320px) {
  #toc { display: block; }
  #toc-toggle { display: none !important; }
}
@media (min-width: 769px) and (max-width: 1319px) {
  #toc-toggle { display: flex; }
  #toc.toc-visible { display: block; }
}

/* --- Status Board (status.html) --- */
article:has(.status-board) { max-width: 1400px; }

/* progress bar */
/* dual progress bars */
.bar-rows { margin: 0 0 1.1rem; }
.bar-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}
.bar-label-left {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8a7a62;
  min-width: 3.6rem;
  text-align: right;
  flex-shrink: 0;
}
.bar-label-right {
  font-size: 0.72rem;
  color: #6a5c48;
  white-space: nowrap;
  flex-shrink: 0;
}
.bar-aside { color: #9a8a72; }
.bar-beta  { color: #7a6850; font-style: italic; }
.bar-row .progress-track { flex: 1; margin: 0; }

.progress-track {
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
  margin: 0 0 1.1rem;
  display: flex;
  background: rgba(13,31,56,0.08);
}
.bar-note {
  font-size: 0.78rem; color: rgba(90,74,56,0.7); margin: -0.4rem 0 0.9rem;
  font-style: italic;
}
.pb-done     { background: #2d7a2d; }
.pb-pr       { background: #2a4ab0; }
.pb-partial  { background: #b87800; }
.pb-todo     { background: rgba(13,31,56,0.12); }
.pb-deferred { background: rgba(120,100,70,0.18); }

.page-crosslink {
  font-size: 0.82rem;
  color: #7a6a52;
  margin: -0.5rem 0 1.5rem;
}

/* summary chips */
.status-summary {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}
.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.28rem 0.85rem 0.28rem 0.65rem;
  border-radius: 2px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.stat-chip span { font-family: 'Playfair Display', Georgia, serif; font-size: 1.1rem; font-weight: 700; line-height: 1; }
.stat-chip::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.stat-done    { background: rgba(45,122,45,0.1);  color: #2d7a2d; border: 1px solid rgba(45,122,45,0.25); }
.stat-done::before    { background: #2d7a2d; }
.stat-pr      { background: rgba(42,74,176,0.1);  color: #2a4ab0; border: 1px solid rgba(42,74,176,0.25); }
.stat-pr::before      { background: #2a4ab0; }
.stat-partial { background: rgba(184,120,0,0.1);  color: #8a5800; border: 1px solid rgba(184,120,0,0.25); }
.stat-partial::before { background: #b87800; }
.stat-todo    { background: rgba(100,80,60,0.07); color: #5a4a38; border: 1px solid rgba(120,100,70,0.18); }
.stat-todo::before    { background: rgba(13,31,56,0.22); border: 1px solid rgba(13,31,56,0.15); }
.stat-beta    { background: rgba(100,80,50,0.07); color: #7a6040; border: 1px dashed rgba(120,90,50,0.3); font-style: italic; }
.stat-beta::before    { background: repeating-linear-gradient(45deg,rgba(100,80,50,0.4) 0px,rgba(100,80,50,0.4) 2px,transparent 2px,transparent 4px); }

/* milestone filter buttons */
.milestone-btn {
  padding: 0.2rem 0.7rem;
  border: 1px solid rgba(120,100,70,0.35);
  border-radius: 2px;
  background: transparent;
  color: #5a4a38;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.milestone-btn:hover { background: rgba(201,168,67,0.12); color: #0d1f38; }
.milestone-btn.active { background: #0d1f38; color: #c9a843; border-color: rgba(201,168,67,0.7); }

/* scope dimming for alpha/beta filter */
.scope-dimmed {
  opacity: 0.18;
  filter: grayscale(1);
  pointer-events: none;
  transition: opacity 0.2s, filter 0.2s;
}
.cov-item, .sb-item { transition: opacity 0.2s, filter 0.2s; }

/* filters */
.status-filters { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.filter-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #4a3a22;
}
.layer-btn {
  padding: 0.22rem 0.7rem;
  border: 1px solid rgba(201,168,67,0.35);
  border-radius: 2px;
  background: transparent;
  color: #6a5638;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.layer-btn:hover { background: rgba(201,168,67,0.12); color: #0d1f38; }
.layer-btn.active { background: #0d1f38; color: #c9a843; border-color: rgba(201,168,67,0.7); }

.filter-sep { width: 1px; height: 1.1rem; background: rgba(201,168,67,0.22); margin: 0 0.2rem; align-self: center; flex-shrink: 0; }
.group-btn {
  padding: 0.22rem 0.7rem;
  border: 1px solid rgba(201,168,67,0.35);
  border-radius: 2px;
  background: transparent;
  color: #6a5638;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.group-btn:hover { background: rgba(201,168,67,0.12); color: #0d1f38; }
.group-btn.active { background: #1a3a24; color: #7ec87e; border-color: rgba(80,160,80,0.4); }

/* board */
.status-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; align-items: start; }

.sb-col {
  border: 1px solid rgba(201,168,67,0.22);
  border-radius: 2px;
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
  max-height: 74vh;
}
.sb-col-body {
  overflow-y: auto;
  flex: 1;
}
.sb-col-body::-webkit-scrollbar { width: 4px; }
.sb-col-body::-webkit-scrollbar-track { background: transparent; }
.sb-col-body::-webkit-scrollbar-thumb { background: rgba(201,168,67,0.2); border-radius: 2px; }

.sb-col-header {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #faf6ec;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(201,168,67,0.25);
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sb-col-count {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0;
  opacity: 0.75;
}
.done-col   { background: #1a3a1a; }
.inwork-col { background: #0d2040; }
.todo-col   { background: #2a1e0e; }

/* sections */
.sb-section { border-bottom: 1px solid rgba(201,168,67,0.1); padding: 0.5rem 0 0.3rem; }
.sb-section:last-child { border-bottom: none; }
.sb-section-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.57rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #8a7050;
  padding: 0 0.85rem 0.3rem;
}
.sb-branch-title {
  display: flex;
  align-items: center;
  gap: 0.4em;
  text-transform: none;
  letter-spacing: 0.04em;
  font-size: 0.62rem;
}
.branch-name { font-family: 'Courier New', monospace; color: #2a4ab0; }
.branch-count {
  margin-left: auto;
  background: rgba(13,31,56,0.07);
  color: #5a4a38;
  font-size: 0.55rem;
  padding: 0.05em 0.4em;
  border-radius: 2px;
}

/* done cards */
.sb-done-card { padding: 0.6rem 0.85rem; border-bottom: 1px solid rgba(201,168,67,0.08); }
.sb-done-card:last-child { border-bottom: none; }
.sb-done-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1a3a1a;
  margin-bottom: 0.15rem;
}
.sb-done-summary {
  font-size: 0.73rem;
  color: #4a5840;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* items */
.sb-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.3rem 0.85rem;
  font-size: 0.8rem;
  line-height: 1.42;
  transition: background 0.1s;
}
.sb-item:hover { background: rgba(201,168,67,0.07); }
.sb-item[data-hidden] { display: none; }

.sb-status-dot {
  flex-shrink: 0;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-top: 0.42em;
}
.sb-needs-pr .sb-status-dot { background: #2a4ab0; box-shadow: 0 0 0 2px rgba(42,74,176,0.15); }
.sb-partial   .sb-status-dot { background: #b87800; box-shadow: 0 0 0 2px rgba(184,120,0,0.15); }
.sb-started   .sb-status-dot { background: #7a5200; box-shadow: 0 0 0 2px rgba(122,82,0,0.12); }
.sb-todo      .sb-status-dot { background: transparent; border: 1.5px solid rgba(13,31,56,0.28); }

.sb-item-text { flex: 1; min-width: 0; color: #1a0f08; }
.pr-badge {
  flex-shrink: 0;
  font-size: 0.6rem;
  font-family: 'Cinzel', Georgia, serif;
  letter-spacing: 0.04em;
  padding: 0.1em 0.45em;
  border-radius: 3px;
  background: rgba(42,74,176,0.10);
  color: #2a4ab0;
  text-decoration: none;
  border: 1px solid rgba(42,74,176,0.25);
  margin-right: 0.25em;
}
.pr-badge:hover { background: rgba(42,74,176,0.18); }
/* rules-summary implementation status pills */
.impl-pill {
  display: inline-block;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.12em 0.55em;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 0.5em;
  white-space: nowrap;
  font-weight: 600;
}
.impl-done    { background: rgba(45,122,45,0.15);  color: #1a5c1a; border: 1px solid rgba(45,122,45,0.3); }
.impl-pr      { background: rgba(42,74,176,0.12);  color: #1a2e80; border: 1px solid rgba(42,74,176,0.3); }
.impl-partial { background: rgba(184,120,0,0.12);  color: #7a4e00; border: 1px solid rgba(184,120,0,0.3); }
.impl-todo    { background: rgba(140,30,30,0.10);  color: #8c1e1e; border: 1px solid rgba(140,30,30,0.25); }
.impl-def     { background: rgba(100,80,60,0.08);  color: #6a5040; border: 1px solid rgba(100,80,60,0.2); }
.impl-beta    { font-style: italic; opacity: 0.75; }

.layer-tag {
  flex-shrink: 0;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.56rem;
  letter-spacing: 0.07em;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  background: rgba(13,31,56,0.06);
  color: #5a4a32;
  border: 1px solid rgba(201,168,67,0.16);
  white-space: nowrap;
  margin-top: 0.15em;
}
.started-badge {
  flex-shrink: 0;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  background: rgba(122,82,0,0.12);
  color: #7a5200;
  border: 1px solid rgba(122,82,0,0.25);
  white-space: nowrap;
  margin-top: 0.15em;
}

.sb-section:not(:has(.sb-item:not([data-hidden]))) { display: none; }

@media (max-width: 1100px) {
  article:has(.status-board) { max-width: 820px; }
  .status-board { grid-template-columns: 1fr; }
  .sb-col { max-height: none; }
}

/* --- Rulebook Coverage Heatmap --- */
article:has(.coverage-map) { max-width: 1200px; }

.coverage-summary {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin: 0 0 1.5rem;
}

.coverage-map {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.cov-chapter { }
.cov-chapter-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #0d1f38;
  margin: 0 0 0.45rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid rgba(201,168,67,0.3);
}
.cov-expand-bar {
  display: flex; gap: 0.5rem; margin-bottom: 0.8rem;
}
.cov-expand-btn {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.58rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.25em 0.8em; border-radius: 3px; cursor: pointer;
  background: rgba(201,168,67,0.08); color: #5a4a38;
  border: 1px solid rgba(201,168,67,0.28);
}
.cov-expand-btn:hover { background: rgba(201,168,67,0.18); color: #0d1f38; }

.cov-toggle {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.5em;
}
.cov-toggle::before {
  content: '▶';
  font-size: 0.5rem;
  opacity: 0.45;
  flex-shrink: 0;
}
.cov-chapter.open .cov-toggle::before { content: '▼'; }
.cov-chapter.open .cov-toggle { color: #1a3a24; }
.cov-ch-name { flex: 0 0 auto; }
.cov-sec-bar-wrap {
  flex: 1;
  min-width: 40px; max-width: 100px;
  display: flex; align-items: center;
}
.cov-sec-bar {
  width: 100%; height: 4px; border-radius: 2px;
  background: rgba(13,31,56,0.08);
  display: flex; overflow: hidden;
}
.csb-seg { height: 100%; }
.csb-done    { background: #2d7a2d; }
.csb-pr      { background: #2a4ab0; }
.csb-partial { background: #b87800; }
.cov-sec-count {
  flex-shrink: 0;
  font-size: 0.55rem;
  color: #8a7050;
  font-family: 'Cinzel', Georgia, serif;
  white-space: nowrap;
}
.cov-rules-link {
  color: inherit; text-decoration: none;
  border-bottom: 1px dotted rgba(13,31,56,0.25);
}
.cov-rules-link:hover { color: #2a4ab0; border-bottom-color: #2a4ab0; }

.cov-detail { display: none; margin: 0.5rem 0 0.8rem; }
.cov-chapter.open .cov-detail { display: block; }
.cov-detail-summary {
  font-size: 0.7rem; padding: 0.25rem 0.2rem 0.5rem;
  display: flex; gap: 0.6em; flex-wrap: wrap;
}
.cov-detail-summary .cov-dr-done    { color: #2d7a2d; font-weight: 600; }
.cov-detail-summary .cov-dr-pr      { color: #2a4ab0; font-weight: 600; }
.cov-detail-summary .cov-dr-partial { color: #b87800; font-weight: 600; }
.cov-detail-summary .cov-dr-todo    { color: rgba(13,31,56,0.45); font-weight: 600; }
.cov-detail-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.cov-dr td { padding: 0.18rem 0.4rem; }
.cov-dr-icon { width: 1.4em; text-align: center; font-weight: bold; opacity: 0.85; }
.cov-dr-label { color: #1a0f08; }
.cov-dr-done   .cov-dr-icon { color: #2d7a2d; }
.cov-dr-pr     .cov-dr-icon { color: #2a4ab0; }
.cov-dr-partial .cov-dr-icon { color: #b87800; }
.cov-dr-todo   .cov-dr-icon { color: rgba(13,31,56,0.35); }
.cov-dr-def    .cov-dr-icon { color: rgba(100,80,60,0.5); }
.cov-dr:hover td { background: rgba(201,168,67,0.07); }
.scope-pill {
  font-size: 0.6rem;
  padding: 0.05em 0.45em;
  border-radius: 3px;
  font-family: 'Cinzel', Georgia, serif;
  letter-spacing: 0.05em;
}
.scope-pill-alpha { background: rgba(29,80,29,0.12); color: #1d501d; }
.scope-pill-beta  { background: rgba(42,74,176,0.10); color: #2a4ab0; }

.cov-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cov-item {
  padding: 0.22rem 0.6rem;
  border-radius: 2px;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: nowrap;
  cursor: default;
}

.cov-done     { background: #2d7a2d; color: #dff0df; }
.cov-needs-pr { background: #2a4ab0; color: #dde5f8; }
.cov-partial  { background: #b87800; color: #fff3d8; }
.cov-todo     { background: rgba(13,31,56,0.07); color: #5a4a38; border: 1px solid rgba(201,168,67,0.2); }
.cov-deferred {
  background: repeating-linear-gradient(
    45deg,
    rgba(100,80,60,0.08) 0px, rgba(100,80,60,0.08) 3px,
    transparent 3px, transparent 6px
  );
  color: #8a7a62;
  border: 1px solid rgba(120,100,70,0.2);
}

.cov-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  background: rgba(13,31,56,0.04);
  border: 1px solid rgba(201,168,67,0.15);
  border-radius: 2px;
}
.cov-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.8rem;
  color: #4a3a22;
}
.cov-legend-swatch {
  width: 14px; height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Alpha Gaps page ─────────────────────────────────────────────────── */
/* Alpha summary banner */
.alpha-banner {
  background: linear-gradient(135deg, rgba(13,31,56,0.06) 0%, rgba(201,168,67,0.08) 100%);
  border: 1px solid rgba(201,168,67,0.3);
  border-radius: 6px;
  padding: 1.1rem 1.3rem 0.9rem;
  margin: 1.2rem 0 1.6rem;
}
.alpha-banner-header {
  display: flex; align-items: baseline; gap: 0.8rem;
  margin-bottom: 0.85rem;
}
.alpha-banner-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: #5a4a38;
}
.alpha-banner-date {
  margin-left: auto;
  font-size: 0.68rem; color: #8a7050; font-style: italic;
}
.readiness-red   { font-size: 0.72rem; font-weight: 700; color: #c03030; letter-spacing: 0.05em; }
.readiness-amber { font-size: 0.72rem; font-weight: 700; color: #b87800; letter-spacing: 0.05em; }
.readiness-green { font-size: 0.72rem; font-weight: 700; color: #2d7a2d; letter-spacing: 0.05em; }
.alpha-banner-stats {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-bottom: 1rem;
}
.alpha-banner-stat {
  padding: 0.3rem 0.75rem; border-radius: 3px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: #faf6ec;
}
.alpha-banner-bar .bar-rows { margin: 0; }
.alpha-banner-bar .bar-row  { margin-bottom: 0; }

.gap-stats {
  display: flex; flex-wrap: wrap; gap: 0.6rem;
  margin: 1.4rem 0 2rem;
}
.gap-stat {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 1rem; border-radius: 4px;
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: #faf6ec;
}
.gap-stat span {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.2rem; font-weight: 700;
}
.gap-stat-high    { background: #7a1a1a; border: 1px solid #c03030; }
.gap-stat-med     { background: #5a3a00; border: 1px solid #c9a843; }
.gap-stat-low     { background: #1a3a1a; border: 1px solid #3a7a3a; }
.gap-stat-feat    { background: #0d1f38; border: 1px solid #2a4ab0; }
.gap-stat-partial { background: #2a1f00; border: 1px solid #b87800; }

.gap-section-h {
  margin: 2.2rem 0 0.7rem;
  font-size: 1rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: #c9a843; border-bottom: 1px solid rgba(201,168,67,0.25);
  padding-bottom: 0.3rem;
}

.gap-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.875rem; margin-bottom: 1rem;
}
.gap-table thead th {
  text-align: left; padding: 0.4rem 0.7rem;
  background: rgba(13,31,56,0.7);
  color: #c9a843; font-size: 0.75rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  border-bottom: 1px solid rgba(201,168,67,0.3);
}
.gap-table td { padding: 0.35rem 0.7rem; vertical-align: top; }
.gap-table tr + tr td { border-top: 1px solid rgba(201,168,67,0.07); }

.gap-section-row td.gap-section-label {
  background: rgba(13,31,56,0.5);
  color: #c9a843; font-size: 0.78rem;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.3rem 0.7rem; font-weight: 600;
  border-top: 1px solid rgba(201,168,67,0.15) !important;
}

.gap-id    { font-family: monospace; font-size: 0.8rem; white-space: nowrap; width: 6.5rem; color: #8ab4d8; }
.gap-title { font-weight: 600; width: 35%; }
.gap-sym   { color: rgba(26,15,8,0.72); font-size: 0.83rem; }
.gap-feat  { padding-left: 1.2rem; }
.gap-area  { width: 0.5rem; }

.gap-row-high   { background: rgba(122,26,26,0.08); }
.gap-row-high:hover { background: rgba(122,26,26,0.15); }
.gap-row-med    { background: rgba(90,58,0,0.06); }
.gap-row-med:hover { background: rgba(90,58,0,0.12); }
.gap-row-low    { }
.gap-row-feat   { }
.gap-row-partial { background: rgba(42,31,0,0.06); }

.gap-none { color: #2d7a2d; font-style: italic; margin: 0.3rem 0 1rem; }

/* ---- Map Status Table ---- */
.map-status-table { width: 100%; border-collapse: collapse; margin: 0.8rem 0 1.4rem; }
.map-status-table thead th {
  background: rgba(13,31,56,0.55); color: #c9a843;
  font-family: 'Cinzel', serif; font-size: 0.68rem; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 0.45rem 0.7rem; text-align: left;
}
.map-status-table td { padding: 0.35rem 0.7rem; vertical-align: top; }
.map-status-table tr + tr td { border-top: 1px solid rgba(201,168,67,0.07); }
.ms-area  { font-weight: 500; white-space: nowrap; width: 22%; }
.ms-status { width: 2.5rem; text-align: center; }
.ms-sym { display: inline-block; width: 1.4rem; text-align: center;
  font-weight: 700; font-size: 1rem; border-radius: 2px; }
.ms-sym-done    { color: #2d7a2d; }
.ms-sym-needs-pr{ color: #2a4ab0; }
.ms-sym-partial { color: #b87800; }
.ms-sym-todo    { color: rgba(13,31,56,0.35); }
.ms-row-done    { background: rgba(45,122,45,0.04); }
.ms-row-partial { background: rgba(184,120,0,0.05); }
.ms-row-todo    { }
.ms-row-needs-pr{ background: rgba(42,74,176,0.05); }
.ms-desc code   { font-size: 0.82em; }
