/* Shared shell for every page behind the landing page: top bar + collapsible sidebar. */
:root {
  --bg: #141919; --panel: #1a2121; --raised: #222b2b; --line: #2a3535;
  --text: #ffffff; --dim: #8fa0a0; --cyan: #19d3f3; --green: #3ddc84; --red: #ff6b6b;
  --side: 248px; --top: 56px;
  --sans: Montserrat, "Avenir Next", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; padding-top: var(--top); background: var(--bg); color: var(--text);
  font: 16px/1.6 var(--sans); -webkit-text-size-adjust: 100%;
  transition: padding-left .2s ease;
}
body.no-anim, body.no-anim .side { transition: none; }

/* top bar */
.top {
  position: fixed; inset: 0 0 auto 0; height: var(--top); z-index: 30;
  display: flex; align-items: center; gap: 6px; padding: 0 8px;
  background: var(--bg); border-bottom: 1px solid var(--line); font-family: var(--sans);
}
.menu-btn {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; padding: 0;
  background: none; border: 0; border-radius: 8px; color: var(--text); cursor: pointer;
}
.menu-btn:hover { background: var(--raised); }
.menu-btn svg { width: 22px; height: 22px; }
.brand {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding-right: 8px;
  color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .1em; font-size: 15px;
}
.brand img { width: 32px; height: 32px; border-radius: 7px; display: block; }

/* buttons + account control */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1px solid transparent; background: #fff; color: #141919; cursor: pointer;
  font: 600 14px/1.2 var(--sans); text-decoration: none; white-space: nowrap;
}
.btn[hidden] { display: none; }
.btn:hover { background: #dfe8e8; }
.btn.ghost { background: none; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--raised); }
.acct { margin-left: auto; display: flex; align-items: center; }
.acct-btn { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; background: none; border: 0; border-radius: 50%; cursor: pointer; }
.face {
  position: relative; width: 34px; height: 34px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--green)); color: #141919; font: 700 15px/1 var(--sans);
}
.face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.acct-menu {
  position: fixed; top: calc(var(--top) - 2px); right: 8px; z-index: 40; width: min(260px, calc(100vw - 16px));
  display: grid; gap: 4px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45); font-family: var(--sans);
}
.acct-menu[hidden] { display: none; }
.acct-menu small { color: var(--dim); font-size: 12px; }
.acct-menu strong { overflow-wrap: anywhere; }
.acct-menu .btn { margin-top: 10px; }
@media (max-width: 420px) {
  .top .btn { padding: 0 12px; font-size: 13px; }
  /* signed out on a narrow phone: show the icon only, leaving room for the sign-in button */
  .top:has(.acct a.btn) .brand { font-size: 0; gap: 0; padding-right: 0; min-width: 44px; justify-content: center; }
}

/* sidebar */
.side {
  position: fixed; top: var(--top); bottom: 0; left: 0; width: min(var(--side), 84vw); z-index: 20;
  padding: 12px 10px 24px; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line);
  font-family: var(--sans); transform: translateX(-100%); visibility: hidden;
  transition: transform .2s ease, visibility .2s;
}
body.side-open .side { transform: none; visibility: visible; }
.side h2 { margin: 18px 12px 6px; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.side a {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 15px;
}
.side a:hover { background: var(--raised); }
.side a[aria-current="page"] { background: var(--raised); color: var(--green); font-weight: 600; }
.side-row { display: flex; align-items: center; gap: 2px; }
.side-row a { flex: 1; min-width: 0; }
.side-note { margin: 14px 12px 0; font-size: 12px; line-height: 1.5; color: var(--dim); }
.side-note.warn { color: #ffcf8a; }
.side-note[hidden] { display: none; }

/* owner-only visibility switch: 44px tap target around a small track */
.switch { position: relative; flex: none; width: 52px; height: 44px; padding: 0; background: none; border: 0; border-radius: 8px; cursor: pointer; }
.switch::before { content: ""; position: absolute; left: 8px; top: 12px; width: 36px; height: 20px; border-radius: 999px; background: #3a4646; transition: background .15s; }
.switch::after { content: ""; position: absolute; left: 10px; top: 14px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch[aria-checked="true"]::before { background: var(--green); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }
.switch:disabled { opacity: .6; cursor: default; }
.switch.failed::before { background: var(--red); }
.backdrop { display: none; }

/* wide screens: sidebar pushes the page; narrow screens: it slides over the page */
@media (min-width: 900px) {
  body.side-open { padding-left: var(--side); }
}
@media (max-width: 899px) {
  body.side-open .backdrop { display: block; position: fixed; inset: var(--top) 0 0 0; z-index: 10; background: rgba(0, 0, 0, .55); }
}

/* page content */
.page { max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; }
.page h1 { margin: 0 0 12px; font-size: clamp(28px, 6vw, 40px); line-height: 1.15; letter-spacing: -.01em; }
.page h2 { margin: 40px 0 12px; font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.page p { margin: 0 0 14px; color: #d5dddd; overflow-wrap: anywhere; }
.grad { background: linear-gradient(90deg, var(--cyan), var(--green)); -webkit-background-clip: text; background-clip: text; color: transparent; }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { body, .side, .switch::before, .switch::after { transition: none; } }
