/* ============================================================
   Dezined AI — styles
   Lightweight Webflow-style catalog UI
   ============================================================ */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e5e8ee;
  --border-strong: #d3d8e0;
  --text: #14171f;
  --muted: #6b7280;
  --faint: #9aa1ad;
  --accent: #4f46e5;
  --accent-2: #7c6cf6;
  --accent-soft: #eef0ff;
  --danger: #e1483a;
  --ok: #18a957;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(20, 23, 31, .06), 0 1px 3px rgba(20, 23, 31, .05);
  --shadow-md: 0 6px 20px rgba(20, 23, 31, .10);
  --shadow-lg: 0 24px 60px rgba(20, 23, 31, .22);
  --font: "Inter", -apple-system, "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --topbar-h: 60px;
  --topbar-bg: rgba(255, 255, 255, .85);
  --preview-bg: #eceef3;
}

/* Dark theme: override the tokens; the rest of the UI follows automatically */
html[data-theme="dark"] {
  --bg: #09090a;
  --surface: #141416;
  --surface-2: #1c1c1f;
  --border: #262629;
  --border-strong: #37373c;
  --text: #ededee;
  --muted: #9c9ca3;
  --faint: #69696f;
  --accent: #8b7dff;
  --accent-2: #a99cff;
  --accent-soft: #1f1c2b;
  --danger: #f06a5d;
  --ok: #34d399;
  --topbar-bg: rgba(9, 9, 10, .8);
  --preview-bg: #050506;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, .55);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .65);
}
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] .team-role.dev { background: #122a1e; color: #34d399; }html[data-theme="dark"] .login-error { background: #2a1613; border-color: #46201a; color: #f0857a; }
html[data-theme="dark"] #favBtn.on { background: rgba(245, 179, 1, .12); border-color: rgba(245, 179, 1, .4); }
html[data-theme="dark"] .search:focus-within { border-color: var(--accent); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); font-weight: 400; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .05s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-color: transparent; color: #fff;
  box-shadow: 0 1px 2px rgba(79,70,229,.4), 0 4px 14px rgba(79,70,229,.25);
}
.btn.primary:hover { filter: brightness(1.05); background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.btn.danger:hover { background: #fdf4f3; }
.btn.block { width: 100%; justify-content: center; }
.btn.xs { padding: 5px 10px; font-size: 12px; }
.btn .ic { width: 15px; height: 15px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: var(--topbar-bg);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(140deg, var(--accent-2), var(--accent));
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px;
  box-shadow: 0 2px 8px rgba(79,70,229,.4);
}
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
.brand-ai { color: var(--accent); }
.search {
  flex: 1; max-width: 520px;
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 10px; padding: 8px 12px;
  color: var(--faint);
  transition: border-color .12s, background .12s;
}
.search:focus-within { background: var(--surface); border-color: var(--accent); }
.search input { border: 0; background: transparent; outline: none; flex: 1; font-size: 14px; color: var(--text); font-family: inherit; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(140deg, #2dd4bf, #4f46e5);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; cursor: pointer;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .ic { width: 19px; height: 19px; }
/* Hamburger: only shown on mobile (see responsive section) */
.menu-btn { display: none; margin-left: -4px; }

/* Mobile sidebar backdrop — invisible/inert until the drawer opens */
.nav-scrim {
  position: fixed; inset: 0; z-index: 38;
  background: rgba(8, 8, 10, .45);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}

/* ---------- Shell: persistent sidebar + swappable main ---------- */
.shell { display: grid; grid-template-columns: var(--nav-w, 248px) 1fr; }
.main { min-width: 0; }
.view { min-height: calc(100vh - var(--topbar-h)); }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 18px 14px;
}
.nav-group { margin-bottom: 22px; }
.nav-group h4 {
  margin: 0 0 8px 8px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--faint);
}
.nav-item {
  width: 100%; text-align: left;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
  font-size: 13.5px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .count { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--faint); }
.nav-item.active .count { color: var(--accent); }
.ico { width: 16px; height: 16px; border-radius: 4px; background: currentColor; opacity: .85; flex: none; -webkit-mask-size: contain; mask-size: contain; }
.ico.lib   { -webkit-mask: var(--m-lib); mask: var(--m-lib); }
.ico.star  { -webkit-mask: var(--m-star); mask: var(--m-star); }
.ico.clock { -webkit-mask: var(--m-clock); mask: var(--m-clock); }
.ico.coll  { -webkit-mask: var(--m-coll); mask: var(--m-coll); }
:root {
  --m-lib: no-repeat center/contain url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></svg>');
  --m-star: no-repeat center/contain url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><polygon points="12,2 15,9 22,9 16.5,13.5 18.5,21 12,16.5 5.5,21 7.5,13.5 2,9 9,9"/></svg>');
  --m-clock: no-repeat center/contain url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" fill="none" stroke="black" stroke-width="2"/><path d="M12 7v5l3 2" fill="none" stroke="black" stroke-width="2"/></svg>');
  --m-coll: no-repeat center/contain url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 7h6l2 2h10v10H3z"/></svg>');
}
.tagcloud { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--border-strong); border-radius: 20px;
  padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--surface); cursor: pointer; user-select: none;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.static { cursor: default; }
.chip.static:hover { border-color: var(--border-strong); color: var(--muted); }

/* ---------- Content / page head ---------- */
.content { padding: 24px 28px 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.page-head h1 { margin: 0; font-size: 23px; letter-spacing: -.02em; }
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.view-toggle { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.vt { border: 0; background: transparent; padding: 7px 10px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.vt + .vt { border-left: 1px solid var(--border); }
.vt.active { background: var(--accent-soft); color: var(--accent); }

/* ---------- Catalog grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.grid.list { grid-template-columns: 1fr; }

.card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .15s, transform .15s, border-color .15s;
  cursor: pointer;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }

.thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.thumb .frame-scaler { position: absolute; top: 0; left: 0; transform-origin: top left; }
.thumb iframe { border: 0; background: #fff; pointer-events: none; }
.thumb .thumb-overlay {
  position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 10px; opacity: 0; transition: opacity .15s;
  background: linear-gradient(180deg, transparent 55%, rgba(20,23,31,.35));
}
.card:hover .thumb-overlay { opacity: 1; }
.thumb-overlay .btn { backdrop-filter: blur(4px); }

.fav-btn {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.9); box-shadow: var(--shadow-sm);
  cursor: pointer; display: grid; place-items: center; font-size: 15px; color: var(--faint);
  transition: transform .1s, color .12s;
}
.fav-btn:hover { transform: scale(1.1); }
.fav-btn.on { color: #f5b301; }

.card-body { padding: 13px 14px 15px; }
.card-title { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 2px; }
.card-src { font-size: 12px; color: var(--faint); margin: 0 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* list view variant */
.grid.list .card { flex-direction: row; align-items: stretch; cursor: pointer; }
.grid.list .thumb { width: 220px; aspect-ratio: auto; flex: none; border-bottom: 0; border-right: 1px solid var(--border); }
.grid.list .card-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty-art { font-size: 48px; color: var(--border-strong); }
.empty h3 { margin: 10px 0 4px; color: var(--text); }
.empty p { margin: 0 0 18px; }

/* ============================================================
   WORKSPACE
   ============================================================ */
#workspaceView { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h)); }
.ws-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.crumbs { color: var(--muted); font-size: 13.5px; }
.crumbs b { color: var(--text); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 12px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); font-family: inherit; display: grid; place-items: center; }
.seg button .ic { width: 18px; height: 18px; display: block; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--accent); color: #fff; }

.ws-body { flex: 1; display: grid; grid-template-columns: var(--split, 1fr) 6px 1fr var(--rail-w, 280px); min-height: 0; }
.col-resizer { cursor: col-resize; background: var(--border); position: relative; transition: background .12s; }
.col-resizer::before {
  content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 2px; height: 28px; border-radius: 2px; background: var(--faint); opacity: .55; transition: opacity .12s;
}
.col-resizer:hover, .col-dragging .col-resizer { background: var(--accent); }
.col-resizer:hover::before, .col-dragging .col-resizer::before { opacity: 0; }
.col-dragging { cursor: col-resize; user-select: none; }
.col-dragging iframe { pointer-events: none; }
.ws-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--border); }
.pane-head {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.dotmark { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(24,169,87,.15); }

.preview-wrap { flex: 1; overflow: auto; background: var(--preview-bg); padding: 22px; display: flex; justify-content: center; min-height: 0; }
.preview-frame {
  width: 100%; height: 100%; min-height: 480px; border: 1px solid var(--border-strong);
  border-radius: 10px; background: #fff; box-shadow: var(--shadow-md); transition: width .2s;
}

/* code pane */
.code-tabs { display: flex; align-items: center; gap: 0; border-bottom: 1px solid var(--border); background: var(--surface-2); padding-right: 10px; }
.code-tabs button[data-tab] {
  border: 0; border-right: 1px solid var(--border); background: transparent;
  padding: 9px 14px; cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 600;
  letter-spacing: .02em; color: var(--muted);
  display: inline-flex; align-items: center; gap: 7px;
}
.code-tabs button[data-tab].active { background: var(--surface); color: var(--text); }
.code-tabs .ic { width: 15px; height: 15px; }
.code-tabs .ic.lang-html { stroke: #e34f26; }
.code-tabs .ic.lang-css  { stroke: #2965f1; }
.code-tabs .ic.lang-js   { stroke: #c79a00; }
.code-tabs .btn.xs { margin-left: 6px; }
.code {
  flex: 1; margin: 0; overflow: auto; background: #161618; color: #c7ccd9;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65; padding: 14px 0;
  counter-reset: ln; min-height: 0;
}
.cl { display: flex; gap: 16px; padding: 0 16px; }
.cl::before {
  counter-increment: ln; content: counter(ln);
  width: 30px; text-align: right; color: #565d72; flex: none; user-select: none;
}
.cl code { white-space: pre; font-family: inherit; color: inherit; }
.cl .t-tag { color: #8ab4ff; }
.cl .t-attr { color: #c792ea; }
.cl .t-str { color: #c3e88d; }
.cl .t-com { color: #5b6172; font-style: italic; }

/* meta rail */
.ws-rail { background: var(--surface); padding: 16px 16px 18px; overflow-y: auto; border-right: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #1c1c1f; color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 80;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------- Responsive ---------- */

/* Laptop / small desktop: drop the meta rail under the two code panes */
@media (max-width: 1080px) {
  .ws-body { grid-template-columns: 1fr 1fr; }
  .col-resizer { display: none; }
  .ws-rail { grid-column: 1 / -1; border-top: 1px solid var(--border); border-right: 0; }
}

/* Tablet & mobile: sidebar becomes an off-canvas drawer, workspace stacks */
@media (max-width: 860px) {
  /* --- top bar + drawer --- */
  .menu-btn { display: grid; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; z-index: 45;
    width: 272px; max-width: 84vw;
    height: calc(100vh - var(--topbar-h));
    padding: 16px 14px; overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; } /* stop the page scrolling behind the drawer */

  /* the desktop "collapse" affordance is meaningless for a drawer — neutralize it */
  #navToggle { display: none; }
  .shell.nav-collapsed { --nav-w: 248px; }
  .shell.nav-collapsed .sidebar { padding: 16px 14px; overflow-y: auto; }
  .shell.nav-collapsed .sidebar-head { justify-content: space-between; }
  .shell.nav-collapsed .sidebar-title,
  .shell.nav-collapsed .sidebar .nav-group { display: block; }

  /* --- catalog --- */
  .content { padding: 18px 16px 36px; }

  /* --- workspace: scroll the page instead of cramming a fixed-height grid --- */
  #workspaceView { height: auto; min-height: calc(100vh - var(--topbar-h)); }
  .ws-head { flex-wrap: wrap; gap: 8px 10px; padding: 10px 14px; }
  .ws-head .crumbs { order: 5; flex-basis: 100%; }
  .ws-head .spacer { display: none; }
  .ws-body { display: flex; flex-direction: column; }
  .ws-pane { border-right: 0; border-bottom: 1px solid var(--border); }
  .preview-wrap { height: 68vh; min-height: 340px; padding: 14px; }
  .code { max-height: 70vh; }
  /* meta rail sits inline at full width; collapse toggle isn't needed here */
  .ws-rail { border-right: 0; }
  .ws-body.rail-collapsed { --rail-w: auto; }
  .ws-body.rail-collapsed .ws-rail { padding: 16px; overflow: visible; }
  .ws-body.rail-collapsed .rail-head { justify-content: space-between; }
  .ws-body.rail-collapsed .rail-title,
  .ws-body.rail-collapsed .rail-body { display: block; }
}

/* Phones */
@media (max-width: 560px) {
  .topbar { padding: 0 12px; gap: 10px; }
  .brand-name { display: none; }
  .search { max-width: none; }
  .content { padding: 14px 12px 32px; }
  .page-head h1 { font-size: 20px; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  /* list view: stack thumb over text so neither gets squished */
  .grid.list .card { flex-direction: column; }
  .grid.list .thumb { width: 100%; aspect-ratio: 16 / 10; border-right: 0; border-bottom: 1px solid var(--border); }
  .ws-head .crumbs { display: none; }
  .preview-wrap { height: 60vh; min-height: 300px; padding: 10px; }
  .settings-inner { padding: 20px 14px 48px; }
  .team-member { gap: 10px; padding: 10px 12px; }

  /* We're already on a phone: desktop/tablet preview widths make no sense here.
     Keep only Mobile (as a status indicator) and render the preview full-width. */
  #deviceSeg button[data-w="100%"],
  #deviceSeg button[data-w="768px"] { display: none; }
  #deviceSeg button[data-w="390px"] { background: var(--accent); color: #fff; cursor: default; }
  #wsDeviceLabel { display: none; }
  .preview-frame { width: 100% !important; }
}

/* ============================================================
   Browse-only additions
   ============================================================ */

/* card title row + type tag */
.card-titlerow { display: flex; align-items: center; gap: 8px; }
.card-titlerow .card-title { margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-tag {
  flex: none; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 7px; border-radius: 5px; color: #fff; background: var(--faint);
}
.type-tag.t-block { background: #4f46e5; }
.type-tag.t-template { background: #0ea5a4; }
.type-tag.t-site { background: #f59e0b; }
.type-tag.t-page { background: #db2777; }

/* favorite button in detail header */
#favBtn { font-size: 15px; line-height: 1; padding: 8px 11px; }
#favBtn.on { color: #f5b301; border-color: #f3d27a; background: #fffdf5; }

/* read-only metadata rail */
.ws-rail .meta-row { padding: 11px 2px; border-bottom: 1px solid var(--border); }
.ws-rail .meta-row:last-child { border-bottom: 0; }
.meta-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin-bottom: 4px; }
.meta-val { display: block; font-size: 13.5px; color: var(--text); word-break: break-word; }
.meta-val.mono { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.meta-val a { color: var(--accent); text-decoration: none; }
.meta-val a:hover { text-decoration: underline; }

/* ============================================================
   Login overlay
   ============================================================ */
.login-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1000px 600px at 50% -20%, #1a1726, #08080a);
}
.login-card {
  width: 100%; max-width: 360px; background: var(--surface);
  border-radius: 16px; padding: 28px 26px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 14px;
}
.login-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 2px; }
.login-title { margin: 0; font-size: 18px; text-align: center; }
.login-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.login-field input {
  border: 1px solid var(--border-strong); border-radius: 9px; padding: 10px 12px;
  font-size: 14px; font-family: inherit; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text); outline: none;
}
.login-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-error { background: #fdf4f3; border: 1px solid #f0c7c2; color: var(--danger); border-radius: 9px; padding: 9px 11px; font-size: 13px; }
.login-card .btn.primary { margin-top: 4px; padding: 11px; }
.google-btn { background: #fff; border: 1px solid var(--border-strong); color: #1f1f1f; justify-content: center; padding: 11px; font-weight: 600; }
.google-btn:hover { background: var(--surface-2); }
.login-or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 2px 0; }
.login-or::before, .login-or::after { content: ""; height: 1px; background: var(--border); flex: 1; }

/* account row (email + sign out) */
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ============================================================
   Settings page
   ============================================================ */
.settings { overflow-y: auto; background: var(--bg); }
.settings-inner { max-width: 820px; margin: 0 auto; padding: 28px 28px 60px; }
.settings-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.settings-head h1 { margin: 0; font-size: 23px; letter-spacing: -.02em; }
.settings-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px 22px 24px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.settings-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.settings-card h2 { margin: 0; font-size: 16px; }

/* team */
.team-list { display: flex; flex-direction: column; gap: 10px; }
.team-member { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.team-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; }
.team-info { min-width: 0; flex: 1; }
.team-name { font-weight: 700; font-size: 14px; }
.team-email { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-role { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 4px 10px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); flex: none; }
.team-role.dev { background: #e7f8f0; color: #0a8f54; }

/* mcp snippets */
.mcp-block { border: 1px solid var(--border); border-radius: 11px; overflow: hidden; margin-bottom: 14px; }
.mcp-block-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.mcp-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.snippet { margin: 0; padding: 13px 14px; background: #161618; color: #c7ccd9; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; overflow-x: auto; white-space: pre; }

/* ============================================================
   Collapsible panels — left sidebar + right meta rail
   ============================================================ */
/* shared toggle button + header rows */
.rail-toggle {
  border: 0; background: transparent; cursor: pointer; color: var(--muted);
  width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; flex: none;
}
.rail-toggle:hover { background: var(--surface-2); color: var(--text); }
.rail-toggle .ic { width: 18px; height: 18px; transition: transform .18s ease; }

.rail-head, .sidebar-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 10px;
}
.rail-title, .sidebar-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--faint);
}

/* --- right meta rail collapsed --- */
.ws-body.rail-collapsed { --rail-w: 46px; }
.ws-body.rail-collapsed .ws-rail { padding-left: 9px; padding-right: 9px; overflow: hidden; }
.ws-body.rail-collapsed .rail-head { justify-content: center; border-bottom: 0; margin: 0; padding: 0; }
.ws-body.rail-collapsed .rail-title,
.ws-body.rail-collapsed .rail-body { display: none; }

/* --- left sidebar collapsed --- */
.shell.nav-collapsed { --nav-w: 50px; }
.shell.nav-collapsed .sidebar { padding-left: 9px; padding-right: 9px; overflow: hidden; }
.shell.nav-collapsed .sidebar-head { justify-content: center; border-bottom: 0; margin: 0; padding: 0; }
.shell.nav-collapsed .sidebar-title,
.shell.nav-collapsed .sidebar .nav-group { display: none; }
