:root {
  color-scheme: light;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ink: #202938;
  --muted: #6f7b8a;
  --line: #e4e9f1;
  --panel: #ffffff;
  --surface: #f6f8fc;
  --accent: #2f7ee6;
  --accent-dark: #2366c2;
  --green: #18b982;
  --purple: #7c5cf4;
  --warn: #be4b35;
  --focus: #eef5ff;
  --shadow: 0 8px 28px rgba(30, 45, 70, 0.08);
  --soft-shadow: 0 2px 12px rgba(30, 45, 70, 0.05);
  --page-gap: 16px;
  --case-detail-col: clamp(500px, 31vw, 560px);
  --case-insight-col: clamp(300px, 21vw, 380px);
  --case-panel-height: 620px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  padding: 0 14px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 650;
  box-shadow: var(--soft-shadow);
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

input,
select {
  min-height: 38px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  color: var(--ink);
  background: #f9fbff;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

td {
  font-size: 14px;
  line-height: 1.35;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.invite-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #eef3f2;
}

.invite-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: var(--panel);
  box-shadow: 0 18px 40px rgba(23, 32, 38, 0.08);
}

.invite-panel h1 {
  margin: 6px 0 24px;
  font-size: 30px;
  line-height: 1.05;
}

.invite-panel label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.invite-panel input,
.invite-panel button {
  width: 100%;
}

.invite-panel button {
  margin-top: 14px;
}

.error-text {
  min-height: 20px;
  color: var(--warn);
  font-size: 13px;
}

.app-shell {
  display: grid;
  grid-template-rows: 68px minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  padding: 0 28px;
  background: #fff;
  box-shadow: 0 1px 10px rgba(31, 42, 55, 0.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 232px;
  color: #111827;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: 0;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.sidebar nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-button,
.secondary {
  width: auto;
  color: var(--ink);
  background: transparent;
  text-align: center;
  box-shadow: none;
}

.nav-button:hover,
.nav-button.active {
  background: var(--focus);
  color: var(--accent-dark);
}

.secondary {
  margin-left: auto;
  color: var(--muted);
}

.workspace {
  height: 100%;
  min-height: 0;
  min-width: 0;
  width: 100%;
  margin: 0 auto;
  overflow: auto;
  padding: 24px 18px 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

#cases-view.view.active {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.view-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.view-header h2 {
  margin: 3px 0 0;
  font-size: 24px;
  font-weight: 700;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.toolbar {
  display: grid;
  grid-template-columns:
    minmax(220px, 1.4fr)
    minmax(150px, 0.9fr)
    minmax(140px, 0.9fr)
    138px
    138px
    auto;
  gap: 8px;
  width: min(960px, 100%);
}

.case-toolbar {
  width: 100%;
  margin: -4px 0 16px;
}

.search-methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: var(--page-gap);
  margin: 0 0 16px;
}

.search-card {
  display: grid;
  align-content: start;
  grid-template-rows: auto minmax(38px, auto) auto;
  height: 100%;
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.traditional-search-card {
  grid-template-rows: auto 1fr;
}

.search-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
  margin-bottom: 8px;
}

.search-card-head strong {
  font-size: 17px;
  font-weight: 700;
}

.search-card-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.case-search-grid {
  display: grid;
  grid-template-columns: minmax(215px, 1.25fr) minmax(135px, 0.75fr) minmax(115px, 0.65fr) minmax(116px, 0.45fr);
  align-items: start;
  gap: 8px;
}

.toolbar.compact {
  grid-template-columns: minmax(220px, 1fr) auto;
  width: min(420px, 100%);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: var(--page-gap);
}

.case-layout {
  grid-template-columns: var(--case-detail-col) minmax(0, 1fr) var(--case-insight-col);
  align-items: stretch;
  min-height: 0;
}

.case-profile-panel {
  align-self: stretch;
  height: 100%;
  min-height: 0;
  overflow: auto;
  order: 0;
}

.case-list-panel {
  display: contents;
  min-height: 0;
  order: 0;
}

.case-results-grid {
  display: contents;
  gap: var(--page-gap);
  align-items: start;
}

.case-table-panel {
  grid-column: 2;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  min-width: 0;
}

.case-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.case-list-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.case-list-head span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.case-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.case-profile-panel,
.case-table-scroll,
.case-insights {
  scrollbar-color: #b8c6d8 transparent;
  scrollbar-width: thin;
}

.case-profile-panel::-webkit-scrollbar,
.case-table-scroll::-webkit-scrollbar,
.case-insights::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.case-profile-panel::-webkit-scrollbar-thumb,
.case-table-scroll::-webkit-scrollbar-thumb,
.case-insights::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #b8c6d8;
}

.case-table-scroll table {
  min-width: 960px;
}

.case-table-panel col.case-col {
  width: 150px;
}

.case-table-panel col.date-col {
  width: 118px;
}

.case-table-panel col.parties-col {
  width: 170px;
}

.case-table-panel col.outcome-col {
  width: 190px;
}

.case-table-panel col.amount-col {
  width: 120px;
}

.case-table-panel col.other-col {
  width: 140px;
}

.case-table-panel thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}

.case-table-panel th:nth-child(1),
.case-table-panel td:nth-child(1) {
  width: 150px;
}

.case-table-panel th:nth-child(2),
.case-table-panel td:nth-child(2) {
  width: 118px;
  white-space: nowrap;
}

.case-table-panel th:nth-child(3),
.case-table-panel td:nth-child(3) {
  width: 170px;
}

.case-table-panel th:nth-child(4),
.case-table-panel td:nth-child(4) {
  width: 190px;
}

.case-table-panel th:nth-child(5),
.case-table-panel td:nth-child(5) {
  width: 120px;
  white-space: nowrap;
}

.case-table-panel th:nth-child(6),
.case-table-panel td:nth-child(6) {
  width: 140px;
}

.case-insights {
  grid-column: 3;
  align-self: stretch;
  display: grid;
  align-content: start;
  height: 100%;
  min-height: 0;
  overflow: auto;
  min-width: 0;
  gap: var(--page-gap);
}

.insight-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.insight-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.insight-card h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.insight-card-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-align: right;
}

.distribution-list {
  display: grid;
}

.ai-arbitrator-list {
  display: grid;
}

.ai-arbitrator-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 0;
  border-top: 1px solid var(--line);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  padding: 12px 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.ai-arbitrator-row:first-child {
  border-top: 0;
}

.ai-arbitrator-row:hover {
  color: var(--ink);
  background: #f8fbff;
}

.ai-arbitrator-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  color: #2467d1;
  background: #eaf2ff;
  font-size: 12px;
  font-weight: 700;
}

.ai-arbitrator-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.ai-arbitrator-main strong,
.ai-arbitrator-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-arbitrator-main strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.ai-arbitrator-main small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.ai-arbitrator-score {
  border-radius: 999px;
  padding: 3px 7px;
  color: #2467d1;
  background: #eaf2ff;
  font-size: 11px;
  font-weight: 700;
}

.distribution-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 0;
  border-top: 1px solid var(--line);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  padding: 12px 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.distribution-row:first-child {
  border-top: 0;
}

.distribution-row:hover,
.distribution-row.active {
  color: var(--ink);
  background: #f8fbff;
}

.distribution-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.distribution-name {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.distribution-row strong {
  color: #617086;
  font-size: 12px;
  font-weight: 700;
}

.distribution-bar {
  grid-column: 2 / 4;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.distribution-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.timeline {
  margin: 0 0 16px;
}

.range-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.range-header,
.range-actions,
.range-scale {
  display: flex;
  align-items: center;
}

.range-header {
  justify-content: space-between;
  gap: 16px;
}

.range-header h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
}

.range-header span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.range-actions {
  gap: 8px;
}

button.ghost {
  color: var(--muted);
  background: #eef2f7;
  box-shadow: none;
}

button.ghost:hover {
  color: var(--ink);
  background: #dfe7ed;
}

.range-control {
  --range-left: 0%;
  --range-right: 0%;
  position: relative;
  height: 36px;
  margin-top: 14px;
}

.range-track {
  position: absolute;
  right: 0;
  top: 6px;
  left: 0;
  height: 24px;
  border: 1px solid #e9e1b8;
  border-radius: 4px;
  background: #f5f0d6;
}

.range-selected {
  position: absolute;
  right: var(--range-right);
  top: 6px;
  left: var(--range-left);
  height: 24px;
  border: 1px solid #a5c5f0;
  border-radius: 4px;
  background: #bdd8fb;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38);
}

.range-input {
  position: absolute;
  right: 0;
  top: 6px;
  left: 0;
  width: 100%;
  height: 24px;
  min-height: 24px;
  margin: 0;
  border: 0;
  padding: 0;
  pointer-events: none;
  appearance: none;
  background: transparent;
}

.range-input::-webkit-slider-runnable-track {
  height: 24px;
  background: transparent;
}

.range-input::-webkit-slider-thumb {
  width: 22px;
  height: 24px;
  margin-top: 0;
  border: 1px solid #a8b7c7;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 7px rgba(31, 42, 55, 0.22);
  cursor: ew-resize;
  pointer-events: auto;
  appearance: none;
}

.range-input::-moz-range-track {
  height: 24px;
  background: transparent;
}

.range-input::-moz-range-thumb {
  width: 22px;
  height: 24px;
  border: 1px solid #a9b8c5;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 7px rgba(31, 42, 55, 0.22);
  cursor: ew-resize;
  pointer-events: auto;
}

.range-scale {
  position: relative;
  display: block;
  height: 22px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.range-tick {
  position: absolute;
  top: 0;
  white-space: nowrap;
  transform: translateX(-50%);
}

.range-tick.edge-start {
  transform: translateX(0);
}

.range-center-label {
  position: absolute;
  top: 6px;
  left: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 24px;
  transform: translateX(-50%);
  color: #1e66db;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  pointer-events: none;
}

.range-chevrons {
  position: absolute;
  top: 6px;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 24px;
  color: rgba(105, 119, 139, 0.42);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.range-chevrons.left {
  left: 48%;
  transform: translateX(-76px);
}

.range-chevrons.right {
  left: 52%;
  transform: translateX(56px);
}

.table-wrap,
.detail-panel {
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
}

.detail-panel {
  padding: 18px;
  overflow: auto;
}

.case-profile-panel.detail-panel,
.case-table-panel.table-wrap,
.case-insights {
  min-height: 0;
}

.case-profile-panel {
  padding: 22px;
}

.case-profile-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.case-profile-head h3 {
  margin: 0;
  font-size: 38px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: 0;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 11px;
  padding: 10px 16px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.05;
}

.status-chip {
  margin-top: 24px;
}

.outcome-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  white-space: normal;
}

.outcome-claimant {
  color: #08765b;
  background: #e6f8f0;
}

.outcome-respondent {
  color: #b42318;
  background: #fff1f0;
}

.outcome-neutral {
  color: #546176;
  background: #eef3f8;
}

.status-chip.outcome-claimant,
.status-chip.outcome-respondent,
.status-chip.outcome-neutral {
  border-radius: 11px;
  padding: 10px 16px;
  font-size: 22px;
}

.case-summary-card {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  background: transparent;
  box-shadow: none;
}

.case-summary-card h4 {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.35;
}

.case-summary-card p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 10px;
  color: #3f4b5c;
  font-size: 13px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 8;
}

.text-link-button {
  min-height: 0;
  padding: 0;
  color: var(--accent-dark);
  background: transparent;
  box-shadow: none;
  font-size: 13px;
}

.text-link-button:hover {
  background: transparent;
  text-decoration: underline;
}

.case-profile-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 20px;
}

.case-profile-metrics div {
  border-right: 1px solid var(--line);
  padding-right: 8px;
}

.case-profile-metrics div:last-child {
  border-right: 0;
}

.case-profile-metrics strong,
.case-profile-metrics span {
  display: block;
}

.case-profile-metrics strong {
  color: var(--accent-dark);
  overflow: hidden;
  font-size: 18px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-profile-metrics span,
.section-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.case-profile-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.case-profile-section p {
  margin: 8px 0;
  color: #3f4b5c;
  line-height: 1.45;
}

.party-group {
  margin-top: 12px;
}

.party-group h4,
.case-profile-section h4 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.entity-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.entity-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid #d7e8fb;
  border-radius: 9px;
  padding: 6px 10px;
  color: #1765c5;
  background: #edf7ff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.entity-pill-button {
  cursor: pointer;
  box-shadow: none;
}

.entity-pill-button:hover {
  color: #fff;
  background: var(--accent);
}

.detail-panel.wide {
  min-height: 360px;
  margin-top: 16px;
}

.row-button {
  display: block;
  width: 100%;
  min-height: 0;
  border-radius: 0;
  padding: 0;
  color: var(--accent-dark);
  background: transparent;
  box-shadow: none;
  text-align: left;
  font-weight: 700;
}

.row-button:hover {
  background: transparent;
  text-decoration: underline;
}

.case-number-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.case-number-cell .row-button {
  width: auto;
  min-width: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

.case-score-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 7px;
  color: #2563eb;
  background: #eaf2ff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.party-cell {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amount-cell {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.order-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 3px 8px;
  color: #6d28d9;
  background: #f1eaff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.load-more-row td {
  padding: 16px;
  text-align: center;
}

.secondary-action {
  min-height: 34px;
  border: 1px solid #b8cced;
  border-radius: 7px;
  padding: 0 16px;
  color: #2563eb;
  background: #f7faff;
  box-shadow: none;
}

.secondary-action:hover {
  color: #fff;
  background: var(--accent);
}

.muted {
  color: var(--muted);
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid #e0e7f1;
  border-radius: 8px;
  padding: 5px 9px;
  color: #506176;
  background: #f6f9fc;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.selector-form {
  display: grid;
  gap: 12px;
  width: min(1120px, 100%);
  margin: 0 auto 16px;
}

.selector-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
  align-items: end;
}

.selector-controls.compact {
  grid-template-columns: repeat(3, minmax(100px, 1fr)) minmax(180px, 1.15fr) minmax(130px, auto);
  justify-self: center;
  width: min(1120px, 100%);
}

.selector-controls .secondary {
  margin-left: 0;
}

.selector-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.selector-add-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  justify-self: center;
  width: min(1120px, 100%);
}

.selector-add-field {
  align-self: start;
}

.selector-search-results {
  display: grid;
  max-height: 360px;
  min-height: 0;
  overflow: auto;
  gap: 6px;
}

.selector-case-description {
  display: grid;
  gap: 7px;
  justify-self: center;
  width: min(1120px, 100%);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.selector-case-description textarea {
  min-height: 96px;
}

.selector-attachment-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.selector-attachment-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 34px;
  border: 1px solid #bdd5fb;
  border-radius: 8px;
  padding: 0 14px;
  color: #2563eb;
  background: #eef6ff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.selector-attachment-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

.selector-context-field {
  position: relative;
  min-width: 0;
}

.selector-context-results {
  position: absolute;
  z-index: 8;
  right: 0;
  left: 0;
  top: calc(100% + 6px);
  display: grid;
  max-height: 290px;
  overflow: auto;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14);
}

.selector-context-results:empty {
  display: none;
}

.selector-context-row em {
  text-transform: capitalize;
}

.selector-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  box-shadow: none;
  text-align: left;
}

.selector-search-row:hover {
  color: var(--ink);
  background: #f8fbff;
}

.selector-search-row span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.selector-search-row strong,
.selector-search-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selector-search-row strong {
  font-size: 14px;
  font-weight: 700;
}

.selector-search-row small,
.selector-search-row em,
.selector-search-empty,
.selector-search-loading,
.selector-list-empty {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.selector-search-row em {
  border-radius: 999px;
  padding: 4px 8px;
  color: #2563eb;
  background: #eaf2ff;
  white-space: nowrap;
}

.selector-form .file-field {
  width: min(520px, 100%);
}

.selector-form input[type="file"] {
  min-height: 42px;
  padding: 8px 10px;
  background: #fff;
}

.selector-form .checkbox-label {
  align-items: center;
  grid-template-columns: auto 1fr;
  min-height: 38px;
  color: var(--ink);
}

.selector-form .checkbox-label input {
  min-height: 0;
  width: 18px;
  height: 18px;
  padding: 0;
}

.selector-lists,
.selector-ranking-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  justify-self: center;
  width: min(1120px, 100%);
  gap: 12px;
}

.selector-list-card,
.selector-ranking-card {
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: start;
  align-self: start;
  gap: 10px;
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.selector-list-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.selector-list-card-head small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 22px;
  border-radius: 999px;
  color: #2563eb;
  background: #eaf2ff;
  font-size: 12px;
  font-weight: 700;
}

.selector-candidate-box {
  display: flex;
  align-content: flex-start;
  align-items: flex-start;
  align-self: stretch;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 120px;
  border: 1px dashed #d5deeb;
  border-radius: 8px;
  padding: 10px;
  background: #f9fbff;
}

.selector-candidate-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  border: 1px solid #cfe0f7;
  border-radius: 999px;
  padding: 4px 5px 4px 10px;
  color: #145bc5;
  background: #eef6ff;
  font-size: 13px;
  line-height: 1.1;
}

.selector-candidate-pill.entering {
  animation: selector-chip-pop 180ms ease-out;
}

.selector-candidate-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selector-candidate-pill button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  min-height: 20px;
  margin-left: 4px;
  border-radius: 999px;
  padding: 0;
  color: #2563eb;
  background: transparent;
  box-shadow: none;
  opacity: 0;
}

.selector-candidate-pill:hover button,
.selector-candidate-pill:focus-within button {
  opacity: 1;
}

.selector-candidate-pill button:hover {
  color: #fff;
  background: #2563eb;
}

.selector-list-source {
  display: none;
}

.selector-fly-card {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
  transition: transform 360ms ease, opacity 360ms ease;
}

@keyframes selector-chip-pop {
  from {
    transform: scale(0.92);
    opacity: 0.55;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.selector-form textarea {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  line-height: 1.5;
}

.selector-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0;
  background: #fff;
}

.selector-ranking-grid {
  margin: 12px auto 14px;
}

.selector-ranking-card {
  min-height: 170px;
}

.selector-ranking-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 112px;
  border: 1px dashed #d5deeb;
  border-radius: 8px;
  padding: 10px;
  background: #f9fbff;
}

.selector-ranking-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid #e0e7f1;
  border-radius: 8px;
  padding: 5px 8px;
  background: #fff;
}

.selector-rank-chip,
.selector-alignment-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.selector-rank-chip {
  min-width: 32px;
  min-height: 22px;
  padding: 0 8px;
  color: #145bc5;
  background: #eaf2ff;
}

.selector-ranking-row.is-strike .selector-rank-chip {
  color: #b42318;
  background: #fde8e8;
}

.selector-alignment-chip {
  min-height: 22px;
  padding: 0 9px;
  color: #08765b;
  background: #e7f9f1;
}

.selector-ranking-name {
  position: relative;
  justify-self: end;
  overflow: hidden;
  max-width: 100%;
  color: var(--ink);
  font-size: 13px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selector-ai-rationale {
  border: 1px solid #cfe0f7;
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  background: #f8fbff;
}

.selector-rationale-text {
  margin: 10px 0 0;
  white-space: pre-wrap;
  color: var(--ink);
  font: inherit;
  line-height: 1.55;
}

.selector-card.strike {
  border-color: #e2b8b8;
  background: #fffafa;
}

.selector-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.selector-score {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.selector-breakdown,
.supporting-cases {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.selector-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.selector-stat-grid span {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  background: #fbfcfd;
}

.selector-stat-grid small,
.compact-line {
  color: var(--muted);
  font-size: 12px;
}

.selector-stat-grid small,
.selector-stat-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.selector-details {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.selector-details summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.compact-line {
  margin: 6px 0;
}

.note-list {
  margin: 8px 0 14px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.memo-block {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
  color: var(--ink);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.packet-details {
  margin-top: 14px;
}

.warning-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #8a5a00;
  font-size: 12px;
}

.summary {
  line-height: 1.55;
}

.selector-group h5 {
  margin: 18px 0 8px;
  font-size: 14px;
}

.home-match-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 180px);
  gap: 8px;
}

.home-match-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  grid-column: 1 / -1;
  min-height: 24px;
}

.home-match-head div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.home-match-head strong {
  font-size: 17px;
  font-weight: 700;
}

.home-match-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.match-title-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ai-match-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 28px;
  border-radius: 11px;
  padding: 0 13px;
  color: #fff !important;
  background: #7c5cf4;
  font-size: 15px !important;
  font-weight: 700 !important;
}

.match-readiness-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border: 1px solid #dbe5f2;
  border-radius: 999px;
  padding: 0 9px;
  color: #617086 !important;
  background: #f7faff;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1;
  white-space: nowrap;
}

.match-readiness-pill.ready {
  border-color: #b8ebd3;
  color: #08765b !important;
  background: #e7f9f1;
}

.match-readiness-pill.fallback {
  border-color: #dbe5f2;
  color: #617086 !important;
  background: #f7faff;
}

.home-match-card textarea {
  width: 100%;
  min-height: 54px;
  height: 54px;
  resize: vertical;
  overflow: auto;
  scrollbar-width: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--ink);
  background: #f9fbff;
  font: inherit;
  line-height: 1.4;
}

.home-match-card textarea::-webkit-scrollbar {
  display: none;
}

.home-match-controls {
  display: grid;
  grid-template-columns: 1fr;
  align-self: start;
  gap: 8px;
  justify-content: end;
}

.home-match-controls button {
  white-space: nowrap;
}

.home-match-controls button.ai-search-loading,
.home-match-controls button.ai-search-loading:disabled,
.selector-controls button.ai-search-loading,
.selector-controls button.ai-search-loading:disabled {
  opacity: 1;
  color: #fff;
  background: linear-gradient(90deg, #2563eb, #7c5cf4, #14b8a6, #2563eb);
  background-size: 280% 100%;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
  animation: ai-search-flow 1.15s linear infinite;
}

@keyframes ai-search-flow {
  from {
    background-position: 0% 50%;
  }

  to {
    background-position: 100% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-match-controls button.ai-search-loading,
  .selector-controls button.ai-search-loading {
    animation: none;
  }
}

.match-status {
  grid-column: 1 / -1;
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1180px) {
  .case-layout {
    grid-template-columns: minmax(420px, 0.9fr) minmax(0, 1.1fr);
  }

  .case-list-panel {
    display: block;
    min-height: 0;
  }

  .case-profile-panel,
  .case-insights {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .case-table-panel {
    height: auto;
    min-height: var(--case-panel-height);
  }

  .case-table-scroll {
    max-height: var(--case-panel-height);
  }

  .case-results-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .case-table-panel,
  .case-insights {
    grid-column: auto;
  }

  .case-insights {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .sidebar nav {
    display: flex;
    flex: 1;
  }

  .secondary {
    width: auto;
    margin-top: 0;
  }

  .view-header,
  .split {
    grid-template-columns: 1fr;
    display: grid;
  }

  .toolbar,
  .search-methods,
  .case-search-grid,
  .home-match-controls,
  .selector-add-panel,
  .selector-controls,
  .selector-controls.compact,
  .selector-lists,
  .selector-ranking-grid,
  .selector-stat-grid,
  .case-results-grid {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .search-methods,
  .case-results-grid {
    grid-template-columns: 1fr;
  }

  .case-list-panel {
    display: block;
  }

  .case-results-grid {
    display: grid;
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 14px;
  }

  .sidebar {
    align-items: stretch;
    flex-direction: column;
  }

  .sidebar nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .brand {
    justify-content: space-between;
  }

  .toolbar,
  .toolbar.compact,
  .search-methods,
  .case-search-grid,
  .home-match-controls,
  .case-results-grid,
  .case-insights,
    .selector-add-panel,
    .selector-controls,
    .selector-controls.compact,
    .selector-lists,
    .selector-ranking-grid,
    .selector-stat-grid,
    .metric-grid {
      grid-template-columns: 1fr;
  }

  th:nth-child(3),
  td:nth-child(3),
  th:nth-child(5),
  td:nth-child(5) {
    display: none;
  }
}
