/* memoryspace.dev — dark modern UI, GitHub + Figma hybrid */

:root {
  --bg:        #0a0a0f;
  --bg-1:      #0d1117;
  --bg-2:      #161b22;
  --bg-3:      #1c2128;
  --border:    #30363d;
  --border-2:  #21262d;
  --text:      #e6edf3;
  --text-dim:  #9198a1;
  --text-mute: #6e7681;
  --accent:    #7c5cff;     /* memoryspace purple */
  --accent-2:  #58a6ff;     /* link blue */
  --green:     #3fb950;
  --yellow:    #d29922;
  --red:       #f85149;
  --orange:    #ff7b72;
  --grad:      linear-gradient(135deg, #7c5cff 0%, #58a6ff 50%, #3fb950 100%);
  --shadow:    0 8px 32px rgba(0,0,0,.4);
  --radius:    10px;
  --mono:      "JetBrains Mono", "SF Mono", Menlo, monospace;
  --sans:      -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text",
               "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 12px; }

/* ── top nav ─────────────────────────────────────────────────────────── */
.topnav {
  display: flex; align-items: center;
  gap: 20px;
  padding: 12px 24px;
  background: rgba(13, 17, 23, .85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand .logo {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--grad);
  display: grid; place-items: center;
  color: white; font-weight: 900;
  font-family: var(--mono);
  box-shadow: 0 0 20px rgba(124, 92, 255, .5);
}
.topnav .grow { flex: 1; }
.topnav .navlink {
  color: var(--text-dim);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
}
.topnav .navlink:hover { background: var(--bg-2); color: var(--text); text-decoration: none; }
.topnav .btn { margin-left: 8px; }

/* ── buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .12s;
}
.btn:hover { background: var(--bg-3); border-color: #484f58; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn-primary:hover { background: #6f4ef5; border-color: #6f4ef5; }
.btn-success {
  background: var(--green); border-color: var(--green); color: #0d1117;
}
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── landing ─────────────────────────────────────────────────────────── */
.landing {
  min-height: calc(100vh - 52px);
  display: grid; place-items: center;
  padding: 60px 24px;
  position: relative;
  overflow: hidden;
}
.landing::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(124,92,255,.18), transparent 70%),
    radial-gradient(ellipse 40% 30% at 80% 60%, rgba(88,166,255,.12), transparent 70%),
    radial-gradient(ellipse 40% 30% at 20% 80%, rgba(63,185,80,.10), transparent 70%);
  pointer-events: none;
}
.landing-inner { position: relative; max-width: 1100px; text-align: center; }
.tagline {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 28px;
  font-family: var(--mono);
}
.tagline .dot { color: var(--green); }
h1.hero {
  font-size: clamp(40px, 6vw, 72px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 24px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h1.hero .small { display: block; font-size: 0.42em; font-weight: 500; color: var(--text-dim); -webkit-text-fill-color: var(--text-dim); margin-top: 18px; letter-spacing: 0; }
.lead {
  font-size: 20px;
  color: var(--text-dim);
  max-width: 720px;
  margin: 0 auto 40px;
}
.cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.cta-row .btn { padding: 12px 22px; font-size: 14px; }

.features {
  margin-top: 80px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  text-align: left;
}
.feature {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.feature h3 {
  margin: 0 0 8px;
  font-size: 15px;
  display: flex; align-items: center; gap: 8px;
}
.feature .icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(124, 92, 255, .12);
  color: var(--accent);
  display: grid; place-items: center;
  font-size: 16px;
}
.feature p { margin: 0; color: var(--text-dim); font-size: 13px; }

/* ── dashboard / home ────────────────────────────────────────────────── */
.dashboard {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
}
.sidecol {
  display: flex; flex-direction: column; gap: 16px;
}
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card h4 {
  margin: 0 0 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
}

.maincol h2 {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 600;
}
.repo-grid { display: grid; gap: 12px; }
.repo-row {
  display: block;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: all .15s;
}
.repo-row:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}
.repo-row .title {
  font-size: 16px; font-weight: 600;
  color: var(--accent-2);
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
}
.repo-row .tag-pill {
  font-size: 10px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.repo-row p { margin: 0 0 12px; color: var(--text-dim); font-size: 13px; }
.repo-row .meta {
  display: flex; gap: 18px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-mute);
}
.repo-row .meta span { display: inline-flex; align-items: center; gap: 5px; }
.swatch {
  display: inline-block;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
}

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  color: var(--text-mute);
}
.empty code {
  display: inline-block;
  background: var(--bg-2);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text);
  border: 1px solid var(--border);
}

/* ── repo view ───────────────────────────────────────────────────────── */
.repo-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
}
.repo-header-inner {
  max-width: 1680px;
  margin: 0 auto;
  padding: 20px 24px 0;
}
.repo-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px;
}
.repo-title .owner { color: var(--accent-2); text-decoration: none; }
.repo-title .owner:hover { text-decoration: underline; }
.repo-title .sep { color: var(--text-mute); }
.repo-title .name { font-weight: 700; color: var(--accent-2); text-decoration: none; }
.repo-title .name:hover { text-decoration: underline; }
.repo-desc {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 13px;
}
.repo-tabs {
  display: flex;
  gap: 4px;
  margin-top: 18px;
  overflow-x: auto;
}
.repo-tab {
  padding: 10px 14px;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.repo-tab:hover { color: var(--text); text-decoration: none; }
.repo-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 500;
}
.repo-tab .count {
  display: inline-block;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--text-dim);
}

/* ── three-pane repo layout: sidebar | CANVAS | sidebar ─────────────── */
.repo-body {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: 0;
  height: calc(100vh - 170px);
  min-height: 600px;
}
.pane {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 18px;
  background: var(--bg-1);
}
.pane.right { border-right: none; border-left: 1px solid var(--border); }

.pane h5 {
  margin: 0 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
}
.pane .branch-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  margin-bottom: 12px;
}
.pane .branch-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

.commit-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-2);
  font-size: 12px;
}
.commit-row:last-child { border-bottom: none; }
.commit-row .msg {
  color: var(--text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.commit-row .meta {
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 10px;
  display: flex; gap: 8px;
}
.commit-row .hash {
  color: var(--yellow);
}

/* center canvas: Figma-style with floating toolbar */
.canvas {
  position: relative;
  background:
    radial-gradient(ellipse at center, rgba(124,92,255,.05), transparent 70%),
    #08090f;
  overflow: hidden;
}
.canvas iframe {
  width: 100%; height: 100%;
  border: none;
  display: block;
}
.canvas-overlay {
  position: absolute;
  top: 14px; left: 14px;
  display: flex; gap: 8px;
  z-index: 20;
}
.canvas-overlay .chip {
  background: rgba(22, 27, 34, .9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.canvas-overlay .chip.pulse .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.canvas-loading {
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
  pointer-events: none;
}

/* right pane: activity / agents */
.agent-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border-2);
}
.agent-row:last-child { border-bottom: none; }
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--grad);
  display: grid; place-items: center;
  color: white; font-weight: 600; font-size: 11px;
  flex-shrink: 0;
}
.agent-row .who { font-weight: 500; color: var(--text); }
.agent-row .sub { color: var(--text-mute); font-size: 11px; }

/* ── issues / pulls / insights / settings ───────────────────────────── */
.tab-body {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px;
}
.tab-body h2 { margin: 0 0 20px; font-size: 22px; }

.issue-card, .pr-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 10px;
}
.issue-card .title, .pr-card .title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.issue-card .meta, .pr-card .meta {
  font-size: 12px;
  color: var(--text-mute);
  display: flex; gap: 12px;
}
.state-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.state-pill.open { background: rgba(63,185,80,.15); color: var(--green); }
.state-pill.closed { background: rgba(248,81,73,.15); color: var(--red); }

.form-row { margin-bottom: 12px; }
.form-row label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
input[type=text], textarea {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
input[type=text]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, .12);
}
textarea { min-height: 100px; resize: vertical; }

.insights-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.stat .num { font-size: 28px; font-weight: 700; color: var(--text); }
.stat .lbl { font-size: 12px; color: var(--text-mute); margin-top: 4px; }

.bar-list .bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 50px;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
}
.bar-list .bar-row .label { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-list .bar-row .bar {
  height: 8px;
  background: var(--bg-2);
  border-radius: 4px;
  overflow: hidden;
}
.bar-list .bar-row .fill {
  height: 100%;
  background: var(--grad);
  border-radius: 4px;
}
.bar-list .bar-row .count { text-align: right; color: var(--text); font-family: var(--mono); }

/* ── toast ───────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 1000;
  display: none;
}
.toast.show { display: block; animation: slideup .3s ease; }
@keyframes slideup {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 1100px) {
  .repo-body { grid-template-columns: 240px 1fr; }
  .pane.right { display: none; }
  .dashboard { grid-template-columns: 1fr; }
  .insights-grid { grid-template-columns: repeat(2, 1fr); }
}

/* -- auth pages ----------------------------------------------------------- */
.auth-page {
  display: flex; justify-content: center; align-items: center;
  min-height: calc(100vh - 52px); padding: 40px 16px;
}
.auth-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 36px 32px; width: 100%;
  max-width: 400px; box-shadow: var(--shadow);
}
.auth-card h2 {
  margin: 0 0 24px; font-size: 22px; text-align: center;
}
.auth-card label {
  display: block; font-size: 13px; color: var(--text-dim);
  margin-bottom: 6px; margin-top: 14px;
}
.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
  width: 100%; padding: 10px 12px; font-size: 14px;
  background: var(--bg-1); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  outline: none; transition: border-color .15s;
}
.auth-card input:focus {
  border-color: var(--accent);
}
.auth-error {
  background: rgba(248, 81, 73, 0.12); border: 1px solid var(--red);
  color: var(--red); border-radius: 6px; padding: 10px 14px;
  font-size: 13px; margin-bottom: 8px;
}
.auth-switch {
  text-align: center; margin-top: 20px; font-size: 13px;
  color: var(--text-dim);
}
.auth-switch a { color: var(--accent); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
