:root {
  --bg: #0e1218;
  --bg2: #151b24;
  --panel: #1a2230;
  --line: #2a3548;
  --text: #e8eef7;
  --muted: #8b9bb3;
  --brand: #3d8bfd;
  --ok: #3dd68c;
  --danger: #ff6b6b;
  --warn: #f0c14a;
  --radius: 14px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --display: "Trebuchet MS", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1b2a44 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #142033 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
  background: rgba(14,18,24,.75); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.brand {
  font-family: var(--display);
  font-weight: 800; letter-spacing: .02em; font-size: 1.15rem;
  color: var(--text); text-decoration: none;
}
.brand span { color: var(--brand); }
.nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--muted); font-size: .95rem; }
.nav a.active, .nav a:hover { color: var(--text); text-decoration: none; }

h1, h2, h3 { font-family: var(--display); margin: 0 0 .5rem; }
h1 { font-size: 1.7rem; }
.muted { color: var(--muted); }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 260px; }

.panel {
  background: linear-gradient(180deg, #1c2535, var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.stat {
  min-width: 160px;
}
.stat .n { font-size: 1.8rem; font-weight: 800; }
.stat .l { color: var(--muted); font-size: .85rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=color], input[type=number], textarea, select {
  width: 100%;
  background: #0f1520;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 10px 14px;
  background: var(--brand); color: #fff; font-weight: 700; cursor: pointer;
  text-decoration: none; font: inherit;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary { background: #2a3548; color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.small { padding: 7px 10px; font-size: .85rem; }

.flash {
  padding: 12px 14px; border-radius: 10px; margin-bottom: 16px;
  border: 1px solid var(--line);
}
.flash.ok { background: rgba(61,214,140,.12); border-color: rgba(61,214,140,.35); }
.flash.error { background: rgba(255,107,107,.12); border-color: rgba(255,107,107,.35); }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line);
  vertical-align: middle; font-size: .95rem;
}
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

.badge {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  background: #243147; color: var(--muted); font-size: .75rem;
}
.swatch {
  width: 18px; height: 18px; border-radius: 50%; display: inline-block;
  border: 1px solid rgba(255,255,255,.25); vertical-align: middle;
}

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card { width: min(420px, 100%); }

.split {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
}

#viewer, #person-view, #public-canvas-wrap {
  width: 100%;
  height: 520px;
  background: #070a10;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  position: relative;
}
#person-view { height: 280px; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center;
}
.hint {
  font-size: .85rem; color: var(--muted); margin: 8px 0 0;
}

.public-shell {
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.public-header {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.public-header img {
  height: 40px; width: auto; max-width: 140px; object-fit: contain;
}
.public-header .cname {
  font-family: var(--display); font-weight: 800; font-size: 1.1rem;
}
.public-main { flex: 1; padding: 18px; }
.object-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  padding: 16px;
}
.object-card h3 { margin-bottom: 6px; }
.vr-bar {
  position: absolute; left: 12px; bottom: 12px; right: 12px;
  display: flex; gap: 8px; flex-wrap: wrap; z-index: 5;
}
.vp-list button.active { outline: 2px solid var(--brand); }

.footer-note {
  text-align: center; color: var(--muted); font-size: .8rem; padding: 20px;
}
code.inline {
  background: #0f1520; padding: 2px 6px; border-radius: 6px; font-size: .85rem;
}
