:root {
  --bg: #0f1220; --panel: #181c2e; --panel-2: #1f2438; --line: #2b3150;
  --ink: #e7e9f3; --muted: #9aa0be; --accent: #6c7cff; --accent-2: #35c4b5;
  --warn: #ffb454; --danger: #ff6b7d; --good: #46d59e;
  --radius: 12px; --shadow: 0 6px 24px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1a2040 0%, var(--bg) 55%); color: var(--ink);
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
input, textarea, select {
  font: inherit; width: 100%; background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
label { display:block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
a { color: var(--accent); }

/* Layout */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: rgba(20,24,42,.7); border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.02em; margin: 4px 8px 22px; }
.brand small { display:block; font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: .02em; margin-top: 2px; }
.nav button { display:flex; align-items:center; gap: 10px; width: 100%; text-align: left; background: transparent; border: none; color: var(--muted); padding: 10px 12px; border-radius: 9px; margin-bottom: 2px; font-weight: 600; }
.nav button:hover { background: var(--panel); color: var(--ink); }
.nav button.active { background: var(--accent); color: white; }
.main { padding: 26px 30px 60px; max-width: 1100px; }
.head { display:flex; align-items:center; justify-content:space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
h1 { font-size: 24px; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Buttons */
.btn { background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); padding: 9px 14px; border-radius: 9px; font-weight: 600; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }

/* Cards / panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.row { display:flex; gap: 10px; align-items: center; }
.spread { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

/* Stat tiles */
.tiles { display:grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.tile { background: var(--panel); border:1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.tile .n { font-size: 26px; font-weight: 800; }
.tile .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

/* Lead list */
.lead { background: var(--panel); border:1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.lead:hover { border-color: #3a4269; }
.lead .title { font-weight: 700; font-size: 15px; }
.lead .meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; display:flex; gap: 12px; flex-wrap: wrap; }
.pill { display:inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: capitalize; }
.st-idea { background: #2b3150; color: #b9c0e6; }
.st-drafting { background: #3a3160; color: #cbb6ff; }
.st-ready { background: #143f38; color: var(--good); }
.st-sent { background: #123a52; color: #6fc9f5; }
.st-replied { background: #1d4a2e; color: #7ff0b0; }
.st-closed { background: #2a2a33; color: #9a9aac; }
.dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
.pri-1 { color: var(--danger); } .pri-2 { color: var(--muted); } .pri-3 { color: #5c6280; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(6,8,16,.62); display:flex; align-items:flex-start; justify-content:center; padding: 40px 16px; z-index: 50; overflow:auto; }
.modal { background: var(--panel); border:1px solid var(--line); border-radius: 16px; width: 100%; max-width: 720px; padding: 22px; box-shadow: var(--shadow); }
.modal.wide { max-width: 960px; }
.modal .x { float:right; background:transparent; border:none; color: var(--muted); font-size: 20px; }

/* Login */
.login-wrap { min-height: 100vh; display:flex; align-items:center; justify-content:center; padding: 20px; }
.login { width: 100%; max-width: 380px; text-align:center; }
.login .brand { font-size: 30px; margin-bottom: 4px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.tag { display:inline-block; background: var(--panel-2); border:1px solid var(--line); color: var(--muted); font-size: 11px; padding: 2px 8px; border-radius: 6px; margin: 2px 4px 2px 0; cursor: pointer; }
.tag:hover { border-color: var(--accent); color: var(--ink); }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.divider { height:1px; background: var(--line); margin: 16px 0; }
.review-item { border:1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; background: var(--panel-2); }
.review-item.bad { border-color: var(--danger); }
.issue { color: var(--warn); font-size: 12px; }
pre.body { white-space: pre-wrap; font-family: inherit; background: transparent; margin: 6px 0 0; line-height: 1.55; }
.checkline { display:flex; align-items:center; gap:8px; }
.empty { text-align:center; color: var(--muted); padding: 40px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border:1px solid var(--accent); color: var(--ink); padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; }
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .tiles { grid-template-columns: repeat(3,1fr); }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
}

/* Markdown (Playbook page) */
.panel.md { line-height: 1.6; }
.md h1 { font-size: 22px; margin: 4px 0 12px; }
.md h2 { font-size: 17px; margin: 22px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.md h3 { font-size: 14px; margin: 16px 0 6px; color: var(--muted); text-transform: none; }
.md h1:first-child, .md h2:first-child { border: none; padding-top: 0; margin-top: 0; }
.md p { margin: 8px 0; }
.md a { color: var(--accent); word-break: break-word; }
.md ul, .md ol { margin: 8px 0; padding-left: 22px; }
.md li { margin: 4px 0; }
.md code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 12.5px; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.md blockquote { border-left: 3px solid var(--accent); margin: 10px 0; padding: 4px 14px; color: var(--muted); background: var(--panel-2); border-radius: 0 8px 8px 0; }
.md strong { color: var(--ink); }
.md table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--panel-2); font-weight: 700; }
