/* Client space — generic dark dashboard, vanilla CSS, no framework */

:root {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-row: #1a1f29;
  --bg-hover: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-warn: #d29922;
  --accent-crit: #f85149;
  --accent-ok: #3fb950;
  --radius: 6px;
  --gap: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); font-size: 12px; }

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  gap: 12px;
}
.accent {
  width: 3px;
  height: 24px;
  background: linear-gradient(180deg, var(--accent) 0%, transparent 100%);
}
.logo {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.02em;
}
.meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.badge {
  padding: 3px 10px;
  background: var(--bg-row);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Tabs ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  padding: 0 20px;
  border-top: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  padding: 10px 16px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Content ─────────────────────────────────────────────── */
main {
  padding: 24px 20px;
  max-width: 1200px;
  margin: 0 auto;
}
.loading, .error {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}
.error { color: var(--accent-crit); }

.tab-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.tab-content h2 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
}
.tab-content .note {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-row);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  font-size: 12px;
  color: var(--text-muted);
}
.tab-content .source {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Backlog list ────────────────────────────────────────── */
.backlog-item {
  display: grid;
  grid-template-columns: 100px 80px 1fr;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-row);
  border-radius: 4px;
  margin-bottom: 6px;
  align-items: center;
}
.backlog-item:hover { background: var(--bg-hover); }
.backlog-item .id {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--accent);
}
.backlog-item .status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  text-align: center;
}
.status-ready { background: rgba(88, 166, 255, 0.15); color: var(--accent); }
.status-in_progress { background: rgba(210, 153, 34, 0.15); color: var(--accent-warn); }
.status-done, .status-resolved { background: rgba(63, 185, 80, 0.15); color: var(--accent-ok); }
.status-todo { background: rgba(139, 148, 158, 0.15); color: var(--text-muted); }

/* ── Credits table ───────────────────────────────────────── */
.credits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.credits-card {
  padding: 16px;
  background: var(--bg-row);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.credits-card .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.credits-card .value {
  font-size: 24px;
  font-weight: 600;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

/* ── Placeholder (Copilot) ───────────────────────────────── */
.placeholder {
  text-align: center;
  padding: 60px 20px;
}
.placeholder .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.placeholder .message {
  font-size: 16px;
  margin-bottom: 8px;
}
.placeholder .details {
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
}

/* ── Repo list ───────────────────────────────────────────── */
.repo-list .repo-row {
  padding: 12px;
  background: var(--bg-row);
  border-radius: 4px;
  margin-bottom: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
}
.repo-list .repo-row .stack {
  margin-left: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Project tab (Spec/Roadmap/Changelog) ────────────────── */
.project-section { margin-bottom: 24px; }
.project-section h3 {
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}
.spec-content {
  white-space: pre-wrap;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.6;
  background: var(--bg-row);
  padding: 12px;
  border-radius: 4px;
  max-height: 400px;
  overflow-y: auto;
}
.milestone {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-row);
  border-radius: 4px;
  margin-bottom: 4px;
}
.milestone .label {
  font-weight: 600;
  color: var(--accent);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.changelog-entry {
  padding: 8px 12px;
  background: var(--bg-row);
  border-radius: 4px;
  margin-bottom: 4px;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
}

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  padding: 20px;
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ── PRD link ────────────────────────────────────────────── */
.prd-link {
  display: block;
  padding: 12px;
  background: var(--bg-row);
  border-radius: 4px;
  margin-bottom: 6px;
  color: var(--text);
  text-decoration: none;
  border-left: 3px solid var(--accent);
}
.prd-link:hover { background: var(--bg-hover); }
.prd-link .title { font-weight: 500; margin-bottom: 4px; }
.prd-link .meta { font-size: 12px; color: var(--text-muted); }

/* ── Copilot floating button + modal (LEE-EXT-LUNOVA-COPILOT 2026-05-13) ── */

.copilot-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7e57c2 0%, #5e35b1 100%);
  color: white;
  font-size: 26px;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(94, 53, 177, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  z-index: 100;
}
.copilot-fab:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 28px rgba(94, 53, 177, 0.55);
}

.copilot-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 24px;
  z-index: 200;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.copilot-modal-card {
  width: 100%;
  max-width: 520px;
  height: min(680px, calc(100vh - 48px));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.copilot-modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(180deg, #1c2230 0%, var(--bg-card) 100%);
}
.copilot-modal-title { font-weight: 600; font-size: 15px; }
.copilot-modal-sub { font-size: 11px; }

.copilot-close {
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 24px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  border-radius: 4px;
  line-height: 1;
}
.copilot-close:hover { background: var(--bg-hover); color: var(--text); }

.copilot-thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.copilot-turn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-row);
}
.copilot-turn.role-user {
  background: rgba(126, 87, 194, 0.12);
  border-left: 3px solid #7e57c2;
}
.copilot-turn.role-assistant {
  background: var(--bg-row);
  border-left: 3px solid var(--accent);
}
.copilot-turn.placeholder { opacity: 0.6; font-style: italic; }
.copilot-role { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.copilot-text { font-size: 14px; line-height: 1.55; }
.copilot-text p { margin: 0 0 8px 0; }
.copilot-text p:last-child { margin-bottom: 0; }
.copilot-text code {
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}
.copilot-text pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  overflow-x: auto;
  margin: 6px 0;
}
.copilot-text pre code { background: transparent; padding: 0; }
.copilot-text h4 {
  font-size: 13px;
  font-weight: 600;
  margin: 8px 0 4px 0;
  color: var(--accent);
}
.copilot-text ul { padding-left: 20px; margin: 4px 0; }
.copilot-text li { margin-bottom: 2px; }
.copilot-meta { margin-top: 4px; font-size: 10px; opacity: 0.7; }

.copilot-form {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  background: var(--bg-card);
}
.copilot-input {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 56px;
}
.copilot-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.18);
}
.copilot-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 12px;
}
.copilot-send {
  background: #7e57c2;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  font-size: 13px;
}
.copilot-send:hover { background: #6a3fb5; }
.copilot-send:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 600px) {
  .copilot-modal { padding: 0; }
  .copilot-modal-card { height: 100vh; max-width: 100%; border-radius: 0; }
}
