: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); }
.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; }
.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.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.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-grid { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
.btn.full { width:100%; margin-top:10px; }
.row { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin-top:8px; }
.panel-box { background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.07); border-radius:10px; padding:11px; }
.sidebar input:not([type="checkbox"]), .sidebar select, .sidebar textarea { width:100%; margin-top:4px; margin-bottom:9px; padding:8px 10px; border-radius:7px; border:1px solid rgba(255,255,255,0.11); background:rgba(255,255,255,0.05); color:#e8edf5; font-size:12px; transition:border-color 0.15s, box-shadow 0.15s; }
.sidebar select option { background:#1a2233; color:#e8edf5; }
.sidebar input:not([type="checkbox"]):focus, .sidebar select:focus, .sidebar textarea:focus { outline:none; border-color:rgba(59,130,246,0.55); box-shadow:0 0 0 2px rgba(37,99,235,0.18); }
.sidebar input::placeholder { color:#4a5a6e; }
.sidebar label { display:block; font-size:11px; color:#8899aa; margin-bottom:2px; letter-spacing:0.2px; }
.label-checkbox { display:flex !important; align-items:center; gap:6px; font-size:12px !important; color:#aab8c8 !important; margin-bottom:4px !important; cursor:pointer; }
.sidebar input[type="checkbox"] { width:auto; margin:0; accent-color:#3b82f6; cursor:pointer; }
.small { font-size:11px; color:#7a8fa3; line-height:1.6; }
.hint { font-size:11px; color:#7a8fa3; margin-top:6px; line-height:1.7; }
.hint b { color:#93c5fd; }
.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); }
.svg-space { position:relative; width:5200px; height:3600px; margin-top:0; }
svg { width:100%; height:100%; display:block; user-select:none; overflow:visible; }
.tbl-outer { background:white; border-radius:8px; border:1.5px solid #bfdbfe; overflow:hidden; cursor:move; box-shadow:0 1px 5px rgba(37,99,235,.10); }
.tbl-outer.selected { border-color:#f59e0b; border-width:2.5px; box-shadow:0 0 0 3px rgba(245,158,11,.25); }
.tbl-outer.connecting-src { border-color:#059669; border-width:2px; box-shadow:0 0 0 3px rgba(5,150,105,.15); }
.tbl-head { padding:7px 11px 6px; font-size:12px; font-weight:700; color:#ffffff; background:#1d4ed8; cursor:move; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tbl-outer.selected       .tbl-head { background:#b45309; }
.tbl-outer.connecting-src .tbl-head { background:#059669; }
.tbl-field { display:grid; grid-template-columns:32px 1fr; align-items:center; gap:0; padding:2px 8px; border-top:0.5px solid #e8f0fe; cursor:pointer; min-height:22px; }
.tbl-field:hover { background:#eff6ff; }
.tbl-field.pk-field { color:#1e3a8a; font-weight:700; }
.tbl-field-badge { display:flex; align-items:center; gap:2px; }
.tbl-field-name { padding:0 4px; font-size:11px; color:#1e293b; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tbl-field.pk-field .tbl-field-name { color:#1e3a8a; font-weight:700; }
.badge { font-size:8px; font-weight:700; padding:1px 3px; border-radius:2px; flex-shrink:0; font-family:ui-monospace, Menlo, monospace; letter-spacing:0.3px; }
.badge-pk { background:#fef3c7; color:#92400e; }
.badge-fk { background:#d1fae5; color:#065f46; }
.tbl-add-field { padding:5px 10px; font-size:11px; color:#93c5fd; border-top:0.5px solid #e8f0fe; cursor:pointer; }
.tbl-add-field:hover { background:#eff6ff; color:#2563eb; }
.field-action { color:#cbd5e1; font-size:11px; cursor:pointer; padding-left:4px; flex-shrink:0; }
.field-action:hover { color:#2563eb; }
.field-action.danger:hover { color:#dc2626; }
.field-edit-row { display:flex; align-items:center; gap:4px; padding:3px 8px; border-top:0.5px solid #bfdbfe; background:#eff6ff; }
.field-edit-input { flex:1; font-size:11px; padding:2px 5px; border:1px solid #93c5fd; border-radius:4px; outline:none; min-width:0; }
.field-edit-lbl { display:flex; align-items:center; gap:2px; font-size:9px; color:#555; white-space:nowrap; cursor:pointer; }
.field-edit-check { accent-color:#2563eb; width:12px; height:12px; }
.field-edit-ok { background:#2563eb; color:white; border:none; border-radius:4px; font-size:10px; padding:2px 6px; cursor:pointer; }
.field-edit-cancel { background:transparent; color:#888; border:none; font-size:14px; cursor:pointer; padding:0 2px; }
.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(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; }
.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; }
.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; }
.modal-overlay { position:fixed; inset:0; z-index:3000; background:rgba(15,23,42,0.4); display:flex; align-items:center; justify-content:center; }
.modal-dialog { width:min(460px,calc(100vw - 32px)); background:#fff; border:1px solid #dbe4f0; border-radius:16px; box-shadow:0 20px 60px rgba(15,23,42,.22); overflow:hidden; }
.modal-header { display:flex; align-items:center; justify-content:space-between; padding:14px 16px; border-bottom:1px solid #e5e7eb; }
.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; }
.modal-close:hover { background:#f8fafc; }
.modal-body { padding:16px; }
.modal-label { display:block; font-size:12px; color:var(--muted); margin-bottom:4px; }
.modal-input, .modal-select { width:100%; padding:8px 10px; border-radius:8px; border:1.5px solid #bfdbfe; font-size:13px; outline:none; color:var(--texto); margin-bottom:10px; }
.modal-input:focus, .modal-select:focus { border-color:var(--acento); box-shadow:0 0 0 3px rgba(37,99,235,.1); }
.modal-checks { display:flex; gap:16px; margin-bottom:4px; }
.modal-check { display:flex; align-items:center; gap:5px; font-size:12px; color:#555; cursor:pointer; }
.modal-check input { accent-color:var(--acento); }
.modal-footer { display:flex; justify-content:flex-end; gap:8px; padding:12px 16px; border-top:1px solid #e5e7eb; }
.modal-btn { padding:7px 18px; border-radius:8px; font-size:12px; font-weight:600; cursor:pointer; border:1px solid transparent; }
.modal-btn.cancel { background:transparent; border-color:#d1d5db; color:#555; }
.modal-btn.cancel:hover { background:#f5f5f5; }
.modal-btn.ok { background:var(--acento); color:white; border-color:var(--acento); }
.modal-btn.ok:hover { background:#1d4ed8; }
.conn-info { font-size:10px; padding:4px 10px; color:#6b7280; background:#f0f9ff; border-top:0.5px solid #bae6fd; font-style:italic; }
.txt-selected .txt-bg { stroke: #2563eb !important; fill: rgba(239,246,255,0.3) !important; }
.tbl-resize { position:absolute; right:0; bottom:0; width:10px; height:10px; cursor:se-resize; background:transparent; }
.tbl-resize::after { content:''; position:absolute; right:2px; bottom:2px; width:6px; height:6px; border-right:2px solid #93c5fd; border-bottom:2px solid #93c5fd; border-radius:1px; }
.tbl-outer.selected .tbl-resize::after { border-color:#f59e0b; }
.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; }
.btn.sql { background:rgba(82, 172, 72, 0.28); border-color:rgba(134, 237, 165, 0.55); color:#93c5fd; font-weight:700; box-shadow:0 0 0 2px rgba(37,99,235,0.15); }
.tbl-field-tipo { padding:0 0 0 6px; font-size:10px; color:#475569; white-space:nowrap; font-style:italic; text-align:right; }
.tbl-field.pk-field .tbl-field-tipo { color:#1e40af; }
.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; }
body.h-fisico .tbl-field { display:grid; grid-template-columns:32px 1fr auto; align-items:center; gap:0; padding:2px 8px; border-top:0.5px solid #e8f0fe; cursor:pointer; min-height:22px; }
