:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #1f2a2d;
  --muted: #60707a;
  --line: #dfe6e8;
  --accent: #16afd1;
  --orange: #ff7617;
  --green: #2f806d;
  --shadow: 0 18px 44px rgba(29, 43, 50, .10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(145deg, rgba(22, 175, 209, .10), transparent 34%),
    linear-gradient(335deg, rgba(255, 118, 23, .10), transparent 30%),
    var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  letter-spacing: 0;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.hero {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 32px;
  align-items: center;
  padding: 36px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.logo {
  width: 168px;
  height: 104px;
  object-fit: contain;
  background: white;
  border-radius: 4px;
}

.eyebrow,
.step {
  margin: 0 0 8px;
  color: var(--orange);
  font-weight: 800;
}

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

h1 {
  margin-bottom: 14px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.08;
}

.lead {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
  max-width: 860px;
}

.notice,
.panel {
  margin-top: 22px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.notice {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 26px;
}

.notice strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
}

.notice p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.notice span {
  align-self: flex-start;
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  color: white;
  background: var(--green);
  font-weight: 800;
}

.panel {
  padding: 28px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}

.section-head h2 {
  margin-bottom: 0;
  font-size: 28px;
}

.section-head > p {
  margin: 6px 0 0;
  max-width: 460px;
  color: var(--muted);
  line-height: 1.6;
}

.grid {
  display: grid;
  gap: 18px;
}

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

label span {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

em {
  color: var(--orange);
  font-style: normal;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #ccd7db;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 12px 13px;
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.6;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 175, 209, .16);
}

.nomination-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.nomination-slot {
  display: grid;
  gap: 18px;
  min-height: 190px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #fbfcfc);
}

.nomination-slot > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.slot-label {
  display: block;
  margin-bottom: 8px;
  color: var(--orange);
  font-size: 24px;
  font-weight: 900;
}

.nomination-slot strong {
  color: var(--muted);
  font-size: 15px;
}

.slot-content {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
}

.slot-placeholder {
  width: 100%;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  padding: 16px;
  border: 1px dashed #c9d5d9;
  border-radius: 8px;
  background: #f7fafb;
}

.selected-pill {
  display: inline-grid;
  gap: 3px;
  min-width: 132px;
  border: 0;
  border-radius: 8px;
  padding: 14px 16px;
  color: white;
  background: var(--orange);
  text-align: left;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.selected-pill span {
  color: rgba(255, 255, 255, .82);
  font-size: 13px;
  font-weight: 700;
}

.candidate-pool {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.candidate-profile {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcfc;
}

.candidate-profile.political-party {
  border-color: rgba(218, 48, 37, .28);
  background: linear-gradient(180deg, #fff, #fff4f3);
}

.candidate-profile.political-nonparty {
  border-color: rgba(22, 120, 209, .26);
  background: linear-gradient(180deg, #fff, #f1f8ff);
}

.candidate-profile.political-mass {
  background: #fff;
}

.candidate-profile.is-selected {
  border-color: rgba(255, 118, 23, .46);
  background: #fff8f1;
}

.profile-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.profile-head > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: white;
  background: var(--green);
  font-weight: 900;
}

.profile-head h3 {
  margin-bottom: 4px;
  font-size: 22px;
}

.profile-head strong {
  color: var(--orange);
  font-size: 14px;
}

.profile-head .muted-role {
  color: var(--muted);
}

.profile-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.profile-meta div {
  padding: 10px;
  border-radius: 6px;
  background: white;
}

.profile-meta .legal-warning {
  color: #9f2f24;
  background: #fff1ee;
  border: 1px solid rgba(218, 48, 37, .22);
}

.profile-meta dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-meta dd {
  margin: 0;
  font-weight: 900;
}

.eligibility-note {
  padding: 10px 12px;
  border-radius: 6px;
  color: #8c2b22;
  background: #fff1ee;
  border: 1px solid rgba(218, 48, 37, .20);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.candidate-profile p {
  flex: 1;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.candidate-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mini-btn {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.mini-btn.active {
  color: white;
  border-color: var(--orange);
  background: var(--orange);
}

.mini-btn.danger {
  color: #b43a2e;
}

.mini-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 118, 23, .55);
}

.add-person {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  padding: 18px;
  border: 1px dashed #c9d5d9;
  border-radius: 8px;
}

.add-person h3 {
  margin-bottom: 6px;
}

.add-person p {
  margin-bottom: 0;
  color: var(--muted);
}

.inline-add {
  display: grid;
  grid-template-columns: minmax(180px, 260px) auto;
  gap: 10px;
}

.details-empty {
  color: var(--muted);
  padding: 18px;
  border-radius: 8px;
  background: #f7fafb;
  border: 1px dashed #c9d5d9;
}

.candidate-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin-top: 16px;
  background: #fff;
}

.candidate-card:first-child {
  margin-top: 0;
}

.candidate-card h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 22px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--orange);
  font-size: 13px;
  font-weight: 800;
}

.candidate-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.candidate-fields label.wide {
  grid-column: span 2;
}

.candidate-fields label.full {
  grid-column: 1 / -1;
}

.notes {
  color: var(--muted);
  line-height: 1.7;
}

.notes ol {
  margin: 0 0 18px;
  padding-left: 22px;
}

.checkline {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
}

.checkline input {
  width: 18px;
  height: 18px;
  margin-top: 4px;
}

.actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
  padding: 16px;
  background: rgba(245, 247, 248, .88);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(204, 215, 219, .7);
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.btn.primary {
  color: white;
  background: var(--orange);
}

.btn.ghost {
  color: var(--text);
  background: white;
  border: 1px solid var(--line);
}

.btn:hover {
  transform: translateY(-1px);
}

dialog {
  width: min(860px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 28px 80px rgba(20, 34, 40, .28);
}

dialog::backdrop {
  background: rgba(25, 36, 40, .38);
}

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

.dialog-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.dialog-head h2 {
  margin-bottom: 0;
}

#closeDialog {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #f0f4f5;
  font-size: 26px;
  cursor: pointer;
}

#resultText {
  margin: 0;
  max-height: 58vh;
  overflow: auto;
  padding: 22px;
  white-space: pre-wrap;
  line-height: 1.7;
  font-family: "SFMono-Regular", Consolas, monospace;
  color: #273338;
  background: #fbfcfc;
}

@media (max-width: 900px) {
  .hero,
  .nomination-board,
  .candidate-pool,
  .grid.two {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 26px;
  }

  .logo {
    width: 150px;
  }

  .section-head,
  .notice,
  .add-person {
    display: block;
  }

  .inline-add {
    grid-template-columns: 1fr;
    margin-top: 14px;
  }

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

  .candidate-fields label.wide {
    grid-column: auto;
  }

  .actions {
    flex-direction: column;
  }
}
