/* Synthetic design system — tokens + components (ADR 013). */

:root {
  color-scheme: dark;
  --bg: #07090f;
  --surface: #0d1117;
  --surface-2: #121a26;
  --border: #1f2937;
  --text: #e6edf3;
  --muted: #8b96a5;
  --accent: #7c5cff;
  --accent-2: #2dd4bf;
  --gradient: linear-gradient(120deg, #7c5cff 0%, #4f8dff 55%, #2dd4bf 100%);
  --success: #3fb950;
  --warn: #d29922;
  --danger: #f85149;
  --radius: 14px;
  --font: ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0 0 .4em; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: clamp(34px, 5.4vw, 62px); font-weight: 800; }
h2 { font-size: clamp(24px, 3.4vw, 36px); font-weight: 750; }
h3 { font-size: 17px; font-weight: 650; }
p { margin: 0 0 1em; }
a { color: var(--accent-2); text-decoration: none; }
.muted { color: var(--muted); }
.grad-text {
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px; border: 1px solid transparent;
  font: 600 15px var(--font); cursor: pointer; color: var(--text);
  background: var(--surface-2); transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn-primary {
  background: var(--gradient); color: #060810;
  box-shadow: 0 8px 30px rgba(124, 92, 255, .35);
}
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }

/* cards & chips */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.card-hover { transition: border-color .2s, transform .2s; cursor: pointer; }
.card-hover:hover { border-color: var(--accent); transform: translateY(-2px); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); color: var(--muted); background: var(--surface-2);
}
.chip-on { color: var(--accent-2); border-color: rgba(45, 212, 191, .4); }
.chip-soon { color: var(--warn); border-color: rgba(210, 153, 34, .35); }
.chip-err { color: var(--danger); border-color: rgba(248, 81, 73, .4); }

/* forms */
.input, .select, textarea.input {
  width: 100%; padding: 11px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: 15px var(--font); outline: none;
}
.input:focus { border-color: var(--accent); }
label.field { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
label.field > span { display: block; margin-bottom: 6px; font-weight: 600; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

/* layout */
.container { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

/* app shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidenav {
  border-right: 1px solid var(--border); padding: 22px 14px;
  display: flex; flex-direction: column; gap: 4px; background: var(--surface);
  position: sticky; top: 0; height: 100vh;
}
.sidenav .brand { font-weight: 800; font-size: 17px; padding: 4px 12px 18px; }
.sidenav a.nav-item {
  padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 600;
}
.sidenav a.nav-item.active, .sidenav a.nav-item:hover {
  color: var(--text); background: var(--surface-2);
}
.view { padding: 34px 38px; }

/* avatar stage */
.stage {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(ellipse 70% 60% at 50% 35%, #131c2e 0%, #07090f 75%);
  border: 1px solid var(--border);
}
.stage canvas { display: block; width: 100%; height: 100%; }
.stage .stage-tag {
  position: absolute; left: 14px; bottom: 12px; font-size: 12px;
  color: var(--muted); font-family: var(--mono);
}

/* chat */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px; }
.bubble {
  max-width: 78%; padding: 11px 15px; border-radius: 16px; font-size: 14.5px;
}
.bubble.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.bubble.twin { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.bubble .meta { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.chat-input { display: flex; gap: 10px; padding-top: 14px; }

/* wizard */
.wizard-progress { display: flex; gap: 6px; margin-bottom: 26px; }
.wizard-progress i { flex: 1; height: 4px; border-radius: 4px; background: var(--surface-2); }
.wizard-progress i.done { background: var(--gradient); }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3, 5, 9, .72);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal { width: min(520px, 92vw); box-shadow: var(--shadow); }

/* dimension meter */
.dim { margin-bottom: 10px; }
.dim .dim-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.dim .dim-bar { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.dim .dim-bar > i { display: block; height: 100%; background: var(--gradient); }

/* misc */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 60;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow);
}
.spin {
  width: 16px; height: 16px; border-radius: 50%; display: inline-block;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite; vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }
code, .mono { font-family: var(--mono); font-size: 13px; }
pre.code {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; overflow-x: auto; font-size: 12.5px;
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidenav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .view { padding: 22px 18px; }
}
