:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5c6773;
  --line: #c8d1dc;
  --blue-900: #1f4e78;
  --blue-100: #d9eaf7;
  --yellow-100: #fff2cc;
  --pink-100: #ffc7ce;
  --pink-900: #7a1b2c;
  --surface: #ffffff;
  --bg: #f4f7fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.app {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: var(--blue-900);
  color: white;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  opacity: 0.85;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.actions {
  display: flex;
  gap: 8px;
}

button {
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 6px;
  background: white;
  color: var(--blue-900);
  font-weight: 700;
  cursor: pointer;
  padding: 0 14px;
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.panel {
  display: grid;
  gap: 10px;
  align-self: start;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 9px;
  font: inherit;
  background: var(--yellow-100);
}

.panelDivider {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--blue-900);
  font-size: 13px;
  font-weight: 700;
}

[data-ai-field] {
  background: #eef6ff;
}

select {
  background: white;
}

.content {
  min-width: 0;
}

.lookup {
  margin-top: 14px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.compactLookup {
  display: grid;
  gap: 8px;
}

.lookupHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
}

.lookupActions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

h2 {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.25;
}

.lookup p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.searchField {
  margin-bottom: 0;
}

.searchField textarea {
  min-height: 54px;
  max-height: 86px;
  background: var(--yellow-100);
  font-family: Arial, Helvetica, sans-serif;
}

.dropZone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfe;
}

.dropZone.isDragging {
  border-color: var(--blue-900);
  background: #eef6ff;
}

.dropZone strong,
.dropZone span {
  display: block;
}

.dropZone strong {
  font-size: 13px;
}

.dropZone span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.attachmentList {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachmentPill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 280px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  background: white;
  font-size: 12px;
}

.attachmentPill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachmentPill button {
  min-height: 22px;
  width: 22px;
  padding: 0;
  border-radius: 999px;
  border-color: var(--line);
}

.advancedLookup {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.advancedLookup summary {
  cursor: pointer;
  font-weight: 700;
}

.advancedLookup label {
  margin-top: 8px;
}

.lookupGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  font: 13px/1.45 Consolas, "Courier New", monospace;
  color: var(--ink);
  background: #fbfcfe;
}

.aiLinks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
}

.aiLinks a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--blue-900);
  background: white;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.lookupStatus {
  margin-top: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.lookupResultDetails {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.lookupResultDetails summary {
  cursor: pointer;
  padding: 9px 10px;
  background: #fbfcfe;
  color: var(--blue-900);
  font-size: 13px;
  font-weight: 700;
}

.lookupResult {
  margin-top: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
}

.lookupResult table {
  min-width: 0;
  font-size: 13px;
}

.lookupResult th {
  position: static;
}

.lookupResult td {
  white-space: normal;
  text-align: left;
}

.resultActions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px;
  background: #fbfcfe;
  border-top: 1px solid var(--line);
}

.warningList {
  margin: 0;
  padding: 10px 10px 0 26px;
  color: #9a3412;
  font-size: 13px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.metric {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 12px;
}

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

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
}

.tableWrap {
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border: 1px solid var(--line);
  padding: 8px 9px;
  text-align: center;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #bfefff;
  font-weight: 700;
}

tbody tr.best {
  background: var(--pink-100);
  color: var(--pink-900);
  font-weight: 700;
}

tbody tr:not(.best) td:nth-child(-n+5) {
  background: var(--blue-100);
}

.ok {
  color: #146c2e;
  font-weight: 700;
}

.no {
  color: #9a3412;
  font-weight: 700;
}

@media (max-width: 900px) {
  .topbar,
  .workspace {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary {
    grid-template-columns: 1fr 1fr;
  }

  .lookupGrid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .summary {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 10px;
  }
}
