:root {
  --bg: #f4f1ea; --cream: #f4f1ea; --panel: #fff; --ink: #1a1a1a; --muted: #5a5a5a;
  --navy: #1f4e79; --accent: #1f4e79; --orange: #c45c26; --accent2: #c45c26;
  --amend: #8b1e1e; --line: #d9d2c4; --ok: #2f6b3a;
  font-family: Arial, Helvetica, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cream); color: var(--ink); }
html { scroll-behavior: smooth; }
#app { min-height: 100vh; display: flex; flex-direction: column; }
.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem; padding: .75rem 1rem; background: var(--navy); color: #fff;
}
.brand strong { font-size: 1.15rem; }
.brand .ver { display: block; font-size: .72rem; color: #ffd7c2; }
.modes { display: flex; gap: .35rem; }
.mode {
  font-family: Arial, Helvetica, sans-serif; border: 1px solid rgba(255,255,255,.35);
  background: transparent; color: #fff; padding: .4rem .75rem; border-radius: 999px; cursor: pointer;
}
.mode.active { background: var(--orange); border-color: var(--orange); font-weight: 700; }
.banner {
  background: #fff6e8; border-bottom: 1px solid #e6d3a8; color: #4a3a18;
  padding: .55rem 1rem; font-size: .85rem; line-height: 1.35;
}
.search-bar {
  display: flex; gap: .5rem; padding: .75rem 1rem; background: var(--panel);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
#q {
  flex: 1; font-family: Arial, Helvetica, sans-serif; font-size: 1rem;
  padding: .65rem .8rem; border: 1px solid #b9c3cf; border-radius: 8px;
}
#goSearch, .flip-nav button, .btn {
  font-family: Arial, Helvetica, sans-serif; background: var(--navy); color: #fff;
  border: 0; border-radius: 8px; padding: .65rem 1rem; cursor: pointer; font-weight: 700;
}
.btn.secondary { background: #4a667f; }
.btn.amend { background: var(--amend); }
.btn.calc { background: var(--orange); }
.layout { display: grid; grid-template-columns: 280px 1fr; flex: 1; min-height: 0; }
aside {
  background: #15375a; color: #fff; overflow: auto; max-height: calc(100vh - 160px); padding: .75rem;
}
.side-block h3 { margin: .4rem 0 .5rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; opacity: .85; }
.book-btn, .toc-item {
  display: block; width: 100%; text-align: left; background: transparent; color: #fff;
  border: 0; border-bottom: 1px solid rgba(255,255,255,.08); padding: .45rem .35rem;
  font-family: Arial, Helvetica, sans-serif; cursor: pointer; font-size: .86rem;
}
.book-btn.active, .toc-item.active { background: rgba(196,92,38,.35); font-weight: 700; }
.book-btn .meta, .toc-item .meta { display: block; font-size: .72rem; opacity: .75; }
main { padding: 1rem; overflow: auto; scroll-behavior: smooth; }
.status { color: var(--muted); }
.hit {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: .85rem 1rem; margin: 0 0 .65rem; cursor: pointer;
}
.hit:hover { border-color: var(--orange); }
.hit .who { font-size: .78rem; color: var(--muted); margin-bottom: .25rem; }
.hit .sec { font-weight: 700; color: var(--navy); }
.hit .snip { font-size: .92rem; line-height: 1.4; margin-top: .35rem; }
.hit mark { background: #ffe08a; padding: 0 .1em; }
.reader {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem 1.4rem;
}
.reader.scroll-reader { padding: .5rem 1.1rem 2rem; }
.scroll-reader .sec-block {
  padding: 1.1rem 0 1.35rem;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 5.5rem;
}
.scroll-reader .sec-block:last-child { border-bottom: 0; }
.reader h1 { font-size: 1.25rem; margin: 0 0 .35rem; color: var(--navy); }
.scroll-reader .sec-block h1 { font-size: 1.15rem; }
.reader .meta { color: var(--muted); font-size: .82rem; margin-bottom: .75rem; }
.badge {
  display: inline-block; background: var(--amend); color: #fff; font-size: .72rem; font-weight: 700;
  padding: .2rem .45rem; border-radius: 4px; margin-right: .35rem;
}
.amend-box {
  background: #fdecec; border: 1px solid #e3b0b0; border-radius: 8px; padding: .75rem; margin: .75rem 0 1rem;
}
.amend-box.amend-banner { border-left: 4px solid var(--amend); }
.amend-box h3 { margin: 0 0 .35rem; color: var(--amend); font-size: .95rem; }
.actions { display: flex; flex-wrap: wrap; gap: .45rem; margin: .75rem 0 1rem; }
.section-body {
  white-space: pre-wrap; font-family: Arial, Helvetica, sans-serif;
  font-size: .95rem; line-height: 1.55; max-width: 52rem;
  overflow-wrap: anywhere;
}
.section-body.has-html { white-space: normal; }
.section-body.has-html p { margin: 0 0 .65rem; }
.section-body.has-html ul, .section-body.has-html ol { margin: 0 0 .65rem 1.1rem; }

/* UpCodes-style Indiana amendment marks (from sec.htmlBody) */
/* Stocks Round R1: overlay markup uses .amd-ins / .amd-del — alias to amend-* */

.amend-add, .amend-green, .amd-ins, ins.amd-ins {
  background: #e6f4ea;
  border: 1px solid #a7d4b0;
  border-left: 4px solid var(--ok);
  border-radius: 3px;
  padding: 0 .2em;
  color: #1a3d22;
}
.amend-del, .amend-del s, s.amend-del, .amd-del, del.amd-del, .section-body s {
  color: #8b1e1e;
  background: #fdecec;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  border-radius: 2px;
  padding: 0 .15em;
}
.amend-banner {
  background: #fdecec;
  border: 1px solid #e3b0b0;
  border-left: 4px solid var(--amend);
  border-radius: 8px;
  padding: .75rem .85rem;
  margin: .75rem 0 1rem;
}
.amend-label {
  font-weight: 700;
  color: var(--amend);
  font-size: .9rem;
}
.amend-note {
  margin: .35rem 0 0;
  font-size: .9rem;
  line-height: 1.4;
  color: #4a2a2a;
}
.table-hit {
  background: #fff3cd;
  border-bottom: 2px solid var(--orange);
  padding: 0 .12em;
  border-radius: 2px;
  font-weight: 700;
}

a.table-link {
  color: var(--orange); font-weight: 700; text-decoration: underline;
  text-decoration-thickness: 2px; text-underline-offset: 2px;
  cursor: pointer;
}
a.table-link:hover { color: #a0481c; }
span.table-link {
  color: var(--orange); font-weight: 700; text-decoration: underline;
  text-decoration-thickness: 2px; text-underline-offset: 2px;
  cursor: pointer; background: #fff3cd; padding: 0 .15em; border-radius: 3px;
}


/* Brook cross-links (2026-09-12): section / calc / definition refs in body */
a.sec-link, a.calc-link, a.chapter-link {
  color: var(--navy); font-weight: 700; text-decoration: underline;
  text-decoration-thickness: 2px; text-underline-offset: 2px;
  cursor: pointer;
}
a.sec-link:hover, a.calc-link:hover, a.chapter-link:hover { color: var(--orange); }
a.def-link {
  color: var(--navy); font-weight: 600; text-decoration: underline dotted;
  text-decoration-thickness: 1.5px; text-underline-offset: 3px;
  cursor: pointer;
}
a.def-link:hover { color: var(--orange); }


/* Soft Prev/Next section bar (scroll context — not page flip) */
.flip-nav, .section-nav {
  display: none;
  position: sticky; bottom: 0; z-index: 6;
  align-items: center; justify-content: center; gap: .75rem;
  padding: .55rem 1rem;
  background: rgba(31, 78, 121, 0.95); color: #fff;
  border-top: 1px solid rgba(255,255,255,.2);
}
.flip-nav.visible, .section-nav.visible {
  display: flex !important;
}
.flip-nav button:disabled, .section-nav button:disabled {
  opacity: .45; cursor: not-allowed;
}
#flipPos { font-size: .85rem; min-width: 9rem; text-align: center; }
.tools .card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin-bottom: .75rem;
}
.tools a { color: var(--navy); }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  aside { max-height: 220px; }
}

#bookFilter {
  font-family: Arial, Helvetica, sans-serif; font-size: .9rem;
  padding: .55rem .6rem; border: 1px solid #b9c3cf; border-radius: 8px; max-width: 11rem;
  background: #fff; color: var(--ink);
}
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  aside { max-height: 220px; }
  #bookFilter { max-width: 40%; }
}

.brand{display:flex;align-items:center;gap:0.65rem}
.brand > div{display:flex;flex-direction:column}
.brand img{display:block}

/* Quick index — chapter chips above TOC (Brook 2026-09-12) */
#quickIndex.quick-index {
  position: sticky; top: 0; z-index: 2;
  background: #15375a; padding-bottom: .55rem;
  border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: .35rem;
}
#quickIndex h3 { margin: .15rem 0 .4rem; }
.qi-chips {
  display: flex; flex-wrap: wrap; gap: .28rem;
}
.qi-chip {
  font-family: Arial, Helvetica, sans-serif;
  font-size: .72rem; font-weight: 700;
  padding: .28rem .48rem; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.35);
  background: transparent; color: #fff;
  line-height: 1.1; white-space: nowrap;
}
.qi-chip:hover { border-color: var(--orange); color: #ffd7c2; }
.qi-chip.active {
  background: var(--orange); border-color: var(--orange); color: #fff;
}
.qi-clear {
  font-family: Arial, Helvetica, sans-serif;
  font-size: .68rem; font-weight: 700; text-transform: none; letter-spacing: 0;
  margin-left: .35rem; padding: .12rem .4rem; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.35); background: transparent; color: #ffd7c2;
  cursor: pointer; vertical-align: middle;
}
.qi-clear:hover { border-color: var(--orange); color: #fff; }
@media (max-width: 860px) {
  #quickIndex.quick-index { position: static; }
  .qi-chip { font-size: .68rem; padding: .24rem .42rem; }
}


/* Windowed scroll reader sentinels (large packs) */
.scroll-window-sentinel {
  margin: .75rem 0;
  padding: .55rem .75rem;
  background: #eef3f8;
  border: 1px dashed #8aa4bc;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  font-size: .85rem;
}
.scroll-window-sentinel:hover {
  border-color: var(--orange);
  color: var(--navy);
}
