:root {
  color-scheme: light;
  --ink: #102c2a;
  --ink-soft: #36504e;
  --paper: #f5f2e9;
  --surface: #fffdf7;
  --line: #c7cec5;
  --line-strong: #7f918d;
  --accent: #e65b36;
  --accent-soft: #ffdfd3;
  --blue: #195c78;
  --yellow: #f4cc65;
  --shadow: 0 18px 45px rgb(16 44 42 / 14%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}
.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;
}
.topbar {
  position: sticky; top: 0; z-index: 20;
  min-height: 72px; padding: 0 clamp(1rem, 4vw, 4rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: rgb(245 242 233 / 94%); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: .75rem; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--ink); color: white; font-family: "Newsreader", serif; font-size: 1.35rem;
  transform: rotate(-4deg);
}
main { width: min(1440px, 100%); margin: 0 auto; padding: clamp(1.5rem, 4vw, 4rem); }
.intro { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr); gap: 3rem; align-items: end; margin: .75rem 0 2.5rem; }
.eyebrow { margin: 0 0 .55rem; color: var(--accent); font-size: .78rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
h1, h2, h3 { font-family: "Newsreader", Georgia, serif; line-height: .98; letter-spacing: -.025em; }
h1 { max-width: 820px; margin: 0; font-size: clamp(3.1rem, 7vw, 6.8rem); font-weight: 650; overflow-wrap: break-word; hyphens: auto; }
.intro-copy { margin: 0 0 .35rem; color: var(--ink-soft); font-size: 1.05rem; }
.workspace { border-top: 3px solid var(--ink); }
.toolbar { padding: 1.3rem 0; display: grid; grid-template-columns: minmax(280px, 1fr) minmax(540px, 1.5fr); align-items: end; gap: 1rem; border-bottom: 1px solid var(--line); }
.search-field { position: relative; display: flex; align-items: center; height: 48px; }
.search-field svg { position: absolute; left: .9rem; width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.search-field input { width: 100%; min-height: 48px; padding: .65rem .9rem .65rem 2.8rem; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.filter-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; }
.filter-row label { display: grid; gap: .25rem; }
.filter-row label > span { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
select { min-height: 48px; width: 100%; padding: .55rem 2rem .55rem .7rem; border: 1px solid var(--line-strong); border-radius: 0; background: var(--surface); color: var(--ink); }
.result-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 68px; }
.result-bar p { margin: 0; font-weight: 600; }
.favorites-toggle { display: flex; align-items: center; gap: .5rem; min-height: 40px; padding: .5rem .7rem; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); }
.favorites-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.favorites-toggle svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.favorites-toggle span { min-width: 1.4rem; height: 1.4rem; display: inline-grid; place-items: center; background: var(--ink); color: white; font-size: .72rem; }
.candidate-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.candidate-card { min-height: 310px; display: flex; flex-direction: column; padding: 1.25rem; background: var(--surface); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: background 160ms ease, transform 160ms ease; }
.candidate-card:hover { background: white; }
.card-top { display: flex; justify-content: space-between; gap: 1rem; }
.candidate-number { font-family: "Newsreader", serif; font-size: 1.25rem; color: var(--accent); }
.save-button { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.save-button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.save-button[aria-pressed="true"] { background: var(--yellow); border-color: var(--ink); }
.save-button[aria-pressed="true"] svg { fill: var(--ink); }
.candidate-card h2 { margin: .85rem 0 .75rem; font-size: 1.75rem; line-height: 1.08; }
.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.1rem; }
.tag { padding: .22rem .5rem; border: 1px solid var(--line); color: var(--ink-soft); font-size: .72rem; font-weight: 600; }
.tag.primary { color: var(--blue); border-color: rgb(25 92 120 / 45%); }
.tag.action { color: #80301b; background: var(--accent-soft); border-color: transparent; }
.card-meta { margin: auto 0 1.1rem; display: grid; grid-template-columns: 4.5rem 1fr; gap: .35rem .6rem; font-size: .88rem; }
.card-meta dt { color: var(--ink-soft); }
.card-meta dd { margin: 0; font-weight: 500; }
.card-actions { display: flex; gap: .55rem; }
.primary-button, .secondary-button, .empty-state button { min-height: 42px; padding: .55rem .85rem; border: 1px solid var(--ink); font-weight: 700; }
.primary-button { flex: 1; background: var(--ink); color: white; }
.primary-button:hover { background: var(--blue); }
.secondary-button { background: transparent; color: var(--ink); }
.secondary-button.is-copied { background: var(--ink); color: white; }
.empty-state { padding: 5rem 1rem; text-align: center; border: 1px solid var(--line); background: var(--surface); }
.empty-state p { font-family: "Newsreader", serif; font-size: 2rem; }
.empty-state button { background: var(--ink); color: white; }
.method-note { width: 100%; margin: 2.5rem 0 0; padding: 1.2rem 1.3rem; border-left: 5px solid var(--yellow); color: var(--ink-soft); }
.method-note p { margin: 0; }
dialog { width: min(860px, 100%); height: 100%; max-height: 100%; margin: 0 0 0 auto; padding: 0; border: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(16 44 42 / 58%); }
dialog[open] { animation: slide-in 220ms ease-out; }
@keyframes slide-in { from { transform: translateX(35px); opacity: .5; } }
.detail-panel { min-height: 100%; }
.detail-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 1rem; padding: 1.5rem 1.6rem 1.25rem; border-bottom: 1px solid var(--line); background: rgb(255 253 247 / 96%); }
.detail-header h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.02; }
.icon-button { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border: 1px solid var(--line); background: transparent; }
.icon-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.detail-body { padding: 1.5rem 1.6rem 4rem; }
.detail-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-bottom: 1.6rem; background: var(--line); border: 1px solid var(--line); }
.detail-summary div { padding: .8rem; background: var(--paper); }
.detail-summary dt { color: var(--ink-soft); font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.detail-summary dd { margin: .2rem 0 0; font-weight: 600; overflow-wrap: anywhere; }
.contact-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-bottom: 2rem; }
.contact-actions a, .contact-actions button { min-height: 42px; display: inline-flex; align-items: center; padding: .55rem .8rem; border: 1px solid var(--ink); background: transparent; color: var(--ink); text-decoration: none; font-weight: 700; }
.contact-actions .solid { background: var(--ink); color: white; }
.letter-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1.6rem 0 .65rem; }
.letter-heading h3 { margin: 0; font-size: 1.7rem; }
.letter { margin: 0; padding: 1.2rem; border: 1px solid var(--line); background: white; white-space: pre-wrap; overflow-wrap: anywhere; font-family: "DM Sans", sans-serif; font-size: .96rem; line-height: 1.65; }
.draft-note { margin-top: .65rem; color: var(--ink-soft); font-size: .83rem; }
.toast { position: fixed; z-index: 40; right: 1.2rem; bottom: 1.2rem; padding: .75rem 1rem; background: var(--ink); color: white; box-shadow: var(--shadow); }
dialog .toast { z-index: 3; }
@media (max-width: 1050px) {
  .toolbar { grid-template-columns: 1fr; }
  .candidate-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 740px) {
  .topbar { min-height: 62px; }
  main { padding: 1rem; }
  .intro { grid-template-columns: 1fr; gap: 1rem; margin: 1.3rem 0 2rem; }
  h1 { max-width: 100%; font-size: clamp(2.35rem, 11.5vw, 4rem); line-height: 1; }
  .eyebrow { max-width: 100%; overflow-wrap: break-word; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .candidate-list { grid-template-columns: 1fr; }
  .candidate-card { min-height: 270px; }
  .result-bar { align-items: flex-start; padding: .9rem 0; }
  .detail-summary { grid-template-columns: 1fr; }
  .detail-header, .detail-body { padding-left: 1rem; padding-right: 1rem; }
  dialog { width: 100%; }
}
@media (max-width: 430px) {
  .brand span:last-child { display: none; }
  .filter-row { grid-template-columns: 1fr; }
  .result-bar { flex-direction: column; }
  .favorites-toggle { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; }
}
