/* ─── Reset & tokens ─── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Brand (Black Label) — theme-independent */
  --brand-purple:       #BB9FFF;
  --brand-purple-soft:  #D1BEFF;
  --brand-purple-deep:  #8E5FE0;

  --blue:               #1863DC;
  --blue-hover:         #1457C4;
  --blue-bg:            #EBF1FC;
  --blue-glow:          rgba(24, 99, 220, 0.25);

  --amber:              #B45309;
  --amber-bg:           #FEF3C7;

  --bg:                 #ffffff;
  --bg-elevated:        #fafafa;
  --bg-sidebar:         #F7F7F7;
  --bg-hover:           #EEEEEE;
  --bg-active:          #E6E6E6;
  --border:             #EBEBEB;
  --border-strong:      #D9D9D9;

  --text:               #121212;
  --text-muted:         #7A7A7A;
  --text-subtle:        #9C9C9C;

  --shadow-sm:          0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md:          0 4px 14px rgba(0, 0, 0, 0.06);
  --shadow-lg:          0 14px 32px rgba(0, 0, 0, 0.08);

  --header-h:           52px;
  --toolbar-h:          44px;
  --sidebar-w:          clamp(240px, 22%, 300px);
  --sidebar-collapsed-w: 44px;

  --radius-sm:          6px;
  --radius-md:          10px;
  --radius-lg:          16px;

  --transition-fast:    150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-med:     250ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Category accents — overridden per-card via inline `--cat` */
  --cat:                #1863DC;
  --cat-industrials:    #F0932B;
  --cat-life_science:   #8E5FE0;
  --cat-sales_interfaces: #2ECC9A;
  --cat-fintech:        #4F6BE8;
  --cat-cdmo:           #E85B8E;
  --cat-highcharts:     #1863DC;
  --cat-mapbox:         #2AAED6;
}

html[data-theme="dark"] {
  /* Primary accent mirrors Black Label brand purple */
  --blue:               #BB9FFF;
  --blue-hover:         #D1BEFF;
  --blue-bg:            rgba(187, 159, 255, 0.10);
  --blue-glow:          rgba(187, 159, 255, 0.28);

  --amber:              #FCD34D;
  --amber-bg:           rgba(251, 191, 36, 0.14);

  --bg:                 #000000;
  --bg-elevated:        #0E0E0D;
  --bg-sidebar:         #080808;
  --bg-hover:           #17161A;
  --bg-active:          #1B1633;
  --border:             #1B1B1C;
  --border-strong:      #2C2934;

  --text:               #EFEFEF;
  --text-muted:         #949494;
  --text-subtle:        #5A5A5A;

  --shadow-sm:          0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow-md:          0 4px 18px rgba(0, 0, 0, 0.65);
  --shadow-lg:          0 14px 38px rgba(0, 0, 0, 0.8);

  /* Category accents — slightly desaturated for the darker ground */
  --cat-highcharts:     var(--brand-purple);
  --cat-fintech:        #7C8FFF;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Custom scrollbar ─── */

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--text-subtle);
  background-clip: padding-box;
  border: 2px solid transparent;
}

/* ─── Password gate ─── */

.gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #07080A;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: gate-enter 400ms ease-out;
}

.gate.hidden {
  animation: gate-exit 400ms ease-in forwards;
}

@keyframes gate-enter {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes gate-exit {
  from { opacity: 1; }
  to   { opacity: 0; visibility: hidden; }
}

.gate-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.gate-blob {
  position: absolute;
  width: 720px;
  height: 720px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.55;
  mix-blend-mode: screen;
  will-change: transform;
}

.gate-blob--a {
  background: radial-gradient(circle, #8E5FE0 0%, transparent 65%);
  top: -18%;
  left: -12%;
  animation: drift-a 22s ease-in-out infinite alternate;
}

.gate-blob--b {
  background: radial-gradient(circle, #BB9FFF 0%, transparent 65%);
  bottom: -18%;
  right: -12%;
  animation: drift-b 28s ease-in-out infinite alternate;
}

@keyframes drift-a {
  0%   { transform: translate(0, 0)       scale(1); }
  50%  { transform: translate(80px, -40px) scale(1.1); }
  100% { transform: translate(-60px, 60px) scale(0.95); }
}

@keyframes drift-b {
  0%   { transform: translate(0, 0)        scale(1); }
  50%  { transform: translate(-70px, 40px) scale(0.9); }
  100% { transform: translate(50px, -60px) scale(1.1); }
}

.gate-noise {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.08 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.5;
  pointer-events: none;
}

.gate-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  margin: 0 24px;
  padding: 40px 36px 32px;
  background: rgba(18, 19, 22, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.gate-logo {
  height: 34px;
  width: auto;
  display: block;
  margin: 0 auto 24px;
  filter: invert(1);
}

.gate-title {
  font-size: 18px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 6px;
}

.gate-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 28px;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gate-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.gate-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.gate-input:focus {
  border-color: var(--brand-purple);
  box-shadow: 0 0 0 3px rgba(187, 159, 255, 0.22);
}

.gate-input.error {
  border-color: #F05C56;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

.gate-btn {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--brand-purple) 0%, var(--brand-purple-deep) 100%);
  color: #0B0A12;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
  box-shadow: 0 4px 18px rgba(142, 95, 224, 0.35);
}

.gate-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(142, 95, 224, 0.48);
}

.gate-btn:active {
  transform: translateY(0);
}

.gate-error {
  margin-top: 14px;
  font-size: 12px;
  color: #F05C56;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.gate-error.visible {
  opacity: 1;
}

.gate-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  background: #ffffff;
  color: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.gate-google:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.gate-google svg {
  flex-shrink: 0;
}

.gate-fallback-toggle {
  margin-top: 14px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, 0.2);
  padding: 4px;
}

.gate-fallback-toggle:hover {
  color: rgba(255, 255, 255, 0.75);
}

.gate-form[hidden] {
  display: none;
}

.gate-form:not([hidden]) {
  margin-top: 14px;
}

/* ─── Header ─── */

.header {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 24px;
  z-index: 100;
  backdrop-filter: blur(8px);
}

html[data-theme="dark"] .header {
  background: rgba(12, 13, 16, 0.85);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.header-brand:hover { opacity: 0.75; }

.brand-logo {
  height: 24px;
  width: auto;
  display: block;
  transition: filter var(--transition-fast);
}

html[data-theme="dark"] .brand-logo {
  filter: invert(1);
}

.brand-divider {
  width: 1px;
  height: 16px;
  background: var(--border-strong);
}

.brand-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── Icon button ─── */

.icon-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn.is-success {
  color: #2ECC9A;
}

.icon-btn--header { color: var(--text-muted); }

.header-user {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 4px 0 8px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Theme toggle swap */
.theme-icon { transition: opacity var(--transition-fast), transform var(--transition-med); }
.theme-icon--moon { display: none; }
html[data-theme="dark"] .theme-icon--sun  { display: none; }
html[data-theme="dark"] .theme-icon--moon { display: inline-block; }

/* ─── Layout ─── */

.layout {
  display: flex;
  height: 100vh;
  padding-top: var(--header-h);
}

/* ─── Sidebar ─── */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: width var(--transition-med);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-w);
}

.sidebar-top {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 8px 10px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar.collapsed .sidebar-top {
  padding: 10px 6px;
  justify-content: center;
  border-bottom: none;
}

.search-box {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 30px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  min-width: 0;
}

.search-box:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}

.sidebar.collapsed .search-box { display: none; }

.search-icon {
  color: var(--text-subtle);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  min-width: 0;
}

.search-input::placeholder { color: var(--text-subtle); }
.search-input::-webkit-search-cancel-button { display: none; }

.search-kbd {
  font-family: inherit;
  font-size: 11px;
  color: var(--text-subtle);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  line-height: 1.2;
  pointer-events: none;
}

.search-box:focus-within .search-kbd { opacity: 0; }

.sidebar-toggle {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.sidebar-toggle svg { transition: transform var(--transition-med); }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }

.nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 0 16px;
  transition: opacity var(--transition-fast);
}

.sidebar.collapsed .nav {
  opacity: 0;
  pointer-events: none;
}

/* Category */

.nav-category {
  margin-bottom: 2px;
}

.nav-category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: default;
  user-select: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-category-header.clickable {
  cursor: pointer;
  transition: color var(--transition-fast);
}

.nav-category-header.clickable:hover { color: var(--text); }

.nav-cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--cat);
  flex-shrink: 0;
}

.nav-category-header .nav-cat-label { flex: 1; }

.nav-cat-count {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-subtle);
  letter-spacing: 0;
}

.nav-chevron {
  flex-shrink: 0;
  transition: transform var(--transition-med);
  color: var(--text-subtle);
}

.nav-category-header.open .nav-chevron { transform: rotate(90deg); }

/* Demo list */

.nav-demos {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--transition-med);
}

.nav-demos.open { max-height: 600px; }

.nav-demo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 28px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  line-height: 1.35;
  text-decoration: none;
}

.nav-demo-item:hover { background: var(--bg-hover); }

.nav-demo-item.active {
  background: var(--blue-bg);
  color: var(--blue);
  border-left-color: var(--blue);
  font-weight: 500;
}

.nav-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-subtle);
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.nav-demo-item:hover .nav-dot { background: var(--cat); }
.nav-demo-item.active .nav-dot { background: var(--blue); }

.nav-demo-label { flex: 1; }

.nav-badge {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--bg-hover);
  color: var(--text-muted);
}

.nav-badge--new {
  background: var(--blue-bg);
  color: var(--blue);
}

.nav-badge--draft {
  background: var(--amber-bg);
  color: var(--amber);
}

.nav-badge--featured {
  background: transparent;
  color: var(--cat);
  padding: 0;
}

.nav-empty {
  padding: 4px 16px 8px 28px;
  font-size: 12px;
  color: var(--text-subtle);
  font-style: italic;
}

/* Empty category — visually marked as "coming soon" */
.nav-category--empty .nav-cat-dot       { opacity: 0.35; }
.nav-category--empty .nav-cat-label     { opacity: 0.55; text-decoration: line-through; text-decoration-thickness: 1px; }
.nav-category--empty                    { cursor: default; }

.nav-cat-soon {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 1px 6px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  line-height: 1.4;
}

.nav-no-results {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 12px;
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-subtle);
  letter-spacing: 0.02em;
  transition: opacity var(--transition-fast);
}

.sidebar.collapsed .sidebar-footer { opacity: 0; }

/* ─── Content & toolbar ─── */

.content {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  min-width: 0;
}

.toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--toolbar-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 13px;
}

.toolbar[hidden] { display: none; }

.toolbar-home { margin-right: 2px; }

.breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
}

.breadcrumb-cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--cat);
  flex-shrink: 0;
}

.breadcrumb-cat {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
  cursor: pointer;
}

a.breadcrumb-cat:hover { color: var(--text); }

.breadcrumb-sep {
  color: var(--text-subtle);
  opacity: 0.6;
}

.breadcrumb-current {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

/* ─── Stage (welcome + preview) ─── */

.stage {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Welcome / landing */

.welcome {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 64px clamp(24px, 5vw, 64px) 64px;
  opacity: 1;
  transition: opacity var(--transition-med);
}

.welcome[hidden] {
  display: none;
}

.welcome-hero {
  max-width: 760px;
  margin-bottom: 56px;
}

.welcome-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-bottom: 20px;
  background: var(--bg-elevated);
}

.welcome-eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--cat, var(--blue));
}

.welcome-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  margin-bottom: 16px;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.welcome-back:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.grid-empty {
  padding: 40px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  text-align: center;
  background: var(--bg-elevated);
}

.grid-empty p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.grid-empty-sub {
  margin-top: 6px !important;
  font-size: 12px !important;
  color: var(--text-subtle) !important;
}

.welcome-hero h1 {
  font-size: clamp(28px, 3.6vw, 44px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 14px;
}

.welcome-hero h1 em {
  font-style: normal;
  background: linear-gradient(135deg, var(--blue) 0%, #8E5FE0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-hero p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 540px;
}

/* Grid sections */

.grid-section { margin-bottom: 44px; }

.grid-section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.grid-section-head h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.grid-section-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Card */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 20px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--transition-med), box-shadow var(--transition-med), border-color var(--transition-med);
  text-align: left;
  font: inherit;
  color: inherit;
  appearance: none;
  text-decoration: none;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cat), transparent 80%);
  opacity: 0.9;
}

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, var(--cat) 0%, transparent 55%);
  opacity: 0;
  transition: opacity var(--transition-med);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--cat) 35%, var(--border));
}

.card:hover::after { opacity: 0.06; }

.card:focus-visible {
  outline: 2px solid var(--cat);
  outline-offset: 2px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.card-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--cat) 12%, transparent);
  color: var(--cat);
  flex-shrink: 0;
}

.card-cat {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cat);
  flex: 1;
}

.card-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1.2;
  flex-shrink: 0;
}

.card-badge--featured {
  background: color-mix(in srgb, var(--cat) 14%, transparent);
  color: var(--cat);
}

.card-badge--new {
  background: var(--blue-bg);
  color: var(--blue);
}

.card-badge--draft {
  background: var(--amber-bg);
  color: var(--amber);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}

.card-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
  flex: 1;
}

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--cat);
  position: relative;
  z-index: 1;
  margin-top: 2px;
}

.card-cta svg {
  transition: transform var(--transition-med);
}

.card:hover .card-cta svg {
  transform: translateX(3px);
}

/* Soon chips */

.soon-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 28px;
  border-top: 1px dashed var(--border);
  margin-top: 12px;
}

.soon-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.soon-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.soon-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
}

.soon-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--cat);
  opacity: 0.6;
}

/* ─── Preview (iframe + skeleton) ─── */

.preview {
  position: absolute;
  inset: 0;
  display: none;
  background: var(--bg);
}

.preview.visible { display: block; }

.preview-skeleton {
  position: absolute;
  inset: 0;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.preview.loading .preview-skeleton {
  opacity: 1;
}

.skeleton-bar {
  height: 28px;
  width: 40%;
  min-width: 200px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-hover) 0%, var(--bg-active) 50%, var(--bg-hover) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 16px;
}

.skeleton-block {
  border-radius: 10px;
  background: linear-gradient(90deg, var(--bg-hover) 0%, var(--bg-active) 50%, var(--bg-hover) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-block--wide { grid-column: span 2; }
.skeleton-block--tall { grid-row: span 2; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.demo-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  opacity: 0;
  transition: opacity 280ms ease-out;
  background: var(--bg);
}

.preview:not(.loading) .demo-frame { opacity: 1; }

/* ─── Toast ─── */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med), transform var(--transition-med);
  z-index: 500;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ─── Fullscreen ─── */

body.fullscreen .header,
body.fullscreen .sidebar,
body.fullscreen .toolbar {
  display: none;
}

body.fullscreen .layout { padding-top: 0; }
body.fullscreen .layout { height: 100vh; }

/* ─── Reduced motion ─── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .gate-blob { animation: none; }
}

/* ─── Share modal (admin) ─── */

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.share-modal[hidden] {
  display: none;
}

.share-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.share-modal-box {
  position: relative;
  width: 100%;
  max-width: 580px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.share-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.share-modal-head h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.share-form-section,
.share-list-section {
  padding: 20px 22px;
}

.share-list-section {
  border-top: 1px solid var(--border);
  flex: 1;
  overflow-y: auto;
  background: var(--bg-elevated);
}

.share-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.share-refresh {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

.share-refresh:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.share-form {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
}

.share-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.share-field--full {
  grid-column: 1 / -1;
}

.share-field-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.share-select,
.share-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.share-select:focus,
.share-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}

.share-generate-btn {
  grid-column: 1 / -1;
  padding: 11px 18px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.share-generate-btn:hover:not(:disabled) {
  background: var(--blue-hover);
}

.share-generate-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.share-result {
  margin-top: 16px;
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.share-result-row {
  display: flex;
  gap: 8px;
}

.share-result-url {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 12px;
  outline: none;
}

.share-result-copy {
  padding: 8px 16px;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.share-result-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.share-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-list-empty {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 0;
  margin: 0;
}

.share-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.share-row-main {
  flex: 1;
  min-width: 0;
}

.share-row-demo {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-row-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.share-status {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.share-status--active {
  background: rgba(46, 204, 154, 0.15);
  color: #2ECC9A;
}

.share-status--expired {
  background: var(--bg-active);
  color: var(--text-muted);
}

.share-status--revoked {
  background: rgba(240, 92, 86, 0.15);
  color: #F05C56;
}

.share-row-tag {
  display: inline-block;
  padding: 1px 6px;
  margin-left: 4px;
  background: var(--bg-active);
  color: var(--text-muted);
  border-radius: 4px;
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 500;
}

.share-row-copy {
  padding: 6px 10px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}

.share-row-copy:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.share-revoke {
  padding: 6px 12px;
  background: transparent;
  color: #F05C56;
  border: 1px solid rgba(240, 92, 86, 0.4);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.share-revoke:hover:not(:disabled) {
  background: rgba(240, 92, 86, 0.1);
}

.share-revoke:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ─── Responsive ─── */

@media (max-width: 720px) {
  .welcome { padding: 32px 20px; }
  .welcome-hero { margin-bottom: 36px; }
  .demo-grid { grid-template-columns: 1fr; }
  .search-kbd { display: none; }
  .share-form { grid-template-columns: 1fr; }
  .share-row { flex-wrap: wrap; }
  .header-user { max-width: 120px; }
}
