:root {
  color-scheme: light;
  --bg: #f4f3ee;
  --surface: #ffffff;
  --surface-muted: #eceae3;
  --ink: #202825;
  --muted: #68716c;
  --line: #d8d8d1;
  --green: #176b4d;
  --green-dark: #0f5039;
  --green-soft: #e3f0e9;
  --amber: #9a5b16;
  --amber-soft: #f7ead8;
  --red: #a23d39;
  --focus: #206ea1;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button, input, textarea { font: inherit; letter-spacing: 0; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 34%, transparent);
  outline-offset: 2px;
}

.demo-shell {
  width: min(100%, 980px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
  border-inline: 1px solid var(--line);
}

.topbar {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  background: var(--green);
  color: white;
  font-size: 12px;
  font-weight: 800;
}

.brand-text { display: grid; gap: 1px; min-width: 0; }
.brand-text strong { font-size: 13px; }
.brand-text span { color: var(--muted); font-size: 10px; }

.schema-tag {
  flex: 0 0 auto;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--green-dark);
  background: #fafaf7;
  font-size: 10px;
  font-weight: 800;
}

.progress-track { height: 4px; background: var(--surface-muted); }
.progress-track span { display: block; width: 63%; height: 100%; background: var(--green); }

.workspace { width: min(100% - 40px, 790px); margin: 0 auto; padding: 34px 0 28px; }

.case-meta,
.section-heading,
.decision-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.case-meta { color: var(--muted); font-size: 10px; font-weight: 750; }
.case-meta strong { color: var(--green); }

.job-title { margin: 30px 0 22px; }
.job-title span,
.section-heading span,
.note-field span,
.search-panel label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.job-title h1 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 36px;
  font-weight: 760;
  line-height: 1.12;
}

.context-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 19px;
}

.context-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--line);
  background: #f8f8f5;
}

.context-row span { color: var(--muted); font-size: 9px; font-weight: 700; }
.context-row strong { overflow-wrap: anywhere; font-size: 11px; }

.model-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 22px 0 28px;
  padding: 11px 12px;
  border: 1px solid #e8cfaa;
  border-radius: 7px;
  background: var(--amber-soft);
  color: #6e451b;
  font-size: 10px;
  line-height: 1.45;
}

.notice-mark {
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--amber);
  color: white;
  font-size: 10px;
  font-weight: 850;
}

.section-heading { margin-bottom: 10px; }
.section-heading h2 { margin: 0; font-size: 16px; }
.section-heading span { margin: 0; text-transform: none; }

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

.candidate {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(32, 40, 37, 0.045);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.candidate:hover { border-color: #94aa9f; }
.candidate.is-selected { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-soft); }

.candidate-choice {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 76px;
  width: 100%;
  min-height: 82px;
  align-items: start;
  gap: 12px;
  padding: 14px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.rank {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #c7ccc8;
  border-radius: 6px;
  color: var(--muted);
  background: #fafaf8;
  font-size: 11px;
  font-weight: 850;
}

.is-selected .rank { border-color: var(--green); background: var(--green); color: white; }

.candidate-main { display: grid; min-width: 0; gap: 5px; }
.candidate-code { color: var(--green); font-size: 10px; font-weight: 850; }
.candidate-title { overflow-wrap: anywhere; font-size: 13px; font-weight: 780; line-height: 1.35; }
.candidate-meta { color: var(--muted); font-size: 10px; line-height: 1.35; }

.score { display: grid; justify-items: end; gap: 6px; color: var(--muted); font-size: 9px; }
.score strong { color: var(--ink); font-size: 13px; }
.score-bar { width: 68px; height: 4px; overflow: hidden; border-radius: 4px; background: #e3e4df; }
.score-bar i { display: block; height: 100%; background: var(--green); }

.candidate details { border-top: 1px solid #ecece7; background: #fafaf8; }
.candidate summary {
  padding: 8px 14px 9px 56px;
  color: var(--green-dark);
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}
.candidate details p { margin: 0; padding: 0 14px 13px 56px; color: var(--muted); font-size: 10px; line-height: 1.55; }

.actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 17px; }
.action-button,
.status-button,
.save-button,
.search-result,
.reset-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-size: 10px;
  font-weight: 780;
}
.action-button, .status-button { padding: 0 11px; }
.action-button:hover, .status-button:hover { border-color: var(--green); color: var(--green); }
.status-button.is-selected { border-color: var(--amber); background: var(--amber-soft); color: #714515; }

.search-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f8f5;
}
.search-panel[hidden] { display: none; }
.search-panel label { display: block; }
.search-panel input,
.note-field textarea {
  width: 100%;
  border: 1px solid #cfd1cb;
  border-radius: 7px;
  background: white;
  color: var(--ink);
}
.search-panel input { height: 40px; padding: 0 11px; font-size: 11px; }
.search-results { display: grid; gap: 5px; margin-top: 8px; }
.search-result {
  display: flex;
  min-height: 43px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  text-align: left;
}
.search-result:hover { border-color: var(--green); background: var(--green-soft); }
.search-result span { display: grid; gap: 2px; }
.search-result strong { font-size: 10px; }
.search-result small { color: var(--muted); font-size: 9px; }
.search-result b { flex: 0 0 auto; color: var(--green); font-size: 10px; }
.empty-result { padding: 10px 2px; color: var(--muted); font-size: 10px; }

.note-field { display: block; margin-top: 17px; }
.note-field textarea { min-height: 64px; padding: 10px 11px; resize: vertical; font-size: 11px; }

.decision-bar {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  width: 100%;
  min-height: 74px;
  padding: 12px 24px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -8px 28px rgba(32, 40, 37, 0.07);
}
.decision-summary { justify-content: flex-start; min-width: 0; }
.decision-indicator { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #b8bcb9; }
.has-decision .decision-indicator { background: var(--green); }
.decision-copy { display: grid; min-width: 0; gap: 3px; }
.decision-copy span { color: var(--muted); font-size: 9px; }
.decision-copy strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.save-button { min-width: 150px; padding: 0 15px; border-color: var(--green); background: var(--green); color: white; }
.save-button:hover { background: var(--green-dark); }
.save-button:disabled { border-color: #cfd2cf; background: #d8dad8; color: #818783; cursor: default; }

.toast {
  position: fixed;
  z-index: 20;
  top: 18px;
  left: 50%;
  display: flex;
  min-width: min(360px, calc(100vw - 32px));
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 14px;
  border: 1px solid #8bb7a2;
  border-radius: 8px;
  background: #f3fbf7;
  color: var(--green-dark);
  box-shadow: 0 16px 42px rgba(32, 40, 37, 0.18);
  transform: translate(-50%, -150%);
  transition: transform 180ms ease;
  font-size: 11px;
  font-weight: 750;
}
.toast.is-visible { transform: translate(-50%, 0); }
.reset-button { min-height: 30px; padding: 0 8px; border-color: #a9c7b8; color: var(--green); }

@media (max-width: 640px) {
  .demo-shell { border: 0; }
  .topbar { min-height: 56px; padding: 0 14px; }
  .brand-text span { display: none; }
  .workspace { width: min(100% - 24px, 790px); padding-top: 25px; }
  .job-title h1 { font-size: 28px; }
  .context-row { grid-template-columns: 1fr; }
  .candidate-choice { grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 12px; }
  .score { grid-column: 2; grid-template-columns: auto 68px; align-items: center; justify-items: start; }
  .candidate summary, .candidate details p { padding-left: 50px; }
  .decision-bar { padding: 10px 12px; }
  .save-button { min-width: 116px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
