:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #00bc7d;
  --accent-dark: #009966;
  --sidebar: #111827;
  --sidebar-text: #e5e7eb;
  --danger: #b42318;
  --warn-bg: #fff7ed;
  --warn-line: #fdba74;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--accent-dark); }

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100dvh;
}

[data-demo-nav] {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 1.25rem 1rem 2rem;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: auto;
}

.nav-brand {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin-bottom: 1rem;
}

.nav-brand img { border-radius: 6px; }

.nav-brand strong {
  display: block;
  font-size: 0.92rem;
}

.nav-brand span {
  display: block;
  color: #9ca3af;
  font-size: 0.75rem;
}

.ext-status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  padding: 0.45rem 0.6rem;
  border-radius: 999px;
  background: #1f2937;
  margin-bottom: 1.25rem;
}

.ext-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  flex-shrink: 0;
}

.ext-status.is-on .dot { background: var(--accent); }
.ext-status.is-off .dot { background: #f87171; }

.nav-title {
  margin: 1.1rem 0 0.35rem;
  color: #9ca3af;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-link {
  display: block;
  color: #d1d5db;
  text-decoration: none;
  padding: 0.38rem 0.55rem;
  border-radius: 6px;
  font-size: 0.88rem;
}

.nav-link:hover { background: #1f2937; color: #fff; }

.nav-link.is-active {
  background: #064e3b;
  color: #ecfdf5;
}

.nav-repo {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.5rem;
  color: #9ca3af;
  text-decoration: none;
  font-size: 0.8rem;
  padding: 0.38rem 0.55rem;
}

.nav-repo svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-repo:hover { color: #fff; }

.repo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.repo-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.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;
}

.content {
  padding: 1.5rem 2rem 3rem;
  max-width: 1040px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.btn,
.menu-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.menu-btn {
  display: none;
  padding: 0.45rem;
}

.menu-btn svg {
  display: block;
  width: 22px;
  height: 22px;
}

h1 { font-size: 1.6rem; margin: 0 0 0.35rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 0.4rem; }

.lede, .muted { color: var(--muted); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.feature-card, .scenario-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.scenario-card:hover { border-color: #a7f3d0; }

.kicker {
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 0.3rem;
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}

input[type="text"],
input[type="date"] {
  width: 100%;
  min-width: 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--text);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.2rem;
  margin: 0.4rem 0 1rem;
}

.marker {
  min-height: 3.2rem;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  background: #f8fafc;
}

.marker p {
  margin: 0;
  color: #9ca3af;
  font-size: 0.8rem;
}

.callout {
  border-left: 3px solid var(--accent);
  background: #ecfdf5;
  padding: 0.75rem 0.9rem;
  border-radius: 0 8px 8px 0;
  margin: 0.8rem 0;
}

.callout.warn {
  border-left-color: #f59e0b;
  background: var(--warn-bg);
}

.callout.danger {
  border-left-color: var(--danger);
  background: #fef2f2;
}

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

pre {
  background: #111827;
  color: #e5e7eb;
  padding: 0.9rem 1rem;
  border-radius: 8px;
  overflow: auto;
  font-size: 0.78rem;
  line-height: 1.5;
}

code.inline {
  background: #eef2ff;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.82em;
  word-break: break-word;
}

table.docs, .table-container table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

table.docs th, table.docs td,
.table-container td {
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

table.docs th { color: var(--muted); font-size: 0.75rem; }

.table-container {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
}

.table-container tr:nth-child(even) { background: #f9fafb; }

.results {
  margin-top: 1.25rem;
}

.partial-error {
  padding: 0.7rem 0.85rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #7f1d1d;
  margin-bottom: 0.8rem;
}

.shots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.img-container {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem;
}

.img-container p {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.img-container img {
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.iframe-frame {
  width: 100%;
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.stack > * + * { margin-top: 0.85rem; }

.nav-backdrop {
  display: none;
}

@media (max-width: 900px) {
  html, body { overflow-x: hidden; }
  body.nav-open { overflow: hidden; }

  .app { grid-template-columns: 1fr; }

  [data-demo-nav] {
    position: fixed;
    z-index: 20;
    transform: translateX(-110%);
    transition: transform 160ms ease, visibility 160ms ease;
    width: min(260px, 86vw);
    visibility: hidden;
    pointer-events: none;
  }
  [data-demo-nav].is-open {
    transform: none;
    visibility: visible;
    pointer-events: auto;
  }

  .nav-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    z-index: 15;
  }

  .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
  }

  .grid-2, .grid-3, .form-grid, .shots { grid-template-columns: 1fr; }
  .content { padding: 1rem; }

  table.docs {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table.docs thead,
  table.docs tbody {
    display: table;
    width: 100%;
    min-width: 36rem;
  }

  .iframe-frame { min-height: 70dvh; }
}
