:root {
  --fg: #2a2a2a;
  --muted: #6b6b6b;
  --bg: #fafafa;
  --card: #ffffff;
  --border: #e2e2e2;
  --accent: #fe5658;
  --accent-fg: #ffffff;
  --danger: #b00;
  --positive: #0a8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Funnel Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.4;
}

header {
  background: #404040;
  color: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header .brand { color: #fff; text-decoration: none; font-weight: 600; letter-spacing: 0.02em; }
header nav a { color: #ccc; margin-left: 1rem; text-decoration: none; }
header nav a:hover { color: #fff; }

main { max-width: 960px; margin: 1.5rem auto; padding: 0 1.5rem; }

h1 { margin-top: 0; }
h2 { margin-top: 2rem; }

.muted { color: var(--muted); font-size: 0.9rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 6px; }
.badge { display: inline-block; padding: 0.1rem 0.5rem; background: #ffe; border: 1px solid #cc8; border-radius: 12px; font-size: 0.75rem; color: #864; }

.agent-list { list-style: none; padding: 0; }
.agent-list li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.agent-list a { color: var(--fg); text-decoration: none; }
.agent-list .count { font-size: 0.9rem; color: var(--muted); }
.agent-list .pending-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e53935;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.candidate {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.candidate-head h2 { margin: 0; font-size: 1.1rem; }
.candidate-head .meta { font-size: 0.85rem; color: var(--muted); margin-top: 0.2rem; }
.candidate-head .meta span { margin-right: 0.5rem; }
.candidate-head .meta a { color: var(--accent); }

.candidate section { margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid var(--border); }
.candidate section h3 { margin: 0 0 0.5rem 0; font-size: 0.95rem; color: #555; }

.row { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: end; margin-bottom: 0.5rem; }
.row label { display: flex; flex-direction: column; font-size: 0.85rem; color: var(--muted); }
.row label input[type="text"], .row label select, .row label textarea {
  font-size: 0.95rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg);
  min-width: 14rem;
}
.candidate label > input[type="text"], .candidate label > textarea, .candidate label > select {
  display: block;
  margin-top: 0.15rem;
}
.candidate textarea { width: 100%; min-width: 0; font-family: inherit; }
.candidate label { display: block; margin: 0.5rem 0; font-size: 0.85rem; color: var(--muted); }
.candidate label > input[type="text"] { width: 100%; min-width: 0; }

.checkrow, .radiorow {
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--fg);
  margin-bottom: 0.3rem;
}
.checkrow input, .radiorow input { margin: 0; }

.opps { margin-top: 0.7rem; padding: 0.6rem 0.8rem; background: #f3f6ff; border: 1px solid #d6def0; border-radius: 6px; }
.opps strong { display: block; margin-bottom: 0.4rem; }
.opps em { color: var(--muted); font-style: normal; font-size: 0.85rem; }

.actions { margin-top: 1rem; display: flex; gap: 0.5rem; }
button {
  font: inherit;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(0.95); }
button.danger { background: var(--danger); color: #fff; border-color: var(--danger); }

.discard-form { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid var(--border); }
.discard-form details summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
.discard-form details[open] summary { color: var(--danger); }

table { border-collapse: collapse; width: 100%; }
table th, table td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); }
code { background: #f0f0f0; padding: 0 0.3rem; border-radius: 3px; font-size: 0.9em; }

.info-icon {
  display: inline-block;
  position: relative;
  cursor: help;
  margin-left: 0.35rem;
  color: var(--accent);
  font-size: 1rem;
  line-height: 1;
  vertical-align: middle;
  user-select: none;
  font-style: normal;
}
.info-icon:hover { color: var(--fg); }

.info-icon::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.5rem);
  transform: translateX(-50%);
  background: #2a2a2a;
  color: #fff;
  padding: 0.55rem 0.75rem;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 400;
  font-style: normal;
  font-family: 'Funnel Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  white-space: normal;
  width: 17rem;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s;
}
.info-icon::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.05rem);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #2a2a2a;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s;
}
.info-icon:hover::after,
.info-icon:hover::before {
  opacity: 1;
  visibility: visible;
}
