:root {
  --ink: #1c2126; --muted: #5d6670; --line: #d9dde2; --soft: #f4f5f7; --paper: #ffffff;
  --accent: #1f4e79; --accent-soft: #e8eef5; --good: #1d6b3a; --good-soft: #e3f1e7; --warn: #8a5a00; --warn-soft: #fbf3df; --bad: #9b2226;
  --opening: #1f4e79; --entry: #4a5560; --closing: #6b3fa0; --proviso: #8a5a00;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--soft); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top { display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.25rem; background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
header.top .brand { font-weight: 700; color: var(--ink); letter-spacing: .01em; }
header.top nav { display: flex; gap: .25rem; flex: 1; }
header.top nav a { padding: .35rem .7rem; border-radius: 6px; color: var(--muted); }
header.top nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
header.top .account { font-size: .93rem; }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
main { padding: 1rem 1.25rem 3rem; }
h1 { font-size: 1.35rem; margin: .4rem 0 .5rem; }
h1 .hd { font-weight: 400; color: var(--muted); margin-left: .4rem; }
h2 { font-size: 1rem; margin: 0 0 .5rem; }
h2.sub { margin-top: 2rem; }
.lead { color: var(--muted); margin: 0 0 1rem; }
.count { color: var(--muted); margin: 0 0 .6rem; }
.small, .muted { color: var(--muted); }
.small { font-size: .87rem; margin-top: .2rem; max-width: 60rem; }
.nowrap { white-space: nowrap; }
.flash { background: var(--good-soft); border: 1px solid #b9dcc4; color: var(--good); padding: .55rem .8rem; border-radius: 6px; margin: 0 0 1rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); background: var(--paper); border: 1px dashed var(--line); border-radius: 8px; }
.narrow { max-width: 24rem; margin: 3rem auto; background: var(--paper); padding: 1.5rem; border: 1px solid var(--line); border-radius: 10px; }
.narrowish { max-width: 60rem; }
.stack { display: grid; gap: .8rem; }
.stack label, .filters label { display: grid; gap: .2rem; font-size: .85rem; color: var(--muted); }
.exportform { max-width: 28rem; background: var(--paper); padding: 1.25rem; border: 1px solid var(--line); border-radius: 10px; }
input, select, textarea { font: inherit; color: var(--ink); padding: .4rem .5rem; border: 1px solid #b9c0c8; border-radius: 6px; background: #fff; max-width: 100%; }
textarea { width: 100%; line-height: 1.45; resize: vertical; }
input.widein { width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary { background: var(--accent); color: #fff; border: 0; padding: .5rem 1rem; border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer; }
button.primary:hover { background: #173b5c; }
.small-btn { background: #fff; border: 1px solid #b9c0c8; border-radius: 6px; padding: .3rem .65rem; font: inherit; font-size: .88rem; cursor: pointer; color: var(--ink); }
.small-btn:hover { border-color: var(--accent); color: var(--accent); }
.small-btn.danger { color: var(--bad); }
.small-btn.danger:hover { border-color: var(--bad); }
form.inline { display: inline; margin-left: .6rem; }
label.check { display: flex; align-items: center; gap: .4rem; color: var(--ink); font-size: .93rem; }
.filters { display: flex; flex-wrap: wrap; gap: .7rem; align-items: end; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .8rem; margin-bottom: 1rem; }
.filters .grow { flex: 1 1 16rem; }
.filters .grow input { width: 100%; }
.filters select { max-width: 19rem; }
.filters .reset { align-self: center; font-size: .9rem; }
.filters .check { align-self: center; }
.split { display: flex; gap: 1rem; align-items: flex-start; }
.regs { flex: 0 0 17rem; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .7rem; position: sticky; top: 3.6rem; max-height: calc(100vh - 4.6rem); overflow: auto; }
.regs ol { list-style: none; margin: .3rem 0 0; padding: 0; }
.regs a { display: grid; grid-template-columns: 2.6rem 1fr auto; gap: .35rem; padding: .25rem .4rem; border-radius: 5px; color: var(--ink); font-size: .9rem; align-items: baseline; }
.regs a:hover { background: var(--soft); text-decoration: none; }
.regs a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.regs a.all { display: block; }
.regs .n { font-variant-numeric: tabular-nums; font-weight: 600; }
.regs .c { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.regs .c.done { color: var(--good); font-weight: 600; }
.rows { flex: 1; min-width: 0; }
.scroll { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
table.grid { border-collapse: collapse; width: 100%; }
table.grid th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .5rem .6rem; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; position: sticky; top: 0; }
table.grid td { padding: .45rem .6rem; border-bottom: 1px solid #eceef1; vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
table.docs td:first-child { min-width: 22rem; }
table.clauses td { font-variant-numeric: tabular-nums; }
table.clauses .c-citation { white-space: nowrap; }
table.clauses .c-text { min-width: 26rem; width: 60%; }
table.clauses.wide .c-text { min-width: 34rem; }
table.clauses.wide td { font-size: .9rem; }
table.clauses.wide .c-note, table.clauses.wide .c-source, table.clauses.wide .c-amended_by, table.clauses.wide .c-heading, table.clauses.wide .c-instrument { min-width: 13rem; }
table.clauses tr.newreg td { border-top: 2px solid #aab3bd; }
table.clauses tr.not-in-force .tx { color: var(--muted); text-decoration: line-through; text-decoration-color: #b9c0c8; }
table.clauses tr:target td { background: #fff8e1; }
.tx { white-space: pre-wrap; }
.tx.d1 { padding-left: 0; } .tx.d2 { padding-left: 1.6rem; } .tx.d3 { padding-left: 3.2rem; } .tx.d4 { padding-left: 4.8rem; }
tr.role-opening .tx { font-weight: 600; }
tr.role-closing .tx, tr.role-proviso .tx { font-style: italic; }
.role { display: inline-block; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; padding: .08rem .4rem; border-radius: 4px; border: 1px solid currentColor; white-space: nowrap; }
tr.role-opening .role, li .role { color: var(--opening); }
tr.role-entry .role { color: var(--entry); border-color: #c5cbd2; }
tr.role-closing .role { color: var(--closing); }
tr.role-proviso .role { color: var(--proviso); }
.noteline { margin-top: .3rem; font-size: .86rem; color: var(--warn); background: var(--warn-soft); border-radius: 5px; padding: .25rem .45rem; }
.noteline span { font-weight: 700; text-transform: uppercase; font-size: .72rem; letter-spacing: .05em; margin-right: .3rem; }
.flagline { margin-top: .25rem; font-size: .86rem; color: var(--bad); }
.c-verified { width: 1%; text-align: center; }
.vform { margin: 0; }
.vbtn { width: 1.55rem; height: 1.55rem; border-radius: 5px; border: 1.5px solid #9aa3ad; background: #fff; cursor: pointer; font-size: 1rem; line-height: 1; color: #fff; padding: 0; }
.vbtn.yes { background: var(--good); border-color: var(--good); }
.vbtn:hover { border-color: var(--good); }
.tick { color: var(--good); font-weight: 700; } .untick { color: #b3bac2; }
.pager { display: flex; gap: .3rem; margin-top: .9rem; flex-wrap: wrap; }
.pager a, .pager span { padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); }
.pager .on { background: var(--accent); color: #fff; border-color: var(--accent); }
.pager .gap { border: 0; background: none; }
.crumbs { margin: 0; color: var(--muted); font-size: .92rem; }
.clausehead { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.clausehead .pn { display: flex; gap: 1rem; font-size: .92rem; }
.two { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.two > section { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .4rem 1rem 1rem; }
table.fields { border-collapse: collapse; width: 100%; }
table.fields th { text-align: left; font-weight: 600; color: var(--muted); font-size: .86rem; padding: .45rem .8rem .45rem 0; width: 9.5rem; vertical-align: top; white-space: nowrap; }
table.fields td { padding: .35rem 0; border-bottom: 1px solid #eceef1; }
table.fields tr:last-child td { border-bottom: 0; }
.fulltext { white-space: pre-wrap; font-size: 1.02rem; }
.actions { margin: 1rem 0 0; }
.rowtools { display: flex; gap: .6rem; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.context { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .8rem; position: sticky; top: 3.6rem; max-height: calc(100vh - 4.6rem); overflow: auto; }
.context ol { list-style: none; margin: 0; padding: 0; }
.context li a { display: block; padding: .25rem .4rem; border-radius: 5px; color: var(--ink); font-size: .88rem; }
.context li a:hover { background: var(--soft); text-decoration: none; }
.context li.on a { background: var(--accent-soft); }
.context li.d2 { margin-left: 1rem; } .context li.d3 { margin-left: 2rem; } .context li.d4 { margin-left: 3rem; }
.context .lab { font-weight: 700; font-variant-numeric: tabular-nums; }
.context .role { font-size: .66rem; color: var(--muted); border-color: #c5cbd2; }
@media (max-width: 900px) {
  .split, .two { display: block; }
  .regs, .context { position: static; max-height: 16rem; margin-bottom: 1rem; }
  header.top { flex-wrap: wrap; gap: .5rem; }
}
