:root {
  --bg: #0d0f14;
  --panel: #161a23;
  --panel-2: #1d2230;
  --line: #2a3040;
  --text: #e6e9ef;
  --muted: #8b93a7;
  --accent: #7c5cff;
  --accent-2: #38e2b0;
  --danger: #ff5c72;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #1a1030 0%, var(--bg) 55%);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }
h1 { font-size: 30px; margin: 6px 0 14px; letter-spacing: -0.02em; }
h2 { font-size: 19px; margin: 34px 0 14px; letter-spacing: -0.01em; }
h3 { font-size: 15px; margin: 0 0 10px; }
.muted { color: var(--muted); }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: rgba(13,15,20,0.75); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.03em; }
.brand span { color: var(--accent-2); }
.topbar nav { display: flex; gap: 16px; }
.topbar nav a { color: var(--muted); font-weight: 500; }
.topbar nav a:hover { color: var(--text); }
.spacer { flex: 1; }
.auth { display: flex; align-items: center; gap: 12px; }
.who { color: var(--muted); font-size: 13px; }

.btn {
  display: inline-block; background: var(--accent); color: #fff; border: 0;
  padding: 9px 15px; border-radius: 10px; font-weight: 600; font-size: 14px; cursor: pointer;
}
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.danger, .mini.danger { color: var(--danger); }
.btn.ghost.danger { border-color: rgba(255,92,114,0.4); }

.hero { padding: 26px 0 10px; }
.hero h1 { font-size: 34px; max-width: 760px; }
.hero p { color: var(--muted); max-width: 640px; font-size: 16px; }

.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.crumbs a:hover { color: var(--text); }

/* grids */
.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.previews { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; transition: transform .12s, border-color .12s;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.model-name { font-weight: 700; font-size: 17px; margin-bottom: 8px; }
.stat b { font-size: 22px; }
.stat span { color: var(--muted); margin-left: 6px; font-size: 13px; }

/* previews (iframe thumbnails) */
.preview { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.preview a, .frameholder { position: relative; display: block; }
.preview iframe {
  width: 200%; height: 440px; border: 0; transform: scale(.5); transform-origin: top left;
  margin-bottom: -220px; pointer-events: none; background: #fff;
}
.preview .scrim { position: absolute; inset: 0; }
.preview figcaption {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  padding: 10px 12px; border-top: 1px solid var(--line); font-size: 13px;
}
.preview .placeholder {
  height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--muted); background: var(--panel-2);
}
.err { padding: 8px 12px; color: var(--danger); font-size: 12px; border-top: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--line);
}
.pill.done { color: var(--accent-2); border-color: rgba(56,226,176,.4); }
.pill.running, .pill.pending { color: #ffd479; border-color: rgba(255,212,121,.4); }
.pill.error { color: var(--danger); border-color: rgba(255,92,114,.4); }
.pill.vision { color: var(--accent-2); border-color: rgba(56,226,176,.4); }
.pill.workaround { color: #ffb454; border-color: rgba(255,180,84,.45); }
label.checkbox { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
details.imgdesc { margin-top: 14px; }
details.imgdesc summary { cursor: pointer; color: var(--muted); }
details.imgdesc[open] summary { margin-bottom: 10px; color: var(--text); }

/* lists / tables */
.list { display: flex; flex-direction: column; }
.row { display: flex; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 8px; background: var(--panel); }
.row:hover { border-color: var(--accent); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; padding: 8px 10px; }
.tbl td { padding: 10px; border-top: 1px solid var(--line); }
.tbl tr.off td { opacity: .5; }
.nowrap { white-space: nowrap; }

/* panels / forms */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input, textarea, select {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 9px 11px; font: inherit; font-size: 14px;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; }
.inline { display: inline; }
.rowbtns { display: flex; gap: 10px; }

.case-head { display: grid; grid-template-columns: 1fr 300px; gap: 22px; align-items: start; }
.brief { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  white-space: pre-wrap; font: inherit; color: var(--text); max-height: 320px; overflow: auto; }
.thumbs { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.thumbs img { height: 84px; border-radius: 8px; border: 1px solid var(--line); }
.launch { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.checks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.checks label { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.launch .danger { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.modellist { list-style: none; padding: 0; margin: 0 0 14px; }
.modellist li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.modellist li.off { opacity: .5; }
.modellist em { color: var(--muted); font-style: normal; font-size: 12px; }

.run-actions { display: flex; gap: 6px; }
.mini { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 7px;
  width: 26px; height: 26px; cursor: pointer; font-size: 13px; }
.mini:hover { border-color: var(--accent); }

/* run detail stage */
.run-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.run-meta { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
.stage { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.stage iframe { width: 100%; height: 78vh; border: 0; display: block; }
.panel.err pre { white-space: pre-wrap; color: var(--danger); }

.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; display: inline-block; animation: spin 0.8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

footer { text-align: center; color: var(--muted); font-size: 13px; padding: 30px; border-top: 1px solid var(--line); }

@media (max-width: 820px) {
  .split, .case-head { grid-template-columns: 1fr; }
}
