    :root {
      --fondo: #f4f6fb;
      --panel: #ffffff;
      --linea: #d7dceb;
      --texto: #1f2937;
      --muted: #6b7280;
      --acento: #2563eb;
      --peligro: #dc2626;
      --ok: #059669;
      --lienzo: #ffffff;
      --sombra: 0 10px 25px rgba(0,0,0,.08);
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      font-family: Arial, Helvetica, sans-serif;
      background: var(--fondo);
      color: var(--texto);
      overflow: hidden;
    }

    .app {
      display: grid;
      grid-template-columns: 320px 1fr;
      height: 100vh;
    }

    .sidebar {
      background: var(--panel);
      border-right: 1px solid var(--linea);
      padding: 16px;
      overflow: auto;
      display: flex;
      flex-direction: column;
    }

    .sidebar h1 {
      margin: 0 0 12px;
      font-size: 22px;
    }

    .section {
      margin-bottom: 18px;
      padding-bottom: 16px;
      border-bottom: 1px solid var(--linea);
    }

    .section h2 {
      font-size: 14px;
      margin: 0 0 10px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: .08em;
    }

    .btn-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }

    button, select, input, textarea {
      font: inherit;
    }

    .btn {
      border: 1px solid var(--linea);
      background: #fff;
      border-radius: 10px;
      padding: 10px 12px;
      cursor: pointer;
      transition: .15s ease;
    }

    .btn:hover { border-color: var(--acento); }

    .btn.active {
      background: #eff6ff;
      border-color: var(--acento);
      color: var(--acento);
      font-weight: bold;
    }

    .btn.primary {
      background: var(--acento);
      color: white;
      border-color: var(--acento);
    }

    .btn.success {
      background: var(--ok);
      color: white;
      border-color: var(--ok);
    }

    .btn.danger {
      background: var(--peligro);
      color: white;
      border-color: var(--peligro);
    }

    .row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin-top: 8px;
    }

    .full {
      width: 100%;
      margin-top: 8px;
    }

    .hint {
      color: var(--muted);
      font-size: 13px;
      line-height: 1.4;
    }

    .canvas-wrap {
      position: relative;
      overflow: auto;
      background:
        linear-gradient(to right, rgba(37,99,235,.06) 1px, transparent 1px) 0 0 / 24px 24px,
        linear-gradient(to bottom, rgba(37,99,235,.06) 1px, transparent 1px) 0 0 / 24px 24px,
        var(--lienzo);
    }

    .topbar {
      position: sticky;
      left: 12px;
      top: 12px;
      z-index: 30;
      width: max-content;
      margin: 12px;
      background: rgba(255,255,255,.95);
      border: 1px solid var(--linea);
      border-radius: 14px;
      padding: 8px;
      box-shadow: var(--sombra);
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
    }

    .toolbar-group {
      display: flex;
      align-items: center;
      gap: 6px;
      padding-right: 8px;
      margin-right: 4px;
      border-right: 1px solid var(--linea);
    }

    .toolbar-group:last-child {
      border-right: 0;
      padding-right: 0;
      margin-right: 0;
    }

    .icon-btn {
      width: 38px;
      height: 38px;
      border-radius: 10px;
      border: 1px solid var(--linea);
      background: white;
      cursor: pointer;
      font-size: 18px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: .15s ease;
    }

    .icon-btn:hover {
      border-color: var(--acento);
      background: #eff6ff;
    }

    .icon-btn.active {
      border-color: var(--acento);
      background: #eff6ff;
      color: var(--acento);
      font-weight: bold;
    }

    .status {
      font-size: 13px;
      color: var(--muted);
      margin-left: 4px;
    }

    .zoom-label {
      min-width: 54px;
      text-align: center;
      font-size: 13px;
      color: var(--muted);
      font-weight: bold;
    }

    .svg-space {
      position: relative;
      width: 5200px;
      height: 3600px;
    }

    svg {
      width: 100%;
      height: 100%;
      display: block;
      user-select: none;
      -webkit-user-select: none;
      overflow: visible;
    }

    .grupo-figura { cursor: move; }

    .grupo-figura.selected .main-shape,
    .grupo-figura.selected .shape-body,
    .grupo-figura.multi-selected .main-shape,
    .grupo-figura.multi-selected .shape-body,
    .connection.selected .conn-line,
    .connection.selected .conn-hit {
      stroke: var(--acento) !important;
      stroke-width: 2.8;
    }

    .entity .shape-body {
      fill: #e0f2fe;;
      stroke: #111827;
      stroke-width: 2;
    }

    .relationship .shape-body {
      fill: #fffef2;
      stroke: #92400e;
      stroke-width: 2;
    }

    .specialization .shape-body {
      fill: #f5f3ff;
      stroke: #5b21b6;
      stroke-width: 2;
    }

    .title-text {
      font-weight: bold;
      font-size: 16px;
    }

    .attr-text {
      font-size: 14px;
    }

    .text-block .shape-body {
      fill: #ffffff;
      stroke: #9ca3af;
      stroke-width: 1.2;
    }

    .text-content {
      font-size: 24px;
      fill: #111827;
      dominant-baseline: hanging;
      white-space: pre;
      user-select: none;
      -webkit-user-select: none;
    }

    .conn-line {
      stroke: #111827;
      stroke-width: 2;
      fill: none;
    }

    .conn-hit {
      stroke: transparent;
      stroke-width: 16;
      fill: none;
      cursor: pointer;
    }

    .conn-label {
      font-size: 13px;
      fill: #111827;
      paint-order: stroke;
      stroke: white;
      stroke-width: 3px;
      stroke-linejoin: round;
    }

    .ovalo-atributo-externo {
      fill: #ffffff;
      stroke: #374151;
      stroke-width: 1.8;
    }

    .linea-atributo-externo {
      stroke: #374151;
      stroke-width: 1.5;
      fill: none;
    }


    .grupo-atributo-externo.selected .ovalo-atributo-externo {
      stroke: var(--acento) !important;
      stroke-width: 2.8 !important;
    }

    .grupo-atributo-externo.selected .attr-text {
      fill: var(--acento) !important;
      font-weight: bold;
    }

    .panel-box {
      border: 1px solid var(--linea);
      border-radius: 12px;
      padding: 10px;
      background: #fafcff;
    }

    .panel-box label {
      display: block;
      font-size: 13px;
      margin-bottom: 6px;
      color: var(--muted);
    }

    .panel-box input,
    .panel-box textarea,
    .panel-box select {
      width: 100%;
      border: 1px solid var(--linea);
      border-radius: 8px;
      padding: 8px;
      margin-bottom: 8px;
      background: white;
    }

    .small {
      font-size: 12px;
      color: var(--muted);
    }

    .list {
      max-height: 160px;
      overflow: auto;
      border: 1px solid var(--linea);
      background: white;
      border-radius: 8px;
      padding: 6px;
    }

    .list-item {
      padding: 6px 8px;
      border-radius: 8px;
      cursor: pointer;
      font-size: 14px;
    }

    .list-item:hover,
    .list-item.active {
      background: #eff6ff;
      color: var(--acento);
    }

    .subcard {
      border: 1px solid var(--linea);
      border-radius: 10px;
      padding: 8px;
      margin-bottom: 8px;
      background: white;
    }

    .subcard-title {
      font-size: 13px;
      font-weight: bold;
      margin-bottom: 6px;
    }

    .mini-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }

    .creditos {
      margin-top: 28px;
      padding-top: 16px;
      border-top: 1px solid var(--linea);
      text-align: center;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.6;
    }

    .creditos .tarjeta-creditos {
      border: 1px solid var(--linea);
      border-radius: 12px;
      background: #fafcff;
      padding: 14px 10px;
    }

    .creditos .titulo { color: var(--muted); }
    .creditos .version { letter-spacing: .04em; color: var(--muted); }
    .creditos .autor { font-weight: bold; color: var(--texto); }
    .creditos .correo { color: var(--muted); }
  
    .help-modal.hidden {
  display: none;
}

.help-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
}

.help-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.help-modal-dialog {
  position: relative;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  margin: 20px auto;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.help-modal-header h2 {
  margin: 0;
  font-size: 20px;
  color: #111827;
}

.help-modal-close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  color: #374151;
  padding: 6px;
  border-radius: 8px;
}

.help-modal-close:hover {
  background: #e5e7eb;
}

.help-modal-body {
  padding: 20px;
  overflow: auto;
  color: #111827;
  line-height: 1.55;
}

.help-modal-body p {
  margin: 0 0 14px 0;
}

.help-modal-body ul {
  margin: 0 0 14px 20px;
  padding: 0;
}

.help-modal-body li {
  margin-bottom: 6px;
}

.help-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #e5e7eb;
  background: #f8fafc;
}

.hidden {
  display: none !important;
}


/* HEADER */
.attr-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
}

/* TARJETA */
.attr-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
}

/* FILAS */
.attr-row-top {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 6px;
  margin-bottom: 6px;
}

.attr-row-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* INPUT */
.attr-input {
  width: 100%;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
}

/* SELECT */
.attr-select {
  width: 100%;
  border-radius: 6px;
}

/* META INFO */
.attr-meta {
  font-size: 11px;
  color: #64748b;
}

/* ACCIONES */
.attr-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* PK */
.attr-pk {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
}

/* BOTONES */
.btn.icon {
  min-width: 28px;
  padding: 2px 4px;
}

.btn.small {
  padding: 2px 6px;
}





    .inline-rename-editor {
      position: fixed;
      z-index: 2000;
      pointer-events: auto;
    }

    .inline-rename-input {
      width: 100%;
      min-height: 42px;
      padding: 10px 12px;
      border-radius: 12px;
      border: 2px solid var(--acento);
      background: rgba(255,255,255,.98);
      box-shadow: 0 12px 28px rgba(37,99,235,.18);
      color: var(--texto);
      outline: none;
      resize: both;
    }

    textarea.inline-rename-input {
      min-height: 88px;
      line-height: 1.35;
      resize: both;
    }

.rename-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(15, 23, 42, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.rename-modal-dialog {
  width: min(460px, calc(100vw - 32px));
  max-width: 100%;
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.rename-modal-header,
.rename-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.rename-modal-header {
  border-bottom: 1px solid #e5e7eb;
}

.rename-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--texto);
}

.rename-modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  font-size: 16px;
}

.rename-modal-close:hover {
  background: #f8fafc;
}

.rename-modal-body {
  padding: 16px;
}

.rename-modal-hint {
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.rename-modal-input {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid #bfdbfe;
  background: #fff;
  color: var(--texto);
  outline: none;
  font-size: 15px;
  box-sizing: border-box;
}

.rename-modal-input:focus {
  border-color: var(--acento);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

textarea.rename-modal-input {
  min-height: 120px;
  resize: vertical;
  line-height: 1.4;
}

.rename-modal-footer {
  justify-content: flex-end;
  border-top: 1px solid #e5e7eb;
}
