: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; }
.sidebar { width: 300px; background: #0f1520; color: #e8edf5; display: flex; flex-direction: column; padding: 0; border-right: 1px solid rgba(255,255,255,0.06); overflow-y: auto; }
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar-brand-badge { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; background: rgba(16,185,129,0.10); color: #34d399; border: 1px solid rgba(52,211,153,0.18); border-radius: 20px; padding: 3px 8px; font-size: 10px; font-weight: 600; flex-shrink: 0; }
.badge-dot { width: 5px; height: 5px; border-radius: 50%; background: #34d399; flex-shrink: 0; }
.section { margin-bottom: 0; padding: 14px 14px 0; }
.section:last-of-type { padding-bottom: 14px; }
.section h2 { font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; color: #7a8fa3; font-weight: 700; margin: 0 0 9px; display: flex; align-items: center; gap: 7px; }
.section h2::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.07); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.hint { font-size: 11px; color: #7a8fa3; margin-top: 6px; line-height: 1.7; }
.hint b { color: #93c5fd; }
.btn { background: rgba(255,255,255,0.06); color: #dde5f0; border: 1px solid rgba(255,255,255,0.10); padding: 9px 10px; border-radius: 8px; font-size: 12px; cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s; text-align: center; font-family: inherit; }
.btn:hover { background: rgba(255,255,255,0.11); border-color: rgba(255,255,255,0.18); color: #ffffff; transform: translateY(-1px); }
.btn.active { background: rgba(37,99,235,0.28); border-color: rgba(59,130,246,0.55); color: #93c5fd; font-weight: 700; box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
.btn.primary { background: rgba(37,99,235,0.22); color: #93c5fd; border-color: rgba(59,130,246,0.35); font-weight: 600; }
.btn.primary:hover { background: rgba(37,99,235,0.35); border-color: rgba(59,130,246,0.55); color: #bfdbfe; }
.btn.danger { background: rgba(220,38,38,0.14); color: #fca5a5; border-color: rgba(248,113,113,0.25); }
.btn.danger:hover { background: rgba(220,38,38,0.26); border-color: rgba(248,113,113,0.45); color: #fecaca; }
.btn.success { background: rgba(82,172,72,0.28); border-color: rgba(134,237,165,0.55); color: #bbf7d0; font-weight: 600; }
.btn.success:hover { background: rgba(82,172,72,0.42); border-color: rgba(134,237,165,0.75); color: #dcfce7; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.btn.full { width: 100%; margin-top: 10px; }
.panel-box { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); border-radius: 6px; padding: 9px; }
.panel-box label { display: block; font-size: 10px; color: #7a8fa3; margin: 6px 0 3px; font-weight: 500; }
.panel-box label:first-child { margin-top: 0; }
.panel-box input, .panel-box select, .panel-box textarea { width: 100%; background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.1); color: #e8edf5; padding: 5px 7px; font-size: 11px; border-radius: 4px; font-family: ui-monospace, Menlo, monospace; }
.panel-box input:focus, .panel-box select:focus, .panel-box textarea:focus { outline: none; border-color: #60a5fa; }
.panel-box .label-checkbox { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #cbd5e1; margin-top: 6px; }
.panel-box .label-checkbox input { width: auto; margin: 0; }
.panel-box .small { font-size: 10px; color: #7a8fa3; }
.canvas-wrap { position: relative; background: var(--fondo); overflow: auto; min-width: 0; }
.canvas-area { padding: 12px; background: #f8fafc; background-image: linear-gradient(rgba(37,99,235,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(37,99,235,0.04) 1px, transparent 1px); background-size: 20px 20px; transform-origin: 0 0; min-height: calc(100vh - 90px); }
.phase-row { margin-bottom: 14px; padding: 10px; border-radius: 8px; background: rgba(255,255,255,0.65); border: 1px solid rgba(0,0,0,0.06); min-height: 80px; }
.phase-row.active-phase { background: rgba(255,255,255,0.95); border-color: rgba(96,165,250,0.5); box-shadow: 0 0 0 2px rgba(96,165,250,0.13); }
.phase-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.phase-label { font-size: 10px; color: #fff; background: #475569; padding: 3px 9px; border-radius: 4px; font-weight: 600; letter-spacing: 0.5px; }
.phase-row.active-phase .phase-label { background: #2563eb; }
.phase-count { font-size: 10px; color: #64748b; }
.phase-tables { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; min-height: 40px; }
.phase-tables.dragover { outline: 2px dashed rgba(96,165,250,0.5); outline-offset: -3px; background: rgba(96,165,250,0.05); border-radius: 6px; }
.tbl-outer { width: 168px; background: rgba(37,99,235,0.13); border: 1px solid #60a5fa; border-radius: 6px; overflow: hidden; cursor: pointer; transition: box-shadow 0.12s, border-color 0.12s; user-select: none; resize: horizontal; min-width: 100px; max-width: 800px; }
.tbl-outer.tbl-universal { width: 540px; max-width: 900px; }
.tbl-outer:hover { box-shadow: 0 2px 8px rgba(37,99,235,0.18); }
.tbl-outer.selected { border-color: #f59e0b; border-width: 1.5px; box-shadow: 0 0 0 2px rgba(245,158,11,0.22); }
.tbl-outer.dragover { border-color: #34d399; border-width: 1.5px; box-shadow: 0 0 0 2px rgba(52,211,153,0.3); }
.tbl-head { background: rgba(37,99,235,0.42); padding: 5px 9px; color: #fff; font-weight: 600; font-size: 12px; font-family: ui-monospace, Menlo, monospace; }
.tbl-head-draggable { cursor: grab; }
.tbl-head-draggable:active, .tbl-head.dragging { cursor: grabbing; }
.tbl-head.dragging { opacity: 0.5; }
.tbl-fields { padding: 3px 0; }
.tbl-field { display: grid; grid-template-columns: 32px 1fr; align-items: center; gap: 0; padding: 2px 8px; min-height: 22px; cursor: grab; font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: #1e293b; border-top: 0.5px solid rgba(255,255,255,0.5); }
.tbl-field.with-desc { grid-template-columns: 32px 150px 1fr; align-items: center; padding: 5px 8px; cursor: grab; }
.tbl-field.with-desc .tbl-field-badge { grid-column: 1; }
.tbl-field.with-desc .tbl-field-name { grid-column: 2; border-right: 0.5px solid rgba(0,0,0,0.08); padding-right: 8px; margin-right: 8px; }
.tbl-field-desc-line { grid-column: 3; font-family: Arial, Helvetica, sans-serif; font-size: 11px; color: #475569; font-style: italic; line-height: 1.35; white-space: normal; word-wrap: break-word; }
.tbl-field:first-child { border-top: 0; }
.tbl-field:hover { background: rgba(255,255,255,0.4); }
.tbl-field.dragging { opacity: 0.4; }
.tbl-field.pk-field .tbl-field-name { font-weight: 600; }
.tbl-field-badge { display: flex; gap: 2px; align-items: center; }
.tbl-field-name { padding: 0 4px; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl-field-mark { display: inline-block; margin-left: 4px; font-size: 12px; font-weight: 700; cursor: help; vertical-align: middle; line-height: 1; }
.tbl-field-mark.mark-cons { color: #2563eb; font-size: 13px; }
.tbl-field-mark.mark-uniq { color: #b45309; }
.tbl-field-mark.mark-desc { color: #64748b; font-weight: 400; font-size: 12px; }
.badge { font-size: 8px; font-weight: 700; padding: 1px 3px; border-radius: 2px; font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.3px; }
.badge-pk { background: #fef3c7; color: #92400e; }
.badge-fk { background: #d1fae5; color: #065f46; }
.tbl-empty { padding: 10px 9px; text-align: center; font-size: 10px; color: #64748b; font-style: italic; }
.phase-body-row { display: flex; gap: 16px; align-items: flex-start; }
.phase-row[data-phase="universal"] .phase-tables { flex: 0 0 auto; }
.phase-extras { flex: 1 1 auto; display: flex; flex-direction: row; gap: 12px; align-items: flex-start; min-width: 0; }
.extras-section { background: #ffffff; border: 1px solid #cbd5e1; border-radius: 8px; padding: 12px 12px 10px; box-shadow: 0 1px 2px rgba(15,23,42,0.04); resize: horizontal; overflow: hidden; min-width: 200px; max-width: 600px; flex: 0 0 auto; }
.extras-section.section-entities { width: 240px; }
.extras-section.section-relations { width: 380px; }
.extras-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.extras-head h3 { margin: 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: #475569; }
.extras-add-btn { background: #2563eb; color: #fff; border: none; width: 22px; height: 22px; border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; font-family: inherit; }
.extras-add-btn:hover { background: #1d4ed8; }
.extras-hint { font-size: 10.5px; color: #64748b; font-style: italic; margin-bottom: 8px; line-height: 1.4; }
.extras-section.dragover { border-color: #2563eb; border-style: dashed; background: #eff6ff; }
.entities-list, .relations-list { display: flex; flex-direction: column; gap: 4px; min-height: 12px; }
.extras-empty { font-size: 10.5px; color: #94a3b8; font-style: italic; text-align: center; padding: 6px 0; }
.entity-item { display: flex; align-items: center; justify-content: space-between; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 6px; padding: 5px 8px 5px 10px; font-size: 12px; color: #1e293b; cursor: grab; transition: background 0.12s, border-color 0.12s; user-select: none; }
.entity-item:hover { background: #e2e8f0; border-color: #cbd5e1; }
.entity-item.dragging { opacity: 0.4; }
.entity-item .entity-name { font-weight: 500; }
.entity-item .entity-del, .relation-item .rel-del { background: transparent; border: none; cursor: pointer; color: #94a3b8; font-size: 13px; padding: 2px 4px; border-radius: 3px; line-height: 1; font-family: inherit; }
.entity-item .entity-del:hover, .relation-item .rel-del:hover { color: #dc2626; background: rgba(220,38,38,0.08); }
.relation-builder { display: flex; align-items: center; gap: 4px; padding: 6px; margin-bottom: 8px; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 6px; }
.rel-slot { flex: 1 1 0; min-width: 0; min-height: 26px; padding: 4px 6px; background: #ffffff; border: 1px dashed #cbd5e1; border-radius: 4px; font-size: 11px; display: flex; align-items: center; justify-content: center; gap: 2px; cursor: pointer; text-align: center; font-family: ui-monospace, Menlo, monospace; color: #1e293b; }
.rel-slot.dragover { background: #eff6ff; border-color: #2563eb; border-style: solid; }
.rel-slot.filled { background: #f1f5f9; border-style: solid; font-weight: 600; }
.rel-slot-placeholder { color: #94a3b8; font-style: italic; font-family: Arial, sans-serif; }
.rel-slot-name { flex: 1 1 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.rel-slot-clear { background: transparent; border: none; color: #94a3b8; cursor: pointer; font-size: 12px; padding: 0 2px; font-family: inherit; line-height: 1; flex-shrink: 0; }
.rel-slot-clear:hover { color: #dc2626; }
.rel-card-toggle { display: flex; border: 1px solid #cbd5e1; border-radius: 4px; overflow: hidden; flex-shrink: 0; }
.rel-card-btn { background: #fff; border: none; padding: 4px 6px; font-size: 10px; font-weight: 700; cursor: pointer; color: #475569; font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.3px; }
.rel-card-btn:hover { background: #e2e8f0; }
.rel-card-btn.active[data-card="1:1"], .rel-card-btn.active[data-card="1:N"] { background: #2563eb; color: white; }
.rel-add-btn { background: #2563eb; color: white; border: none; width: 26px; height: 26px; border-radius: 4px; font-size: 14px; line-height: 1; cursor: pointer; flex-shrink: 0; font-family: inherit; }
.rel-add-btn:hover:not(:disabled) { background: #1d4ed8; }
.rel-add-btn:disabled { background: #cbd5e1; cursor: not-allowed; color: #94a3b8; }
.relation-item { display: flex; align-items: center; justify-content: space-between; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 6px; padding: 5px 6px 5px 10px; font-size: 12px; color: #1e293b; cursor: pointer; transition: background 0.12s, border-color 0.12s; font-family: ui-monospace, Menlo, monospace; }
.relation-item:hover { background: #e2e8f0; border-color: #cbd5e1; }
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.4); display: flex; align-items: center; justify-content: center; z-index: 3000; }
.modal-overlay.hidden { display: none; }
.modal-dialog { width: min(460px, calc(100vw - 32px)); background: #fff; color: var(--texto); border: 1px solid #dbe4f0; border-radius: 16px; box-shadow: 0 20px 60px rgba(15,23,42,0.22); overflow: hidden; }
.modal-header { padding: 14px 16px; border-bottom: 1px solid #e5e7eb; display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 16px; font-weight: 700; color: var(--texto); }
.modal-close { width: 32px; height: 32px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; cursor: pointer; font-size: 15px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; color: #374151; }
.modal-close:hover { background: #f8fafc; }
.modal-body { padding: 16px; font-size: 13px; color: var(--texto); }
.modal-body label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; font-weight: 500; }
.modal-body label:first-child { margin-top: 0; }
.modal-body input, .modal-body select, .modal-body textarea { width: 100%; background: #fff; border: 1.5px solid #bfdbfe; color: var(--texto); padding: 8px 10px; font-size: 13px; border-radius: 8px; outline: none; margin-bottom: 4px; box-sizing: border-box; font-family: inherit; transition: border-color 0.12s, box-shadow 0.12s; }
.modal-body textarea { font-family: inherit; resize: vertical; min-height: 60px; }
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus { border-color: var(--acento); box-shadow: 0 0 0 3px rgba(37,99,235,0.10); }
.modal-body .label-checkbox { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #555; margin-top: 10px; cursor: pointer; font-weight: 400; }
.modal-body .label-checkbox input { width: auto; margin: 0; accent-color: var(--acento); }
.modal-body .small { font-size: 11px; color: var(--muted); }
.modal-footer { padding: 12px 16px; border-top: 1px solid #e5e7eb; display: flex; justify-content: flex-end; gap: 8px; }
.modal-btn { padding: 7px 18px; font-size: 12px; font-weight: 600; border-radius: 8px; cursor: pointer; font-family: inherit; border: 1px solid #d1d5db; background: transparent; color: #555; transition: background 0.12s, border-color 0.12s; }
.modal-btn:hover { background: #f5f5f5; }
.modal-btn.ok { background: var(--acento); border-color: var(--acento); color: #fff; }
.modal-btn.ok:hover { background: #1d4ed8; border-color: #1d4ed8; }
.help-modal { position: fixed; inset: 0; z-index: 3000; }
.help-modal.hidden { display: none; }
.help-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.help-modal-dialog { position: relative; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 40px); margin: 20px auto; background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(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; font-weight: 700; }
.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; font-size: 13px; }
.help-modal-body p { margin: 0 0 14px; }
.help-modal-body ul { margin: 0 0 14px 20px; padding: 0; }
.help-modal-body li { margin-bottom: 6px; }
.help-modal-body strong { color: #111827; font-weight: 700; }
.help-modal-body em { color: #2563eb; font-style: italic; }
.help-modal-body h3 { margin: 18px 0 8px; font-size: 14px; color: #111827; font-weight: 700; }
.help-modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid #e5e7eb; background: #f8fafc; }
.field-list-row { display: flex; align-items: center; gap: 4px; padding: 4px 2px; border-bottom: 0.5px solid rgba(255,255,255,0.06); }
.field-list-row:last-child { border-bottom: none; }
.field-list-row .field-name { flex: 1; font-size: 11px; color: #e8edf5; font-family: ui-monospace, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-icon-btn { background: transparent; border: none; cursor: pointer; color: #7a8fa3; font-size: 11px; padding: 0 3px; flex-shrink: 0; }
.field-icon-btn:hover { color: #e8edf5; }
.field-icon-btn.danger:hover { color: #f87171; }
.help-modal-dialog.testdata-dialog { width: min(1280px, calc(100vw - 32px)); max-height: calc(100vh - 40px); }
#testDataModal .help-modal-header { padding: 12px 18px; background: #f8fafc; }
#testDataModal .help-modal-header h2 { font-size: 15px; font-weight: 500; color: #1f2937; }
#testDataBody { padding: 18px; overflow: auto; background: #fff; }
#testDataUniversalTable input.td-cell:focus { background: #eff6ff !important; box-shadow: inset 0 0 0 1.5px #2563eb; }
#testDataUniversalTable .td-del:hover { color: #dc2626 !important; }
#td-add-row:hover { background: #f1f5f9 !important; color: #475569 !important; }
#testDataBody .td-toggle-excl:hover { opacity: 1 !important; background: rgba(30,58,138,0.10) !important; border-radius: 3px; }
.sidebar { width: 264px !important; background: #053a61 !important; color: #cfe6f5 !important; border-right: 1px solid rgba(0,192,243,.14) !important; transition: width .2s ease; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(0,192,243,.18) !important; }
.sidebar-brand-badge { background: rgba(0,192,243,.12) !important; color: #7fd6f5 !important; border-color: rgba(0,192,243,.22) !important; }
.badge-dot { background: #00c0f3 !important; }
.section h2 { color: #5d8fb3 !important; }
.section h2::after { background: rgba(0,192,243,.14) !important; }
.btn { background: rgba(0,192,243,.07) !important; color: #dbeaf6 !important; border-color: rgba(0,192,243,.16) !important; }
.btn:hover { background: rgba(0,192,243,.14) !important; border-color: rgba(0,192,243,.32) !important; color: #fff !important; }
.btn.active { background: rgba(0,192,243,.20) !important; border-color: rgba(0,192,243,.55) !important; color: #fff !important; }
.btn.danger { background: rgba(178,58,46,.20) !important; color: #f4b9b3 !important; border-color: rgba(178,58,46,.4) !important; }
.btn.danger:hover { background: rgba(178,58,46,.35) !important; color: #fff !important; }
.btn.primary { background: rgba(0,93,164,.32) !important; color: #dcefff !important; border-color: rgba(0,93,164,.5) !important; }
.btn.primary:hover { background: rgba(0,93,164,.46) !important; color: #fff !important; }
.btn.success { background: rgba(63,154,64,.24) !important; color: #cdeccd !important; border-color: rgba(63,154,64,.45) !important; }
.btn.success:hover { background: rgba(63,154,64,.4) !important; color: #fff !important; }
.panel-box { background: rgba(0,192,243,.05) !important; border-color: rgba(0,192,243,.12) !important; }
.small, .hint { color: #8fb2c9 !important; }
.hint b { color: #7fd6f5 !important; }
.sidebar input:not([type="checkbox"]), .sidebar select, .sidebar textarea { background: rgba(0,192,243,.06) !important; color: #eaf6ff !important; border-color: rgba(0,192,243,.18) !important; }
.sidebar input:not([type="checkbox"]):focus, .sidebar select:focus, .sidebar textarea:focus { border-color: rgba(0,192,243,.6) !important; box-shadow: 0 0 0 2px rgba(0,192,243,.18) !important; }
.sidebar select option { background: #0a2c48; color: #eaf6ff; }
.sidebar label { color: #8fb2c9 !important; }
.sidebar input[type="checkbox"] { accent-color: #00c0f3; }
.app { display: grid; grid-template-columns: auto 1fr; flex: 1; min-height: 0; height: auto; }
.app.sin-panel { grid-template-columns: 1fr; }
.app.sin-panel > .sidebar { display: none !important; }
.sidebar { height: 100%; }
.su-modo { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #5d8fb3; }
.su-modo .sidebar-brand-badge { margin-left: 0; text-transform: none; letter-spacing: normal; }
