:root {
  --bg: #07080f;
  --bg-2: #0d0f1c;
  --panel: rgba(20, 23, 40, 0.72);
  --panel-solid: #14172a;
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.16);
  --text: #eef1fb;
  --muted: #9aa2c0;
  --faint: #656d8c;
  --accent: #6c8cff;
  --accent-2: #b16cff;
  --good: #35d399;
  --warn: #ffbf47;
  --bad: #ff6b81;
  --radius: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#bg-aurora {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(60% 50% at 15% 0%, rgba(108, 140, 255, 0.18), transparent 70%),
    radial-gradient(55% 45% at 90% 10%, rgba(177, 108, 255, 0.16), transparent 70%),
    radial-gradient(50% 50% at 50% 100%, rgba(53, 211, 153, 0.08), transparent 70%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}

.hidden { display: none !important; }
.grad-text {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px;
  background: rgba(7, 8, 15, 0.72);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: baseline; gap: 8px; cursor: pointer; user-select: none; }
.brand-mark { color: var(--accent); font-size: 20px; transform: translateY(2px); }
.brand-name { font-family: "Space Grotesk", sans-serif; font-weight: 700; letter-spacing: 3px; font-size: 20px; }
.brand-sub { color: var(--faint); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav-link {
  background: none; border: none; color: var(--muted); font: inherit; font-weight: 500;
  padding: 8px 14px; border-radius: 10px; cursor: pointer; transition: all .15s;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-link.active { color: var(--text); background: rgba(108,140,255,0.16); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.search input {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  color: var(--text); padding: 9px 14px; border-radius: 11px; width: 220px; font: inherit;
  transition: border .15s, width .2s;
}
.search input:focus { outline: none; border-color: var(--accent); width: 260px; }

/* ---------- auth slot ---------- */
.user-pill { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; color: #fff; font-size: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.user-pill .uname { font-weight: 600; font-size: 14px; }
.user-pill .urole { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 11px;
  padding: 10px 16px; border: 1px solid var(--border-bright);
  background: rgba(255,255,255,0.06); color: var(--text); transition: all .15s;
}
.btn:hover { background: rgba(255,255,255,0.12); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  border: none; color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(108,140,255,0.35);
}
.btn.primary:hover { box-shadow: 0 10px 30px rgba(108,140,255,0.5); }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(255,107,129,.08); border-color: rgba(255,107,129,.35); color: #ffc2cb; }
.btn.danger:hover { background: rgba(255,107,129,.16); }
.btn.confirming { border-color: var(--warn); color: var(--warn); background: rgba(255,191,71,.12); }
.btn.good { background: linear-gradient(120deg, #1f9d6b, var(--good)); border: none; color: #04150f; }
.btn.wide { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- hero ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 32px 28px 80px; }
.hero {
  position: relative; display: flex; align-items: center;
  padding: 46px 44px; margin-bottom: 36px;
  border: 1px solid var(--border); border-radius: 26px;
  background: linear-gradient(120deg, rgba(108,140,255,0.10), rgba(177,108,255,0.06));
  overflow: hidden;
}
.hero-copy { max-width: 640px; z-index: 1; }
.hero h1 { font-family: "Space Grotesk", sans-serif; font-size: 42px; line-height: 1.05; margin: 0 0 14px; }
.hero p { color: var(--muted); font-size: 16px; line-height: 1.6; margin: 0 0 24px; max-width: 520px; }
.hero-stats { display: flex; gap: 36px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 24px; font-family: "Space Grotesk", sans-serif; }
.hero-stats span { color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.hero-glow {
  position: absolute; right: -120px; top: -80px; width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(177,108,255,0.5), transparent 60%);
  filter: blur(40px);
}
.hero.sealed-market { min-height: 340px; background: linear-gradient(120deg, #172037, #261a39); }
.hero.sealed-market .hero-copy { max-width: 56%; }
.hero.sealed-market h1 { max-width: 520px; }
#market-device-cta { margin: 0 0 24px; }
.market-visual { position: absolute; right: 0; top: 0; width: 46%; height: 100%; object-fit: cover;
  mask-image: linear-gradient(90deg, transparent, #000 22%); opacity: .85; }
.hero.sealed-market .hero-glow { right: -220px; opacity: .45; }

/* ---------- filters ---------- */
.filters { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  padding: 7px 14px; border-radius: 999px; color: var(--muted);
  border: 1px solid var(--border); background: rgba(255,255,255,0.03); transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--border-bright); }
.chip.active { color: #fff; background: rgba(108,140,255,0.22); border-color: rgba(108,140,255,0.5); }
.price-toggle { display: flex; gap: 6px; }

/* ---------- grid ---------- */
.grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.store-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border-bright);
  border-radius: var(--radius); background: var(--panel); transition: transform .18s, box-shadow .18s, border-color .18s; }
.store-card:hover { transform: translateY(-3px); border-color: rgba(162,177,255,.65); box-shadow: var(--shadow); }
.store-card-open { all: unset; display: block; flex: 1; cursor: pointer; color: var(--text); }
.store-card-open:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.store-card-open img { display: block; width: 100%; aspect-ratio: 9 / 5; object-fit: cover; }
.store-card-content { display: grid; gap: 9px; padding: 18px 19px 16px; }
.store-card-content strong { font: 700 22px "Space Grotesk", sans-serif; }
.store-card-content > span:not(.card-cat) { min-height: 42px; color: var(--muted); line-height: 1.45; font-size: 14px; }
.store-card-content small { color: var(--faint); font-size: 12px; }
.store-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 19px; padding: 14px 0 19px; border-top: 1px solid var(--border); }
.store-card-foot .btn { min-width: 92px; padding: 9px 12px; }
.store-state { color: var(--muted); font-size: 12px; }
.store-state.available { color: var(--good); }
.card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); backdrop-filter: blur(12px);
  overflow: hidden; cursor: pointer; transition: transform .18s, border-color .18s, box-shadow .18s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-bright); box-shadow: var(--shadow); }
.card-poster {
  height: 150px; position: relative; display: grid; place-items: center; overflow: hidden;
}
.card-poster img { width: 100%; height: 100%; object-fit: cover; }
.poster-gen { width: 100%; height: 100%; display: grid; place-items: center; position: relative; }
.poster-gen .glyph { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 40px; color: rgba(255,255,255,0.92); letter-spacing: 1px; z-index: 1; text-shadow: 0 2px 20px rgba(0,0,0,.4); }
.poster-gen::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 70% 20%, rgba(255,255,255,0.22), transparent 55%); }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-cat { font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--faint); font-weight: 600; }
.card-name { font-size: 17px; font-weight: 700; }
.card-tag { color: var(--muted); font-size: 13px; line-height: 1.45; flex: 1; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.card-vendor { font-size: 12px; color: var(--faint); }
.price-pill { font-weight: 700; font-size: 14px; padding: 5px 11px; border-radius: 999px; }
.price-pill.free { color: var(--good); background: rgba(53,211,153,0.14); }
.price-pill.paid { color: var(--text); background: rgba(255,255,255,0.08); }
.owned-badge { font-size: 11px; font-weight: 700; color: var(--good); background: rgba(53,211,153,0.14); padding: 4px 9px; border-radius: 999px; letter-spacing: .5px; }
.empty { text-align: center; color: var(--faint); padding: 60px; }

/* ---------- drawer / detail ---------- */
.scrim { position: fixed; inset: 0; background: rgba(2,3,8,0.66); backdrop-filter: blur(3px); z-index: 50; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 100vw); z-index: 60;
  background: var(--panel-solid); border-left: 1px solid var(--border);
  box-shadow: var(--shadow); overflow-y: auto; animation: slidein .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
.drawer-close { position: absolute; top: 16px; right: 16px; z-index: 5; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-bright); background: rgba(0,0,0,0.4); color: #fff; cursor: pointer; font-size: 15px; }
.drawer-close:hover { background: rgba(0,0,0,0.7); }

.gallery { position: relative; height: 280px; background: #000; }
.gallery .slide { position: absolute; inset: 0; opacity: 0; transition: opacity .35s; }
.gallery .slide.active { opacity: 1; }
.gallery .slide img, .gallery .slide video { width: 100%; height: 100%; object-fit: cover; }
.gallery .poster-gen .glyph { font-size: 64px; }
.gallery-nav { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 7px; z-index: 3; }
.gallery-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.35); border: none; cursor: pointer; }
.gallery-dot.active { background: #fff; width: 22px; border-radius: 4px; }
.gallery-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(0,0,0,0.45); color: #fff; font-size: 20px; cursor: pointer; }
.gallery-arrow:hover { background: rgba(0,0,0,0.75); }
.gallery-arrow.left { left: 12px; } .gallery-arrow.right { right: 12px; }

.detail-body { padding: 24px 26px 40px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.detail-cat { font-size: 12px; text-transform: uppercase; letter-spacing: 1.4px; font-weight: 600; }
.detail-title { font-family: "Space Grotesk", sans-serif; font-size: 28px; font-weight: 700; margin: 4px 0 2px; }
.detail-vendor { color: var(--muted); font-size: 14px; }
.detail-price { text-align: right; }
.detail-price .amt { font-size: 26px; font-weight: 800; font-family: "Space Grotesk", sans-serif; }
.detail-meta { display: flex; gap: 18px; margin: 18px 0; flex-wrap: wrap; }
.meta-item { font-size: 13px; color: var(--muted); }
.meta-item b { color: var(--text); font-weight: 600; }
.detail-desc { color: #c9cfe6; line-height: 1.7; font-size: 15px; margin: 8px 0 20px; }
.features { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; }
.features li { display: flex; gap: 10px; align-items: flex-start; color: #d6dbf0; font-size: 14px; }
.features li::before { content: "✓"; color: var(--good); font-weight: 800; }
.detail-actions { display: flex; flex-direction: column; gap: 12px; }
.action-note { font-size: 13px; color: var(--faint); line-height: 1.5; }
.serial-row { display: flex; gap: 8px; }
.serial-row select, .serial-row input { flex: 1; background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text); padding: 10px 12px; border-radius: 10px; font: inherit; }
.status-line { font-size: 13px; padding: 10px 12px; border-radius: 10px; }
.status-line.ok { color: var(--good); background: rgba(53,211,153,0.12); }
.status-line.err { color: var(--bad); background: rgba(255,107,129,0.12); }

/* ---------- library ---------- */
.section-title { font-family: "Space Grotesk", sans-serif; font-size: 28px; margin: 6px 0 24px; }
.companion-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.companion-title-row .section-title { margin: 6px 0 0; }
.companion-presence { border: 1px solid var(--border-bright); border-radius: 999px; padding: 7px 11px;
  color: var(--muted); background: var(--bg-2); font-size: 12px; font-weight: 700; }
.companion-presence::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px;
  border-radius: 50%; background: var(--muted); vertical-align: 1px; }
.companion-presence.online { color: var(--good); border-color: rgba(91,202,156,.35); }
.companion-presence.online::before { background: var(--good); }
.sub { color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: 1px; margin: 0 0 14px; }
.gate { text-align: center; padding: 60px 20px; border: 1px dashed var(--border-bright); border-radius: var(--radius); color: var(--muted); }
.gate p { margin-bottom: 18px; }
.lib-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.owned-list, .device-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.lib-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.lib-item .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); }
.lib-item .dot.revoked, .lib-item .dot.expired { background: var(--bad); }
.lib-item .li-main { flex: 1; }
.lib-item .li-title { font-weight: 600; font-size: 14px; }
.lib-item .li-sub { color: var(--faint); font-size: 12px; }
.device-form { display: flex; flex-direction: column; gap: 10px; }
.device-form input { background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text); padding: 10px 12px; border-radius: 10px; font: inherit; }
.hint { color: var(--faint); font-size: 12px; line-height: 1.5; margin-top: 12px; }
.hint code, code { background: rgba(255,255,255,0.08); padding: 1px 6px; border-radius: 5px; font-size: 12px; }

/* ---------- supervised install review ---------- */
.admin-heading, .request-heading, .request-actions { display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.admin-heading { margin-bottom: 24px; }
.admin-heading .section-title { margin-bottom: 8px; }
.admin-requests { display: grid; gap: 20px; }
.install-request { padding: 24px; border: 1px solid var(--border-bright); border-radius: var(--radius); background: var(--panel); }
.request-heading h3 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.request-status, .simulation-label { background: rgba(108,140,255,.15); border-radius: 6px; padding: 5px 9px; font-size: 13px; }
.simulation-label { margin-left: 12px; color: var(--warn); }
.scan-clear { color: var(--good); }
.scan-finding { color: var(--warn); }
.install-request details { margin: 18px 0; }
.install-request pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 240px; overflow-y: auto; color: var(--muted); }
.webcam-check { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0; line-height: 1.5; }
.webcam-check input { margin-top: 5px; }
.review-reason { display: grid; gap: 8px; color: var(--muted); font-size: 14px; }
.review-reason textarea { resize: vertical; font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--border-bright); border-radius: 8px; padding: 12px; }
.request-actions { justify-content: flex-start; margin-top: 16px; }
.pair-code-form { max-width: 580px; margin-top: 24px; display: grid; gap: 10px; }
#pair-code { text-transform: uppercase; letter-spacing: 2px; }
#pair-review { margin: 20px 0; }
button:disabled { opacity: .55; cursor: wait; }

/* ---------- companion setup and device controls ---------- */
.release-access { margin: 20px 0 24px; }
.release-access.linked { padding: 16px 20px; }
.release-access.linked .btn { padding: 8px 12px; }
.release-access > summary { cursor: pointer; font-weight: 600; }
.release-access .release-summary { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 10px; }
.release-access[open] > summary { margin-bottom: 8px; }
.release-access .action-note, #view-companion .action-note { color: var(--muted); }
.release-access #sealed-status { margin: 8px 0 0; }
#companion-intro:empty { display: none; }
.release-access h3, .connect-step h3, .companion-heading h3 { margin: 0; font-size: 18px; }
.release-access > .action-note { margin-bottom: 8px; }
#sealed-form { max-width: 700px; margin-top: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
#sealed-form label, #companion-list .request-actions label { display: grid; gap: 7px; min-width: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
#sealed-form input, #companion-list .request-actions select {
  width: 100%; min-width: 0; min-height: 42px; padding: 9px 12px;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--border-bright);
  border-radius: 10px; font: inherit; color-scheme: dark;
}
#sealed-form input:focus, #companion-list .request-actions select:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
#sealed-form button { grid-column: 1 / -1; justify-self: start; }
.connect-panel { margin: 22px 0; border: 1px solid var(--border-bright); border-radius: 12px; padding: 14px 18px; }
.connect-panel > summary { cursor: pointer; font-weight: 600; }
.connect-step { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin: 10px 0; }
.connect-step .action-note { margin: 6px 0 0; }
.connect-step .btn { flex-shrink: 0; }
.manual-pairing { margin: 8px 0 20px; color: var(--muted); font-size: 13px; }
.manual-pairing .pair-code-form { margin-top: 14px; }
#pair-status:empty { display: none; }
#pair-status:not(:empty) {
  margin: 2px 0 24px; padding: 12px 15px;
  border: 1px solid var(--border-bright); border-radius: 10px;
  background: var(--bg-2); color: var(--text);
}
#pair-status:not(:empty)::before {
  content: "Connection status"; display: block; margin-bottom: 3px;
  color: var(--muted); font-size: 11px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
}
.companion-heading { margin-top: 30px; margin-bottom: 14px; }
#companion-list .install-request { min-width: 0; }
#companion-list .request-actions { gap: 10px; align-items: end; }
#companion-list .request-actions label { flex: 1 1 250px; max-width: 360px; }
#companion-list .request-actions .btn { min-height: 42px; }
#companion-list .installed-actions label { flex-basis: 100%; max-width: none; }
#companion-list .device-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
#companion-list .device-section h4 { margin: 0 0 12px; font-size: 15px; }
#companion-list .release-picker > summary { cursor: pointer; color: var(--text); font-size: 15px; font-weight: 600; }
#companion-list .release-picker[open] > summary { margin-bottom: 12px; }
#companion-list .device-section .request-actions { margin-top: 10px; }
#companion-list .device-main-actions { margin-top: 18px; }
#companion-list .device-activity { margin: 12px 0 18px; padding: 12px 15px; border: 1px solid var(--border);
  border-radius: 10px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 13px; }
#companion-list .device-activity.busy { border-color: rgba(108,140,255,.55); background: rgba(108,140,255,.09); }
#companion-list .device-activity.failed { border-color: rgba(255,107,129,.45); background: rgba(255,107,129,.07); }
#companion-list .device-activity-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#companion-list .device-activity strong { color: var(--text); }
#companion-list .device-activity p { margin: 9px 0 0; }
#companion-list .device-activity details { margin: 9px 0 0; }
#companion-list .device-activity pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.job-dock { position: fixed; right: 18px; bottom: 18px; z-index: 45; display: flex; align-items: center;
  gap: 12px; max-width: min(520px, calc(100vw - 36px)); padding: 10px 12px; border: 1px solid rgba(126,156,255,.7);
  border-radius: 14px; background: #1b2541; box-shadow: 0 15px 45px rgba(0,0,0,.55); font-size: 13px; }
.job-dock strong { flex: 1; font-weight: 600; }
.job-dock .btn { padding: 7px 10px; }
.job-dock-pulse { width: 11px; height: 11px; flex-shrink: 0; border-radius: 50%; background: #8aa4ff;
  box-shadow: 0 0 0 5px rgba(138,164,255,.15); animation: job-pulse 1.3s ease-in-out infinite; }
@keyframes job-pulse { 50% { opacity: .45; transform: scale(.75); } }
#companion-list .scan-finding { padding: 10px 12px; background: rgba(255,191,71,.1); border: 1px solid rgba(255,191,71,.25); border-radius: 8px; }
.help-tip { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-left: 4px; color: var(--muted); cursor: help; font-size: 14px; vertical-align: middle; }
.help-tip:focus { outline: 2px solid var(--accent); border-radius: 50%; }
#companion-list .request-feedback:empty { display: none; }
.previous-connections { color: var(--muted); }
.previous-connections summary { cursor: pointer; padding: 10px 0; }
.previous-connection-list { display: grid; gap: 16px; margin-top: 10px; }
.history-device { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.history-device summary { display: flex; justify-content: space-between; gap: 12px; color: var(--text); cursor: pointer; }
.history-device summary span { color: var(--muted); font-size: 12px; }
.history-device ul { list-style: none; margin: 12px 0 0; padding: 0; }
.history-device li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0;
  border-top: 1px solid var(--border); font-size: 12px; }
.history-device time { color: var(--faint); text-align: right; }
#view-market .empty strong { display: block; color: var(--text); font-size: 18px; }
#view-market .empty p { margin: 10px auto 18px; max-width: 520px; line-height: 1.5; }
@media (max-width: 620px) {
  #sealed-form { grid-template-columns: 1fr; }
  .connect-step { align-items: start; }
  .connect-step .btn { width: 100%; }
  #companion-list .request-actions label { flex-basis: 100%; max-width: none; }
  .job-dock { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* ---------- modal ---------- */
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 60;
  width: min(420px, 92vw); background: var(--panel-solid); border: 1px solid var(--border-bright);
  border-radius: 20px; padding: 32px; box-shadow: var(--shadow); animation: pop .22s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes pop { from { transform: translate(-50%, -46%) scale(.96); opacity: 0; } }
.modal h2 { margin: 0 0 6px; font-family: "Space Grotesk", sans-serif; }
.modal-sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; }
#auth-form, .modal label { display: flex; flex-direction: column; gap: 6px; }
.modal label { margin-bottom: 14px; font-size: 13px; color: var(--muted); font-weight: 500; }
.modal input { background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text); padding: 11px 13px; border-radius: 10px; font: inherit; }
.modal input:focus { outline: none; border-color: var(--accent); }
.form-error { color: var(--bad); font-size: 13px; background: rgba(255,107,129,0.1); padding: 9px 12px; border-radius: 9px; margin-bottom: 12px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 13px 18px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--border-bright); box-shadow: var(--shadow); font-size: 14px; font-weight: 500; animation: toastin .25s; max-width: 340px; }
.toast.ok { border-left: 3px solid var(--good); }
.toast.err { border-left: 3px solid var(--bad); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes toastin { from { transform: translateX(30px); opacity: 0; } }

.registered-plugin-controls { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }
.registered-plugin-controls:empty { display: none; }
.registered-plugin-controls h4 { margin: 0 0 12px; font-size: 15px; }
.registered-plugin-controls pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.control-readings { margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.control-readings summary { cursor: pointer; }
.install-timeline { padding: 12px 0; }
.installer-banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 28px; background: #23281c; color: #e4ebc8; border-bottom: 1px solid #68724c; }
.installer-screen { position: fixed; inset: 0; z-index: 70; overflow: auto; background: radial-gradient(ellipse at 80% 0%, #212b48, transparent 60%), #080c14; }
.installer-shell { max-width: 1240px; margin: auto; padding: 30px 40px 50px; }
.installer-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.installer-brand { color: #a4bbff; font: 700 13px "Space Grotesk", sans-serif; letter-spacing: .16em; }
.installer-screen h1 { font: 700 clamp(28px, 4vw, 46px) "Space Grotesk", sans-serif; margin: 10px 0; letter-spacing: -.04em; }
.installer-current { color: #b4c5ed; margin-bottom: 24px; }
.installer-status { padding: 9px 14px; border: 1px solid #597fc0; border-radius: 8px; color: #b4d5ff; font: 600 12px monospace; letter-spacing: .1em; }
.installer-meter { background: #121b2d; border: 1px solid #2d3a55; border-radius: 12px; padding: 18px 22px; margin-bottom: 24px; }
.installer-meter span { color: #9aa9c4; font-size: 13px; }
.installer-meter progress { display: block; width: 100%; height: 10px; margin-top: 14px; accent-color: #7f9fff; border: none; border-radius: 8px; overflow: hidden; }
.installer-meter progress::-webkit-progress-bar { background: #26324b; }
.installer-meter progress::-webkit-progress-value { background: linear-gradient(90deg, #6487f5, #a69aff); transition: width .4s; }
.installer-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 24px; }
.installer-terminal { background: #050c10; color: #b6e1d0; border: 1px solid #24433c; border-radius: 14px; padding: 22px; font: 12px/1.7 Consolas, monospace; min-width: 0; }
.installer-terminal-heading { display: flex; justify-content: space-between; color: #76ac9a; letter-spacing: .08em; font-size: 10px; }
.installer-live-dot { color: #55dda3; }
.installer-glyph-label { color: #536f66; font-size: 9px; margin-top: 16px; }
.installer-glyphs { color: #67c9a6; overflow: hidden; white-space: pre; margin: 24px 0 12px; user-select: none; min-height: 330px; line-height: 1.8; text-shadow: 0 0 12px #3cf4a52b; font-size: clamp(10px, 1.1vw, 13px); }
.installer-terminal .install-phase-list { gap: 9px; padding-left: 20px; }
.installer-terminal .install-phase-list [data-phase-state="waiting"] { color: #607e73; }
.installer-terminal .install-phase-list [data-phase-state="active"] { color: #a3c5ff; }
.installer-terminal h3 { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; border-top: 1px solid #1b312a; padding-top: 20px; margin-top: 24px; }
.installer-log { max-height: 190px; overflow: auto; color: #90afa3; }
.installer-log p { margin: 3px 0; overflow-wrap: anywhere; }
.installer-safety { padding: 22px; background: #171e2b; border: 1px solid #35405a; border-radius: 14px; align-self: start; }
.installer-safety-symbol { font-size: 42px; color: #b4c6ff; line-height: 1; }
.installer-safety h2 { font: 600 22px "Space Grotesk", sans-serif; }
.installer-safety p { color: #bcc5d8; line-height: 1.65; font-size: 14px; }
.installer-safety .installer-safety-message { border-left: 2px solid #ffbf47; padding-left: 12px; color: #f2d9a7; }
.installer-screen[data-install-state="ready"] .installer-status { color: #66e4ae; border-color: #388765; }
.installer-screen[data-install-state="ready"] .installer-safety-message { border-color: #35d399; color: #a6eace; }
.installer-screen[data-install-state="interrupted"] .installer-status { color: #ffb1bf; border-color: #a5596a; }
@media (max-width: 820px) {
  .installer-shell { padding: 22px 18px; }
  .installer-grid { grid-template-columns: 1fr; }
  .installer-heading { gap: 12px; flex-wrap: wrap; }
  .installer-banner { padding: 12px 18px; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .installer-meter progress::-webkit-progress-value { transition: none; } }
.install-timeline pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.site-alert { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 18px; margin-bottom: 24px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--panel-solid); color: var(--text); }
.site-footer { padding: 8px 24px 24px; color: var(--muted); font-size: 12px; }
.download-status { color: var(--muted); font-size: 13px; }
.install-phase-list { display: grid; gap: 8px; padding-left: 24px; }
.install-phase-list [data-phase-state="active"] { color: var(--accent); font-weight: 700; }
.install-phase-list [data-phase-state="completed"] { color: var(--good); }
.install-phase-list [data-phase-state="failed"], .install-phase-list [data-phase-state="blocked"] { color: var(--bad); }
.plugin-control-form { display: grid; gap: 10px; padding: 14px 0; border-top: 1px solid var(--border); }
.plugin-control-form label { display: grid; gap: 6px; }
.plugin-control-form input:not([type="checkbox"]), .plugin-control-form select, .plugin-control-form textarea {
  width: 100%; max-width: 440px; padding: 9px; color: var(--text); background: var(--panel-solid);
  border: 1px solid var(--border); border-radius: 6px;
}
.plugin-control-form button { justify-self: start; }

@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .topbar-right { margin-left: auto; }
  .nav { order: 3; width: 100%; overflow-x: auto; flex-shrink: 0; }
  .nav-link { white-space: nowrap; }
}

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
  .nav { order: 3; width: 100%; }
  .search input { width: 140px; }
  .search input:focus { width: 160px; }
  main { padding: 20px 16px 60px; }
  .hero { padding: 28px 22px; }
  .hero h1 { font-size: 30px; }
  .hero-glow { display: none; }
  .hero.sealed-market .hero-copy { max-width: 100%; }
  .market-visual { display: none; }
  .lib-cols { grid-template-columns: 1fr; gap: 24px; }
}
