/* ── StatuteViewer ─────────────────────────────────────────────────────────── */

/* Outer wrapper — fills available height between site header and footer */
.sv-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 9rem);
  min-height: 480px;
  border: 1px solid #dde3ec;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 2rem;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */

.sv-toolbar {
  display: flex;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  background: #f8f9fb;
  border-bottom: 1px solid #dde3ec;
  flex-shrink: 0;
}

.sv-select {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.875rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid #ccd3de;
  border-radius: 4px;
  background: #fff;
  color: #1a1a1a;
}

.sv-search {
  width: 190px;
  flex-shrink: 0;
  font: inherit;
  font-size: 0.875rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid #ccd3de;
  border-radius: 4px;
}

.sv-search:disabled {
  background: #f3f4f6;
  color: #aaa;
}

/* ── Body ────────────────────────────────────────────────────────────────── */

.sv-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Tree panel ──────────────────────────────────────────────────────────── */

.sv-tree {
  width: 290px;
  flex-shrink: 0;
  overflow-y: auto;
  border-right: 1px solid #dde3ec;
  padding: 0.375rem 0;
}

/* ── Content panel ───────────────────────────────────────────────────────── */

.sv-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 2rem;
}

/* ── Tree lists ──────────────────────────────────────────────────────────── */

.sv-tree-ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Toggle (group) buttons ──────────────────────────────────────────────── */

.sv-toggle,
.sv-rule-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.28rem 0.75rem;
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.35;
  cursor: pointer;
  color: #1a1a1a;
}

.sv-toggle {
  font-weight: 600;
  color: #222;
}

.sv-toggle:hover { background: #eef1f7; }
.sv-rule-btn:hover { background: #f0f4fb; }

/* Expand/collapse arrow */
.sv-toggle::before {
  content: '\25B6\00A0';
  font-size: 0.6em;
  color: #999;
  display: inline-block;
  transition: transform 0.12s;
  vertical-align: middle;
}

.sv-toggle[aria-expanded="true"]::before {
  transform: rotate(90deg);
}

/* Active leaf */
.sv-rule-btn.sv-active {
  background: #e8f0fe;
  color: #1a56a0;
  font-weight: 500;
}

/* ── Status / messages ───────────────────────────────────────────────────── */

.sv-msg {
  padding: 0.75rem 0.75rem;
  font-size: 0.82rem;
  color: #666;
  margin: 0;
}

.sv-loading { color: #888; font-style: italic; }
.sv-error   { color: #b00020; }

/* ── Content panel typography ────────────────────────────────────────────── */

.sv-breadcrumb {
  margin: 0 0 0.625rem;
  font-size: 0.78rem;
  color: #777;
  line-height: 1.4;
}

.sv-breadcrumb span + span::before {
  content: ' › ';
  color: #bbb;
}

.sv-rule-title {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  line-height: 1.3;
  color: #111;
}

.sv-rule-title-label {
  font-weight: 400;
  color: #333;
}

.sv-content p {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  line-height: 1.65;
  color: #222;
  max-width: 70ch;
}

.sv-content .source-note {
  margin-top: 1.25rem;
  padding-top: 0.875rem;
  border-top: 1px solid #eef0f4;
  font-size: 0.8rem;
  color: #666;
}

.sv-content .source-note p {
  font-size: 0.8rem;
  color: #666;
}

.sv-ext-link {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: #888;
}

.sv-ext-link a {
  color: #1a56a0;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 660px) {
  .sv-wrap {
    height: auto;
    min-height: 0;
  }

  .sv-body {
    flex-direction: column;
  }

  .sv-tree {
    width: 100%;
    max-height: 280px;
    border-right: none;
    border-bottom: 1px solid #dde3ec;
  }

  .sv-content {
    padding: 1rem;
    max-height: 60vh;
  }

  .sv-toolbar {
    flex-wrap: wrap;
  }

  .sv-search {
    width: 100%;
  }
}
