:root {
  --bg: #141210;
  --bg-elev: #1e1b18;
  --bg-soft: #26221e;
  --ink: #f3ece3;
  --muted: #a89f93;
  --line: rgba(243, 236, 227, 0.12);
  --accent: #d97706;
  --accent-soft: rgba(217, 119, 6, 0.16);
  --good: #3d9a6a;
  --warn: #c9842a;
  --bad: #c45c4a;
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Instrument Serif", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(217, 119, 6, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(61, 154, 106, 0.08), transparent 50%),
    var(--bg);
  color: var(--ink);
}

.eyebrow {
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}

h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-family: var(--display); font-size: 2rem; font-weight: 400; }
h2 { font-family: var(--display); font-size: 1.8rem; font-weight: 400; }
h3 { font-size: 0.95rem; margin-bottom: 0.75rem; }
.muted { color: var(--muted); }

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.75rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.auth-sub, .auth-hint { color: var(--muted); font-size: 0.95rem; }
.auth-hint { margin-top: 1rem; font-size: 0.85rem; }
.auth-card label {
  display: grid;
  gap: 0.35rem;
  margin: 0.85rem 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.auth-card input, .list-tools input, .list-tools select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  font: inherit;
}
.auth-actions { display: flex; gap: 0.6rem; margin-top: 0.5rem; }
.error { color: #f0a090; font-size: 0.9rem; }

button, .link {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #1a1208;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button.ghost, a.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button:disabled { opacity: 0.55; cursor: wait; }

.app { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.topbar-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.stats article {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.stats span { display: block; font-size: 1.5rem; font-weight: 700; }
.stats small { color: var(--muted); }

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 1rem;
  min-height: 65vh;
}
.list-pane, .detail-pane {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.list-tools {
  display: grid;
  gap: 0.5rem;
  padding: 0.85rem;
  border-bottom: 1px solid var(--line);
}
.client-list {
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  max-height: 70vh;
  overflow: auto;
}
.client-list li button {
  width: 100%;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  padding: 0.85rem;
  display: grid;
  gap: 0.2rem;
  text-align: left;
  font-weight: 500;
}
.client-list li button:hover,
.client-list li button.active {
  background: var(--accent-soft);
  border-color: rgba(217, 119, 6, 0.35);
}
.client-list .row-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.detail-pane { padding: 1.1rem; }
.empty-detail {
  min-height: 50vh;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
  gap: 0.5rem;
}
.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.status-pill {
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.status-pill.lead { color: #e8c27a; }
.status-pill.active { color: #8fd4ae; }
.status-pill.paused { color: #f0a090; }

.badges { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 1rem; }
.badge {
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.badge.on { background: var(--accent-soft); border-color: rgba(217, 119, 6, 0.4); }

.card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.85rem;
}
.checklist { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.checklist li { margin: 0.3rem 0; }
.checklist .yes { color: #9ed9b8; }
.checklist .no { color: var(--muted); }
.monthly { margin: 0.85rem 0 0; font-weight: 700; font-size: 1.1rem; }

.meta { margin: 0; display: grid; gap: 0.55rem; }
.meta div { display: grid; grid-template-columns: 110px 1fr; gap: 0.5rem; font-size: 0.92rem; }
.meta dt { color: var(--muted); margin: 0; }
.meta dd { margin: 0; word-break: break-word; }
.meta a { color: #f0c27a; }

.note-label { display: grid; gap: 0.4rem; margin: 0.85rem 0 0.5rem; color: var(--muted); font-size: 0.85rem; }
.notes { list-style: none; margin: 0.9rem 0 0; padding: 0; display: grid; gap: 0.55rem; }
.notes li {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font-size: 0.92rem;
}
.notes time { display: block; color: var(--muted); font-size: 0.78rem; margin-bottom: 0.25rem; }

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .workspace { grid-template-columns: 1fr; }
  .client-list { max-height: 40vh; }
  .topbar { flex-direction: column; }
}
