:root {
  color-scheme: dark;
  --sw-background: oklch(0.16 0.015 260);
  --sw-foreground: oklch(0.95 0.01 100);
  --sw-card: oklch(0.20 0.018 260);
  --sw-muted: oklch(0.24 0.018 260);
  --sw-muted-foreground: oklch(0.76 0.02 260);
  --sw-primary: oklch(0.72 0.17 50);
  --sw-primary-foreground: oklch(0.18 0.02 50);
  --sw-secondary: oklch(0.26 0.02 260);
  --sw-accent: oklch(0.30 0.04 250);
  --sw-ember: oklch(0.72 0.18 45);
  --sw-ember-glow: oklch(0.72 0.18 45);
  --sw-success: oklch(0.70 0.16 155);
  --sw-warning: oklch(0.80 0.16 85);
  --sw-info: oklch(0.70 0.13 230);
  --sw-destructive: oklch(0.62 0.22 25);
  --sw-border: oklch(0.28 0.02 260);
  --sw-input: oklch(0.26 0.02 260);
  --sw-sidebar: oklch(0.14 0.015 260);
  --sw-sidebar-accent: oklch(0.22 0.02 260);
  --sw-radius: 0.5rem;
  --sw-ember-shadow: 0 10px 34px -18px color-mix(in oklch, var(--sw-ember-glow), transparent 44%);
  font-family: "Segoe UI", "Aptos", system-ui, sans-serif;
  font-feature-settings: "cv11", "ss01";
}

html,
body {
  margin: 0;
  min-height: 100%;
  background-color: var(--sw-background);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, color-mix(in oklab, var(--sw-ember) 12%, transparent), transparent),
    radial-gradient(1000px 500px at -10% 110%, color-mix(in oklab, var(--sw-info) 10%, transparent), transparent);
  background-attachment: fixed;
  color: var(--sw-foreground);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(color-mix(in oklch, var(--sw-border), transparent 34%) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in oklch, var(--sw-border), transparent 34%) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, black, transparent 76%);
  opacity: 0.08;
}

a {
  color: var(--sw-ember-glow);
}

.sw-shell {
  min-height: 100vh;
}

.sw-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  min-height: 3.5rem;
  padding: 0.65rem clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid var(--sw-border);
  background: color-mix(in oklab, var(--sw-background) 80%, transparent);
  backdrop-filter: blur(12px);
}

.sw-brand {
  color: var(--sw-foreground) !important;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
}

.sw-nav,
.sw-top-actions,
.sw-action-row,
.sw-footer,
.sw-docs-navlinks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.sw-nav a,
.sw-sidebar-link,
.sw-toc a,
.sw-footer a {
  color: var(--sw-muted-foreground) !important;
  text-decoration: none;
}

.sw-nav a {
  padding: 0.38rem 0.65rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

.sw-nav a:hover,
.sw-sidebar-link:hover,
.sw-toc a:hover {
  background: color-mix(in oklch, var(--sw-accent), transparent 28%);
  color: var(--sw-foreground) !important;
}

.sw-main,
.sw-docs-main,
.sw-app-main {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}

.sw-page {
  padding: clamp(2rem, 5vw, 3rem) 0;
}

.sw-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(16rem, 0.7fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  min-height: 42vh;
}

.sw-hero h1,
.sw-page-header h1 {
  max-width: 16ch;
  color: var(--sw-foreground);
  font-size: clamp(2.25rem, 5vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.sw-hero-copy,
.sw-section-lede,
.sw-page-header p {
  max-width: 66ch;
  color: var(--sw-muted-foreground);
}

.sw-hero-copy,
.sw-section-lede,
.sw-page-header p,
.mud-typography-body1,
.mud-typography-body2 {
  color: var(--sw-muted-foreground);
}

.sw-feature-card .mud-typography-h5,
.sw-lovable-card .mud-typography-h5,
.sw-settings-panel .mud-typography-h5,
.sw-forge-panel .mud-typography-h5 {
  color: var(--sw-foreground);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sw-docs-content > .sw-section-header:first-child .mud-typography-h2 {
  color: var(--sw-foreground);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.035em;
}

.sw-doc-section .mud-typography-h2 {
  color: var(--sw-foreground);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.mud-button-filled-primary {
  background-color: var(--sw-primary) !important;
  color: var(--sw-primary-foreground) !important;
  box-shadow: 0 1px 0 color-mix(in oklch, white, transparent 82%) inset;
}

.mud-button-outlined-primary,
.mud-button-text-primary {
  border-color: color-mix(in oklch, var(--sw-primary), transparent 45%) !important;
  color: var(--sw-primary) !important;
}

.mud-button-root {
  border-radius: 0.375rem !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em;
}

.sw-eyebrow {
  margin: 0 0 0.65rem;
  color: var(--sw-ember-glow);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sw-forge-panel,
.sw-feature-card,
.sw-callout,
.sw-empty-state,
.sw-metric-card {
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  background: var(--sw-card);
  box-shadow: none;
}

.sw-forge-panel.glow-ember,
.sw-feature-card.glow-ember,
.sw-lovable-preview-header {
  box-shadow: var(--sw-ember-shadow);
}

.sw-forge-panel {
  min-height: 15rem;
  padding: 1.25rem;
}

.sw-section-grid,
.sw-metric-grid {
  margin-top: 2rem;
}

.sw-feature-card {
  height: 100%;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.sw-feature-card-lite {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sw-mobile-scroll-table {
  contain: inline-size;
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.sw-feature-card:hover {
  border-color: color-mix(in oklch, var(--sw-ember), transparent 60%);
}

.sw-feature-icon {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 1rem;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in oklch, var(--sw-ember), transparent 82%);
  color: var(--sw-ember-glow);
}

.sw-status-badge {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  width: max-content;
  padding: 0.3rem 0.55rem;
  border: 1px solid color-mix(in oklch, var(--sw-border), transparent 12%);
  border-radius: 999px;
  color: var(--sw-foreground);
  font-size: 0.78rem;
  font-weight: 700;
}

.sw-status-dot {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 999px;
  background: var(--sw-info);
}

.sw-status-success .sw-status-dot {
  background: var(--sw-success);
}

.sw-status-success {
  border-color: color-mix(in oklch, var(--sw-success), transparent 72%);
  background: color-mix(in oklch, var(--sw-success), transparent 90%);
  color: color-mix(in oklch, var(--sw-success), white 18%);
}

.sw-status-warning .sw-status-dot {
  background: var(--sw-warning);
}

.sw-status-warning {
  border-color: color-mix(in oklch, var(--sw-warning), transparent 72%);
  background: color-mix(in oklch, var(--sw-warning), transparent 90%);
  color: color-mix(in oklch, var(--sw-warning), white 18%);
}

.sw-status-danger .sw-status-dot {
  background: var(--sw-ember);
}

.sw-status-danger {
  border-color: color-mix(in oklch, var(--sw-ember), transparent 68%);
  background: color-mix(in oklch, var(--sw-ember), transparent 88%);
  color: color-mix(in oklch, var(--sw-ember), white 16%);
}

.sw-status-info {
  border-color: color-mix(in oklch, var(--sw-info), transparent 72%);
  background: color-mix(in oklch, var(--sw-info), transparent 90%);
  color: color-mix(in oklch, var(--sw-info), white 18%);
}

.sw-callout {
  margin: 1.25rem 0;
  padding: 0.85rem 1rem;
}

.sw-section-header {
  margin-bottom: 1rem;
}

.sw-docs-frame,
.sw-app-frame {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: 1.25rem;
  width: min(1440px, calc(100% - 2rem));
  margin-inline: auto;
  padding-top: 1.5rem;
}

.sw-app-frame {
  grid-template-columns: 13rem minmax(0, 1fr);
}

.sw-app-frame:has(.sw-guild-sidebar) {
  grid-template-columns: 13rem 13rem minmax(0, 1fr);
}

.sw-docs-sidebar,
.sw-app-sidebar,
.sw-guild-sidebar,
.sw-toc {
  position: sticky;
  top: 5rem;
  align-self: start;
  padding: 0.9rem;
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  background: color-mix(in oklch, var(--sw-card), transparent 8%);
}

.sw-sidebar-link,
.sw-toc a {
  display: block;
  margin: 0.08rem 0;
  padding: 0.35rem 0.45rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

.sw-docs-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14rem;
  gap: 1.5rem;
  padding-top: 1rem;
}

.sw-doc-section {
  scroll-margin-top: 6rem;
  margin: 2.1rem 0;
}

.sw-docs-paragraph {
  color: var(--sw-muted-foreground);
  max-width: 74ch;
  line-height: 1.65;
}

.sw-docs-table {
  overflow: hidden;
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  background: var(--sw-card) !important;
}

.sw-docs-table .mud-table-root,
.sw-docs-table .mud-table-container,
.sw-docs-table .mud-table,
.sw-docs-table table,
.sw-docs-table thead,
.sw-docs-table tbody,
.sw-docs-table tr,
.sw-docs-table td,
.sw-docs-table th {
  background: transparent !important;
  color: var(--sw-foreground) !important;
}

.sw-docs-table th {
  color: var(--sw-muted-foreground) !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em;
}

.sw-docs-table td,
.sw-docs-table th {
  border-color: color-mix(in oklch, var(--sw-border), transparent 18%) !important;
}

.sw-docs-table td {
  color: var(--sw-muted-foreground) !important;
}

.sw-docs-table td:first-child {
  color: var(--sw-foreground) !important;
  font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 0.78rem;
}

.sw-code {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  background: color-mix(in oklch, black, var(--sw-background) 24%);
  color: var(--sw-foreground);
  font-size: 0.78rem;
  line-height: 1.65;
}

.sw-empty-state,
.sw-metric-card,
.sw-guild-card,
.sw-module-card,
.sw-settings-panel {
  height: 100%;
  padding: 1rem;
}

.sw-guild-picker {
  margin: 1.5rem 0;
}

.sw-guild-card {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  border: 1px solid color-mix(in oklch, var(--sw-border), transparent 8%);
  border-radius: var(--sw-radius);
  background: color-mix(in oklch, var(--sw-card), transparent 10%);
}

.sw-guild-settings {
  display: grid;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.sw-settings-summary,
.sw-module-grid,
.sw-control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.sw-module-grid,
.sw-control-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1rem;
}

.sw-module-card,
.sw-settings-panel,
.sw-control-shell {
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  background: var(--sw-card);
}

.sw-module-card-header {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
}

.sw-control-shell {
  display: grid;
  gap: 0.5rem;
  padding: 1rem;
}

.sw-control-shell label,
.sw-disabled-control {
  color: var(--sw-foreground);
  font-weight: 700;
}

.sw-control-shell input,
.sw-control-shell select,
.sw-control-shell textarea {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  background: color-mix(in oklch, var(--sw-input), transparent 8%);
  color: var(--sw-foreground);
}

.sw-control-shell textarea {
  min-height: 5rem;
  padding-block: 0.7rem;
  resize: vertical;
}

.sw-control-shell input:disabled,
.sw-control-shell textarea:disabled {
  opacity: 0.78;
}

.sw-control-shell small {
  color: var(--sw-muted-foreground);
}

.sw-disabled-control {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.sw-page-header {
  display: flex;
  gap: 1rem;
  align-items: start;
  justify-content: space-between;
}

.sw-lovable-preview {
  display: grid;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.sw-lovable-preview-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem;
  border: 1px solid color-mix(in oklch, var(--sw-ember), transparent 66%);
  border-radius: var(--sw-radius);
  background:
    radial-gradient(560px 180px at 0% 0%, color-mix(in oklch, var(--sw-ember), transparent 90%), transparent),
    var(--sw-card);
}

.sw-lovable-card {
  padding: 1rem;
  border-color: var(--sw-border);
}

.sw-pending-banner {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.7rem 0.85rem;
  border: 1px solid color-mix(in oklch, var(--sw-warning), transparent 72%);
  border-radius: var(--sw-radius);
  background: color-mix(in oklch, var(--sw-warning), transparent 90%);
  color: color-mix(in oklch, var(--sw-warning), white 18%);
  font-size: 0.78rem;
}

.sw-pending-banner::before {
  width: 0.42rem;
  height: 0.42rem;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.sw-table-shell {
  overflow-x: auto;
  margin-top: 1rem;
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  background: color-mix(in oklch, var(--sw-card), transparent 5%);
}

.sw-table-shell table {
  width: 100%;
  border-collapse: collapse;
}

.sw-table-shell th,
.sw-table-shell td {
  padding: 0.75rem;
  border-bottom: 1px solid color-mix(in oklch, var(--sw-border), transparent 18%);
  text-align: left;
  vertical-align: top;
}

.sw-table-shell th {
  color: var(--sw-muted-foreground);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sw-lovable-preview .mud-button:disabled,
.sw-lovable-preview .mud-button-root.mud-disabled,
.sw-lovable-preview button:disabled {
  border-color: color-mix(in oklch, var(--sw-border), white 18%) !important;
  color: color-mix(in oklch, var(--sw-muted-foreground), white 22%) !important;
  background: color-mix(in oklch, var(--sw-muted), transparent 28%) !important;
  opacity: 0.72 !important;
}

.sw-footer {
  justify-content: center;
  padding: 2rem 1rem;
  color: var(--sw-muted-foreground);
}

@media (max-width: 960px) {
  .sw-topbar,
  .sw-page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .sw-hero,
  .sw-docs-frame,
  .sw-app-frame,
  .sw-app-frame:has(.sw-guild-sidebar),
  .sw-docs-page,
  .sw-settings-summary,
  .sw-module-grid,
  .sw-control-grid {
    grid-template-columns: 1fr;
  }

  .sw-docs-sidebar,
  .sw-app-sidebar,
  .sw-guild-sidebar,
  .sw-toc {
    position: static;
  }
}

/* Lovable visual-port overrides: keep Shardwright behavior, but let the
   generated Tailwind/shadcn stylesheet own the visible shell and primitives. */
:root {
  --sw-background: var(--background);
  --sw-foreground: var(--foreground);
  --sw-card: var(--card);
  --sw-muted: var(--muted);
  --sw-muted-foreground: var(--muted-foreground);
  --sw-primary: var(--primary);
  --sw-primary-foreground: var(--primary-foreground);
  --sw-accent: var(--accent);
  --sw-border: var(--border);
  --sw-input: var(--input);
  --sw-ember: var(--ember);
  --sw-sidebar: var(--sidebar);
  --sw-sidebar-accent: var(--sidebar-accent);
  --sw-radius: var(--radius);
}

a {
  color: inherit;
  text-decoration: none;
}

.mud-typography,
.mud-input,
.mud-input-control,
.mud-select,
.mud-table,
.mud-table-root {
  color: inherit !important;
}

.mud-paper,
.mud-card,
.mud-table {
  color: var(--foreground) !important;
  background: transparent !important;
  box-shadow: none !important;
}

.mud-button-root,
.sw-action-row .mud-button-root {
  display: inline-flex !important;
  height: 2.25rem !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: calc(var(--radius) - 2px) !important;
  padding-inline: 1rem !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.mud-button-filled-primary {
  background: var(--primary) !important;
  color: var(--primary-foreground) !important;
}

.mud-button-outlined-primary,
.mud-button-text-primary {
  border: 1px solid var(--input) !important;
  background: var(--background) !important;
  color: var(--foreground) !important;
}

.mud-button-filled-warning {
  background: var(--warning) !important;
  color: var(--background) !important;
}

.sw-page {
  width: min(80rem, calc(100% - 2rem));
  margin-inline: auto;
  padding: 0;
}

.sw-hero {
  width: 100%;
  min-height: auto;
  margin: 0 auto;
  padding: 3rem 0;
}

.sw-page[data-route-id="invite"],
.sw-page[data-route-id="login"] {
  width: min(48rem, calc(100% - 2rem));
}

.sw-page[data-route-id="invite"] .sw-hero,
.sw-page[data-route-id="login"] .sw-hero {
  min-height: min(60vh, 42rem);
}

.sw-lovable-preview {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.sw-lovable-preview-header,
.sw-settings-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 1rem;
}

.sw-lovable-preview-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  box-shadow: none;
}

.sw-lovable-preview-header .mud-typography-h4,
.sw-settings-panel .mud-typography-h4,
.sw-settings-panel .mud-typography-h5 {
  color: var(--foreground);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
}

.sw-lovable-preview-header .mud-typography-body2,
.sw-settings-panel .mud-typography-body2 {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.sw-metric-grid,
.sw-section-grid,
.sw-settings-summary,
.sw-module-grid,
.sw-control-grid {
  display: grid;
  gap: 0.75rem;
}

.mud-grid.sw-metric-grid,
.mud-grid.sw-section-grid {
  width: 100%;
  margin: 0;
}

.sw-metric-grid > .mud-grid-item,
.sw-section-grid > .mud-grid-item {
  width: auto;
  max-width: none;
  flex-basis: auto;
  padding: 0 !important;
}

.sw-metric-grid,
.sw-settings-summary {
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.sw-section-grid,
.sw-module-grid,
.sw-control-grid {
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.sw-feature-card,
.sw-lovable-card,
.sw-module-card,
.sw-empty-state,
.sw-guild-card,
.sw-forge-panel {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  background: var(--card) !important;
  box-shadow: none !important;
}

.sw-module-card,
.sw-feature-card,
.sw-lovable-card {
  padding: 1.125rem;
}

.sw-module-card-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.sw-pending-banner {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  border: 1px solid color-mix(in oklch, var(--warning), transparent 70%);
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--warning), transparent 90%);
  padding: 0.75rem 1rem;
  color: var(--warning);
  font-size: 0.875rem;
}

.sw-control-shell {
  display: grid;
  gap: 0.35rem;
}

.sw-control-shell label {
  font-size: 0.875rem;
  font-weight: 500;
}

.sw-control-shell input,
.sw-control-shell select,
.sw-control-shell textarea {
  width: 100%;
  min-height: 2.25rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in oklch, var(--background), white 3%);
  padding: 0.45rem 0.75rem;
  color: var(--foreground);
  font-size: 0.875rem;
}

.sw-control-shell small {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.sw-disabled-control {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.sw-table-shell {
  border-color: var(--border);
  background: var(--card);
}

.sw-table-shell th {
  background: color-mix(in oklch, var(--muted), transparent 70%);
  color: var(--muted-foreground);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
}

button:disabled {
  border-color: var(--border);
  background: color-mix(in oklch, var(--muted), transparent 35%);
  color: var(--muted-foreground);
}

input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

.sw-docs-visual-frame {
  display: grid;
  width: 100%;
  max-width: 80rem;
  margin-inline: auto;
  gap: 1.5rem;
  padding: 3rem 1rem;
  grid-template-columns: 220px minmax(0, 1fr);
}

.sw-docs-route-visual {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr) 220px;
}

.sw-docs-sidebar-visual,
.sw-docs-toc-visual {
  display: block;
}

.sw-docs-sidebar-visual > div,
.sw-docs-toc-visual > div {
  position: sticky;
  top: 5rem;
}

.sw-app-main-visual {
  padding: 1.75rem clamp(1.25rem, 2vw, 2rem) 2.5rem;
}

.sw-app-main-visual > article {
  width: min(80rem, 100%);
  margin-inline: auto;
}

.sw-app-main-visual > .mb-4 {
  margin-bottom: 1.5rem;
}

.sw-switch-preview {
  position: relative;
  display: inline-flex;
  width: 2.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid color-mix(in oklch, var(--border), transparent 16%);
  background: color-mix(in oklch, var(--background), transparent 8%);
}

button.sw-switch-preview {
  cursor: pointer;
  padding: 0;
  appearance: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

button.sw-switch-preview:hover:not(:disabled),
button.sw-switch-preview:focus-visible:not(:disabled) {
  border-color: color-mix(in oklch, var(--ember), transparent 30%);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ember), transparent 84%);
}

button.sw-switch-preview:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.sw-switch-preview::after {
  content: "";
  width: 0.875rem;
  height: 0.875rem;
  margin-left: 0.15rem;
  border-radius: 9999px;
  background: color-mix(in oklch, var(--muted-foreground), transparent 18%);
  transition: transform 160ms ease;
}

.sw-switch-preview.is-on {
  background: color-mix(in oklch, var(--ember), transparent 26%);
  border-color: color-mix(in oklch, var(--ember), transparent 48%);
}

.sw-switch-preview.is-on::after {
  transform: translateX(0.95rem);
  background: var(--background);
}

/* Lovable/Tailwind utility fallbacks used by route-specific Razor ports. */
.sw-lovable-preview .p-3 {
  padding: 0.75rem;
}

.sw-lovable-preview .p-4 {
  padding: 1rem;
}

.sw-lovable-preview .p-5 {
  padding: 1.25rem;
}

.sw-lovable-preview .px-4 {
  padding-inline: 1rem;
}

.sw-lovable-preview .py-3 {
  padding-block: 0.75rem;
}

.sw-lovable-preview .gap-3 {
  gap: 0.75rem;
}

.sw-lovable-preview .gap-4 {
  gap: 1rem;
}

.sw-lovable-preview .space-y-2 > :not(:first-child) {
  margin-top: 0.5rem;
}

.sw-lovable-preview .space-y-6 > :not(:first-child) {
  margin-top: 1.5rem;
}

.sw-lovable-preview .grid.gap-3.sm\:grid-cols-2.lg\:grid-cols-3 > .rounded-lg.border.bg-card {
  min-height: 8.6rem;
}

@media (min-width: 40rem) {
  .sw-lovable-preview .sm\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .sw-docs-visual-frame,
  .sw-docs-route-visual {
    grid-template-columns: 1fr;
  }

  .sw-docs-sidebar-visual,
  .sw-docs-toc-visual {
    display: none;
  }
}

@media (max-width: 768px) {
  .sw-app-main-visual {
    padding: 1rem;
  }
}

/* Shell/card primitive parity: these are thin Razor compatibility rules that
   keep the emitted Blazor DOM aligned with Lovable's shadcn/Tailwind shell. */
body {
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.sw-guild-switcher summary::-webkit-details-marker {
  display: none;
}

.sw-guild-switcher[open] summary {
  background: var(--accent);
  color: var(--accent-foreground);
}

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

.bg-warning {
  background-color: var(--warning);
}

.text-primary-foreground {
  color: var(--primary-foreground);
}

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

[data-testid="portal-shell"] header a,
[data-testid="portal-shell"] header summary,
[data-testid="portal-shell"] aside a {
  text-decoration: none;
}

[data-testid="portal-shell"] aside {
  min-height: calc(100vh - 3.5rem);
}

[data-testid="portal-shell"] aside nav a {
  line-height: 1.25rem;
}

[data-testid="portal-shell"] aside .border-t {
  border-color: var(--sidebar-border);
}

.lovable-sidebar {
  width: 14rem;
  min-height: calc(100vh - 3.5rem);
  border-color: var(--sidebar-border);
  background: var(--sidebar);
  color: var(--sidebar-foreground);
}

.lovable-sidebar-content {
  display: flex;
  min-height: 0;
  height: 100%;
  flex-direction: column;
  gap: 0.5rem;
  overflow: auto;
  padding: 0.75rem;
}

.lovable-sidebar-group {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  padding: 0.25rem;
}

.lovable-sidebar-label {
  display: flex;
  align-items: center;
  height: 2rem;
  border-radius: calc(var(--radius) - 2px);
  padding: 0 0.5rem;
  color: color-mix(in oklab, var(--sidebar-foreground) 70%, transparent);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  line-height: 1;
  text-transform: uppercase;
}

.lovable-sidebar-group-content {
  min-width: 0;
}

.lovable-sidebar-menu,
.lovable-sidebar-other-list {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lovable-sidebar-menu-item {
  position: relative;
  min-width: 0;
}

.lovable-sidebar-menu-button {
  position: relative;
  display: flex;
  width: 100%;
  height: 2rem;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  border-radius: calc(var(--radius) - 2px);
  padding: 0.5rem;
  color: var(--sidebar-foreground);
  font-size: 0.875rem;
  line-height: 1.25rem;
  outline: none;
  text-align: left;
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.lovable-sidebar-menu-button:hover,
.lovable-sidebar-menu-button:active,
.lovable-sidebar-menu-button[data-active="true"] {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
}

.lovable-sidebar-menu-button[data-active="true"] {
  font-weight: 500;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--sidebar-accent-foreground) 10%, var(--sidebar-border));
}

.lovable-sidebar-menu-button:focus-visible,
.lovable-sidebar-other-link:focus-visible {
  outline: 2px solid var(--sidebar-ring);
  outline-offset: 2px;
}

.lovable-sidebar-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lovable-sidebar-separator {
  margin: 0 0.5rem 0.375rem;
  border-top: 1px solid var(--sidebar-border);
}

.lovable-sidebar-danger-group {
  padding-top: 0;
}

.lovable-sidebar-menu-button-danger {
  color: var(--destructive);
}

.lovable-sidebar-menu-button-danger:hover,
.lovable-sidebar-menu-button-danger:active {
  background: color-mix(in oklab, var(--destructive) 10%, transparent);
  color: var(--destructive);
}

.lovable-sidebar-menu-button-danger[data-active="true"] {
  background: color-mix(in oklab, var(--destructive) 15%, transparent);
  color: var(--destructive);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--destructive) 24%, transparent);
}

.lovable-sidebar-other {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-top: 0.5rem;
  border: 1px solid var(--sidebar-border);
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in oklab, var(--sidebar-accent) 20%, transparent);
  padding: 0.5rem;
  color: color-mix(in oklab, var(--sidebar-foreground) 70%, transparent);
  font-size: 0.6875rem;
  line-height: 1rem;
}

.lovable-sidebar-other-title {
  color: var(--sidebar-foreground);
  font-size: 0.6875rem;
  font-weight: 500;
}

.lovable-sidebar-other-link {
  display: block;
  min-width: 0;
  border-radius: calc(var(--radius) - 4px);
  overflow: hidden;
  padding: 0.125rem 0.25rem;
  color: color-mix(in oklab, var(--sidebar-foreground) 72%, transparent);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease;
}

.lovable-sidebar-other-link:hover {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
}

[data-testid="portal-shell"] .rounded-lg.border.bg-card,
.sw-settings-panel,
.sw-lovable-card,
.sw-feature-card,
.sw-module-card,
.sw-guild-card,
.sw-forge-panel {
  border-color: var(--border) !important;
  background: var(--card) !important;
  color: var(--card-foreground) !important;
  box-shadow: none !important;
}

.sw-settings-panel {
  border-radius: var(--radius);
  padding: 1rem;
}

.sw-settings-panel > div:first-child h2,
.sw-settings-panel h3,
.rounded-lg.border.bg-card h2,
.rounded-lg.border.bg-card h3 {
  color: var(--foreground);
  letter-spacing: -0.01em;
}

.sw-settings-panel > div:first-child p,
.sw-settings-panel small,
.rounded-lg.border.bg-card p,
.rounded-lg.border.bg-card small {
  color: var(--muted-foreground);
}

.sw-pending-banner {
  border-style: dashed;
  border-color: color-mix(in oklab, var(--warning) 42%, transparent);
  background: color-mix(in oklab, var(--warning) 12%, transparent);
  color: var(--warning);
}

.sw-control-shell input,
.sw-control-shell select,
.sw-control-shell textarea,
input.flex.h-9,
select.flex.h-9,
textarea.flex.h-9 {
  border-color: var(--input);
  background: transparent;
  color: var(--foreground);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.sw-table-shell,
.overflow-x-auto.rounded-lg.border.bg-card,
.overflow-hidden.rounded-lg.border.bg-card {
  border-color: var(--border);
  background: var(--card);
}

.sw-table-shell table,
.overflow-x-auto.rounded-lg.border.bg-card table,
.overflow-hidden.rounded-lg.border.bg-card table {
  caption-side: bottom;
  width: 100%;
  font-size: 0.875rem;
}

.sw-table-shell th,
.overflow-x-auto.rounded-lg.border.bg-card th,
.overflow-hidden.rounded-lg.border.bg-card th {
  height: 2.5rem;
  padding: 0.5rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.sw-table-shell td,
.overflow-x-auto.rounded-lg.border.bg-card td,
.overflow-hidden.rounded-lg.border.bg-card td {
  padding: 0.5rem;
  vertical-align: middle;
}
