/* Shared component layer. Canvas geometry and code editors keep their own styles. */
:root {
  --surface: #fff;
  --surface-subtle: #f7f9fc;
  --text: #25324a;
  --muted: #5e6d83;
  --line: #dce3ee;
  --accent: #275fe8;
  --accent-hover: #1d4fc9;
  --focus: #275fe8;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --radius-control: 8px;
  --radius-panel: 12px;
}
button, input, select, textarea { font-family: inherit; }
button { border-radius: var(--radius-control); }
.primary { background: var(--accent); border-color: var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.muted, .save-status, .project-heading #project-status { color: var(--muted); }
:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
summary { cursor: pointer; }
dialog {
  padding: var(--space-6);
  border-color: var(--line);
  border-radius: var(--radius-panel);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  color: var(--text);
}
dialog::backdrop { background: #25324a55; backdrop-filter: blur(2px); }
dialog h2, dialog .dialog-heading h2, .insight-dialog h2, #experiments-dialog .dialog-heading h2,
.community-dialog .dialog-heading h2 {
  font-size: 22px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -.35px;
  margin: 0;
  overflow-wrap: anywhere;
}
dialog h3 { font-size: 15px; line-height: 1.45; }
dialog p { line-height: 1.6; }
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.dialog-heading > :first-child { min-width: 0; }
.dialog-heading > button, .learn-heading > button {
  flex-shrink: 0;
  min-width: 36px;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 14px;
  line-height: 1.4;
}
:is(dialog, .inspector) label { font-size: 13px; line-height: 1.5; color: var(--text); }
:is(dialog, .inspector) :is(input:not([type=checkbox], [type=radio], [type=color], [type=range]), select, textarea) {
  max-width: 100%;
  border: 1px solid #bbc8da;
  border-radius: var(--radius-control);
  background-color: var(--surface);
  color: var(--text);
  font-size: 14px;
}
:is(dialog, .inspector) select {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 8px;
  margin-top: 6px;
}
:is(dialog, .inspector) input::placeholder, textarea::placeholder { color: #6c788c; }
dialog button { min-height: 36px; line-height: 1.4; }
.insight-dialog button { margin: 3px; }
.insight-dialog :is(.dialog-heading, .insight-actions, .dialog-actions) > button { margin: 0; }
.insight-actions, .project-actions, .dialog-actions { gap: var(--space-2); }
.insight-actions { margin: var(--space-4) 0; }
.dialog-actions { flex-wrap: wrap; padding-top: var(--space-4); border-top: 1px solid var(--line); }
.inline-label, dialog label.inline-label {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: var(--space-2);
}
label.inline-label input[type=checkbox] {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--accent);
}
.project-section { padding: var(--space-4) 0; border-top: 1px solid var(--line); }
.project-section h3 { margin: 0 0 var(--space-3); }
.project-section label { margin-top: var(--space-3); }
.project-section .project-actions { margin-bottom: 0; }
.project-section p:empty { display: none; }
.project-transfer { padding-top: var(--space-4); border-top: 1px solid var(--line); }
.project-transfer > summary { font-size: 14px; font-weight: 600; }
.project-navigation > .context-actions { padding: 8px 0; margin-left: auto; }
.context-actions button { min-height: 36px; font-size: 12px; }
.inspector-heading { gap: var(--space-2); margin-bottom: var(--space-2); }
.inspector-heading h2 { font-size: 18px; line-height: 1.4; }
#inspector-back { display: none; }
#inspector-form > button { margin-top: 8px; }
#inspector-form #node-description { font: inherit; font-size: 13px; line-height: 1.5; min-height: 62px; }
.block-contract { margin: 16px 0; padding: 12px; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: var(--radius-control); }
.block-contract summary { font-size: 13px; font-weight: 600; }
.block-contract ul { padding-left: 18px; }
.empty-state { padding: 32px 24px; margin: 16px 0; text-align: center; background: var(--surface-subtle); border: 1px dashed #c5d0e0; border-radius: var(--radius-panel); }
.empty-state h3 { font-size: 18px; margin: 0 0 8px; }
.empty-state p { max-width: 440px; margin: 0 auto 20px; color: var(--muted); }
.experiments-filters { display: flex; flex: 1; flex-wrap: wrap; align-items: end; gap: 12px; min-width: 0; }
.experiments-filters label { flex: 1; }
.experiments-tools input[type=search] { min-width: 0; }
.experiments-table { font-size: 13px; font-variant-numeric: tabular-nums; }
.experiments-table th, .experiments-table td { padding: 12px 16px; }
.experiments-table tbody tr:hover td { background: #f4f7fc; }
.model-version p, .insight-card h3, .insight-card h4 { overflow-wrap: anywhere; }
.experiments-scroll, .insight-scroll, .dataset-table { overscroll-behavior: contain; }
.chart-scroll { max-width: 100%; overflow: auto; overscroll-behavior: contain; }
.chart-scroll svg { display: block; min-width: 700px; }
.experiment-wizard > section > .dataset-table { max-height: 180px; overflow: auto; }
.experiment-wizard > section > .dataset-table tr:first-child th { position: sticky; top: 0; background: var(--surface-subtle); }
#learning-dialog { overflow: hidden; }
.learn-layout { max-height: calc(92dvh - 125px); }
.learn-sidebar, .learn-main { overflow: auto; overscroll-behavior: contain; }
.learn-sidebar > summary { display: none; }
.learn-main { scroll-padding-top: 24px; }
.learn-main .learn-meta { color: var(--muted); }
@media (max-width: 760px) {
  dialog, .insight-dialog, #experiments-dialog, .community-dialog {
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    padding: 16px;
  }
  dialog h2, dialog .dialog-heading h2, .insight-dialog h2, #experiments-dialog .dialog-heading h2,
  .community-dialog .dialog-heading h2 { font-size: 20px; }
  .dialog-heading { gap: 12px; align-items: flex-start; }
  .project-navigation > .context-actions { width: 100%; padding: 0 0 6px; }
  #schema-view .inspector { max-height: none; scroll-margin-top: 12px; }
  #inspector-back { display: block; flex-shrink: 0; }
  .experiments-filters { flex-basis: 100%; }
  .experiments-filters label { min-width: 100%; }
  .experiments-compare-tools label { min-width: 0; width: 100%; }
  .empty-state { padding: 24px 16px; }
  #learning-dialog { padding: 0; overflow: auto; }
  .learn-layout { max-height: none; display: block; }
  .learn-sidebar, .learn-main { overflow: visible; }
  .learn-sidebar > summary { display: list-item; font-size: 14px; font-weight: 600; }
  .learn-sidebar[open] > summary { margin-bottom: 16px; }
  .learn-sidebar nav { display: grid; max-height: 240px; overflow: auto; }
  .learn-sidebar nav button { min-height: 40px; }
  .learn-heading .learn-meta { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
