:root {
  --bg: #0a0d13;
  --panel: #121826;
  --panel-2: #182030;
  --panel-3: #1f2838;
  --border: #263042;
  --border-2: #324056;
  --text: #e7ebf3;
  --muted: #8a94a8;
  --muted-2: #5c6678;
  --red: #f0616d;
  --green: #2fb27c;
  --amber: #e7a90c;
  --blue: #5b8cff;
  --violet: #a78bfa;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 700px at 70% -10%, #131c2e 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }

/* ---- token gate ---- */
.gate { display: grid; place-items: center; height: 100vh; }
.gate-box {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; width: min(380px, 90vw); box-shadow: var(--shadow); text-align: center;
}
.gate-logo { font-weight: 800; letter-spacing: .18em; color: var(--text); font-size: 20px; }
.gate-box p { color: var(--muted); }
.gate-box input {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border-2); color: var(--text);
  border-radius: 9px; padding: 11px 12px; margin: 6px 0 12px;
}
.gate-box button {
  width: 100%; background: var(--blue); color: #06101f; border: 0; border-radius: 9px;
  padding: 11px; font-weight: 700;
}
.gate-box button:disabled { opacity: .4; cursor: not-allowed; }

/* ---- header ---- */
.hdr {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 18px; background: rgba(10,13,19,.72); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; letter-spacing: .16em; }
.brand .sub { color: var(--muted-2); font-weight: 600; letter-spacing: .08em; font-size: 11px; margin-left: 8px; text-transform: uppercase; }
.seg { display: flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button { background: transparent; border: 0; border-radius: 7px; padding: 6px 16px; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset; }
.meta { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pill { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px; }
.pill.needs { color: #2a0c0f; background: var(--red); border-color: var(--red); }
.dot-upd { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(47,178,124,.6); animation: ping 2.4s infinite; }
.ghost { background: transparent; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); padding: 5px 9px; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(47,178,124,.5);} 70%{ box-shadow: 0 0 0 7px rgba(47,178,124,0);} 100%{box-shadow:0 0 0 0 rgba(47,178,124,0);} }

/* ---- layout ---- */
main { padding: 18px; max-width: 1500px; margin: 0 auto; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 22px 4px 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.section-title .count { color: var(--muted-2); }

/* ---- hero: needs you ---- */
.hero { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.hero-empty { color: var(--muted-2); padding: 14px; border: 1px dashed var(--border); border-radius: var(--radius); }
.needs-card {
  background: linear-gradient(180deg, rgba(240,97,109,.10), var(--panel)); border: 1px solid rgba(240,97,109,.4);
  border-radius: var(--radius); padding: 14px; position: relative; overflow: hidden;
}
.needs-card::before { content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background: var(--red); }
.needs-card .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.needs-card .ttl { font-weight: 700; }
.needs-card .path { color: var(--muted); font-size: 12px; margin-top: 2px; word-break: break-all; }

/* ---- domain board ---- */
.domains { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.domain {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.domain > h2 {
  display: flex; align-items: center; gap: 9px; margin: 0; padding: 12px 14px;
  font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--text);
  border-bottom: 1px solid var(--border); background: var(--panel-2);
}
.domain > h2 .swatch { width: 9px; height: 9px; border-radius: 3px; }
.domain > h2 .n { margin-left: auto; color: var(--muted-2); font-size: 11px; letter-spacing: 0; }
.proj { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.proj:last-child { border-bottom: 0; }
.proj .ph { display: flex; align-items: center; gap: 8px; }
.proj .pname { font-weight: 700; font-size: 13px; }
.proj .add { margin-left: auto; background: transparent; border: 1px solid var(--border-2); color: var(--muted); border-radius: 7px; width: 22px; height: 22px; line-height: 1; padding: 0; }

/* ---- sessions ---- */
.sess { display: flex; gap: 9px; align-items: flex-start; margin: 9px 0 4px; padding: 8px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; }
.sess .badge { flex: none; }
.sess .body { min-width: 0; flex: 1; }
.sess .stitle { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess .meta-row { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 11px; margin-top: 2px; }
.prog { height: 4px; background: var(--panel-3); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.prog > i { display: block; height: 100%; background: var(--green); }

.badge { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 3px 7px; border-radius: 999px; }
.badge.needs-you { background: var(--red); color: #2a0c0f; }
.badge.working { background: rgba(47,178,124,.16); color: var(--green); border: 1px solid rgba(47,178,124,.4); }
.badge.working .live { display:inline-block; width:6px; height:6px; border-radius:50%; background: var(--green); margin-right: 4px; animation: ping 1.6s infinite; }
.badge.idle { background: var(--panel-3); color: var(--muted); }
.badge.lull { background: var(--panel-3); color: var(--amber); }
.badge.free { background: rgba(91,140,255,.14); color: var(--blue); border: 1px solid rgba(91,140,255,.35); }

/* ---- tasks ---- */
.task { display: flex; gap: 9px; align-items: center; padding: 5px 2px; }
.task .chk { flex: none; width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--border-2); background: transparent; padding: 0; display: grid; place-items: center; color: transparent; }
.task .chk.done { background: var(--green); border-color: var(--green); color: #06120c; }
.task .tt { flex: 1; min-width: 0; font-size: 13px; }
.task.s-done .tt { color: var(--muted-2); text-decoration: line-through; }
.task .stat { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 2px 6px; border-radius: 6px; }
.stat.next { background: rgba(91,140,255,.16); color: var(--blue); }
.stat.blocked { background: rgba(240,97,109,.16); color: var(--red); }
.stat.backlog { background: var(--panel-3); color: var(--muted); }
.stat.active { background: rgba(47,178,124,.16); color: var(--green); }
.task .del { opacity: 0; background: transparent; border: 0; color: var(--muted-2); padding: 0 4px; }
.task:hover .del { opacity: 1; }
.task .note { color: var(--muted-2); font-size: 11px; }
.addrow { display: flex; gap: 6px; margin-top: 6px; }
.addrow input { flex: 1; background: var(--panel-2); border: 1px solid var(--border-2); color: var(--text); border-radius: 8px; padding: 6px 9px; font-size: 13px; }
.addrow button { background: var(--blue); color: #06101f; border: 0; border-radius: 8px; padding: 0 12px; font-weight: 700; }

/* ---- map ---- */
.mapwrap { height: calc(100vh - 64px); width: 100%; }
.mapwrap svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.mapwrap svg:active { cursor: grabbing; }
.node-label { font-size: 11px; fill: var(--text); paint-order: stroke; stroke: var(--bg); stroke-width: 3px; }
.node-label.dim { fill: var(--muted); }
.link { stroke: var(--border-2); stroke-width: 1.2px; fill: none; }
.maphint { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); color: var(--muted-2); font-size: 12px; background: var(--panel); border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px; }
.pulse-r { animation: pr 1.6s ease-in-out infinite; }
@keyframes pr { 0%, 100% { opacity: .85; } 50% { opacity: .12; } }

.err { position: fixed; bottom: 14px; right: 14px; background: var(--red); color: #2a0c0f; padding: 8px 12px; border-radius: 9px; font-weight: 600; }

@media (max-width: 600px) {
  main { padding: 12px; }
  .hdr { gap: 10px; padding: 10px 12px; }
  .brand .sub { display: none; }
  .domains { grid-template-columns: 1fr; }
}
