:root,
html[data-theme="dark"] {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243044;
  --border: #3d4f66;
  --text: #e8eef4;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-dim: #0ea5e9;
  --on-accent: #0f1419;
  --success: #4ade80;
  --danger: #f87171;
  --warning: #fbbf24;
  --manual: #a78bfa;
  --auto: #34d399;
  --canvas-bg: #121820;
  --overlay: rgba(0, 0, 0, 0.55);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.35rem;
  --nav-active-bar: var(--accent);
}

html[data-theme="light"] {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #e2e8f0;
  --border: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0284c7;
  --accent-dim: #0ea5e9;
  --on-accent: #ffffff;
  --success: #15803d;
  --danger: #b91c1c;
  --warning: #b45309;
  --manual: #7c3aed;
  --auto: #059669;
  --canvas-bg: #e2e8f0;
  --overlay: rgba(15, 23, 42, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: var(--text-sm);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 100;
}

.header-start {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.deploy-env-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 0.25rem;
}

.deploy-env-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.deploy-env-reset {
  font-size: 0.75rem;
  white-space: nowrap;
}

.auth-header-slot {
  display: flex;
  align-items: center;
}

.auth-header-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.45rem 0.25rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: var(--text-sm);
}

.auth-header-chip__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.auth-header-chip__name {
  font-weight: 600;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-header-chip__user {
  font-size: var(--text-xs);
  color: var(--muted);
}

.user-avatar {
  --avatar-size: 40px;
  --avatar-hue: 200;
  position: relative;
  display: inline-flex;
  width: var(--avatar-size);
  height: var(--avatar-size);
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: hsl(var(--avatar-hue) 55% 42%);
  border: 2px solid color-mix(in srgb, var(--border) 80%, transparent);
}

.user-avatar__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--surface);
}

.user-avatar__fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--avatar-size) * 0.34);
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

.user-avatar__img:not([src]),
.user-avatar--offline .user-avatar__img {
  display: none;
}

.user-avatar__img:not([src]) ~ .user-avatar__fallback,
.user-avatar--offline .user-avatar__fallback {
  display: flex;
}

.user-profile-body {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
}

.user-profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1.25rem;
  min-width: 14rem;
}

.user-profile-name {
  margin: 0.5rem 0 0;
  font-size: 1.2rem;
}

.user-profile-username {
  margin: 0;
  color: var(--muted);
}

.user-profile-table-wrap {
  flex: 1;
  min-width: min(100%, 22rem);
}

.user-profile-table-wrap th {
  width: 38%;
  text-align: left;
  font-weight: 500;
  color: var(--muted);
}

.auth-users-table .auth-user-row__avatar {
  width: 3.25rem;
  vertical-align: middle;
}

.auth-user-row__actions {
  text-align: right;
  white-space: nowrap;
}

.user-detail-url {
  word-break: break-all;
  font-size: 0.82rem;
}

.report-catalog-flow-block {
  margin-top: 1.25rem;
}

.report-catalog-flow-block:first-of-type {
  margin-top: 0.75rem;
}

.report-catalog-flow-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.form-row--full {
  grid-column: 1 / -1;
}

.master-def-entity-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: min(40vh, 16rem);
  overflow: auto;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2, rgba(255, 255, 255, 0.02));
}

.master-def-entity-check {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  cursor: pointer;
}

.master-def-entity-check__label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.master-def-editor-body {
  max-width: 52rem;
}

.master-def-entities-panel {
  margin-top: 0.5rem;
}

.master-record-editor-body {
  max-width: 52rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.master-record-entity-panel {
  margin-top: 0;
}

.master-record-fields {
  margin-top: 0.5rem;
}

.master-record-field--auto input {
  opacity: 0.85;
}

.master-abm-definitions-panel {
  margin-bottom: 1rem;
}

.master-abm-definitions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  gap: 0.75rem;
  margin-top: 0.65rem;
}

.master-abm-definition-card {
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2, rgba(255, 255, 255, 0.02));
}

.master-abm-definition-card.is-selected {
  border-color: var(--accent, #5b9fd4);
}

.master-abm-definition-card h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.master-abm-definition-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.master-abm-blocks {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 0.75rem;
}

.master-abm-block__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.master-abm-block__title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.master-abm-incomplete-hint {
  margin: 0 0 0.75rem;
}

.app-shell.is-auth-locked .nav-drawer,
.app-shell.is-auth-locked .nav-overlay {
  visibility: hidden;
  pointer-events: none;
}

.app-shell.is-auth-locked .app-main {
  max-width: none;
}

.auth-gate {
  min-height: calc(100vh - 8rem);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem 1rem 2rem;
  border: none;
  background: transparent;
}

.auth-gate__inner {
  width: min(960px, 100%);
}

.auth-gate__header h2 {
  margin: 0 0 0.35rem;
  font-size: var(--text-xl);
}

.auth-gate__subtitle {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: var(--text-sm);
}

.auth-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.auth-user-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
}

.auth-user-card__name {
  margin: 0;
  font-size: 1.05rem;
}

.auth-user-card__username {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.auth-user-card__form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.auth-user-card__label {
  font-size: var(--text-xs);
  color: var(--muted);
}

.auth-user-card__input {
  width: 100%;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.auth-user-card__submit {
  margin-top: 0.25rem;
  width: 100%;
}

.auth-gate__hint {
  margin-top: 1.25rem;
  text-align: center;
}

.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 1px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .theme-icon-sun {
  display: none;
}

.theme-toggle .theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-toggle .theme-icon-sun {
  display: block;
}

html[data-theme="light"] .theme-toggle .theme-icon-moon {
  display: block;
}

.nav-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.nav-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(300px, 88vw);
  height: 100vh;
  z-index: 210;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transform: translateX(-105%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.22s ease, visibility 0.22s ease;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.nav-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

.app-shell {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.app-shell .app-main {
  flex: 1;
  min-width: 0;
}

@media (min-width: 768px) {
  .nav-overlay {
    display: none !important;
  }

  .nav-drawer {
    position: relative;
    top: auto;
    left: auto;
    height: auto;
    width: 280px;
    min-width: 280px;
    z-index: 1;
    flex-shrink: 0;
    transform: none;
    visibility: visible;
    pointer-events: auto;
    box-shadow: none;
    padding-top: 1rem;
    transition: width 0.22s ease, min-width 0.22s ease, padding 0.22s ease, opacity 0.2s ease;
  }

  .nav-drawer:not(.is-open) {
    transform: none;
  }

  .app-shell.is-nav-collapsed .nav-drawer {
    width: 0;
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
    border-right-width: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
  }

  body.nav-open {
    overflow: auto;
  }
}

.nav-drawer-title {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.nav-drawer .nav-btn {
  width: 100%;
  text-align: left;
}

.nav-drawer-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-drawer-footer a {
  color: var(--accent);
}

body.nav-open {
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--manual));
}

.brand h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.main-nav {
  display: none;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.15rem;
}

.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-left: 0.55rem;
  padding-left: 0.65rem;
  border-left: 1px solid var(--border);
}

.nav-sub .nav-btn,
.nav-sub-btn {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.42rem 0.65rem;
}

.nav-group-toggle.is-active + .nav-sub .nav-sub-btn.is-active {
  border-color: var(--accent-muted, var(--border));
}

.nav-sub-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.nav-sub-group:first-of-type {
  margin-top: 0.25rem;
}

.nav-sub-group-label {
  margin: 0 0 0.1rem 0.15rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-sub-group.is-active .nav-sub-group-label {
  color: var(--accent, var(--text));
}

.nav-master-records-abm-items {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0.15rem 0 0 0.65rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border);
}

.nav-master-records-abm-empty {
  margin: 0.25rem 0 0 0.65rem;
  padding-left: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.nav-sub-btn--abm-def {
  font-size: 0.8125rem;
  text-align: left;
}

.master-records-abm-count {
  margin: 0 0 0.75rem;
}

.master-record-editor-version {
  margin: 0 0 1rem;
}

.master-record-history-detail {
  margin-top: 1rem;
}

.master-import-hero .master-import-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.master-import-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.master-import-stat {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.master-import-stat__n {
  display: block;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
}

.master-import-stat--ok .master-import-stat__n {
  color: var(--success, #3d9a5f);
}

.master-import-stat--warn .master-import-stat__n {
  color: var(--warning, #c9a227);
}

.master-import-stat--err .master-import-stat__n {
  color: var(--danger);
}

.master-import-subtitle {
  margin: 1rem 0 0.5rem;
  font-size: 0.92rem;
}

.master-import-issue-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
}

.master-import-normalize-opt {
  display: block;
  margin-top: 0.65rem;
}

.data-backup-actions {
  margin: 1rem 0;
}

.data-backup-keys {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.data-backup-import-panel {
  margin-top: 1rem;
}

.data-backup-merge-opt {
  display: block;
  margin: 0.65rem 0;
}

.data-backup-warn {
  color: var(--muted);
}

.page-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.master-record-history-pre {
  margin: 0.5rem 0 0;
  padding: 0.75rem;
  font-size: 0.75rem;
  max-height: 14rem;
  overflow: auto;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border);
  background: var(--surface-2, rgba(0, 0, 0, 0.15));
}

.nav-sub-btn--nested {
  margin-left: 0.15rem;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nav-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-btn:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

.nav-btn.is-active {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  color: var(--text);
  font-weight: 600;
}

.nav-btn.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--nav-active-bar);
}

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

.app-main {
  flex: 1;
  padding: 1.25rem 1.5rem;
  overflow: auto;
}

.app-footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
}

.app-footer a {
  color: var(--accent);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.panel-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
}

.btn:hover:not(:disabled) {
  border-color: var(--accent);
}

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

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border);
}

.btn-primary {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.btn-success {
  background: #166534;
  border-color: var(--success);
  color: var(--success);
}

.btn-danger {
  background: #7f1d1d;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 500;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-borrador {
  background: #422006;
  color: var(--warning);
}

.badge-listo {
  background: #14532d;
  color: var(--success);
}

.badge-deprecado {
  background: #334155;
  color: var(--muted);
}

.flow-readonly-banner,
.flow-draft-banner {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.flow-draft-banner {
  border-color: color-mix(in srgb, var(--warning) 45%, var(--border));
}

.split-designer.is-read-only .palette-item {
  opacity: 0.55;
  cursor: not-allowed;
}

.split-designer.is-read-only .flow-node {
  cursor: default;
}

.split-designer.is-read-only .palette-tool:not([data-tool="select"]) {
  opacity: 0.45;
  pointer-events: none;
}

.split-designer.is-read-only .props-form input:not([type="checkbox"]),
.split-designer.is-read-only .props-form select,
.split-designer.is-read-only .props-form textarea {
  opacity: 0.92;
  cursor: not-allowed;
}

.props-intro--readonly {
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--muted) 35%, var(--border));
  background: color-mix(in srgb, var(--muted) 8%, transparent);
  font-size: 0.82rem;
}

.toolbar-flow-version {
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: 0.35rem;
}

.badge-curso {
  background: #1e3a5f;
  color: var(--accent);
}

.badge-completada {
  background: #14532d;
  color: var(--success);
}

.badge-rechazada {
  background: #7f1d1d;
  color: var(--danger);
}

.form-grid {
  display: grid;
  gap: 0.75rem;
}

.form-hint {
  margin: 0.25rem 0 0;
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.4;
}

.form-row label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-row input:focus-visible,
.form-row select:focus-visible,
.form-row textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.form-row textarea {
  min-height: 72px;
  resize: vertical;
}

.form-row--date .date-input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
}

.form-row--date .date-input-wrap input[type="date"].input-date-native {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding-right: 2.75rem;
  color-scheme: light dark;
  cursor: pointer;
}

.form-row--date .date-input-wrap input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  position: absolute;
  right: 0;
  width: 2.75rem;
  height: 100%;
  cursor: pointer;
}

.date-input-picker-btn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  pointer-events: auto;
}

.date-input-picker-btn:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.date-input-picker-icon {
  display: block;
}

.split {
  display: grid;
  gap: 1rem;
}

.designer-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
}

.designer-panel-head .panel-title {
  margin: 0;
}

.designer-panel-close {
  display: inline-flex;
  min-width: 2rem;
  padding: 0.25rem 0.5rem;
  line-height: 1;
}

.designer-panel-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-right: 0.35rem;
}

.split-designer {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  position: relative;
  min-height: calc(100vh - 180px);
  max-height: calc(100vh - 180px);
  align-items: stretch;
  gap: 0;
}

.split-designer > .canvas-wrap {
  grid-column: 1;
  grid-row: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.split-designer > .palette,
.split-designer > .props-panel {
  display: none;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 4px 24px color-mix(in srgb, var(--text) 18%, transparent);
  z-index: 25;
}

.split-designer.is-palette-open > .palette,
.split-designer.is-props-open > .props-panel {
  display: flex;
}

.btn.is-toggle-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-2));
}

.designer-viewport-blocked {
  max-width: 36rem;
  margin: 1rem auto;
}

.designer-viewport-blocked-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.75rem 0 0;
}

.designer-viewport-banner {
  font-size: 0.85rem;
  line-height: 1.4;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
}

.designer-viewport-banner--critical {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface-2));
  color: var(--text);
}

.designer-viewport-banner--tablet {
  border-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, var(--surface-2));
  color: var(--text);
}

.catalog-viewport-warning {
  font-size: 0.85rem;
  line-height: 1.45;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  margin: 0.75rem 0;
  border: 1px solid var(--border);
}

.catalog-viewport-warning--blocked {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface-2));
}

.catalog-viewport-warning--critical {
  border-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 10%, var(--surface-2));
}

.catalog-viewport-warning--tablet {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
}

.catalog-flow-filters {
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.catalog-flow-filters__search {
  flex: 1 1 14rem;
  min-width: min(100%, 14rem);
}

.catalog-flow-filters__search input[type="search"] {
  width: 100%;
  max-width: 22rem;
}

.catalog-flow-filters__actions {
  align-self: flex-end;
}

.catalog-flow-filters__actions-label {
  visibility: hidden;
  height: 0;
  margin: 0;
  padding: 0;
}

.catalog-flow-filters__summary {
  flex: 1 1 100%;
  margin: 0;
}

.catalog-toolbar-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

/* Catálogo de flujos — árbol listo / deprecado */
.table-modern.catalog-flow-tree {
  border-collapse: separate;
  border-spacing: 0 0.5rem;
}

.catalog-flow-tree thead th {
  padding-bottom: 0.65rem;
}

.catalog-flow-tree tbody tr:hover {
  background: transparent;
}

.table-modern.catalog-flow-tree th,
.table-modern.catalog-flow-tree td {
  border-bottom: none;
}

.table-modern.catalog-flow-tree thead th {
  border-bottom: 1px solid var(--border);
}

.catalog-flow-tree .catalog-name-cell {
  min-width: 12rem;
  vertical-align: middle;
}

.catalog-name-cell-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.catalog-flow-name {
  font-weight: 500;
}

.catalog-version {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.9em;
}

.catalog-version--current {
  color: var(--text);
  font-weight: 600;
}

.catalog-tree-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.catalog-tree-toggle:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.catalog-tree-toggle.is-expanded {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
}

.catalog-tree-chevron {
  transition: transform 0.2s ease;
  transform: rotate(0deg);
}

.catalog-tree-toggle.is-expanded .catalog-tree-chevron {
  transform: rotate(90deg);
}

.catalog-tree-toggle--spacer {
  display: inline-block;
  width: 1.65rem;
  flex-shrink: 0;
}

.catalog-tree-count {
  flex-shrink: 0;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--muted) 25%, var(--border));
}

.catalog-tree-count--muted {
  text-transform: none;
  font-weight: 500;
  letter-spacing: 0;
  font-size: 0.72rem;
}

.catalog-muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.table-modern.catalog-activity-tree {
  border-collapse: separate;
  border-spacing: 0 0.55rem;
}

.catalog-tree-node--component {
  align-items: center;
  gap: 0.5rem;
}

.catalog-component-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
}

.catalog-component-shape.palette-shape-icon {
  width: 14px;
  height: 14px;
  border-width: 1.5px;
}

.catalog-component-icon-wrap--gateway .catalog-component-gateway {
  width: 14px;
  height: 14px;
  transform: rotate(45deg);
  border-width: 1.5px;
}

.catalog-component-icon-wrap--gateway .gateway-mark {
  transform: rotate(-45deg) scale(0.85);
}

.catalog-component-glyph {
  font-size: 0.95rem;
  line-height: 1;
}

.catalog-component-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.catalog-component-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-component-kind-hint {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.2;
}

.catalog-lineage-group {
  transition: filter 0.15s ease;
}

.catalog-lineage-group.has-children.is-collapsed .catalog-row--parent td {
  background: color-mix(in srgb, var(--surface-2) 92%, var(--surface));
}

.catalog-lineage-group.has-children.is-collapsed .catalog-row--parent td:first-child {
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 50%, transparent);
  border-radius: 10px 0 0 10px;
}

.catalog-lineage-group.has-children.is-collapsed .catalog-row--parent td:last-child {
  border-radius: 0 10px 10px 0;
}

.catalog-lineage-group.has-children.is-collapsed:hover .catalog-row--parent td {
  background: color-mix(in srgb, var(--accent) 6%, var(--surface-2));
}

.catalog-lineage-group.has-children.is-expanded .catalog-row--parent td {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
}

.catalog-lineage-group.has-children.is-expanded .catalog-row--parent td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
  border-radius: 10px 0 0 0;
}

.catalog-lineage-group.has-children.is-expanded .catalog-row--parent td:last-child {
  border-radius: 0 10px 0 0;
}

.catalog-lineage-group.has-children.is-expanded .catalog-row--parent .catalog-flow-name {
  font-weight: 600;
}

.catalog-name-cell--child {
  padding-left: 0.35rem !important;
}

.catalog-tree-node {
  display: flex;
  align-items: stretch;
  gap: 0.65rem;
  min-height: 1.5rem;
  padding-left: 0.15rem;
}

.catalog-tree-rail {
  position: relative;
  flex-shrink: 0;
  width: 1.25rem;
  margin-left: 0.85rem;
}

.catalog-tree-rail::before {
  content: "";
  position: absolute;
  left: 0;
  top: -0.65rem;
  bottom: 50%;
  width: 2px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.catalog-tree-rail::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 0.65rem;
  height: 2px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--accent) 35%, var(--border));
  transform: translateY(-50%);
}

.catalog-lineage-group.is-expanded .catalog-row--child td {
  background: color-mix(in srgb, var(--muted) 5%, var(--surface));
}

.catalog-lineage-group.is-expanded .catalog-row--child:last-child td:first-child {
  border-radius: 0 0 0 10px;
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 25%, transparent);
}

.catalog-lineage-group.is-expanded .catalog-row--child:last-child td:last-child {
  border-radius: 0 0 10px 0;
}

.catalog-row--child.catalog-row--deprecated td {
  background: color-mix(in srgb, var(--muted) 6%, var(--surface));
}

.catalog-row--child.catalog-row--deprecated .catalog-flow-name {
  color: color-mix(in srgb, var(--text) 78%, var(--muted));
  font-weight: 400;
}

.catalog-row--child.catalog-row--deprecated .catalog-tree-rail::before,
.catalog-row--child.catalog-row--deprecated .catalog-tree-rail::after {
  background: color-mix(in srgb, var(--muted) 45%, var(--border));
}

.catalog-row--child.catalog-row--draft td {
  background: color-mix(in srgb, #eab308 8%, var(--surface));
}

.catalog-row--child.catalog-row--draft .catalog-tree-rail::before,
.catalog-row--child.catalog-row--draft .catalog-tree-rail::after {
  background: color-mix(in srgb, #eab308 45%, var(--border));
}

.catalog-lineage-group:not(.has-children) .catalog-name-cell-inner {
  padding-left: calc(1.65rem + 0.5rem);
}

.catalog-section {
  margin-top: 1.5rem;
}

.catalog-section-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
}

.catalog-section-hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.empty-state--compact {
  padding: 1.25rem 1rem;
  margin-bottom: 1rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  text-align: center;
}

.catalog-toolbar-secondary__hint {
  margin: 0;
  flex: 1;
  min-width: 12rem;
  font-size: var(--text-sm);
  color: var(--muted);
}

.catalog-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#btn-new-flow:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.palette-panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-right: 0.15rem;
}

.palette-section-collapse .props-collapse-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

@media (max-width: 959px) {
  .split-designer {
    grid-template-areas:
      "canvas"
      "palette"
      "props";
    grid-template-rows: auto auto auto;
    min-height: 0;
    max-height: none;
    gap: 1rem;
  }

  .split-designer > .canvas-wrap {
    grid-area: canvas;
    grid-column: 1;
    grid-row: auto;
    min-height: min(62vh, 520px);
  }

  .split-designer > .palette,
  .split-designer > .props-panel {
    position: static;
    box-shadow: none;
    max-height: 42vh;
    width: auto;
  }

  .split-designer > .palette {
    grid-area: palette;
  }

  .split-designer > .props-panel {
    grid-area: props;
  }

  .toolbar .btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.65rem;
  }
}

@media (min-width: 960px) {
  .split-designer > .palette {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(280px, 90vw);
    max-height: none;
  }

  .split-designer > .props-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(320px, 92vw);
    max-height: none;
  }
}

.palette {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.palette-section-title {
  margin: 0.35rem 0 0;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.palette-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
  line-height: 1.35;
}

.palette-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.palette-item {
  padding: 0.6rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  cursor: grab;
  font-size: 0.85rem;
  user-select: none;
}

.palette-tool {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
}

.palette-tool.is-tool-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  outline: 1px solid var(--accent);
}

.palette-task-toggle {
  cursor: default;
}

.palette-chevron {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  font-size: 0.75rem;
}

.palette-submenu {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-left: 0.5rem;
  border-left: 2px solid var(--border);
  margin-left: 0.35rem;
}

.palette-shape-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--surface);
}

.icon-start {
  border-radius: 50%;
  border-color: var(--accent);
}

.icon-end {
  border-radius: 50%;
  border-width: 3px;
  border-color: var(--danger);
}

.icon-gateway {
  transform: rotate(45deg);
  border-color: var(--warning);
  width: 18px;
  height: 18px;
  margin: 2px;
}

.icon-gateway-diamond {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  transform: rotate(45deg);
  border: 2px solid var(--warning);
  border-radius: 2px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gateway-mark {
  transform: rotate(-45deg);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  color: var(--warning);
}

.gateway-mark-parallel::before {
  content: "+";
}

.gateway-mark-exclusive::before {
  content: "×";
}

.gateway-mark-inclusive::before {
  content: "○";
  font-weight: 400;
}

.gateway-mark-event::before {
  content: "◎";
  font-size: 0.55rem;
  font-weight: 400;
}

.gateway-mark-event-exclusive::before {
  content: "○";
  font-weight: 400;
}

.gateway-mark-event-parallel::before {
  content: "+";
}

.gateway-mark-complex::before {
  content: "*";
}

.palette-gateway-toggle {
  cursor: default;
}

.palette-item-future {
  opacity: 0.55;
  cursor: not-allowed;
}

.future-badge {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
}

.gateway-type-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.gateway-type-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  padding: 0.25rem 0;
}

.gateway-type-option-future {
  opacity: 0.55;
}

.context-pad-btn-future {
  opacity: 0.55;
  cursor: not-allowed;
}

.icon-task,
.icon-user-task,
.icon-service-task {
  border-radius: 6px;
}

.icon-user-task {
  border-color: var(--manual);
}

.icon-service-task {
  border-color: var(--auto);
}

.icon-select {
  border-radius: 4px;
  border-style: solid;
  opacity: 0.7;
}

.palette-line-icon {
  width: 28px;
  height: 12px;
  flex-shrink: 0;
  position: relative;
}

.icon-line-sequence::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: var(--accent);
  transform: translateY(-50%);
}

.icon-line-message {
  background: linear-gradient(90deg, transparent 0, transparent 40%, var(--muted) 40%, var(--muted) 45%, transparent 45%);
}

.icon-line-message::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  transform: translateY(-50%);
}

.icon-line-message::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  border: 4px solid transparent;
  border-left-color: var(--muted);
  transform: translateY(-50%);
}

.icon-line-association::after {
  content: "";
  position: absolute;
  left: 0;
  right: 4px;
  top: 50%;
  border-top: 2px dashed var(--muted);
  transform: translateY(-50%);
}

.flow-node {
  position: absolute;
}

.flow-port {
  position: absolute;
  top: 50%;
  right: -7px;
  width: 12px;
  height: 12px;
  transform: translateY(-50%);
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--surface);
  cursor: crosshair;
  padding: 0;
  z-index: 6;
  box-shadow: 0 0 0 2px var(--canvas-bg);
}

.flow-port:hover {
  background: var(--accent);
}

.flow-port-accept {
  border-color: #4ade80;
}

.flow-port-accept:hover {
  background: #4ade80;
}

.flow-port-reject {
  border-color: #f87171;
}

.flow-port-reject:hover {
  background: #f87171;
}

.context-pad-connect {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.flow-node.is-link-target {
  outline-color: var(--success);
}

.line-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: var(--surface-2);
  margin-right: 0.25rem;
}

.line-badge-sequence {
  color: var(--accent);
}

.line-badge-message {
  color: var(--muted);
}

.line-badge-association {
  color: var(--muted);
}

.palette-item:active {
  cursor: grabbing;
}

.catalog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.palette-inicio { border-color: var(--accent); }
.palette-manual { border-color: var(--manual); }
.palette-auto { border-color: var(--auto); }
.palette-gateway { border-color: var(--warning); }
.palette-fin { border-color: var(--danger); }

.canvas-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 480px;
  background-color: var(--canvas-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.canvas-wrap:fullscreen {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  min-height: 100vh;
  border-radius: 0;
  border: none;
}

.canvas-wrap:fullscreen .canvas-viewport {
  flex: 1;
  min-height: 0;
}

.canvas-view-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}

.canvas-zoom-label {
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 2.75rem;
  text-align: center;
}

.canvas-viewport {
  position: relative;
  flex: 1;
  min-height: 420px;
  overflow: hidden;
  cursor: grab;
  background:
    linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--border) 1px, transparent 1px) 0 0 / 24px 24px;
  background-color: var(--canvas-bg);
}

.canvas-viewport.is-panning {
  cursor: grabbing;
}

.canvas-stage {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

.canvas {
  position: relative;
  min-width: 1200px;
  min-height: 600px;
}

.canvas svg.connections {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.flow-connection-hit {
  pointer-events: stroke;
  cursor: pointer;
}

.flow-connection-group:hover .flow-connection-line {
  stroke-width: 3;
  filter: drop-shadow(0 0 2px rgba(56, 189, 248, 0.6));
}

.flow-pool {
  position: absolute;
  left: 12px;
  top: 12px;
  display: flex;
  flex-direction: row;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 35%, transparent);
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.flow-pool-name {
  width: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  line-height: 1.2;
}

.flow-pool-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.flow-lane {
  display: flex;
  flex-direction: row;
  border-bottom: 1px solid var(--border);
  min-height: 120px;
}

.flow-lane:last-child {
  border-bottom: none;
}

.flow-lane-title {
  width: 44px;
  flex-shrink: 0;
  padding: 0.35rem 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 85%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  text-align: center;
  line-height: 1.2;
  max-height: 100%;
  min-height: 0;
}

.flow-lane-title-text {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.flow-lane-remove {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--danger) 55%, var(--border));
  border-radius: 4px;
  background: color-mix(in srgb, var(--danger) 18%, var(--surface));
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}

.flow-lane-remove:hover {
  background: color-mix(in srgb, var(--danger) 35%, var(--surface));
}

.flow-lane-content {
  flex: 1;
  min-width: 0;
}

.flow-diagram-props h4 {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.85rem;
}

.lane-editor-row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.lane-name-input {
  flex: 1;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
}

.palette-kind-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  font-size: 0.9rem;
  line-height: 1;
}

.palette-submenu[hidden] {
  display: none !important;
}

.context-pad-submenu[hidden] {
  display: none !important;
}

.flow-node {
  position: absolute;
  overflow: visible;
  z-index: 3;
  min-width: 140px;
  max-width: 180px;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: move;
  font-size: 0.8rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.flow-node.node-inicio,
.flow-node.node-fin {
  width: 52px;
  min-width: 52px;
  max-width: 52px;
  height: 52px;
  padding: 0.35rem;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.flow-node.node-inicio {
  border-width: 2px;
}

.flow-node.node-fin {
  border-width: 4px;
  border-color: var(--danger);
}

.flow-node.node-inicio .node-name,
.flow-node.node-fin .node-name {
  display: none;
}

.flow-node.node-inicio .node-kind,
.flow-node.node-fin .node-kind {
  font-size: 0.55rem;
  margin: 0;
}

.flow-node.node-gateway {
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.gateway-node-shape {
  position: absolute;
  inset: 0;
  transform: rotate(45deg);
  border-radius: 4px;
  border: 2px solid var(--warning);
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.flow-node.node-gateway .gateway-node-shape .node-kind,
.flow-node.node-gateway .gateway-node-shape .node-name,
.flow-node.node-gateway .gateway-node-shape .bpmn-gateway-x {
  transform: rotate(-45deg);
  pointer-events: none;
}

.flow-node.node-gateway .node-name {
  display: none;
}

.flow-node.node-gateway .node-kind {
  font-size: 0.5rem;
  line-height: 1.1;
}

.bpmn-gateway-x {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  color: var(--warning);
}

.flow-node.node-manual,
.flow-node.node-automatica {
  width: 148px;
  min-width: 148px;
  border-radius: 12px;
  text-align: left;
  padding-top: 0.45rem;
}

.bpmn-task-icon {
  float: right;
  font-size: 0.85rem;
  opacity: 0.85;
}

.flow-node.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  z-index: 10;
  box-shadow: var(--shadow-md);
}

.selection-handles {
  position: absolute;
  inset: -6px;
  pointer-events: none;
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 12px;
}

.selection-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 1px solid var(--canvas-bg);
}

.selection-handle-nw { top: -4px; left: -4px; }
.selection-handle-ne { top: -4px; right: -4px; }
.selection-handle-sw { bottom: -4px; left: -4px; }
.selection-handle-se { bottom: -4px; right: -4px; }

.context-pad {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 7.5rem;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  z-index: 30;
  pointer-events: auto;
}

.context-pad-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  min-height: 32px;
  height: auto;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  cursor: pointer;
  color: var(--text);
}

.context-pad-label {
  flex: 1;
  font-size: 0.62rem;
  line-height: 1.15;
  text-align: left;
  white-space: nowrap;
}

.context-pad-btn:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
}

.context-pad-btn-danger {
  border-color: color-mix(in srgb, var(--danger, #ef4444) 45%, var(--border));
}

.context-pad-btn-danger:hover {
  border-color: var(--danger, #ef4444);
  background: color-mix(in srgb, var(--danger, #ef4444) 12%, var(--surface-2));
}

.context-pad-delete-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.context-pad-btn .palette-shape-icon {
  width: 18px;
  height: 18px;
}

.context-pad-kind-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  font-size: 0.85rem;
  line-height: 1;
}

.context-pad-branch {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}

.context-pad-task-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.context-pad-task-row {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
}

.context-pad-task-main {
  flex: 1;
  min-width: 0;
}

.context-pad-chevron {
  flex-shrink: 0;
  width: 18px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1;
  cursor: pointer;
}

.context-pad-chevron:hover {
  border-color: var(--accent);
  color: var(--text);
}

.context-pad-submenu {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-left: 4px;
  border-left: 2px solid var(--border);
  margin-left: 2px;
}

.context-pad-submenu-btn {
  width: 100%;
}

.flow-node .node-kind {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.flow-node .node-name {
  font-weight: 600;
  margin-top: 0.2rem;
}

.node-inicio { border-color: var(--accent); }
.node-manual { border-color: var(--manual); }
.node-automatica { border-color: var(--auto); }
.node-fin { border-color: var(--danger); }

.props-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.props-section h4 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.props-panel .panel-title {
  flex-shrink: 0;
}

.props-panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.props-form {
  gap: 0.35rem;
}

.props-collapse {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  margin-bottom: 0.4rem;
}

.props-collapse-summary {
  cursor: pointer;
  padding: 0.5rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  user-select: none;
}

.props-collapse-summary::-webkit-details-marker {
  display: none;
}

.props-collapse-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.35rem;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.props-collapse[open] > .props-collapse-summary::before {
  transform: rotate(90deg);
}

.props-collapse-body {
  padding: 0 0.65rem 0.65rem;
  border-top: 1px solid var(--border);
}

.props-collapse-body .form-row:first-child {
  margin-top: 0.5rem;
}

.props-intro {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.5rem 0 0.75rem;
}

.props-subtitle {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.props-connection-list {
  margin: 0.35rem 0 0;
  padding-left: 1rem;
  font-size: 0.8rem;
}

.props-connection-list .props-empty {
  color: var(--muted);
}

.props-delete-node {
  margin-top: 0.5rem;
  width: 100%;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.chip button {
  margin-left: 0.35rem;
  border: none;
  background: none;
  color: var(--danger);
  cursor: pointer;
  padding: 0;
}

.validation-list {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--danger);
}

.validation-modal-body {
  padding: 0 0.25rem 0.5rem;
}

.validation-modal-intro {
  margin: 0 0 0.75rem;
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.5;
}

.validation-modal-list {
  max-height: min(50vh, 320px);
  overflow-y: auto;
  margin-bottom: 1rem;
}

.validation-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.modal-root {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-root[hidden] {
  display: none;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 1.25rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.component-attr-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.component-attr-tabs {
  display: flex;
  gap: 0.35rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}

.component-attr-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.component-attr-tab.is-active {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-2);
}

.component-attr-hint {
  margin: 0 0 0.65rem;
}

.component-attr-hero-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.component-attr-hero-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.new-flow-hero-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-top: 0.25rem;
}

.new-flow-form {
  max-width: 36rem;
}

.entity-editor-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.entity-editor-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 42rem;
}

.entity-meta-panel {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.entity-meta-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.entity-meta-grid {
  gap: 0.85rem;
}

.entity-attr-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.entity-attr-title {
  margin: 0;
  font-size: 1rem;
}

.entity-attr-table .entity-attr-input {
  width: 100%;
  min-width: 5rem;
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.entity-attr-required label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.entity-attr-ref {
  min-width: 10rem;
}

.entity-check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
}

.entity-meta-extends[hidden] {
  display: none !important;
}

.entity-uuid-auto-hint {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
}

.component-attr-panel--split {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}

.component-attr-master {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 92%, var(--bg));
}

.component-attr-master-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.component-attr-list-select {
  max-height: min(22rem, 42vh);
  overflow: auto;
}

.component-attr-table {
  --component-attr-grid: 1.25rem 2rem minmax(4.5rem, 1fr) minmax(5rem, 1.2fr) minmax(4rem, 0.75fr) minmax(
      4.5rem,
      0.75fr
    ) minmax(3.5rem, 0.55fr) 4.25rem;
  min-width: min(100%, 36rem);
}

.component-attr-table-head,
.component-attr-defined-row {
  display: grid;
  grid-template-columns: var(--component-attr-grid);
  column-gap: 0.45rem;
  align-items: center;
}

.component-attr-table-head {
  padding: 0.35rem 0.5rem 0.45rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.35rem;
}

.component-attr-th {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.component-attr-th-actions {
  text-align: center;
}

.component-attr-defined-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.component-attr-defined-list li {
  margin: 0;
}

.component-attr-defined-row {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  cursor: default;
  font-size: 0.8rem;
}

.component-attr-defined-row:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.component-attr-defined-row.is-selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg));
}

.component-attr-defined-row.is-dragging {
  opacity: 0.55;
}

.component-attr-defined-row.is-drop-target {
  border-color: var(--accent);
  outline: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 1px;
}

.component-attr-list-drag {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: var(--muted);
  font-size: 0.75rem;
  user-select: none;
  border-radius: 4px;
}

.component-attr-list-drag--placeholder {
  cursor: default;
}

.component-attr-list-drag:active {
  cursor: grabbing;
}

.component-attr-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-attr-cell-ord {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.component-attr-cell-key code {
  font-size: 0.75rem;
  padding: 0.05rem 0.25rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--border) 50%, transparent);
}

.component-attr-cell-muted {
  color: var(--muted);
}

.component-attr-cell-req.is-yes {
  color: var(--danger);
  font-weight: 600;
}

.component-attr-row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
}

.component-attr-icon-btn,
.action-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg) 92%, var(--border));
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  position: relative;
  flex-shrink: 0;
}

.action-icon-btn--md {
  width: 2rem;
  height: 2rem;
}

.action-icon-btn--primary {
  background: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 85%, #000);
  color: #fff;
}

.action-icon-btn--primary:hover:not(:disabled) {
  filter: brightness(1.06);
  color: #fff;
}

.action-icon-btn--danger:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  color: var(--danger);
}

.action-icon-btn--success {
  background: color-mix(in srgb, var(--success, #22c55e) 18%, var(--bg));
  border-color: color-mix(in srgb, var(--success, #22c55e) 45%, var(--border));
  color: var(--success, #16a34a);
}

.action-icon-btn--ghost {
  background: transparent;
  border-color: transparent;
}

.action-icon-btn--ghost:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.action-icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.action-icon-btn__badge {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
  background: var(--accent);
  color: #fff;
  pointer-events: none;
}

.action-icon-svg,
.component-attr-action-icon {
  width: 1rem;
  height: 1rem;
  display: block;
  pointer-events: none;
}

.action-icon-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.page-header__actions.action-icon-group,
.catalog-actions.action-icon-group {
  gap: 0.35rem;
}

.screen-save-action {
  margin-top: 0.75rem;
}

.component-attr-icon-btn:hover,
.action-icon-btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent);
}

.component-attr-icon-btn--danger:hover,
.action-icon-btn--danger:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  color: var(--danger);
}

.component-attr-order-row input[type="number"] {
  max-width: 5rem;
}

.component-attr-order-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
}

.component-attr-detail {
  padding: 0.85rem 0.75rem 1rem;
}

.component-attr-detail.is-open {
  margin-top: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.component-attr-detail-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.component-attr-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  font-size: 0.85rem;
}

.component-attr-detail-empty {
  margin: 0.5rem 0;
}

.component-attr-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.65rem;
  background: var(--surface-2);
}

.component-attr-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.component-attr-options {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border);
}

.component-attr-options-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.component-attr-option-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.component-attr-option-row input[type="text"] {
  flex: 1;
  min-width: 8rem;
}

.component-attr-opt-req {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.component-attr-empty {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.25rem 0;
}

.component-attr-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.component-attr-chip {
  font-size: 0.8rem;
}

.instance-list-options {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.instance-list-option {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.screen-designer {
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .screen-designer {
    grid-template-columns: 1fr 1fr;
  }
}

.screen-blocks {
  min-height: 200px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}

.screen-block {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  margin-bottom: 0.35rem;
  background: var(--surface-2);
  border-radius: 6px;
  font-size: 0.85rem;
}

.screen-preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: var(--bg);
}

.screen-preview h3 {
  margin: 0 0 0.5rem;
}

.screen-preview .preview-field {
  margin-bottom: 0.75rem;
}

.screen-preview .preview-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.screen-preview .preview-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.toast-root {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.65rem 1rem;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.trace-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.trace-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.trace-item time {
  color: var(--muted);
  font-size: 0.75rem;
}

.progress-bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.35rem;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: flex-end;
}

.filters .form-row {
  min-width: 160px;
}

.card-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .card-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.instance-card {
  cursor: pointer;
  transition: border-color 0.15s;
}

.instance-card:hover,
.instance-card.is-selected {
  border-color: var(--accent);
}

.gestion-layout {
  display: grid;
  gap: 1rem;
}

.gestion-layout--hub {
  align-items: start;
  grid-template-columns: 1fr;
}

.gestion-panel-hub .gestion-hub-tabs {
  margin: 0 0 1rem;
}

.gestion-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  padding: 0 0.35rem;
  margin-left: 0.35rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent);
}

.component-attr-tab.is-active .gestion-tab-count {
  background: color-mix(in srgb, #fff 22%, var(--accent));
  color: #fff;
}

.gestion-hub-panel[hidden] {
  display: none !important;
}

.gestion-instance-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.gestion-manage-section-title {
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
}

.gestion-manage-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: min(70vh, 640px);
  overflow: auto;
}

.gestion-manage-attrs {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.gestion-preview-legend {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.gestion-flow-preview-wrap {
  overflow: auto;
  max-height: min(75vh, 720px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.gestion-flow-preview-canvas {
  position: relative;
  margin: 0 auto;
}

.gestion-flow-preview-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.flow-node--readonly {
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.flow-node.is-instance-current {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent);
}

.gestion-hero {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: calc(100vh - 8.5rem);
  padding: 1.25rem 1.5rem;
}

.gestion-hero-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.gestion-hero-heading h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.gestion-hero-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.gestion-hero-back {
  flex-shrink: 0;
}

.gestion-manage-body--hero {
  max-height: none;
  flex: 1;
  overflow: auto;
}

.gestion-preview-panels--hero {
  max-height: none;
  flex: 1;
  min-height: 0;
}

.gestion-preview-tabs {
  margin: 0.75rem 0 0;
}

.gestion-preview-panels {
  margin-top: 0.75rem;
  max-height: min(75vh, 720px);
  overflow: auto;
}

.gestion-preview-panel[hidden] {
  display: none !important;
}

.instance-preview-data-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.instance-preview-step-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  background: var(--surface-2);
}

.instance-preview-step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.instance-preview-step-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.instance-preview-step-time {
  font-size: var(--text-xs);
  color: var(--muted);
}

.instance-preview-step-kind {
  display: block;
  margin-top: 0.15rem;
  text-transform: capitalize;
}

.instance-preview-fields {
  width: 100%;
  margin: 0.5rem 0 0;
}

.instance-preview-fields th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  width: 38%;
  padding: 0.35rem 0.5rem 0.35rem 0;
  vertical-align: top;
  font-size: var(--text-sm);
}

.instance-preview-fields td {
  padding: 0.35rem 0;
  font-size: var(--text-sm);
  word-break: break-word;
}

.instance-preview-trace-list {
  margin: 0;
}

.instance-preview-trace-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.instance-preview-trace-msg {
  margin: 0 0 0.35rem;
  font-size: var(--text-sm);
}

.gestion-panel-finished {
  margin-top: 0.25rem;
}

.gestion-panel-list,
.gestion-panel-workspace {
  min-height: 12rem;
}

.gestion-start-actions {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.gestion-empty--inline {
  margin: 0;
  font-size: 0.9rem;
}

.gestion-instance-list .gestion-instance-row {
  cursor: pointer;
}

.gestion-instance-list .gestion-instance-row.is-selected td {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.gestion-instance-list .gestion-step-label {
  margin-right: 0.35rem;
}

.gestion-cell-muted {
  font-size: 0.85rem;
  color: var(--muted);
}

.gestion-instance-actions {
  text-align: right;
  white-space: nowrap;
}

.gestion-workspace-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.gestion-workspace-meta {
  margin-left: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: normal;
}

.gestion-workspace-step {
  font-size: 0.9rem;
  align-self: center;
}

.gestion-resolver-body {
  min-height: 8rem;
}

.designer-studio-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.5rem 0 0.75rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.designer-studio-meta {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
}

.designer-studio-root {
  margin-top: 0.5rem;
}

.designer-studio {
  display: grid;
  gap: 0.75rem;
  min-height: 420px;
}

@media (min-width: 960px) {
  .workspace-screen {
    grid-template-columns: 220px 1fr 240px;
  }
  .workspace-automation {
    grid-template-columns: 280px 1fr;
  }
}

.studio-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: var(--surface);
  min-height: 0;
  overflow: auto;
}

.studio-component-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.studio-block-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.studio-block-row span {
  flex: 1;
}

.studio-separator {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 0.75rem 0;
}

.integration-test-output {
  margin-top: 0.75rem;
  padding: 0.65rem;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 0.75rem;
  max-height: 240px;
  overflow: auto;
}

.studio-map-table {
  width: 100%;
  font-size: 0.8rem;
  border-collapse: collapse;
}

.studio-map-table th,
.studio-map-table td {
  border: 1px solid var(--border);
  padding: 0.35rem;
}

/* =============================================================================
   UX polish — page layout, tables, studio, gestión
   ============================================================================= */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.page-header__text h2 {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header__text p {
  margin: 0.35rem 0 0;
  max-width: 42rem;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.page-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.kpi-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--muted);
}

.stat-chip strong {
  color: var(--text);
  font-size: var(--text-sm);
}

.empty-state--rich {
  padding: 2.5rem 1.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 80%, var(--bg));
}

.empty-state--rich p {
  margin: 0.5rem 0 1rem;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

.empty-state__icon {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 0.75rem;
  opacity: 0.5;
  color: var(--accent);
}

.table-wrap--modern {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
  box-shadow: var(--shadow-sm);
}

.table-modern {
  width: 100%;
  border-collapse: collapse;
}

.table-modern.catalog-flow-tree {
  border-collapse: separate;
  border-spacing: 0 0.55rem;
}

.table-modern thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table-modern tbody tr {
  transition: background 0.12s ease;
}

.table-modern tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.table-row-selectable {
  cursor: pointer;
}

.table-row-selectable.is-selected,
.table-modern tbody tr.is-selected {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.toolbar--designer {
  align-items: center;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.toolbar-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.toolbar-divider {
  width: 1px;
  height: 1.5rem;
  background: var(--border);
  margin: 0 0.35rem;
  flex-shrink: 0;
}

.toolbar-flow-title {
  flex: 1;
  min-width: 8rem;
  font-weight: 600;
  font-size: var(--text-sm);
}

.segmented-control {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.segmented-control .studio-tab,
.segmented-control .btn {
  border: none;
  background: transparent;
  box-shadow: none;
  margin: 0;
}

.segmented-control .studio-tab.is-toggle-active,
.segmented-control .btn.is-toggle-active {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  font-weight: 600;
}

.designer-studio-bar {
  border-radius: var(--radius-lg);
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.node-kind-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: color-mix(in srgb, var(--manual) 25%, var(--surface));
  color: var(--manual);
  margin-left: 0.35rem;
}

.node-kind-badge--auto {
  background: color-mix(in srgb, var(--auto) 25%, var(--surface));
  color: var(--auto);
}

.studio-component-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.studio-component-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 2.5rem;
  padding: 0.4rem 0.35rem;
  font-size: 0.72rem;
  line-height: 1.25;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.studio-component-tile:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
}

.studio-block-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.35rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.25rem;
  background: var(--surface-2);
  border-bottom: none;
}

.studio-block-actions {
  display: inline-flex;
  gap: 0.2rem;
  margin-left: auto;
}

.studio-block-handle {
  width: 4px;
  height: 1.25rem;
  border-radius: 2px;
  background: var(--border);
  flex-shrink: 0;
}

.studio-block-actions .btn {
  min-width: 2rem;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

.studio-section {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.studio-section-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
}

.screen-preview-frame {
  margin-top: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg) 90%, var(--surface));
  border: 1px solid var(--border);
}

.screen-preview-frame .screen-preview {
  max-width: 28rem;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius);
}

.preview-caption {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.integration-test-output {
  font-family: ui-monospace, "Cascadia Code", monospace;
  border: 1px solid var(--border);
}

.badge-mock {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--warning) 20%, var(--surface));
  color: var(--warning);
  vertical-align: middle;
  margin-left: 0.35rem;
}

.instance-card {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  border: 1px solid var(--border);
}

.instance-card__meta {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 0.35rem;
}

.instance-card__step {
  font-size: var(--text-sm);
  margin-top: 0.5rem;
}

.instance-card:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  box-shadow: var(--shadow-sm);
}

.instance-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.gestion-empty {
  color: var(--muted);
  font-size: var(--text-sm);
  padding: var(--space-4);
}

.resolver-panel .screen-preview {
  margin-top: var(--space-3);
}

.report-split {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 900px) {
  .report-split {
    grid-template-columns: 1fr 1fr;
  }
}

.report-detail-title {
  margin-top: 0;
  font-size: var(--text-lg);
}

.report-context-json {
  font-family: ui-monospace, monospace;
  font-size: var(--text-xs);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: auto;
}

.trace-list {
  font-size: var(--text-sm);
  padding-left: 1.1rem;
}

.trace-list .trace-item {
  margin-bottom: 0.65rem;
}

.trace-list time {
  font-size: var(--text-xs);
  color: var(--muted);
}

.toast--success {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
}

.toast--error {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
}

.card-grid {
  display: grid;
  gap: var(--space-3);
}

@media (min-width: 480px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

.preview-actions--sticky {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  padding-bottom: 0.25rem;
  z-index: 2;
}

@media (max-width: 767px) {
  .preview-actions--sticky {
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
  }
}
