:root {
  color-scheme: light;
  --paper: #f5f2ea;
  --card: #fffdf8;
  --ink: #23201a;
  --muted: #7d7566;
  --line: #ddd5c4;
  --hairline: #e8e2d3;
  --green: #1e5f45;
  --green-soft: #e4ede7;
  --hot: #b4551d;
}
* { box-sizing: border-box; margin: 0; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  font-size: 14.5px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: #a03030; font-size: 14px; }
.right { text-align: right; }
code {
  background: #ece7da; border: 1px solid var(--hairline);
  padding: 0 5px; border-radius: 4px; font-size: 12px;
}

.wordmark {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 21px; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 10px;
}
.wordmark em { font-style: italic; color: var(--green); margin-left: 4px; }
.wordmark svg { width: 26px; height: 26px; flex: none; }

header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 36px; border-bottom: 2px solid var(--ink); background: var(--paper);
}
.header-actions { display: flex; gap: 10px; }

.btn {
  border: 1px solid var(--ink); border-radius: 6px; padding: 8px 18px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; color: var(--ink); background: transparent; text-decoration: none; display: inline-block;
  transition: background .12s, color .12s;
}
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: #17503a; }
.btn.quiet { border-color: var(--line); background: var(--card); }
.btn.quiet:hover { border-color: var(--ink); }
.btn:disabled { opacity: .45; cursor: default; }

.stats { display: flex; gap: 8px; flex-wrap: wrap; padding: 22px 36px 6px; }
.chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; font-size: 13px;
  cursor: pointer; color: var(--muted); background: var(--card); font-family: inherit;
}
.chip b { color: var(--ink); margin-left: 6px; font-variant-numeric: tabular-nums; }
.chip.active { border-color: var(--green); color: var(--green); background: var(--green-soft); font-weight: 600; }

.table-wrap { padding: 14px 36px 60px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .12em;
  padding: 12px 14px; border-bottom: 1px solid var(--ink);
}
th.r, td.r { text-align: right; }
td { padding: 14px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
tr:hover td { background: rgba(255, 253, 248, .9); }
.co { font-weight: 650; font-size: 15px; }
.co a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.co a:hover { border-color: var(--ink); }
.sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.45; }
.contact div { font-size: 13.5px; line-height: 1.6; font-variant-numeric: tabular-nums; }
.contact .none { color: var(--muted); }

.st { white-space: nowrap; font-size: 13px; font-weight: 600; }
.st i {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 7px; vertical-align: 1px; background: var(--dot, #a39a88);
}
.st.new       { --dot: #a39a88; color: var(--muted); }
.st.building  { --dot: #c08a00; color: #8a6300; }
.st.ready     { --dot: #2f6e8f; color: #2f6e8f; }
.st.contacted { --dot: #7a5ca8; color: #6a4e96; }
.st.engaged   { --dot: #1e7a4c; color: #1e7a4c; }
.st.replied   { --dot: #0f7a6e; color: #0f7a6e; }
.st.won       { --dot: #9a7b00; color: #86690a; }
.st.lost      { --dot: #a05252; color: #96504f; }
.st.error     { --dot: #b03030; color: #a03030; }

.eng { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.eng b { color: var(--ink); font-size: 14px; }
.eng .hot { color: var(--hot); }
.eng .flag { color: var(--hot); font-weight: 700; font-size: 12px; letter-spacing: .06em; }

.rowbtns { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.iconbtn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.iconbtn:hover { border-color: var(--ink); }
.iconbtn.danger:hover { border-color: #a03030; color: #a03030; }
.linkish { background: none; border: none; color: var(--green); cursor: pointer; font-size: 13.5px; padding: 0; font-family: inherit; text-decoration: underline; text-underline-offset: 3px; }
td a.linkish { text-decoration: underline; }
select.status {
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 8px; font-size: 13px; font-family: inherit;
}
.empty { text-align: center; color: var(--muted); padding: 90px 0; }
.empty-title { font-family: Georgia, serif; font-size: 22px; font-style: italic; color: var(--ink); margin-bottom: 8px; }

dialog {
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  padding: 30px; width: min(640px, 92vw); box-shadow: 0 24px 60px rgba(35, 32, 26, .22);
}
dialog::backdrop { background: rgba(35, 32, 26, .45); }
dialog h2 { font-family: Georgia, serif; font-size: 22px; margin-bottom: 12px; }
.section-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); font-weight: 700; margin: 18px 0 6px;
}
input, textarea {
  width: 100%; background: #fff; color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 9px 12px; font-size: 14px; font-family: inherit; margin: 4px 0;
}
input:focus, textarea:focus { outline: none; border-color: var(--green); }
input[readonly], textarea[readonly] { background: #faf7ef; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; margin-bottom: 8px; }
.dropzone {
  display: block; border: 1.5px dashed var(--line); border-radius: 8px;
  padding: 22px; text-align: center; cursor: pointer; color: var(--muted); background: #fbf9f2;
}
.dropzone:hover { border-color: var(--green); color: var(--ink); }
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.field { margin: 12px 0; }
.field label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
}
.copy {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 5px; font-size: 11px; padding: 2px 10px; cursor: pointer;
  text-transform: none; letter-spacing: 0; font-family: inherit;
}
.copy:hover { color: var(--green); border-color: var(--green); }

.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 36px; width: min(380px, 90vw); display: flex; flex-direction: column; gap: 12px;
}

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  border-radius: 8px; padding: 11px 22px; font-size: 14px; z-index: 50;
  box-shadow: 0 12px 30px rgba(35, 32, 26, .35); max-width: 90vw;
}
.toast.err { background: #7c2a2a; }
