/* The examples' own controls (controls.mjs), in the same Basecoat look and tokens as the board. */
.demo-panel {
  --radius: 8px;
  --background: oklch(1 0 0);
  --foreground: oklch(0.21 0.008 120);
  --primary: oklch(0.33 0.035 155);
  --primary-foreground: oklch(0.985 0.002 100);
  --muted: oklch(0.945 0.006 85);
  --muted-foreground: oklch(0.52 0.012 90);
  --border: oklch(0.88 0.008 85);
  --ring: oklch(0.6 0.05 150);
  --focus-ring: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05);
  display: grid; gap: 18px; align-content: start; min-width: 0;
  color: var(--foreground); font: 400 14px/1.43 ui-sans-serif, system-ui, sans-serif;
}
.demo-panel * { box-sizing: border-box; }
.demo-panel [hidden] { display: none !important; }
.demo-section { display: grid; gap: 12px; padding-top: 18px; border-top: 1px solid var(--border); }
.demo-section:first-child { padding-top: 0; border-top: 0; }
.demo-heading { margin: 0; font-size: 14px; font-weight: 500; line-height: 1; }
.demo-status { margin: 0; color: var(--muted-foreground); font-size: 13px; font-variant-numeric: tabular-nums; }
.demo-refusal { margin: 0; color: var(--destructive, #b42318); font-size: 13px; }
.demo-refusal:empty { display: none; }
.demo-row { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) 72px; gap: 8px; }
.demo-field { display: grid; gap: 8px; min-width: 0; }
.demo-label { color: var(--muted-foreground); font-size: 13px; line-height: 1; }

.demo-btn {
  display: inline-flex; align-items: center; justify-content: center; height: 36px; margin: 0; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--background); color: var(--foreground);
  box-shadow: var(--shadow-xs); font: 500 14px/1 ui-sans-serif, system-ui, sans-serif; cursor: pointer; outline: none;
  transition: background-color .15s, box-shadow .15s;
}
.demo-btn:hover:not(:disabled) { background: var(--muted); }
.demo-btn:disabled { opacity: .5; cursor: default; }
.demo-btn:focus-visible { border-color: var(--ring); box-shadow: var(--focus-ring); }
.demo-btn.demo-primary { border-color: transparent; background: var(--primary); color: var(--primary-foreground); }
.demo-btn.demo-primary:hover:not(:disabled) { background: color-mix(in oklab, var(--primary) 88%, transparent); }
.demo-section > .demo-btn.demo-primary { width: 100%; }

.demo-panel select, .demo-panel input[type="number"] {
  width: 100%; height: 36px; margin: 0; padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--background); color: var(--foreground); box-shadow: var(--shadow-xs); font: 400 14px ui-sans-serif, system-ui, sans-serif; outline: none;
}
.demo-panel select {
  appearance: none; padding-inline-end: 30px; cursor: pointer;
  background: var(--background) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23777b70' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center;
}
.demo-panel select:focus-visible, .demo-panel input[type="number"]:focus-visible { border-color: var(--ring); box-shadow: var(--focus-ring); }

/* A toggle group: radios drawn as joined outline buttons, the chosen one filled. */
.demo-choice { display: flex; isolation: isolate; }
.demo-choice label { position: relative; display: flex; flex: 1 1 0; min-width: 0; }
.demo-choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.demo-choice span {
  flex: 1; display: grid; place-items: center; height: 36px; padding: 0 8px; border: 1px solid var(--border); border-inline-start-width: 0;
  background: var(--background); color: var(--muted-foreground); box-shadow: var(--shadow-xs); font-weight: 500; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.demo-choice label:first-child span { border-inline-start-width: 1px; border-radius: var(--radius) 0 0 var(--radius); }
.demo-choice label:last-child span { border-radius: 0 var(--radius) var(--radius) 0; }
.demo-choice label:hover span { background: var(--muted); }
.demo-choice input:checked + span { background: var(--muted); color: var(--foreground); }
.demo-choice input:focus-visible + span { position: relative; z-index: 1; border-color: var(--ring); box-shadow: var(--focus-ring); }
.demo-choice:has(input:disabled) { opacity: .5; }
.demo-choice input:disabled { cursor: default; }

/* Basecoat's switch. */
.demo-switches { display: grid; gap: 4px; }
.demo-switch { display: flex; align-items: center; justify-content: space-between; min-height: 32px; cursor: pointer; }
.demo-switch:has(input:disabled) { opacity: .5; cursor: default; }
.demo-switch input {
  appearance: none; flex: none; display: inline-flex; align-items: center; width: 32px; height: 18.4px; margin: 0; padding: 0;
  border: 1px solid transparent; border-radius: 9999px; background: var(--border); box-shadow: var(--shadow-xs); cursor: pointer; outline: none;
  transition: background-color .15s;
}
.demo-switch input::before {
  content: ''; width: 16px; height: 16px; border-radius: 50%; background: var(--background); box-shadow: 0 1px 2px rgb(0 0 0 / .18); transition: translate .15s;
}
.demo-switch input:checked { background: var(--primary); }
.demo-switch input:checked::before { translate: calc(100% - 2px) 0; }
.demo-switch input:focus-visible { border-color: var(--ring); box-shadow: var(--focus-ring); }
.demo-switch input:disabled { cursor: default; }
