:root {
  --bg: #fafaf9;
  --fg: #1c1917;
  --muted: #78716c;
  --border: #e7e5e4;
  --accent: #0f766e;
  --danger: #b91c1c;
}
* { box-sizing: border-box; }
body { font: 14px/1.45 system-ui, sans-serif; margin: 0; background: var(--bg); color: var(--fg); }
body.centered { display: grid; place-items: center; min-height: 100vh; }
.card { background: white; padding: 32px; border: 1px solid var(--border); border-radius: 8px; max-width: 360px; }
header { background: white; border-bottom: 1px solid var(--border); }
nav { display: flex; align-items: center; gap: 16px; padding: 12px 24px; max-width: 1100px; margin: 0 auto; }
nav .brand { font-weight: 600; }
nav a { color: var(--fg); text-decoration: none; }
nav a:hover { color: var(--accent); }
nav .logout { margin-left: auto; }
main { max-width: 1100px; margin: 24px auto; padding: 0 24px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin-top: 24px; }
.back { color: var(--muted); text-decoration: none; }
small.slug { color: var(--muted); font-weight: 400; font-size: 14px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: white; text-decoration: none; color: var(--fg); font-size: 12px; }
.chip.active { background: var(--fg); color: white; border-color: var(--fg); }

table.grid { width: 100%; border-collapse: collapse; background: white; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
table.grid th, table.grid td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; }
table.grid th { background: #f5f5f4; font-weight: 600; font-size: 12px; text-transform: uppercase; color: var(--muted); }
table.grid tr:last-child td { border-bottom: none; }

.stage, .prio { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.stage-prospect       { background: #f5f5f4; color: var(--muted); }
.stage-exploring      { background: #fef3c7; color: #92400e; }
.stage-qualifying     { background: #dbeafe; color: #1e40af; }
.stage-demo-scheduled { background: #dcfce7; color: #14532d; }
.stage-cold           { background: #e0e7ff; color: #3730a3; }
.stage-not-a-fit      { background: #fee2e2; color: #991b1b; }
.prio-P0 { background: #fee2e2; color: #991b1b; }
.prio-P1 { background: #fef3c7; color: #92400e; }
.prio-P2 { background: #dbeafe; color: #1e40af; }
.prio-P3 { background: #f5f5f4; color: var(--muted); }

form.meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; background: white; padding: 16px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 24px; }
form.meta label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
form.meta label.full { grid-column: 1 / -1; }
form.meta input, form.meta select, form.meta textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; }
form.meta button { grid-column: 1 / -1; justify-self: start; padding: 6px 14px; background: var(--accent); color: white; border: none; border-radius: 4px; cursor: pointer; }

.tabs { display: flex; gap: 4px; margin: 24px 0 12px; border-bottom: 1px solid var(--border); }
.tab { background: none; border: none; padding: 8px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font: inherit; }
.tab.active { color: var(--fg); border-color: var(--accent); }
.tab.disabled { color: #d6d3d1; cursor: not-allowed; }

.inline-add { display: flex; gap: 8px; margin-top: 12px; }
.inline-add input, .inline-add select { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; }
.inline-add button { padding: 6px 14px; background: var(--accent); color: white; border: none; border-radius: 4px; cursor: pointer; }

form.inline { display: inline; margin: 0; }
button.link { background: none; border: none; color: var(--danger); cursor: pointer; font: inherit; padding: 0; }

ul.domains, ul.emails { list-style: none; padding: 0; margin: 8px 0; }
ul.domains li, ul.emails li { padding: 6px 0; display: flex; gap: 12px; align-items: baseline; }

details.newform { margin-top: 16px; }
details.newform summary { cursor: pointer; color: var(--accent); }
details.newform form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; padding: 12px; background: white; border: 1px solid var(--border); border-radius: 6px; }
details.newform form label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
details.newform form input, details.newform form select { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; }
details.newform form button { grid-column: 1 / -1; justify-self: start; padding: 6px 14px; background: var(--accent); color: white; border: none; border-radius: 4px; cursor: pointer; }

button { font: inherit; }
button[type=submit] { padding: 6px 14px; background: var(--accent); color: white; border: none; border-radius: 4px; cursor: pointer; }
button.secondary { background: white; color: var(--fg); border: 1px solid var(--border); }
p.status { color: var(--danger); min-height: 1.2em; }
.row { display: flex; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
details.enrol { margin-top: 16px; }
details.enrol summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details.enrol button { margin-top: 8px; padding: 6px 14px; background: white; color: var(--fg); border: 1px solid var(--border); border-radius: 4px; cursor: pointer; }
.card button#loginBtn { padding: 8px 16px; background: var(--accent); color: white; border: none; border-radius: 4px; cursor: pointer; width: 100%; font-size: 15px; }
.card button#loginBtn:hover { opacity: 0.9; }
form.inline-rename { display: inline-flex; gap: 6px; align-items: center; }
form.inline-rename input { font: inherit; padding: 2px 6px; border: 1px solid var(--border); border-radius: 3px; min-width: 140px; }
code.tiny { font-size: 11px; color: var(--muted); }
