:root {
  --bg: #0a0e17; --bg2: #0f1522; --panel: #121a2a; --panel2: #172033; --line: #1f2a3f; --line2: #2b3852;
  --text: #e6e9f2; --muted: #8b95ab; --cyan: #22d3ee; --violet: #8b5cf6; --green: #34d399; --amber: #fbbf24; --red: #f87171;
  --grad: linear-gradient(90deg, var(--cyan), var(--violet));
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; position: relative; }
.bg-grid { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px; opacity: .25;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 70%); -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 70%); }
a { color: var(--cyan); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 4px; font-weight: 700; }
h2 { font-size: 18px; letter-spacing: -.01em; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
h3:first-child { margin-top: 0; }
main { max-width: 980px; margin: 0 auto; padding: 28px 20px 80px; }
main.wide { max-width: 1400px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .mono { font-family: var(--mono); font-size: .92em; } .right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.amber { color: var(--amber); } .green { color: var(--green); }
.row { display: flex; align-items: center; } .col { display: flex; flex-direction: column; }
.gap { gap: 10px; } .end { justify-content: flex-end; } .between { justify-content: space-between; } .grow { flex: 1; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; padding: 10px 20px; background: rgba(10,14,23,.8); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { color: var(--text); font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand.big { font-size: 20px; justify-content: center; margin-bottom: 22px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 14px var(--cyan); display: inline-block; }
.tabs { display: flex; align-items: center; gap: 4px; }
.tabs .crumb { color: var(--muted); padding: 0 10px 0 4px; border-right: 1px solid var(--line); margin-right: 6px; }
.tabs a { color: var(--muted); padding: 6px 12px; border-radius: 8px; font-weight: 500; }
.tabs a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.tabs a.on { color: var(--text); background: var(--panel2); }
.spacer { flex: 1; }
.topbar form { margin: 0; }

/* Cards, lists */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card.link { display: block; color: var(--text); transition: border-color .15s, transform .15s; } .card.link:hover { border-color: var(--line2); transform: translateY(-2px); text-decoration: none; }
.card.dashed { border-style: dashed; background: transparent; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 20px; flex-wrap: wrap; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 30px 0 10px; flex-wrap: wrap; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list.tight { gap: 4px; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); color: var(--text); }
.list.tight .item { padding: 10px 12px; background: transparent; }
a.item:hover { border-color: var(--line2); text-decoration: none; background: var(--panel2); }
.item-title { font-weight: 600; margin-top: 4px; }
.empty { padding: 34px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r); }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); } .pill b { color: var(--cyan); }
.badge { font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); margin-left: 4px; }
.badge:first-child { margin-left: 0; }
.badge.cyan { color: var(--cyan); border-color: rgba(34,211,238,.35); } .badge.violet { color: #a78bfa; border-color: rgba(139,92,246,.4); }
.badge.green { color: var(--green); border-color: rgba(52,211,153,.35); } .badge.amber { color: var(--amber); border-color: rgba(251,191,36,.35); }
.badge.red { color: var(--red); border-color: rgba(248,113,113,.35); }
.badge.ai { background: var(--grad); color: #0a0e17; border: 0; }
.flash { padding: 10px 14px; background: rgba(34,211,238,.08); border: 1px solid rgba(34,211,238,.3); border-radius: 10px; margin: 0 0 16px; }
.flash-card { border-color: var(--cyan); margin-bottom: 18px; }
.flash-card .row { margin-top: 10px; }

/* Forms */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0; }
label > input, label > select, label > textarea, .editor textarea, input.mono { display: block; width: 100%; margin-top: 5px; padding: 10px 12px; background: var(--bg2); color: var(--text); border: 1px solid var(--line2); border-radius: 9px; font: inherit; font-size: 14px; }
input.mono { font-family: var(--mono); font-size: 13px; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--cyan); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34,211,238,.15); }
textarea { resize: vertical; min-height: 90px; }
select { appearance: none; padding-right: 30px !important; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.form h1, .form h2 { margin-bottom: 14px; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; } .inline-form label { margin: 6px 0; min-width: 110px; } .inline-form button { margin-bottom: 6px; }
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; }
.seg label { margin: 0; cursor: pointer; } .seg input { display: none; }
.seg span { display: inline-block; padding: 6px 14px; border-radius: 7px; color: var(--muted); font-weight: 500; font-size: 14px; }
.seg input:checked + span { background: var(--panel2); color: var(--text); }
.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; color: var(--text); font-size: 14px; }
.toggle input { display: none; }
.switch { width: 38px; height: 22px; border-radius: 999px; background: var(--line2); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked + .switch { background: var(--grad); } .toggle input:checked + .switch::after { transform: translateX(16px); }
.checks { border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; max-height: 240px; overflow: auto; margin: 10px 0; }
.checks legend { color: var(--muted); font-size: 13px; padding: 0 4px; }
.checks label { display: flex; gap: 8px; align-items: center; margin: 6px 0; color: var(--text); }
button, .primary, .ghost { font: inherit; font-weight: 600; font-size: 14px; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover, .primary:hover, .ghost:hover { text-decoration: none; filter: brightness(1.12); }
.primary { background: var(--grad); color: #0a0e17; border: 0; }
.ghost { background: transparent; }
.ghost.danger, .danger { color: var(--red); }
button.small, .ghost.small { padding: 5px 10px; font-size: 13px; }
.block { width: 100%; justify-content: center; margin-top: 8px; }
.ai { background: var(--bg2); border: 1px solid transparent; background-image: linear-gradient(var(--bg2), var(--bg2)), var(--grad); background-origin: border-box; background-clip: padding-box, border-box; color: var(--text); }
.error { color: var(--red); }
details.card summary { cursor: pointer; color: var(--muted); font-weight: 500; } details.card[open] summary { margin-bottom: 8px; }
details.section { margin-top: 30px; } details.section summary { cursor: pointer; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 16px; padding: 24px; width: min(560px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
dialog::backdrop { background: rgba(5,8,14,.7); backdrop-filter: blur(4px); }

/* Auth */
.auth { max-width: 400px; margin: 12vh auto 0; }
.auth .card { padding: 28px; }

/* Issues */
.issue-head { display: flex; justify-content: space-between; gap: 20px; margin: 10px 0 18px; flex-wrap: wrap; align-items: flex-start; }
.issue-head h1 { margin: 8px 0 4px; }
.issue-head select { margin: 0; min-width: 170px; }
.prose { line-height: 1.6; overflow-wrap: anywhere; } .prose p { margin: 0 0 10px; } .prose p:last-child { margin: 0; }
.prose img { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; margin: 8px 0; }
.prose pre { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; font-family: var(--mono); font-size: 13px; }
.prose code { font-family: var(--mono); font-size: .9em; background: var(--bg2); padding: 1px 5px; border-radius: 4px; } .prose pre code { padding: 0; background: none; }
.prose blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid var(--line2); color: var(--muted); }
.prose ul, .prose ol { padding-left: 22px; margin: 6px 0; }
.thread { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.comment { padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); }
.comment.staff { border-color: rgba(139,92,246,.3); } .comment.agent { border-color: rgba(34,211,238,.35); background: linear-gradient(180deg, rgba(34,211,238,.05), transparent); }
.comment-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.editor textarea { margin: 0; border-radius: 9px 9px 0 0; font-family: var(--mono); font-size: 13.5px; }
.editor textarea.drop { border-color: var(--cyan); }
.editor-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: var(--bg2); border: 1px solid var(--line2); border-top: 0; border-radius: 0 0 9px 9px; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 20px; }
.kcol { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); min-height: 300px; display: flex; flex-direction: column; }
.kcol header { padding: 12px 14px; font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.kcol.over { border-color: var(--cyan); }
.kcards { padding: 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.kcard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: grab; transition: transform .1s; }
.kcard:hover { border-color: var(--line2); } .kcard.dragging { opacity: .4; }
.kcard-title { font-weight: 500; font-size: 14px; }
.kcard a { display: inline-block; margin-top: 6px; }

/* Billing */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 10px; }
@media (max-width: 700px) { .stats { grid-template-columns: 1fr; } }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 26px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 12px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--bg2); }
.table tbody tr:last-child td { border-bottom: 0; } .table tfoot td { border-top: 1px solid var(--line2); border-bottom: 0; background: var(--bg2); }
.table td form { margin: 0; }
tr.muted td { color: var(--muted); }
.docs pre { font-size: 12px; }
