:root {
  color-scheme: light;
  /* Financial Sandbox blue with UNIST's official Navy and Emerald accents. */
  --sandbox-blue: #3057b9;
  --unist-navy: #001b54;
  --unist-emerald: #44c1c4;
  --canvas: #f7f9fd;
  --surface: #ffffff;
  --surface-muted: #edf3fc;
  --text: var(--unist-navy);
  --muted: #52627d;
  --line: #d6e0f0;
  --line-strong: #afc1db;
  --teal: var(--sandbox-blue);
  --teal-dark: var(--unist-navy);
  --teal-soft: #edf3fc;
  --teal-line: #b7ccef;
  --emerald-soft: #e5f5f5;
  --warning: #7e570e;
  --warning-bg: #fff6df;
  --danger: #a72d2d;
  --focus: var(--unist-emerald);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
}

button,
textarea,
select {
  font: inherit;
}

button,
a,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

a {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

h1,
h2,
h3,
p,
ol,
ul,
dl,
dd {
  margin: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.brand {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 20px;
  font-weight: 760;
  line-height: 1.2;
  text-decoration: none;
}

.brand-sandbox-logo {
  display: block;
  width: 158px;
  height: auto;
  flex: 0 0 auto;
}

.brand-service-name {
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
  font-size: 17px;
  font-weight: 720;
}

.header-actions {
  display: flex;
  align-self: stretch;
  align-items: center;
}

.primary-nav {
  display: flex;
  align-self: stretch;
  align-items: stretch;
  gap: 8px;
}

.lab-brand {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.lab-brand img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.lab-brand-copy {
  display: grid;
  gap: 1px;
  line-height: 1.1;
  white-space: nowrap;
}

.lab-brand-copy strong {
  font-size: 14px;
  font-weight: 800;
}

.lab-brand-copy span {
  font-size: 11px;
  font-weight: 720;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-bottom: 3px solid transparent;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.nav-link:hover,
.nav-link.active {
  color: var(--teal-dark);
}

.nav-link.active {
  border-bottom-color: var(--unist-emerald);
}

.app-main,
.guide-main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 32px;
}

.search-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 56px;
  align-items: stretch;
  padding: 18px 0 36px;
  border-bottom: 1px solid var(--line);
}

.search-intro-main {
  min-width: 0;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 780;
  line-height: 1.35;
}

h1 {
  max-width: 850px;
  font-size: 30px;
  font-weight: 780;
  line-height: 1.27;
}

h2 {
  font-size: 20px;
  font-weight: 760;
  line-height: 1.3;
}

h3 {
  font-size: 17px;
  font-weight: 760;
  line-height: 1.38;
}

.search-description {
  max-width: 760px;
  margin-top: 12px;
  color: var(--muted);
}

.search-form {
  margin-top: 24px;
}

.query-label,
.filters label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 720;
}

.query-field {
  position: relative;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

textarea {
  min-height: 116px;
  padding: 16px 70px 36px 16px;
  resize: vertical;
  line-height: 1.6;
}

textarea::placeholder {
  color: #77858c;
  opacity: 1;
}

select {
  min-height: 46px;
  padding: 0 38px 0 13px;
}

.query-count {
  position: absolute;
  right: 14px;
  bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.primary-action,
.secondary-action,
.quiet-button,
.compare-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--teal);
  border-radius: 6px;
  font-weight: 760;
  line-height: 1.2;
  text-decoration: none;
}

.primary-action {
  width: 100%;
  margin-top: 12px;
  background: var(--teal);
  color: #fff;
}

.primary-action:hover {
  background: var(--teal-dark);
}

.secondary-action,
.compare-toggle {
  background: var(--surface);
  color: var(--teal);
}

.secondary-action:hover,
.compare-toggle:hover,
.compare-toggle.selected {
  background: var(--teal-soft);
}

.quiet-button {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.quiet-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.filter-details {
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.filter-details summary {
  min-height: 46px;
  padding-top: 12px;
  color: var(--teal);
  font-weight: 760;
  cursor: pointer;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 8px 0 4px;
}

.search-steps {
  display: flex;
  flex-direction: column;
  padding: 22px 0 0 28px;
  border-left: 1px solid var(--line);
}

.search-steps h2 {
  margin-bottom: 14px;
  font-size: 18px;
}

.search-steps ol {
  display: grid;
  gap: 0;
  padding: 0;
  list-style: none;
}

.search-steps li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.search-steps li > span,
.section-number,
.reason-list li > span {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 15px;
  font-weight: 780;
}

.search-steps strong {
  display: block;
  font-size: 16px;
}

.search-steps p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.case-count {
  display: grid;
  gap: 3px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.case-count strong {
  color: var(--teal);
  font-size: 17px;
}

.case-count span {
  color: var(--muted);
  font-size: 13px;
}

.search-feedback {
  margin: 18px 0;
  color: var(--muted);
  font-size: 15px;
}

.search-feedback[data-tone="error"] {
  color: var(--danger);
}

.search-feedback[data-tone="notice"] {
  color: var(--warning);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(330px, 0.9fr) minmax(520px, 1.35fr);
  gap: 20px;
  align-items: start;
}

.workspace[hidden] {
  display: none;
}

.results-panel,
.detail-panel {
  min-width: 0;
  border-top: 2px solid var(--text);
  background: var(--surface);
}

.results-panel {
  padding: 20px;
}

.detail-panel {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 20px;
  overscroll-behavior: auto;
  scrollbar-gutter: stable;
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-heading .eyebrow {
  margin-bottom: 4px;
}

.result-count {
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.comparison-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--teal);
}

.comparison-bar[hidden] {
  display: none;
}

.comparison-bar > div {
  display: flex;
  gap: 8px;
}

.comparison-bar .quiet-button,
.comparison-bar .secondary-action {
  min-height: 38px;
  padding: 0 12px;
  font-size: 14px;
}

.result-list {
  display: grid;
  gap: 0;
}

.result-row {
  display: grid;
  gap: 10px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.result-row.selected {
  margin-left: -12px;
  padding-left: 12px;
  border-left: 4px solid var(--unist-emerald);
  background: var(--teal-soft);
}

.result-select {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.result-select:hover strong {
  color: var(--teal);
}

.result-company,
.result-meta {
  color: var(--muted);
  font-size: 14px;
}

.result-select strong {
  font-size: 18px;
  line-height: 1.4;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.match-tag-button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 680;
}

.match-tag-button:hover,
.match-tag-button.active {
  border-color: var(--unist-emerald);
  background: var(--emerald-soft);
  color: var(--teal-dark);
}

.match-preview {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--teal-line);
  border-left: 3px solid var(--unist-emerald);
  background: var(--teal-soft);
}

.match-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.match-preview-head strong {
  color: var(--teal-dark);
  font-size: 14px;
}

.match-preview-head .quiet-button {
  min-height: 32px;
  padding: 0 9px;
  font-size: 13px;
}

.match-preview .evidence-text {
  max-height: 190px;
}

.result-reason {
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

.result-reason b {
  margin-right: 8px;
  color: var(--teal);
}

.result-row-actions,
.case-detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.result-row-actions .quiet-button,
.result-row-actions .compare-toggle,
.case-detail-actions .compare-toggle {
  min-height: 38px;
  padding: 0 12px;
  font-size: 14px;
}

.compact-source-links,
.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.compact-source-links a,
.source-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--teal-line);
  border-radius: 5px;
  color: var(--teal);
  font-size: 14px;
  font-weight: 720;
  text-decoration: none;
}

.compact-source-links a {
  min-height: 38px;
  font-size: 13px;
}

.compact-source-links a:hover,
.source-links a:hover {
  background: var(--teal-soft);
}

.empty-results,
.empty-detail,
.empty-evidence {
  display: grid;
  gap: 6px;
  padding: 22px 0;
  color: var(--muted);
}

.empty-results strong,
.empty-detail strong {
  color: var(--text);
}

.case-detail {
  display: grid;
  gap: 20px;
}

.case-detail-head {
  display: grid;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.case-detail-head > div:first-child {
  min-width: 0;
}

.case-detail-head > div:first-child > span {
  color: var(--muted);
  font-size: 15px;
}

.case-detail-head h3 {
  margin-top: 3px;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.case-detail-head p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.case-detail-actions {
  justify-content: flex-start;
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.case-detail-actions > .compare-toggle,
.case-detail-actions > .secondary-action {
  box-sizing: border-box;
  inline-size: 170px;
  min-height: 48px;
  padding: 0 14px;
  font-size: 16px;
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.2;
}

.case-detail-actions .compact-source-links {
  flex: 0 1 auto;
}

.external-action,
.disabled-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.disabled-action {
  border-color: var(--line);
  color: var(--muted);
  background: var(--surface-muted);
}

.case-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.case-tab {
  min-height: 42px;
  padding: 0 2px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 760;
}

.case-tab:hover,
.case-tab.selected {
  border-bottom-color: var(--unist-emerald);
  color: var(--teal-dark);
}

.case-tab-panel {
  display: grid;
  gap: 20px;
}

/* The component establishes a grid, so the browser's default [hidden] rule
   must be restated at the same specificity. */
.case-tab-panel[hidden] {
  display: none;
}

.detail-section {
  display: grid;
  gap: 10px;
}

.detail-section > h3 {
  font-size: 18px;
}

.law-verification-section {
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--teal-line);
  border-left: 3px solid var(--sandbox-blue);
  background: #f8fbff;
  scroll-margin-top: 88px;
}

.law-verification-section:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.law-verification-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.law-verification-head h3 {
  color: var(--teal-dark);
}

.law-verification-head p,
.law-loading {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.law-verification-head .secondary-action {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 12px;
  font-size: 14px;
}

.law-live-status {
  margin: 0;
  min-height: 44px;
  padding: 10px 12px;
  border-left: 3px solid var(--sandbox-blue);
  background: var(--teal-soft);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.law-live-status[data-long-running="true"] {
  border-left-color: #d59d36;
  background: var(--warning-bg);
  color: var(--warning);
}

.law-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e5c37d;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 14px;
}

.law-error .quiet-button,
.law-status-item {
  min-height: 44px;
}

.law-status-summary,
.law-caution {
  color: var(--muted);
  font-size: 14px;
}

.law-status-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.law-status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.law-status-row.selected {
  border-left: 3px solid var(--unist-emerald);
  background: var(--emerald-soft);
}

.law-status-item {
  display: grid;
  width: 100%;
  gap: 10px;
  padding: 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.law-status-item:hover {
  background: #f8fbff;
}

.case-tab:focus-visible,
.law-status-item:focus-visible,
.law-status-link:focus-visible,
.law-provision-text:focus-visible {
  outline: 3px solid var(--unist-emerald);
  outline-offset: 2px;
}

.law-status-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.law-status-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.law-status-title strong {
  overflow-wrap: anywhere;
}

.law-authority-type {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
}

.law-timeline {
  display: grid;
  gap: 3px;
  margin: 0;
}

.law-timeline > div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
}

.law-timeline dt {
  color: var(--muted);
  font-size: 13px;
}

.law-timeline dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.law-decision {
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  border-left: 3px solid var(--line-strong);
  background: var(--surface-muted);
  font-size: 13px;
  line-height: 1.55;
}

.law-decision strong {
  color: var(--text);
}

.law-decision span {
  color: var(--muted);
}

.law-decision-confirmed {
  border-left-color: var(--unist-emerald);
  background: var(--emerald-soft);
}

.law-decision-changed {
  border-left-color: #bd514b;
  background: #fff4f3;
}

.law-decision-history {
  border-left-color: #607aa7;
  background: #f3f6fb;
}

.law-decision-review {
  border-left-color: #d59d36;
  background: var(--warning-bg);
}

.law-status-actions {
  display: none;
}

.law-status-link {
  display: flex;
  min-height: 44px;
  align-self: center;
  align-items: center;
  padding: 8px 12px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 720;
  text-align: right;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.law-selected-diff {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.law-selected-diff-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
}

.law-diff-precision-notice {
  padding: 10px 12px;
  border-left: 3px solid #d59d36;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 13px;
  line-height: 1.55;
}

.law-selected-diff-head h4 {
  font-size: 16px;
}

.law-selected-diff-head span {
  color: var(--muted);
  font-size: 14px;
}

.law-comparison-unavailable p,
.law-comparison-note,
.law-comparison-context {
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid var(--line-strong);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.law-comparison-note {
  border-left-color: #d59d36;
  background: var(--warning-bg);
  color: var(--warning);
}

.law-comparison-context {
  border-left-color: #607aa7;
  background: #f3f6fb;
}

.law-comparison-same-summary {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid var(--unist-emerald);
  background: var(--emerald-soft);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.law-comparison-same-summary strong {
  color: var(--teal-dark);
}

.law-comparison-same-summary span {
  color: var(--muted);
}

.law-comparison-conflict-summary {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid #d59d36;
  background: var(--warning-bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.law-comparison-conflict-summary strong {
  color: var(--warning);
}

.law-comparison-conflict-summary span {
  color: var(--muted);
}

.law-same-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 13px;
}

.law-same-text {
  display: grid;
  gap: 6px;
}

.law-same-text h5 {
  margin: 0;
  color: var(--teal-dark);
  font-size: 14px;
}

.law-same-text .evidence-text {
  max-height: 360px;
  font-size: 14px;
}

.law-provision-text-neutral {
  border-left-color: var(--line-strong);
}

.law-full-article-evidence {
  width: 100%;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.law-full-article-evidence summary {
  display: flex;
  width: fit-content;
  min-height: 44px;
  align-items: center;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.law-full-article-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.law-full-article-grid {
  margin-top: 10px;
}

.law-full-article-grid .law-provision-text {
  max-height: 440px;
}

.law-provision-text-original {
  white-space: pre-wrap;
}

.law-diff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.law-diff-grid section {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.law-diff-grid h5 {
  margin: 0;
  color: var(--teal-dark);
  font-size: 14px;
}

.law-diff-grid p {
  color: var(--muted);
  font-size: 13px;
}

.law-diff-grid .evidence-text {
  max-height: 360px;
  font-size: 14px;
}

.law-missing-text {
  min-height: 82px;
  padding: 13px 14px;
  border-left: 3px solid var(--line-strong);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 14px;
}

.diff-removed,
.diff-added {
  padding: 0 1px;
}

.diff-removed {
  background: #fde9e8;
  color: #8a2622;
}

.diff-added {
  background: #e2f4ee;
  color: #0e6849;
}

.law-evidence {
  width: 100%;
}

.law-evidence summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.law-evidence-body {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.law-evidence-body > div {
  display: grid;
  gap: 5px;
}

.law-evidence-body strong {
  color: var(--muted);
  font-size: 12px;
}

.law-evidence .evidence-text {
  max-height: 180px;
  font-size: 13px;
}

.reason-list {
  display: grid;
  gap: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.reason-list li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.reason-list li > span {
  width: 26px;
  height: 26px;
  font-size: 13px;
}

.reason-list strong {
  display: block;
}

.reason-list p {
  margin-top: 4px;
  color: var(--text);
  font-size: 15px;
}

.evidence-text {
  padding: 13px 14px;
  border-left: 3px solid var(--teal);
  background: var(--teal-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.65;
}

.evidence-scrollable {
  max-height: 260px;
  overflow: auto;
  overscroll-behavior: auto;
  scrollbar-gutter: stable;
}

.source-section > p {
  color: var(--muted);
  font-size: 15px;
}

.source-card {
  border-top: 1px solid var(--line);
}

.source-card:last-child {
  border-bottom: 1px solid var(--line);
}

.source-card summary {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-weight: 720;
  cursor: pointer;
}

.source-card summary span:last-child {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-align: right;
}

.source-card[open] {
  padding: 0 0 14px;
}

.source-card .source-links {
  margin: 0 0 10px;
}

.source-card .evidence-text {
  max-height: 300px;
}

.source-full-button {
  width: 100%;
  margin-top: 10px;
}

.comparison-dialog {
  width: min(1440px, calc(100vw - 32px));
  max-width: none;
  height: min(94vh, 1120px);
  max-height: none;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(20, 33, 37, 0.25);
}

.comparison-dialog::backdrop {
  background: rgba(22, 31, 34, 0.48);
}

.comparison-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.comparison-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
}

.comparison-dialog-head h2 {
  font-size: 24px;
}

.comparison-dialog-head p:last-child {
  margin-top: 4px;
  color: var(--muted);
}

.comparison-content {
  min-height: 0;
  overflow: auto;
  padding: 24px 28px 32px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.comparison-summary {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 22px;
  padding: 18px 0;
  border-top: 2px solid var(--teal);
  border-bottom: 1px solid var(--line);
}

.comparison-summary dl {
  display: grid;
  gap: 8px;
}

.comparison-summary dl > div {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
}

.comparison-summary dt {
  color: var(--teal);
  font-weight: 760;
}

.comparison-summary dd {
  color: var(--text);
}

.comparison-case-heads,
.compare-cells {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.comparison-case-heads {
  margin-left: 174px;
  padding-bottom: 14px;
}

.compare-case-head {
  min-width: 0;
  padding: 12px 14px;
  border-top: 2px solid var(--teal);
  background: var(--surface-muted);
}

.compare-case-head > span {
  display: block;
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 14px;
  font-weight: 780;
}

.compare-case-head strong {
  display: block;
  font-size: 17px;
  line-height: 1.42;
}

.compare-case-head p,
.compare-case-head small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.compare-row {
  display: grid;
  grid-template-columns: 158px minmax(0, 1fr);
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.compare-row > h3 {
  color: var(--text);
  font-size: 16px;
}

.compare-row > h3 span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.compare-row .evidence-text {
  min-height: 112px;
  max-height: 300px;
}

.diff-token {
  padding: 0 2px;
  background: var(--emerald-soft);
  color: inherit;
}

.compare-source-row .compare-cells {
  align-items: stretch;
}

.compare-source-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  background: #f9fbff;
}

.comparison-source-text .evidence-text {
  max-height: 410px;
}

.comparison-source-text p {
  color: var(--muted);
  font-size: 14px;
}

.compare-source-row > .secondary-action {
  grid-column: 2;
  width: fit-content;
  margin-top: 2px;
}

.guide-body {
  background: var(--surface);
}

.guide-main {
  max-width: 1120px;
  padding-top: 48px;
  padding-bottom: 0;
}

.guide-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  padding-bottom: 38px;
  border-bottom: 1px solid var(--line);
}

.guide-intro h1 {
  max-width: 680px;
}

.guide-intro p:last-child {
  max-width: 720px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 17px;
}

.guide-intro .primary-action {
  width: auto;
  min-width: 168px;
  margin: 0;
  white-space: nowrap;
}

.guide-section {
  padding: 42px 0;
  border-bottom: 1px solid var(--line);
}

.guide-section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.guide-section-title .eyebrow {
  margin-bottom: 3px;
}

.guide-list-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.guide-list-grid > div {
  display: grid;
  gap: 5px;
  min-height: 104px;
  align-content: center;
  padding: 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.guide-list-grid strong {
  font-size: 17px;
}

.guide-list-grid span {
  color: var(--muted);
  font-size: 15px;
}

.guide-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 16px;
  color: var(--muted);
}

.guide-note strong {
  color: var(--teal);
}

.method-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  padding: 0;
  list-style: none;
}

.method-steps li {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 124px;
  padding: 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.method-steps li:last-child {
  grid-column: 1 / -1;
  min-height: 92px;
  align-items: center;
  padding-block: 14px;
}

.method-steps li:last-child .method-copy {
  grid-template-columns: minmax(250px, 0.8fr) minmax(0, 1.5fr);
  align-items: center;
}

.method-steps li > span {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 13px;
  font-weight: 760;
  margin-top: 1px;
}

.method-steps strong {
  display: flex;
  min-height: 1.42em;
  align-items: flex-start;
  font-size: 16px;
  line-height: 1.42;
}

.method-copy {
  display: grid;
  gap: 4px;
  align-content: start;
  min-width: 0;
}

.method-copy > small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
  line-height: 1.4;
}

.model-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.future-section {
  background: var(--teal-soft);
}

.future-section .guide-list-grid {
  grid-template-columns: minmax(0, 1fr);
}

.future-section .guide-list-grid > div {
  background: var(--surface);
}

.guide-use {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 32px;
  align-items: end;
}

.guide-use .guide-section-title,
.guide-use > p,
.guide-use > .guide-credit {
  grid-column: 1;
}

.guide-use > p {
  max-width: 760px;
  color: var(--text);
}

.guide-credit {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 28px;
  margin-top: 4px;
  color: var(--muted);
}

.guide-credit > div {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}

.guide-credit span {
  font-size: 14px;
  font-weight: 650;
}

.guide-credit strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 760;
}

.guide-use .secondary-action {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 170px;
}

.service-updates summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 24px;
  min-height: 56px;
  align-items: center;
  padding: 6px 0;
  color: #4b5563;
  cursor: pointer;
  font-size: 13px;
}

.service-updates summary::marker {
  color: #6b7280;
}

.service-update-current {
  color: #374151;
  font-weight: 650;
}

.service-update-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: #6b7280;
  font-weight: 650;
  white-space: nowrap;
}

.service-update-toggle::after {
  content: "⌄";
  font-size: 16px;
  line-height: 1;
  transition: transform 150ms ease;
}

.service-updates[open] .service-update-toggle::after {
  transform: rotate(180deg);
}

.service-update-groups {
  display: grid;
  gap: 12px;
  padding: 0 0 20px 22px;
}

.service-update-group {
  display: grid;
  gap: 4px;
}

.service-update-group h3 {
  margin: 0;
  color: #6b7280;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.service-update-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 0 0 16px;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.55;
}

.service-update-list li::marker {
  color: #6b7280;
}

.site-footer {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 24px 32px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 14px;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  align-items: center;
  justify-content: center;
}

.footer-row > span {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  line-height: 1.45;
}

.site-footer a {
  display: inline;
  min-height: 0;
  color: var(--teal);
  font-weight: 700;
  line-height: inherit;
}

.research-citation {
  color: #8a96a5;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
}

@media (max-width: 1100px) {
  .app-main,
  .guide-main {
    padding: 24px;
  }

  .search-intro {
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: 28px;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr);
  }

  .comparison-dialog {
    width: calc(100vw - 20px);
  }

  .comparison-content,
  .comparison-dialog-head {
    padding-left: 20px;
    padding-right: 20px;
  }
}

@media (max-width: 820px) {
  .app-header {
    min-height: 62px;
    padding: 0 18px;
  }

  .brand {
    font-size: 17px;
  }

  .brand-sandbox-logo {
    width: 146px;
  }

  .brand-service-name {
    font-size: 15px;
  }

  .lab-brand img {
    width: 38px;
    height: 38px;
  }

  .lab-brand-copy strong {
    font-size: 13px;
  }

  .lab-brand-copy span {
    font-size: 10px;
  }

  .nav-link {
    padding: 0 9px;
    font-size: 14px;
  }

  .search-intro,
  .workspace {
    grid-template-columns: 1fr;
  }

  .search-steps {
    display: none;
  }

  .detail-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .comparison-case-heads {
    margin-left: 0;
  }

  .comparison-summary,
  .compare-row {
    grid-template-columns: 1fr;
  }

  .compare-source-row > .secondary-action {
    grid-column: 1;
  }

  .method-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 640px) {
  .app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 12px;
    padding: 8px 16px 0;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    min-height: 36px;
    gap: 0;
  }

  .brand-sandbox-logo {
    width: 154px;
  }

  .primary-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 4px;
    min-height: 44px;
  }

  .header-actions {
    display: contents;
  }

  .lab-brand {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .lab-brand img {
    width: 34px;
    height: 34px;
  }

  .lab-brand-copy {
    display: none;
  }

  .app-main,
  .guide-main {
    padding: 20px 16px 28px;
  }

  .app-header {
    position: static;
    align-items: center;
  }

  .brand-service-name {
    display: none;
  }

  h1 {
    font-size: 27px;
  }

  .search-intro {
    padding-top: 8px;
    padding-bottom: 24px;
  }

  .filters,
  .guide-list-grid,
  .method-steps,
  .comparison-case-heads,
  .compare-cells {
    grid-template-columns: 1fr;
  }

  .results-panel,
  .detail-panel {
    padding: 16px;
  }

  .result-row.selected {
    margin-left: -8px;
    padding-left: 8px;
  }

  .case-detail-head,
  .comparison-dialog-head,
  .guide-intro {
    display: grid;
    grid-template-columns: 1fr;
  }

  .case-detail-actions {
    justify-content: flex-start;
    min-width: 0;
  }

  .case-detail-actions > .compare-toggle,
  .case-detail-actions > .secondary-action {
    inline-size: min(100%, 170px);
  }

  .law-verification-head,
  .law-status-row,
  .law-diff-grid {
    grid-template-columns: 1fr;
  }

  .law-verification-head {
    display: grid;
  }

  .law-verification-head .secondary-action {
    width: 100%;
  }

  .law-error .quiet-button {
    width: 100%;
  }

  .brand,
  .lab-brand,
  .result-row-actions .quiet-button,
  .result-row-actions .compare-toggle,
  .case-detail-actions .compare-toggle,
  .case-tab,
  .law-verification-head .secondary-action,
  .law-status-link,
  .law-verification-section summary {
    min-height: 44px;
  }

  .lab-brand {
    min-width: 44px;
  }

  .law-verification-section summary {
    display: flex;
    align-items: center;
  }

  .law-status-link {
    justify-self: start;
    padding: 0 14px 14px;
    text-align: left;
    white-space: normal;
  }

  .match-tag-button {
    min-height: 44px;
    padding: 0 12px;
  }

  .comparison-dialog {
    width: 100vw;
    height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .comparison-content,
  .comparison-dialog-head {
    padding: 18px 16px;
  }

  .comparison-case-heads {
    padding-bottom: 0;
  }

  .compare-row {
    gap: 10px;
  }

  .compare-row .evidence-text {
    min-height: 0;
    max-height: 240px;
  }

  .guide-intro .primary-action,
  .guide-use .secondary-action {
    width: 100%;
  }

  .guide-use {
    grid-template-columns: 1fr;
  }

  .guide-use .guide-section-title,
  .guide-use > p,
  .guide-use .guide-credit,
  .guide-use .secondary-action {
    grid-column: 1;
    grid-row: auto;
  }

  .site-footer {
    justify-items: start;
    padding: 20px 16px;
  }

  .footer-row {
    justify-content: flex-start;
  }

  .service-updates summary {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 10px 0;
  }

  .method-steps li:last-child .method-copy {
    grid-template-columns: 1fr;
  }

  .service-update-toggle {
    justify-self: start;
  }

  .research-citation {
    text-align: left;
  }
}

@media print {
  .app-header,
  .guide-intro .primary-action,
  .guide-use .secondary-action {
    display: none;
  }

  .guide-main {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .guide-section {
    break-inside: avoid;
  }
}
