:root {
  --bg: #09090b;
  --surface: #18181b;
  --surface2: #1f1f23;
  --border: #27272a;
  --text: #fafafa;
  --text-muted: #71717a;
  --accent: #f59e0b;
  --accent-dim: #451a03;
  --accent-hover: #fcd34d;
  --green: #4ade80;
  --green-dim: rgba(74,222,128,0.12);
  --red: #f87171;
  --red-dim: rgba(248,113,113,0.12);
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Header ── */
header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(9,9,11,0.85);
  backdrop-filter: blur(12px);
}
.header-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.logo svg { width: 26px; height: 26px; color: var(--accent); }
.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.15s;
}
.back-btn:hover { color: var(--text); }
.back-btn svg { width: 18px; height: 18px; }

/* ── Layout ── */
main { max-width: 1000px; margin: 0 auto; padding: 2.5rem 1.5rem; }

/* ── Buttons ── */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-approve {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green);
  flex: 1;
  justify-content: center;
  font-size: 1.05rem;
}
.btn-approve:hover:not(:disabled) { background: rgba(74,222,128,0.2); }
.btn-reject {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid var(--red);
  flex: 1;
  justify-content: center;
  font-size: 1.05rem;
}
.btn-reject:hover:not(:disabled) { background: rgba(248,113,113,0.2); }
.btn-primary {
  background: var(--accent);
  color: #000;
  font-weight: 700;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid transparent;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}
.btn-danger:hover { border-color: var(--red); background: var(--red-dim); }
.btn-implement {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent);
  font-size: 1rem;
  font-weight: 700;
}
.btn-implement:hover:not(:disabled) { background: rgba(245,158,11,0.2); }

/* ── Spinner ── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Idea Generator Card ── */
.generator-section {
  margin-bottom: 3rem;
}
.generator-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.idea-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s;
}
.idea-card.loading {
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-muted);
}
.idea-card.loading .spinner { color: var(--accent); width: 24px; height: 24px; }

.idea-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}
.idea-summary {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 1.25rem;
  flex: 1;
}
.idea-meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}
.idea-meta-row { display: flex; gap: 0.5rem; }
.idea-meta-label { color: var(--text-muted); min-width: 7rem; flex-shrink: 0; }
.idea-meta-value { color: var(--text); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}
.tag {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
}
.type-badge {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.35);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
}

.action-row {
  display: flex;
  gap: 0.75rem;
}

.shortcut-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  opacity: 0.7;
}
kbd {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-size: 0.7rem;
  font-family: monospace;
}

/* ── Vault (saved ideas list) ── */
.vault-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.vault-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.vault-count {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
}

.ideas-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.vault-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: border-color 0.15s;
  text-decoration: none;
  color: inherit;
}
.vault-card:hover { border-color: var(--accent); color: inherit; }
.vault-card-body { flex: 1; min-width: 0; }
.vault-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vault-card-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vault-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status-approved { background: rgba(245,158,11,0.12); color: var(--accent); border: 1px solid rgba(245,158,11,0.3); }
.status-implemented { background: var(--green-dim); color: var(--green); border: 1px solid rgba(74,222,128,0.3); }
.vault-card-date { font-size: 0.78rem; color: var(--text-muted); }

.empty-vault {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── Idea detail page ── */
.idea-detail-header {
  margin-bottom: 2rem;
}
.idea-detail-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}
.idea-detail-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.meta-sep { opacity: 0.3; }

.detail-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.detail-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.detail-section-content { color: var(--text); line-height: 1.7; }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* ── PRD section ── */
.prd-section { margin-top: 2rem; }
.prd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.prd-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.prd-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  line-height: 1.75;
  min-height: 200px;
}
.prd-body h2 { font-size: 1.3rem; margin: 0 0 0.75rem; color: var(--accent-hover); }
.prd-body h3 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }
.prd-body p { margin: 0 0 0.9rem; color: var(--text); }
.prd-body ul, .prd-body ol { padding-left: 1.5rem; margin: 0 0 0.9rem; color: var(--text); }
.prd-body li { margin-bottom: 0.3rem; }
.prd-body strong { color: var(--text); }
.prd-body code { background: var(--surface2); padding: 0.1em 0.4em; border-radius: 4px; font-size: 0.875em; color: var(--accent-hover); }
.prd-body blockquote { border-left: 3px solid var(--accent); padding-left: 1rem; color: var(--text-muted); margin: 1rem 0; font-style: italic; }
.prd-placeholder { color: var(--text-muted); text-align: center; padding: 2rem; }

.implement-success {
  background: var(--green-dim);
  border: 1px solid rgba(74,222,128,0.3);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-top: 1rem;
  display: none;
}
.implement-success.visible { display: block; }
.implement-success-title { font-weight: 700; color: var(--green); margin-bottom: 0.4rem; }
.implement-success-path { font-family: 'Courier New', monospace; font-size: 0.875rem; color: var(--text-muted); word-break: break-all; }

/* ── Streaming cursor ── */
.cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: middle;
  animation: blink 0.8s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── Responsive ── */
@media (max-width: 640px) {
  .detail-grid { grid-template-columns: 1fr; }
  .action-row { flex-direction: column; }
  .idea-title { font-size: 1.3rem; }
  main { padding: 1.5rem 1rem; }
}
