.legend-box.deletion {
  background: var(--red-bg);
  border-color: var(--red);
}

.aligned-matrix .provision-col {
  width: 132px;
  min-width: 132px;
  max-width: 132px;
}

.aligned-matrix tbody th.provision-col {
  top: auto;
  z-index: 3;
  padding: .72rem .6rem;
  background: #f3f7fb;
  color: var(--navy);
  font-size: .8rem;
  line-height: 1.3;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  box-shadow: 6px 0 10px rgb(0 0 0 / .04);
}

.aligned-matrix .source-meta-row td {
  background: #f8fafc;
  padding: .58rem .75rem;
}

.aligned-matrix .source-meta-row .provision-col { background: #eaf1f8; }
.source-meta-row .provision-col span {
  display: block;
  margin-top: .25rem;
  color: var(--muted);
  font-weight: 500;
  font-size: .72rem;
}
.source-meta-row .source-link { display: block; margin-top: .25rem; }
.aligned-matrix .section-merge {
  vertical-align: top;
  background: #f8fafc;
}
.ui-icon { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.compact-view-head { align-items: center; min-height: 36px; margin-bottom: .42rem; }
.compact-view-head .section-identity { align-items: center; gap: .55rem; min-width: 0; }
.compact-view-head .section-identity h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-view-head .section-number { padding: .28rem .5rem; border-radius: 6px; }
.compact-risk { display: inline-flex; align-items: center; gap: .32rem; color: var(--muted); font-size: .75rem; font-weight: 720; text-transform: capitalize; white-space: nowrap; }
.compact-risk i { width: 8px; height: 8px; border-radius: 50%; background: var(--grey); }
.compact-risk.high i { background: var(--red); }.compact-risk.medium i { background: var(--amber); }.compact-risk.low i { background: var(--green); }
.matrix-commandbar { gap: .35rem; padding: .34rem .42rem; margin-bottom: .28rem; border-radius: 8px; }
.matrix-commandbar .subtabs { gap: .15rem; }
.matrix-commandbar button { display: inline-flex; align-items: center; justify-content: center; gap: .28rem; height: 29px; padding: 0 .48rem; font-size: .78rem; }
.command-divider { width: 1px; height: 22px; margin: 0 .12rem; background: var(--line); }
.matrix-filters { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.filter-group { display: inline-flex; padding: 1px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.toolbar .filter-group button { height: 27px; border: 0; background: transparent; padding: 0 .38rem; }
.toolbar .filter-group button.active { background: var(--blue); color: #fff; }
.source-command { margin-left: auto; }
.integrated-provision-matrix .baseline-law-cell { width: 360px; max-width: 360px; }
.integrated-provision-matrix th:first-child { position: sticky; left: 0; z-index: 6; }
.integrated-provision-matrix tbody td:first-child { position: sticky; left: 0; z-index: 2; background: var(--panel); box-shadow: 6px 0 10px rgb(0 0 0 / .04); }
.integrated-provision-matrix .section-start td { border-top: 3px solid #9eb1c4; }
.integrated-provision-matrix .section-start td:first-child { border-top-color: var(--blue); }
.provision-section-cell b { display: block; color: var(--navy); font-size: .84rem; }
.provision-section-cell span { display: block; margin-top: .3rem; color: var(--muted); font-size: .72rem; font-weight: 500; line-height: 1.4; }
.law-provision { display: grid; grid-template-columns: 68px minmax(0,1fr); gap: .32rem; align-items: start; }
.inline-provision-code { color: var(--blue); font-size: .73rem; font-weight: 800; line-height: 1.35; word-break: break-word; }
.provision-copy { min-width: 0; }
.header-source-link { display: inline-block; margin-top: .28rem; color: #a9d5ff; font-size: .67rem; font-weight: 650; text-decoration: none; }
.header-source-link:hover { color: #fff; text-decoration: underline; }
.aligned-matrix .provision-row td { padding: .55rem .62rem; }
.aligned-matrix .provision-row:nth-child(odd) td { background: #fcfdff; }
.aligned-matrix .provision-row p { margin: 0; white-space: normal; }
.aligned-matrix .provision-row .provision-level-1,
.aligned-matrix .provision-row .provision-level-2 { margin-left: 0; text-indent: 0; }
.aligned-matrix .provision-row .provision-heading { font-weight: 750; color: var(--navy); }

.tracked-change .change-kind {
  display: inline-block;
  margin-bottom: .38rem;
  border-radius: 999px;
  background: #edf3f8;
  color: #52677c;
  padding: .15rem .42rem;
  font-size: .65rem;
  font-weight: 750;
}

.tracked-change ins.change-add,
.tracked-change del.change-del { padding: 0 .08em; }
.omitted-tag {
  display: inline-block;
  margin-left: .3rem;
  border-radius: 999px;
  background: var(--red-bg);
  color: var(--red);
  padding: .1rem .36rem;
  font-size: .65rem;
  font-weight: 750;
  vertical-align: middle;
}
.no-corresponding-text { color: #a6b2bf; }
.aligned-matrix .row-empty { background: #f8fafc !important; }

.export-menu,
.export-menu button { color: var(--ink); }
#exportToggle[aria-expanded="true"] {
  background: #fff;
  color: var(--navy);
  border-color: #fff;
}

.matrix-commandbar .column-choices { gap: .25rem; }
.matrix-commandbar .column-choices label { display: inline-flex; align-items: center; gap: .25rem; padding: .18rem .38rem; border-radius: 6px; font-size: .72rem; line-height: 1.2; }
.matrix-commandbar .column-choices input { width: 13px; height: 13px; }
.matrix-commandbar .compare-label { margin: 0 .05rem 0 .15rem; font-size: .7rem; }
.matrix-legend { min-height: 24px; margin: .2rem 0 .28rem; gap: .5rem; }
.matrix-legend .ui-icon { width: 13px; height: 13px; }
.matrix-legend .legend-scope { margin-left: auto; color: var(--ink); font-weight: 650; }
.integrated-provision-matrix .baseline-law-cell { width: 330px; max-width: 330px; }
.matrix-wrap { max-height: calc(100vh - 230px); }

@media (max-width: 860px) {
  .aligned-matrix tbody th.provision-col {
    display: block;
    position: static;
    width: 100%;
    max-width: none;
    box-shadow: none;
  }
  .aligned-matrix .source-meta-row .provision-col { width: 100%; max-width: none; }
  .aligned-matrix .section-merge { display: block; width: 100% !important; max-width: none !important; }
  .integrated-provision-matrix tbody td:first-child { position: static; box-shadow: none; }
  .compact-view-head .section-identity h1 { white-space: normal; }
  .matrix-commandbar { align-items: flex-start; }
  .command-divider { display: none; }
  .matrix-commandbar .column-choices { order: 5; }
  .law-provision { grid-template-columns: 64px minmax(0,1fr); }
}

@media print {
  .aligned-matrix tbody th.provision-col {
    position: static;
    background: #f3f7fb !important;
    color: #0b1f3a !important;
    box-shadow: none;
  }
  .integrated-provision-matrix th:first-child,
  .integrated-provision-matrix tbody td:first-child { position: static; box-shadow: none; }
}
