:root {
  --ink: #19352d;
  --ink-soft: #34534a;
  --paper: #f3efe4;
  --paper-deep: #e8e0cf;
  --surface: #fffdf7;
  --line: #d4c8b2;
  --line-strong: #b5a589;
  --vermilion: #a23c2d;
  --vermilion-dark: #7e2b20;
  --gold: #c39b52;
  --muted: #706d63;
  --success: #2d6b52;
  --warning: #9d6a20;
  --danger: #9b302b;
  --shadow: 0 18px 50px rgba(44, 37, 25, .11);
  --display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, serif;
  --sans: "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 80% -15%, rgba(195, 155, 82, .23), transparent 70%),
    linear-gradient(135deg, #f7f3e9 0%, var(--paper) 52%, #ece4d4 100%);
  font-family: var(--sans);
  padding-bottom: 76px;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
.is-hidden { display: none !important; }
.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;
}

.page-texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .34;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(91, 75, 50, .045) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 79px, rgba(91, 75, 50, .025) 79px 80px);
  mask-image: linear-gradient(to bottom, #000, transparent 76%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(260px, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 82px;
  padding: 12px clamp(20px, 4vw, 56px);
  color: #f8f1e3;
  background:
    linear-gradient(90deg, rgba(255,255,255,.04), transparent 28%),
    var(--ink);
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 8px 28px rgba(15, 36, 30, .22);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  color: inherit;
  text-decoration: none;
}
.brand-seal {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255,255,255,.45);
  outline: 1px solid rgba(195,155,82,.65);
  outline-offset: -5px;
  background: var(--vermilion);
  font: 700 25px/1 var(--display);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.08);
}
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { font: 700 18px/1.25 var(--display); letter-spacing: .04em; }
.brand-copy small { color: rgba(248,241,227,.64); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

.desktop-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(0,0,0,.13);
}
.nav-tab {
  min-width: 102px;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  color: rgba(248,241,227,.68);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  transition: background .2s ease, color .2s ease;
}
.nav-tab:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-tab.is-active { background: var(--paper); color: var(--ink); }

.global-session {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 260px;
}
.session-state { display: flex; align-items: center; gap: 7px; font-size: 12px; color: rgba(248,241,227,.7); }
.session-dot { width: 8px; height: 8px; border-radius: 50%; background: #897f6f; box-shadow: 0 0 0 4px rgba(255,255,255,.06); }
.session-dot.is-live { background: #64cb9f; box-shadow: 0 0 0 4px rgba(100,203,159,.14); }
.credit-state { display: grid; gap: 1px; padding-left: 14px; border-left: 1px solid rgba(255,255,255,.16); }
.credit-state span { color: rgba(248,241,227,.58); font-size: 10px; letter-spacing: .12em; }
.credit-state strong { font: 700 21px/1 var(--display); color: #f1d69e; }

.main-frame {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 72px;
}

.login-gate {
  display: grid;
  grid-template-columns: 90px minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: clamp(22px, 5vw, 76px);
  min-height: 580px;
  padding: clamp(28px, 6vw, 74px);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.login-gate::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(181,165,137,.46);
  pointer-events: none;
}
.login-gate::after {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  right: -180px;
  bottom: -220px;
  border: 60px solid rgba(162,60,45,.045);
  border-radius: 50%;
  pointer-events: none;
}
.gate-index {
  writing-mode: vertical-rl;
  letter-spacing: .38em;
  color: var(--vermilion);
  font: 700 15px/1 var(--display);
}
.gate-copy { align-self: center; max-width: 660px; }
.eyebrow {
  margin: 0 0 10px;
  color: var(--vermilion);
  font: 700 11px/1.2 var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
}
.gate-copy h1,
.section-heading h1 {
  margin: 0;
  font: 700 clamp(34px, 5vw, 62px)/1.1 var(--display);
  letter-spacing: -.035em;
}
.lead {
  max-width: 620px;
  margin: 20px 0 30px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.9;
}
.login-form { display: grid; gap: 14px; max-width: 520px; }
.gate-guide {
  align-self: center;
  display: grid;
  gap: 8px;
  padding: 26px 28px;
  background: #eee7d8;
  border-top: 4px solid var(--ink);
}
.gate-guide strong { margin-bottom: 8px; font: 700 17px/1.4 var(--display); }
.gate-guide p { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.75; }
.guide-number { color: var(--vermilion); font: 700 11px/1 var(--mono); letter-spacing: .12em; }

.field { display: grid; gap: 8px; }
.field > span { color: var(--ink-soft); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.field small { color: var(--muted); font-weight: 400; }
input, textarea, select {
  width: 100%;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
input, select { min-height: 46px; padding: 10px 13px; }
textarea { padding: 14px; resize: vertical; line-height: 1.75; }
input:focus, textarea:focus, select:focus {
  border-color: var(--ink);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(25,53,45,.09);
}
.secret-input { position: relative; }
.secret-input input { padding-right: 64px; letter-spacing: .08em; }
.reveal-button {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: .03em;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: wait; transform: none; }
.button.primary { color: #fffaf0; background: var(--vermilion); border-color: var(--vermilion); }
.button.primary:hover { background: var(--vermilion-dark); }
.button.secondary { color: var(--ink); background: transparent; border-color: var(--ink); }
.button.secondary:hover { background: rgba(25,53,45,.07); }
.button.ghost { color: rgba(248,241,227,.78); border-color: rgba(248,241,227,.24); background: transparent; }
.button.compact { min-height: 34px; padding: 6px 12px; font-size: 12px; }
.button.wide { width: 100%; }
.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--vermilion);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.inline-notice { min-height: 20px; margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.inline-notice.error { color: var(--danger); }
.inline-notice.success { color: var(--success); }

.app-shell { animation: reveal .45s ease both; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: panel-in .34s ease both; }
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line-strong);
}
.section-heading h1 { font-size: clamp(34px, 4.4vw, 56px); }
.section-heading p:not(.eyebrow) { max-width: 680px; margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.heading-mark {
  display: grid;
  place-items: center;
  min-width: 106px;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  background: rgba(255,253,247,.55);
}
.heading-mark span { font: 700 42px/1 var(--display); color: var(--vermilion); }
.heading-mark small { margin-top: 4px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }

.query-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, .72fr);
  gap: 24px;
  align-items: start;
}
.query-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, .75fr);
  gap: 24px;
  align-items: start;
}
.query-panel { min-width: 0; }
.query-panel-heading { align-items: flex-start; }
.panel-intro {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}
.mode-tabs {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.mode-tab {
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.mode-tab:hover { color: var(--ink); }
.mode-tab.is-active { background: var(--ink); color: var(--surface); }
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.field-span-full { grid-column: 1 / -1; }
.advanced-details {
  margin-top: 18px;
  border-top: 1px dashed var(--line);
}
.advanced-details summary {
  padding: 14px 0 10px;
  color: var(--vermilion);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.advanced-details textarea { font-family: var(--mono); font-size: 12px; }
.query-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
}
.query-form-foot > span {
  color: var(--muted);
  font-size: 12px;
}
.query-form-foot b { color: var(--vermilion); font-size: 17px; }
.query-form-foot .button { min-width: 180px; }
.cost-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  color: var(--vermilion);
  border: 1px solid currentColor;
  font: 700 10px/1 var(--mono);
  white-space: nowrap;
}
.execute-court-fields { display: grid; gap: 12px; }
.query-help-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 24px;
  border: 1px solid var(--line);
  background: var(--line);
}
.query-help-strip div {
  display: grid;
  gap: 5px;
  padding: 16px 18px;
  background: rgba(255,253,247,.72);
}
.query-help-strip strong { font: 700 15px/1.3 var(--display); }
.query-help-strip span { color: var(--muted); font-size: 11px; line-height: 1.65; }
.dossier-card {
  position: relative;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 10px 32px rgba(50,42,28,.07);
}
.dossier-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 64px;
  background: var(--vermilion);
}
.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.card-kicker { color: var(--vermilion); font: 700 10px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; }
.card-heading h2 { margin: 5px 0 0; font: 700 24px/1.3 var(--display); }
.batch-textarea {
  min-height: 248px;
  font-family: var(--mono);
  font-size: 14px;
  background:
    linear-gradient(90deg, rgba(162,60,45,.04), transparent 8%),
    #fffdf8;
}
.input-foot { display: flex; justify-content: space-between; gap: 16px; margin-top: 8px; color: var(--muted); font-size: 11px; }
.option-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, .9fr);
  gap: 20px;
  align-items: end;
  margin: 22px 0;
  padding: 18px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
}
.check-option { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check-option input { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 1px solid var(--ink);
  background: #fff;
  position: relative;
}
.check-option input:checked + .check-box { background: var(--ink); }
.check-option input:checked + .check-box::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.check-option strong { display: block; font-size: 13px; }
.check-option small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.compact-field input { min-height: 40px; font-size: 13px; }
.estimate-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  margin-bottom: 18px;
  padding: 16px 18px;
  color: #f8f1e3;
  background: var(--ink);
}
.estimate-box div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.estimate-box span { color: rgba(248,241,227,.64); font-size: 11px; }
.estimate-box strong { font: 700 20px/1 var(--display); color: #f0d294; }
.estimate-box p { grid-column: 1 / -1; margin: 2px 0 0; color: rgba(248,241,227,.55); font-size: 10px; }
.submit-filing { justify-content: space-between; min-height: 54px; font-size: 15px; }
.button-arrow { font-size: 22px; font-weight: 400; }
.fine-print { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.65; }

.query-aside { display: grid; gap: 18px; }
.info-slip { padding: 24px; color: #f7f1e3; background: var(--ink); box-shadow: var(--shadow); }
.slip-label { color: #d4b777; font: 700 10px/1 var(--sans); letter-spacing: .18em; }
.rule-list { display: grid; gap: 16px; margin: 18px 0 0; padding: 0; list-style: none; }
.rule-list li { display: flex; align-items: baseline; gap: 12px; color: rgba(247,241,227,.68); font-size: 12px; }
.rule-list span { min-width: 56px; color: #f1d69e; font: 700 22px/1 var(--display); }
.compact-dossier { padding: 0; overflow: hidden; }
.compact-dossier::before { display: none; }
.compact-dossier summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  cursor: pointer;
  list-style: none;
}
.compact-dossier summary::-webkit-details-marker { display: none; }
.compact-dossier summary strong { display: block; margin-top: 4px; font: 700 18px/1.3 var(--display); }
.summary-icon { color: var(--vermilion); font-size: 24px; transition: transform .2s ease; }
.compact-dossier[open] .summary-icon { transform: rotate(45deg); }
.execute-form { display: grid; gap: 16px; }
.notice-slip { padding: 20px 22px; background: #ede5d4; border-left: 4px solid var(--gold); }
.notice-slip strong { font: 700 16px/1.3 var(--display); }
.notice-slip p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.75; }

.results-heading { align-items: center; }
.result-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 14px;
  background: rgba(255,253,247,.7);
  border: 1px solid var(--line);
}
.search-field input { background: #fff; }
.select-all-option { display: flex; align-items: center; gap: 8px; padding: 0 10px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.select-all-option input { width: 17px; min-height: 17px; accent-color: var(--ink); }
.selection-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  margin-bottom: 18px;
  padding: 8px 12px 8px 18px;
  color: #f7f1e3;
  background: var(--ink);
  position: sticky;
  top: 96px;
  z-index: 15;
  box-shadow: 0 8px 20px rgba(16,35,29,.15);
}
.selection-bar span { margin-right: auto; font-size: 12px; }
.selection-bar strong { color: #f1d69e; font-size: 17px; }
.selection-bar .button.primary { background: var(--gold); color: var(--ink); }
.selection-bar .button.secondary { border-color: rgba(255,255,255,.55); color: #fff; }
.results-list { display: grid; gap: 18px; }
.result-group {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(50,42,28,.055);
}
.result-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8f3e8;
}
.result-group-title { display: grid; gap: 3px; }
.result-group-title strong { font: 700 18px/1.35 var(--display); }
.result-group-title small { color: var(--muted); font-size: 11px; }
.results-subheading { margin-top: 20px; }
.wenshu-results-wrap { margin-top: 22px; }
.execute-results {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}
.execute-result-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(50,42,28,.055);
}
.execute-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.execute-result-title { display: grid; gap: 4px; min-width: 0; }
.execute-result-title strong {
  overflow: hidden;
  font: 700 19px/1.35 var(--display);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.execute-result-title small { color: var(--muted); font-size: 11px; line-height: 1.55; }
.execute-result-summary {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.65;
}
.execute-result-note {
  margin-top: 14px;
  padding: 12px 14px;
  color: var(--muted);
  background: var(--paper);
  border-left: 3px solid var(--gold);
  font-size: 12px;
  line-height: 1.65;
}
.execute-result-note.is-error { color: var(--danger); border-left-color: var(--danger); }
.execute-table-wrap { overflow-x: auto; border: 1px solid var(--line); }
.execute-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 12px; }
.execute-table th {
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(232,224,207,.55);
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 10px;
  letter-spacing: .06em;
  white-space: nowrap;
}
.execute-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(212,200,178,.62);
  vertical-align: top;
}
.execute-table tr:last-child td { border-bottom: 0; }
.execute-table tbody tr:hover { background: rgba(243,239,228,.45); }
.list-shot {
  margin: 14px 0 0;
  padding: 12px;
  background: #22342e;
  border: 1px solid rgba(255,255,255,.08);
}
.batch-shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.batch-shot-grid .list-shot {
  min-width: 0;
  margin-top: 0;
}
.list-shot.is-compact img { max-height: 220px; }
.list-shot figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: rgba(248,241,227,.65);
  font-size: 10px;
}
.list-shot figcaption strong { color: #f1d69e; font-size: 11px; }
.list-shot a:first-of-type { display: block; overflow: hidden; }
.list-shot img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  object-position: top center;
  background: #f8f3e8;
}
.shot-actions {
  display: flex;
  gap: 14px;
  margin-top: 9px;
  font-size: 10px;
}
.shot-actions a { color: #f1d69e; text-decoration: underline; text-underline-offset: 3px; }
.list-shot a.shot-error {
  display: grid;
  min-height: 92px;
  place-items: center;
  color: #f1d69e;
  background: rgba(0,0,0,.16);
  font-size: 11px;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid currentColor;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
}
.status-chip.succeeded { color: var(--success); background: rgba(45,107,82,.07); }
.status-chip.running, .status-chip.queued { color: var(--warning); background: rgba(157,106,32,.08); }
.status-chip.failed, .status-chip.no_result { color: var(--danger); background: rgba(155,48,43,.06); }
.result-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.result-table th {
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(232,224,207,.48);
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 10px;
  letter-spacing: .08em;
  white-space: nowrap;
}
.result-table td { padding: 12px; border-bottom: 1px solid rgba(212,200,178,.62); vertical-align: middle; }
.result-table tr:last-child td { border-bottom: 0; }
.result-table tbody tr:hover { background: rgba(243,239,228,.45); }
.result-table .check-cell { width: 42px; text-align: center; }
.result-table input[type="checkbox"] { width: 17px; min-height: 17px; accent-color: var(--vermilion); }
.case-number { font-family: var(--mono); font-size: 11px; font-weight: 700; white-space: nowrap; }
.case-title { max-width: 340px; font-weight: 700; line-height: 1.5; }
.case-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.row-action { padding: 5px 9px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; font-size: 10px; font-weight: 700; white-space: nowrap; }
.row-action:hover { border-color: var(--ink); }
.row-action:disabled { opacity: .45; cursor: default; }
.empty-state { padding: 64px 20px; text-align: center; border: 1px dashed var(--line-strong); background: rgba(255,253,247,.5); }
.empty-state strong { font: 700 23px/1.3 var(--display); }
.empty-state p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.ledger-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 700px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.ledger-summary div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 16px 18px; border-right: 1px solid var(--line); }
.ledger-summary div:last-child { border-right: 0; }
.ledger-summary span { color: var(--muted); font-size: 11px; }
.ledger-summary strong { font: 700 28px/1 var(--display); color: var(--vermilion); }
.ledger-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.subsection-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding-bottom: 9px; border-bottom: 1px solid var(--line-strong); }
.subsection-heading h2 { margin: 0; font: 700 21px/1.3 var(--display); }
.subsection-heading span { color: var(--muted); font-size: 10px; }
.ledger-list { display: grid; gap: 10px; }
.ledger-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  padding: 16px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color .18s ease, transform .18s ease;
}
.ledger-item:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.ledger-item strong { display: block; font: 700 15px/1.45 var(--display); }
.ledger-item p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.ledger-progress { grid-column: 1 / -1; height: 4px; background: var(--paper-deep); overflow: hidden; }
.ledger-progress span { display: block; height: 100%; background: var(--vermilion); transition: width .4s ease; }
.ledger-actions { display: flex; gap: 8px; align-items: center; grid-column: 1 / -1; justify-content: flex-end; }
.ledger-actions .row-action { font-size: 11px; }

.mobile-tabs { display: none; }
.dialog-card {
  width: min(470px, calc(100% - 28px));
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: 0 30px 90px rgba(20,35,29,.28);
}
.dialog-card::backdrop { background: rgba(15,29,24,.62); backdrop-filter: blur(3px); }
.dialog-card form { display: grid; gap: 16px; padding: 26px; }
.dialog-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.dialog-close { width: 34px; height: 34px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 20px; }

.toast-host { position: fixed; z-index: 80; right: 22px; bottom: 26px; display: grid; gap: 8px; width: min(360px, calc(100% - 32px)); pointer-events: none; }
.toast {
  padding: 13px 15px;
  color: #f8f1e3;
  background: var(--ink);
  border-left: 4px solid var(--gold);
  box-shadow: 0 12px 36px rgba(15,35,29,.24);
  font-size: 12px;
  line-height: 1.55;
  animation: toast-in .24s ease both;
}
.toast.error { border-left-color: #e27368; }
.toast.success { border-left-color: #6fc49e; }
.site-footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 28px;
  color: var(--muted);
  font: 10px/1.4 var(--mono);
  letter-spacing: .08em;
}

@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes panel-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 1080px) {
  .topbar { grid-template-columns: 1fr auto; }
  .desktop-tabs { order: 3; grid-column: 1 / -1; justify-self: center; margin-bottom: -4px; }
  .main-frame { padding-top: 30px; }
  .query-layout { grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr); }
  .query-columns { grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); }
  .login-gate { grid-template-columns: 70px 1fr; }
  .gate-guide { grid-column: 2; }
  .selection-bar { top: 138px; }
}

@media (max-width: 780px) {
  body { padding-bottom: 86px; }
  .topbar {
    position: relative;
    grid-template-columns: 1fr;
    gap: 14px;
    min-height: 74px;
    padding: 14px 18px 18px;
  }
  .brand-seal { width: 40px; height: 40px; font-size: 21px; }
  .brand-copy strong { font-size: 16px; }
  .desktop-tabs { display: none; }
  .global-session { justify-self: stretch; min-width: 0; justify-content: space-between; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.12); }
  .credit-state { margin-left: auto; }
  .main-frame { width: min(100% - 24px, 720px); padding: 22px 0 36px; }
  .login-gate { grid-template-columns: 1fr; min-height: 0; padding: 34px 28px; gap: 24px; }
  .gate-index { display: none; }
  .gate-guide { grid-column: auto; }
  .section-heading { align-items: flex-start; padding-bottom: 16px; }
  .heading-mark { min-width: 84px; padding: 9px 10px; }
  .heading-mark span { font-size: 32px; }
  .query-layout, .query-columns, .ledger-columns { grid-template-columns: 1fr; }
  .query-help-strip { grid-template-columns: 1fr; }
  .option-strip { grid-template-columns: 1fr; }
  .result-toolbar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .select-all-option { justify-self: end; }
  .selection-bar { top: 8px; padding-left: 12px; overflow-x: auto; }
  .selection-bar span { min-width: 84px; }
  .results-list { gap: 12px; }
  .query-form-foot { align-items: flex-start; flex-wrap: wrap; }
  .query-form-foot .button { width: 100%; }
  .execute-result-title strong { white-space: normal; }
  .result-group { overflow-x: auto; }
  .result-table { min-width: 660px; }
  .ledger-summary { max-width: none; }
  .mobile-tabs {
    position: fixed;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    left: 0;
    right: 0;
    bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(25,53,45,.97);
    border-top: 2px solid var(--gold);
    box-shadow: 0 -8px 28px rgba(17,39,32,.2);
  }
  .mobile-tab {
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 64px;
    padding: 7px 4px;
    border: 0;
    background: transparent;
    color: rgba(248,241,227,.62);
    font-size: 10px;
    font-weight: 700;
  }
  .mobile-tab span { font-size: 19px; line-height: 1; }
  .mobile-tab.is-active { color: #f1d69e; background: rgba(255,255,255,.06); }
  .toast-host { bottom: 84px; }
  .site-footer { width: min(100% - 28px, 720px); }
}

@media (max-width: 480px) {
  .section-heading h1 { font-size: 34px; }
  .section-heading { gap: 12px; }
  .heading-mark { display: none; }
  .dossier-card { padding: 20px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-span-full { grid-column: auto; }
  .query-panel-heading { display: grid; }
  .mode-tabs { width: 100%; }
  .mode-tab { flex: 1; }
  .estimate-box { grid-template-columns: 1fr; }
  .result-toolbar { grid-template-columns: 1fr; }
  .search-field, .select-all-option { grid-column: auto; justify-self: stretch; }
  .select-all-option { padding: 4px 0; }
  .ledger-summary div { display: grid; gap: 4px; padding: 12px; }
  .ledger-summary strong { font-size: 24px; }
  .selection-bar { flex-wrap: wrap; }
  .selection-bar span { width: 100%; }
  .execute-result-head { display: grid; gap: 10px; }
  .list-shot { padding: 8px; }
  .list-shot figcaption { display: grid; gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
