/*
 * iHub Marketplace website.
 * Colors, radii, and spacing mirror the Tailwind classes of the iHub admin
 * marketplace (AdminMarketplacePage, MarketplaceItemCard, MarketplaceItemDetail),
 * so the site looks like the page administrators know from the product.
 */

@font-face {
  font-family: 'Inter var';
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  src: url('fonts/Inter-roman.var.woff2') format('woff2');
}

:root {
  --header-bg: #003557;
  --header-fg: #ffffff;
  --header-muted: rgba(255, 255, 255, 0.72);

  --bg: #f9fafb;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f9fafb;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --text-soft: #4b5563;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-fg: #ffffff;
  --primary-soft: #dbeafe;
  --primary-soft-fg: #1d4ed8;
  --focus: #2563eb;
  --card-hover-border: #93c5fd;

  --tag-bg: #f3f4f6;
  --tag-fg: #4b5563;
  --code-bg: #f3f4f6;
  --backdrop: rgba(0, 0, 0, 0.4);

  --badge-app-bg: #dbeafe;
  --badge-app-fg: #1e40af;
  --badge-model-bg: #dcfce7;
  --badge-model-fg: #166534;
  --badge-prompt-bg: #f3e8ff;
  --badge-prompt-fg: #6b21a8;
  --badge-skill-bg: #fef3c7;
  --badge-skill-fg: #92400e;
  --badge-workflow-bg: #cffafe;
  --badge-workflow-fg: #155e75;

  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

  --radius: 0.5rem;
  --radius-lg: 0.75rem;

  color-scheme: light;
}

:root.dark {
  --header-bg: #002640;

  --bg: #111827;
  --bg-alt: #0b1220;
  --surface: #1f2937;
  --surface-muted: #111827;
  --border: #374151;
  --border-strong: #4b5563;
  --text: #f9fafb;
  --text-muted: #9ca3af;
  --text-faint: #6b7280;
  --text-soft: #d1d5db;

  --primary: #2563eb;
  --primary-hover: #3b82f6;
  --primary-soft: rgba(30, 58, 138, 0.4);
  --primary-soft-fg: #93c5fd;
  --focus: #60a5fa;
  --card-hover-border: #2563eb;

  --tag-bg: #374151;
  --tag-fg: #9ca3af;
  --code-bg: #111827;
  --backdrop: rgba(0, 0, 0, 0.6);

  --badge-app-bg: rgba(30, 58, 138, 0.4);
  --badge-app-fg: #93c5fd;
  --badge-model-bg: rgba(20, 83, 45, 0.4);
  --badge-model-fg: #86efac;
  --badge-prompt-bg: rgba(88, 28, 135, 0.4);
  --badge-prompt-fg: #d8b4fe;
  --badge-skill-bg: rgba(120, 53, 15, 0.4);
  --badge-skill-fg: #fcd34d;
  --badge-workflow-bg: rgba(22, 78, 99, 0.4);
  --badge-workflow-fg: #67e8f9;

  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family:
    'Inter var',
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body.no-scroll {
  overflow: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  z-index: 100;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-md);
}

.skip-link:focus {
  top: 0.5rem;
}

.font-light {
  font-weight: 300;
}

.font-extrabold {
  font-weight: 800;
}

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

.small {
  font-size: 0.875rem;
}

.container {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .container {
    padding: 0 1.5rem;
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 2rem;
  }
}

/* ---------- Header ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--header-bg);
  color: var(--header-fg);
}

.topbar-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0.625rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  margin-right: auto;
  min-width: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  flex: none;
  background: #ffffff;
  border-radius: 0.5rem;
  padding: 0.25rem;
  width: 2.5rem;
  height: 2.25rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-size: 1.125rem;
  line-height: 1.2;
  white-space: nowrap;
}

.brand-tagline {
  font-size: 0.75rem;
  color: var(--header-muted);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.topnav a {
  color: var(--header-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.topnav a:hover {
  color: var(--header-fg);
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.topnav-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.5rem;
}

.icon-btn,
.pill-btn {
  border: 0;
  background: transparent;
  color: var(--header-fg);
  cursor: pointer;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
}

.icon-btn {
  width: 2.25rem;
  height: 2.25rem;
}

.pill-btn {
  height: 2rem;
  padding: 0 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.icon-btn:hover,
.pill-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.icon-sun {
  display: none;
}

.dark .icon-sun {
  display: block;
}

.dark .icon-moon {
  display: none;
}

.menu-toggle {
  display: none;
}

@media (max-width: 860px) {
  .menu-toggle {
    display: inline-flex;
  }

  .topnav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 1rem 1rem;
    background: var(--header-bg);
    box-shadow: var(--shadow-md);
  }

  .topnav.open {
    display: flex;
  }

  .topnav a {
    padding: 0.75rem;
  }

  .topnav-tools {
    margin: 0.5rem 0 0;
    gap: 0.5rem;
  }
}

/* ---------- Hero ---------- */

.hero {
  background: var(--header-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2.5rem 0 3rem;
}

.hero-inner {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 960px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 2.5rem;
  }
}

.hero-copy {
  color: var(--header-fg);
  padding-bottom: 1rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lead {
  margin: 1rem 0 1.5rem;
  font-size: 1.0625rem;
  color: var(--header-muted);
  max-width: 40rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero .btn-secondary {
  background: transparent;
  color: var(--header-fg);
  border-color: rgba(255, 255, 255, 0.45);
}

.hero .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-xl);
}

.hero-card-label {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-soft);
}

.hero-card-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 1.25rem 0 0;
}

@media (max-width: 480px) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.stat {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: var(--radius);
  padding: 0.625rem 0.25rem;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat:hover {
  border-color: var(--card-hover-border);
}

.stat-value {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---------- Copy fields and code ---------- */

.copy-field,
.code-block {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  border: 1px solid var(--border);
  background: var(--code-bg);
  border-radius: var(--radius);
  padding: 0.375rem 0.375rem 0.375rem 0.75rem;
}

.code-block {
  margin-top: 0.75rem;
}

.copy-field code,
.code-block code {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  align-self: center;
  overflow-wrap: anywhere;
  color: var(--text);
}

.copy-btn {
  flex: none;
  align-self: center;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: 0.375rem;
  padding: 0.25rem 0.625rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  min-width: 4.5rem;
}

.copy-btn:hover {
  background: var(--surface-muted);
}

.copy-btn.copied {
  color: #15803d;
  border-color: #86efac;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary,
.btn-outline {
  background: var(--surface);
  color: var(--text-soft);
  border-color: var(--border-strong);
}

.btn-secondary:hover,
.btn-outline:hover {
  background: var(--surface-muted);
}

.btn-outline.connected {
  border-color: #86efac;
  color: #15803d;
}

.dark .btn-outline.connected {
  border-color: #166534;
  color: #86efac;
}

.btn-link {
  background: transparent;
  color: var(--text-muted);
  padding-left: 0;
  padding-right: 0;
}

.btn-link:hover {
  color: #dc2626;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  border-radius: var(--radius);
}

/* ---------- Sections ---------- */

.section {
  padding: 2rem 0 3rem;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.page-header h2,
.section-heading h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.page-header p,
.section-heading p {
  margin: 0.25rem 0 0;
}

.section-heading {
  margin-bottom: 1.5rem;
}

/* ---------- Type tabs (MarketplaceTypeTabs) ---------- */

.type-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.type-tab {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-muted);
  cursor: pointer;
}

.type-tab:hover {
  color: var(--text);
}

.type-tab[aria-pressed='true'] {
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.dark .type-tab[aria-pressed='true'] {
  color: #60a5fa;
}

.count-pill {
  padding: 0.125rem 0.375rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--tag-bg);
  color: var(--tag-fg);
}

.type-tab[aria-pressed='true'] .count-pill {
  background: var(--primary-soft);
  color: var(--primary-soft-fg);
}

/* ---------- Filter bar ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0 0.75rem;
}

.input {
  font: inherit;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  min-height: 2.375rem;
}

.input.grow {
  flex: 1;
  min-width: 12rem;
}

.result-count {
  margin: 0 0 1rem;
  font-size: 0.8125rem;
}

/* ---------- Card grid (MarketplaceItemCard) ---------- */

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  cursor: pointer;
  transition:
    box-shadow 0.15s,
    border-color 0.15s;
}

.card:hover,
.card:focus-within {
  box-shadow: var(--shadow-md);
  border-color: var(--card-hover-border);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--tag-fg);
}

.badge-app {
  background: var(--badge-app-bg);
  color: var(--badge-app-fg);
}

.badge-model {
  background: var(--badge-model-bg);
  color: var(--badge-model-fg);
}

.badge-prompt {
  background: var(--badge-prompt-bg);
  color: var(--badge-prompt-fg);
}

.badge-skill {
  background: var(--badge-skill-bg);
  color: var(--badge-skill-fg);
}

.badge-workflow {
  background: var(--badge-workflow-bg);
  color: var(--badge-workflow-fg);
}

.version {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title a {
  color: var(--text);
}

.card-title a:hover {
  text-decoration: none;
}

.card-title a:focus-visible {
  outline: none;
}

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

.card-desc {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  min-height: 2.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.tag {
  padding: 0.125rem 0.5rem;
  background: var(--tag-bg);
  color: var(--tag-fg);
  border-radius: 0.25rem;
  font-size: 0.75rem;
}

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.author {
  font-size: 0.75rem;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- States ---------- */

.loading {
  display: flex;
  justify-content: center;
  padding: 4rem 0;
}

.spinner {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 2px solid transparent;
  border-bottom-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}

.empty-state p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-soft);
}

.page-btn {
  font: inherit;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.25rem;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ---------- Getting started ---------- */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 960px) {
  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-soft-fg);
  font-weight: 700;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.step h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.step p {
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
  color: var(--text-soft);
}

.step p.muted {
  color: var(--text-muted);
}

.step-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 0.75rem !important;
  font-size: 0.875rem !important;
}

.contribute {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.contribute h3 {
  font-size: 1.0625rem;
  font-weight: 600;
}

.contribute p {
  margin: 0.25rem 0 0;
}

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.5rem 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer p {
  margin: 0;
}

.powered {
  font-weight: 600;
  font-size: 0.9375rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.875rem;
}

.footer-links a {
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--text);
}

/* ---------- Detail drawer (MarketplaceItemDetail) ---------- */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
}

.drawer-backdrop {
  flex: 1;
  background: var(--backdrop);
}

.drawer-panel {
  width: 100%;
  max-width: 42rem;
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slide-in 0.2s ease-out;
}

.drawer-panel:focus {
  outline: none;
}

@keyframes slide-in {
  from {
    transform: translateX(2rem);
    opacity: 0;
  }
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.drawer-heading {
  flex: 1;
  min-width: 0;
  margin-right: 1rem;
}

.drawer-heading .badge-row {
  margin-bottom: 0.5rem;
}

.drawer-heading h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.drawer-heading p {
  margin: 0.125rem 0 0;
}

.close-btn {
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}

.close-btn:hover {
  color: var(--text);
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}

.drawer-tabs {
  display: flex;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.drawer-tab {
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-muted);
  cursor: pointer;
}

.drawer-tab:hover {
  color: var(--text);
}

.drawer-tab[aria-selected='true'] {
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.dark .drawer-tab[aria-selected='true'] {
  color: #60a5fa;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.detail-section + .detail-section {
  margin-top: 1.5rem;
}

.detail-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 0.5rem;
}

.detail-section p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text-soft);
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail-tags .tag {
  border-radius: 999px;
  padding: 0.25rem 0.625rem;
  font-size: 0.875rem;
}

.install-box {
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  background: var(--surface-muted);
}

.install-box p + p {
  margin-top: 0.5rem;
}

.meta-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.875rem;
}

.meta-row dt {
  color: var(--text-muted);
  flex: none;
}

.meta-row dd {
  margin: 0;
  color: var(--text);
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}

.meta-row.stacked {
  flex-direction: column;
  gap: 0.25rem;
}

.meta-row.stacked dd {
  text-align: left;
  color: var(--text-soft);
  line-height: 1.6;
}

.meta-row code {
  font-size: 0.8125rem;
}

.json-preview {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.6;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-soft);
}

.json-key {
  color: #1d4ed8;
}

.json-string {
  color: #15803d;
}

.json-number,
.json-literal {
  color: #b45309;
}

.dark .json-key {
  color: #93c5fd;
}

.dark .json-string {
  color: #86efac;
}

.dark .json-number,
.dark .json-literal {
  color: #fcd34d;
}

/* Markdown preview for SKILL.md (Tailwind "prose" equivalent) */
.prose {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-soft);
  margin-top: 1rem;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  color: var(--text);
  margin: 1.5em 0 0.5em;
  line-height: 1.3;
}

.prose h1 {
  font-size: 1.5rem;
  margin-top: 0;
}

.prose h2 {
  font-size: 1.2rem;
}

.prose h3 {
  font-size: 1.05rem;
}

.prose h4 {
  font-size: 0.95rem;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose table,
.prose pre {
  margin: 0 0 1em;
}

.prose ul,
.prose ol {
  padding-left: 1.5em;
}

.prose li + li {
  margin-top: 0.25em;
}

.prose strong {
  color: var(--text);
}

.prose code {
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 0.25rem;
}

.prose pre {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  overflow-x: auto;
}

.prose pre code {
  background: transparent;
  padding: 0;
}

.prose blockquote {
  border-left: 3px solid var(--border-strong);
  padding-left: 1em;
  color: var(--text-muted);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 0.375rem 0.625rem;
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--surface-muted);
  color: var(--text);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.5em 0;
}

/* ---------- Connect dialog ---------- */

.modal {
  width: min(28rem, calc(100% - 2rem));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xl);
}

.modal::backdrop {
  background: var(--backdrop);
}

.modal h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.modal p {
  margin: 0 0 1rem;
}

.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
}

.modal .input {
  width: 100%;
}

.field-error {
  color: #dc2626;
  font-size: 0.8125rem;
  margin: 0.375rem 0 0 !important;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.spacer {
  flex: 1;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 60;
  background: #111827;
  color: #ffffff;
  padding: 0.625rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  box-shadow: var(--shadow-xl);
}

.dark .toast {
  background: #f9fafb;
  color: #111827;
}
