:root {
  color-scheme: light;
  --ink: #34312f;
  --muted: #706a65;
  --line: #ded8d1;
  --panel: #ffffff;
  --soft: #f7f4ef;
  --accent: #ff9914;
  --accent-strong: #d87400;
  --warn: #a44a22;
  --danger: #a12828;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f1ede7;
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #fffdf9;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
  padding: 18px;
}

.brand-row,
.record-header,
.header-actions,
.toolbar,
.section-title.inline {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.brand-logo {
  display: block;
  height: auto;
  max-width: 225px;
  width: 72%;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  margin-top: -6px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.1;
}

h2 {
  font-size: 26px;
  line-height: 1.18;
}

h3 {
  font-size: 16px;
  line-height: 1.2;
}

.muted,
.section-title p,
.brand-row p,
.empty-state p,
.upload-zone small {
  color: var(--muted);
}

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

.icon-button {
  align-items: center;
  background: #fff;
  display: grid;
  font-size: 22px;
  height: 36px;
  justify-content: center;
  padding: 0;
  width: 36px;
}

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

.upload-zone {
  align-items: center;
  background: #fff8ef;
  border: 1px dashed #f1ad54;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  gap: 6px;
  padding: 16px;
}

.auto-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.auto-panel .section-title {
  margin-bottom: 0;
}

.auto-panel input {
  min-height: 40px;
  padding: 9px 10px;
  width: 100%;
}

.auto-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}

.auto-actions button {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: #252321;
  font-weight: 800;
  padding: 10px 12px;
}

.auto-panel progress {
  height: 12px;
  width: 100%;
}

.auto-panel small {
  color: var(--muted);
  line-height: 1.35;
}

.upload-zone img {
  height: 54px;
  width: 54px;
}

.upload-zone input {
  inline-size: 1px;
  opacity: 0;
  position: absolute;
}

.upload-zone span {
  color: var(--accent-strong);
  font-weight: 800;
}

.toolbar {
  align-items: stretch;
}

.toolbar input,
.toolbar select,
.field-grid input,
.field-grid select,
textarea,
.header-actions select {
  background: #fff;
  min-height: 40px;
  padding: 9px 10px;
  width: 100%;
}

.toolbar select {
  max-width: 150px;
}

.metric-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
}

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

.metric-grid strong {
  display: block;
  font-size: 21px;
}

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

.record-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  overflow: auto;
  padding: 0 2px 12px 0;
}

.record-list button {
  background: #fff;
  display: grid;
  gap: 3px;
  padding: 12px;
  text-align: left;
  width: 100%;
}

.record-list button.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 153, 20, 0.22);
}

.record-list span,
.record-list em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.workspace {
  display: grid;
  gap: 18px;
  grid-template-rows: auto 1fr;
  padding: 22px;
}

.record-header {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.header-actions {
  min-width: 310px;
}

.header-actions button,
form button,
.source-links a {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: #252321;
  font-weight: 800;
  padding: 10px 12px;
  text-decoration: none;
}

.empty-state {
  align-content: center;
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 60vh;
  text-align: center;
}

.hidden {
  display: none !important;
}

#activeWorkspace {
  display: grid;
  gap: 18px;
}

.source-band,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.section-title {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.source-links a {
  background: #fff;
  color: var(--accent-strong);
}

.source-links a:hover,
.header-actions button:hover,
form button:hover {
  border-color: #2f2c2a;
  box-shadow: 0 2px 0 #2f2c2a;
}

.split-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
}

form,
.field-grid,
fieldset {
  display: grid;
  gap: 12px;
}

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

label {
  color: #34414b;
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 12px;
}

fieldset legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 0 6px;
}

fieldset label {
  align-items: center;
  display: flex;
  font-weight: 600;
}

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

.best-grid div {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.best-grid span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 5px;
}

.best-grid strong {
  overflow-wrap: anywhere;
}

.candidate-list {
  display: grid;
  gap: 10px;
}

.results-panel {
  padding: 0;
}

.results-panel .section-title {
  margin: 0;
  padding: 16px;
}

.table-wrap {
  overflow: auto;
}

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

.results-table th,
.results-table td {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.results-table th {
  background: #fff8ef;
  color: #3a3632;
  font-size: 12px;
  text-transform: uppercase;
}

.results-table td {
  overflow-wrap: anywhere;
}

.results-table button {
  background: transparent;
  border: 0;
  color: var(--accent-strong);
  font-weight: 800;
  padding: 0;
  text-align: left;
}

.candidate-card {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1fr) 140px minmax(220px, 1.2fr) auto;
  padding: 12px;
}

.candidate-card span,
.candidate-card p {
  color: var(--muted);
  font-size: 13px;
}

.candidate-card p {
  overflow-wrap: anywhere;
}

.candidate-card button {
  background: #fff5f3;
  color: var(--danger);
  padding: 8px 10px;
}

meter {
  height: 20px;
  width: 100%;
}

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

  .sidebar {
    min-height: auto;
  }

  .record-header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
    min-width: 0;
  }

  .candidate-card {
    grid-template-columns: 1fr;
  }
}
