/* Shared visual language for the Law × AI research tools. */
:root {
  color-scheme: light;
  --ink: #183d3b;
  --muted: #647471;
  --paper: #f6f6ef;
  --surface: #fffef8;
  --line: #d8e1d7;
  --accent: #0f625b;
  --accent-soft: #e5eee7;
  --gold: #ba8243;
  --danger: #a14138;
  --danger-soft: #fff0eb;
  --radius: 14px;
  --shadow: 0 9px 30px #23443b08;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.65;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}
button,
input,
select,
textarea {
  font: inherit;
}
a {
  color: var(--accent);
  text-underline-offset: 4px;
}
a:hover {
  text-decoration-thickness: 2px;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 9px;
  padding: 0.65rem 1rem;
  transition:
    background 0.15s,
    border-color 0.15s;
}
button:hover {
  background: var(--accent-soft);
  border-color: #acc4b7;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
button.primary,
.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
button.primary:hover {
  background: #174e48;
}
.danger {
  color: var(--danger);
}
:focus-visible {
  outline: 3px solid #d7a85c;
  outline-offset: 3px;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefc;
  color: var(--ink);
  padding: 0.6rem 0.8rem;
}
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  accent-color: var(--accent);
}
textarea {
  resize: vertical;
  min-height: 110px;
}
label {
  display: block;
  font-size: 0.87rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2 {
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-weight: 500;
  letter-spacing: -0.025em;
}
h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.14;
}
h2 {
  font-size: 1.65rem;
  line-height: 1.25;
}
h3 {
  font-size: 1rem;
}
small,
.muted {
  color: var(--muted);
}
.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.7rem;
}
.mono {
  font-family: ui-monospace, Consolas, monospace;
}
.skip-link {
  position: absolute;
  top: -60px;
  left: 12px;
  background: var(--ink);
  color: #fff;
  padding: 12px;
  z-index: 20;
}
.skip-link:focus {
  top: 12px;
}
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.header-inner {
  max-width: 1440px;
  margin: auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: space-between;
}
.brand {
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 0.07em;
  text-decoration: none;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  background: var(--ink);
  color: var(--surface);
  width: 32px;
  height: 32px;
  margin-right: 10px;
  border-radius: 7px;
  font-weight: 500;
}
.suite-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.8rem;
  flex-wrap: wrap;
}
.suite-nav a {
  color: var(--muted);
  text-decoration: none;
}
.suite-nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
}
.app-shell {
  max-width: 1440px;
  padding: 36px 32px 60px;
  margin: 0 auto;
}
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
}
.hero p {
  max-width: 700px;
  color: var(--muted);
  margin-bottom: 0;
}
.hero h1 {
  margin-bottom: 12px;
}
.hero-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar,
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.panel,
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 24px;
  box-shadow: var(--shadow);
}
.panel + .panel {
  margin-top: 18px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.section-head h2,
.section-head h3 {
  margin: 0;
}
.field {
  margin-bottom: 16px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.note {
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.7;
}
.tag,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  letter-spacing: 0.025em;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: 99px;
}
.badge.warning {
  background: #fff1d8;
  color: #815923;
  border-color: #e9d8b5;
}
.badge.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #ecd2cb;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
}
.stat strong {
  display: block;
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 4px;
}
.stat span {
  font-size: 0.77rem;
  color: var(--muted);
}
.empty {
  text-align: center;
  padding: 50px 24px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.empty h3 {
  color: var(--ink);
  font-size: 1.1rem;
}
.status-bar {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(640px, 90vw);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 6px 28px #132d3926;
  z-index: 50;
}
.status-bar[hidden] {
  display: none;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}
th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}
pre {
  overflow: auto;
  background: var(--accent-soft);
  padding: 16px;
  border-radius: 8px;
}
code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85em;
}
details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}
.footer {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 32px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 0.75rem;
  color: var(--muted);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  width: min(720px, calc(100vw - 32px));
  max-height: 90vh;
  padding: 28px;
  box-shadow: 0 25px 100px #183d3b30;
}
dialog::backdrop {
  background: #15322d70;
  backdrop-filter: blur(3px);
}
dialog .dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
dialog .dialog-head h2 {
  margin: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
[hidden] {
  display: none !important;
}
.error-text {
  color: var(--danger);
}
.success-text {
  color: var(--accent);
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}
.chip-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.nowrap {
  white-space: nowrap;
}
@media (max-width: 1000px) {
  .header-inner {
    flex-wrap: wrap;
  }
  .layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }
  .suite-nav {
    gap: 12px;
  }
  .hero {
    display: block;
  }
  .hero-actions {
    margin-top: 20px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 720px) {
  .header-inner,
  .app-shell,
  .footer {
    padding-left: 18px;
    padding-right: 18px;
  }
  .app-shell {
    padding-top: 28px;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .panel,
  .card {
    padding: 18px;
  }
  .suite-nav {
    font-size: 0.72rem;
    gap: 12px;
    overflow-wrap: anywhere;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .footer {
    display: block;
  }
  .footer span {
    display: block;
    margin-bottom: 6px;
  }
  .hero h1 {
    font-size: 2.4rem;
  }
  .stats {
    gap: 8px;
  }
  .stat {
    padding: 14px;
  }
  .actions button,
  .toolbar button {
    font-size: 0.82rem;
  }
  .table-scroll {
    overflow: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Evidence Atlas: paragraph retrieval and source snapshots. */
.english-title {
  display: block;
  color: var(--muted);
  font-size: 0.52em;
  letter-spacing: 0;
  margin-top: 8px;
}
.scope-note {
  border-left: 3px solid var(--gold);
  padding: 10px 16px;
  margin: 0 0 24px;
  font-size: 0.82rem;
  background: #efece1;
}
.scope-note span,
.note span[lang="en"] {
  display: block;
}
.atlas-layout {
  grid-template-columns: 300px minmax(0, 1fr);
}
.subheading {
  display: block;
  color: var(--muted);
  font:
    400 0.74rem/1.5 Inter,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0.01em;
  margin-top: 3px;
}
.compact-button {
  padding: 0.1rem 0.7rem;
  font-size: 1.5rem;
}
.corpus-actions {
  gap: 6px;
}
.corpus-actions button {
  padding: 0.45rem 0.65rem;
  font-size: 0.76rem;
}
.document-list {
  max-height: 590px;
  overflow-y: auto;
  margin-top: 20px;
}
.document-item {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.document-item h3 {
  font-size: 0.87rem;
  margin-bottom: 5px;
  overflow-wrap: anywhere;
}
.document-item .note {
  font-size: 0.71rem;
  margin: 0 0 7px;
}
.document-actions button {
  font-size: 0.72rem;
  padding: 4px 8px;
}
.corpus-limit {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin: 16px 0 0;
}
.corpus-empty {
  padding: 16px 0;
}
.compact-panel h3 {
  margin-bottom: 12px;
}
.compact-panel > button {
  width: 100%;
  font-size: 0.83rem;
}
.method-link {
  display: block;
  margin-top: 14px;
  font-size: 0.77rem;
}
.query-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.query-row input {
  min-width: 0;
}
.search-options {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
  flex-wrap: wrap;
}
.search-options label {
  margin: 0;
  font-size: 0.73rem;
  font-weight: 400;
}
.search-options select {
  width: auto;
  padding: 5px 10px;
  font-size: 0.77rem;
}
.suggested-queries {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.73rem;
  color: var(--muted);
  margin-bottom: 16px;
}
.suggested-queries button {
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 99px;
  background: var(--accent-soft);
}
.research-workspace {
  min-width: 0;
}
.research-workspace > .panel + .panel {
  margin-top: 24px;
}
.results-list {
  display: grid;
  gap: 16px;
}
.result-card {
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.result-head {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.9rem;
}
.result-head > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
.result-rank {
  margin-right: 12px;
  font-size: 0.76rem;
  color: var(--gold);
  font-family: ui-monospace, Consolas, monospace;
}
.score {
  white-space: nowrap;
  font-size: 0.74rem;
  color: var(--accent);
}
.result-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.71rem;
  color: var(--muted);
  margin: 9px 0 13px;
}
.result-meta a {
  font-size: 0.72rem;
}
.result-excerpt {
  font-size: 0.86rem;
  line-height: 1.9;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-bottom: 13px;
}
.result-excerpt mark {
  background: #e0eadb;
  color: var(--ink);
  border-radius: 2px;
  padding: 0 1px;
}
.save-evidence {
  font-size: 0.76rem;
  padding: 6px 11px;
}
.score-details {
  margin: 12px 0 4px;
  font-size: 0.75rem;
  border: 0;
  padding: 0;
}
.score-details summary {
  font-size: 0.73rem;
  color: var(--muted);
  font-weight: 400;
}
.score-details table {
  font-size: 0.74rem;
}
.score-details th,
.score-details td {
  padding: 5px 8px;
}
.score-details .note {
  margin: 10px 0 8px;
  font-size: 0.72rem;
}
.export-actions {
  margin-bottom: 20px;
}
.export-actions button {
  font-size: 0.74rem;
  padding: 6px 10px;
}
.notebook-list {
  display: grid;
  gap: 16px;
}
.notebook-empty {
  padding: 30px 20px;
}
.evidence-card {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.evidence-card .section-head {
  align-items: flex-start;
  margin-bottom: 8px;
}
.evidence-card h3 {
  font-size: 0.95rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  flex: 1;
}
.evidence-card .badge {
  flex-shrink: 0;
}
.evidence-preview {
  margin: 16px 0;
  padding: 12px 16px;
  border-left: 3px solid var(--line);
  background: #f0f3ec;
  font-size: 0.84rem;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 300px;
  overflow: auto;
}
.evidence-note {
  font-size: 0.83rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.dialog-actions {
  justify-content: flex-end;
}
.benchmark-dialog {
  width: min(980px, calc(100vw - 32px));
}
.benchmark-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}
.benchmark-summary h3 {
  font-size: 0.86rem;
}
.benchmark-dialog .table-scroll {
  max-height: 420px;
  overflow: auto;
  margin-bottom: 20px;
}
.benchmark-dialog th {
  background: var(--surface);
  position: sticky;
  top: 0;
}
.benchmark-dialog td {
  font-size: 0.76rem;
}
.storage-warning {
  font-size: 0.83rem;
  color: var(--danger);
  padding: 14px 18px;
  background: var(--danger-soft);
  border: 1px solid #ecd2cb;
  border-radius: 8px;
}
.result-card .table-scroll {
  overflow-x: auto;
}
#searchSummary:empty {
  display: none;
}
.results-list > .empty p,
.notebook-empty p {
  font-size: 0.83rem;
  margin-bottom: 0;
}
@media (max-width: 1000px) {
  .atlas-layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }
  .result-head {
    flex-wrap: wrap;
  }
  .query-row {
    grid-template-columns: 1fr;
  }
  .query-row button {
    justify-self: start;
  }
}
@media (max-width: 720px) {
  .atlas-layout {
    grid-template-columns: 1fr;
  }
  .document-list {
    max-height: 260px;
  }
  .corpus-sidebar {
    display: grid;
    gap: 16px;
  }
  .corpus-sidebar .panel + .panel {
    margin: 0;
  }
  .compact-panel {
    order: 2;
  }
  .result-head {
    display: block;
  }
  .score {
    display: inline-block;
    margin-top: 6px;
  }
  .benchmark-summary {
    gap: 8px;
  }
  .evidence-card .section-head {
    flex-wrap: wrap;
  }
  .export-actions {
    gap: 6px;
  }
  .query-row button {
    width: 100%;
  }
  .suggested-queries {
    align-items: flex-start;
  }
  .evidence-preview {
    padding: 10px 12px;
  }
  .dialog-head h2 {
    font-size: 1.4rem;
  }
}
