/* People Finder: one calm style for both pages. No internet fonts: the Mac's own font. */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1d2733;
  --muted: #6b7684;
  --line: #e2e6eb;
  --green: #18824a;   --green-bg: #e4f5ea;
  --blue: #2457d6;    --blue-bg: #e7eefc;
  --grey: #7d8794;    --grey-bg: #eef0f3;
  --orange: #c26407;  --orange-bg: #fdf0df;
  --yellow: #a87f00;  --yellow-bg: #fbf4d3;
  --red: #c62828;     --red-bg: #fbe8e8;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.25rem; }
h2 { font-size: 1.2rem; margin-bottom: 10px; }
a { color: var(--blue); }
[hidden] { display: none !important; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* ---------------------------------------------------------------- top bar */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.topbar nav a.active { background: var(--blue-bg); color: var(--blue); }
.topbar .spacer { flex: 1; }
.account { color: var(--muted); font-size: 0.85rem; }
#run-picker { max-width: 230px; font-size: 0.9rem; }
.topbar h1 { font-size: 1.1rem; }
.totals { font-size: 0.95rem; }
.totals b { font-weight: 600; }

/* ---------------------------------------------------------------- page 1 */

.page { max-width: 1180px; margin: 0 auto; padding: 20px 24px 40px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.hint { margin: 0 0 10px; color: var(--muted); }
textarea {
  width: 100%;
  min-height: 190px;
  padding: 12px;
  font: 0.95rem/1.4 ui-monospace, Menlo, monospace;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
}
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.row label { display: flex; align-items: center; gap: 8px; }
input[type="text"], input[type="search"], select {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.button.primary { background: var(--blue); color: #fff; }
.button.go { background: var(--green); color: #fff; }
.button.danger { background: var(--red); color: #fff; }
.button.secondary { background: #fff; color: var(--text); border-color: var(--line); }
.button.small { padding: 4px 10px; font-size: 0.85rem; font-weight: 500; }
.button.big { font-size: 1.1rem; padding: 10px 28px; }
.button.done-on { background: var(--green-bg); color: var(--green); border-color: var(--green); }

.table-wrap { overflow-x: auto; max-height: 460px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); background: #fafbfc; position: sticky; top: 0; }
#preview-table input[type="text"] { width: 100%; min-width: 140px; }
tr.duplicate td { color: var(--muted); }
.note { display: inline-block; margin: 1px 4px 1px 0; padding: 1px 8px; border-radius: 999px; font-size: 0.8rem; background: var(--grey-bg); color: var(--grey); }
.note.warn { background: var(--yellow-bg); color: var(--yellow); }
.note.good { background: var(--green-bg); color: var(--green); }
.note.bad { background: var(--orange-bg); color: var(--orange); }

.summary { margin-top: 14px; padding: 10px 14px; border-radius: 8px; font-size: 1.05rem; }
.summary.ok { background: var(--green-bg); color: var(--green); }
.summary.warn { background: var(--red-bg); color: var(--red); }

.bar { height: 14px; background: var(--grey-bg); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--blue); transition: width 0.4s; }
.bar-fill.finished { background: var(--green); }
.progress-line { display: flex; gap: 24px; flex-wrap: wrap; margin: 10px 0 14px; font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 4px 12px; border-radius: 999px; font-size: 0.9rem; background: var(--grey-bg); color: var(--grey); }
.chip.searching { background: var(--blue-bg); color: var(--blue); }
.chip.failed { background: var(--red-bg); color: var(--red); font-weight: 600; }
.message { margin: 10px 0 0; }
.message.warn { color: var(--red); }
.message.ok { color: var(--green); }
#preview-table .center { text-align: center; }
td.no-city { color: var(--yellow); font-weight: 600; }

#runs tbody tr { cursor: pointer; }
#runs tbody tr:hover { background: #f8fafc; }
.status { font-weight: 600; }
.status.running { color: var(--blue); }
.status.done { color: var(--green); }
.status.paused { color: var(--orange); }

/* ---------------------------------------------------------------- page 2 */

.results { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; padding: 16px 20px 30px; align-items: start; }
.results .card { padding: 18px 18px; }
.sidebar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
}
.sidebar input[type="search"] { width: 100%; margin-bottom: 10px; }
.filters { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.filters button { font: inherit; font-size: 0.85rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.filters button.active { background: var(--blue-bg); color: var(--blue); border-color: var(--blue); }
#company-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
#company-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
#company-list li:hover { background: #f4f6f9; }
#company-list li.selected { background: var(--blue-bg); }
#company-list .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--grey); flex: none; }
.dot.failed { background: var(--red); }
/* The 4 company statuses: found green, none grey, failed red, waiting yellow. */
.dot.found { background: var(--green); }
.dot.none { background: var(--grey); }
.dot.waiting { background: #e0b100; }
.name-block { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.state-text { font-size: 0.78rem; }
.state-text.found, .note.state.found { color: var(--green); }
.state-text.none, .note.state.none { color: var(--grey); }
.state-text.failed, .note.state.failed { color: var(--red); }
.state-text.waiting, .note.state.waiting { color: var(--yellow); }
.note.state { font-weight: 600; }
.note.state.found { background: var(--green-bg); }
.note.state.none { background: var(--grey-bg); }
.note.state.failed { background: var(--red-bg); }
.note.state.waiting { background: var(--yellow-bg); }
.chip.found { background: var(--green-bg); color: var(--green); }
.chip.none { background: var(--grey-bg); color: var(--grey); }
.chip.waiting { background: var(--yellow-bg); color: var(--yellow); }
.note.failed { background: var(--red-bg); color: var(--red); font-weight: 600; }
.failed-box { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--red); border-radius: 10px; background: var(--grey-bg); }
.failed-reason { display: block; margin: 6px 0 10px; color: var(--grey); font-size: 0.9rem; }
.failed-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--grey); font-size: 0.9rem; }

.company { min-width: 0; }
.company h2 { font-size: 1.6rem; margin-bottom: 6px; }
.company-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); }
.company-meta .sep { color: var(--line); }
.notes { margin-top: 8px; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0 12px; }
.tick { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; font-weight: 500; }
.help { background: var(--yellow-bg); color: #6b5300; border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }

.table-scroll { overflow-x: auto; }
.people th { font-size: 0.72rem; letter-spacing: 0.02em; padding: 7px 8px; }
.people td { font-size: 0.95rem; padding: 7px 8px; }
.people .p-name { font-weight: 600; }
.people .p-notes { margin-top: 3px; }
.people .p-role { min-width: 150px; max-width: 240px; }
.people .p-place { min-width: 110px; max-width: 170px; }
.people .center { text-align: center; }
.hide-buttons { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.people .cell-buttons { display: grid; grid-template-columns: auto auto; gap: 4px; align-items: center; justify-content: start; }
.people .cell-buttons .button { grid-column: 1; }
.people .cell-buttons .g-mark { grid-column: 2; grid-row: 1; }
.people th.tick-col { width: 64px; white-space: normal; hyphens: manual; }
.priority-High { font-weight: 700; }
.priority-Medium { font-weight: 400; }
.priority-Low { color: var(--grey); }
.type { font-size: 0.8rem; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--grey-bg); white-space: nowrap; }
.type.TOP { background: var(--blue-bg); color: var(--blue); }
.g-mark {
  display: inline-block;
  width: 18px; height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  background: var(--grey-bg);
  color: var(--grey);
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 4px;
  cursor: help;
}
.cell-buttons { display: flex; gap: 6px; white-space: nowrap; }
tr.added td { background: #fbfdf7; }
.link-button { font: inherit; background: none; border: none; color: var(--blue); cursor: pointer; padding: 6px 0; margin-top: 10px; }
.keys { color: var(--muted); font-size: 0.85rem; margin-top: 16px; }
.empty { color: var(--muted); padding: 30px 0; text-align: center; }

/* ---------------------------------------------------------------- practice copy, START messages, copy box */

/* Only a practice copy (fake data) shows this bar: it can never be mistaken for the real app. */
.practice-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #f97316;
  color: #fff;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 12px;
}
.loaded { color: var(--green); font-weight: 600; }
.start-message { margin-top: 12px; padding: 12px 16px; border-radius: 8px; font-size: 1.05rem; font-weight: 600; }
.start-message.ok { background: var(--green-bg); color: var(--green); }
.start-message.warn { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }
.copy-box {
  position: fixed;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, 92vw);
  background: var(--card);
  border: 2px solid var(--blue);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  z-index: 40;
}
.copy-box textarea { min-height: 220px; font-family: inherit; }

/* ---------------------------------------------------------------- footer and messages */

footer { text-align: center; color: var(--muted); font-size: 0.9rem; padding: 10px 0 24px; }
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 500;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  z-index: 10;
}
.toast.warn { background: var(--red); }

@media (max-width: 1000px) {
  .results { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: 360px; }
}

/* All companies: the big totals at the top. */
.totals-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.total { flex: 1 1 150px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.total b { display: block; font-size: 2rem; line-height: 1.1; }
.total span { color: var(--muted); font-size: 0.9rem; }
.total.found b { color: var(--green); }
.total.none b { color: var(--grey); }
.total.mail b { color: var(--blue); }
#all-companies .center, #preview-table .center { text-align: center; }
#find { min-width: 220px; }
.match-cell { white-space: nowrap; }

/* ---------------------------------------------------------------- Step 4: reveal contact */

.signalhire { color: var(--text); font-weight: 500; }
.warn-text { color: var(--red); }
.people .person-buttons { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.type.priority-Low { opacity: 0.75; }
.type.LOCAL { background: var(--green-bg); color: var(--green); }

/* the ⋯ menu */
details.more { position: relative; display: inline-block; }
details.more > summary { list-style: none; cursor: pointer; min-width: 34px; justify-content: center; }
details.more > summary::-webkit-details-marker { display: none; }
details.more .menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  display: flex; flex-direction: column; min-width: 180px; padding: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
.menu-item {
  font: inherit; font-size: 0.9rem; text-align: left; padding: 7px 10px;
  background: none; border: 0; border-radius: 6px; cursor: pointer; color: var(--text);
}
.menu-item:hover { background: var(--bg); }
.menu-item:disabled { color: var(--muted); cursor: not-allowed; }

/* the contact row under a person */
.people tr.contact-row > td { background: #fafbfc; padding: 12px 16px 16px; }
.contact-box { display: flex; flex-direction: column; gap: 10px; max-width: 860px; }
.contact-line { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.contact-label { width: 64px; padding-top: 3px; font-size: 0.8rem; letter-spacing: 0.04em; color: var(--muted); }
.choices { display: flex; flex-direction: column; gap: 4px; min-width: 260px; }
.choice { display: flex; align-items: center; gap: 8px; user-select: text; }
.choice input { accent-color: var(--blue); }
textarea.prompt { min-height: 170px; font-size: 0.85rem; background: #fff; }
.contact-warning {
  margin: 0; padding: 8px 12px; border-radius: 8px; font-weight: 600;
  background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange);
}
.reveal-reason { margin: 0; }
.reveal-reason.warn { color: var(--red); }
.row.tight { margin-top: 0; }
.link-input { min-width: 380px; }
.box-settings textarea { min-height: 120px; font-family: inherit; }
.email-label { font-size: 0.75rem; font-weight: 600; padding: 0 7px; border-radius: 999px; }
.email-label.work { background: var(--blue-bg); color: var(--blue); }
.email-label.personal { background: var(--grey-bg); color: var(--grey); }

/* ---------------------------------------------------------------- Step 5: mail fast */

.found-as { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.best-tag {
  font-size: 0.75rem; font-weight: 700; padding: 1px 7px; border-radius: 6px; white-space: nowrap;
  background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow);
}
.people tr.best > td:first-child { box-shadow: inset 3px 0 0 var(--yellow); }
.people tr.current > td { background: var(--blue-bg); }
.people tr[data-person] { cursor: default; }
#show-more { display: block; margin-top: 6px; }
.mail-box { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; border-top: 1px dashed var(--line); }
textarea.mail-text { min-height: 150px; font-size: 0.9rem; font-family: inherit; background: #fff; }
.mail-box .contact-line { align-items: center; }
