/* ==========================================================================
   MigueOS Design System — Shared UI Kit Stylesheet (v1.0)
   Depends on ./tokens.css. Uses `.mos-*` class prefix to avoid collisions.
   ========================================================================== */

@import url("./tokens.css");

/* ---- Base Reset (Scoped to .mos-app or Opt-In Root) ---- */
*, *::before, *::after {
  box-sizing: border-box;
}

.mos-app {
  margin: 0;
  background-color: var(--surface-canvas);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

:where(.mos-app button, .mos-app input, .mos-app select, .mos-app textarea) {
  font-family: var(--font-sans);
}

/* ---- Typography ---- */
.mos-display {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  color: var(--ink-primary);
}

.mos-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  color: var(--ink-primary);
}

.mos-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-heading);
  color: var(--ink-primary);
}

.mos-body {
  margin: 0;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--ink-primary);
}

.mos-secondary {
  color: var(--ink-secondary);
}

.mos-muted {
  color: var(--ink-muted);
}

.mos-subtle {
  color: var(--ink-subtle);
}

.mos-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--tracking-mono-label);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.mos-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---- Core Structural Surfaces (Tray-and-Tile Grammar) ---- */
.mos-tray {
  display: flex;
  flex-direction: column;
  gap: var(--tile-gap);
  padding: var(--tray-pad);
  background-color: var(--surface-tray);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-shell);
  box-shadow: var(--shadow-shell);
}

.mos-tray-flat {
  box-shadow: none;
}

.mos-tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 6px 8px 4px;
}

.mos-tile {
  background-color: var(--surface-card);
  border-radius: var(--radius-tile);
  box-shadow: var(--shadow-tile);
  padding: var(--tile-pad);
}

.mos-tile-flush {
  padding: 0;
  overflow: hidden;
}

.mos-card {
  background-color: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-shell);
  box-shadow: var(--shadow-shell);
  overflow: hidden;
}

/* Proportional card scale: larger cards increase padding, gap, and radius together */
.mos-card-sm {
  padding: var(--space-4);
  border-radius: var(--radius-tile);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.mos-card-md {
  padding: var(--space-5);
  border-radius: var(--radius-shell);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.mos-card-lg {
  padding: var(--space-6);
  border-radius: var(--radius-frame);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.mos-nested-box {
  background-color: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-tile);
  padding: var(--tile-pad);
}

.mos-divider {
  height: 1px;
  border: 0;
  margin: 0;
  background-color: var(--divider);
}

.mos-tray > .mos-divider {
  margin: 0 4px;
}

/* ---- Buttons ---- */
.mos-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: var(--tracking-ui);
  line-height: 1;
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard),
    transform var(--motion-press) var(--ease-standard);
}

.mos-btn:active:not(:disabled) {
  transform: translateY(var(--press-y));
}

.mos-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.mos-btn:disabled {
  background-color: var(--surface-control);
  color: var(--ink-subtle);
  border-color: transparent;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.72;
}

.mos-btn-sm {
  font-size: var(--text-xs);
  padding: 7px 12px;
}

.mos-btn-lg {
  font-size: var(--text-base);
  padding: 12px 20px;
}

.mos-btn-block {
  width: 100%;
}

/* Dark Primary CTA (Default authoritative action) */
.mos-btn-dark {
  background-color: var(--action-dark-bg);
  color: var(--action-dark-fg);
}
.mos-btn-dark:hover:not(:disabled) {
  background-color: var(--action-dark-hover);
}
.mos-btn-dark:active:not(:disabled) {
  background-color: var(--action-dark-active);
}

/* Vivid Cobalt Accent CTA */
.mos-btn-cobalt {
  background-color: var(--accent-cobalt);
  color: var(--ink-on-dark);
}
.mos-btn-cobalt:hover:not(:disabled) {
  background-color: var(--accent-cobalt-hover);
}

/* Vivid Red-Magenta Signal / Destructive CTA */
.mos-btn-magenta {
  background-color: var(--accent-magenta-fill);
  color: var(--ink-on-dark);
}
.mos-btn-magenta:hover:not(:disabled) {
  background-color: var(--accent-magenta-hover);
}
.mos-btn-magenta:focus-visible {
  box-shadow: var(--focus-ring-magenta);
}

/* Soft Red-Magenta Subtle Action */
.mos-btn-magenta-soft {
  background-color: var(--accent-magenta-soft);
  color: var(--accent-magenta-ink);
}
.mos-btn-magenta-soft:hover:not(:disabled) {
  background-color: #FFDCE8;
}

/* Secondary Hairline Button (Ref 3 "Save As") */
.mos-btn-secondary {
  background-color: var(--surface-card);
  color: var(--ink-primary);
  border-color: var(--border-strong);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-control);
  padding: 8px 12px;
}
.mos-btn-secondary:hover:not(:disabled) {
  background-color: var(--surface-subtle);
}

/* Soft Neutral Pill Button (Ref 2 & Ref 4 "Agent", "Pause") */
.mos-btn-pill {
  background-color: var(--surface-control);
  color: var(--ink-primary);
  padding: 7px 12px;
}
.mos-btn-pill:hover:not(:disabled) {
  background-color: var(--surface-control-hover);
}

/* Ghost Utility Button */
.mos-btn-ghost {
  background-color: transparent;
  color: var(--ink-secondary);
  border-radius: var(--radius-chip);
  padding: 7px 10px;
}
.mos-btn-ghost:hover:not(:disabled) {
  background-color: var(--surface-control);
  color: var(--ink-primary);
}

/* Circular Icon Buttons */
.mos-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: var(--radius-pill);
  background-color: var(--surface-control);
  color: var(--ink-primary);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background-color var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard),
    transform var(--motion-press) var(--ease-standard);
}
.mos-btn-icon:hover:not(:disabled) {
  background-color: var(--surface-control-hover);
}
.mos-btn-icon:active:not(:disabled) {
  transform: translateY(var(--press-y));
}
.mos-btn-icon:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.mos-btn-icon-dark {
  background-color: var(--action-dark-bg);
  color: var(--action-dark-fg);
}
.mos-btn-icon-dark:hover:not(:disabled) {
  background-color: var(--action-dark-hover);
}

/* ---- Semantic Entity Pills, Tags & Citations ---- */
.mos-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.45;
  padding: 2px 10px;
  white-space: nowrap;
}

.mos-pill-cobalt {
  background-color: var(--accent-cobalt-soft);
  color: var(--accent-cobalt-ink);
}
.mos-pill-violet {
  background-color: var(--accent-violet-soft);
  color: var(--accent-violet-ink);
}
.mos-pill-magenta {
  background-color: var(--accent-magenta-soft);
  color: var(--accent-magenta-ink);
}
.mos-pill-amber {
  background-color: var(--accent-amber-soft);
  color: var(--accent-amber-ink);
}

.mos-tag {
  display: inline-flex;
  align-items: center;
  background-color: var(--surface-control);
  color: var(--ink-secondary);
  border-radius: var(--radius-chip);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.3;
  padding: 3px 8px;
  white-space: nowrap;
}

.mos-citation {
  display: inline-flex;
  align-items: center;
  background-color: var(--surface-recessed);
  color: var(--ink-secondary);
  border-radius: var(--radius-chip);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
  padding: 3px 9px;
}

.mos-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background-color: var(--ink-subtle);
  flex-shrink: 0;
}
.mos-dot-cobalt { background-color: var(--accent-cobalt); }
.mos-dot-magenta { background-color: var(--accent-magenta); }
.mos-dot-violet { background-color: var(--accent-violet); }
.mos-dot-amber { background-color: var(--accent-amber); }

/* ---- Form Controls ---- */
.mos-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mos-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink-secondary);
}

.mos-input,
.mos-select,
.mos-textarea {
  width: 100%;
  background-color: var(--surface-card);
  color: var(--ink-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  padding: 8px 12px;
  font-size: var(--text-sm);
  line-height: 1.45;
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard);
}

.mos-input::placeholder,
.mos-textarea::placeholder {
  color: var(--ink-subtle);
}

.mos-input:focus,
.mos-select:focus,
.mos-textarea:focus {
  border-color: var(--accent-cobalt);
  box-shadow: var(--focus-ring);
}

.mos-input-error {
  border-color: var(--accent-magenta);
}
.mos-input-error:focus {
  border-color: var(--accent-magenta);
  box-shadow: var(--focus-ring-magenta);
}

.mos-error-text {
  font-size: var(--text-xs);
  color: var(--accent-magenta-ink);
}

/* Styled Native Select (Custom SVG Chevron) */
.mos-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%234E4E58' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.2 6.2L8 10l3.8-3.8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
.mos-select-sm {
  width: auto;
  padding: 4px 28px 4px 10px;
  font-size: var(--text-xs);
  font-weight: 500;
  background-position: right 9px center;
}

/* Input Group (Search, Prefix / Suffix, Inline Shortcut) */
.mos-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background-color: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  padding: 0 10px;
  transition: border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard);
}
.mos-input-group:focus-within {
  border-color: var(--accent-cobalt);
  box-shadow: var(--focus-ring);
}
.mos-input-group .mos-input {
  border: none;
  box-shadow: none;
  padding: 8px 0;
  background: transparent;
  flex: 1;
  min-width: 0;
}
.mos-input-group .mos-input:focus {
  border: none;
  box-shadow: none;
}
.mos-input-addon {
  display: inline-flex;
  align-items: center;
  color: var(--ink-muted);
  font-size: var(--text-xs);
  flex-shrink: 0;
}

/* Pure-CSS Native Checkbox (Round default for checklists; .mos-checkbox-square for forms) */
.mos-checkbox {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-content: center;
  width: 17px;
  height: 17px;
  margin: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background-color: var(--surface-card);
  color: var(--accent-cobalt);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background-color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    transform var(--motion-press) var(--ease-standard);
}
.mos-checkbox-square {
  border-radius: 5px;
}
.mos-checkbox::before {
  content: "";
  width: 8px;
  height: 4.5px;
  border: solid currentColor;
  border-width: 0 0 1.8px 1.8px;
  opacity: 0;
  transform: translateY(-1px) rotate(-45deg) scale(0.55);
  transition:
    opacity var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}
.mos-checkbox:hover:not(:disabled):not(:checked) {
  border-color: var(--ink-subtle);
  background-color: var(--surface-subtle);
}
.mos-checkbox:active:not(:disabled) {
  transform: scale(0.92);
}
.mos-checkbox:focus-visible {
  outline: 1.5px solid var(--accent-cobalt-soft);
  outline-offset: 2px;
  box-shadow: none;
}
.mos-checkbox:checked {
  border-color: transparent;
  background-color: var(--accent-cobalt-soft);
  color: var(--accent-cobalt);
}
.mos-checkbox:checked::before {
  opacity: 1;
  transform: translateY(-1px) rotate(-45deg) scale(1);
}
.mos-checkbox:indeterminate {
  border-color: transparent;
  background-color: var(--accent-cobalt-soft);
  color: var(--accent-cobalt);
}
.mos-checkbox:indeterminate::before {
  width: 8px;
  height: 1.8px;
  border: 0;
  border-radius: 2px;
  background-color: currentColor;
  opacity: 1;
  transform: scale(1);
}
.mos-checkbox:disabled {
  background-color: var(--surface-control);
  border-color: var(--border-default);
  cursor: not-allowed;
  opacity: 0.65;
}
.mos-check-row .mos-checkbox + span {
  transition: color var(--motion-fast) var(--ease-standard), opacity var(--motion-fast) var(--ease-standard);
}
.mos-check-row .mos-checkbox:checked + span {
  color: var(--ink-muted);
  text-decoration: line-through;
}
.mos-check-row .mos-checkbox:checked + span .mos-pill,
.mos-check-row .mos-checkbox:checked + span .mos-tag {
  display: inline-flex;
  text-decoration: none;
  opacity: 0.65;
}

/* Pure-CSS Native Radio */
.mos-radio {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-content: center;
  width: 17px;
  height: 17px;
  margin: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background-color: var(--surface-card);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}
.mos-radio:hover:not(:disabled) {
  border-color: var(--ink-muted);
}
.mos-radio:focus-visible {
  outline: none;
  border-color: var(--accent-cobalt);
  box-shadow: var(--focus-ring);
}
.mos-radio:checked {
  border-color: var(--accent-cobalt);
}
.mos-radio:checked::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background-color: var(--accent-cobalt);
}
.mos-radio:disabled {
  background-color: var(--surface-control);
  cursor: not-allowed;
  opacity: 0.65;
}

@media (forced-colors: active) {
  .mos-checkbox,
  .mos-radio {
    appearance: auto;
  }
  .mos-checkbox::before,
  .mos-radio::before {
    display: none;
  }
}

/* Native Range Slider */
.mos-range {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background-color: var(--surface-recessed);
  outline: none;
  cursor: pointer;
}
.mos-range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  background-color: var(--surface-card);
  border: 1.5px solid var(--accent-cobalt);
  box-shadow: var(--shadow-control);
  transition: transform var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard);
}
.mos-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  background-color: var(--surface-card);
  border: 1.5px solid var(--accent-cobalt);
  box-shadow: var(--shadow-control);
}
.mos-range:focus-visible::-webkit-slider-thumb {
  box-shadow: var(--focus-ring);
}

/* File Dropzone */
.mos-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: var(--space-6) var(--space-4);
  background-color: var(--surface-subtle);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-tile);
  text-align: center;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-standard),
              background-color var(--duration-fast) var(--ease-standard);
}
.mos-dropzone:hover,
.mos-dropzone.is-dragover {
  border-color: var(--accent-cobalt);
  background-color: var(--accent-cobalt-soft);
}

/* Segmented Control */
.mos-segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background-color: var(--surface-control);
  border-radius: var(--radius-pill);
}

.mos-seg-item {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 5px 12px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-standard);
}

.mos-seg-item.is-active,
.mos-seg-item[aria-selected="true"] {
  background-color: var(--surface-card);
  color: var(--ink-primary);
  box-shadow: 0 1px 2px rgba(16, 16, 24, 0.08);
}

/* Toggle Switch */
.mos-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 36px;
  height: 20px;
  padding: 2px;
  border: none;
  border-radius: var(--radius-pill);
  background-color: var(--surface-recessed);
  cursor: pointer;
  transition: background-color var(--duration-base) var(--ease-standard);
}
.mos-switch:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.mos-switch.is-on,
.mos-switch[aria-checked="true"] {
  background-color: var(--accent-cobalt);
}
.mos-switch-thumb {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-pill);
  background-color: #FFFFFF;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
  transition: transform var(--duration-base) var(--ease-standard);
}
.mos-switch.is-on .mos-switch-thumb,
.mos-switch[aria-checked="true"] .mos-switch-thumb {
  transform: translateX(16px);
}

/* ---- Agentic & Workspace Components ---- */

/* Active Cobalt Spinner */
@keyframes mos-spin {
  to { transform: rotate(360deg); }
}

.mos-spinner {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-pill);
  border: 1.75px solid transparent;
  border-top-color: var(--accent-cobalt);
  border-right-color: var(--accent-cobalt);
  animation: mos-spin 0.9s linear infinite;
  flex-shrink: 0;
}
.mos-spinner.is-paused {
  animation-play-state: paused;
  opacity: 0.45;
}
.mos-spinner-magenta {
  border-top-color: var(--accent-magenta);
  border-right-color: var(--accent-magenta);
}

/* Task Checklist Row (Ref 4) */
.mos-checklist {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mos-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 6px;
  margin: 0 -6px;
  border: none;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--ink-primary);
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-standard);
}
.mos-check-row:hover {
  background-color: var(--surface-subtle);
}
.mos-check-row.is-done {
  color: var(--ink-muted);
  text-decoration: line-through;
}
.mos-tile-flush .mos-check-row {
  margin: 0;
  padding: 8px var(--tile-pad);
}

.mos-check-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: var(--radius-pill);
  border: 1.4px solid var(--border-strong);
  flex-shrink: 0;
}
.mos-check-circle.is-done {
  border-color: transparent;
  background-color: var(--accent-cobalt-soft);
  color: var(--accent-cobalt);
}

/* Status Callout Tile with Tinted Icon Well (Ref 4) */
.mos-callout {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.mos-icon-well {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-well);
  background-color: var(--accent-cobalt-soft);
  color: var(--accent-cobalt);
  flex-shrink: 0;
}
.mos-icon-well-magenta {
  background-color: var(--accent-magenta-soft);
  color: var(--accent-magenta);
}

/* Footer Telemetry Bar (Ref 4) */
.mos-telemetry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 10px 14px;
  flex-wrap: wrap;
}

/* Split Document + Recessed Side Panel (Ref 3) */
.mos-split {
  display: grid;
  grid-template-columns: 1fr;
  background-color: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-shell);
  box-shadow: var(--shadow-shell);
  overflow: hidden;
}
@media (min-width: 768px) {
  .mos-split {
    grid-template-columns: 5fr 7fr;
  }
}

.mos-split-main {
  background-color: var(--surface-card);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mos-split-inspector {
  background-color: var(--surface-tray);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mos-orb {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--gradient-orb);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}

.mos-prompt-bubble {
  background-color: var(--surface-card);
  border-radius: var(--radius-tile);
  box-shadow: var(--shadow-tile);
  padding: 10px 14px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-primary);
}

/* Reasoning / Activity Trace Timeline (Ref 3) */
.mos-trace {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.mos-trace-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.mos-trace-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--ink-muted);
  padding-top: 2px;
}
.mos-trace-line {
  width: 1px;
  min-height: 18px;
  flex: 1;
  margin-top: 4px;
  background-color: var(--border-strong);
}

/* Atmospheric Header Banner + Frosted Squircle (Ref 1) */
.mos-banner {
  position: relative;
  overflow: hidden;
  background: var(--gradient-banner);
  padding: 24px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mos-banner :is(h1, h2, h3, .mos-heading, .mos-title) {
  position: relative;
  z-index: 1;
  color: var(--ink-on-dark);
}
.mos-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.2;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

.mos-frosted-squircle {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-well);
  background: rgba(255, 255, 255, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #FFFFFF;
}

/* Composer Dock (Ref 2) */
.mos-frame {
  padding: var(--space-5);
  border-radius: var(--radius-frame);
  background: var(--gradient-frame);
}

.mos-composer {
  border-top: 1px solid var(--divider);
  padding: 12px 16px;
}
.mos-composer-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--text-base);
  color: var(--ink-primary);
  padding: 2px 0 10px;
}
.mos-composer-input::placeholder {
  color: var(--ink-subtle);
}

/* ---- Data Table ---- */
.mos-table-wrap {
  width: 100%;
  overflow-x: auto;
}
.mos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.mos-table th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--divider);
  background-color: var(--surface-subtle);
}
.mos-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--divider);
  color: var(--ink-primary);
  vertical-align: middle;
  transition: background-color var(--motion-fast) var(--ease-standard);
}
.mos-table tbody tr:last-child td {
  border-bottom: none;
}
.mos-table tbody tr:hover td {
  background-color: var(--surface-subtle);
}

/* ---- Sidebar Navigation Item (for App Templates) ---- */
.mos-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--ink-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard);
}
.mos-nav-item:hover {
  background-color: var(--surface-control);
  color: var(--ink-primary);
}
.mos-nav-item.is-active {
  background-color: var(--surface-card);
  color: var(--ink-primary);
  box-shadow: var(--shadow-tile);
}

/* ---- Modal Backdrop & Dialog ---- */
.mos-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background-color: rgba(18, 18, 22, 0.34);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
}
.mos-backdrop.is-open {
  display: flex;
}
.mos-modal {
  width: 100%;
  max-width: 440px;
  background-color: var(--surface-card);
  border-radius: var(--radius-shell);
  box-shadow: var(--shadow-floating);
  overflow: hidden;
}

/* ---- Toast ---- */
.mos-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  background-color: var(--action-dark-bg);
  color: var(--action-dark-fg);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-floating);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-standard),
              transform var(--duration-base) var(--ease-standard);
}
.mos-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Floating Status Pill Toast (Progress, Failure/Retry, Completed) */
.mos-toast-pill {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  max-width: 100%;
  padding: 8px 12px 8px 10px;
  background-color: var(--surface-card);
  color: var(--ink-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-floating);
  font-size: var(--text-sm);
  font-weight: 500;
}
@media (max-width: 480px) {
  .mos-toast-pill {
    gap: var(--space-2);
    padding: 8px 10px;
    border-radius: var(--radius-tile);
    font-size: var(--text-xs);
  }
}
.mos-toast-sep {
  width: 1px;
  height: 20px;
  background-color: var(--divider);
  flex-shrink: 0;
}
.mos-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-on-dark);
  flex-shrink: 0;
}
.mos-step-amber {
  background-color: var(--accent-amber);
  box-shadow: 0 0 0 3px var(--accent-amber-soft);
}
.mos-step-magenta {
  background-color: var(--accent-magenta-fill);
  box-shadow: 0 0 0 3px var(--accent-magenta-soft);
}
.mos-step-cobalt {
  background-color: var(--accent-cobalt);
  box-shadow: 0 0 0 3px var(--accent-cobalt-soft);
}

/* ---- Identity & Metadata (Avatars, Kbd, Key-Value Lists) ---- */
.mos-avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background-color: var(--surface-control);
  color: var(--ink-primary);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
  user-select: none;
}
.mos-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mos-avatar-sm {
  width: 24px;
  height: 24px;
  font-size: 10.5px;
}
.mos-avatar-lg {
  width: 42px;
  height: 42px;
  font-size: var(--text-base);
}
.mos-avatar-cobalt {
  background-color: var(--accent-cobalt-soft);
  color: var(--accent-cobalt-ink);
}
.mos-avatar-violet {
  background-color: var(--accent-violet-soft);
  color: var(--accent-violet-ink);
}
.mos-avatar-magenta {
  background-color: var(--accent-magenta-soft);
  color: var(--accent-magenta-ink);
}

.mos-avatar-wrap {
  position: relative;
  display: inline-flex;
}
.mos-avatar-status {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 9px;
  height: 9px;
  border-radius: var(--radius-pill);
  background-color: var(--accent-cobalt);
  border: 2px solid var(--surface-card);
}
.mos-avatar-status-magenta { background-color: var(--accent-magenta); }
.mos-avatar-status-amber { background-color: var(--accent-amber); }

.mos-avatar-group {
  display: inline-flex;
  align-items: center;
}
.mos-avatar-group .mos-avatar {
  border: 2px solid var(--surface-card);
  margin-left: -8px;
}
.mos-avatar-group .mos-avatar:first-child {
  margin-left: 0;
}

.mos-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.25;
  color: var(--ink-secondary);
  background-color: var(--surface-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-chip);
  box-shadow: 0 1px 0 var(--border-default);
}

.mos-kv-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
}
.mos-kv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 9px 0;
  border-bottom: 1px solid var(--divider);
  font-size: var(--text-sm);
}
.mos-kv-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.mos-kv-row:first-child {
  padding-top: 0;
}
.mos-kv-key {
  color: var(--ink-muted);
}
.mos-kv-val {
  color: var(--ink-primary);
  font-weight: 500;
  text-align: right;
}
.mos-kv-list + form,
.mos-kv-list + .mos-field {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--divider);
}

/* ---- Navigation & Disclosure (Tabs, Breadcrumbs, Accordion, Menu, Drawer) ---- */
.mos-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  border-bottom: 1px solid var(--divider);
  overflow-x: auto;
}
.mos-tab {
  position: relative;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 9px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--duration-fast) var(--ease-standard);
}
.mos-tab:hover {
  color: var(--ink-primary);
}
.mos-tab.is-active,
.mos-tab[aria-selected="true"] {
  color: var(--ink-primary);
}
.mos-tab.is-active::after,
.mos-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 2px;
  border-radius: var(--radius-pill);
  background-color: var(--action-dark-bg);
}

.mos-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--ink-muted);
  margin: 0;
  padding: 0;
  list-style: none;
}
.mos-breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mos-breadcrumbs li + li::before {
  content: "/";
  color: var(--ink-subtle);
}
.mos-breadcrumbs a {
  color: var(--ink-muted);
  text-decoration: none;
  transition: color var(--motion-fast) var(--ease-standard);
}
.mos-breadcrumbs a:hover {
  color: var(--ink-primary);
}
.mos-breadcrumbs [aria-current="page"] {
  color: var(--ink-primary);
  font-weight: 500;
}

/* Pure-HTML Collapsible Tree with Vertical Guide Lines */
.mos-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mos-tree-branch {
  display: flex;
  flex-direction: column;
}
.mos-tree-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius-control);
  color: var(--ink-primary);
  font-size: var(--text-sm);
  line-height: 1.35;
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background-color var(--duration-fast) var(--ease-standard);
}
.mos-tree-row::-webkit-details-marker {
  display: none;
}
.mos-tree-row:hover {
  background-color: var(--surface-subtle);
}
.mos-tree-leaf {
  padding-left: 24px;
}
.mos-tree-caret {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12' fill='%238E8E9A'%3E%3Cpath d='M4 2.5L8.5 6L4 9.5V2.5Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform var(--duration-fast) var(--ease-standard);
}
.mos-tree-branch[open] > .mos-tree-row > .mos-tree-caret {
  transform: rotate(90deg);
}
.mos-tree-label {
  flex: 1;
  min-width: 0;
  color: var(--ink-secondary);
  font-weight: 400;
  overflow-wrap: anywhere;
}
.mos-tree-row:has(.mos-checkbox:checked) .mos-tree-label {
  color: var(--ink-primary);
  font-weight: 600;
}
.mos-tree-count {
  font-size: var(--text-xs);
  flex-shrink: 0;
  margin-left: auto;
}
.mos-tree-children {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 14px;
  padding-left: 12px;
  border-left: 1px solid var(--divider);
}

/* Pure-HTML Collapsible Accordion */
.mos-accordion {
  background-color: var(--surface-card);
  border-radius: var(--radius-tile);
  box-shadow: var(--shadow-tile);
  overflow: hidden;
}
.mos-accordion > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 13px var(--tile-pad);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--ink-primary);
  cursor: pointer;
  user-select: none;
  transition: background-color var(--motion-fast) var(--ease-standard);
}
.mos-accordion > summary:hover {
  background-color: var(--surface-subtle);
}
.mos-accordion > summary::-webkit-details-marker {
  display: none;
}
.mos-accordion > summary::after {
  content: "";
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%237E7E8A' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.2 6.2L8 10l3.8-3.8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform var(--duration-base) var(--ease-standard);
}
.mos-accordion[open] > summary::after {
  transform: rotate(180deg);
}
.mos-accordion-body {
  padding: 0 var(--tile-pad) var(--tile-pad);
  color: var(--ink-secondary);
  font-size: var(--text-sm);
  border-top: 1px solid var(--divider);
  padding-top: var(--space-3);
}

/* Popover / Dropdown Menu */
.mos-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 196px;
  padding: 6px;
  background-color: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-tile);
  box-shadow: var(--shadow-floating);
}
.mos-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--ink-primary);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-standard);
}
.mos-menu-item:hover {
  background-color: var(--surface-subtle);
}
.mos-menu-item-danger {
  color: var(--accent-magenta-ink);
}
.mos-menu-item-danger:hover {
  background-color: var(--accent-magenta-soft);
}
.mos-menu-divider {
  height: 1px;
  margin: 4px 6px;
  background-color: var(--divider);
  border: 0;
}

/* Slide-Over Drawer */
.mos-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 85;
  background-color: rgba(18, 18, 22, 0.28);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: none;
  justify-content: flex-end;
}
.mos-drawer-backdrop.is-open {
  display: flex;
}
.mos-drawer {
  width: 100%;
  max-width: 420px;
  height: 100%;
  background-color: var(--surface-card);
  box-shadow: var(--shadow-floating);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}
.mos-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5);
  border-bottom: 1px solid var(--divider);
}
.mos-drawer-body {
  padding: var(--space-5);
  flex: 1;
}
.mos-drawer-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--divider);
  background-color: var(--surface-subtle);
}

/* ---- Feedback, Data & States ---- */
.mos-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 12px 14px;
  border-radius: var(--radius-tile);
  background-color: var(--surface-subtle);
  border: 1px solid var(--border-default);
  color: var(--ink-primary);
  font-size: var(--text-sm);
}
.mos-alert-cobalt {
  background-color: var(--accent-cobalt-soft);
  border-color: rgba(26, 107, 255, 0.18);
  color: var(--accent-cobalt-ink);
}
.mos-alert-amber {
  background-color: var(--accent-amber-soft);
  border-color: rgba(255, 138, 0, 0.22);
  color: var(--accent-amber-ink);
}
.mos-alert-magenta {
  background-color: var(--accent-magenta-soft);
  border-color: rgba(242, 22, 93, 0.20);
  color: var(--accent-magenta-ink);
}
.mos-alert-title {
  font-weight: 600;
  line-height: 1.3;
}

/* Determinate Progress Bar */
.mos-progress {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background-color: var(--surface-recessed);
  overflow: hidden;
}
.mos-progress-bar {
  height: 100%;
  border-radius: var(--radius-pill);
  background-color: var(--accent-cobalt);
  transition: width var(--motion-base) var(--ease-standard);
}
.mos-progress-bar-magenta { background-color: var(--accent-magenta); }
.mos-progress-bar-violet { background-color: var(--accent-violet); }

/* Multi-Segment Ratio Bar (Thin, solid, zero stripes) */
.mos-ratio-bar {
  display: flex;
  gap: 4px;
  width: 100%;
  height: 6px;
}
.mos-ratio-seg {
  height: 100%;
  border-radius: var(--radius-pill);
  background-color: var(--surface-recessed);
}
.mos-ratio-cobalt { background-color: var(--accent-cobalt); }
.mos-ratio-violet { background-color: var(--accent-violet); }
.mos-ratio-amber { background-color: var(--accent-amber); }
.mos-ratio-magenta { background-color: var(--accent-magenta); }
.mos-ratio-dark { background-color: var(--action-dark-bg); }

/* Segmented Vertical Tick Meter */
.mos-tick-meter {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: var(--space-1);
  height: 22px;
}
.mos-tick {
  border-radius: 3px;
  background-color: var(--surface-recessed);
}
.mos-tick-active {
  background-color: var(--accent-cobalt);
}

/* Subtle Cool-Grey Skeleton Loader */
@keyframes mos-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.mos-skeleton {
  border-radius: var(--radius-chip);
  background: linear-gradient(
    90deg,
    var(--surface-control) 25%,
    var(--surface-subtle) 50%,
    var(--surface-control) 75%
  );
  background-size: 200% 100%;
  animation: mos-shimmer 1.6s ease-in-out infinite;
}
.mos-skeleton-line {
  height: 12px;
  width: 100%;
}
.mos-skeleton-circle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
}

/* Empty State */
.mos-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: var(--space-8) var(--space-5);
  text-align: center;
}

/* KPI / Stat Tile */
.mos-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mos-stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: var(--tracking-display);
  font-variant-numeric: tabular-nums;
  color: var(--ink-primary);
}

/* Pure-CSS Micro-Tooltip */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%) translateY(2px);
  padding: 5px 9px;
  border-radius: var(--radius-chip);
  background-color: var(--action-dark-bg);
  color: var(--action-dark-fg);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 90;
  transition: opacity var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard);
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Diagram & Node-Graph Primitives ---- */
.mos-canvas {
  position: relative;
  width: 100%;
  overflow-x: auto;
  padding: var(--space-6);
  background-color: var(--surface-subtle);
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1px);
  background-size: 16px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-shell);
}

.mos-node {
  position: relative;
  background-color: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-tile);
  box-shadow: var(--shadow-tile);
  display: flex;
  flex-direction: column;
  transition:
    border-color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard);
}
.mos-node:hover {
  border-color: var(--border-strong);
}
.mos-node.is-selected {
  border-color: var(--accent-cobalt);
  box-shadow: var(--focus-ring);
}
.mos-node.is-selected-violet {
  border-color: var(--accent-violet);
  box-shadow: 0 0 0 3px var(--accent-violet-soft);
}

.mos-node-flag {
  position: absolute;
  top: -22px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-chip);
  background-color: var(--surface-card);
  border: 1px solid var(--border-subtle);
  color: var(--ink-secondary);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.mos-node-flag-amber {
  background-color: var(--accent-amber-soft);
  border-color: transparent;
  color: var(--accent-amber-ink);
}
.mos-node-flag-cobalt {
  background-color: var(--accent-cobalt-soft);
  border-color: transparent;
  color: var(--accent-cobalt-ink);
}

.mos-node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 10px 12px;
  border-bottom: 1px solid var(--divider);
}
.mos-node-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.mos-node-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 8px 12px;
  border-top: 1px solid var(--divider);
  background-color: var(--surface-subtle);
  border-radius: 0 0 var(--radius-tile) var(--radius-tile);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
}

.mos-node-port {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  background-color: var(--surface-card);
  border: 2px solid var(--action-dark-bg);
  z-index: 2;
  transition: transform var(--motion-fast) var(--ease-standard);
}
.mos-node-port-left {
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
}
.mos-node-port-right {
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
}
.mos-node-port-cobalt { border-color: var(--accent-cobalt); }
.mos-node-port-violet { border-color: var(--accent-violet); }
.mos-node-port-magenta { border-color: var(--accent-magenta); }
.mos-node-port-amber { border-color: var(--accent-amber); }

.mos-edge {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mos-edge-dark { stroke: var(--action-dark-bg); }
.mos-edge-cobalt { stroke: var(--accent-cobalt); }
.mos-edge-violet { stroke: var(--accent-violet); }
.mos-edge-magenta { stroke: var(--accent-magenta); }
.mos-edge-dashed { stroke-dasharray: 4 4; }

.mos-flow-step-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
}
.mos-flow-stem {
  width: 1.5px;
  height: 14px;
  background-color: var(--accent-violet);
  opacity: 0.45;
}
.mos-flow-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background-color: var(--surface-card);
  color: var(--accent-violet-ink);
  cursor: pointer;
  transition:
    background-color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    transform var(--motion-press) var(--ease-standard);
}
.mos-flow-add:hover {
  background-color: var(--accent-violet-soft);
  border-color: var(--accent-violet);
}
.mos-flow-add:active {
  transform: translateY(var(--press-y));
}

/* ---- Fast Blur Fade-Up View/Step Entrance ---- */
@keyframes mos-blur-fade-up {
  from {
    opacity: 0;
    transform: translateY(var(--motion-enter-y));
    filter: blur(var(--motion-enter-blur));
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.mos-enter-blur-up {
  animation: mos-blur-fade-up var(--motion-enter) var(--ease-standard) both;
  will-change: opacity, transform, filter;
}

/* ---- Reduced Motion Guard ---- */
@media (prefers-reduced-motion: reduce) {
  .mos-app *,
  .mos-app *::before,
  .mos-app *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .mos-enter-blur-up {
    filter: none !important;
    transform: none !important;
  }
}
