/* ============================================
   MURMELDYR - Clinical Elegance Design System
   Vanilla CSS - No Tailwind
   ============================================ */

/* Fonts - self-hosted for GDPR compliance */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/instrument-sans-400.ttf) format('truetype');
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/instrument-sans-500.ttf) format('truetype');
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/instrument-sans-600.ttf) format('truetype');
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/fonts/instrument-sans-700.ttf) format('truetype');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/instrument-serif-400.ttf) format('truetype');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/instrument-serif-400-italic.ttf) format('truetype');
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-white: #ffffff;
  --color-slate-50: #f8fafc;
  --color-slate-100: #f1f5f9;
  --color-slate-200: #e2e8f0;
  --color-slate-300: #cbd5e1;
  --color-slate-400: #94a3b8;
  --color-slate-500: #64748b;
  --color-slate-600: #475569;
  --color-slate-700: #334155;
  --color-slate-800: #1e293b;
  --color-slate-900: #0f172a;

  --color-teal-50: #f0fdfa;
  --color-teal-100: #ccfbf1;
  --color-teal-200: #99f6e4;
  --color-teal-400: #2dd4bf;
  --color-teal-500: #14b8a6;
  --color-teal-600: #0d9488;
  --color-teal-700: #0f766e;

  --color-emerald-400: #34d399;
  --color-emerald-500: #10b981;
  --color-emerald-600: #059669;

  --color-rose-50: #fff1f2;
  --color-rose-500: #f43f5e;
  --color-rose-600: #e11d48;
  --color-rose-800: #9f1239;

  --color-amber-50: #fffbeb;
  --color-amber-200: #fde68a;
  --color-amber-900: #78350f;

  --font-sans: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-mono: 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  color: var(--color-slate-800);
  background: var(--color-white);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================
   LAYOUT
   ============================================ */

.accent-bar {
  height: 4px;
  background: linear-gradient(to right, var(--color-teal-600), var(--color-emerald-500), var(--color-teal-600));
}

.site-nav {
  border-bottom: 1px solid var(--color-slate-100);
}

.nav-container {
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.nav-brand:hover .brand-icon {
  box-shadow: var(--shadow-md);
}

.nav-brand:hover .brand-text {
  color: var(--color-teal-700);
}

.brand-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, var(--color-teal-600), var(--color-emerald-600));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.brand-icon svg {
  width: 1rem;
  height: 1rem;
  color: white;
}

.brand-text {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--color-slate-900);
  transition: color 0.2s;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  font-size: 0.875rem;
  color: var(--color-slate-500);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--color-teal-600);
}

.site-main {
  flex: 1;
  width: 100%;
  overflow: hidden;
}

.site-footer {
  border-top: 1px solid var(--color-slate-100);
  margin-top: auto;
}

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

.footer-text {
  font-size: 0.875rem;
  color: var(--color-slate-400);
}

.footer-text em {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--color-slate-500);
}

.footer-badge {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--color-slate-300);
}

.footer-badge::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--color-emerald-400);
}

/* ============================================
   WIKI PAGE
   ============================================ */

.wiki-page {
  animation: fadeIn 0.5s ease-out;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-slate-100);
  animation: fadeIn 0.4s ease-out 0.1s both;
}

.page-header-content {
  flex: 1;
  min-width: 0;
}

.page-header h1 {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 400;
  color: var(--color-slate-900);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 1.125rem;
  color: var(--color-slate-500);
  margin-top: 0.5rem;
  line-height: 1.5;
}

/* TOC Dropdown */
.toc-dropdown {
  position: relative;
  flex-shrink: 0;
}

.toc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--color-slate-600);
  background: var(--color-slate-50);
  border: 1px solid var(--color-slate-200);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.toc-toggle:hover {
  background: var(--color-slate-100);
  border-color: var(--color-slate-300);
  color: var(--color-slate-800);
}

.toc-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 16rem;
  max-width: 24rem;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--color-white);
  border: 1px solid var(--color-slate-200);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  z-index: 50;
}

.toc-menu.open {
  display: block;
  animation: fadeIn 0.15s ease-out;
}

.toc-link {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--color-slate-600);
  text-decoration: none;
  border-radius: 0.375rem;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-link:hover {
  background: var(--color-slate-50);
  color: var(--color-teal-700);
}

.toc-level-2 { padding-left: 0.75rem; font-weight: 500; color: var(--color-slate-800); }
.toc-level-3 { padding-left: 1.5rem; }
.toc-level-4 { padding-left: 2.25rem; font-size: 0.8125rem; }
.toc-level-5 { padding-left: 3rem; font-size: 0.8125rem; }
.toc-level-6 { padding-left: 3.75rem; font-size: 0.8125rem; }

.page-content {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--color-slate-700);
  animation: fadeIn 0.4s ease-out 0.2s both;
}

/* Content Headings */
.page-content h1,
.page-content h2,
.page-content h3,
.page-content h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--color-slate-900);
  line-height: 1.3;
}

.page-content h1 {
  font-size: 2rem;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
}

.page-content h2 {
  font-size: 1.625rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-slate-100);
}

.page-content h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.page-content h4 {
  font-size: 1.125rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--color-slate-800);
}

/* Paragraphs */
.page-content p {
  margin-bottom: 1.25rem;
}

/* Lists */
.page-content ul,
.page-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.page-content ul {
  list-style-type: disc;
}

.page-content ol {
  list-style-type: decimal;
}

.page-content li {
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
}

.page-content li::marker {
  color: var(--color-teal-600);
}

/* Links */
.page-content a {
  color: var(--color-teal-700);
  text-decoration: none;
  border-bottom: 1px solid var(--color-teal-200);
  transition: border-color 0.2s;
}

.page-content a:hover {
  border-color: var(--color-teal-500);
}

/* Code */
.page-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-slate-50);
  color: var(--color-teal-800);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  border: 1px solid var(--color-slate-200);
}

.page-content pre {
  background: var(--color-slate-900);
  color: var(--color-slate-100);
  padding: 1.25rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.7;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.page-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border: none;
  font-size: inherit;
}

/* Blockquotes */
.page-content blockquote {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--color-slate-600);
  border-left: 2px solid var(--color-teal-400);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
}

/* Bold & Emphasis */
.page-content strong {
  font-weight: 600;
  color: var(--color-slate-900);
}

.page-content em {
  font-family: var(--font-serif);
  font-style: italic;
}

/* Horizontal Rule */
.page-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--color-slate-200), transparent);
  margin: 2.5rem 0;
}

/* Tables */
.page-content table {
  width: 100%;
  max-width: 100%;
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--color-slate-200);
  border-radius: 0.5rem;
  overflow: hidden;
  table-layout: fixed;
}

.page-content td,
.page-content th {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.page-content thead {
  background: var(--color-teal-50);
}

.page-content th {
  text-align: left;
  font-weight: 600;
  color: var(--color-slate-800);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-slate-200);
}

.page-content td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-slate-100);
}

.page-content tbody tr:nth-child(even) {
  background: var(--color-slate-50);
}

.page-content tbody tr:last-child td {
  border-bottom: none;
}

.page-content tbody tr:hover {
  background: rgba(240, 253, 250, 0.6);
}

/* ============================================
   IMAGE PLUGIN
   ============================================ */

.wiki-image {
  margin: 2rem 0;
}

.wiki-image.align-left {
  float: left;
  margin-right: 2rem;
  margin-bottom: 1rem;
}

.wiki-image.align-right {
  float: right;
  margin-left: 2rem;
  margin-bottom: 1rem;
}

.wiki-image.align-center {
  display: block;
  margin-left: auto;
  margin-right: auto;
  clear: both;
}

.wiki-image img {
  max-width: 100%;
  height: auto;
  display: block;
}

.wiki-image.with-border img {
  border: 1px solid var(--color-slate-200);
}

.wiki-image.with-shadow img {
  box-shadow: var(--shadow-lg);
}

/* ============================================
   LEGAL NOTICE PLUGIN
   ============================================ */

.legal-notice {
  display: flex;
  gap: 1rem;
  background: linear-gradient(to right, var(--color-amber-50), #fff7ed);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.legal-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  opacity: 0.8;
}

.legal-content {
  font-size: 0.875rem;
  color: var(--color-amber-900);
  line-height: 1.6;
}

/* ============================================
   CALLOUTS (Obsidian-style)
   ============================================ */

.callout {
  margin: 1.5rem 0;
  border-radius: 0.5rem;
  border-left: 4px solid;
  overflow: hidden;
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.9375rem;
}

.callout-icon {
  font-size: 1.125rem;
  line-height: 1;
}

.callout-title-text {
  flex: 1;
}

.callout-fold-icon {
  width: 1.25rem;
  height: 1.25rem;
  transition: transform 0.2s;
  cursor: pointer;
}

.callout-fold-icon::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  margin: 0.375rem auto;
  opacity: 0.6;
}

.callout-foldable .callout-title {
  cursor: pointer;
}

.callout-collapsed .callout-content {
  display: none;
}

.callout-collapsed .callout-fold-icon {
  transform: rotate(-90deg);
}

.callout-content {
  padding: 0 1rem 0.75rem 1rem;
  font-size: 0.9375rem;
  line-height: 1.7;
}

.callout-content > *:first-child {
  margin-top: 0;
}

.callout-content > *:last-child {
  margin-bottom: 0;
}

/* Callout Colors */
.callout-blue {
  background: #eff6ff;
  border-color: #3b82f6;
}
.callout-blue .callout-title {
  color: #1e40af;
}
.callout-blue .callout-content {
  color: #1e3a5f;
}

.callout-cyan {
  background: var(--color-teal-50);
  border-color: var(--color-teal-500);
}
.callout-cyan .callout-title {
  color: var(--color-teal-700);
}
.callout-cyan .callout-content {
  color: var(--color-slate-700);
}

.callout-green {
  background: #ecfdf5;
  border-color: #10b981;
}
.callout-green .callout-title {
  color: #065f46;
}
.callout-green .callout-content {
  color: #064e3b;
}

.callout-yellow {
  background: #fefce8;
  border-color: #eab308;
}
.callout-yellow .callout-title {
  color: #854d0e;
}
.callout-yellow .callout-content {
  color: #713f12;
}

.callout-orange {
  background: var(--color-amber-50);
  border-color: #f97316;
}
.callout-orange .callout-title {
  color: #c2410c;
}
.callout-orange .callout-content {
  color: var(--color-amber-900);
}

.callout-red {
  background: var(--color-rose-50);
  border-color: var(--color-rose-500);
}
.callout-red .callout-title {
  color: var(--color-rose-800);
}
.callout-red .callout-content {
  color: #7f1d1d;
}

.callout-purple {
  background: #faf5ff;
  border-color: #a855f7;
}
.callout-purple .callout-title {
  color: #6b21a8;
}
.callout-purple .callout-content {
  color: #581c87;
}

.callout-gray {
  background: var(--color-slate-50);
  border-color: var(--color-slate-400);
}
.callout-gray .callout-title {
  color: var(--color-slate-700);
}
.callout-gray .callout-content {
  color: var(--color-slate-600);
}

/* ============================================
   CHANGELOG PLUGIN
   ============================================ */

.changelog {
  background: var(--color-slate-50);
  border: 1px solid var(--color-slate-200);
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.changelog h4 {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  color: var(--color-slate-800);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-slate-200);
}

.changelog ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.changelog li {
  display: flex;
  gap: 0.75rem;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  align-items: flex-start;
}

.changelog time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-teal-700);
  background: var(--color-teal-50);
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  flex-shrink: 0;
}

.changelog span {
  color: var(--color-slate-600);
}

/* ============================================
   TIMELINE PLUGIN
   ============================================ */

.timeline {
  margin: 2rem 0;
}

.timeline-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--color-slate-900);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--color-teal-500);
}

.timeline-month {
  margin-bottom: 2rem;
}

.timeline-month-name {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--color-teal-700);
  margin-bottom: 1rem;
  position: sticky;
  top: 0;
  background: var(--color-white);
  padding: 0.5rem 0;
  z-index: 5;
}

.timeline-entries {
  border-left: 2px solid var(--color-slate-200);
  margin-left: 0.5rem;
  padding-left: 1.5rem;
}

.timeline-day {
  position: relative;
  margin-bottom: 1rem;
}

.timeline-day::before {
  content: '';
  position: absolute;
  left: -1.625rem;
  top: 0.5rem;
  width: 10px;
  height: 10px;
  background: var(--color-teal-500);
  border-radius: 50%;
  border: 2px solid var(--color-white);
}

.timeline-date {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-slate-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.timeline-day-entries {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.timeline-entry {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  text-decoration: none;
  padding: 0.375rem 0.625rem;
  margin-left: -0.625rem;
  border-radius: 0.375rem;
  transition: background 0.15s;
}

.timeline-entry:hover {
  background: var(--color-slate-50);
}

.timeline-year {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-emerald-600);
  flex-shrink: 0;
}

.timeline-entry-title {
  font-size: 0.9375rem;
  color: var(--color-slate-700);
}

.timeline-entry:hover .timeline-entry-title {
  color: var(--color-teal-700);
}

/* ============================================
   NOT FOUND PAGE
   ============================================ */

.not-found .page-content {
  text-align: center;
  padding: 3rem 0;
}

.not-found code {
  background: var(--color-slate-100);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

/* ============================================
   BACKEND STYLES
   ============================================ */

.backend-wrapper {
  max-width: 56rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

.backend-card {
  background: var(--color-white);
  border: 1px solid var(--color-slate-200);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.backend-accent {
  height: 4px;
  background: linear-gradient(to right, var(--color-teal-600), var(--color-emerald-600));
}

.backend-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-slate-100);
}

.backend-header h2 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--color-slate-900);
}

.backend-body {
  padding: 1.5rem;
}

/* Form Elements */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-slate-700);
  margin-bottom: 0.375rem;
}

.form-label .required {
  color: var(--color-rose-500);
}

.form-input {
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--color-slate-800);
  background: var(--color-white);
  border: 1px solid var(--color-slate-300);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-teal-500);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.form-input::placeholder {
  color: var(--color-slate-400);
}

.form-input.mono {
  font-family: var(--font-mono);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--color-slate-400);
  margin-top: 0.375rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-teal-600), var(--color-emerald-600));
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--color-slate-100);
  color: var(--color-slate-700);
}

.btn-secondary:hover {
  background: var(--color-slate-200);
}

.btn-danger {
  color: var(--color-rose-600);
  background: transparent;
  padding: 0.375rem 0.75rem;
}

.btn-danger:hover {
  background: var(--color-rose-50);
  color: var(--color-rose-800);
}

/* Alerts */
.alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background: var(--color-rose-50);
  color: var(--color-rose-800);
  border: 1px solid #fecdd3;
}

.alert svg {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
}

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background: var(--color-slate-50);
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-slate-500);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--color-slate-100);
  transition: background 0.15s;
}

.data-table tbody tr:hover {
  background: var(--color-slate-50);
}

.data-table td {
  padding: 1rem;
}

.data-table .cell-preview img {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: cover;
  border-radius: 0.5rem;
  border: 1px solid var(--color-slate-200);
  transition: border-color 0.2s;
}

.data-table .cell-preview img:hover {
  border-color: var(--color-teal-400);
}

.data-table .cell-slug {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--color-slate-800);
}

.data-table .cell-usage code {
  font-size: 0.75rem;
  background: var(--color-slate-100);
  color: var(--color-teal-700);
  padding: 0.375rem 0.625rem;
  border-radius: 0.375rem;
  border: 1px solid var(--color-slate-200);
  cursor: pointer;
  transition: border-color 0.2s;
}

.data-table .cell-usage code:hover {
  border-color: var(--color-teal-300);
}

.data-table .cell-meta {
  font-size: 0.875rem;
  color: var(--color-slate-500);
}

.data-table .cell-meta small {
  display: block;
  font-size: 0.75rem;
  color: var(--color-slate-400);
}

/* Empty State */
.empty-state {
  padding: 3rem;
  text-align: center;
}

.empty-state-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: var(--color-slate-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.empty-state-icon svg {
  width: 2rem;
  height: 2rem;
  color: var(--color-slate-400);
}

.empty-state p {
  color: var(--color-slate-500);
}

.empty-state small {
  font-size: 0.875rem;
  color: var(--color-slate-400);
}

/* Backend Page Header */
.backend-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.backend-page-header h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  color: var(--color-slate-900);
}

.backend-page-header p {
  color: var(--color-slate-500);
  margin-top: 0.25rem;
}

/* Badge */
.badge {
  font-size: 0.875rem;
  color: var(--color-slate-400);
  background: var(--color-slate-100);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
}

/* Grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

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

/* Spacing Utilities */
.space-y-6 > * + * {
  margin-top: 1.5rem;
}

.space-y-8 > * + * {
  margin-top: 2rem;
}

.mt-2 { margin-top: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }

/* Text Utilities */
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
  .page-header {
    flex-direction: column;
    gap: 1rem;
  }

  .page-header h1 {
    font-size: 2rem;
  }

  .page-subtitle {
    font-size: 1rem;
  }

  .toc-dropdown {
    align-self: flex-start;
  }

  .toc-menu {
    left: 0;
    right: auto;
  }

  .page-content h1 {
    font-size: 1.625rem;
  }

  .page-content h2 {
    font-size: 1.375rem;
  }

  .backend-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .footer-container {
    flex-direction: column;
    text-align: center;
  }
}

/* ============================================
   STACKED PANES (Andy Matuschak style)
   ============================================ */

.panes-container {
  display: flex;
  height: calc(100vh - 4rem - 4px);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--color-slate-300) transparent;
}

.panes-container::-webkit-scrollbar {
  height: 8px;
}

.panes-container::-webkit-scrollbar-track {
  background: transparent;
}

.panes-container::-webkit-scrollbar-thumb {
  background: var(--color-slate-300);
  border-radius: 4px;
}

.pane {
  flex: 0 0 600px;
  width: 600px;
  max-width: 100vw;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--color-white);
  border-right: 1px solid var(--color-slate-100);
  position: relative;
  transition: flex-basis 0.2s, width 0.2s, opacity 0.2s;
}

.pane:last-child {
  border-right: none;
}

/* Pane states */
.pane-unfocused {
  opacity: 0.4;
  cursor: pointer;
}

.pane-unfocused:hover {
  opacity: 0.6;
}

.pane-unfocused .pane-content {
  pointer-events: none;
}

.pane-focused {
  opacity: 1;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  z-index: 5;
}

/* Pane entrance animation */
.pane-entered {
  animation: paneSlideIn 0.25s ease-out;
}

@keyframes paneSlideIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Pane exit animation */
.pane-exiting {
  animation: paneSlideOut 0.2s ease-in forwards;
}

@keyframes paneSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* Pane content styling */
.pane-content {
  padding: 2.5rem;
  min-height: 100%;
}

.pane-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-slate-100);
  position: relative;
}

.pane-breakout-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 2rem;
  height: 2rem;
  padding: 0.375rem;
  background: var(--color-slate-50);
  border: 1px solid var(--color-slate-200);
  border-radius: 0.375rem;
  cursor: pointer;
  color: var(--color-slate-500);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pane-breakout-btn:hover {
  background: var(--color-white);
  border-color: var(--color-emerald-400);
  color: var(--color-emerald-600);
}

.pane-breakout-btn svg {
  width: 100%;
  height: 100%;
}

/* Expanded pane mode */
.pane-expanded {
  flex: 0 0 960px;
  width: 960px;
  max-width: 100vw;
  margin: 0 auto;
}

.pane-header h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  color: var(--color-slate-900);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.pane-subtitle {
  font-size: 1rem;
  color: var(--color-slate-500);
  margin-top: 0.5rem;
  line-height: 1.5;
}

.pane-body {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--color-slate-700);
}

/* Inherit prose styles for pane body */
.pane-body h2,
.pane-body h3,
.pane-body h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--color-slate-900);
  line-height: 1.3;
}

.pane-body h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-slate-100);
}

.pane-body h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.pane-body p {
  margin-bottom: 1rem;
}

.pane-body ul,
.pane-body ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.pane-body li {
  margin-bottom: 0.375rem;
}

.pane-body li::marker {
  color: var(--color-teal-600);
}

.pane-body a {
  color: var(--color-teal-700);
  text-decoration: none;
  border-bottom: 1px solid var(--color-teal-200);
  transition: border-color 0.2s;
}

.pane-body a:hover {
  border-color: var(--color-teal-500);
}

.pane-body a.external-link::after {
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-left: 0.2em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230f766e'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  vertical-align: middle;
}

.pane-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-slate-50);
  color: var(--color-teal-800);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  border: 1px solid var(--color-slate-200);
}

.pane-body blockquote {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--color-slate-600);
  border-left: 2px solid var(--color-teal-400);
  padding-left: 1rem;
  margin: 1.25rem 0;
}

.pane-body table {
  width: 100%;
  max-width: 100%;
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--color-slate-200);
  border-radius: 0.5rem;
  overflow: hidden;
  table-layout: fixed;
}

.pane-body td,
.pane-body th {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.pane-body thead {
  background: var(--color-teal-50);
}

.pane-body th {
  text-align: left;
  font-weight: 600;
  color: var(--color-slate-800);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-slate-200);
}

.pane-body td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-slate-100);
}

.pane-body tbody tr:nth-child(even) {
  background: var(--color-slate-50);
}

.pane-body tbody tr:last-child td {
  border-bottom: none;
}

.pane-body tbody tr:hover {
  background: rgba(240, 253, 250, 0.6);
}

/* Loading state */
.pane-loading .pane-content {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pane-loading-indicator {
  text-align: center;
  color: var(--color-slate-400);
}

.pane-spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--color-slate-200);
  border-top-color: var(--color-teal-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Error state */
.pane-error {
  color: var(--color-slate-500);
}

/* Shadow overlay on left edge when scrolled */
.panes-container::before {
  content: '';
  position: sticky;
  left: 0;
  width: 0;
  height: 100%;
  flex-shrink: 0;
  box-shadow: 8px 0 16px rgba(0, 0, 0, 0.08);
  z-index: 10;
  pointer-events: none;
}

/* Collapse bar (vertical title strip) */
.pane-collapse-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 40px;
  background: var(--color-white);
  border-right: 1px solid var(--color-slate-200);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  z-index: 10;
  display: none;
}

.pane-collapse-title {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  white-space: nowrap;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-emerald-600);
  max-width: calc(100vh - 8rem);
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}

/* Collapsed pane state */
.pane-collapsed {
  flex: 0 0 40px !important;
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  overflow: visible !important;
  position: sticky;
  left: 0;
  z-index: 20;
  opacity: 1 !important;
}

/* Stack multiple collapsed panes */
.pane-collapsed:nth-child(1) { left: 0; z-index: 25; }
.pane-collapsed:nth-child(2) { left: 40px; z-index: 24; }
.pane-collapsed:nth-child(3) { left: 80px; z-index: 23; }
.pane-collapsed:nth-child(4) { left: 120px; z-index: 22; }
.pane-collapsed:nth-child(5) { left: 160px; z-index: 21; }

.pane-collapsed .pane-collapse-bar {
  display: block;
}

.pane-collapsed .pane-content {
  display: none;
}

/* Mobile: single pane at a time, no collapse bars */
@media (max-width: 700px) {
  .pane {
    flex: 0 0 100vw;
    width: 100vw;
  }

  .pane-content {
    padding: 1.5rem;
  }

  .pane-header h1 {
    font-size: 1.75rem;
  }

  .pane-collapse-bar {
    display: none !important;
  }

  .pane-collapsed {
    flex: 0 0 100vw !important;
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
  }

  .pane-collapsed .pane-content {
    display: block;
  }
}
