/* Analog Tools theme over the native Schematic Editor Web layout. */
html:has(.schematic-page),
body.schematic-page {
  min-width: 0;
  background: var(--bg);
}

.schematic-page #app {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-height: 0;
  height: auto;
}

.schematic-page #app > .schematic-shell {
  flex: 1 1 0;
  height: auto;
  --schematic-ink: var(--text);
  --schematic-muted: var(--text-2);
  --schematic-border: var(--border);
  --schematic-soft-rule: var(--border);
  --schematic-focus: var(--accent);
  --schematic-ui-panel: var(--bg-elev);
  --schematic-ui-input: var(--bg);
  --schematic-ui-line: var(--border);
  --schematic-ui-hover: var(--accent-soft);
  --schematic-ui-active: var(--accent-soft);
  --ink: var(--text);
  --muted: var(--text-2);
  --soft-rule: var(--border);
  --viva-blue: var(--accent);
  background: var(--bg);
}

:root[data-effective-theme="light"] .schematic-page .schematic-shell {
  --schematic-paper: #fdfcf9;
}

:root[data-effective-theme="dark"] .schematic-page .schematic-shell {
  --schematic-ui-selected: color-mix(in oklch, var(--accent) 22%, var(--bg-elev));
}

.schematic-page .schematic-shell > :is(.schematic-palette, .schematic-workspace, .right-dock) {
  border-color: var(--border);
  background: var(--bg-elev);
}

.schematic-page .schematic-workspace :is(.schematic-toolbar, .schematic-document-tabs) {
  background: var(--bg-elev);
  border-color: var(--border);
}

.schematic-page .schematic-shell :is(.property-editor, .schematic-statusbar, .schematic-instance-browser-dialog) {
  background: var(--bg-elev);
  border-color: var(--border);
}

/* The site's global margin reset also applies to native dialogs. */
.schematic-page .schematic-shell dialog:modal {
  position: fixed;
  inset: 0;
  margin: auto;
  block-size: fit-content;
  max-block-size: calc(100dvh - 32px);
  overflow: auto;
}

.schematic-page .schematic-shell .schematic-instance-browser {
  position: fixed;
}

.schematic-page .schematic-shell :is(
  .property-editor input:not([type="color"], [type="checkbox"]),
  .property-editor select, .property-editor textarea, .browser-search,
  .schematic-dialog :is(select, textarea, input:not([type="color"], [type="checkbox"]))
) {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}

.schematic-page .schematic-shell .schematic-toolbar :is(button, .schematic-toolbar-help) {
  border-color: var(--border);
  border-radius: 7px;
  background: var(--bg-elev);
  color: var(--text);
}

.schematic-page .schematic-shell .schematic-toolbar :is(button, .schematic-toolbar-help):is(:hover, .is-active) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.schematic-site-heading {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  container-type: inline-size;
  gap: 6px;
  min-width: 0;
  min-height: 40px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.schematic-site-heading .back {
  min-height: 28px;
  flex: none;
  font-size: clamp(0.66rem, 5.8cqi, 0.77rem);
  white-space: nowrap;
}

.schematic-site-heading .header-divider { display: block; height: 16px; }
.schematic-site-heading .app-title {
  overflow: visible;
  font-size: clamp(0.69rem, 5.8cqi, 0.98rem);
  white-space: nowrap;
}

.schematic-page.app-page .app-footer {
  padding-block: 6px calc(6px + env(safe-area-inset-bottom));
}

@media (max-width: 560px) {
  .schematic-page #app > .schematic-shell { padding: 5px; }
  .schematic-page.app-page .app-footer .wrap { gap: 2px 10px; }
}
