*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f5f7fa; --surface: #ffffff; --border: #e4e8ee; --border-light: #eef1f6;
  --ng-pill-idle: #efefef;
  --primary: #2563eb; --primary-hover: #1d4ed8; --primary-soft: #eff4ff;
  --text-primary: #0f172a; --text-secondary: #475569; --text-muted: #94a3b8;
  --tag-bg: #f1f5f9; --tag-text: #475569;
  --avatar-1: #8b5cf6; --avatar-2: #f59e0b; --avatar-3: #ec4899;
  --avatar-4: #10b981; --avatar-5: #3b82f6; --avatar-6: #ef4444;
  --section-bg: #f4f6f9; --dot-red: #ef4444; --dot-green: #10b981;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg); color: var(--text-primary); font-size: 14px; -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.topbar {
  height: 56px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
  flex-shrink: 0;
}
.brand {
  display: flex; align-items: center; gap: 5px;
  text-decoration: none; color: inherit;
}
.brand-logo {
  width: 28px; height: 28px; border-radius: 8px; background: transparent;
  display: grid; place-items: center; flex-shrink: 0;
}
.brand-logo img {
  width: 100%; height: 100%; object-fit: contain; display: block;
}
/* Brand inside the leftnav: icon always visible, wordmark only when expanded
   (the wordmark is tagged .nav-label so it picks up the same opacity transition
   as the other nav-item labels). */
.leftnav .brand--leftnav {
  display: flex; align-items: center; gap: 4px;
  height: 36px; padding: 0 6px; margin: 0 0 6px;
  border-radius: 7px;
  font-family: 'Poppins', system-ui, sans-serif;
  font-weight: 600; font-size: 0.8125rem;
  color: var(--text-primary);
}
.leftnav .brand--leftnav:hover { background: var(--bg); }
.leftnav-brand-shell .brand--leftnav {
  margin-bottom: 0;
}
.app:not(.leftnav-expanded) .leftnav .brand--leftnav {
  justify-content: center; padding: 0; gap: 0; align-self: center; width: 32px;
}
.leftnav-top {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  flex-shrink: 0;
  gap: 0;
}
/* Logo + collapse control; toggle aligns to the right edge of .brand--leftnav when expanded. */
.leftnav-brand-shell {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.app.leftnav-expanded .leftnav-brand-shell {
  align-items: stretch;
  margin-bottom: 6px;
}
.app.leftnav-expanded .leftnav-brand-shell .brand--leftnav {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  padding-right: 36px;
}
.app.leftnav-expanded .leftnav-brand-shell .nav-toggle {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  margin: 0;
  align-self: auto;
}
.app:not(.leftnav-expanded) .leftnav-brand-shell .nav-toggle {
  margin-bottom: 10px;
}
.topbar-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
  flex: 0 1 auto;
  min-width: 0;
}
.topbar-search-slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}
.leftnav > .leftnav-theme-slot {
  margin-top: auto;
  margin-bottom: 0;
  flex-shrink: 0;
  width: 32px;
  align-self: center;
  display: inline-flex;
  justify-content: center;
}
.app.leftnav-expanded .leftnav .leftnav-theme-slot {
  width: 100%;
  align-self: stretch;
  justify-content: flex-start;
  padding: 0 8px;
  box-sizing: border-box;
}
.leftnav .leftnav-theme-slot .theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: 7px;
}
.topbar-avatar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px 0 4px;
  margin-right: 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
}
.topbar-avatar:hover { background: var(--bg); }
.topbar-avatar .la-av {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.topbar-avatar .la-chev {
  width: 12px;
  height: 12px;
  color: var(--text-muted);
  transform: rotate(0deg);
  transition: transform 0.14s ease;
}
.topbar-avatar[aria-expanded="true"] .la-chev {
  transform: rotate(180deg);
}
/* Leftnav chrome matches app.css (used by edit/view pages). */
.leftnav .leftnav-avatar {
  position: relative; overflow: hidden; white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 20px 8px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-primary); text-decoration: none;
  cursor: pointer; font: inherit;
}
.leftnav > .leftnav-avatar {
  margin-top: auto;
  margin-bottom: 0;
  flex-shrink: 0;
}
.leftnav .leftnav-avatar:hover { background: var(--bg); }
.leftnav .leftnav-avatar .la-av {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 700;
  flex-shrink: 0;
}
.leftnav .leftnav-avatar .la-meta {
  position: absolute; left: 38px; right: 22px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: flex-start; flex-direction: column; min-width: 0; gap: 2px;
  opacity: 0; pointer-events: none; transition: opacity .12s ease;
}
.leftnav .leftnav-avatar .la-name { font-size: 12px; font-weight: 600; line-height: 1.15; }
.leftnav .leftnav-avatar .la-role { font-size: 10px; color: var(--text-muted); line-height: 1.15; margin-top: 0; }
.leftnav .leftnav-avatar .la-chev {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 12px; height: 12px; color: var(--text-muted);
  opacity: 0; transition: opacity .12s ease;
}
.app.leftnav-expanded .leftnav .leftnav-avatar .la-meta,
.app.leftnav-expanded .leftnav .leftnav-avatar .la-chev { opacity: 1; pointer-events: auto; transition-delay: .14s; }
.app:not(.leftnav-expanded) .leftnav .leftnav-avatar {
  justify-content: center; padding: 0; width: 32px; align-self: center; gap: 0;
  border: 1px solid transparent; background: transparent;
}

.app.leftnav-expanded { --nav-w: 210px; }
.layout {
  display: grid;
  grid-template-columns: var(--nav-w, 52px) 1fr;
  height: 100vh;
  /* No grid transition — inner item layouts flip instantly on class change,
     so the 180ms width animation made labels reflow visibly mid-flight. */
}
.main-col {
  display: flex; flex-direction: column; min-width: 0; height: 100vh;
}
.leftnav {
  position: relative;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: stretch;
  padding: 12px 8px 8px 12px; gap: 0; overflow: hidden;
  height: 100vh;
}
.nav-toggle {
  width: 32px; height: 28px; margin: 0 0 2px; border-radius: 6px; border: none; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--text-muted);
  align-self: center;
}
.app.leftnav-expanded .leftnav-brand-shell .nav-toggle { align-self: auto; }
.nav-toggle:hover { background: var(--bg); color: var(--text-primary); }
.nav-toggle img { width: 16px; height: 16px; display: block; opacity: 0.4; }
.nav-toggle .nav-toggle-close { display: none; }
.app.leftnav-expanded .nav-toggle .nav-toggle-open { display: none; }
.app.leftnav-expanded .nav-toggle .nav-toggle-close { display: block; }
html[data-theme="dark"] .nav-toggle img { filter: brightness(0) invert(1); }
.nav-toggle:hover img { opacity: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 2px 8px; border-radius: 7px;
  color: var(--text-muted); text-decoration: none;
  font-size: 13px; font-weight: 500;
}
.nav-item:hover { background: var(--bg); color: var(--text-primary); }
.leftnav .nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  margin-top: 2px;
  margin-bottom: 2px;
}
.leftnav .nav-item-stub {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}
.leftnav .nav-item-stub:hover {
  background: transparent;
  color: var(--text-muted);
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.leftnav .leftnav-group-label {
  display: none;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); padding: 14px 8px 6px; margin: 0; flex-shrink: 0;
}
.app.leftnav-expanded .leftnav .leftnav-group-label { display: block; }
.leftnav .nav-label {
  white-space: nowrap; opacity: 0; transition: opacity .15s ease .05s;
  pointer-events: none;
}
.app.leftnav-expanded .leftnav .nav-label { opacity: 1; pointer-events: auto; }
.app:not(.leftnav-expanded) .leftnav .nav-label { display: none; }
.app:not(.leftnav-expanded) .leftnav .nav-item {
  justify-content: center; padding: 0; width: 32px; align-self: center; gap: 0;
}
.leftnav-avatar-pop {
  position: fixed; z-index: 90; padding: 6px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}
.leftnav-avatar-pop[hidden] { display: none; }
.leftnav-avatar-pop button {
  width: 100%; height: 32px; border: none; border-radius: 7px; background: transparent;
  color: var(--text-primary); text-align: left; padding: 0 10px; cursor: pointer;
  font-size: 12.5px; font-family: inherit;
}
.leftnav-avatar-pop button:hover { background: var(--bg); }

.main { padding: 26px 30px 36px; overflow: auto; flex: 1; min-height: 0; }
.header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px;
}
.header h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.header p {display: none; margin-top: 6px; color: var(--text-muted); max-width: 760px; }
.header-actions { display: flex; gap: 10px; }
.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-primary); border-radius: 8px;
  height: 36px; padding: 0 14px; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn .btn-icon-plus {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.leftnav .nav-item-dashboard { position: relative; }
.leftnav .nav-item-plus {
  margin-left: auto;
  width: 20px;
  height: 20px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease, color .14s ease, border-color .14s ease, background .14s ease;
}
.leftnav .nav-item-plus svg { width: 12px; height: 12px; }
.app.leftnav-expanded .leftnav .nav-item-plus {
  opacity: 1;
  pointer-events: auto;
}
.app:not(.leftnav-expanded) .leftnav .nav-item-plus { display: none; }
.leftnav .nav-item-plus:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.community-search-row {
  display: block;
  margin-bottom: 16px;
}
.community-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--surface);
}
.community-search-input-wrap svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.community-search-input-wrap > input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: none;
  background: transparent;
  padding: 0;
  color: var(--text-primary); font-family: inherit; font-size: 13px;
  outline: none;
  box-shadow: none;
}
.community-search-input-wrap:focus-within {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent);
}
.community-search-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.community-filter-wrap { position: relative; display: inline-flex; align-items: center; }
.community-filter-wrap .role-filter-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 34px;
  min-width: 124px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-sizing: border-box;
}
.community-filter-wrap .role-filter-trigger:hover { background: var(--bg); }
.community-filter-wrap .role-filter-trigger[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent);
}
.community-filter-wrap .role-filter-trigger-label { flex: 1; text-align: left; }
.community-filter-wrap .role-filter-trigger-chevron {
  display: flex;
  align-items: center;
  color: var(--text-muted);
}
.community-filter-wrap .role-filter-trigger-chevron svg { width: 12px; height: 12px; display: block; }
.community-filter-wrap .role-filter-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 70;
  min-width: 100%;
  width: max-content;
  max-width: min(260px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  padding: 4px;
}
.community-filter-wrap .role-filter-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  font: inherit;
  font-size: 12px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.community-filter-wrap .role-filter-item:hover { background: var(--bg); color: var(--text-primary); }
.community-filter-wrap .role-filter-item.active { background: var(--primary-soft); color: var(--primary); }
.topic-rail {
  position: relative;
  margin-bottom: 14px;
  margin-top: 10px;
}
.topic-pills {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  padding: 0;
}
.topic-pills::-webkit-scrollbar { display: none; }
.topic-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: var(--border);
  color: var(--text-secondary);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.topic-pill-icon {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
  opacity: 0.82;
  object-fit: contain;
  filter: brightness(0) saturate(0) opacity(0.82);
}
.topic-pill:hover .topic-pill-icon,
.topic-pill.active .topic-pill-icon { opacity: 1; }
html[data-theme="dark"] .topic-pill { background: #2a3444; }
.topic-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
html[data-theme="dark"] .topic-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
html[data-theme="dark"] .topic-pill { color: #c7d2e5; }
html[data-theme="dark"] .topic-pill.active { color: #ffffff; }
.topic-pill.active .topic-pill-icon {
  filter: brightness(0) invert(1) opacity(1);
}
html[data-theme="dark"] .topic-pill-icon {
  filter: brightness(0) invert(1) opacity(0.9);
}
.topic-rail-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32px;
  pointer-events: none;
  z-index: 2;
}
.topic-rail-fade--left {
  left: 0;
  background: linear-gradient(to right, var(--bg), color-mix(in srgb, var(--bg) 0%, transparent));
}
.topic-rail-fade--right {
  right: 0;
  background: linear-gradient(to left, var(--bg), color-mix(in srgb, var(--bg) 0%, transparent));
}
.topic-rail-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.topic-rail-nav[hidden],
.topic-rail-fade[hidden] { display: none !important; }
.topic-rail-nav:hover { background: var(--bg); color: var(--text-primary); }
.topic-rail-nav svg { width: 14px; height: 14px; }
.topic-rail-nav--left { left: 4px; }
.topic-rail-nav--right { right: 4px; }

/* My Graphs collection tabs — same styling as community topic pills */
.section-head--dashboard .topic-pills {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(100%, 640px);
  flex-wrap: wrap;
}

.section-head .status-filter {
  height: var(--hub-head-h);
  min-height: var(--hub-head-h);
  border-radius: var(--hub-head-r);
  box-sizing: border-box;
}

.section-head .role-filter-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.section-head .role-filter-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: var(--hub-head-h);
  min-width: 118px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--hub-head-r);
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-sizing: border-box;
}
.section-head .role-filter-trigger:hover { background: var(--bg); }
.section-head .role-filter-trigger[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent);
}
.section-head .role-filter-trigger-label { flex: 1; text-align: left; }
.section-head .role-filter-trigger-chevron {
  display: flex;
  align-items: center;
  color: var(--text-muted);
}
.section-head .role-filter-trigger-chevron svg { width: 12px; height: 12px; display: block; }
.section-head .role-filter-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 70;
  min-width: 100%;
  width: max-content;
  max-width: min(260px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  padding: 4px;
}
.section-head .role-filter-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  font: inherit;
  font-size: 12px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.section-head .role-filter-item:hover { background: var(--bg); color: var(--text-primary); }
.section-head .role-filter-item.active { background: var(--primary-soft); color: var(--primary); }
/* Anchored confirm — same pattern as variant delete on editing canvas */
.variant-confirm-pop {
  position: fixed;
  z-index: 80;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  padding: 10px 12px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
}
.variant-confirm-pop::before {
  content: '';
  position: absolute;
  top: -6px;
  left: var(--pop-tail-left, 18px);
  width: 10px;
  height: 10px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
.variant-confirm-pop .pop-msg { color: var(--text-primary); line-height: 1.35; }
.variant-confirm-pop .pop-msg strong { font-weight: 600; }
.variant-confirm-pop .pop-actions {
  display: flex;
  justify-content: flex-start;
  gap: 6px;
}
.variant-confirm-pop button {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid transparent;
}
.variant-confirm-pop .pop-yes { background: #dc2626; color: #fff; }
.variant-confirm-pop .pop-yes:hover { background: #b91c1c; }
.variant-confirm-pop .pop-no {
  color: var(--text-secondary);
  border-color: var(--border);
  background: transparent;
}
.variant-confirm-pop .pop-no:hover { background: var(--bg); }
.graph-delete-confirm-pop .pop-actions {
  justify-content: flex-start;
  align-items: flex-start;
}
.status-filter {
  height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px;
  background: var(--surface); color: var(--text-primary); font-family: inherit; font-size: 12px;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px;
  margin-bottom: 12px;
}

/* ── Dashboard empty state ─────────────────────────────────────
   Shown on the Home tab when the user has zero owned graphs.
   Sits inside #dashboardCards (which itself is a grid container,
   so we let this single child span all columns).
*/
.dashboard-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 64px 32px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 14px;
  text-align: center;
}
.dashboard-empty-art {
  width: 64px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft, var(--bg));
  border-radius: 50%;
  color: var(--text-muted, #94a3b8);
}
.dashboard-empty-art svg { width: 32px; height: 32px; }
.dashboard-empty-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text-primary);
}
.dashboard-empty-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 420px;
  margin: 0;
}
.dashboard-empty-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
  justify-content: center;
}
.dashboard-empty-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.dashboard-empty-btn svg { width: 15px; height: 15px; }
.dashboard-empty-btn:hover {
  background: var(--bg-soft, var(--bg));
}
.dashboard-empty-btn--primary {
  background: var(--primary, #2563eb);
  color: #ffffff;
  border-color: var(--primary, #2563eb);
}
.dashboard-empty-btn--primary:hover {
  background: var(--primary-hover, #1d4ed8);
  border-color: var(--primary-hover, #1d4ed8);
  color: #ffffff;
}
.panel h2 { font-size: 15px; margin-bottom: 10px; }
.section { margin-bottom: 20px; }
.section-head {
  --hub-head-h: 34px;
  --hub-head-r: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-head--dashboard {
  flex-wrap: wrap;
  row-gap: 8px;
}
@media (max-width: 520px) {
  .section-head--dashboard .topic-pills {
    max-width: 100%;
  }
}
.section-head-right {
  display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.cards-view-toggle {
  display: inline-flex;
  align-items: stretch;
  height: var(--hub-head-h, 34px);
  border: 1px solid var(--border);
  border-radius: var(--hub-head-r, 8px);
  overflow: hidden;
  background: var(--surface);
  flex-shrink: 0;
  box-sizing: border-box;
}
.cards-view-btn {
  width: 34px;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-sizing: border-box;
}
.cards-view-btn svg { width: 16px; height: 16px; }
.cards-view-btn:hover { background: var(--bg); color: var(--text-primary); }
.cards-view-btn.active {
  background: var(--primary-soft); color: var(--primary);
}
.cards-view-btn + .cards-view-btn { border-left: 1px solid var(--border); }
.section-title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.subtle { color: var(--text-muted); font-size: 12px; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(332px, 100%), 1fr));
  gap: 12px;
  padding-bottom: 8px;
}
.graph-card {
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  width: 100%;
  min-width: 0;
}
/* List layout: one column, thumbnail left + details right */
body.graph-cards--list .cards {
  grid-template-columns: 1fr;
}
body.graph-cards--list .graph-card {
  display: grid;
  grid-template-columns: min(160px, 34vw) minmax(0, 1fr);
  grid-template-rows: auto auto auto auto;
  column-gap: 14px;
  row-gap: 6px;
  align-items: start;
}
body.graph-cards--list .graph-thumb {
  grid-column: 1;
  grid-row: 1 / -1;
  height: 108px;
  margin-bottom: 0;
}
body.graph-cards--list .graph-head {
  grid-column: 2; grid-row: 1;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
body.graph-cards--list .chip-row { grid-column: 2; grid-row: 2; }
body.graph-cards--list .stats { grid-column: 2; grid-row: 3; }
body.graph-cards--list .card-footer { grid-column: 2; grid-row: 4; }
@media (max-width: 520px) {
  body.graph-cards--list .graph-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  body.graph-cards--list .graph-thumb {
    grid-column: 1;
    grid-row: 1;
    height: 120px;
    max-width: 100%;
  }
  body.graph-cards--list .graph-head { grid-column: 1; grid-row: 2; }
  body.graph-cards--list .chip-row { grid-column: 1; grid-row: 3; }
  body.graph-cards--list .stats { grid-column: 1; grid-row: 4; }
  body.graph-cards--list .card-footer { grid-column: 1; grid-row: 5; }
}
.graph-card[data-graph-slug] { cursor: pointer; }
.graph-card[data-graph-slug]:hover { border-color: var(--primary); }
.graph-thumb {
  position: relative; width: 100%; height: 124px; border: 1px solid var(--border-light); border-radius: 8px; overflow: hidden;
  background:
    radial-gradient(circle at 20% 30%, #dbeafe 0%, transparent 45%),
    radial-gradient(circle at 80% 70%, #e0e7ff 0%, transparent 50%),
    #f8fafc;
  background-image:
    linear-gradient(var(--border-light) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-light) 1px, transparent 1px);
  background-size: 16px 16px;
  margin-bottom: 2px;
}
.graph-viz {
  position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); opacity: .9;
}
.role-badge {
  position: absolute; top: 8px; right: 8px; border-radius: 7px; padding: 3px 8px; font-size: 11px; font-weight: 700;
  color: #fff;
}
.role-admin { background: #0f172a; }
.role-view { background: #64748b; }
.role-contrib { background: #d97706; }
.role-public { background: #16a34a; }
.card-actions { display: inline-flex; align-items: center; gap: 0; flex-shrink: 0; }
.card-icon-btn {
  width: 22px; height: 22px; border: none; border-radius: 6px;
  background: transparent; cursor: pointer; color: #94a3b8;
  display: grid; place-items: center; padding: 0;
}
.card-icon-btn:hover { color: var(--text-primary); background: var(--bg); }
.card-icon-btn.danger:hover { color: #dc2626; }
.card-icon-btn.danger.confirming { background: var(--surface); box-shadow: 0 0 0 1px var(--border); color: #dc2626; }
.card-icon-btn svg { width: 14px; height: 14px; }
.card-icon-btn img { width: 14px; height: 14px; object-fit: contain; }
.star-btn.active { color: #f59e0b; }
.star-btn.active:hover { color: #f59e0b; }
.graph-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
/* Let title + meta use all space left of actions so long titles don’t wrap prematurely. */
.graph-head > div:first-child {
  flex: 1 1 0;
  min-width: 0;
}
.graph-title { font-size: 14px; font-weight: 700; line-height: 1.3; }
.graph-title--editable {
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 6px;
  margin: -2px -6px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.graph-title--editable:hover {
  background: var(--bg);
  color: var(--text-primary);
}
.graph-title--editable[contenteditable="true"] {
  background: var(--surface);
  border: 1px solid var(--primary);
  color: var(--text-primary);
  outline: none;
}
.graph-meta { color: var(--text-muted); font-size: 12px; padding-bottom: 4px; padding-top: 2px;}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--tag-bg); color: var(--tag-text); font-size: 11px; padding: 3px 8px; border-radius: 999px; font-weight: 500; }
.chip.chip-nodes { color: var(--text-secondary);}
.stats { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11.5px; color: var(--text-secondary); padding-top: 4px;}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}
.push-meta { font-size: 11.5px; color: var(--text-muted); }
.push-meta strong { color: var(--text-secondary); font-weight: 600; }
.avatar-stack { display: flex; align-items: center; justify-content: flex-end; }
.avatar-stack .mini {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid var(--surface);
  margin-left: -6px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}
.avatar-stack .mini:first-child { margin-left: 0; }
.avatar-stack .more {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  height: 22px;
  min-width: 26px;
  padding: 0 5px;
  margin-left: -6px;
  display: grid;
  place-items: center;
}
.open-list { display: grid; gap: 8px; }
.open-item[data-graph-slug] { cursor: pointer; }
.open-item[data-graph-slug]:hover { background: var(--bg); }
.open-item {
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
}
.open-item .title { font-size: 13.5px; font-weight: 700; }
.open-item .meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.open-item .signals { font-size: 11.5px; color: var(--text-secondary); margin-top: 4px; }
.open-chart { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.open-chart .open-item { border: none; border-radius: 0; }
.open-chart .open-sep { height: 1px; background: var(--border-light); margin: 0 12px; }
.open-pager {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.open-pager-btn {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.open-pager-btn:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text-primary);
}
.open-pager-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.open-pager-btn svg { width: 13px; height: 13px; }
.open-pager-label {
  min-width: 44px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.open-chart.open-chart--empty {
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.queue-item { border: 1px solid var(--border-light); border-radius: 9px; padding: 9px; margin-bottom: 8px; }

@media (max-width: 1200px) {
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .leftnav { display: none; }
  .main { padding: 16px; }
  .header { flex-direction: column; }
  .community-search-filters { justify-content: flex-end; }
}

/* ============================================================
   Fork confirmation (community / new-graph fork)
   ============================================================ */
.fork-confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.fork-confirm-backdrop.is-open {
  display: flex;
}
.fork-confirm-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: 14px;
  padding: 22px 24px 20px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  border: 1px solid var(--border);
}
.fork-confirm-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.fork-confirm-close:hover {
  background: var(--bg);
  color: var(--text-primary);
}
.fork-confirm-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 32px;
  margin-bottom: 10px;
}
.fork-confirm-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.fork-confirm-icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}
html[data-theme="dark"] .fork-confirm-icon img {
  filter: brightness(0) invert(1);
}
.fork-confirm-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.fork-confirm-text {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.fork-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.fork-confirm-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid transparent;
}
.fork-confirm-btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}
.fork-confirm-btn--ghost:hover {
  background: var(--bg);
}
.fork-confirm-btn--primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.fork-confirm-btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

/* ============================================================
   New-graph modal
   Triggered from the dashboard "New Graph" button and from the
   landing page CTA (?new=1). Lets users start blank, fork a
   public graph, or browse the full community list.
   ============================================================ */
.ng-modal-backdrop {
  position: fixed; inset: 0; z-index: 1300;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  padding: 32px;
  animation: ng-fade-in 140ms ease-out;
}
.ng-modal-backdrop:not([hidden]) { display: flex; }

@keyframes ng-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ng-pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

.ng-modal-card {
  width: min(1180px, 100%);
  height: min(780px, 92vh);
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: row;
  align-items: stretch;
  overflow: hidden;
  animation: ng-pop 180ms ease-out;
}

.ng-modal-stack {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ng-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.ng-modal-head h2 {
  margin: 0; font-size: 16px; font-weight: 600; color: var(--text-primary);
  letter-spacing: -0.005em;
}
.ng-close {
  background: transparent; border: 0; color: var(--text-muted);
  padding: 6px; border-radius: 8px; display: grid; place-items: center;
  cursor: pointer; transition: background 120ms ease, color 120ms ease;
}
.ng-close:hover { background: var(--bg); color: var(--text-primary); }
.ng-close svg { width: 16px; height: 16px; }

.ng-modal-body {
  flex: 1; min-height: 0;
  display: flex;
}

/* Categories rail — full modal height; head + main + foot live in .ng-modal-stack */
.ng-cats {
  width: 220px;
  flex: 0 0 220px;
  align-self: stretch;
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--bg);
}
.ng-cat {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border: 0; background: transparent;
  text-align: left;
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.ng-cat:hover { background: var(--surface); color: var(--text-primary); }
.ng-cat.active {
  background: color-mix(in srgb, var(--primary) 24%, var(--surface));
  color: var(--primary);
  /* box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 55%, transparent); */
}
html[data-theme="dark"] .ng-cat.active {
  background: var(--primary-soft);
  box-shadow: none;
}
.ng-cat-count {
  font-size: 11px; font-weight: 600;
  color: var(--text-primary);
  padding: 2px 7px; border-radius: 999px;
  border: 0px solid var(--border);
}
.ng-cat.active .ng-cat-count {
  background: var(--surface);
  color: var(--primary);
  border-color: transparent;
}
.ng-cat-divider {
  height: 1px;
  margin: 8px 4px;
  background: var(--border);
  flex-shrink: 0;
}

/* Right pane */
.ng-main {
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
}
.ng-controls {
  padding: 18px 24px 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.ng-search {
  position: relative;
}
.ng-search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted);
}
.ng-search input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.ng-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.ng-status-pills {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ng-pill {
  padding: 6px 12px;
  border: none;
  background: var(--border-light);
  color: var(--text-secondary);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.ng-pill:hover { color: var(--text-primary); }
.ng-pill.active {
  background: var(--primary);
  border: none;
  color: var(--surface);
}
html[data-theme="dark"] .ng-pill:not(.active) {
  background: color-mix(in srgb, var(--surface) 82%, var(--text-primary));
}

/* Grid */
.ng-grid {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 18px 24px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  grid-auto-rows: max-content;
  gap: 16px;
  align-content: start;
}
.ng-grid:empty::after {
  content: 'No graphs match your filters.';
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* Card hover overlay (preview / fork) */
.ng-card {
  position: relative;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-height: 0;
}
.ng-card:hover {
  /* border-color: var(--primary); */
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}
.ng-card .graph-card {
  border: 0; box-shadow: none; background: transparent;
  margin: 0;
  flex: 1 1 auto;
  min-height: 0;
}
/* Outer ng-card supplies hover chrome; inner graph-card hover border reads as a stray bottom edge */
.ng-modal-card .ng-card .graph-card[data-graph-slug]:hover {
  border: 0;
}

/* Modal cards: always thumbnail on top (dashboard “list” layout uses a 2-col grid on body). */
.ng-modal-card .graph-card,
body.graph-cards--list .ng-modal-card .graph-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  grid-template-columns: unset;
  grid-template-rows: unset;
  align-items: stretch;
}
.ng-modal-card .graph-thumb,
body.graph-cards--list .ng-modal-card .graph-thumb {
  grid-column: unset;
  grid-row: unset;
  width: 100%;
  max-width: 100%;
  height: 124px;
  margin-bottom: 2px;
}
.ng-modal-card .graph-head,
body.graph-cards--list .ng-modal-card .graph-head {
  grid-column: unset;
  grid-row: unset;
}
.ng-modal-card .chip-row,
.ng-modal-card .stats,
.ng-modal-card .card-footer,
body.graph-cards--list .ng-modal-card .chip-row,
body.graph-cards--list .ng-modal-card .stats,
body.graph-cards--list .ng-modal-card .card-footer {
  grid-column: unset;
  grid-row: unset;
}
/* Pin stats to bottom of card; flex absorbs row height from grid */
.ng-modal-card .graph-card .stats {
  margin-top: auto;
  padding-top: 0;
}
.ng-card-overlay {
  position: absolute;
  left: 12px;
  top: 12px;
  width: calc(100% - 24px);
  height: 124px;
  display: none;
  align-items: center; justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
  border-radius: 8px;
  z-index: 2;
  pointer-events: none;
}
.ng-card:hover .ng-card-overlay { display: flex; }
html[data-theme="dark"] .ng-card-overlay { background: rgba(11, 18, 32, 0.42); }

.ng-overlay-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
  pointer-events: auto;
}
.ng-overlay-btn:hover { transform: translateY(-1px); }
.ng-overlay-btn svg { width: 14px; height: 14px; }
.ng-overlay-btn img {
  width: 14px;
  height: 14px;
  object-fit: contain;
}
.ng-overlay-btn--fork {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}
.ng-overlay-btn--fork img {
  filter: brightness(0) invert(1);
}
.ng-overlay-btn--fork:hover { background: var(--primary-hover); }

/* Blank card */
.ng-blank {
  border: 1.5px dashed var(--border);
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 36px 20px;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  min-height: 280px;
  transition: border-color 120ms ease, background 120ms ease;
}
.ng-blank:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.ng-blank-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--primary);
  margin-bottom: 14px;
}
.ng-blank-icon svg { width: 22px; height: 22px; }
.ng-blank-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  margin-bottom: 4px;
}
.ng-blank-sub {
  font-size: 12px; color: var(--text-muted); line-height: 1.5;
  max-width: 200px;
}

/* Footer */
.ng-modal-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end;
  background: var(--bg);
}
.ng-browse-all {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  background: transparent;
  color: var(--primary);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: background 120ms ease;
}
.ng-browse-all:hover { background: var(--primary-soft); }
.ng-browse-all svg { width: 14px; height: 14px; }

/* Responsive */
@media (max-width: 820px) {
  .ng-modal-card { flex-direction: column; }
  .ng-modal-stack { flex: 1; min-height: 0; }
  .ng-cats {
    width: auto;
    flex: 0 0 auto;
    align-self: stretch;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    flex-direction: row; overflow-x: auto; overflow-y: hidden;
    padding: 10px 12px; gap: 4px;
  }
  .ng-cat { white-space: nowrap; }
  .ng-cat-count { display: none; }
}

/* ============================================================
   SETTINGS (?tab=settings)
   Two-column layout: sticky in-page section nav + scrollable
   grouped setting cards. Reuses the page's design tokens so it
   inherits dark mode automatically.
   ============================================================ */
.settings-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  max-width: 1080px;
}

/* ── Section nav (sticky) ── */
.settings-nav {
  position: sticky;
  top: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.settings-nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.settings-nav-item:hover { background: var(--section-bg); color: var(--text-primary); }
.settings-nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.settings-nav-item.active svg { opacity: 1; }
.settings-nav-item--danger.active { background: rgba(239,68,68,.10); color: var(--dot-red); }
.settings-nav-item--danger:hover { color: var(--dot-red); }

/* ── Content column ── */
.settings-content {
  display: flex;
  flex-direction: column;
  gap: 36px;
  padding-bottom: 40px;
}
.settings-section { scroll-margin-top: 16px; }
.settings-section-head { margin-bottom: 14px; }
.settings-section-head h2 {
  font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: var(--text-primary);
}
.settings-section-head p { margin-top: 3px; font-size: 13px; color: var(--text-muted); }

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 18px;
}
.settings-card--danger { border-color: rgba(239,68,68,.32); }

/* ── Rows ── */
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
  min-height: 56px;
}
.set-row--stack { align-items: flex-start; }
.set-row--avatar { gap: 16px; }
.set-divider { height: 1px; background: var(--border-light); margin: 0 -18px; }

.set-row-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-row-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.set-row-desc { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.set-row-control { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
.set-row-control--full { flex: 1; min-width: 0; max-width: 360px; }
.set-row-control--stack-h { flex-direction: row; }

/* ── Inputs ── */
.set-input {
  width: 280px;
  max-width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.set-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.set-input--err { border-color: var(--dot-red); box-shadow: 0 0 0 3px rgba(239,68,68,.18); }
.set-textarea { width: 280px; height: auto; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.set-select { width: 200px; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 15px; padding-right: 32px;
}
.set-input-prefixed { display: inline-flex; align-items: center; width: 280px; max-width: 100%;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  transition: border-color .14s ease, box-shadow .14s ease;
}
.set-input-prefixed:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.set-input-prefix { padding: 0 2px 0 11px; color: var(--text-muted); font-size: 13px; }
.set-input-prefixed .set-input { border: none; box-shadow: none; padding-left: 2px; width: 100%; }

/* ── Toggle switch ── */
.set-switch { position: relative; display: inline-flex; cursor: pointer; }
.set-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.set-switch-track {
  width: 40px; height: 23px; border-radius: 999px;
  background: var(--border); transition: background .18s ease;
  display: inline-flex; align-items: center; padding: 2px;
}
.set-switch-thumb {
  width: 19px; height: 19px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .18s ease;
}
.set-switch input:checked + .set-switch-track { background: var(--primary); }
.set-switch input:checked + .set-switch-track .set-switch-thumb { transform: translateX(17px); }
.set-switch input:focus-visible + .set-switch-track { box-shadow: 0 0 0 3px var(--primary-soft); }

/* ── Avatar ── */
.set-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--avatar-1), var(--avatar-5));
  color: #fff; font-weight: 700; font-size: 17px; letter-spacing: .02em;
}
.set-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.set-avatar.has-img { background: var(--section-bg); }
.set-row--avatar .set-row-label { flex: 1; }

/* Logged-out CTA (Profile section) */
.set-login-cta-inner {
  display: flex; align-items: center; gap: 16px; padding: 20px 0;
}
.set-login-cta-inner svg { width: 30px; height: 30px; color: var(--text-muted); flex-shrink: 0; }
.set-login-cta-inner .set-login-cta-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.set-login-cta-inner .set-row-title { font-size: 14px; }

/* ── Buttons (local variants on top of .btn) ── */
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--section-bg); }
.btn--danger { border-color: rgba(239,68,68,.4); color: var(--dot-red); background: transparent; }
.btn--danger:hover { background: var(--dot-red); border-color: var(--dot-red); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn[hidden] { display: none; }

/* ── Section footer (save) ── */
.settings-section-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; }
.set-save-status { font-size: 12px; font-weight: 600; color: var(--dot-green); display: inline-flex; align-items: center; gap: 5px; }
.set-save-status[hidden] { display: none; }
.set-save-status::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--dot-green)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center/10px no-repeat; }

/* ── Change-password reveal ── */
.set-pw-fields { display: flex; flex-direction: column; gap: 14px; padding-top: 16px; margin-top: 4px; border-top: 1px solid var(--border-light); }
.set-pw-fields[hidden] { display: none; }
.set-pw-field { display: flex; flex-direction: column; gap: 6px; }
.set-pw-field .set-input { width: 320px; }
.set-pw-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 2px; }
.set-pw-msg { margin-right: auto; font-size: 12px; font-weight: 600; }
.set-pw-msg[hidden] { display: none; }
.set-pw-msg.err { color: var(--dot-red); }
.set-pw-msg.ok { color: var(--dot-green); }

/* ── Theme picker ── */
.set-theme-options { display: flex; gap: 12px; flex-wrap: wrap; }
.set-theme-card {
  display: flex; flex-direction: column; gap: 8px; padding: 8px; width: 104px;
  border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface);
  cursor: pointer; font-family: inherit; transition: border-color .14s ease, box-shadow .14s ease;
}
.set-theme-card:hover { border-color: var(--text-muted); }
.set-theme-card[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.set-theme-name { font-size: 12px; font-weight: 600; color: var(--text-primary); text-align: left; padding-left: 2px; }
.set-theme-swatch { height: 56px; border-radius: 6px; border: 1px solid var(--border-light); }
.set-theme-swatch--light { background: linear-gradient(135deg, #f5f7fa 50%, #ffffff 50%); }
.set-theme-swatch--dark { background: linear-gradient(135deg, #0b1220 50%, #18233a 50%); }
.set-theme-swatch--system { background: linear-gradient(135deg, #f5f7fa 50%, #0b1220 50%); }

/* ── Plan & credits ── */
.set-plan { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 0; }
.set-plan-info { min-width: 0; }
.set-plan-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  letter-spacing: .03em; text-transform: uppercase; background: var(--primary-soft); color: var(--primary);
}
.set-plan-desc { margin-top: 7px; font-size: 13px; color: var(--text-secondary); max-width: 420px; }
.set-credits { display: flex; align-items: center; gap: 12px; width: 100%; }
.set-credits-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--section-bg); overflow: hidden; }
.set-credits-fill { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.set-credits-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }

/* ── Responsive ── */
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: 1fr; gap: 18px; }
  .settings-nav {
    position: static; flex-direction: row; flex-wrap: wrap; gap: 4px;
    padding-bottom: 14px; border-bottom: 1px solid var(--border);
  }
  .settings-nav-item span { display: none; }
  .settings-nav-item { padding: 9px; }
  .settings-nav-item svg { width: 18px; height: 18px; }
  .set-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .set-row-control { width: 100%; }
  .set-input, .set-textarea, .set-input-prefixed, .set-select { width: 100%; }
}

/* Reduce-motion preference (toggled from Appearance settings). */
html[data-reduce-motion="1"] *,
html[data-reduce-motion="1"] *::before,
html[data-reduce-motion="1"] *::after {
  transition-duration: .001ms !important;
  animation-duration: .001ms !important;
}
