:root {
  --bg: #070b14;
  --panel: #101826;
  --line: #1c2940;
  --text: #f4f7fb;
  --muted: #9aa8bd;
  --accent: #1c69d4;
  --accent-2: #3b82f6;
  --danger: #ef6b6b;
  --ok: #5bd08a;
  --mono: "Cascadia Mono", "Consolas", monospace;
  --sans: Inter, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; height: 100%; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 16px/1.5 var(--sans); }
body:not(.in-panel) {
  height: 100vh; overflow: hidden;
  display: flex; flex-direction: column;
}
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); color: var(--accent-2); }
.nav {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 12px 28px; background: rgba(7,11,20,.88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 900; letter-spacing: .04em; font-size: 20px; justify-self: start; }
.brand span { color: var(--accent); }
.brand em { font-style: normal; margin-left: 8px; color: var(--muted); font-weight: 700; font-size: 12px; letter-spacing: .18em; }
.nav-dl { justify-self: center; padding: 10px 22px; }
.nav-links { display: flex; gap: 18px; align-items: center; color: var(--muted); font-size: 14px; justify-self: end; }
.nav-links .phone { color: var(--text); font-weight: 700; }
.hero {
  position: relative;
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 1fr minmax(280px, 420px);
  gap: 36px; align-items: center; padding: 48px 28px 48px;
  background:
    linear-gradient(90deg, rgba(7,11,20,.92) 12%, rgba(7,11,20,.35) 55%, rgba(7,11,20,.55) 100%),
    url("/static/brand/hero.jpg") center/cover no-repeat;
}
.hero-copy { max-width: 720px; }
.hero-login { max-width: 460px; z-index: 5; }
.hero-login h2 { margin-bottom: 14px; }
.hero-login .gate-card { max-width: none; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; color: var(--accent-2); font-size: 11px; font-weight: 700; margin: 0 0 10px; }
h1 { margin: 0 0 12px; font-size: clamp(42px, 7vw, 72px); font-weight: 900; letter-spacing: .02em; }
h1 span { color: var(--accent); }
h2 { margin: 0 0 18px; font-size: 28px; }
h3 { margin: 8px 0; }
.lead { color: #d5deeb; font-size: 18px; max-width: 540px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 22px 0 16px; }
.pills { color: var(--muted); font-size: 14px; }
.btn, button {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-weight: 750; border: 0; border-radius: 10px;
  padding: 12px 18px; cursor: pointer; font: inherit;
}
.btn.ghost, button[type="button"] { background: #243041; color: var(--text); }
button:disabled { opacity: .4; cursor: not-allowed; }
.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.stats-row div { background: #0b1220; padding: 22px; }
.stats-row b { display: block; font-size: 28px; color: var(--accent-2); }
.stats-row span { color: var(--muted); font-size: 13px; }
.wrap { padding: 56px 28px; max-width: 1120px; margin: 0 auto; }
.grid3, .grid2 { display: grid; gap: 16px; }
.grid3 { grid-template-columns: repeat(3, 1fr); }
.grid2 { grid-template-columns: repeat(2, 1fr); }
.public-dl { max-width: 520px; }
.grid3 article, .dl, .card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px;
}
.step { color: var(--accent); font-weight: 800; letter-spacing: .12em; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
[hidden] { display: none !important; }
.perm-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.perm { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.perm input { width: auto; accent-color: var(--accent); }
form.user-create { display: grid; gap: 10px; width: 100%; }
.user-row { align-items: start; }
.gate-card { max-width: 460px; }
form, .inline { display: flex; gap: 8px; flex-wrap: wrap; }
input, select, textarea {
  background: #0b1220; color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font: inherit;
}
header { display: flex; justify-content: space-between; gap: 16px; align-items: end; padding: 28px 28px 8px; }
.header-side { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
main { display: grid; gap: 16px; padding: 16px 28px 40px; }
.shell { display: grid; grid-template-columns: 240px 1fr; height: 100%; min-height: 0; }
.side {
  background: #0b1220; border-right: 1px solid var(--line);
  padding: 22px 14px; display: flex; flex-direction: column; gap: 10px;
}
.side-brand { font-weight: 900; letter-spacing: .04em; }
.side-brand span { color: var(--accent); }
.side-brand em { font-style: normal; color: var(--muted); font-size: 12px; letter-spacing: .16em; margin-left: 6px; }
.side-who { font-size: 13px; margin: 0 0 8px; }
.side-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.side-nav button {
  width: 100%; justify-content: flex-start; background: transparent;
  color: var(--muted); border: 1px solid transparent; text-align: left;
}
.side-nav button:hover { background: #162033; color: var(--text); }
.side-nav button.active { background: var(--accent); color: #fff; }
.shell-main { min-width: 0; min-height: 0; overflow: auto; }
.view { display: grid; gap: 16px; }
.view[hidden] { display: none !important; }
#logout-btn { margin-top: auto; background: #243041; }
.row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.gate-card form { flex-direction: column; }
.gate-card input, .gate-card button { width: 100%; }
button.danger { color: var(--danger); border-color: #5a2a2a; }
.editor { display: grid; gap: 8px; }
.editor h3 { margin: 16px 0 4px; font-size: 16px; }
.editor input, .editor textarea { width: 100%; }
.editor textarea { min-height: 72px; resize: vertical; }
.editor-grid { display: grid; grid-template-columns: 120px 1fr; gap: 8px; }
.editor-bar {
  position: sticky; top: 0; z-index: 4;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--panel); padding: 4px 0 12px; margin: 0 0 4px;
  border-bottom: 1px solid var(--line);
}
.editor-bar-end { position: static; border-bottom: 0; border-top: 1px solid var(--line); padding: 12px 0 0; margin: 8px 0 0; }
.editor-bar button[type="submit"] { width: max-content; margin: 0; }
.editor-bar p { margin: 0; }
.pill { background: #0b1220; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.table { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; background: #0b1220; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.item .actions { justify-content: flex-end; }
body.join-body {
  min-height: 100vh; height: auto; overflow: auto; display: grid; place-items: center; padding: 24px;
  background:
    linear-gradient(90deg, rgba(7,11,20,.92) 12%, rgba(7,11,20,.45) 100%),
    url("/static/brand/hero.jpg") center/cover no-repeat;
}
.join-card { max-width: 460px; width: 100%; display: grid; gap: 12px; }
.join-card h1 { font-size: 32px; margin: 0; }
#join-box { display: grid; justify-items: center; gap: 0; }
#join-box[hidden] { display: none !important; }
#join-dl { justify-self: center; min-width: 220px; }
.join-token {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center;
  width: 100%; margin-top: 22px;
  background: #0b1220; border: 1px solid var(--line); border-radius: 12px; padding: 12px;
}
.join-token b { font-family: var(--mono); letter-spacing: .12em; font-size: 22px; }
#join-label { justify-self: center; margin-top: 8px; text-align: center; }
.item b { font-family: var(--mono); letter-spacing: .08em; }
.tag { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.console {
  margin: 12px 0 0; background: #05080e; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; min-height: 180px; white-space: pre-wrap; font: 13px/1.5 var(--mono); color: #c9d6e8;
}
.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
footer {
  display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 36px 28px; border-top: 1px solid var(--line); color: var(--muted);
}
@media (max-width: 900px) {
  .grid3, .grid2, .stats-row { grid-template-columns: 1fr 1fr; }
  .hero { grid-template-columns: 1fr; }
  .nav-links a:not(.phone) { display: none; }
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side-nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
  .side-nav button { width: auto; }
}
@media (max-width: 640px) {
  .grid3, .grid2, .stats-row { grid-template-columns: 1fr; }
}
body:not(.in-panel) #how,
body:not(.in-panel) #download,
body:not(.in-panel) footer { display: none; }
body.in-panel .nav,
body.in-panel .hero,
body.in-panel .stats-row,
body.in-panel #how,
body.in-panel #download,
body.in-panel #panel,
body.in-panel footer { display: none; }
body.in-panel { display: block; overflow: hidden; height: 100vh; }
body.in-panel #app { height: 100vh; }
