:root {
  --bg: #0c0d0f;
  --surface: #141518;
  --surface-2: #1c1e22;
  --border: rgba(255,255,255,.08);
  --border-hover: rgba(255,255,255,.14);
  --text: #ededef;
  --text-2: #9ca3af;
  --text-3: #6b7280;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --green: #22c55e;
  --orange: #f59e0b;
  --red: #ef4444;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); -webkit-font-smoothing: antialiased;
}
.app { width: min(820px, 100%); margin: 0 auto; padding: 0 16px 48px; }

/* ── Header ── */
.header {
  padding: 20px 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--border);
}
.header h1 { font-size: 20px; font-weight: 600; letter-spacing: -.4px; margin: 0; }
.header-right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--text-2); }
.header-right strong { color: var(--text); }

/* ── Toolbar ── */
.toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 0; flex-wrap: wrap;
}
.search-wrap {
  flex: 1; min-width: 160px;
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); padding: 0 10px;
}
.search-wrap input {
  height: 34px; width: 100%;
  border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 13px;
}
.search-wrap input::placeholder { color: var(--text-3); }
.sort-btn {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text-2);
  height: 34px; padding: 0 10px; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
}
.sort-btn:hover { border-color: var(--border-hover); color: var(--text); }
.sort-btn.active { border-color: var(--accent); color: var(--accent-hover); }

.counter {
  font-size: 12px; color: var(--text-3);
  margin-left: auto; white-space: nowrap;
}

/* ── List ── */
.list { display: flex; flex-direction: column; gap: 2px; }
.item {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 12px; border-radius: 10px;
  cursor: pointer; transition: background .1s;
  border: 1px solid transparent;
}
.item:hover { background: var(--surface); border-color: var(--border); }

.item-idx { font-size: 12px; color: var(--text-3); font-family: var(--mono); min-width: 28px; text-align: right; }

.item-body { flex: 1; min-width: 0; }
.item-title { font-size: 14px; font-weight: 500; line-height: 1.35; }
.item-meta { margin-top: 3px; font-size: 12px; color: var(--text-3); display: flex; gap: 6px; flex-wrap: wrap; }

.item-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Badges ── */
.badge {
  font-size: 11px; font-weight: 500; padding: 3px 8px;
  border-radius: 999px; white-space: nowrap;
}
.badge-p0 { background: rgba(239,68,68,.15); color: #fca5a5; }
.badge-p1 { background: rgba(245,158,11,.15); color: #fde68a; }
.badge-p2 { background: rgba(99,102,241,.15); color: #a5b4fc; }
.badge-new { background: rgba(245,158,11,.10); color: #fde68a; }
.badge-proposal { background: rgba(99,102,241,.10); color: #a5b4fc; }
.badge-prototype { background: rgba(168,85,247,.10); color: #d8b4fe; }
.badge-done { background: rgba(34,197,94,.10); color: #86efac; }
.badge-module { background: rgba(255,255,255,.05); color: var(--text-3); }

.has-prototype::after {
  content: "◈"; margin-left: 4px; color: var(--accent-hover); font-size: 10px;
}

.empty {
  padding: 48px 0; text-align: center; color: var(--text-3); font-size: 14px;
}

/* ── Dialog ── */
dialog {
  width: min(760px, calc(100% - 24px));
  border: 1px solid var(--border); border-radius: 16px;
  padding: 0; background: #121316; color: var(--text);
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
}
dialog::backdrop { background: rgba(0,0,0,.65); }
.dialog-inner { padding: 24px; position: relative; }
.close {
  position: absolute; right: 14px; top: 14px;
  width: 32px; height: 32px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 18px; cursor: pointer;
  display: grid; place-items: center;
}
.close:hover { background: var(--surface-2); }

.detail-head { margin-bottom: 16px; }
.detail-title { font-size: 24px; font-weight: 600; letter-spacing: -.4px; margin: 0 36px 8px 0; }
.detail-meta { display: flex; gap: 8px; flex-wrap: wrap; }

.detail-desc { color: var(--text-2); line-height: 1.6; font-size: 14px; margin-bottom: 20px; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-box {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; background: rgba(255,255,255,.025);
}
.detail-box h3 { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.detail-box ul { margin: 0; padding-left: 16px; color: var(--text-2); line-height: 1.6; font-size: 13px; }
.detail-box li { margin-bottom: 4px; }

.prototype-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 16px; padding: 9px 14px;
  background: var(--accent); color: white; border-radius: 8px;
  text-decoration: none; font-size: 13px; font-weight: 500;
}
.prototype-btn:hover { background: var(--accent-hover); }

@media (max-width: 600px) {
  .detail-grid { grid-template-columns: 1fr; }
  .toolbar .sort-label { display: none; }
}
