:root {
  --bg: #f4f6f8;
  --paper: #ffffff;
  --ink: #17212b;
  --muted: #687582;
  --line: #dce3e9;
  --accent: #176b87;
  --accent-strong: #0d526b;
  --ok: #2d6a4f;
  --danger: #a4453d;
  --shadow: 0 2px 8px rgba(25, 42, 56, 0.06);
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  --bg: #151b21;
  --paper: #1e272f;
  --ink: #edf2f5;
  --muted: #aebbc4;
  --line: #35434d;
  --accent: #6bb5cf;
  --accent-strong: #8ccde3;
  --ok: #9ed0b5;
  --danger: #e09a91;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 15px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { max-width: 1120px; margin: 0 auto; padding: 0 1rem 3rem; }
.main { padding-top: 0.5rem; }

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.75rem;
}
.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  letter-spacing: 0.01em;
  text-decoration: none;
}
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.85rem 1.1rem; margin-left: auto; }
.nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.nav a.is-on, .nav a:hover { color: var(--accent); }
.nav-who { color: var(--muted); font-size: 0.85rem; }
.nav-toggle { display: none; }
.theme-toggle {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  font-size: 0.85rem;
}
.theme-toggle:hover { color: var(--ink); }

h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; margin: 0 0 0.4rem; }
h1 { font-size: 1.9rem; line-height: 1.2; }
h2 { font-size: 1.05rem; }
.kicker { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem; color: var(--muted); margin: 0 0 0.25rem; }
.lede { color: var(--muted); max-width: 36rem; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }
.break { word-break: break-all; }
.hint { font-size: 0.85rem; color: var(--muted); margin: 0; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  border-radius: 6px;
}
.narrow { max-width: 32rem; margin-left: auto; margin-right: auto; }
.narrow-form { max-width: 40rem; }
.grow { flex: 1; min-width: 0; }
.landing { padding: 4rem 0 3rem; }
.landing h1 { max-width: 40rem; font-size: 2.8rem; }
.landing .lede { font-size: 1.08rem; margin: 1rem 0 1.5rem; }
.landing-points {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
}
.landing-points div { display: flex; flex-direction: column; gap: 0.3rem; }
.landing-points span { color: var(--muted); font-size: 0.9rem; }

.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.stack.tight { gap: 0.4rem; }
.top-gap { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.split { display: grid; grid-template-columns: 22rem 1fr; gap: 1rem; align-items: start; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.inline { display: inline; }

label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.88rem; color: var(--muted); }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0.58rem 0.65rem;
  width: 100%;
  border-radius: 4px;
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { background: #151a1e; }
textarea { resize: vertical; }
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  padding: 0.58rem 0.9rem;
  cursor: pointer;
  width: fit-content;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
}
.btn:hover { text-decoration: none; background: var(--accent-strong); border-color: var(--accent-strong); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid rgba(23, 107, 135, 0.22); outline-offset: 2px; }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn-ghost:hover { color: var(--accent-strong); background: #f1f7f9; border-color: #b9d2dc; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-small { padding: 0.3rem 0.6rem; font-size: 0.85rem; }
.linkish {
  background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font: inherit;
}
.linkish:hover { color: var(--ink); text-decoration: underline; }

.flash { padding: 0.7rem 0.9rem; margin-bottom: 1rem; border: 1px solid var(--line); }
.flash-ok { background: #eaf5ef; border-color: #bfe0cb; }
.flash-error { background: #fff0ee; border-color: #ecc6c0; }
html[data-theme="dark"] .flash-ok { background: #203027; border-color: #466150; }
html[data-theme="dark"] .flash-error { background: #382725; border-color: #69443c; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.stat { background: var(--paper); border: 1px solid var(--line); padding: 0.9rem 1rem; border-radius: 6px; box-shadow: var(--shadow); }
.stat span { display: block; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; }
.stat strong { font-size: 1.5rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.7rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
tbody tr:hover { background: #f8fafb; }
html[data-theme="dark"] tbody tr:hover { background: #253039; }

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; align-items: center; }
.filters input, .filters select { width: auto; min-width: 10rem; }
.check { flex-direction: row; align-items: center; gap: 0.4rem; color: var(--ink); }
.check input { width: auto; }

.row-actions { display: flex; gap: 0.5rem; align-items: center; margin: 0.75rem 0 1.5rem; }
.row-actions select { width: auto; min-width: 14rem; }
.pager { display: flex; gap: 1rem; align-items: center; color: var(--muted); }

.pill {
  display: inline-block;
  border: 1px solid var(--line);
  padding: 0.05rem 0.45rem;
  font-size: 0.78rem;
  background: #f8fafb;
  white-space: nowrap;
  border-radius: 999px;
}
.pill.lg { font-size: 0.95rem; padding: 0.2rem 0.6rem; }
.pill-converted { border-color: #c5d6c9; background: #e8f0ea; }
.pill-new { border-color: var(--line); }
.pill-call-back { border-color: #d8c48a; background: #f7f0dc; }
.pill-interested { border-color: #c5d6c9; background: #e8f0ea; }
.pill-not-interested, .pill-do-not-call, .pill-invalid-number, .pill-wrong-info { color: var(--muted); }
.pill-ok { border-color: #c5d6c9; background: #e8f0ea; }
.pill-bad { border-color: #e2c9c3; background: #f6ebe8; }
html[data-theme="dark"] .pill { background: #252d32; }
html[data-theme="dark"] .pill-converted,
html[data-theme="dark"] .pill-interested,
html[data-theme="dark"] .pill-ok { border-color: #466150; background: #203027; }
html[data-theme="dark"] .pill-call-back { border-color: #74653b; background: #393323; }
html[data-theme="dark"] .pill-bad { border-color: #69443c; background: #382725; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { border-color: var(--line); }
html[data-theme="dark"] .btn-ghost:hover { background: #25363d; border-color: #4f7887; }

.kv { display: grid; grid-template-columns: 8rem 1fr; gap: 0.35rem 0.75rem; margin: 0; }
.kv dt { color: var(--muted); font-size: 0.85rem; }
.kv dd { margin: 0; }

.comments { list-style: none; padding: 0; margin: 0 0 1rem; }
.comments li { border-bottom: 1px solid var(--line); padding: 0.7rem 0; }
.comments .meta { font-size: 0.82rem; color: var(--muted); }
.comments p { margin: 0.25rem 0 0; white-space: pre-wrap; }

.log { list-style: none; padding: 0; margin: 0; }
.log li { padding: 0.45rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.resp {
  background: #eef2f5;
  padding: 0.4rem;
  font-size: 0.75rem;
  overflow: auto;
  max-height: 8rem;
}
html[data-theme="dark"] .resp { background: #151a1e; }
.note { font-size: 0.9rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: 0.75rem; }
.sub { margin-top: 1rem; font-size: 1rem; }
.ftd { border-color: #ecc6c0; }

@media (max-width: 860px) {
  .split, .detail-grid, .grid-2 { grid-template-columns: 1fr; }
  .landing { padding-top: 2rem; }
  .landing-points { grid-template-columns: 1fr; }
  .nav-toggle {
    display: inline-block;
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--line);
    padding: 0.3rem 0.6rem;
    cursor: pointer;
  }
  .nav { display: none; width: 100%; flex-direction: column; align-items: flex-start; margin-left: 0; }
  .nav.is-open { display: flex; }
  h1 { font-size: 1.55rem; }
  .landing h1 { font-size: 2.2rem; }
  .filters input, .filters select { min-width: 0; width: 100%; }
}
